Classes | Functions

mth Namespace Reference

All MTH functions are contained in this namespace. More...

Classes

class  Vector
 compile-time (static) vector of size N More...
class  Vector< T, 0 >
 run-time (dynamic) vector More...
class  Vector3
 convenience wrapper over apf::Vector<3> More...
class  Matrix
 compile-time (static) matrix More...
class  Matrix< T, 0, 0 >
 run-time (dynamic) matrix More...
class  Matrix3x3
 convenience wrapper over Matrix<T,3,3> More...
class  AD
 forward automatic differentiation variable More...
class  AD< T, 0 >
 forward automatic differentiation variable with dynamic variable array More...

Functions

template<class T >
Vector< T, 3 > cross (Vector< T, 3 > const &a, Vector< T, 3 > const &b)
 returns vector cross product
template<class T >
Matrix< T, 3, 3 > cross (Vector< T, 3 > const &a)
 returns the cross product matrix for the vector
template<class T , unsigned N>
Vector< T, N > project (Vector< T, N > const &a, Vector< T, N > const &b)
 returns vector a projected onto vector b
template<class T , unsigned N>
Vector< T, N > reject (Vector< T, N > const &a, Vector< T, N > const &b)
 vector rejection
template<class T , unsigned M, unsigned N>
Matrix< T, M, N > transpose (Matrix< T, M, N > const &a)
 transpose of a static matrix
template<class T >
determinant (Matrix< T, 2, 2 > const &a)
 determinant of a 2 by 2 matrix
template<class T >
determinant (Matrix< T, 3, 3 > const &a)
 determinant of a 3 by 3 matrix
template<class T >
Matrix< T, 2, 2 > inverse (Matrix< T, 2, 2 > const &a)
 invert a 2 by 2 matrix
template<class T >
Matrix< T, 3, 3 > inverse (Matrix< T, 3, 3 > const &a)
 invert a 3 by 3 matrix
template<class T >
trace (Tensor< T > const &a)
 trace of a tensor
template<class T >
norm (Tensor< T > const &a)
 Frobenius norm of a tensor.
template<class T >
determinant (Tensor< T > const &a)
 determinant of a tensor
template<class T >
void transpose (Tensor< T > const &a, Tensor< T > &r)
 transpose of a tensor
template<class T >
void inverse (Tensor< T > const &a, Tensor< T > &r)
 inverse of a tensor
template<class T >
Tensor< T > eye (unsigned d)
 identity tensor
template<class T , unsigned M, unsigned N>
unsigned decomposeQR (Matrix< T, M, N > const &a, Matrix< T, M, M > &q, Matrix< T, M, N > &r)
 finds the QR decomposition of A
template<class T , unsigned M, unsigned N>
void backsubUT (Matrix< T, M, N > const &r, Vector< T, M > const &b, Vector< T, N > &x)
 solves Rx = b for upper triangular R
template<class T , unsigned M, unsigned N>
void solveFromQR (Matrix< T, M, M > const &q, Matrix< T, M, N > const &r, Vector< T, M > const &b, Vector< T, N > &x)
 solves Ax = b given A's QR factorization
template<class T , unsigned M, unsigned N>
bool solveQR (Matrix< T, M, N > const &a, Vector< T, M > const &b, Vector< T, N > &x)
 solves Ax = b using A's QR factorization
template<class T , unsigned M>
bool eigenQR (Matrix< T, M, M > const &a, Matrix< T, M, M > &l, Matrix< T, M, M > &q, unsigned max_iters)
 computes the eigendecomposition of A
template<class T , unsigned int N>
AD< T, N > operator- (AD< T, N > const &A)
 unary subtraction
template<class T , unsigned int N>
AD< T, N > operator+ (double L, AD< T, N > const &R)
 binary addition between a double and an AD variable
template<class T , unsigned int N>
AD< T, N > operator+ (AD< T, N > const &L, double R)
 binary addition between an AD variable and a double
template<class T , class B , unsigned int N>
AD< T, N > operator+ (AD< T, N > const &L, AD< B, N > const &R)
 binary addition between two AD variables
template<class T , unsigned int N>
AD< T, N > operator- (double L, AD< T, N > const &R)
 binary subtraction between a double and an AD variable
template<class T , unsigned int N>
AD< T, N > operator- (AD< T, N > const &L, double R)
 binary subtraction between an AD variable and a double
template<class T , class B , unsigned int N>
AD< T, N > operator- (AD< T, N > const &L, AD< B, N > const &R)
 binary subtraction between two AD variables
template<class T , unsigned int N>
AD< T, N > operator* (double L, AD< T, N > const &R)
 binary multiplication between a double and an AD variable
template<class T , unsigned int N>
AD< T, N > operator* (AD< T, N > const &L, double R)
 binary multiplication between an AD variable and a double
template<class T , class B , unsigned int N>
AD< T, N > operator* (AD< T, N > const &L, AD< B, N > const &R)
 binary multiplication between two AD variables
template<class T , unsigned int N>
AD< T, N > operator/ (double L, AD< T, N > const &R)
 binary division between a double and an AD variable
template<class T , unsigned int N>
AD< T, N > operator/ (AD< T, N > const &L, double R)
 binary division between an AD variable and a double
template<class T , class B , unsigned int N>
AD< T, N > operator/ (AD< B, N > const &L, AD< T, N > const &R)
 binary division between two AD variables
double exp (double x)
 wrapper to standard exp function
template<class T , unsigned int N>
AD< T, N > exp (AD< T, N > const &A)
 exponent of an AD variable
double log (double A)
 wrapper for stander log function
