1 # ifndef CPPAD_CORE_FOR_TWO_HPP
2 # define CPPAD_CORE_FOR_TWO_HPP
143 template <
typename Base>
144 template <
typename VectorBase,
typename VectorSize_t>
147 const VectorSize_t &j,
148 const VectorSize_t &k)
159 CheckSimpleVector<Base, VectorBase>();
162 CheckSimpleVector<size_t, VectorSize_t>();
166 "ForTwo: Length of x not equal domain dimension for f."
169 j.size() == k.size(),
170 "ForTwo: Lenght of the j and k vectors are not equal."
177 VectorBase ddy(m * p);
185 for(j1 = 0; j1 < n; j1++)
190 for(j1 = 0; j1 < n; j1++)
197 for(l = 0; l < p; l++)
202 "ForTwo: an element of j not less than domain dimension for f."
206 "ForTwo: an element of k not less than domain dimension for f."
219 for(i = 0; i < m; i++)
220 D[i * n + j1 ] = dy[i];
226 for(l = 0; l < p; l++)
230 {
for(i = 0; i < m; i++)
231 ddy[i * p + l] = Base(2.0) * D[i * n + j1];
245 for(i = 0; i < m; i++)
246 ddy[i * p + l] = dy[i] - D[i*n+j1] - D[i*n+k1];
#define CPPAD_ASSERT_KNOWN(exp, msg)
Check that exp is true, if not print msg and terminate execution.
VectorBase ForTwo(const VectorBase &x, const VectorSize_t &J, const VectorSize_t &K)
forward mode calculation of a subset of second order partials