ampsci
High-precision calculations for one- and two-valence atomic systems
AdamsMoulton::DerivativeMatrix< T, Y >abstract

ok

template<typename T = double, typename Y = double>
struct AdamsMoulton::DerivativeMatrix< T, Y >

Pure-virtual struct defining the derivative matrix for a 2x2 ODE system.

Used by ODESolver2D to define the derivative matrix D and optional inhomogeneous term S. Derive from this and implement a(t), b(t), c(t), d(t) to define the ODE.

The system of ODEs is:

\[ \frac{dF(t)}{dt} = D(t) F(t) + S(t) \]

where:

\[ F(t) = \begin{pmatrix} f(t)\\ g(t) \end{pmatrix}, \quad D(t) = \begin{pmatrix} a(t) & b(t)\\ c(t) & d(t) \end{pmatrix}, \quad S(t) = \begin{pmatrix} s_f(t)\\ s_g(t) \end{pmatrix}. \]

D (and optionally S) must be provided by implementing this struct. The four functions a, b, c, d must be overridden to define the ODE system. Sf and Sg default to zero if not overridden.

Template parameter T is the type of the argument t (usually double or complex<double>, but may be an index type such as std::size_t if the matrix is known only at discrete grid points). Template parameter Y is the return type (usually double, but may be float or complex<double>).

Note
In benchmarks, deriving from a struct was significantly faster than using std::function, slightly faster than function pointers, and comparable to a direct implementation.

#include <AdamsMoulton.hpp>

Public Member Functions

virtual Y a (T t) const =0
 a,b,c,d are derivative matrix functions; all must be user implemented
 
virtual Y b (T t) const =0
 
virtual Y c (T t) const =0
 
virtual Y d (T t) const =0
 
virtual Y Sf (T) const
 Sf and Sg are optional inhomogenous terms.
 
virtual Y Sg (T) const
 

Member Function Documentation

◆ a()

template<typename T = double, typename Y = double>
virtual Y AdamsMoulton::DerivativeMatrix< T, Y >::a ( t) const
pure virtual

a,b,c,d are derivative matrix functions; all must be user implemented

Implemented in DiracODE::DiracContinuumDerivative, DiracODE::Internal::DiracDerivative, and DiracODE::Internal::CDiracDerivative.

◆ Sf()

template<typename T = double, typename Y = double>
virtual Y AdamsMoulton::DerivativeMatrix< T, Y >::Sf ( ) const
inlinevirtual

Sf and Sg are optional inhomogenous terms.

Reimplemented in DiracODE::Internal::DiracDerivative.


The documentation for this struct was generated from the following file: