empty sparse: sparse([]) vs sparse([],[],[0 0])

classic Classic list List threaded Threaded
10 messages Options
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

empty sparse: sparse([]) vs sparse([],[],[0 0])

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
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
mottelet mottelet
Reply | Threaded
Open this post in threaded view
|

Re: empty sparse: sparse([]) vs sparse([],[],[0 0])

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
> [hidden email]
> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/dev 
>
_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: empty sparse: sparse([]) vs sparse([],[],[0 0])

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 https://codereview.scilab.org/#/c/20492/ and the discussion
> starting at Patch Set 8.
>
> S.

_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
mottelet mottelet
Reply | Threaded
Open this post in threaded view
|

Re: empty sparse: sparse([]) vs sparse([],[],[0 0])

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.

S.



Please see https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/codereview.scilab.org/#/c/20492/ and the discussion starting at Patch Set 8.

S.

_______________________________________________
dev mailing list
[hidden email]
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

_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: empty sparse: sparse([]) vs sparse([],[],[0 0])

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.
This is what Antoine is pointing to, in https://codereview.scilab.org/20612.

Samuel


_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
mottelet mottelet
Reply | Threaded
Open this post in threaded view
|

Re: empty sparse: sparse([]) vs sparse([],[],[0 0])

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 (2x0 == empty matrix);

S.

This is what Antoine is pointing to, in https://codereview.scilab.org/20612.

Samuel


_______________________________________________
dev mailing list
[hidden email]
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

_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: empty sparse: sparse([]) vs sparse([],[],[0 0])

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



_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: empty sparse: sparse([]) vs sparse([],[],[0 0])

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  =
   []


_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
mottelet mottelet
Reply | Threaded
Open this post in threaded view
|

Re: empty sparse: sparse([]) vs sparse([],[],[0 0])

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
[hidden email]
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

_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: empty sparse: sparse([]) vs sparse([],[],[0 0])

Le 22/01/2019 à 18:06, Stéphane Mottelet a écrit :
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.


This was the missing intention.
Thanks


_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev