sparse(speye(2), 1)

David Bateman adb014 at gmail.com
Wed Dec 12 13:04:36 CST 2007


Kim Hansen wrote:
> This looks like a bug:
> ===========================
> octave:8> sparse(speye (2),1)
> warning: implicit conversion from real sparse matrix to real scalar
> ans = Compressed Column Sparse (rows = 1, cols = 1, nnz = 0)
> 
> octave:9>
> ===========================
> 
> If I wanted to add tests in order to avoid these bugs to creep back
> into the code later, where should I put them?
> 

I'd say something like the attached is needed to address this. It
doesn't use is_scalar_type to check if the value is scalar, since as you
previously pointed out "sparse(sparse(1),1)" is legal.

D.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch2
Url: https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20071212/5513e1b3/attachment.ksh 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch2.changelog
Url: https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20071212/5513e1b3/attachment-0001.ksh 


More information about the Bug-octave mailing list