x(:)=sparse(42) makes x sparse

David Bateman David.Bateman at motorola.com
Tue Dec 11 08:29:00 CST 2007


Kim Hansen wrote:
> I don't think this was meant to convert x to sparse:
>
> octave:1> x=zeros(2,2);
> octave:2> x(:)=sparse(42)
> x =
>
> Compressed Column Sparse (rows = 2, cols = 2, nnz = 4)
>
>   (1, 1) ->  42
>   (2, 1) ->  42
>   (1, 2) ->  42
>   (2, 2) ->  42
>
> octave:3> x=zeros(2,2,2);
> octave:4> x(:)=sparse(42)
> error: invalid conversion of NDArray to Matrix
> error: assignment failed, or no method for `matrix = sparse matrix'
> error: evaluating assignment expression near line 4, column 5
> octave:4>
>
>   
Ok, that should not happen apparently.. Please try the attached patch

D.


-- 
David Bateman                                David.Bateman at motorola.com
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch8
Url: https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20071211/e3205de3/attachment-0002.ksh 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch8.changelog
Url: https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20071211/e3205de3/attachment-0003.ksh 


More information about the Bug-octave mailing list