[Scilab-users] Ways to speed up simple things in Scilab ?

Samuel Gougeon sgougeon at free.fr
Fri Apr 24 14:53:16 CEST 2015


Le 24/04/2015 14:34, Stéphane Mottelet a écrit :
> Hello,
>
> this is not trivial indexing, in fact some terms are linear 
> combination of v's components
>
> M1_v=[v(17)
> v(104)
> v(149)
> -(v(18)+v(63)+v(103))
> -(v(18)+v(63)+v(103))
> v(17)
> ...
> v(104)
> v(149)
> ]
>
> How do you take this into account in your proposed method ? These 
> combinations are sums of influxes in a metabolic network, and the code 
> is automatically generated.
In this way: from
1> M1_v=[v(17)
2> v(104)
3> v(149)
4> -(v(18)+v(63)+v(103))
5> -(v(18)+v(63)+v(103))
6> v(17)
...
838> v(104)
839> v(149)
]

set:
i   = [1 2 3 6 ... 838 839]
iv = [17 104 149 17 ... 104 149]
M1_v(i) = v(iv)
im = [4 5 ]     // or setdiff(1:839, i).
ivm = [18 18 ... ]
M1_v(im) = -v(ivm)

// + loop over the rank of elements in the linear combination
// + adapt according to the automatic generation of your code

Samuel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20150424/e49e5fef/attachment.htm>


More information about the users mailing list