HyperHDG
Classes | Typedefs | Functions
dense_la.hxx File Reference
#include <HyperHDG/hy_assert.hxx>
#include <array>
#include <cmath>
#include <ostream>
#include <vector>
#include <HyperHDG/wrapper/lapack.hxx>
Include dependency graph for dense_la.hxx:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SmallMatDivByZeroException
 Exception to be thrown if division by zero appears. More...
 
class  SmallMat< n_rowsT, n_colsT, mat_entry_t >
 This class implements a small/dense matrix. More...
 

Typedefs

template<unsigned int n_rows, typename mat_entry_t = double>
using SmallSquareMat = SmallMat< n_rows, n_rows, mat_entry_t >
 A SmallSquareMat is a SmallMat, which is square. More...
 
template<unsigned int n_rows, typename mat_entry_t = double>
using SmallVec = SmallMat< n_rows, 1, mat_entry_t >
 A SmallVec is a SmallMat of one column, where the standard mat_entry_t is double. More...
 
template<unsigned int n_rows, typename mat_entry_t = float>
using Point = SmallVec< n_rows, mat_entry_t >
 A Point is a SmallMat of one column, where the standard mat_entry_t is float. More...
 

Functions

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat< n_rows, n_cols, mat_entry_t > diagonal (const mat_entry_t diag_value)
 Create SmallMat that is a diagonal matrix with specified value on diagonal. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t , unsigned int n_vec>
SmallMat< n_rows, n_cols, mat_entry_t > diagonal (const SmallMat< n_vec, 1, mat_entry_t > &diag)
 Create SmallMat that is a diagonal matrix with specified value on diagonal. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat< n_rows, n_cols, mat_entry_t > rep_mat (const SmallMat< n_rows, 1, mat_entry_t > rep_vec)
 Create SmallMat that repeats given column vector. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat< n_rows, n_cols, mat_entry_t > dyadic_product (const SmallMat< n_rows, 1, mat_entry_t > &left, const SmallMat< n_cols, 1, mat_entry_t > &right)
 Create dyadic product of two small vectors. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat< n_cols, n_rows, mat_entry_t > transposed (SmallMat< n_rows, n_cols, mat_entry_t > mat)
 Transpose given matrix. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
mat_entry_t scalar_product (const SmallMat< n_rows, n_cols, mat_entry_t > &left, const SmallMat< n_rows, n_cols, mat_entry_t > &right)
 Euclidean scalar product of two SmallVecs / Frobenius scalar product for two SmallMats. More...
 
template<unsigned int n_rows, unsigned int n_cols_left, unsigned int n_cols_right, typename mat_entry_t >
SmallMat< n_rows, std::max(n_cols_left, n_cols_right), mat_entry_t > operator+ (const SmallMat< n_rows, n_cols_left, mat_entry_t > &left, const SmallMat< n_rows, n_cols_right, mat_entry_t > &right)
 Add two small / dense matrices. More...
 
template<unsigned int n_rows, unsigned int n_cols_left, unsigned int n_cols_right, typename mat_entry_t >
SmallMat< n_rows, std::max(n_cols_left, n_cols_right), mat_entry_t > operator- (const SmallMat< n_rows, n_cols_left, mat_entry_t > &left, const SmallMat< n_rows, n_cols_right, mat_entry_t > &right)
 Subtract second small/dense matrix from first. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat< n_rows, n_cols, mat_entry_t > hada_prod (const SmallMat< n_rows, n_cols, mat_entry_t > &left, const SmallMat< n_rows, n_cols, mat_entry_t > &right)
 Hadamard product of two small/dense matrices. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat< n_rows, n_cols, mat_entry_t > hada_divi (const SmallMat< n_rows, n_cols, mat_entry_t > &left, const SmallMat< n_rows, n_cols, mat_entry_t > &right)
 Divide first small/dense matrix element-wise by second. More...
 
template<unsigned int n_rowsA, unsigned int n_colsA, unsigned int n_colsB, typename mat_entry_t >
SmallMat< n_rowsA, n_colsB, mat_entry_t > operator* (const SmallMat< n_rowsA, n_colsA, mat_entry_t > &A, const SmallMat< n_colsA, n_colsB, mat_entry_t > &B)
 Standard matrix–matrix multiplication. More...
 
