<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>&nbsp;</div>
<div dir="ltr"><font face="tahoma">I tried to&nbsp;compute the hessian&nbsp;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>&nbsp;</div>
<div dir="ltr"><font face="tahoma">Does anybody know the reason of this?</font></div>
<div dir="ltr"><font face="tahoma"></font>&nbsp;</div>
<div dir="ltr"><font face="tahoma">Then I also tried to implement a version of hessian() for a vector valued function (7 dependent,&nbsp;~30 dependent&nbsp;variables)&nbsp;in order to compare it to tensor_eval()&nbsp;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&nbsp;function evaluation&nbsp;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>&nbsp;</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>&nbsp;</div>
<div dir="ltr"><font face="tahoma">What could be the reason of this &quot;inconsistency&quot;?</font></div>
<div dir="ltr"><font face="tahoma">(does tensor_eval() exploit sparsity?)</font></div>
<div dir="ltr"><font face="tahoma"></font>&nbsp;</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>