[Scilab-Dev] empty sparse: sparse([]) vs sparse([],[],[0 0])
Samuel Gougeon
sgougeon at free.fr
Tue Jan 22 17:56:47 CET 2019
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.
Samuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/dev/attachments/20190122/a9491641/attachment.htm>
More information about the dev
mailing list