Hello Samuel,
Le 11/05/2015 21:16, Samuel Gougeon a écrit :
Hello Stéphane,
Le 11/05/2015 15:03, Stéphane Mottelet a écrit :
Hello Scilab devs/masters,
For performance purposes, i need to implement a function which is
missing to Scilab, allowing to set at once all non-zero terms of a
sparse matrix. Some other languages have this feature, e.g. Julia
allows to write such things.
A.nzval=v
of course this is interesting when the sparsity pattern does not
change but actual element values do. I noticed that the use of
"sparse" to reconstruct matrices in this context is the main
bottleneck of my code... In Scilab the logical name of such a command
should be "spset" and used like this
spset(A,v)
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.
S.
syntax (unless nzval -- that could rather be nzpos -- is implicit)?
Anyway, in a more general way, i agree that an element-wise
assignment operator would be very welcome, as well for lists, structs
and cells -- say heterogenous -- containers.
Whether
[A,B,C, D] = ("hello", %t, (1-%s)^2, list("bye", %pi) )
sets distributively A = "hello", B=%t, C = (1-%s)^2, D = list("bye", %pi)
yet,
L = list(); L(3) = "ok"
L(:) = ("hello", %t, (1-%s)^2) // does not work
A pity!
Regards
Samuel
_______________________________________________
dev mailing list
dev@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
_______________________________________________
dev mailing list
dev@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/dev