[Scilab-Dev] Question about sparse(ij,v,mn) internals

Samuel Gougeon sgougeon at free.fr
Tue May 12 12:01:42 CEST 2015


Le 12/05/2015 11:56, Samuel Gougeon a écrit :
> Le 12/05/2015 11:09, Stéphane Mottelet a écrit :
>> Le 12/05/2015 10:30, Samuel Gougeon a écrit :
>>>
>>>> OK. So, unless i misunderstand you, this syntax is used only to 
>>>> update values at their current positions, not to set new positions 
>>>> or modify ones.
>> exactly !
>
> Stephane,
> Could you report your wish on bugzilla? The patch to do S.nzval=v is 
> ready. I will post it on your report, with updated help pages.
Here is a sample:

-->sp0 = sprand(5,4,0.4); v = grand(1,nnz(sp0),"uin",0,10); sp = sp0;

-->sp.nzval = v;

-->full(sp0), v, full(sp),sp
  ans  =

     0.3439298    0.           0.0811258    0.9293860
     0.           0.7802274    0.3794188    0.
     0.6256186    0.           0.           0.4584969
     0.           0.6692851    0.           0.
     0.8157691    0.           0.           0.7757127
  v  =

     5.    9.    6.    0.    10.    5.    4.    0.    9.    3.
  ans  =

     5.    0.     5.    0.
     0.    0.     4.    0.
     9.    0.     0.    9.
     0.    10.    0.    0.
     6.    0.     0.    3.
  sp  =

(    5,    4) sparse matrix

(    1,    1)        5.
(    1,    3)        5.
(    2,    3)        4.
(    3,    1)        9.
(    3,    4)        9.
(    4,    2)        10.
(    5,    1)        6.
(    5,    4)        3.

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


More information about the dev mailing list