TMB Documentation  v1.9.11
Classes | Functions
atomic Namespace Reference

Namespace with special functions and derivatives. More...

Classes

struct  AtomicGlobal
 For backwards compatibility with CppAD. More...
 
struct  AtomicLocal
 User interface to checkpointing using TMBad. More...
 

Functions

template<class Type >
matrix< Type > absm (matrix< Type > x)
 Matrix absolute value. More...
 
template<class Type >
CppAD::vector< Type > bessel_i_10 (CppAD::vector< Type > x)
 Atomic version of \(besselI(x,\nu)\). Valid parameter range: \(x =(x,\nu) \in \mathbb{R}_+\times\mathbb{R}\). More...
 
template<class Type >
CppAD::vector< Type > bessel_k_10 (CppAD::vector< Type > x)
 Atomic version of \(besselK(x,\nu)\). Valid parameter range: \(x =(x,\nu) \in \mathbb{R}_+\times\mathbb{R}\). More...
 
template<class Type >
CppAD::vector< Type > D_incpl_gamma_shape (CppAD::vector< Type > x)
 Atomic version of scaled incomplete gamma function differentiated to any order wrt. shape parameter

\[ \exp(c) \int_0^{y} \exp(-t) t^{\lambda-1} \log(t)^n \:dt \]

where the 4 input parameters are passed as a vector \(x=(y,\lambda,n,c)\). Note that the normalized incomplete gamma function is obtained as the special case \(n=0\) and \(c=-\log \Gamma(\lambda)\). Valid parameter range: \(x \in \mathbb{R}_+\times\mathbb{R}_+\times\mathbb{N}_0\times\mathbb{R}\). More...

 
template<class Type >
CppAD::vector< Type > D_lgamma (CppAD::vector< Type > x)
 Atomic version of the n'th order derivative of the log gamma function.

\[ \frac{d^n}{d\lambda^n}\log \Gamma(\lambda) \]

where the 2 input parameters are passed as a vector \(x=(\lambda,n)\). The special case \(n=0\) gives the log gamma function. More...

 
template<class Type >
matrix< Type > expm (matrix< Type > x)
 Matrix exponential. More...
 
template<class Type >
vector< std::complex< Type > > fft (vector< std::complex< Type > > xc, bool inverse=false)
 FFT (unscaled) More...
 
template<class Type >
CppAD::vector< Type > inv_incpl_gamma (CppAD::vector< Type > x)
 Atomic version of inverse of scaled incomplete gamma function. Given \(z\) find \(y\) such that

\[ z = \exp(c) \int_0^{y} \exp(-t) t^{\lambda-1} \:dt \]

where the 3 input parameters are passed as a vector \(x=(z,\lambda,c)\). The special case \(c=-\log \Gamma(\lambda)\) gives the inverse normalized incomplete gamma function. Valid parameter range: \(x \in \mathbb{R}_+\times\mathbb{R}_+\times\mathbb{R}\). More...

 
template<class Type >
CppAD::vector< Type > invpd (CppAD::vector< Type > x)
 Atomic version of log determinant and inverse of positive definite n-by-n matrix. Calculated by Cholesky decomposition. More...
 
template<class Type >
CppAD::vector< Type > logdet (CppAD::vector< Type > x)
 Atomic version of log determinant of positive definite n-by-n matrix. More...
 
template<class Type >
Type logdet (matrix< Type > x)
 Log-determinant of positive definite matrix.
 
template<class Type >
CppAD::vector< Type > matinv (CppAD::vector< Type > x)
 Atomic version of matrix inversion. Inverts n-by-n matrix by LU-decomposition. More...
 
template<class Type >
matrix< Type > matinv (matrix< Type > x)
 Matrix inverse. More...
 
template<class Type >
matrix< Type > matinvpd (matrix< Type > x, Type &logdet)
 Matrix inverse and determinant. More...
 
template<class Type >
CppAD::vector< Type > matmul (CppAD::vector< Type > x)
 Atomic version of matrix multiply. Multiplies n1-by-n2 matrix with n2-by-n3 matrix. More...
 
template<class Type >
matrix< Type > matmul (matrix< Type > x, matrix< Type > y)
 Matrix multiply. More...
 
template<class Type >
CppAD::vector< Type > pnorm1 (CppAD::vector< Type > x)
 Atomic version of standard normal distribution function. Derivative is known to be 'dnorm1'. More...
 
template<class Type >
CppAD::vector< Type > ppois (CppAD::vector< Type > x)
 Atomic version of poisson cdf \(ppois(n,\lambda)\). Valid parameter range: \(x =(n,\lambda) \in \mathbb{N}_0\times\mathbb{R}_+\). More...
 
template<class Type >
CppAD::vector< Type > qnorm1 (CppAD::vector< Type > x)
 Atomic version of standard normal quantile function. Derivative is expressed through 'dnorm1'. More...
 
template<class Type >
matrix< Type > sqrtm (matrix< Type > x)
 Matrix square root. More...
 

Detailed Description

Namespace with special functions and derivatives.

This namespace extends the 'derivatives table' of CppAD.

Function Documentation

§ bessel_i_10()

template<class Type >
CppAD::vector<Type> atomic::bessel_i_10 ( CppAD::vector< Type >  x)

Atomic version of \(besselI(x,\nu)\). Valid parameter range: \(x =(x,\nu) \in \mathbb{R}_+\times\mathbb{R}\).