template<unsigned int n_rowsA, unsigned int n_colsA, unsigned int n_rowsB, unsigned int n_colsB, typename mat_entry_t >
SmallMat< n_rowsA, n_colsB, mat_entry_t > mat_times_mat_unfit (const SmallMat< n_rowsA, n_colsA, mat_entry_t > &A, const SmallMat< n_rowsB, n_colsB, mat_entry_t > &B)
 Standard matrix–matrix multiplication with non-fitting dimensions. More...
 
template<unsigned int n_rowsA, unsigned int n_colsA, unsigned int n_colsB, typename mat_entry_t >
SmallMat< n_colsA, n_colsB, mat_entry_t > transposed_mat_times_mat (const SmallMat< n_rowsA, n_colsA, mat_entry_t > &A, const SmallMat< n_rowsA, n_colsB, mat_entry_t > &B)
 Transpose first small/dense matrix and multiply it with second. More...
 
template<unsigned int n_rowsA, unsigned int n_colsA, unsigned int n_rowsB, typename mat_entry_t >
SmallMat< n_rowsA, n_rowsB, mat_entry_t > mat_times_transposed_mat (const SmallMat< n_rowsA, n_colsA, mat_entry_t > &A, const SmallMat< n_rowsB, n_colsA, mat_entry_t > &B)
 Multiply first matrix with transposed of second second. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat< n_rows, n_cols, mat_entry_t > operator+ (const mat_entry_t &scalar, const SmallMat< n_rows, n_cols, mat_entry_t > &mat)
 Add small/dense matrix to scalar. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat< n_rows, n_cols, mat_entry_t > operator+ (const SmallMat< n_rows, n_cols, mat_entry_t > &mat, const mat_entry_t &scalar)
 Add scalar to small/dense matrix. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat< n_rows, n_cols, mat_entry_t > operator- (const mat_entry_t &scalar, const SmallMat< n_rows, n_cols, mat_entry_t > &mat)
 Subtract small/dense matrix from scalar. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat< n_rows, n_cols, mat_entry_t > operator- (const SmallMat< n_rows, n_cols, mat_entry_t > &mat, const mat_entry_t &scalar)
 Subtract scalar from small/dense matrix. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat< n_rows, n_cols, mat_entry_t > operator* (const mat_entry_t &scalar, const SmallMat< n_rows, n_cols, mat_entry_t > &mat)
 Multiply scalar with small/dense matrix. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat< n_rows, n_cols, mat_entry_t > operator* (const SmallMat< n_rows, n_cols, mat_entry_t > &mat, const mat_entry_t &scalar)
 Multiply small/dense matrix with scalar. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat< n_rows, n_cols, mat_entry_t > operator/ (const mat_entry_t &scalar, const SmallMat< n_rows, n_cols, mat_entry_t > &mat)
 Divide scalar by small/dense matrix. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat< n_rows, n_cols, mat_entry_t > operator/ (const SmallMat< n_rows, n_cols, mat_entry_t > &mat, const mat_entry_t &scalar)
 Divide small/dense matrix by scalar. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
mat_entry_t norm_1 (const SmallMat< n_rows, n_cols, mat_entry_t > &mat)
 Column sum norm of a small/dense matrix. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
mat_entry_t norm_2 (const SmallMat< n_rows, n_cols, mat_entry_t > &mat)
 Euclidean norm of a small/dense vector. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
mat_entry_t norm_infty (const SmallMat< n_rows, n_cols, mat_entry_t > &mat)
 Row sum norm of a small/dense matrix. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
mat_entry_t norm_p (const SmallMat< n_rows, n_cols, mat_entry_t > &mat, const mat_entry_t power)
 p-norm of a small/dense vector. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
mat_entry_t entries_product (const SmallMat< n_rows, n_cols, mat_entry_t > &mat)
 Return product of all entries. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
