18 #ifndef HMC_VSP_LINEARALGEBRA_HPP 19 #define HMC_VSP_LINEARALGEBRA_HPP 27 std::vector<double>
MatrixVectorProduct(std::vector<std::vector<double>> M, std::vector<double> A);
35 std::vector<std::vector<double>>
MatrixMatrixProduct(std::vector<std::vector<double>> M, std::vector<std::vector<double>> N);
43 std::vector<std::vector<double>>
MatrixMatrixSum(std::vector<std::vector<double>> M, std::vector<std::vector<double>> N);
51 std::vector<double>
GetMatrixRow(std::vector<std::vector<double>> M,
int row);
59 std::vector<double>
GetMatrixColumn(std::vector<std::vector<double>> M,
int column);
66 std::vector<std::vector<double>>
TransposeMatrix(std::vector<std::vector<double>> M);
73 std::vector<double>
MatrixTrace(std::vector<std::vector<double>> M);
103 std::vector<double>
VectorDifference(std::vector<double> A, std::vector<double> B);
111 std::vector<double>
VectorSum(std::vector<double> A, std::vector<double> B);
136 std::vector<double>
SolveLowerTriangular(std::vector<std::vector<double>> L, std::vector<double> x);
152 std::vector<std::vector<double>>
CholeskyDecompose(std::vector<std::vector<double>> A);
160 std::vector<std::vector<double>>
operator*(std::vector<std::vector<double>> M, std::vector<std::vector<double>> N);
164 double operator*(std::vector<double> A, std::vector<double> B);
168 std::vector<double>
operator*(std::vector<std::vector<double>> M, std::vector<double> A);
172 std::vector<double>
operator*(
double b, std::vector<double> A);
176 std::vector<double>
operator*(std::vector<double> A,
double b);
180 std::vector<double>
operator/(std::vector<double> A,
double b);
184 std::vector<double>
operator+(std::vector<double> A, std::vector<double> B);
188 std::vector<double>
operator-(std::vector<double> A, std::vector<double> B);
192 std::vector<std::vector<double>>
operator+(std::vector<std::vector<double>> M, std::vector<std::vector<double>> N);
194 #endif //HMC_VSP_LINEARALGEBRA_HPP std::vector< double > NormalizeVector(std::vector< double > A)
Normalizes a vector to unit length.
std::vector< double > operator-(std::vector< double > A, std::vector< double > B)
Operator form of VectorDifference(), using std library forwarding.
std::vector< double > VectorScalarProduct(std::vector< double > A, double b)
Vector scalar prodcut of vector and scalar.
std::vector< std::vector< double > > MatrixMatrixSum(std::vector< std::vector< double >> M, std::vector< std::vector< double >> N)
A function to calculate the sum of the entries of two matrices.
std::vector< std::vector< double > > InvertLowerTriangular(std::vector< std::vector< double >> L)
Invert a lower triangular matrix by use of solving the system per column of using SolveLowerTriang...
std::vector< double > GetMatrixColumn(std::vector< std::vector< double >> M, int column)
Function to get a column from a matrix.
std::vector< double > operator+(std::vector< double > A, std::vector< double > B)
Operator form of VectorSum(), using std library forwarding.
std::vector< std::vector< double > > operator*(std::vector< std::vector< double >> M, std::vector< std::vector< double >> N)
Operator form of MatrixMatrixProduct(), using std library forwarding.
std::vector< std::vector< double > > InvertMatrixElements(std::vector< std::vector< double >> M)
Function to take the inverse of the individual matrix elements.
double VectorVectorProduct(std::vector< double > A, std::vector< double > B)
Dot product of vectors.
std::vector< std::vector< double > > VectorToDiagonal(std::vector< double > A)
Function which takes a std::vector of double to make a diagonal matrix of it, such that ...
std::vector< double > GetMatrixRow(std::vector< std::vector< double >> M, int row)
Function to get a row from a matrix.
std::vector< std::vector< double > > MatrixMatrixProduct(std::vector< std::vector< double >> M, std::vector< std::vector< double >> N)
Function incorporating the standard matrix-matrix product, producing a new matrix. Matrix M should have as many columns as N has rows, otherwise an exception is thrown.
std::vector< double > MatrixTrace(std::vector< std::vector< double >> M)
Function to the trace of a square matrix .
std::vector< std::vector< double > > TransposeMatrix(std::vector< std::vector< double >> M)
Function to transpose a matrix M of size i x j into a matrix N of size j x i, where ...
std::vector< double > VectorSum(std::vector< double > A, std::vector< double > B)
Vector sum between two vectors.
std::vector< double > operator/(std::vector< double > A, double b)
Operator form of vector by scalar division. Uses VectorScalarProduct() with std library forwarding...
std::vector< double > VectorDifference(std::vector< double > A, std::vector< double > B)
Vector difference between two vectors.
std::vector< double > MatrixVectorProduct(std::vector< std::vector< double >> M, std::vector< double > A)
Function incorporating the standard matrix-vector product. The result is a column vector...
std::vector< std::vector< double > > CholeskyDecompose(std::vector< std::vector< double >> A)
Cholesky-decomposition of a positive definite Hermitian matrix .
std::vector< double > SolveLowerTriangular(std::vector< std::vector< double >> L, std::vector< double > x)
Solve linear equation where is a lower triangular matrix and and are dimensional vectors...