[Scilab-Dev] Question about sparse(ij,v,mn) internals
Samuel Gougeon
sgougeon at free.fr
Tue May 12 10:30:23 CEST 2015
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.
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
More information about the dev
mailing list