std::ostream & operator<< (std::ostream &stream, const SmallMat< n_rows, n_cols, mat_entry_t > &mat)
 Fill std::ostream with small/dense matrix. More...
 
template<unsigned int n_rowsA, unsigned int n_colsB, typename mat_entry_t >
SmallMat< n_rowsA, n_colsB, mat_entry_t > operator/ (SmallMat< n_rowsA, n_colsB, mat_entry_t > &b, SmallMat< n_rowsA, n_rowsA, mat_entry_t > &A)
 Solve linear system of equations A * x = b <=> x = A / b. More...
 
template<unsigned int n_rowsA, unsigned int n_colsB, typename mat_entry_t >
SmallMat< n_rowsA, n_colsB, mat_entry_t > operator/ (const SmallMat< n_rowsA, n_colsB, mat_entry_t > &b, const SmallMat< n_rowsA, n_rowsA, mat_entry_t > &A)
 Solve linear system of equations A * x = b <=> x = A / b. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat< n_rows, n_rows, mat_entry_t > qr_decomp_q (SmallMat< n_rows, n_cols, mat_entry_t > &mat)
 Matrix Q of Householder QR decomposition. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat< n_rows, n_rows, mat_entry_t > qr_decomp_q (const SmallMat< n_rows, n_cols, mat_entry_t > &mat)
 Matrix Q of Householder QR decomposition. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
void qr_decomp (SmallMat< n_rows, n_cols, mat_entry_t > &mat, SmallSquareMat< n_rows, mat_entry_t > &mat_q, SmallSquareMat< n_cols, mat_entry_t > &mat_r)
 Normalized QR decomposition. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
void qr_decomp (const SmallMat< n_rows, n_cols, mat_entry_t > &mat, SmallSquareMat< n_rows, mat_entry_t > &mat_q, SmallSquareMat< n_cols, mat_entry_t > &mat_r)
 Normalized QR decomposition. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
mat_entry_t determinant (SmallMat< n_rows, n_cols, mat_entry_t > &mat)
 Determinant of a rectangular system. More...
 
template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
mat_entry_t determinant (const SmallMat< n_rows, n_cols, mat_entry_t > &mat)
 Determinant of a rectangular system. More...
 

Typedef Documentation

◆ Point

template<unsigned int n_rows, typename mat_entry_t = float>
using Point = SmallVec<n_rows, mat_entry_t>

A Point is a SmallMat of one column, where the standard mat_entry_t is float.


◆ SmallSquareMat

template<unsigned int n_rows, typename mat_entry_t = double>
using SmallSquareMat = SmallMat<n_rows, n_rows, mat_entry_t>

A SmallSquareMat is a SmallMat, which is square.


◆ SmallVec

template<unsigned int n_rows, typename mat_entry_t = double>
using SmallVec = SmallMat<n_rows, 1, mat_entry_t>

A SmallVec is a SmallMat of one column, where the standard mat_entry_t is double.


Function Documentation

◆ determinant() [1/2]

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
mat_entry_t determinant ( const SmallMat< n_rows, n_cols, mat_entry_t > &  mat)

Determinant of a rectangular system.


Calculate the generalized determinant of a rectangular matrix. If the matrix is square, this is the standard determinant. The determinant is determined by doing a QR decomposition based on Householder transformations. Thus det(Q) = +1, if the number of rows if even and det(Q) = -1, if the number of rows is odd. This number is multiplied by the diagonal entries of R.

Here is the call graph for this function:

◆ determinant() [2/2]

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
mat_entry_t determinant ( SmallMat< n_rows, n_cols, mat_entry_t > &  mat)

Determinant of a rectangular system.


Calculate the generalized determinant of a rectangular matrix. If the matrix is square, this is the standard determinant. The determinant is determined by doing a QR decomposition based on Householder transformations. Thus det(Q) = +1, if the number of rows if even and det(Q) = -1, if the number of rows is odd. This number is multiplied by the diagonal entries of R.

The matrix is destroyed using this function. Its entries might be used to generate matrices Q and R of the QR descomposition.

Here is the call graph for this function:

◆ diagonal() [1/2]

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat<n_rows, n_cols, mat_entry_t> diagonal ( const mat_entry_t  diag_value)

