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

Stéphane Mottelet stephane.mottelet at utc.fr
Tue Jan 22 18:06:12 CET 2019


Le 22/01/2019 à 17:58, Samuel Gougeon a écrit :
> Le 22/01/2019 à 17:56, Samuel Gougeon a écrit :
>> Le 22/01/2019 à 17:40, Stéphane Mottelet a écrit :
>>> Le 22/01/2019 à 17:06, Samuel Gougeon a écrit :
>>>> Le 22/01/2019 à 16:34, Stéphane Mottelet a écrit :
>>>>> Le 22/01/2019 à 16:25, Samuel Gougeon a écrit :
>>>>>> Hello Stéphane,
>>>>>>
>>>>>> Le 17/01/2019 à 08:37, Stéphane Mottelet a écrit :
>>>>>>> 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.
>>>>>>
>>>>>> Why? My remark aimed to bring the attention to existing 
>>>>>> occurrences and to prevent merging the commit without updating 
>>>>>> them, not to prevent updating them.
>>>>>> Then these occurrences changed your opinion and vote, not mine.
>>>>>>
>>>>>> Best regards
>>>>>> Samuel
>>>>>
>>>>> Please see comment #8:
>>>>>
>>>>> Anyway, *as bug #15758 is not related to sparse([]) being not 
>>>>> sparse*, and considered the numerous side effects, I will restore 
>>>>> sparse([]) == double empty matrix. *If you find necessary to have 
>>>>> sparse([]) == sparse empty matrix, please file a bug/whish on BZ.*
>>>>>
>>>>
>>>> Yes, and neither you -- that voted for it -- nor me did it.
>>>> And finally we agree: keeping sparse([])==[] was your decision.
>>>> Changing this could be done later if it proves to be better.
>>>> For the time being, the situation is the following:
>>>>
>>>> *Scilab 6.0.1*:
>>>> --> sparse([])
>>>>  ans  =
>>>>     []
>>>>
>>>> --> sparse([],[])
>>>>  ans  =
>>>> (  0,  0) zero sparse matrix
>>>>
>>>> --> sparse([],[],[0,2])
>>>>  ans  =
>>>>     []
>>>>
>>>> *Scilab 6.0.2-* after https://codereview.scilab.org/20492 :
>>>> --> sparse([])      // unchanged
>>>>  ans  =
>>>>     []
>>>>
>>>> --> sparse([],[])   // unchanged
>>>>  ans  =
>>>> (  0,  0) zero sparse matrix
>>>>
>>>> --> sparse([],[],[0,2])  // *CHANGED*
>>>>  ans  =
>>>> (  0,  0) zero sparse matrix
>>>>
>>>> while i don't think that this last change is intentional.
>>>
>>> it is. To me,
>>>
>>> sparse([],[]) <=> sparse([],[],[0,0]) by getting dims implicitely 
>>> defined in first two arguments (ij,v), so explicit size definition 
>>> in sparse([],[],[2,0]) should give the same output
>>>
>>
>> Yes
>>
>>> (2x0 == empty matrix);
>>>
>>
>> No. Since both other syntaxes yielded [], [] should be returned. What 
>> would make a consistent answer for *all* empty inputs.
>
> I mean: Changing
>
> --> sparse([],[])
>  ans  =
> (  0,  0) zero sparse matrix
>
> into
>
> --> sparse([],[])
>  ans  =
>    []

I do not agree. I will prepare a patch with sparse([]) == (0,0) zero 
sparse matrix for master and this time I will track all possible 
glitches. Every output of sparse(...), whatever the arguments, should be 
sparse, even if empty.

S.


>
>
> _______________________________________________
> dev mailing list
> dev at lists.scilab.org
> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/dev


-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/dev/attachments/20190122/ae3d29cb/attachment.htm>


More information about the dev mailing list