Collection of linear algebra functions. More...
Functions | |
| int | allocateMatrix (std::vector< std::vector< double > > &A, int m, int n) |
| Allocates a matrix of size m x n. More... | |
| int | allocateVector (std::vector< double > &x, int n) |
| Allocates a vector of size n. More... | |
| int | cholBackSolve (const std::vector< std::vector< double > > &L, std::vector< double > &x, const std::vector< double > &b) |
| Solves the equation LL'x = b where L is lower triangular matrix. More... | |
| int | cholFactor (std::vector< std::vector< double > > &A) |
| The subroutine which does cholesky factorization of a given Symmetric positive definite matrix (say) A. More... | |
| int | eye (std::vector< std::vector< double > > &M, int n) |
| Creates an n x n identity matrix for M. More... | |
| double | gammln (double xx) |
| Calculates natural log of a gamma function. More... | |
| double | gammq (double a, double x) |
| Calculates Q, the probability that the chi2 should exceed a particilar chi2 (input) by chance. More... | |
| void | gcf (double *gammcf, double a, double x, double *gln) |
| Calculates Q, the probability that the chi2 should exceed a particilar chi2 (input) by chance, by using continued fractions. More... | |
| void | gser (double *gamser, double a, double x, double *gln) |
| Calculates Q, the probability that the chi2 should exceed a particilar chi2 (input) by chance, by using series approximation. More... | |
| double | innerProduct (const std::vector< double > &a, const std::vector< double > &b) |
| Computes the dot or the inner product of two vectors(i.e. More... | |
| int | invertMatrix (const std::vector< std::vector< double > > &A, std::vector< std::vector< double > > &Ainv) |
| Inverts a SPD matrix a to get inverse Ainv using the cholesky factorization. More... | |
| double | norm (const std::vector< double > &a) |
| Computes the two norm of the vector. More... | |
| std::vector< double > | operator* (double a, const std::vector< double > &x) |
| Given a scalar a and a vector x this function performs operation y = ax. More... | |
| std::vector< std::vector < double > > | operator* (double a, const std::vector< std::vector< double > > &A) |
| Computes the scalar matrix product B = aA. More... | |
| std::vector< double > | operator* (const std::vector< std::vector< double > > &A, const std::vector< double > &x) |
| Computes the Matrix vector product y = Ax. More... | |
| std::vector< double > | operator* (const std::vector< double > &x, const std::vector< std::vector< double > > &A) |
| Computes the vector matrix product y = x'A. More... | |
| std::vector< vector< double > > | operator* (const std::vector< std::vector< double > > &A, const std::vector< std::vector< double > > &B) |
| Computes Matrix Matrix Product C=A*B. More... | |
| std::vector< double > | operator+ (const std::vector< double > &x, const std::vector< double > &y) |
| Given two vectors x and y this function performs operation z = x + y. More... | |
| std::vector< vector< double > > | operator+ (const std::vector< std::vector< double > > &A, const std::vector< std::vector< double > > &B) |
| Given two matrices A and B this function performs operation C = A + B. More... | |
| std::vector< double > | operator- (const std::vector< double > &x, const std::vector< double > &y) |
| Given two vectors x and y this function performs operation z = x - y. More... | |
| std::vector< double > | operator- (const std::vector< double > &y) |
| Given a vector y this function performs operation z = - y. More... | |
| std::vector< vector< double > > | operator- (const std::vector< std::vector< double > > &A, const std::vector< std::vector< double > > &B) |
| Given two matrices A and B this function performs operation C = A - B. More... | |
| std::vector< double > | operator/ (const std::vector< double > &x, double a) |
| Given a scalar and a vector x this function performs operation y = x/a. More... | |
| std::vector< std::vector < double > > | operator/ (const std::vector< std::vector< double > > &A, double a) |
| Computes the scalar matrix product B = A/a. More... | |
| vector< vector< double > > | outerProduct (const std::vector< double > &a, const std::vector< double > &b) |
| Computes the outer product of two vectors (i.e. More... | |
| double | quadraticProduct (const std::vector< std::vector< double > > &A, const std::vector< double > x) |
| Calculates the vector-matrix-vector product x'*A*x. More... | |
| int | write (const std::vector< double > &x) |
| Given the vector it writes it to std stream. More... | |
| int | write (const std::vector< std::vector< double > > &A) |
| Given the matrix it writes it to std stream. More... | |
Collection of linear algebra functions.
| int allocateMatrix | ( | std::vector< std::vector< double > > & | A, |
| int | m, | ||
| int | n | ||
| ) |
| int allocateVector | ( | std::vector< double > & | x, |
| int | n | ||
| ) |
Allocates a vector of size n.
Definition at line 467 of file NumLinAlg.cxx.
| int cholBackSolve | ( | const std::vector< std::vector< double > > & | L, |
| std::vector< double > & | x, | ||
| const std::vector< double > & | b | ||
| ) |
Solves the equation LL'x = b where L is lower triangular matrix.
Definition at line 325 of file NumLinAlg.cxx.
References i.
Referenced by invertMatrix().
| int cholFactor | ( | std::vector< std::vector< double > > & | A | ) |
The subroutine which does cholesky factorization of a given Symmetric positive definite matrix (say) A.
It over-writes A by resulting lower triangular matrix
Definition at line 292 of file NumLinAlg.cxx.
References i.
Referenced by BFGSFitter::calcCovariance(), and invertMatrix().
| int eye | ( | std::vector< std::vector< double > > & | I, |
| int | n | ||
| ) |
Creates an n x n identity matrix for M.
Definition at line 405 of file NumLinAlg.cxx.
References i.
Referenced by BFGSFitter::calcBestFit().
| double gammln | ( | double | xx | ) |
Calculates natural log of a gamma function.
Definition at line 24 of file Gammaq.cxx.
| double gammq | ( | double | a, |
| double | x | ||
| ) |
Calculates Q, the probability that the chi2 should exceed a particilar chi2 (input) by chance.
It internally calls gser and gcf depending on the input range.
Definition at line 116 of file Gammaq.cxx.
Referenced by FunctionController::ellipsoidNTuple().
| void gcf | ( | double * | gammcf, |
| double | a, | ||
| double | x, | ||
| double * | gln | ||
| ) |
| void gser | ( | double * | gamser, |
| double | a, | ||
| double | x, | ||
| double * | gln | ||
| ) |
| double innerProduct | ( | const std::vector< double > & | a, |
| const std::vector< double > & | b | ||
| ) |
Computes the dot or the inner product of two vectors(i.e.
a'b)
Definition at line 239 of file NumLinAlg.cxx.
References i.
Referenced by BFGSFitter::calcBestFit(), and norm().
| int invertMatrix | ( | const std::vector< std::vector< double > > & | A, |
| std::vector< std::vector< double > > & | Ainv | ||
| ) |
Inverts a SPD matrix a to get inverse Ainv using the cholesky factorization.
It inverts the matrix by repeatedly solving Ax = ei
Definition at line 356 of file NumLinAlg.cxx.
References cholBackSolve(), cholFactor(), and i.
Referenced by LMFitter::calcCovariance(), and FunctionController::ellipsoidNTuple().
| double norm | ( | const std::vector< double > & | a | ) |
Computes the two norm of the vector.
Definition at line 285 of file NumLinAlg.cxx.
References innerProduct().
Referenced by LinearTransform::adjustValues(), BFGSFitter::calcBestFit(), Chi2Dist::Chi2Dist(), Gaussian::derivByMean(), Landau::derivByNorm(), Gaussian::derivByParm(), Gaussian::derivBySigma(), Gaussian::Gaussian(), Gaussian::initialParameters(), Landau::initialParameters(), Landau::Landau(), BinningProjector::normalize(), Gaussian::operator()(), and Landau::operator()().
| std::vector< double > operator* | ( | double | a, |
| const std::vector< double > & | x | ||
| ) |
Given a scalar a and a vector x this function performs operation y = ax.
Definition at line 119 of file NumLinAlg.cxx.
References i.
| std::vector< std::vector< double > > operator* | ( | double | a, |
| const std::vector< std::vector< double > > & | A | ||
| ) |
Computes the scalar matrix product B = aA.
Definition at line 149 of file NumLinAlg.cxx.
References i.
| std::vector< double > operator* | ( | const std::vector< std::vector< double > > & | A, |
| const std::vector< double > & | x | ||
| ) |
Computes the Matrix vector product y = Ax.
Definition at line 185 of file NumLinAlg.cxx.
References i.
| std::vector< double > operator* | ( | const std::vector< double > & | x, |
| const std::vector< std::vector< double > > & | A | ||
| ) |
Computes the vector matrix product y = x'A.
Definition at line 202 of file NumLinAlg.cxx.
References i.
| std::vector< std::vector< double > > operator* | ( | const std::vector< std::vector< double > > & | A, |
| const std::vector< std::vector< double > > & | B | ||
| ) |
| std::vector< double > operator+ | ( | const std::vector< double > & | x, |
| const std::vector< double > & | y | ||
| ) |
Given two vectors x and y this function performs operation z = x + y.
Definition at line 38 of file NumLinAlg.cxx.
References i.
| std::vector< std::vector< double > > operator+ | ( | const std::vector< std::vector< double > > & | A, |
| const std::vector< std::vector< double > > & | B | ||
| ) |
Given two matrices A and B this function performs operation C = A + B.
Definition at line 82 of file NumLinAlg.cxx.
References i.
| std::vector< double > operator- | ( | const std::vector< double > & | x, |
| const std::vector< double > & | y | ||
| ) |
Given two vectors x and y this function performs operation z = x - y.
Definition at line 53 of file NumLinAlg.cxx.
References i.
| std::vector< double > operator- | ( | const std::vector< double > & | y | ) |
Given a vector y this function performs operation z = - y.
Definition at line 68 of file NumLinAlg.cxx.
References i.
| std::vector< std::vector< double > > operator- | ( | const std::vector< std::vector< double > > & | A, |
| const std::vector< std::vector< double > > & | B | ||
| ) |
Given two matrices A and B this function performs operation C = A - B.
Definition at line 100 of file NumLinAlg.cxx.
References i.
| std::vector< double > operator/ | ( | const std::vector< double > & | x, |
| double | a | ||
| ) |
Given a scalar and a vector x this function performs operation y = x/a.
Definition at line 133 of file NumLinAlg.cxx.
References i.
| std::vector< std::vector< double > > operator/ | ( | const std::vector< std::vector< double > > & | A, |
| double | a | ||
| ) |
Computes the scalar matrix product B = A/a.
Definition at line 166 of file NumLinAlg.cxx.
References i.
| std::vector< std::vector< double > > outerProduct | ( | const std::vector< double > & | a, |
| const std::vector< double > & | b | ||
| ) |
Computes the outer product of two vectors (i.e.
C = ab')
Definition at line 252 of file NumLinAlg.cxx.
References i.
Referenced by BFGSFitter::calcBestFit().
| double quadraticProduct | ( | const std::vector< std::vector< double > > & | A, |
| const std::vector< double > | x | ||
| ) |
Calculates the vector-matrix-vector product x'*A*x.
Definition at line 268 of file NumLinAlg.cxx.
References i.
Referenced by FunctionController::ellipsoidNTuple().
| int write | ( | const std::vector< double > & | a | ) |
Given the vector it writes it to std stream.
Definition at line 421 of file NumLinAlg.cxx.
References i.
| int write | ( | const std::vector< std::vector< double > > & | A | ) |
Given the matrix it writes it to std stream.
Definition at line 434 of file NumLinAlg.cxx.
References i.