Note
This atomic function does not handle the derivative wrt. \(\nu\).
Parameters
xInput vector of length 2.
Returns
Vector of length 1.

§ bessel_k_10()

template<class Type >
CppAD::vector<Type> atomic::bessel_k_10 ( CppAD::vector< Type >  x)

Atomic version of \(besselK(x,\nu)\). Valid parameter range: \(x =(x,\nu) \in \mathbb{R}_+\times\mathbb{R}\).

Note
This atomic function does not handle the derivative wrt. \(\nu\).
Parameters
xInput vector of length 2.
Returns
Vector of length 1.

§ D_incpl_gamma_shape()

template<class Type >
CppAD::vector<Type> atomic::D_incpl_gamma_shape ( CppAD::vector< Type >  x)

Atomic version of scaled incomplete gamma function differentiated to any order wrt. shape parameter

\[ \exp(c) \int_0^{y} \exp(-t) t^{\lambda-1} \log(t)^n \:dt \]

where the 4 input parameters are passed as a vector \(x=(y,\lambda,n,c)\). Note that the normalized incomplete gamma function is obtained as the special case \(n=0\) and \(c=-\log \Gamma(\lambda)\). Valid parameter range: \(x \in \mathbb{R}_+\times\mathbb{R}_+\times\mathbb{N}_0\times\mathbb{R}\).

Warning
No check is performed on parameters
Parameters
xInput vector of length 4.
Returns
Vector of length 1.

§ D_lgamma()

template<class Type >
CppAD::vector<Type> atomic::D_lgamma ( CppAD::vector< Type >  x)

Atomic version of the n'th order derivative of the log gamma function.

\[ \frac{d^n}{d\lambda^n}\log \Gamma(\lambda) \]

where the 2 input parameters are passed as a vector \(x=(\lambda,n)\). The special case \(n=0\) gives the log gamma function.

Parameters
xInput vector of length 2.
Returns
Vector of length 1.

§ inv_incpl_gamma()

template<class Type >
CppAD::vector<Type> atomic::inv_incpl_gamma ( CppAD::vector< Type >  x)

Atomic version of inverse of scaled incomplete gamma function. Given \(z\) find \(y\) such that

\[ z = \exp(c) \int_0^{y} \exp(-t) t^{\lambda-1} \:dt \]

where the 3 input parameters are passed as a vector \(x=(z,\lambda,c)\). The special case \(c=-\log \Gamma(\lambda)\) gives the inverse normalized incomplete gamma function. Valid parameter range: \(x \in \mathbb{R}_+\times\mathbb{R}_+\times\mathbb{R}\).

Warning
No check is performed on parameters
Parameters
xInput vector of length 3.
Returns
Vector of length 1.

§ invpd()

template<class Type >
CppAD::vector<Type> atomic::invpd ( CppAD::vector< Type >  x)

Atomic version of log determinant and inverse of positive definite n-by-n matrix. Calculated by Cholesky decomposition.

Parameters
xInput vector of length n*n.
Returns
Vector of length 1+n*n.

§ logdet()

template<class Type >
CppAD::vector<Type> atomic::logdet ( CppAD::vector< Type >  x)

Atomic version of log determinant of positive definite n-by-n matrix.

Parameters
xInput vector of length n*n.
Returns
Vector of length 1.
Examples:
laplace.cpp.

§ matinv()

template<class Type >
CppAD::vector<Type> atomic::matinv ( CppAD::vector< Type >  x)

Atomic version of matrix inversion. Inverts n-by-n matrix by LU-decomposition.

Parameters
xInput vector of length n*n.
Returns
Vector of length n*n.
Examples:
laplace.cpp.

Referenced by newton::jacobian_sparse_plus_lowrank_t< dummy >::llt_solve(), and matinv().

§ matmul()

template<class Type >
CppAD::vector<Type> atomic::matmul ( CppAD::vector< Type >  x)

Atomic version of matrix multiply. Multiplies n1-by-n2 matrix with n2-by-n3 matrix.

Parameters
xInput vector of length 2+n1*n2+n2*n3 containing the output dimension (length=2), the first matrix (length=n1*n2) and the second matrix (length=n2*n3).
Returns
Vector of length n1*n3 containing result of matrix multiplication.

Referenced by newton::jacobian_sparse_plus_lowrank_t< dummy >::llt_solve(), and matmul().

§ pnorm1()

template<class Type >
CppAD::vector<Type> atomic::pnorm1 ( CppAD::vector< Type >  x)

Atomic version of standard normal distribution function. Derivative is known to be 'dnorm1'.

Parameters
xInput vector of length 1.
Returns
Vector of length 1.

§ ppois()

template<class Type >
CppAD::vector<Type> atomic::ppois ( CppAD::vector< Type >  x)

Atomic version of poisson cdf \(ppois(n,\lambda)\). Valid parameter range: \(x =(n,\lambda) \in \mathbb{N}_0\times\mathbb{R}_+\).

Warning
No check is performed on parameters
Parameters
xInput vector of length 2.
Returns
Vector of length 1.

§ qnorm1()

template<class Type >
CppAD::vector<Type> atomic::qnorm1 ( CppAD::vector< Type >  x)

Atomic version of standard normal quantile function. Derivative is expressed through 'dnorm1'.

Parameters
xInput vector of length 1.
Returns
Vector of length 1.
License: GPL v2