incorrect sign when subtracting from sparse(0)
David Bateman
adb014 at gmail.com
Thu Jan 3 15:01:32 CST 2008
Thomas Kasper wrote:
> Bug report for Octave 3.0.0 configured for i686-pc-linux-gnu
>
> Description:
> -----------
>
> subtraction of a sparse matrix from a sparse scalar with value 0
> results in a wrong sign
>
> Repeat-By:
> ---------
>
> octave:1> sparse (0) - sparse (1)
> ans = Compressed Column Sparse (rows = 1, cols = 1, nnz = 1)
>
> (1, 1) -> 1
>
> % the same for a matrix-valued op2
> octave:2> s = sprand (4,1,.5)
> s =
>
> Compressed Column Sparse (rows = 4, cols = 1, nnz = 2)
>
> (2, 1) -> 0.96695
> (3, 1) -> 0.26477
>
> octave:3> sparse (0) - s
> ans =
>
> Compressed Column Sparse (rows = 4, cols = 1, nnz = 2)
>
> (2, 1) -> 0.96695
> (3, 1) -> 0.26477
>
I believe the attached patch should fix it, but have to do a complete
rebuild of Octave to check it..
D.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch4
Url: https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080103/d34f960f/attachment.ksh
More information about the Bug-octave
mailing list