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

Samuel Gougeon sgougeon at free.fr
Wed Jan 16 22:49:50 CET 2019


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






More information about the dev mailing list