<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hello Hermes,<br>
      <br>
      As stated in my first answer, the only actually valuable thing to
      do to shorten the execution time is<br>
      exec(SCI+"/modules/optimization/macros/numderivative.sci",-1)<br>
      before the first call to numderivative() (through ode(), in your
      case).<br>
      This will decrease the execution time by a factor of 2,33 (<b>105s</b>/45s,
      not 145/45. I made a mistake in my first answer).<br>
      <br>
      But this is not compatible with putting some "clear" instructions
      everywhere, as matlabers do.<br>
      Any "clear" clears the redefinition done with exec() and so
      cancels the gain in speed.<br>
      So if you are a "clear" addict, you should put it <i>before</i>
      the exec(). Otherwise, each call to numderivative() will use it
      from it library and take 105s (in all) instead of 45s.<br>
      <br>
      I never ever used "clear" (<all>) in my Scilab work for 20
      years. I don't need it in Scilab,<br>
      if it does not apply to some explicitly named variables.<br>
      <br>
      Except the execstr() => try/catch, other modifications =
      partial vectorization are somewhat some hacks,<br>
      and the gain is poor, and back-compatibility is of concern. This
      is why i did not attach them to my mail.<br>
      <br>
      It is possible to improve a lot the speed of numderivative() in
      the case of calling it for a whole set of points instead of only a
      single point as currently done. But this  would need to completely
      overhaul and likely rewrite the code. <br>
      But this will not be a big gain when calling it through ode(),
      because ode() calls the function with a scalar argument.<br>
      With a complete fine profiling, there is likely some room for
      internal optimization of the existing code, but for a marginal
      gain (IMO less than a factor ~1.4 in speed).<br>
      With 5.5.2, you can use add_profiling() and showprofile() to
      analyze the code efficiency, as i did. This will show you the
      parts of the code that take most of the execution time, so where
      to put your efforts to optimize it.<br>
      <br>
      Regards<br>
      Samuel<br>
      <br>
      Le 19/11/2017 à 16:44, Hermes a écrit :<br>
    </div>
    <blockquote cite="mid:1511106295399-0.post@n3.nabble.com"
      type="cite">
      <pre wrap="">Hi samuel,
Such good news! to be able to see completely:"Scilab users - Mailing Lists
Archives"

My questions to your answer. Thanks for them:
How can I reproduce this:
"Then, mainly, vectorizing the function to derive in order to accept x with
N columns instead of only 1, and changing numderivative () in order to be
able to work with this new vectorized profile, we get 29 s."

You can guide me with your answer, if possible with an example:
"Improving numderivative () in order to be fully able to work with
vectorized functions should be possible, but then: ...."
  regards

I would very much like to be able to master numderivative. You could guide
me to a website where I can read and study the vectorization in Scilab. I
still do not feel comfortable with it.
Hermes



--
Sent from: <a class="moz-txt-link-freetext" href="http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html">http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html</a>
_______________________________________________
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>
    <p><br>
    </p>
  </body>
</html>