all() & sparse()

View: New views
2 Messages — Rating Filter:   Alert me  

all() & sparse()

by Jeremy Reynolds :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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?

Re: all() & sparse()

by Jaroslav Hajek-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Jul 2, 2009 at 8:06 AM, Jeremy
Reynolds<jeremy.r.reynolds@...> wrote:

>
> 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?
>

Please try
http://hg.savannah.gnu.org/hgweb/octave/rev/5d46c4a894e8

I've made this a last minute fix for 3.2.1.

thanks

--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave