TMB Documentation  v1.9.11
Functions
Special matrix functions

Special matrix functions for which derivatives are implemented. More...

Functions

template<class Type >
matrix< Type > atomic::absm (matrix< Type > x)
 Matrix absolute value. More...
 
template<class Type >
matrix< Type > atomic::expm (matrix< Type > x)
 Matrix exponential. More...
 
template<class Type >
vector< std::complex< Type > > atomic::fft (vector< std::complex< Type > > xc, bool inverse=false)
 FFT (unscaled) More...
 
template<class Type >
Type atomic::logdet (matrix< Type > x)
 Log-determinant of positive definite matrix.
 
template<class Type >
matrix< Type > atomic::matinv (matrix< Type > x)
 Matrix inverse. More...
 
template<class Type >
matrix< Type > atomic::matinvpd (matrix< Type > x, Type &logdet)
 Matrix inverse and determinant. More...
 
template<class Type >
matrix< Type > atomic::matmul (matrix< Type > x, matrix< Type > y)
 Matrix multiply. More...
 
template<class Type >
matrix< Type > atomic::sqrtm (matrix< Type > x)
 Matrix square root. More...
 

Detailed Description

Special matrix functions for which derivatives are implemented.

These matrix operations are designed to work with automatic differentiation for large dense matrices.

Function Documentation

§ absm()

template<class Type >
matrix<Type> atomic::absm ( matrix< Type >  x)

Matrix absolute value.

Calculate the absolute value matrix of a dense symmetric matrix (represented by its lower triangle). The result will be symmetric positive semi-definite. The matrix abs is defined as absm(x)=sqrtm(matmul(x,x)), but it is more numerically robust especially for singular x.

Definition at line 506 of file expm.hpp.

§ expm()

template<class Type >
matrix<Type> atomic::expm ( matrix< Type >  x)

Matrix exponential.

Calculate the matrix exponential of a dense matrix.

Definition at line 366 of file expm.hpp.

Referenced by atomic::absm().

§ fft()

template<class Type >
vector<std::complex<Type> > atomic::fft ( vector< std::complex< Type > >  xc,
bool  inverse = false 
)

FFT (unscaled)

Parameters
xcComplex vector to be transformed
inverseApply the (unscaled) inverse transform? This interface is identical to 'stats::fft' so does not perform inverse scaling.
Note
To use this function the header must be manually included.
The default implementation is not the most efficient available. The more efficient FFTW library can be used by setting the preprocessor flag EIGEN_FFTW_DEFAULT.
Examples:
fft.cpp.

Definition at line 35 of file fft.hpp.

§ matinv()

template<class Type >
matrix<Type> atomic::matinv ( matrix< Type >  x)

Matrix inverse.

Invert a matrix by LU-decomposition.

For small matrices use

x.inverse();

Definition at line 611 of file atomic_math.hpp.

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

§ matinvpd()

template<class Type >
matrix<Type> atomic::matinvpd ( matrix< Type >  x,
Type &  logdet 
)

Matrix inverse and determinant.

Calculate matrix inverse and log-determinant of a positive definite matrix.

Definition at line 624 of file atomic_math.hpp.

Referenced by density::MVNORM_t< scalartype >::cov().

§ matmul()

template<class Type >
matrix<Type> atomic::matmul ( matrix< Type >  x,
matrix< Type >  y 
)

Matrix multiply.

Matrix multiplication of large dense matrices.

For small matrices use

x * y;

Definition at line 583 of file atomic_math.hpp.

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

§ sqrtm()

template<class Type >
matrix<Type> atomic::sqrtm ( matrix< Type >  x)

Matrix square root.

Calculate the matrix square root of a dense symmetric positive definite matrix (represented by its lower triangle).

Definition at line 433 of file expm.hpp.

License: GPL v2