[Scilab-users] sparse in Scilab 6.0.0

classic Classic list List threaded Threaded
6 messages Options
Taiji HAGIWARA Taiji HAGIWARA
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Scilab-users] sparse in Scilab 6.0.0

Dear all,

I have a question on "sparse" function in ver.6.0.0
Sparse function in ver.6.0.0 returns different answer compared to
ver.5.2.2.  I am using Scilab 6.0.0 on Windows 10 (64bit)

When we set same (i,j) factor twice or more,
ie.
ij=[i1,j1;
     i1,j1]
v=[a1;
     a2]

Scilab 5.5.2 used to return the sum of corresponding value, a1+a2.
But Scilab 6.0.0 now returns the last entry, a2.

Is it a bug?
Otherwise, is it a intended revision?

[example]
ij=[1,2;1,2];v =[1;2];sp=sparse(ij,v)

--------------------------
[Scilab 5.5.2]
--------------------------
-->sp=sparse(ij,v)
  sp  =
(    1,    2) sparse matrix
(    1,    2)        3.                      <---1+2

--------------------------
[Scilab 6.6.0]
--------------------------
--> sp=sparse(ij,v)
  sp  =
(  1,  2) sparse matrix
(  1,  2)      2.                            <--- 2 only. 1 is ignored


--
萩原泰治
神戸大学経済学研究科
〒657-8501 神戸市灘区六甲台町2-1

Taiji Hagiwara
Professor
Graduate School of Economics
Kobe University
2-1 Rokkodai, Nada, Kobe 657-8501, Japan
tel/fax +81-78-803-6848



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Pinçon Bruno Pinçon Bruno
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sparse in Scilab 6.0.0

Le 08/07/2017 à 04:13, Taiji HAGIWARA a écrit :

> Dear all,
>
> I have a question on "sparse" function in ver.6.0.0
> Sparse function in ver.6.0.0 returns different answer compared to
> ver.5.2.2.  I am using Scilab 6.0.0 on Windows 10 (64bit)
>
> When we set same (i,j) factor twice or more,
> ie.
> ij=[i1,j1;
>     i1,j1]
> v=[a1;
>     a2]
>
> Scilab 5.5.2 used to return the sum of corresponding value, a1+a2.
> But Scilab 6.0.0 now returns the last entry, a2.
>
> Is it a bug?
> Otherwise, is it a intended revision?

       Hi all,

     If it is the case, it's for sure a very bad idea : the sum feature
    of the sparse function is used to build finite element matrices fastly
    in those softwares (matlab like). At least the usual behavior could be
   changed by an additionnal option parameter (with the default set to
   get the old behavior).

    hth
   Bruno


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

Re: sparse in Scilab 6.0.0

Hello,

Sure, this is an UGLY regression which will break a lot of already written code. As far as I am concerned it definitely prevents the port of one of my contribs to 6.0...

S.

> Le 8 juil. 2017 à 10:00, Pinçon Bruno <[hidden email]> a écrit :
>
>> Le 08/07/2017 à 04:13, Taiji HAGIWARA a écrit :
>> Dear all,
>>
>> I have a question on "sparse" function in ver.6.0.0
>> Sparse function in ver.6.0.0 returns different answer compared to ver.5.2.2.  I am using Scilab 6.0.0 on Windows 10 (64bit)
>>
>> When we set same (i,j) factor twice or more,
>> ie.
>> ij=[i1,j1;
>>    i1,j1]
>> v=[a1;
>>    a2]
>>
>> Scilab 5.5.2 used to return the sum of corresponding value, a1+a2.
>> But Scilab 6.0.0 now returns the last entry, a2.
>>
>> Is it a bug?
>> Otherwise, is it a intended revision?
>
>      Hi all,
>
>    If it is the case, it's for sure a very bad idea : the sum feature
>   of the sparse function is used to build finite element matrices fastly
>   in those softwares (matlab like). At least the usual behavior could be
>  changed by an additionnal option parameter (with the default set to
>  get the old behavior).
>
>   hth
>  Bruno
>
>
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users

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

Re: sparse in Scilab 6.0.0

In reply to this post by Pinçon Bruno
Hi,

Le 08/07/2017 à 10:00, Pinçon Bruno a écrit :

