<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>
<div>
<div><span style="background-color: rgb(255, 255, 255); color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1;">Hello,</span></div>
</div>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
I'm using CppAD with Eigen. Multiplication of a double with an Eigen-Vector like this:</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
---</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
<div>template<typename Type></div>
<div>using Vector = Eigen::Matrix<Type, Eigen::Dynamic, 1>;</div>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
<div>Vector< AD< AD<double> > > tmp;</div>
<div><br>
</div>
<div>tmp = tmp + 0.5 * tmp;</div>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
---</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
gives the following error</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
<p><b> </b><b>error: </b><b>invalid operands to binary expression ('double' and 'Vector<AD<AD<double> > >' (aka 'Eigen::Matrix<CppAD::AD<<wbr>CppAD::AD<double> >, -1, 1, 0, -1, 1>'))</b></p>
<p>    tmp = tmp + 0.5 * tmp;</p>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
The error goes away if I do</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
---</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
tmp = tmp + AD<double>(0.5) * tmp;</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
---</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
Is this the right way to do it?</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
Btw. an AD< AD<double> > can be multiplied by a double just fine. </div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; widows: 1; background-color: rgb(255, 255, 255);">
Thomas</div>
</div>
</span>
</body>
</html>