本文整理汇总了C++中System::Eval方法的典型用法代码示例。如果您正苦于以下问题:C++ System::Eval方法的具体用法?C++ System::Eval怎么用?C++ System::Eval使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System
的用法示例。
在下文中一共展示了System::Eval方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NewtonLoop
SuccessCode NewtonLoop(Vec<ComplexType> & next_space,
System const& S,
Vec<ComplexType> const& current_space, // pass by value to get a copy of it
ComplexType const& current_time,
RealType const& tracking_tolerance,
unsigned min_num_newton_iterations,
unsigned max_num_newton_iterations)
{
#ifndef BERTINI_DISABLE_ASSERTS
assert(max_num_newton_iterations >= min_num_newton_iterations && "max number newton iterations must be at least the min.");
#endif
next_space = current_space;
for (unsigned ii = 0; ii < max_num_newton_iterations; ++ii)
{
auto f = S.Eval(next_space, current_time);
auto J = S.Jacobian(next_space, current_time);
auto LU = J.lu();
if (LUPartialPivotDecompositionSuccessful(LU.matrixLU())!=MatrixSuccessCode::Success)
return SuccessCode::MatrixSolveFailure;
auto delta_z = LU.solve(-f);
next_space += delta_z;
if ( (delta_z.norm() < tracking_tolerance) && (ii >= (min_num_newton_iterations-1)) )
return SuccessCode::Success;
}
return SuccessCode::FailedToConverge;
}