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) 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

Reply via email to