Create SmallMat that is a diagonal matrix with specified value on diagonal.


Parameters
diag_valueDiagonal value.
Return values
diag_matDiagonal matrix.

◆ diagonal() [2/2]

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t , unsigned int n_vec>
SmallMat<n_rows, n_cols, mat_entry_t> diagonal ( const SmallMat< n_vec, 1, mat_entry_t > &  diag)

Create SmallMat that is a diagonal matrix with specified value on diagonal.


Parameters
diagDiagonal vector.
Return values
diag_matDiagonal matrix.

◆ dyadic_product()

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat<n_rows, n_cols, mat_entry_t> dyadic_product ( const SmallMat< n_rows, 1, mat_entry_t > &  left,
const SmallMat< n_cols, 1, mat_entry_t > &  right 
)

Create dyadic product of two small vectors.


Parameters
leftLeft vector in dyadic product.
rightRight vector in dyadic product.
Return values
dyad_prodDyadic product of both vectors.

◆ entries_product()

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
mat_entry_t entries_product ( const SmallMat< n_rows, n_cols, mat_entry_t > &  mat)

Return product of all entries.


Here is the call graph for this function:

◆ hada_divi()

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat<n_rows, n_cols, mat_entry_t> hada_divi ( const SmallMat< n_rows, n_cols, mat_entry_t > &  left,
const SmallMat< n_rows, n_cols, mat_entry_t > &  right 
)

Divide first small/dense matrix element-wise by second.


◆ hada_prod()

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat<n_rows, n_cols, mat_entry_t> hada_prod ( const SmallMat< n_rows, n_cols, mat_entry_t > &  left,
const SmallMat< n_rows, n_cols, mat_entry_t > &  right 
)

Hadamard product of two small/dense matrices.


◆ mat_times_mat_unfit()

template<unsigned int n_rowsA, unsigned int n_colsA, unsigned int n_rowsB, unsigned int n_colsB, typename mat_entry_t >
SmallMat<n_rowsA, n_colsB, mat_entry_t> mat_times_mat_unfit ( const SmallMat< n_rowsA, n_colsA, mat_entry_t > &  A,
const SmallMat< n_rowsB, n_colsB, mat_entry_t > &  B 
)

Standard matrix–matrix multiplication with non-fitting dimensions.


◆ mat_times_transposed_mat()

template<unsigned int n_rowsA, unsigned int n_colsA, unsigned int n_rowsB, typename mat_entry_t >
SmallMat<n_rowsA, n_rowsB, mat_entry_t> mat_times_transposed_mat ( const SmallMat< n_rowsA, n_colsA, mat_entry_t > &  A,
const SmallMat< n_rowsB, n_colsA, mat_entry_t > &  B 
)

Multiply first matrix with transposed of second second.


◆ norm_1()

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
mat_entry_t norm_1 ( const SmallMat< n_rows, n_cols, mat_entry_t > &  mat)

Column sum norm of a small/dense matrix.


◆ norm_2()

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
mat_entry_t norm_2 ( const SmallMat< n_rows, n_cols, mat_entry_t > &  mat)

Euclidean norm of a small/dense vector.


Here is the call graph for this function:

◆ norm_infty()

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
mat_entry_t norm_infty ( const SmallMat< n_rows, n_cols, mat_entry_t > &  mat)

Row sum norm of a small/dense matrix.


Here is the call graph for this function:

◆ norm_p()

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
mat_entry_t norm_p ( const SmallMat< n_rows, n_cols, mat_entry_t > &  mat,
const mat_entry_t  power 
)

p-norm of a small/dense vector.


Here is the call graph for this function:

◆ operator*() [1/3]

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat<n_rows, n_cols, mat_entry_t> operator* ( const mat_entry_t &  scalar,
const SmallMat< n_rows, n_cols, mat_entry_t > &  mat 
)

Multiply scalar with small/dense matrix.


◆ operator*() [2/3]

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat<n_rows, n_cols, mat_entry_t> operator* ( const SmallMat< n_rows, n_cols, mat_entry_t > &  mat,
const mat_entry_t &  scalar 
)