> Le 08/07/2017 à 04:13, Taiji HAGIWARA a écrit :
>> Dear all,
>>
>> I have a question on "sparse" function in ver.6.0.0
>> Sparse function in ver.6.0.0 returns different answer compared to
>> ver.5.2.2.  I am using Scilab 6.0.0 on Windows 10 (64bit)
>>
>> When we set same (i,j) factor twice or more,
>> ie.
>> ij=[i1,j1;
>>     i1,j1]
>> v=[a1;
>>     a2]
>>
>> Scilab 5.5.2 used to return the sum of corresponding value, a1+a2.
>> But Scilab 6.0.0 now returns the last entry, a2.
>>
>> Is it a bug?
>> Otherwise, is it a intended revision?
>
>       Hi all,
>
>     If it is the case, it's for sure a very bad idea : the sum feature
>    of the sparse function is used to build finite element matrices fastly
>    in those softwares (matlab like). At least the usual behavior could be
>   changed by an additionnal option parameter (with the default set to
>   get the old behavior).

 From a general non-sparse and non-finite-element point of view, this
feature looks like a hack.
Now, it has never been documented in Scilab. Then, it was considered and
reported as a bug
@ http://bugzilla.scilab.org/7675
If apparently it needs to be restored, it clearly needs to be
documented, and actually asks
for an option. Could you -- Bruno and Stephane -- comment the report please?

Thanks.
Samuel

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

Re: sparse in Scilab 6.0.0

Please read the Matlab's help page for sparse at https://fr.mathworks.com/help/matlab/ref/sparse.html :

S = sparse(i,j,v) generates a sparse matrix S from the triplets i, j, and v such that S(i(k),j(k)) = v(k). The max(i)-by-max(j) output matrix has space allotted for length(v) nonzero elements. sparse adds together elements in v that have duplicate subscripts in i and j.

Scilab devs have always wanted to have no strings attached to Matlab conventions. Sometimes this has been a good idea, but here this is definitely not the case...

S.

Le 08/07/2017 à 19:09, Samuel Gougeon a écrit :
Hi,

Le 08/07/2017 à 10:00, Pinçon Bruno a écrit :
Le 08/07/2017 à 04:13, Taiji HAGIWARA a écrit :
Dear all,

I have a question on "sparse" function in ver.6.0.0
Sparse function in ver.6.0.0 returns different answer compared to ver.5.2.2.  I am using Scilab 6.0.0 on Windows 10 (64bit)

When we set same (i,j) factor twice or more,
ie.
ij=[i1,j1;
    i1,j1]
v=[a1;
    a2]

Scilab 5.5.2 used to return the sum of corresponding value, a1+a2.
But Scilab 6.0.0 now returns the last entry, a2.

Is it a bug?
Otherwise, is it a intended revision?

      Hi all,

    If it is the case, it's for sure a very bad idea : the sum feature
   of the sparse function is used to build finite element matrices fastly
   in those softwares (matlab like). At least the usual behavior could be
  changed by an additionnal option parameter (with the default set to
  get the old behavior).

From a general non-sparse and non-finite-element point of view, this feature looks like a hack.
Now, it has never been documented in Scilab. Then, it was considered and reported as a bug
@ http://bugzilla.scilab.org/7675
If apparently it needs to be restored, it clearly needs to be documented, and actually asks
for an option. Could you -- Bruno and Stephane -- comment the report please?

Thanks.
Samuel

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


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Pinçon Bruno Pinçon Bruno
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sparse in Scilab 6.0.0

In reply to this post by Samuel GOUGEON
Le 08/07/2017 à 19:09, Samuel Gougeon a écrit :

>
> From a general non-sparse and non-finite-element point of view, this
> feature looks like a hack.
> Now, it has never been documented in Scilab. Then, it was considered
> and reported as a bug
> @ http://bugzilla.scilab.org/7675
> If apparently it needs to be restored, it clearly needs to be
> documented, and actually asks
> for an option. Could you -- Bruno and Stephane -- comment the report
> please?

       Hi Samuel,

     I don't remind my login/pass so I will let Stephane do it.
    In fact there are several cases where this feature is useful
    (not only building fem matrices). I remember coding a 2d
    histogram (or something like that) in an efficient way thanks
    to it. It belongs to those special tricks in matlab-like softwares
    which make it possible to speed-up some algorithmic operations.
    I understand it looks quite strange the first time and I don't know
    why it iwas not documented...

    Bruno

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