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

Samuel Gougeon sgougeon at free.fr
Tue May 12 10:14:13 CEST 2015


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.
I guess that if v is too long, its extra values are ignored, and if it 
is too short, only the available values are reset. Aren't they? Or an 
error message is then emitted?





More information about the dev mailing list