Defines | Functions | Variables
utils.cpp File Reference
#include "utils.h"
Include dependency graph for utils.cpp:

Go to the source code of this file.

Defines

#define ERRCON   6.0E-4
#define FCOR   0.06666666
#define MAXSTP   10000
#define PGROW   -0.20
#define PSHRNK   -0.25
#define SAFETY   0.9
#define TINY   1.0e-30

Functions

ReturnMatrix Integ_Trap (const ColumnVector &present, ColumnVector &past, const Real dt)
 Trapezoidal integration.
void odeint (ReturnMatrix(*xdot)(Real time, const Matrix &xin), Matrix &xo, Real to, Real tf, Real eps, Real h1, Real hmin, int &nok, int &nbad, RowVector &tout, Matrix &xout, Real dtsav)
 Integrate the ordinary differential equation xdot from time to to time tf using an adaptive step size strategy.
ReturnMatrix pinv (const Matrix &M)
 Matrix pseudo inverse using SVD.
ReturnMatrix rk4 (const Matrix &x, const Matrix &dxdt, Real t, Real h, ReturnMatrix(*xdot)(Real time, const Matrix &xin))
 Compute one Runge-Kutta fourth order step.
void rkqc (Matrix &x, Matrix &dxdt, Real &t, Real htry, Real eps, Matrix &xscal, Real &hdid, Real &hnext, ReturnMatrix(*xdot)(Real time, const Matrix &xin))
 Compute one adaptive step based on two rk4.
void Runge_Kutta4 (ReturnMatrix(*xdot)(Real time, const Matrix &xin), const Matrix &xo, Real to, Real tf, int nsteps, RowVector &tout, Matrix &xout)
 Fixed step size fourth-order Runge-Kutta integrator.
void Runge_Kutta4_Real_time (ReturnMatrix(*xdot)(Real time, const Matrix &xin, bool &exit, bool &init), const Matrix &xo, Real to, Real tf, int nsteps)
 Fixed step size fourth-order Runge-Kutta integrator.
void Runge_Kutta4_Real_time (ReturnMatrix(*xdot)(const Real time, const Matrix &xin), const Matrix &xo, const Real to, const Real tf, const int nsteps)
ReturnMatrix sign (const Matrix &x)
 Sign of a matrix.
short sign (const Real x)
 Sign of real.
ReturnMatrix x_prod_matrix (const ColumnVector &x)
 Cross product matrix.

Variables

static const char rcsid [] = "$Id: utils.cpp,v 1.26 2006/05/16 16:11:15 gourdeau Exp $"
 RCS/CVS version.

Define Documentation

#define ERRCON   6.0E-4

Definition at line 293 of file utils.cpp.

#define FCOR   0.06666666

Definition at line 291 of file utils.cpp.

#define MAXSTP   10000

Definition at line 344 of file utils.cpp.

#define PGROW   -0.20

Definition at line 289 of file utils.cpp.

#define PSHRNK   -0.25

Definition at line 290 of file utils.cpp.

#define SAFETY   0.9

Definition at line 292 of file utils.cpp.

#define TINY   1.0e-30

Definition at line 345 of file utils.cpp.


Function Documentation

ReturnMatrix Integ_Trap ( const ColumnVector &  present,
ColumnVector &  past,
const Real  dt 
)

Trapezoidal integration.

Definition at line 165 of file utils.cpp.

void odeint ( ReturnMatrix(*)(Real time, const Matrix &xin)  xdot,
Matrix &  xo,
Real  to,
Real  tf,
Real  eps,
Real  h1,
Real  hmin,
int &  nok,
int &  nbad,
RowVector &  tout,
Matrix &  xout,
Real  dtsav 
)

Integrate the ordinary differential equation xdot from time to to time tf using an adaptive step size strategy.

adapted from: Numerical Recipes in C, The Art of Scientific Computing, Press, William H. and Flannery, Brian P. and Teukolsky, Saul A. and Vetterling, William T., Cambridge University Press, 1988.

Definition at line 347 of file utils.cpp.

ReturnMatrix pinv ( const Matrix &  M)

Matrix pseudo inverse using SVD.

If $ A = U^{*}QV $ is a singular value decomposition of A, then $ A^{\dagger} = V^{*}Q^{\dagger}U$ where $ X^{*} $ is the conjugate transpose of $ X $ and $ Q^{\dagger} = \left [ \begin{array}{cccc} 1/\sigma_1 & & & \\ & 1/\sigma_2& & \\ & & \ddots & \\ & & & 0 \end{array} \right ]$ where the $1/\sigma_i $ are replaced by 0 when $1/\sigma_i < tol $

Definition at line 99 of file utils.cpp.

ReturnMatrix rk4 ( const Matrix &  x,
const Matrix &  dxdt,
Real  t,
Real  h,
ReturnMatrix(*)(Real time, const Matrix &xin)  xdot 
)

Compute one Runge-Kutta fourth order step.

adapted from: Numerical Recipes in C, The Art of Scientific Computing, Press, William H. and Flannery, Brian P. and Teukolsky, Saul A. and Vetterling, William T., Cambridge University Press, 1988.

Definition at line 260 of file utils.cpp.

void rkqc ( Matrix &  x,
Matrix &  dxdt,
Real t,
Real  htry,
Real  eps,
Matrix &  xscal,
Real hdid,
Real hnext,
ReturnMatrix(*)(Real time, const Matrix &xin)  xdot 
)

Compute one adaptive step based on two rk4.

adapted from: Numerical Recipes in C, The Art of Scientific Computing, Press, William H. and Flannery, Brian P. and Teukolsky, Saul A. and Vetterling, William T., Cambridge University Press, 1988.

Definition at line 295 of file utils.cpp.

void Runge_Kutta4 ( ReturnMatrix(*)(Real time, const Matrix &xin)  xdot,
const Matrix &  xo,
Real  to,
Real  tf,
int  nsteps,
RowVector &  tout,
Matrix &  xout 
)

Fixed step size fourth-order Runge-Kutta integrator.

Definition at line 232 of file utils.cpp.

void Runge_Kutta4_Real_time ( ReturnMatrix(*)(Real time, const Matrix &xin, bool &exit, bool &init xdot,
const Matrix &  xo,
Real  to,
Real  tf,
int  nsteps 
)

Fixed step size fourth-order Runge-Kutta integrator.

Definition at line 178 of file utils.cpp.

void Runge_Kutta4_Real_time ( ReturnMatrix(*)(const Real time, const Matrix &xin)  xdot,
const Matrix &  xo,
const Real  to,
const Real  tf,
const int  nsteps 
)

Definition at line 207 of file utils.cpp.

ReturnMatrix sign ( const Matrix &  x)

Sign of a matrix.

Definition at line 406 of file utils.cpp.

short sign ( const Real  x)

Sign of real.

Definition at line 425 of file utils.cpp.

ReturnMatrix x_prod_matrix ( const ColumnVector &  x)

Cross product matrix.

Definition at line 88 of file utils.cpp.


Variable Documentation

const char rcsid[] = "$Id: utils.cpp,v 1.26 2006/05/16 16:11:15 gourdeau Exp $" [static]

RCS/CVS version.

Definition at line 60 of file utils.cpp.



kni
Author(s): Neuronics AG (see AUTHORS.txt); ROS wrapper by Martin Günther
autogenerated on Mon Oct 6 2014 10:45:34