NcmOdeSpline

NcmOdeSpline — Automatic generation of splines from ODE solvers.

Stability Level

Stable, unless otherwise indicated

Functions

Properties

double abstol Read / Write / Construct
gboolean auto-abstol Read / Write / Construct
gpointer dydx Read / Write / Construct Only
double ini-step Read / Write / Construct
double reltol Read / Write / Construct
NcmSpline * spline Read / Write
gboolean stop-hnil Read / Write / Construct
double xf Read / Write
double xi Read / Write
double yf Read / Write
double yi Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── NcmOdeSpline

Includes

#include <numcosmo/math/ncm_ode_spline.h>

Description

This class defines an object that integrates an ODE and generates a spline from the solution.

Functions

NcmOdeSplineDydx ()

gdouble
(*NcmOdeSplineDydx) (gdouble y,
                     gdouble x,
                     gpointer userdata);

ncm_ode_spline_new ()

NcmOdeSpline *
ncm_ode_spline_new (NcmSpline *s,
                    NcmOdeSplineDydx dydx);

This function creates a new NcmOdeSpline.

Parameters

s

a NcmSpline

 

dydx

a NcmOdeSplineDydx.

[scope notified]

Returns

a new NcmOdeSpline.


ncm_ode_spline_new_full ()

NcmOdeSpline *
ncm_ode_spline_new_full (NcmSpline *s,
                         NcmOdeSplineDydx dydx,
                         gdouble yi,
                         gdouble xi,
                         gdouble xf);

This function creates a new NcmOdeSpline setting all its members.

Parameters

s

a NcmSpline

 

dydx

a NcmOdeSplineDydx.

[scope notified]

yi

initial value of the function to be evaluated

 

xi

initial point to integrate the edo

 

xf

final point to integrate the edo

 

Returns

a new NcmOdeSpline.


ncm_ode_spline_prepare ()

void
ncm_ode_spline_prepare (NcmOdeSpline *os,
                        gpointer userdata);

This function prepares the NcmOdeSpline os and fills its internal NcmSpline with the evaluated ode's solution.

Parameters

os

a NcmOdeSpline

 

userdata

ode additional parameters.

[nullable]

ncm_ode_spline_free ()

void
ncm_ode_spline_free (NcmOdeSpline *os);

Decreases the reference count of os by one.

Parameters

os

a NcmOdeSpline

 

ncm_ode_spline_clear ()

void
ncm_ode_spline_clear (NcmOdeSpline **os);

Atomically decrements the reference count of os by one. If the reference count drops to 0, all memory allocated by os is released. The pointer is set to NULL.

Parameters

os

a NcmOdeSpline

 

ncm_ode_spline_set_interval ()

void
ncm_ode_spline_set_interval (NcmOdeSpline *os,
                             gdouble yi,
                             gdouble xi,
                             gdouble xf);

This function sets os interval [xi , xf ] and its initial value yi in order to integrate the ode.

Parameters

os

a NcmOdeSpline

 

yi

initial value of the function to be evaluated

 

xi

initial point to integrate the edo

 

xf

final point to integrate the edo

 

ncm_ode_spline_set_reltol ()

void
ncm_ode_spline_set_reltol (NcmOdeSpline *os,
                           gdouble reltol);

This functions sets the relative tolerance, reltol , of the edo integrator.

Parameters

os

a NcmOdeSpline

 

reltol

relative tolerance of the ode integrator

 

ncm_ode_spline_set_abstol ()

void
ncm_ode_spline_set_abstol (NcmOdeSpline *os,
                           gdouble abstol);

This functions sets the absolute tolerance, abstol , of the edo integrator.

Parameters

os

a NcmOdeSpline

 

abstol

absolute tolerance of the ode integrator

 

ncm_ode_spline_set_xi ()

void
ncm_ode_spline_set_xi (NcmOdeSpline *os,
                       gdouble xi);

This function sets the initial point, xi , to integrate the edo.

Parameters

os

a NcmOdeSpline

 

xi

initial point to integrate the edo

 

ncm_ode_spline_set_xf ()

void
ncm_ode_spline_set_xf (NcmOdeSpline *os,
                       gdouble xf);

This function sets the final point, xf , to integrate the edo. Note that if yf is also set, yf will take precedence.

Parameters

os

a NcmOdeSpline

 

xf

final point to integrate the edo

 

ncm_ode_spline_set_yi ()

void
ncm_ode_spline_set_yi (NcmOdeSpline *os,
                       gdouble yi);

This function sets the initial value of the function to be evaluated.

Parameters

os

a NcmOdeSpline

 

yi

initial value of the function to be evaluated

 

