<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hello,<br>
<br>
this is not trivial indexing, in fact some terms are linear
combination of v's components <br>
<br>
M1_v=[v(17)<br>
v(104)<br>
v(149)<br>
-(v(18)+v(63)+v(103))<br>
-(v(18)+v(63)+v(103))<br>
v(17)<br>
...<br>
v(104)<br>
v(149)<br>
]<br>
<br>
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.<br>
<br>
<br>
S.<br>
<br>
<br>
Le 24/04/2015 13:48, Samuel Gougeon a écrit :<br>
</div>
<blockquote cite="mid:553A2D7F.4080704@free.fr" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<div class="moz-cite-prefix">Le 24/04/2015 13:36, Samuel Gougeon a
écrit :<br>
</div>
<blockquote cite="mid:553A2AD2.1030106@free.fr" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<div class="moz-cite-prefix">Hello Stephane,<br>
<br>
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:<br>
</div>
</blockquote>
<br>
Actually, to be more accurate, the right comparative test is the
following:<br>
<br>
<pre style="font-family:Monospaced;font-style:normal;font-size:12.0;"><span style="color:rgb(176,24,19);">function</span> <span style="color:rgb(0,0,0);text-decoration:underline;">test2</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(0,0,0);">v</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(50,185,185);">rand</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">172</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(0,0,0);">p</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(50,185,185);">grand</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">839</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">unf</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">173</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(100,174,100);font-style:italic;">// Part 1: 1 call to v()</span>
<span style="color:rgb(174,92,176);text-decoration:underline;">tic</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(160,32,240);">for</span> <span style="color:rgb(0,0,0);">i</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(255,170,0);">:</span><span style="color:rgb(188,143,143);">1000</span>
<span style="color:rgb(0,0,0);">m1_v</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(0,0,0);">v</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">p</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(160,32,240);">end</span>
<span style="color:rgb(50,185,185);">disp</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(174,92,176);text-decoration:underline;">toc</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(100,174,100);font-style:italic;">// Part 2 : 839 calls to v()</span>
<span style="color:rgb(50,185,185);">deff</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">test3()</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">for i=1:1000, M1_v = [ </span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(50,185,185);">strcat</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">v(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(50,185,185);">string</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">p</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">+</span><span sty
le="col
or:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">) </span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">], end</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(174,92,176);text-decoration:underline;">tic</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(0,0,0);">test3</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(50,185,185);">disp</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(174,92,176);text-decoration:underline;">toc</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(176,24,19);">endfunction
</span></pre>
In this version, the compilation time used by execstr() is no
longer taken into account.<br>
<br>
The results are still explicit:<br>
-->test2()<br>
<br>
0.016 <br>
<br>
0.78 <br>
<br>
So, a speed-up by ~x 50<br>
<br>
Samuel<br>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>