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

Stéphane Mottelet stephane.mottelet at utc.fr
Tue May 12 11:09:10 CEST 2015


Le 12/05/2015 10:30, Samuel Gougeon a écrit :
> Le 12/05/2015 10:14, Samuel Gougeon a écrit :
>> Le 12/05/2015 08:34, Stéphane Mottelet a écrit :
>>> .../...
>>>
>>> Le 11/05/2015 21:16, Samuel Gougeon a écrit :
>>>> .../...
>>>> I may miss something: how do you specify the position of terms to 
>>>> be set with the v content? Is A already set, and you just want to 
>>>> replace its nz terms? Is .nzval the "list" of positions (in such a 
>>>> way that we could read A(nzval) .= v , and then what is the 
>>>> equivalent with the spset(A,v)
>>> no, nzval is really the field name such that A.nzval has the value v 
>>> sucht that [ij,v]=spget(A). In Julia, the fields of a sparse matrix are
>>>
>>> julia> A.
>>> colptr m       n       nzval   rowval
>>>
>>> colptr and rowval give the indices for the classical column 
>>> compressed format. The nzval field is of read-write type so that the 
>>> non zero elements can be updated by "A.nzval=v" if v has the correct 
>>> size and corresponds to correctly ordered (column-wise) unique 
>>> (i(k),j(k),v(k)) pairs.
>>
>> 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 !

> There could be a convention: when v(i) is %nan, the existing value 
> could be unchanged and v(i) ignored.
> When v(i)==0, then A's length is automatically changed. This can make 
> forthcoming assignments very hazardous.
>
> Samuel
>
> _______________________________________________
> dev mailing list
> dev at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/dev


-- 
Département de Génie Informatique
EA 4297 Transformations Intégrées de la Matière Renouvelable
Université de Technologie de Compiègne -  CS 60319
60203 Compiègne cedex




More information about the dev mailing list