Possible Bug when Adding Sparse and Diagonal Matrices

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

Possible Bug when Adding Sparse and Diagonal Matrices

by Sebastian Schöps :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear all,
I encountered today that there is a possible bug when adding sparse  
and diagonal matrices. Here is an example
A=5*sparse(eye(2))+sparse([1 2 2],[2 1 2],[-1 1 3]);
B=5*eye(2)+sparse([1 2 2],[2 1 2],[-1 1 3]);
full(A)-full(B) % gives [0 0; 0 0]
full(A-B) % gives [-5 0; 0 0]

Best regards,
Sebastian Schoeps

_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: Possible Bug when Adding Sparse and Diagonal Matrices

by Jaroslav Hajek-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/7/1 Sebastian Schöps <sebastian@...>:

> Dear all,
> I encountered today that there is a possible bug when adding sparse
> and diagonal matrices. Here is an example
> A=5*sparse(eye(2))+sparse([1 2 2],[2 1 2],[-1 1 3]);
> B=5*eye(2)+sparse([1 2 2],[2 1 2],[-1 1 3]);
> full(A)-full(B) % gives [0 0; 0 0]
> full(A-B) % gives [-5 0; 0 0]
>
> Best regards,
> Sebastian Schoeps
>

Please try the attached patch (will be in 3.2.1):
http://hg.savannah.gnu.org/hgweb/octave/rev/79c4dd83d07f

regards

--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz

_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: Possible Bug when Adding Sparse and Diagonal Matrices

by Sebastian Schöps :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks, it works now as expected.

> 2009/7/1 Sebastian Schöps <sebastian@...>:
>> Dear all,
>> I encountered today that there is a possible bug when adding sparse
>> and diagonal matrices. Here is an example
>> A=5*sparse(eye(2))+sparse([1 2 2],[2 1 2],[-1 1 3]);
>> B=5*eye(2)+sparse([1 2 2],[2 1 2],[-1 1 3]);
>> full(A)-full(B) % gives [0 0; 0 0]
>> full(A-B) % gives [-5 0; 0 0]
>>
>> Best regards,
>> Sebastian Schoeps
>>
>
> Please try the attached patch (will be in 3.2.1):
> http://hg.savannah.gnu.org/hgweb/octave/rev/79c4dd83d07f
>
> regards

_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave