<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Le 19/06/2012 20:12, Eduardo Torrecillas a écrit :
<blockquote
cite="mid:CADqPe=u3Q9C9Hp=Nayb_RiQdDR8BNRKrshTi4aANfO3SRMdNEw@mail.gmail.com"
type="cite">Hi all,
<div><br>
</div>
<div>I am currently working on a huge optimization (impossible to
have it done on pure scilab), so my cost function is an external
fortran function. I've tried a few small examples and everything
is working fine (links, results, etc).</div>
<div><br>
</div>
<div>The external subroutine should be on the form:</div>
<div><br>
</div>
<div>
<pre class="scilabcode" style="margin-bottom:0px;margin-top:0px;overflow-x:auto;width:872px;word-wrap:break-word;color:rgb(51,51,51);font-size:13px;line-height:15px">
<span class="scilabid" style="color:rgb(0,0,0)">subroutine</span> <span class="scilabid" style="color:rgb(0,0,0)">costf</span><span class="scilabopenclose" style="color:rgb(74,85,219)">(</span><span class="scilabid" style="color:rgb(0,0,0)">ind</span><span class="scilabdefault" style="color:rgb(0,0,0)">,</span><span class="scilabid" style="color:rgb(0,0,0)">n</span><span class="scilabdefault" style="color:rgb(0,0,0)">,</span><span class="scilabid" style="color:rgb(0,0,0)">x</span><span class="scilabdefault" style="color:rgb(0,0,0)">,</span><span class="scilabid" style="color:rgb(0,0,0)">f</span><span class="scilabdefault" style="color:rgb(0,0,0)">,</span><span class="scilabid" style="color:rgb(0,0,0)">g</span><span class="scilabdefault" style="color:rgb(0,0,0)">,</span><span class="scilabid" style="color:rgb(0,0,0)">ti</span><span class="scilabdefault" style="color:rgb(0,0,0)">,</span><span class="scilabid" style="color:rgb(0,0,0)">tr</span><span class="scilabdefault" style="color:rgb
(0,0,0)">,</span><span class="scilabid" style="color:rgb(0,0,0)">td</span><span class="scilabopenclose" style="color:rgb(74,85,219)">)</span></pre>
</div>
<div><br>
</div>
<div>Then, I can call it via scilab, passing integer, real, or
double arguments (ti, tr, td, respectively). Unfortunately, I
couldn't find a way to pass text strings (if needed) and also
matrices. I have a cost function which should count on a huge
matrix (for example, dimension 10.000,3). Is there a way to pass
it via optim?</div>
<div><br>
</div>
<div>Best regards,<br>
-- <br>
</div>
<div>Eduardo Torrecillas</div>
</blockquote>
You can pass your huge matrix using td for the floating point
numbers and ti for the dimensions, The costf routine should then be
able to recover pointer on matrix data from td ans matrix dimension
from ti<br>
<br>
Serge Steer<br>
INRIA<br>
</body>
</html>