all() & sparse()

Jeremy Reynolds jeremy.r.reynolds at gmail.com
Thu Jul 2 01:06:07 CDT 2009


Hi all,

I'm curious if anyone else has noticed an odd behavior for the all()
function with sparse matrices. Basically, it appears to be broken for small
matrices (which I realize is atypical use for the use of sparse).

For example, just taking the simple case:

all([1 0]) returns 0 as it should, but
all(sparse([1 0])) also returns 1

This doesn't just apply to vectors, but also to matrices:
all([1 0; 1 0; 0 1;]) returns [0 0], and
all([1 0; 1 0; 0 1;],2) returns [0 0 0]', 
but:
all(sparse([1 0; 1 0; 0 1;])) returns [1 0]

(all(sparse([1 0; 1 0; 0 1;]),2) returns the appropriate column vector)

This is with octave 3.2, tested both with the mac OS X binary, as well as a
source install on a kubuntu box.

Am I just missing something, and has anyone else seen this behavior? 

-- 
View this message in context: http://www.nabble.com/all%28%29---sparse%28%29-tp24301687p24301687.html
Sent from the Octave - General mailing list archive at Nabble.com.



More information about the Help-octave mailing list