Multiply small/dense matrix with scalar.


◆ operator*() [3/3]

template<unsigned int n_rowsA, unsigned int n_colsA, unsigned int n_colsB, typename mat_entry_t >
SmallMat<n_rowsA, n_colsB, mat_entry_t> operator* ( const SmallMat< n_rowsA, n_colsA, mat_entry_t > &  A,
const SmallMat< n_colsA, n_colsB, mat_entry_t > &  B 
)

Standard matrix–matrix multiplication.


◆ operator+() [1/3]

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat<n_rows, n_cols, mat_entry_t> operator+ ( const mat_entry_t &  scalar,
const SmallMat< n_rows, n_cols, mat_entry_t > &  mat 
)

Add small/dense matrix to scalar.


◆ operator+() [2/3]

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat<n_rows, n_cols, mat_entry_t> operator+ ( const SmallMat< n_rows, n_cols, mat_entry_t > &  mat,
const mat_entry_t &  scalar 
)

Add scalar to small/dense matrix.


◆ operator+() [3/3]

template<unsigned int n_rows, unsigned int n_cols_left, unsigned int n_cols_right, typename mat_entry_t >
SmallMat<n_rows, std::max(n_cols_left, n_cols_right), mat_entry_t> operator+ ( const SmallMat< n_rows, n_cols_left, mat_entry_t > &  left,
const SmallMat< n_rows, n_cols_right, mat_entry_t > &  right 
)

Add two small / dense matrices.


◆ operator-() [1/3]

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat<n_rows, n_cols, mat_entry_t> operator- ( const mat_entry_t &  scalar,
const SmallMat< n_rows, n_cols, mat_entry_t > &  mat 
)

Subtract small/dense matrix from scalar.


Here is the call graph for this function:

◆ operator-() [2/3]

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat<n_rows, n_cols, mat_entry_t> operator- ( const SmallMat< n_rows, n_cols, mat_entry_t > &  mat,
const mat_entry_t &  scalar 
)

Subtract scalar from small/dense matrix.


◆ operator-() [3/3]

template<unsigned int n_rows, unsigned int n_cols_left, unsigned int n_cols_right, typename mat_entry_t >
SmallMat<n_rows, std::max(n_cols_left, n_cols_right), mat_entry_t> operator- ( const SmallMat< n_rows, n_cols_left, mat_entry_t > &  left,
const SmallMat< n_rows, n_cols_right, mat_entry_t > &  right 
)

Subtract second small/dense matrix from first.


Here is the call graph for this function:

◆ operator/() [1/4]

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat<n_rows, n_cols, mat_entry_t> operator/ ( const mat_entry_t &  scalar,
const SmallMat< n_rows, n_cols, mat_entry_t > &  mat 
)

Divide scalar by small/dense matrix.


Here is the call graph for this function:

◆ operator/() [2/4]

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat<n_rows, n_cols, mat_entry_t> operator/ ( const SmallMat< n_rows, n_cols, mat_entry_t > &  mat,
const mat_entry_t &  scalar 
)

Divide small/dense matrix by scalar.


◆ operator/() [3/4]

template<unsigned int n_rowsA, unsigned int n_colsB, typename mat_entry_t >
SmallMat<n_rowsA, n_colsB, mat_entry_t> operator/ ( const SmallMat< n_rowsA, n_colsB, mat_entry_t > &  b,
const SmallMat< n_rowsA, n_rowsA, mat_entry_t > &  A 
)

Solve linear system of equations A * x = b <=> x = A / b.


◆ operator/() [4/4]

template<unsigned int n_rowsA, unsigned int n_colsB, typename mat_entry_t >
SmallMat<n_rowsA, n_colsB, mat_entry_t> operator/ ( SmallMat< n_rowsA, n_colsB, mat_entry_t > &  b,
SmallMat< n_rowsA, n_rowsA, mat_entry_t > &  A 
)

Solve linear system of equations A * x = b <=> x = A / b.


Here is the call graph for this function:

