<html dir="ltr"><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaTempEditStyle"></style><style title="owaParaStyle"><!--P {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
--></style>
</head>
<body ocsi="x">
<div style="FONT-FAMILY: Tahoma; DIRECTION: ltr; COLOR: #000000; FONT-SIZE: x-small">
<div></div>
<div dir="ltr"><font color="#000000" size="2" face="Tahoma">Hello,</font></div>
<div dir="ltr"><font face="tahoma"></font> </div>
<div dir="ltr"><font face="tahoma">I tried to compute the hessian for the Speelpenning problem</font></div>
<div dir="ltr"><font face="tahoma">both using the function hessian() and tensor_eval(),</font></div>
<div dir="ltr"><font face="tahoma">and it happens that the second is much slower for an increasing number of independent variables (do not know for a small number).</font></div>
<div dir="ltr"><font face="tahoma"></font> </div>
<div dir="ltr"><font face="tahoma">Does anybody know the reason of this?</font></div>
<div dir="ltr"><font face="tahoma"></font> </div>
<div dir="ltr"><font face="tahoma">Then I also tried to implement a version of hessian() for a vector valued function (7 dependent, ~30 dependent variables) in order to compare it to tensor_eval() in computation speed.</font></div>
<div dir="ltr"><font face="tahoma">I checked that the hessian evaluation is correct and the speed is the same as hessian() in a scalar case.</font></div>
<div dir="ltr"><font face="tahoma">The function in question represents the equations of motion for a mechanical system and is computed through the generation of approx. 1000 intermediate variables with trigonometric and polynomial functions (honestly I did
not check the function evaluation time).</font></div>
<div dir="ltr"><font face="tahoma">The hessian matrix happens to be sparse with a 2% of non-zero elements (this might be relevant for the question).</font></div>
<div dir="ltr"><font face="tahoma"></font> </div>
<div dir="ltr"><font face="tahoma">The tensor_eval() performed better than the vectorial version of hessian() this time, and just reading the online manual I cannot really figure out the reason.
</font></div>
<div dir="ltr"><font face="tahoma"></font> </div>
<div dir="ltr"><font face="tahoma">What could be the reason of this "inconsistency"?</font></div>
<div dir="ltr"><font face="tahoma">(does tensor_eval() exploit sparsity?)</font></div>
<div dir="ltr"><font face="tahoma"></font> </div>
<div dir="ltr"><font face="tahoma">Thank you,</font></div>
<div dir="ltr"><font face="tahoma">Giacomo.</font><font size="2"></div>
</font></div>
</body>
</html>