MDSTk Libraries  1.1.0
Medical Data Segmentation Toolkit
Namespaces | Classes | Typedefs | Functions | Variables
mds::math Namespace Reference

Namespaces

namespace  FuzzyCMeans
namespace  GaussianFunc
 

Global definitions.


namespace  LogNum
namespace  MaxLikelihoodByEM

Classes

class  CComplex
 Class representing a complex number. More...
class  CFuzzyCMeans
class  CGaussianFunc
 N-dimensional gaussian function having diagonal covariance matrix. More...
class  CLogNum
 Class representing a number in logarithmic space. More...
class  CMathTraits
 Numerical traits used by math (e.g. More...
class  CMatrix
 Class template for a two dimensional dense matrix stored in row-major format. More...
class  CMatrixBase
 Base class for all two-dimensional matrixes. More...
class  CMatrixIterator
 Iterator used to traverse matrix elements by rows. More...
struct  CMatrixTraits
 Traits used to implement curiously recurring template pattern for matrices. More...
struct  CMatrixTraits< CMatrix< T > >
struct  CMatrixTraits< CStaticMatrix< T, U, V > >
class  CMaxLikelihoodByEM
 Gaussian Mixture Model (GMM) optimization using maximal likelihood estimation via the Expection-Maximization (EM) algorithm. More...
class  CNormalPRNG
 Pseudo-Random Number Generator (PRNG) having the normal (gaussian) distribution. More...
class  CPseudoRNG
 Pseudo-Random Number Generator (PRNG) base class. More...
class  CSparseMatrix
 Template for a two dimensional sparse matrix. More...
class  CSparseMatrixAlt
 Template for a two dimensional sparse matrix. More...
class  CSparseMatrixAltIterator
 Sparse matrix iterator. More...
class  CSparseMatrixBase
 Base class for all two-dimensional sparse matrixes. More...
class  CSparseMatrixIterator
 Sparse matrix iterator. More...
struct  CSparseMatrixTraits
 Traits used to implement curiously recurring template pattern for sparse matrices. More...
struct  CSparseMatrixTraits< CSparseMatrix< T > >
struct  CSparseMatrixTraits< CSparseMatrixAlt< T > >
class  CStaticMatrix
 Class template for a two dimensional static row-major dense matrix. More...
class  CStaticVector
 Class template for a static vector. More...
class  CUniformPRNG
 Pseudo-Random Number Generator (PRNG) having the uniform distribution. More...
class  CVector
 Class template providing basic dense vector operations. More...
class  CVectorBase
 Base class for all vectors. More...
class  CVectorIterator
 Iterator used to traverse vector elements. More...
struct  CVectorTraits
 Traits used to implement curiously recurring template pattern for vectors. More...
struct  CVectorTraits< CStaticVector< T, M > >
struct  CVectorTraits< CVector< T > >
struct  SFundamentalType
 Helper structure used to create vector from fundamental types. More...
struct  SMakeVector
 Helper structure used to create vector from fundamental types. More...
struct  SVectorType
 Helper structure used to create vector from fundamental types. More...

Typedefs

typedef CComplex< double > CDComplex
 Double complex number.
typedef CLogNum< double > CDLogNum
 Double number in logarithmic space.
typedef CMatrix< double > CDMatrix
 Matrix of double numbers.
typedef CStaticMatrix< double, 2, 2 > CDMatrix2x2
 Matrix of double numbers.
typedef CStaticMatrix< double, 3, 3 > CDMatrix3x3
typedef CStaticMatrix< double, 4, 4 > CDMatrix4x4
typedef CDMatrix::tSmartPtr CDMatrixPtr
 Smart pointer to a matrix of double numbers.
typedef CSparseMatrix< double > CDSparseMatrix
 Matrix of double numbers.
typedef CSparseMatrixAlt< double > CDSparseMatrixAlt
 Matrix of double numbers.
typedef CSparseMatrixAlt
< double >::tSmartPtr 
CDSparseMatrixAltPtr
 Matrix of double numbers.
typedef CSparseMatrix< double >
::tSmartPtr 
CDSparseMatrixPtr
 Matrix of double numbers.
typedef CVector< double > CDVector
 Dynamic vector of doubles.
typedef CStaticVector< double, 2 > CDVector2
 Vector of double numbers.
typedef CStaticVector< double, 3 > CDVector3
typedef CStaticVector< double, 4 > CDVector4
typedef CDVector::tSmartPtr CDVectorPtr
 Pointer to a dynamic vector of doubles.
typedef CComplex< float > CFComplex
 Float complex number.
typedef CLogNum< float > CFLogNum
 Float number in logarithmic space.
typedef CMatrix< float > CFMatrix
 Matrix of float numbers.
typedef CStaticMatrix< float, 2, 2 > CFMatrix2x2
 Matrix of float numbers.
typedef CStaticMatrix< float, 3, 3 > CFMatrix3x3
typedef CStaticMatrix< float, 4, 4 > CFMatrix4x4
typedef CFMatrix::tSmartPtr CFMatrixPtr
 Smart pointer to a matrix of float numbers.
typedef CSparseMatrix< float > CFSparseMatrix
 Matrix of float numbers.
typedef CSparseMatrixAlt< float > CFSparseMatrixAlt
 Matrix of float numbers.
typedef CSparseMatrixAlt
< float >::tSmartPtr 
CFSparseMatrixAltPtr
 Matrix of float numbers.
typedef CSparseMatrix< float >
::tSmartPtr 
CFSparseMatrixPtr
 Matrix of float numbers.
typedef CVector< float > CFVector
 Dynamic vector of float numbers.
typedef CStaticVector< float, 2 > CFVector2
 Vector of float numbers.
typedef CStaticVector< float, 3 > CFVector3
typedef CStaticVector< float, 4 > CFVector4
typedef CFVector::tSmartPtr CFVectorPtr
 Pointer to a dynamic vector of float numbers.
typedef CMatrix< intCIMatrix
 Matrix of int numbers.
typedef CStaticMatrix< int, 2, 2 > CIMatrix2x2
 Matrix of int numbers.
typedef CStaticMatrix< int, 3, 3 > CIMatrix3x3
typedef CStaticMatrix< int, 4, 4 > CIMatrix4x4
typedef CIMatrix::tSmartPtr CIMatrixPtr
 Smart pointer to a matrix of int numbers.
typedef CSparseMatrix< intCISparseMatrix
 Matrix of int numbers.
typedef CSparseMatrixAlt< intCISparseMatrixAlt
 Matrix of int numbers.
typedef CSparseMatrixAlt< int >
::tSmartPtr 
CISparseMatrixAltPtr
 Matrix of int numbers.
typedef CSparseMatrix< int >
::tSmartPtr 
CISparseMatrixPtr
 Matrix of int numbers.
typedef CVector< intCIVector
 Dynamic vector of int numbers.
typedef CStaticVector< int, 2 > CIVector2
 Vector of int numbers.
typedef CStaticVector< int, 3 > CIVector3
typedef CStaticVector< int, 4 > CIVector4
typedef CIVector::tSmartPtr CIVectorPtr
 Pointer to a dynamic vector of int numbers.
typedef CDComplex tDComplex
 Double complex number.
typedef CDLogNum tDLogNum
 Double number in logarithmic space.
typedef CFComplex tFComplex
 Float complex number.
typedef CFLogNum tFLogNum
 Float number in logarithmic space.

Functions

template<typename T >
bool conv2Bool (const T &x)
 Conversion of a given number to bool.
template<>
void cut (mds::img::tRGBPixel &x, const mds::img::tRGBPixel &a, const mds::img::tRGBPixel &b, const mds::img::tRGBPixel &n)
 Specialization of the function that remains values in the range <a, b> unchanged, othervise a new value n is assigned.
template<typename T >
void cut (CComplex< T > &x, const CComplex< T > &a, const CComplex< T > &b, const CComplex< T > &n)
 Function remains values in the range <a, b> unchanged, othervise a new value n is assigned.
template<typename T >
void cut (T &x, const T &a, const T &b, const T &n)
 Values in the range <a, b> remain unchanged, othervise a new value n is assigned.
double deg2Rad (double Degrees)
 Converts degrees to radians.
int dummyFunc ()
 Dummy function.
template<class M , class V >
void eig (CMatrixBase< M > &Matrix, CVectorBase< V > &Values)
 Inplace computation of eigenvalues and eigenvectors of a square symmetric matrix.
template<typename T >
const T & get2Pi ()
 Returns the value 2*pi.
template<typename T >
getAbs (const T &a)
 Absolute value.
template<>
unsigned int getAbs (const unsigned int &a)
 Specialization of the function that returns an absolute value.
template<>
unsigned short getAbs (const unsigned short &a)
 Specialization of the function that returns an absolute value.
template<>
unsigned long getAbs (const unsigned long &a)
 Specialization of the function that returns an absolute value.
template<typename T >
getAbs (const CComplex< T > &z)
 Returns absolute value (magnitude) of the complex number.
template<>
mds::img::tRGBPixel getAbs (const mds::img::tRGBPixel &a)
 Specialization of the function that returns an absolute value.
template<typename T >
getArg (const CComplex< T > &z)
 Returns argument (phase) of the complex number.
template<typename T >
CComplex< T > getConj (const CComplex< T > &z)
 Returns complex conjugate number.
template<typename T >
CComplex< T > getCos (const CComplex< T > &z)
 Returns cosine of the complex number.
template<typename T >
CComplex< T > getCosh (const CComplex< T > &z)
 Returns hyperbolic cosine of the complex number.
template<typename R , class M >
getDeterminant (const CMatrixBase< M > &Matrix)
 Returns determinant of a square matrix.
template<typename T >
const T & getE ()
 Returns the Euler's constant.
template<typename R , class V1 , class V2 >
getError (const CVectorBase< V1 > &Vector1, const CVectorBase< V2 > &Vector2)
 Normalized mean error between two vectors - 1/N * sum(abs(v1 - v2)).
template<typename T >
CComplex< T > getExp (const CComplex< T > &z)
 Returns exponential of the complex number.
template<typename T >
const T & getHalfPi ()
 Returns the value pi/2.
template<typename T >
getImag (const CComplex< T > &z)
 Returns m_imaginary part of a complex number.
template<typename T >
CComplex< T > getLog (const CComplex< T > &z)
 Returns natural logarithm with base e of the complex number.
template<typename T >
CComplex< T > getLog10 (const CComplex< T > &z)
 Returns logarithm with base 10 of the complex number.
template<typename R , class V >
getMax (const CVectorBase< V > &Vector)
 Maximum element in the vector.
template<typename R , class M >
getMax (const CMatrixBase< M > &Matrix)
 Maximum value in the matrix.
template<typename T >
getMax (const T &a, const T &b)
 Returns maximum of two values.
template<typename T >
getMax (const T &a, const T &b, const T &c)
 Returns maximum of three values.
template<typename T >
getMax (const T &a, const T &b, const T &c, const T &d)
 Returns maximum of four values.
template<typename T >
CComplex< T > getMax (const CComplex< T > &a, const CComplex< T > &b)
 Function returns maximum of two values.
template<>
mds::img::tRGBPixel getMax (const mds::img::tRGBPixel &a, const mds::img::tRGBPixel &b)
 Specialization of the function that returns maximum of two values.
template<typename R , class V >
getMean (const CVectorBase< V > &Vector)
 Mean of vector elements.
template<typename R , class M >
getMean (const CMatrixBase< M > &Matrix)
 Mean value of matrix elements.
template<typename R , class V >
getMin (const CVectorBase< V > &Vector)
 Minimum element in the vector.
template<typename R , class M >
getMin (const CMatrixBase< M > &Matrix)
 Minimum value in the matrix.
template<typename T >
getMin (const T &a, const T &b)
 Returns minimum of two values.
template<typename T >
getMin (const T &a, const T &b, const T &c)
 Returns minimum of three values.
template<typename T >
getMin (const T &a, const T &b, const T &c, const T &d)
 Returns minimum of four values.
template<typename T >
CComplex< T > getMin (const CComplex< T > &a, const CComplex< T > &b)
 Function returns minimum of two values.
template<>
mds::img::tRGBPixel getMin (const mds::img::tRGBPixel &a, const mds::img::tRGBPixel &b)
 Specialization of the function that returns minimum of two values.
template<typename R , class V >
getMult (const CVectorBase< V > &Vector)
 Multiplication of all elements in the vector.
template<typename R , class M >
getMult (const CMatrixBase< M > &Matrix)
 Returns result of multiplication of all matrix elements.
template<typename T >
getNorm (const CComplex< T > &z)
 Returns squared absolute value of the complex number.
template<typename T >
const T & getPi ()
 Returns the constant pi.
template<typename T >
CComplex< T > getPow (const CComplex< T > &x, const CComplex< T > &y)
 Returns complex power.
template<typename T >
CComplex< T > getPow (const CComplex< T > &x, const T &y)
 Returns complex power.
template<typename T >
CComplex< T > getPow (const T &x, const CComplex< T > &y)
 Returns complex power.
template<typename T >
CComplex< T > getPow (const CComplex< T > &x, int y)
 Returns complex power of a complex number.
template<typename R , class V1 , class V2 >
getProd (const CVectorBase< V1 > &Vector1, const CVectorBase< V2 > &Vector2)
 Returns inner product of two vectors.
template<typename R , class M1 , class M2 >
getProduct (const CMatrixBase< M1 > &Matrix1, const CMatrixBase< M2 > &Matrix2)
 Inner product of two matrices.
template<typename T >
getReal (const CComplex< T > &z)
 Returns real part of a complex number.
template<typename T >
CComplex< T > getSin (const CComplex< T > &z)
 Returns sine of a complex number.
template<typename T >
CComplex< T > getSinh (const CComplex< T > &z)
 Returns hyperbolic sine of a complex number.
template<typename T >
CComplex< T > getSqrt (const CComplex< T > &z)
 Returns square root of the complex number.
template<typename T >
const T & getSqrt2 ()
 Returns square root of the number 2.
template<typename T >
const T & getSqrt2Pi ()
 Returns the value sqrt(2*pi).
template<typename T >
const T & getSqrt3 ()
 Returns square root of the number 3.
template<typename T >
const T & getSqrt6 ()
 Returns square root of the number 6.
template<typename R , class M1 , class M2 >
getSquareError (const CMatrixBase< M1 > &Matrix1, const CMatrixBase< M2 > &Matrix2)
 Normalized mean square error between elements of two matrices - 1/N * sum((m1 - m2)^2).
template<typename R , class V1 , class V2 >
getSquareError (const CVectorBase< V1 > &Vector1, const CVectorBase< V2 > &Vector2)
 Normalized mean square error between two vectors - 1/N * sum((v1 - v2)^2).
template<typename R , class V >
getSum (const CVectorBase< V > &Vector)
 Sum of elements in the vector.
template<typename R , class M >
getSum (const CMatrixBase< M > &Matrix)
 Returns sum of all matrix elements.
template<typename R , class V >
getSumOfSquares (const CVectorBase< V > &Vector)
 Sum of squares of elements in the vector.
template<typename R , class M >
getSumOfSquares (const CMatrixBase< M > &Matrix)
 Returns sum of squares of the matrix elements.
template<typename T >
CComplex< T > getTan (const CComplex< T > &z)
 Returns tangent of a complex number.
template<typename T >
CComplex< T > getTanh (const CComplex< T > &z)
 Returns hyperbolic tangent of a complex number.
template<typename R , class M >
getTrace (const CMatrixBase< M > &Matrix)
 Returns trace of the square matrix.
template<typename R , class V >
getVariance (const CVectorBase< V > &Vector)
 Variance of vector elements.
template<typename R , class M >
getVariance (const CMatrixBase< M > &Matrix)
 Variance of matrix elements.
template<class V1 , class V2 >
void inplaceAdd (CVectorBase< V2 > &R, const CVectorBase< V1 > &A)
 Operation: R += A.
template<typename T , class V1 , class V2 >
void inplaceMultAdd (CVectorBase< V2 > &R, const CVectorBase< V1 > &A, const T &b)
 Operation: R += A * b.
template<class V1 , class V2 >
void inplaceSub (CVectorBase< V2 > &R, const CVectorBase< V1 > &A)
 Operation: R += A.
template<class M >
void inverse (CMatrixBase< M > &Matrix)
 Inplace computation of a square matrix inverse.
template<typename T >
bool isEven (const T &x)
 Returns true if a given integer number is even.
template<typename T >
bool isOdd (const T &x)
 Returns true if a given integer number is odd.
template<>
void limit (mds::img::tRGBPixel &x, const mds::img::tRGBPixel &a, const mds::img::tRGBPixel &b)
 Specialization of the function that limits value x into an interval <a, b>.
template<typename T >
void limit (CComplex< T > &x, const CComplex< T > &a, const CComplex< T > &b)
 Function limits value x into the interval <a, b>.
template<typename T >
void limit (T &x, const T &a, const T &b)
 Value x is limited into an interval <a, b>.
template<typename T >
SMakeVector< T >::tResult makeVector (const T &Value)
 Returns reference to a vector.
template<typename T >
const T & makeVectorImpl (const T &Value, SVectorType)
 Specialization of the function.
template<typename T >
T & makeVectorImpl (T &Value, SVectorType)
 Specialization of the function.
template<typename T >
CStaticVector< T, 1 > makeVectorImpl (T &Value, SFundamentalType)
 Specialization of the function.
template<typename T >
CStaticVector< T, 1 > makeVectorImpl (const T &Value, SFundamentalType)
 Specialization of the function.
template<typename T >
void mirror (T &x, const T &a, const T &b)
 Value x is mirrored into a given interval <a, b>.
template<typename T >
bool operator!= (const CLogNum< T > &x, const CLogNum< T > &y)
template<typename T >
bool operator!= (const CLogNum< T > &x, T y)
template<typename T >
bool operator!= (T x, const CLogNum< T > &y)
template<typename T >
bool operator!= (const CComplex< T > &x, const CComplex< T > &y)
template<typename T >
bool operator!= (const CComplex< T > &x, const T &y)
template<typename T >
bool operator!= (const T &x, const CComplex< T > &y)
template<typename T >
CLogNum< T > operator* (const CLogNum< T > &x, const CLogNum< T > &y)
template<typename T >
CLogNum< T > operator* (const CLogNum< T > &x, T y)
template<typename T >
CLogNum< T > operator* (T x, const CLogNum< T > &y)
template<typename T >
CComplex< T > operator* (const CComplex< T > &x, const CComplex< T > &y)
template<typename T , typename U >
CComplex< T > operator* (const CComplex< T > &x, const U &y)
template<typename T , typename U >
CComplex< T > operator* (const U &x, const CComplex< T > &y)
template<typename T >
CLogNum< T > operator+ (const CLogNum< T > &x, const CLogNum< T > &y)
template<typename T >
CLogNum< T > operator+ (const CLogNum< T > &x, T y)
template<typename T >
CLogNum< T > operator+ (T x, const CLogNum< T > &y)
template<typename T >
CComplex< T > operator+ (const CComplex< T > &x, const CComplex< T > &y)
template<typename T , typename U >
CComplex< T > operator+ (const CComplex< T > &x, const U &y)
template<typename T , typename U >
CComplex< T > operator+ (const U &x, const CComplex< T > &y)
template<typename T >
CComplex< T > operator+ (const CComplex< T > &x)
template<typename T >
CLogNum< T > operator- (const CLogNum< T > &x, const CLogNum< T > &y)
template<typename T >
CLogNum< T > operator- (const CLogNum< T > &x, T y)
template<typename T >
CLogNum< T > operator- (T x, const CLogNum< T > &y)
template<typename T >
CComplex< T > operator- (const CComplex< T > &x, const CComplex< T > &y)
template<typename T , typename U >
CComplex< T > operator- (const CComplex< T > &x, const U &y)
template<typename T , typename U >
CComplex< T > operator- (const U &x, const CComplex< T > &y)
template<typename T >
CComplex< T > operator- (const CComplex< T > &x)
template<typename T >
CLogNum< T > operator/ (const CLogNum< T > &x, const CLogNum< T > &y)
template<typename T >
CLogNum< T > operator/ (const CLogNum< T > &x, T y)
template<typename T >
CLogNum< T > operator/ (T x, const CLogNum< T > &y)
template<typename T >
CComplex< T > operator/ (const CComplex< T > &x, const CComplex< T > &y)
template<typename T >
CComplex< T > operator/ (const T &x, const CComplex< T > &y)
template<typename T >
CComplex< T > operator/ (const CComplex< T > &x, const T &y)
template<typename T >
bool operator< (const CLogNum< T > &x, const CLogNum< T > &y)
template<typename T >
bool operator< (const CLogNum< T > &x, T y)
template<typename T >
bool operator< (T x, const CLogNum< T > &y)
template<class V >
std::ostream & operator<< (std::ostream &Stream, const CVectorBase< V > &Vector)
 Prints the vector to a given output stream.
template<class M >
std::ostream & operator<< (std::ostream &Stream, const CMatrixBase< M > &Matrix)
 Prints the matrix to a given output stream.
template<typename T >
std::ostream & operator<< (std::ostream &Stream, const CLogNum< T > &n)
 Writes number in the logarithmic space to an output stream.
template<typename T >
std::ostream & operator<< (std::ostream &Stream, const CComplex< T > &z)
 Writes complex number to an output stm_ream.
template<typename T >
bool operator<= (const CLogNum< T > &x, const CLogNum< T > &y)
template<typename T >
bool operator<= (const CLogNum< T > &x, T y)
template<typename T >
bool operator<= (T x, const CLogNum< T > &y)
template<typename T >
bool operator== (const CLogNum< T > &x, const CLogNum< T > &y)
template<typename T >
bool operator== (const CLogNum< T > &x, T y)
template<typename T >
bool operator== (T x, const CLogNum< T > &y)
template<typename T >
bool operator== (const CComplex< T > &x, const CComplex< T > &y)
template<typename T >
bool operator== (const CComplex< T > &x, const T &y)
template<typename T >
bool operator== (const T &x, const CComplex< T > &y)
template<typename T >
bool operator> (const CLogNum< T > &x, const CLogNum< T > &y)
template<typename T >
bool operator> (const CLogNum< T > &x, T y)
template<typename T >
bool operator> (T x, const CLogNum< T > &y)
template<typename T >
bool operator>= (const CLogNum< T > &x, const CLogNum< T > &y)
template<typename T >
bool operator>= (const CLogNum< T > &x, T y)
template<typename T >
bool operator>= (T x, const CLogNum< T > &y)
template<typename T >
std::istream & operator>> (std::istream &Stream, CLogNum< T > &n)
 Reads number in the logarithmic space to an input stream.
template<typename T >
std::istream & operator>> (std::istream &Stream, CComplex< T > &z)
 Reads complex number from an input stream.
template<typename T >
CComplex< T > polar (const T &x)
 Creates a temporary complex number from polar coordinates.
template<typename T >
CComplex< T > polar (const T &x, const T &y)
 Creates a temporary complex number from polar coordinates.
double rad2deg (double Radians)
 Converts degrees to radians.
template<typename T >
int round2Int (const T &x)
 Rounds a given floating point number to integer.
template<typename T >
void solve (CSparseMatrixAlt< T > &A, CVector< T > &b, CVector< T > &x)
 This function solves sparse linear system Ax = b.
template<>
void solve (CSparseMatrixAlt< double > &A, CVector< double > &b, CVector< double > &x)
 Defined for sparse systems of double values.
template<typename T >
void swap (T &a, T &b)
 Exchanges two values.
template<>
void swap (int &a, int &b)
 Exchanges two int numbers.
template<>
void swap (unsigned &a, unsigned &b)
 Exchanges two unsigned int numbers.
template<>
void swap (long &a, long &b)
 Exchanges two long numbers.
template<>
void swap (unsigned long &a, unsigned long &b)
 Exchanges two unsigned long numbers.

Variables

const int DUMMY_CONSTANT = 0
 Dummy value.
const double E = 2.718281828459045
 Euler's constant.
const double HALF_PI = 0.5 * PI
 Constant pi/2.
const double PI = 3.141592653589793
 Constant pi.
const double SQRT2 = 1.414213562373095
 Square root of the number 2.
const double SQRT3 = 1.732050807568877
 Square root of the number 3.
const double SQRT6 = 2.449489742783178
 Square root of the number 6.
const double SQRT_TWO_PI = 2.506628274631001
 Constant sqrt(2*pi).
const double TWO_PI = 2.0 * PI
 Constant 2*pi.

Typedef Documentation

typedef CComplex<double> mds::math::CDComplex

Double complex number.

typedef CLogNum<double> mds::math::CDLogNum

Double number in logarithmic space.

typedef CMatrix<double> mds::math::CDMatrix

Matrix of double numbers.

typedef CStaticMatrix<double, 2, 2> mds::math::CDMatrix2x2

Matrix of double numbers.

typedef CStaticMatrix<double, 3, 3> mds::math::CDMatrix3x3
typedef CStaticMatrix<double, 4, 4> mds::math::CDMatrix4x4
typedef CDMatrix::tSmartPtr mds::math::CDMatrixPtr

Smart pointer to a matrix of double numbers.

Matrix of double numbers.

Matrix of double numbers.

Matrix of double numbers.

typedef CSparseMatrix<double>::tSmartPtr mds::math::CDSparseMatrixPtr

Matrix of double numbers.

typedef CVector<double> mds::math::CDVector

Dynamic vector of doubles.

typedef CStaticVector<double, 2> mds::math::CDVector2

Vector of double numbers.

typedef CStaticVector<double, 3> mds::math::CDVector3
typedef CStaticVector<double, 4> mds::math::CDVector4
typedef CDVector::tSmartPtr mds::math::CDVectorPtr

Pointer to a dynamic vector of doubles.

Float complex number.

typedef CLogNum<float> mds::math::CFLogNum

Float number in logarithmic space.

typedef CMatrix<float> mds::math::CFMatrix

Matrix of float numbers.

typedef CStaticMatrix<float, 2, 2> mds::math::CFMatrix2x2

Matrix of float numbers.

typedef CStaticMatrix<float, 3, 3> mds::math::CFMatrix3x3
typedef CStaticMatrix<float, 4, 4> mds::math::CFMatrix4x4
typedef CFMatrix::tSmartPtr mds::math::CFMatrixPtr

Smart pointer to a matrix of float numbers.

Matrix of float numbers.

Matrix of float numbers.

Matrix of float numbers.

typedef CSparseMatrix<float>::tSmartPtr mds::math::CFSparseMatrixPtr

Matrix of float numbers.

typedef CVector<float> mds::math::CFVector

Dynamic vector of float numbers.

Vector of float numbers.

typedef CFVector::tSmartPtr mds::math::CFVectorPtr

Pointer to a dynamic vector of float numbers.

Matrix of int numbers.

Matrix of int numbers.

typedef CIMatrix::tSmartPtr mds::math::CIMatrixPtr

Smart pointer to a matrix of int numbers.

Matrix of int numbers.

Matrix of int numbers.

Matrix of int numbers.

Matrix of int numbers.

Dynamic vector of int numbers.

Vector of int numbers.

typedef CIVector::tSmartPtr mds::math::CIVectorPtr

Pointer to a dynamic vector of int numbers.

Double complex number.

Double number in logarithmic space.

Float complex number.

Float number in logarithmic space.


Function Documentation

template<typename T >
bool mds::math::conv2Bool ( const T &  x)

Conversion of a given number to bool.

template<>
void mds::math::cut ( mds::img::tRGBPixel x,
const mds::img::tRGBPixel a,
const mds::img::tRGBPixel b,
const mds::img::tRGBPixel n 
)

Specialization of the function that remains values in the range <a, b> unchanged, othervise a new value n is assigned.

template<typename T >
void mds::math::cut ( CComplex< T > &  x,
const CComplex< T > &  a,
const CComplex< T > &  b,
const CComplex< T > &  n 
)

Function remains values in the range <a, b> unchanged, othervise a new value n is assigned.

template<typename T >
void mds::math::cut ( T &  x,
const T &  a,
const T &  b,
const T &  n 
)

Values in the range <a, b> remain unchanged, othervise a new value n is assigned.

double mds::math::deg2Rad ( double  Degrees)

Converts degrees to radians.

Dummy function.

template<class M , class V >
void mds::math::eig ( CMatrixBase< M > &  Matrix,
CVectorBase< V > &  Values 
)

Inplace computation of eigenvalues and eigenvectors of a square symmetric matrix.

  • Throws warning on failure.
template<typename T >
const T& mds::math::get2Pi ( )

Returns the value 2*pi.

template<typename T >
T mds::math::getAbs ( const T &  a)

Absolute value.

template<>
unsigned int mds::math::getAbs ( const unsigned int a)

Specialization of the function that returns an absolute value.

template<>
unsigned short mds::math::getAbs ( const unsigned short &  a)

Specialization of the function that returns an absolute value.

template<>
unsigned long mds::math::getAbs ( const unsigned long &  a)

Specialization of the function that returns an absolute value.

template<typename T >
T mds::math::getAbs ( const CComplex< T > &  z)

Returns absolute value (magnitude) of the complex number.

Specialization of the function that returns an absolute value.

template<typename T >
T mds::math::getArg ( const CComplex< T > &  z)

Returns argument (phase) of the complex number.

template<typename T >
CComplex<T> mds::math::getConj ( const CComplex< T > &  z)

Returns complex conjugate number.

template<typename T >
CComplex<T> mds::math::getCos ( const CComplex< T > &  z)

Returns cosine of the complex number.

template<typename T >
CComplex<T> mds::math::getCosh ( const CComplex< T > &  z)

Returns hyperbolic cosine of the complex number.

template<typename R , class M >
R mds::math::getDeterminant ( const CMatrixBase< M > &  Matrix)

Returns determinant of a square matrix.

template<typename T >
const T& mds::math::getE ( )

Returns the Euler's constant.

template<typename R , class V1 , class V2 >
R mds::math::getError ( const CVectorBase< V1 > &  Vector1,
const CVectorBase< V2 > &  Vector2 
)

Normalized mean error between two vectors - 1/N * sum(abs(v1 - v2)).

template<typename T >
CComplex<T> mds::math::getExp ( const CComplex< T > &  z)

Returns exponential of the complex number.

template<typename T >
const T& mds::math::getHalfPi ( )

Returns the value pi/2.

template<typename T >
T mds::math::getImag ( const CComplex< T > &  z)

Returns m_imaginary part of a complex number.

template<typename T >
CComplex<T> mds::math::getLog ( const CComplex< T > &  z)

Returns natural logarithm with base e of the complex number.

template<typename T >
CComplex<T> mds::math::getLog10 ( const CComplex< T > &  z)

Returns logarithm with base 10 of the complex number.

template<typename R , class V >
R mds::math::getMax ( const CVectorBase< V > &  Vector)

Maximum element in the vector.

template<typename R , class M >
R mds::math::getMax ( const CMatrixBase< M > &  Matrix)

Maximum value in the matrix.

template<typename T >
T mds::math::getMax ( const T &  a,
const T &  b 
)

Returns maximum of two values.

template<typename T >
T mds::math::getMax ( const T &  a,
const T &  b,
const T &  c 
)

Returns maximum of three values.

template<typename T >
T mds::math::getMax ( const T &  a,
const T &  b,
const T &  c,
const T &  d 
)

Returns maximum of four values.

template<typename T >
CComplex<T> mds::math::getMax ( const CComplex< T > &  a,
const CComplex< T > &  b 
)

Function returns maximum of two values.

Specialization of the function that returns maximum of two values.

template<typename R , class V >
R mds::math::getMean ( const CVectorBase< V > &  Vector)

Mean of vector elements.

template<typename R , class M >
R mds::math::getMean ( const CMatrixBase< M > &  Matrix)

Mean value of matrix elements.

template<typename R , class V >
R mds::math::getMin ( const CVectorBase< V > &  Vector)

Minimum element in the vector.

template<typename R , class M >
R mds::math::getMin ( const CMatrixBase< M > &  Matrix)

Minimum value in the matrix.

template<typename T >
T mds::math::getMin ( const T &  a,
const T &  b 
)

Returns minimum of two values.

template<typename T >
T mds::math::getMin ( const T &  a,
const T &  b,
const T &  c 
)

Returns minimum of three values.

template<typename T >
T mds::math::getMin ( const T &  a,
const T &  b,
const T &  c,
const T &  d 
)

Returns minimum of four values.

template<typename T >
CComplex<T> mds::math::getMin ( const CComplex< T > &  a,
const CComplex< T > &  b 
)

Function returns minimum of two values.

Specialization of the function that returns minimum of two values.

template<typename R , class V >
R mds::math::getMult ( const CVectorBase< V > &  Vector)

Multiplication of all elements in the vector.

template<typename R , class M >
R mds::math::getMult ( const CMatrixBase< M > &  Matrix)

Returns result of multiplication of all matrix elements.

template<typename T >
T mds::math::getNorm ( const CComplex< T > &  z)

Returns squared absolute value of the complex number.

template<typename T >
const T& mds::math::getPi ( )

Returns the constant pi.

template<typename T >
CComplex<T> mds::math::getPow ( const CComplex< T > &  x,
const CComplex< T > &  y 
)

Returns complex power.

template<typename T >
CComplex<T> mds::math::getPow ( const CComplex< T > &  x,
const T &  y 
)

Returns complex power.

template<typename T >
CComplex<T> mds::math::getPow ( const T &  x,
const CComplex< T > &  y 
)

Returns complex power.

template<typename T >
CComplex<T> mds::math::getPow ( const CComplex< T > &  x,
int  y 
)

Returns complex power of a complex number.

template<typename R , class V1 , class V2 >
R mds::math::getProd ( const CVectorBase< V1 > &  Vector1,
const CVectorBase< V2 > &  Vector2 
)

Returns inner product of two vectors.

  • Takes into account only the overlapping part of both vectors.
template<typename R , class M1 , class M2 >
R mds::math::getProduct ( const CMatrixBase< M1 > &  Matrix1,
const CMatrixBase< M2 > &  Matrix2 
)

Inner product of two matrices.

template<typename T >
T mds::math::getReal ( const CComplex< T > &  z)

Returns real part of a complex number.

template<typename T >
CComplex<T> mds::math::getSin ( const CComplex< T > &  z)

Returns sine of a complex number.

template<typename T >
CComplex<T> mds::math::getSinh ( const CComplex< T > &  z)

Returns hyperbolic sine of a complex number.

template<typename T >
CComplex<T> mds::math::getSqrt ( const CComplex< T > &  z)

Returns square root of the complex number.

template<typename T >
const T& mds::math::getSqrt2 ( )

Returns square root of the number 2.

template<typename T >
const T& mds::math::getSqrt2Pi ( )

Returns the value sqrt(2*pi).

template<typename T >
const T& mds::math::getSqrt3 ( )

Returns square root of the number 3.

template<typename T >
const T& mds::math::getSqrt6 ( )

Returns square root of the number 6.

template<typename R , class M1 , class M2 >
R mds::math::getSquareError ( const CMatrixBase< M1 > &  Matrix1,
const CMatrixBase< M2 > &  Matrix2 
)

Normalized mean square error between elements of two matrices - 1/N * sum((m1 - m2)^2).

template<typename R , class V1 , class V2 >
R mds::math::getSquareError ( const CVectorBase< V1 > &  Vector1,
const CVectorBase< V2 > &  Vector2 
)

Normalized mean square error between two vectors - 1/N * sum((v1 - v2)^2).

template<typename R , class V >
R mds::math::getSum ( const CVectorBase< V > &  Vector)

Sum of elements in the vector.

template<typename R , class M >
R mds::math::getSum ( const CMatrixBase< M > &  Matrix)

Returns sum of all matrix elements.

template<typename R , class V >
R mds::math::getSumOfSquares ( const CVectorBase< V > &  Vector)

Sum of squares of elements in the vector.

template<typename R , class M >
R mds::math::getSumOfSquares ( const CMatrixBase< M > &  Matrix)

Returns sum of squares of the matrix elements.

template<typename T >
CComplex<T> mds::math::getTan ( const CComplex< T > &  z)

Returns tangent of a complex number.

template<typename T >
CComplex<T> mds::math::getTanh ( const CComplex< T > &  z)

Returns hyperbolic tangent of a complex number.

template<typename R , class M >
R mds::math::getTrace ( const CMatrixBase< M > &  Matrix)

Returns trace of the square matrix.

  • Trace of an n-by-n square matrix A is defined to be the sum of the elements on the main diagonal.
  • If the matrix is not square, only its square part is taken.
template<typename R , class V >
R mds::math::getVariance ( const CVectorBase< V > &  Vector)

Variance of vector elements.

  • Standard deviation is square root of the returned variance!
template<typename R , class M >
R mds::math::getVariance ( const CMatrixBase< M > &  Matrix)

Variance of matrix elements.

  • Standard deviation is square root of the returned variance!
template<class V1 , class V2 >
void mds::math::inplaceAdd ( CVectorBase< V2 > &  R,
const CVectorBase< V1 > &  A 
)

Operation: R += A.

template<typename T , class V1 , class V2 >
void mds::math::inplaceMultAdd ( CVectorBase< V2 > &  R,
const CVectorBase< V1 > &  A,
const T &  b 
)

Operation: R += A * b.

template<class V1 , class V2 >
void mds::math::inplaceSub ( CVectorBase< V2 > &  R,
const CVectorBase< V1 > &  A 
)

Operation: R += A.

template<class M >
void mds::math::inverse ( CMatrixBase< M > &  Matrix)

Inplace computation of a square matrix inverse.

  • Throws warning on failure.
template<typename T >
bool mds::math::isEven ( const T &  x)

Returns true if a given integer number is even.

template<typename T >
bool mds::math::isOdd ( const T &  x)

Returns true if a given integer number is odd.

template<>
void mds::math::limit ( mds::img::tRGBPixel x,
const mds::img::tRGBPixel a,
const mds::img::tRGBPixel b 
)

Specialization of the function that limits value x into an interval <a, b>.

template<typename T >
void mds::math::limit ( CComplex< T > &  x,
const CComplex< T > &  a,
const CComplex< T > &  b 
)

Function limits value x into the interval <a, b>.

template<typename T >
void mds::math::limit ( T &  x,
const T &  a,
const T &  b 
)

Value x is limited into an interval <a, b>.

template<typename T >
SMakeVector< T >::tResult mds::math::makeVector ( const T &  Value)

Returns reference to a vector.

  • If type T is a fundamental type, static vector of size 1 is returned.
template<typename T >
const T& mds::math::makeVectorImpl ( const T &  Value,
SVectorType   
)

Specialization of the function.

template<typename T >
T& mds::math::makeVectorImpl ( T &  Value,
SVectorType   
)

Specialization of the function.

template<typename T >
CStaticVector<T,1> mds::math::makeVectorImpl ( T &  Value,
SFundamentalType   
)

Specialization of the function.

template<typename T >
CStaticVector<T,1> mds::math::makeVectorImpl ( const T &  Value,
SFundamentalType   
)

Specialization of the function.

template<typename T >
void mds::math::mirror ( T &  x,
const T &  a,
const T &  b 
)

Value x is mirrored into a given interval <a, b>.

template<typename T >
bool mds::math::operator!= ( const CLogNum< T > &  x,
const CLogNum< T > &  y 
)
template<typename T >
bool mds::math::operator!= ( const CLogNum< T > &  x,
y 
)
template<typename T >
bool mds::math::operator!= ( x,
const CLogNum< T > &  y 
)
template<typename T >
bool mds::math::operator!= ( const CComplex< T > &  x,
const CComplex< T > &  y 
)
template<typename T >
bool mds::math::operator!= ( const CComplex< T > &  x,
const T &  y 
)
template<typename T >
bool mds::math::operator!= ( const T &  x,
const CComplex< T > &  y 
)
template<typename T >
CLogNum<T> mds::math::operator* ( const CLogNum< T > &  x,
const CLogNum< T > &  y 
)
template<typename T >
CLogNum<T> mds::math::operator* ( const CLogNum< T > &  x,
y 
)
template<typename T >
CLogNum<T> mds::math::operator* ( x,
const CLogNum< T > &  y 
)
template<typename T >
CComplex<T> mds::math::operator* ( const CComplex< T > &  x,
const CComplex< T > &  y 
)
template<typename T , typename U >
CComplex<T> mds::math::operator* ( const CComplex< T > &  x,
const U &  y 
)
template<typename T , typename U >
CComplex<T> mds::math::operator* ( const U &  x,
const CComplex< T > &  y 
)
template<typename T >
CLogNum<T> mds::math::operator+ ( const CLogNum< T > &  x,
const CLogNum< T > &  y 
)
template<typename T >
CLogNum<T> mds::math::operator+ ( const CLogNum< T > &  x,
y 
)
template<typename T >
CLogNum<T> mds::math::operator+ ( x,
const CLogNum< T > &  y 
)
template<typename T >
CComplex<T> mds::math::operator+ ( const CComplex< T > &  x,
const CComplex< T > &  y 
)
template<typename T , typename U >
CComplex<T> mds::math::operator+ ( const CComplex< T > &  x,
const U &  y 
)
template<typename T , typename U >
CComplex<T> mds::math::operator+ ( const U &  x,
const CComplex< T > &  y 
)
template<typename T >
CComplex<T> mds::math::operator+ ( const CComplex< T > &  x)
template<typename T >
CLogNum<T> mds::math::operator- ( const CLogNum< T > &  x,
const CLogNum< T > &  y 
)
template<typename T >
CLogNum<T> mds::math::operator- ( const CLogNum< T > &  x,
y 
)
template<typename T >
CLogNum<T> mds::math::operator- ( x,
const CLogNum< T > &  y 
)
template<typename T >
CComplex<T> mds::math::operator- ( const CComplex< T > &  x,
const CComplex< T > &  y 
)
template<typename T , typename U >
CComplex<T> mds::math::operator- ( const CComplex< T > &  x,
const U &  y 
)
template<typename T , typename U >
CComplex<T> mds::math::operator- ( const U &  x,
const CComplex< T > &  y 
)
template<typename T >
CComplex<T> mds::math::operator- ( const CComplex< T > &  x)
template<typename T >
CLogNum<T> mds::math::operator/ ( const CLogNum< T > &  x,
const CLogNum< T > &  y 
)
template<typename T >
CLogNum<T> mds::math::operator/ ( const CLogNum< T > &  x,
y 
)
template<typename T >
CLogNum<T> mds::math::operator/ ( x,
const CLogNum< T > &  y 
)
template<typename T >
CComplex<T> mds::math::operator/ ( const CComplex< T > &  x,
const CComplex< T > &  y 
)
template<typename T >
CComplex<T> mds::math::operator/ ( const T &  x,
const CComplex< T > &  y 
)
template<typename T >
CComplex<T> mds::math::operator/ ( const CComplex< T > &  x,
const T &  y 
)
template<typename T >
bool mds::math::operator< ( const CLogNum< T > &  x,
const CLogNum< T > &  y 
)
template<typename T >
bool mds::math::operator< ( const CLogNum< T > &  x,
y 
)
template<typename T >
bool mds::math::operator< ( x,
const CLogNum< T > &  y 
)
template<class V >
std::ostream & mds::math::operator<< ( std::ostream &  Stream,
const CVectorBase< V > &  Vector 
)

Prints the vector to a given output stream.

template<class M >
std::ostream & mds::math::operator<< ( std::ostream &  Stream,
const CMatrixBase< M > &  Matrix 
)

Prints the matrix to a given output stream.

template<typename T >
std::ostream& mds::math::operator<< ( std::ostream &  Stream,
const CLogNum< T > &  n 
)

Writes number in the logarithmic space to an output stream.

template<typename T >
std::ostream& mds::math::operator<< ( std::ostream &  Stream,
const CComplex< T > &  z 
)

Writes complex number to an output stm_ream.

template<typename T >
bool mds::math::operator<= ( const CLogNum< T > &  x,
const CLogNum< T > &  y 
)
template<typename T >
bool mds::math::operator<= ( const CLogNum< T > &  x,
y 
)
template<typename T >
bool mds::math::operator<= ( x,
const CLogNum< T > &  y 
)
template<typename T >
bool mds::math::operator== ( const CLogNum< T > &  x,
const CLogNum< T > &  y 
)
template<typename T >
bool mds::math::operator== ( const CLogNum< T > &  x,
y 
)
template<typename T >
bool mds::math::operator== ( x,
const CLogNum< T > &  y 
)
template<typename T >
bool mds::math::operator== ( const CComplex< T > &  x,
const CComplex< T > &  y 
)
template<typename T >
bool mds::math::operator== ( const CComplex< T > &  x,
const T &  y 
)
template<typename T >
bool mds::math::operator== ( const T &  x,
const CComplex< T > &  y 
)
template<typename T >
bool mds::math::operator> ( const CLogNum< T > &  x,
const CLogNum< T > &  y 
)
template<typename T >
bool mds::math::operator> ( const CLogNum< T > &  x,
y 
)
template<typename T >
bool mds::math::operator> ( x,
const CLogNum< T > &  y 
)
template<typename T >
bool mds::math::operator>= ( const CLogNum< T > &  x,
const CLogNum< T > &  y 
)
template<typename T >
bool mds::math::operator>= ( const CLogNum< T > &  x,
y 
)
template<typename T >
bool mds::math::operator>= ( x,
const CLogNum< T > &  y 
)
template<typename T >
std::istream& mds::math::operator>> ( std::istream &  Stream,
CLogNum< T > &  n 
)

Reads number in the logarithmic space to an input stream.

template<typename T >
std::istream& mds::math::operator>> ( std::istream &  Stream,
CComplex< T > &  z 
)

Reads complex number from an input stream.

template<typename T >
CComplex<T> mds::math::polar ( const T &  x)

Creates a temporary complex number from polar coordinates.

  • Angle is equal to zero.
template<typename T >
CComplex<T> mds::math::polar ( const T &  x,
const T &  y 
)

Creates a temporary complex number from polar coordinates.

double mds::math::rad2deg ( double  Radians)

Converts degrees to radians.

template<typename T >
int mds::math::round2Int ( const T &  x)

Rounds a given floating point number to integer.

template<typename T >
void mds::math::solve ( CSparseMatrixAlt< T > &  A,
CVector< T > &  b,
CVector< T > &  x 
)

This function solves sparse linear system Ax = b.

template<>
void mds::math::solve ( CSparseMatrixAlt< double > &  A,
CVector< double > &  b,
CVector< double > &  x 
)

Defined for sparse systems of double values.

template<typename T >
void mds::math::swap ( T &  a,
T &  b 
)

Exchanges two values.

template<>
void mds::math::swap ( int a,
int b 
)

Exchanges two int numbers.

template<>
void mds::math::swap ( unsigned &  a,
unsigned &  b 
)

Exchanges two unsigned int numbers.

template<>
void mds::math::swap ( long &  a,
long &  b 
)

Exchanges two long numbers.

template<>
void mds::math::swap ( unsigned long &  a,
unsigned long &  b 
)

Exchanges two unsigned long numbers.


Variable Documentation

Dummy value.

const double mds::math::E = 2.718281828459045

Euler's constant.

const double mds::math::HALF_PI = 0.5 * PI

Constant pi/2.

const double mds::math::PI = 3.141592653589793

Constant pi.

const double mds::math::SQRT2 = 1.414213562373095

Square root of the number 2.

const double mds::math::SQRT3 = 1.732050807568877

Square root of the number 3.

const double mds::math::SQRT6 = 2.449489742783178

Square root of the number 6.

const double mds::math::SQRT_TWO_PI = 2.506628274631001

Constant sqrt(2*pi).

const double mds::math::TWO_PI = 2.0 * PI

Constant 2*pi.