1 # ifndef CPPAD_CORE_LU_RATIO_HPP
2 # define CPPAD_CORE_LU_RATIO_HPP
213 template <
class SizeVector,
class ADvector,
class Base>
216 typedef ADvector FloatVector;
220 CheckNumericType<Float>();
223 CheckSimpleVector<Float, FloatVector>();
224 CheckSimpleVector<size_t, SizeVector>();
227 const Float zero( 0 );
237 size_t n = size_t(ip.size());
239 size_t(jp.size()) == n,
240 "Error in LuFactor: jp must have size equal to n"
243 size_t(LU.size()) == n * n,
244 "Error in LuFactor: LU must have size equal to n * m"
249 for(i = 0; i < n; i++)
260 for(p = 0; p < n; p++)
265 for(i = p; i < n; i++)
266 {
for(j = p; j < n; j++)
268 (ip[i] < n) & (jp[j] < n)
270 etmp = LU[ ip[i] * n + jp[j] ];
280 for(i = p; i < n; i++)
281 {
for(j = p; j < n; j++)
282 { etmp =
fabs(LU[ ip[i] * n + jp[j] ] / emax);
288 (imax < n) & (jmax < n) ,
289 "AbsGeq must return true when second argument is zero"
306 pivot = LU[ ip[p] * n + jp[p] ];
318 for(j = p+1; j < n; j++)
319 LU[ ip[p] * n + jp[j] ] /= pivot;
325 for(i = p+1; i < n; i++ )
326 { etmp = LU[ ip[i] * n + jp[p] ];
327 for(j = p+1; j < n; j++)
328 { LU[ ip[i] * n + jp[j] ] -=
329 etmp * LU[ ip[p] * n + jp[j] ];
#define CPPAD_ASSERT_KNOWN(exp, msg)
Check that exp is true, if not print msg and terminate execution.
int LuRatio(SizeVector &ip, SizeVector &jp, ADvector &LU, AD< Base > &ratio)
CPPAD_INLINE_FRIEND_TEMPLATE_FUNCTION AD< Base > CondExpGt(const AD< Base > &left, const AD< Base > &right, const AD< Base > &if_true, const AD< Base > &if_false)
bool AbsGeq(const Float &x, const Float &y)
#define CPPAD_ASSERT_UNKNOWN(exp)
Check that exp is true, if not terminate execution.
std::complex< double > sign(const std::complex< double > &x)
std::complex< double > fabs(const std::complex< double > &x)