ncm_ode_spline_set_yf ()

void
ncm_ode_spline_set_yf (NcmOdeSpline *os,
                       gdouble yf);

This function sets the final value of the function to be evaluated. When yf is reached, the edo's integration is stopped. Note that if xf is also set, yf will take precedence.

Parameters

os

a NcmOdeSpline

 

yf

final value of the function to be evaluated

 

ncm_ode_spline_auto_abstol ()

void
ncm_ode_spline_auto_abstol (NcmOdeSpline *os,
                            gboolean on);

If on is TRUE, the object uses the value of $\mathrm{d}y_i$ to estimate the abstol as $T_\mathrm{abs} = \dot{y}_i \mathrm{d}t_m T_\mathrm{rel}$, where $T_\mathrm{rel}$ is the relative tolerance and $\mathrm{d}t_m$ is the minimum time step NCM_ODE_SPLINE_MIN_STEP. Useful when computing integrals as ODEs.

Parameters

os

a NcmOdeSpline

 

on

Whether to turn on the auto-abstol

 

ncm_ode_spline_set_ini_step ()

void
ncm_ode_spline_set_ini_step (NcmOdeSpline *os,
                             gdouble ini_step);

Sets a guess for the initial step size. If ini_step is zero it uses the automatic determination based on the tolerances.

Parameters

os

a NcmOdeSpline

 

ini_step

the initial step

 

ncm_ode_spline_get_ini_step ()

gdouble
ncm_ode_spline_get_ini_step (NcmOdeSpline *os);

Gets the current guess for the initial step size.

Parameters

os

a NcmOdeSpline

 

Returns

the current value of the initial guess (zero means disabled).


ncm_ode_spline_peek_spline ()

NcmSpline *
ncm_ode_spline_peek_spline (NcmOdeSpline *os);

Peeks at the last prepared spline.

Parameters

os

a NcmOdeSpline

 

Returns

the last prepared spline.

[transfer none]

Types and Values

NCM_TYPE_ODE_SPLINE

#define NCM_TYPE_ODE_SPLINE (ncm_ode_spline_get_type ())

NCM_ODE_SPLINE_DEFAULT_RELTOL

#define NCM_ODE_SPLINE_DEFAULT_RELTOL (GSL_DBL_EPSILON)

NCM_ODE_SPLINE_DEFAULT_ABSTOL

#define NCM_ODE_SPLINE_DEFAULT_ABSTOL (0.0)

NCM_ODE_SPLINE_MIN_STEP

#define NCM_ODE_SPLINE_MIN_STEP (1.0e-10)

NcmOdeSpline

typedef struct _NcmOdeSpline NcmOdeSpline;

Property Details

The “abstol” property

  “abstol”                   double

Integrator's absolute tolerance.

Owner: NcmOdeSpline

Flags: Read / Write / Construct

Allowed values: [0,1]

Default value: 0


The “auto-abstol” property

  “auto-abstol”              gboolean

Boolean to set whether or not the absolute tolerance is going to be estimated internally by the ode integrator.

Owner: NcmOdeSpline

Flags: Read / Write / Construct

Default value: FALSE


The “dydx” property

  “dydx”                     gpointer

A pointer to the dydx function, a.k.a. the jacobian.

Owner: NcmOdeSpline

Flags: Read / Write / Construct Only


The “ini-step” property

  “ini-step”                 double

The integration initial step size.

Owner: NcmOdeSpline

Flags: Read / Write / Construct

Allowed values: >= 0

Default value: 0


The “reltol” property

  “reltol”                   double

Integrator's relative tolerance.

Owner: NcmOdeSpline

Flags: Read / Write / Construct

Allowed values: [0,1]

Default value: 2.22045e-16


The “spline” property

  “spline”                   NcmSpline *

The spline algorithm to be used.

Owner: NcmOdeSpline

Flags: Read / Write


The “stop-hnil” property

  “stop-hnil”                gboolean

Whether treat hnil as error.

Owner: NcmOdeSpline

Flags: Read / Write / Construct

Default value: TRUE


The “xf” property

  “xf”                       double

The final point to integrate the ode.

Owner: NcmOdeSpline

Flags: Read / Write

Default value: 0


The “xi” property

  “xi”                       double

The initial point to integrate the ode.

Owner: NcmOdeSpline

Flags: Read / Write

Default value: 0


The “yf” property

  “yf”                       double

The final value of the function to be evaluated.

Owner: NcmOdeSpline

Flags: Read / Write

Default value: 0


The “yi” property

  “yi”                       double

The initial value of the function to be evaluated.

Owner: NcmOdeSpline

Flags: Read / Write

Default value: 0