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.
S.
Le 24/04/2015 13:48, Samuel Gougeon a écrit :
Le 24/04/2015 13:36, Samuel Gougeon a écrit :
Hello Stephane,
You can speed up by a factor larger than 100 just by calling v once
(or 3 times) instead of ~1000, as shown by this test:
Actually, to be more accurate, the right comparative test is the
following:
function test2()
v = rand(172,1);
p = grand(1,839,"unf",1,173)
// Part 1: 1 call to v()
tic()
for i=1:1000
m1_v = v(p)
end
disp(toc())
// Part 2 : 839 calls to v()
deff("test3()", "for i=1:1000, M1_v = ["+strcat("v("+string(p)+")")+"],
end")
tic()
test3()
disp(toc())
endfunction
In this version, the compilation time used by execstr() is no longer
taken into account.
The results are still explicit:
-->test2()
0.016
0.78
So, a speed-up by ~x 50
Samuel
_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users