template<class T , unsigned int N>
AD< T, N > log (AD< T, N > const &A)
 logarithm of an AD variable
double pow (double A, double e)
 wrapper to standard pow function
template<class T , unsigned int N>
AD< T, N > pow (AD< T, N > const &A, const int e)
 AD variable raised to an integer power.
template<class T , unsigned int N>
AD< T, N > pow (AD< T, N > const &A, const double e)
 AD variable raised to a double power.
template<class T , unsigned int N>
AD< T, N > pow (const int base, AD< T, N > const &A)
 integer raised to an AD power
template<class T , unsigned int N>
AD< T, N > pow (const double base, AD< T, N > const &A)
 double raised to an AD power
template<class T , unsigned int N>
AD< T, N > pow (AD< T, N > const &A, AD< T, N > const &e)
 AD variable raised to an AD variable power.
double sqrt (double A)
 wrapper for standard sqrt function
template<class T , unsigned int N>
AD< T, N > sqrt (AD< T, N > const &A)
 square root of an AD variable
double sin (double A)
 wrapper for standard sin function
double cos (double A)
 wrapper for standard cos function
template<class T , unsigned int N>
AD< T, N > sin (AD< T, N > const &A)
 sin of an AD variable
template<class T , unsigned int N>
AD< T, N > cos (AD< T, N > const &A)
 cos of an AD variable
template<class T , unsigned int N>
AD< T, N > tan (AD< T, N > const &A)
 tan of an AD variable
template<class T , unsigned int N>
AD< T, N > abs (AD< T, N > const &A)
 absolute value of an AD variable
template<class T , unsigned int N>
bool operator< (double L, AD< T, N > const &R)
 double less than an AD variable
template<class T , unsigned int N>
bool operator< (AD< T, N > const &R, double L)
 AD variable less than a double.
template<class T , unsigned int N>
bool operator< (AD< T, N > const &R, AD< T, N > const &L)
 AD variable less than an AD variable.
template<class T , unsigned int N>
bool operator<= (double L, AD< T, N > const &R)
 double less than or equal to an AD variable
template<class T , unsigned int N>
bool operator<= (AD< T, N > const &R, double L)
 AD variable less than or equal to a double.
template<class T , unsigned int N>
bool operator<= (AD< T, N > const &R, AD< T, N > const &L)
 AD variable less than or equal to an AD variable.
template<class T , unsigned int N>
bool operator> (double L, AD< T, N > const &R)
 double greater than an AD variable
template<class T , unsigned int N>
bool operator> (AD< T, N > const &R, double L)
 AD variable greater than a double.
template<class T , unsigned int N>
bool operator> (AD< T, N > const &R, AD< T, N > const &L)
 AD variable greater than an AD variable.
template<class T , unsigned int N>
bool operator>= (double L, AD< T, N > const &R)
 double greater than or equal to an AD variable
template<class T , unsigned int N>
bool operator>= (AD< T, N > const &R, double L)
 AD variable greater than or equal to a double.
template<class T , unsigned int N>
bool operator>= (AD< T, N > const &R, AD< T, N > const &L)
 AD variable greater than or equal to an AD variable.

Detailed Description

All MTH functions are contained in this namespace.


Function Documentation

template<class T , unsigned M, unsigned N>
void mth::backsubUT ( Matrix< T, M, N > const &  r,
Vector< T, M > const &  b,
Vector< T, N > &  x 
)

solves Rx = b for upper triangular R

when M > N, the lower rows are ignored

Parameters:
r the MxN (M >= N) upper triangular input matrix
b the Mx1 right hand side input vector
x the Nx1 output solution vector
template<class T , unsigned M, unsigned N>
unsigned mth::decomposeQR ( Matrix< T, M, N > const &  a,
Matrix< T, M, M > &  q,
Matrix< T, M, N > &  r 
)

finds the QR decomposition of A

only 3x3 static and dynamic types are explicitly instantiated

Parameters:
a the MxN input matrix (M >= N)
q the MxM orthogonal output matrix
r the MxN upper triangular output matrix
Returns:
the rank of A
template<class T , unsigned M>
bool mth::eigenQR ( Matrix< T, M, M > const &  a,
Matrix< T, M, M > &  l,
Matrix< T, M, M > &  q,
unsigned  max_iters 
)

computes the eigendecomposition of A

this function reduces A to Hessenberg form and then uses a Wilkinson-shifted QR algorithm to identify the eigenvalues and eigenvectors.

Parameters:
a the real, square, symmetric input matrix
l if successful, the diagonal eigenvalue matrix
q if successful, the orthogonal eigenvector matrix
max_iters the number of iterations after which to give up
Returns:
true if converged in less than max_iters
template<class T , unsigned M, unsigned N>
void mth::solveFromQR ( Matrix< T, M, M > const &  q,
Matrix< T, M, N > const &  r,
Vector< T, M > const &  b,
Vector< T, N > &  x 
)

solves Ax = b given A's QR factorization

when M > N, the least squares problem is solved. only the dynamic type is explicitly instantiated.

Parameters:
q the MxM orthogonal input matrix
r the MxN (M >= N) upper triangular input matrix
b the Mx1 right hand side input vector
x the Nx1 output solution vector
template<class T , unsigned M, unsigned N>
bool mth::solveQR ( Matrix< T, M, N > const &  a,
Vector< T, M > const &  b,
Vector< T, N > &  x 
)

solves Ax = b using A's QR factorization

when M > N, the least squares problem is solved. only the dynamic type is explicitly instantiated.

Parameters:
a the MxN (M >= N) input matrix
b the Mx1 right hand side input vector
x the Nx1 output solution vector
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines