\(\newcommand{\W}[1]{ \; #1 \; }\) \(\newcommand{\R}[1]{ {\rm #1} }\) \(\newcommand{\B}[1]{ {\bf #1} }\) \(\newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} }\) \(\newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} }\) \(\newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} }\) \(\newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }\)
atomic_four_lin_ode_get.hpp¶
View page sourceatomic_lin_ode Get Routine: Example Implementation¶
Syntax¶
get
( call_id , r , step , pattern , transpose )Prototype¶
typedef CppAD::sparse_rc< CppAD::vector<size_t> > sparse_rc;
template <class Base>
void atomic_lin_ode<Base>::get(
size_t call_id, Base& r, Base& step, sparse_rc& pattern, bool& transpose
)
Purpose¶
Retrieves the auxiliary information for a an atomic operation that computes the solution of a linear ODE.
call_id¶
This input argument identifies the auxiliary information for this ODE.
r¶
This output argument is the final value for the variable that the ODE is with respect to.
step¶
This is a positive maximum step size to use when solving the ODE.
pattern¶
This output argument is a sparsity pattern.
transpose¶
If this output argument is true (false) the sparsity pattern is for \(A(x)^\R{T}\) (\(A(x)\)).
Source¶
# include <cppad/example/atomic_four/lin_ode/lin_ode.hpp>
namespace CppAD { // BEGIN_CPPAD_NAMESPACE
// BEGIN PROTOTYPE
template <class Base>
void atomic_lin_ode<Base>::get(
size_t call_id, Base& r, Base& step, sparse_rc& pattern, bool& transpose
)
// END PROTOTYPE
{
// thread
size_t thread = thread_alloc::thread_num();
CPPAD_ASSERT_UNKNOWN( work_[thread] != nullptr );
//
// pattern_vec
CppAD::vector<sparse_rc>& pattern_vec( work_[thread]->pattern_vec );
//
// call_vec
CppAD::vector<call_struct>& call_vec( work_[thread]->call_vec );
//
CPPAD_ASSERT_UNKNOWN( thread == call_vec[call_id].thread );
//
// r
call_struct& call = call_vec[call_id];
r = call.r;
step = call.step;
pattern = pattern_vec[call.pattern_index];
transpose = call.transpose;
//
return;
}
} // END_CPPAD_NAMESPACE