...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Home | Libraries | People | FAQ | More |
Note | |
---|---|
The following does not apply to implicit steppers like implicit_euler or
Rosenbrock 4 as there the |
The State
, Algebra
and Operations
together define a concept describing how the mathematical vector operations
required for the stepper algorithms are performed. The typical vector operation
done within steppers is
y = Σ αi xi.
The State
represents the
state variable of an ODE, usually denoted with x. Algorithmically,
the state is often realized as a vector< double >
or array< double , N >
,
however, the genericity of odeint enables you to basically use anything as
a state type. The algorithmic counterpart of such mathematical expressions
is divided into two parts. First, the Algebra
is used to account for the vector character of the equation. In the case
of a vector
as state type
this means the Algebra
is
responsible for iteration over all vector elements. Second, the Operations
are used to represent the actual
operation applied to each of the vector elements. So the Algebra
iterates over all elements of the State
s
and calls an operation taken from the Operations
for each element. This is where State
,
Algebra
and Operations
have to work together to make
odeint running. Please have a look at the range_algebra
and default_operations
to
see an example how this is implemented.
In the following we describe how State
,
Algebra
and Operations
are used together within the
stepper implementations.
Operations
The operations type
Value1
, ... ,
ValueN
Types representing the value or time type of stepper
Scale
Type of the scale operation
scale
Object of type Scale
ScaleSumN
Type that represents a general scale_sum operation, N
should be replaced by a number from 1 to 14.
scale_sumN
Object of type ScaleSumN
,
N
should be replaced by a
number from 1 to 14.
ScaleSumSwap2
Type of the scale sum swap operation
scale_sum_swap2
Object of type ScaleSumSwap2
a1,
a2,
...
Objects of type Value1
,
Value2
, ...
y,
x1,
x2,
...
Objects of State
's
value type
Name |
Expression |
Type |
Semantics |
---|---|---|---|
Get scale operation |
|
|
Get |
|
|
|
Constructs a |
|
|
|
Calculates |
Get general |
|
|
Get the |
|
|
|
Constructs a |
|
|
|
Calculates |
Get scale sum swap operation |
|
|
Get scale sum swap from operations |
|
|
|
Constructor |
|
|
|
Calculates |
State
The state type
Algebra
The algebra type
OperationN
An N
-ary operation type,
N
should be a number from
1 to 14.
algebra
Object of type Algebra
operationN
Object of type OperationN
y,
x1,
x2,
...
Objects of type State
Name |
Expression |
Type |
Semantics |
---|---|---|---|
Vector Operation with arity 2 |
|
void |
Calls |
Vector Operation with arity 3 |
|
void |
Calls |
Vector Operation with arity |
|
void |
Calls |
As standard configuration odeint uses the range_algebra
and default_operations
which suffices most situations. However, a few more possibilities exist
either to gain better performance or to ensure interoperability with other
libraries. In the following we list the existing Algebra
/Operations
configurations that can be
used in the steppers.
|
|
|
Remarks |
---|---|---|---|
Anything supporting Boost.Range,
like |
|
|
Standard implementation, applicable for most typical situations. |
|
|
|
Special implementation for boost::array with better performance
than |
Anything that defines operators + within itself and * with scalar (Mathematically spoken, anything that is a vector space). |
|
|
For the use of Controlled
Stepper, the template |
|
|
|
For running odeint on CUDA devices by using Thrust |
Any RandomAccessRange |
|
|
OpenMP-parallelised range algebra |
|
|
|
OpenMP-parallelised algebra for split data |
|
|
|
Using the Intel Math Kernel Library in odeint for maximum performance. Currently, only the RK4 stepper is supported. |
Name |
Expression |
Type |
Semantics |
---|---|---|---|
Vector operation |
|
void |
Calculates y = a1 x1 + a2 x2 |