[Scilab-Dev] empty sparse: sparse([]) vs sparse([],[],[0 0])

Stéphane Mottelet stephane.mottelet at utc.fr
Thu Jan 17 08:37:14 CET 2019


Hello Samuel,

I have initially voted for this behavior (sparse([]) == (  0,  0) zero 
sparse matrix ) but your remark on numerous occurences of "sparse([])" 
in scilab prevented to do so.

Please see https://codereview.scilab.org/#/c/20492/ and the discussion 
starting at Patch Set 8.

S.

Le 16/01/2019 à 22:49, Samuel Gougeon a écrit :
> Hello,
>
> In Scilab 5.5 and up to Scilab 6.0.1, there was no empty sparse. 
> Trying to build it yielded [] :
>
> --> sparse([])
>  ans  =
>      []
> --> sparse([],[],[0 0])
>  ans  =
>      []
>
> However, in the 6.0 branch, the second statement now creates an empty 
> sparse:
>
> --> sparse([],[],[0 0])
>  ans  =
> (  0,  0) zero sparse matrix
>
> while we still have
>
> --> sparse([])
>  ans  =
>      []
>
> I am wondering if this change is intentional, because it does not look 
> documented.
> I am not really able to assess the impact of this change.
> I have the feeling that it's rather useful to be able to have an empty 
> sparse. This enables the fact that, from a sparse, deletions -- 
> possibly down to empty -- and then further insertions can be done 
> without loosing the sparse encoding.
> However, i think that, if this is kept for Scilab 6.0.2, then still 
> getting [] out of sparse([]) instead of getting the empty sparse 
> becomes rather inconsistent and should be changed as well.
>
> Looking forward to reading you about this topic
>
> Samuel
>
>
>
> _______________________________________________
> dev mailing list
> dev at lists.scilab.org
> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/dev 
>



More information about the dev mailing list