◆ operator<<()

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
std::ostream& operator<< ( std::ostream &  stream,
const SmallMat< n_rows, n_cols, mat_entry_t > &  mat 
)

Fill std::ostream with small/dense matrix.


◆ qr_decomp() [1/2]

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
void qr_decomp ( const SmallMat< n_rows, n_cols, mat_entry_t > &  mat,
SmallSquareMat< n_rows, mat_entry_t > &  mat_q,
SmallSquareMat< n_cols, mat_entry_t > &  mat_r 
)

Normalized QR decomposition.


Do a QR decomposition of the matrix mat and write result into mat_q (matrix Q of QR decomposition), and mat_r is a square matrix with n_cols rows and columns containing R (without some entries).

Parameters
matMatrix that is to be QR decomposed.
mat_qMatrix containing space for Q of QR decomposition.
mat_rMatrix containing space for reduced R of QR decomposition.
Return values
mat_qMatrix Q of QR decomposition.
mat_rReduced matrix R of QR decomposition.
Here is the call graph for this function:

◆ qr_decomp() [2/2]

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
void qr_decomp ( SmallMat< n_rows, n_cols, mat_entry_t > &  mat,
SmallSquareMat< n_rows, mat_entry_t > &  mat_q,
SmallSquareMat< n_cols, mat_entry_t > &  mat_r 
)

Normalized QR decomposition.


Do a QR decomposition of the matrix mat and write result into mat_q (matrix Q of QR decomposition), and mat (matrix R of QR decomposition). Moreover, mat_r is a square matrix with n_cols rows and columns containing R (without some entries).

Parameters
matMatrix that is to be QR decomposed.
mat_qMatrix containing space for Q of QR decomposition.
mat_rMatrix containing space for reduced R of QR decomposition.
Return values
matMatrix R of QR decomposition.
mat_qMatrix Q of QR decomposition.
mat_rReduced matrix R of QR decomposition.
Here is the call graph for this function:

◆ qr_decomp_q() [1/2]

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat<n_rows, n_rows, mat_entry_t> qr_decomp_q ( const SmallMat< n_rows, n_cols, mat_entry_t > &  mat)

Matrix Q of Householder QR decomposition.


Note that Q might be different from the matrix Q attained from qr_decomp.

Here is the call graph for this function:

◆ qr_decomp_q() [2/2]

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat<n_rows, n_rows, mat_entry_t> qr_decomp_q ( SmallMat< n_rows, n_cols, mat_entry_t > &  mat)

Matrix Q of Householder QR decomposition.


Note that Q might be different from the matrix Q attained from qr_decomp.

Here is the call graph for this function:

◆ rep_mat()

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat<n_rows, n_cols, mat_entry_t> rep_mat ( const SmallMat< n_rows, 1, mat_entry_t >  rep_vec)

Create SmallMat that repeats given column vector.


Parameters
rep_vecColumn vector that is to be repeated.
Return values
rep_matMatrix whose columns coincide with given vector.

◆ scalar_product()

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
mat_entry_t scalar_product ( const SmallMat< n_rows, n_cols, mat_entry_t > &  left,
const SmallMat< n_rows, n_cols, mat_entry_t > &  right 
)

Euclidean scalar product of two SmallVecs / Frobenius scalar product for two SmallMats.


Here is the call graph for this function:

◆ transposed()

template<unsigned int n_rows, unsigned int n_cols, typename mat_entry_t >
SmallMat<n_cols, n_rows, mat_entry_t> transposed ( SmallMat< n_rows, n_cols, mat_entry_t >  mat)

Transpose given matrix.


Parameters
matMatrix to be transposed.
Return values
transposedTransposed of the given matrix.

◆ transposed_mat_times_mat()

template<unsigned int n_rowsA, unsigned int n_colsA, unsigned int n_colsB, typename mat_entry_t >
SmallMat<n_colsA, n_colsB, mat_entry_t> transposed_mat_times_mat ( const SmallMat< n_rowsA, n_colsA, mat_entry_t > &  A,
const SmallMat< n_rowsA, n_colsB, mat_entry_t > &  B 
)

Transpose first small/dense matrix and multiply it with second.