Functions | |
template<typename T , std::size_t N> | |
constexpr matrix< T, N, 1 > | nil::crypto3::algebra::as_column (const vector< T, N > &v) |
converts a vector into a column vector More... | |
template<typename T , std::size_t N> | |
constexpr matrix< T, 1, N > | nil::crypto3::algebra::as_row (const vector< T, N > &v) |
converts a vector into a row vector More... | |
template<typename T , typename U , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M > | nil::crypto3::algebra::cast (const matrix< U, N, M > &m) |
casts a vector to another type More... | |
template<typename T , std::size_t M, std::size_t N> | |
constexpr matrix< T, M, N > | nil::crypto3::algebra::conj (const matrix< T, M, N > &m) |
computes the elementwise complex conjugate More... | |
template<typename T , std::size_t M> | |
constexpr T | nil::crypto3::algebra::det (const matrix< T, M, M > &m) |
Compute the determinant. More... | |
template<typename F , typename T , typename... Matrices, typename U = std::invoke_result_t<F, T, typename Matrices::value_type...>, std::size_t N = detail::all_same_value<std::size_t, Matrices::column_size...>::value, std::size_t M = detail::all_same_value<std::size_t, Matrices::row_size...>::value> | |
constexpr matrix< U, N, M > | nil::crypto3::algebra::elementwise (F f, const matrix< T, N, M > &m, const Matrices &...matrices) |
applies a function elementwise between many matrices More... | |
template<std::size_t N, std::size_t M, typename T > | |
constexpr matrix< T, N, M > | nil::crypto3::algebra::fill (T value) |
generates a matrix containing a single value More... | |
template<std::size_t N, std::size_t M, typename F > | |
constexpr decltype(auto) | nil::crypto3::algebra::generate (F &&f) |
generates a matrix as a function of its indices More... | |
template<typename T , std::size_t N> | |
constexpr matrix< T, N, N > | nil::crypto3::algebra::get_identity () |
template<typename T , std::size_t M, std::size_t N> | |
constexpr matrix< T, N, M > | nil::crypto3::algebra::hermitian (const matrix< T, M, N > &m) |
computes the Hermitian transpose More... | |
template<std::size_t M, std::size_t N, std::size_t P, typename T > | |
constexpr matrix< T, M, N+P > | nil::crypto3::algebra::horzcat (const matrix< T, M, N > &a, const matrix< T, M, P > &b) |
horizontally concatenates two matrices More... | |
template<typename T , std::size_t M, std::size_t N> | |
constexpr matrix< nil::crypto3::detail::remove_complex_t< T >, M, N > | nil::crypto3::algebra::imag (const matrix< T, M, N > &m) |
computes the elementwise imag More... | |
template<typename T , std::size_t M> | |
constexpr matrix< T, M, M > | nil::crypto3::algebra::inverse (const matrix< T, M, M > &m) |
computes the matrix inverse More... | |
template<typename T , std::size_t M, std::size_t N, std::size_t P, std::size_t Q> | |
constexpr matrix< T, M *P, N *Q > | nil::crypto3::algebra::kron (const matrix< T, M, N > &a, const matrix< T, P, Q > &b) |
Computes the kronecker tensor product. More... | |
template<typename T , std::size_t M, std::size_t N> | |
constexpr T | nil::crypto3::algebra::macs (const matrix< T, M, N > &m) |
Computes the maximum absolute column sum norm. More... | |
template<typename T , std::size_t M, std::size_t N> | |
constexpr T | nil::crypto3::algebra::mars (const matrix< T, M, N > &m) |
Computes the maximum absolute row sum norm. More... | |
template<typename T , std::size_t M, std::size_t N, std::size_t P> | |
constexpr matrix< T, M, P > | nil::crypto3::algebra::matmul (const matrix< T, M, N > &a, const matrix< T, N, P > &b) |
computes the matrix product More... | |
template<typename T , std::size_t M, std::size_t N> | |
constexpr vector< T, M > | nil::crypto3::algebra::matvectmul (const matrix< T, M, N > &m, const vector< T, N > &v) |
computes the product of matrix and vector More... | |
template<typename T , std::size_t N, std::size_t M> | |
constexpr bool | nil::crypto3::algebra::operator!= (const matrix< T, N, M > &a, const matrix< T, N, M > &b) |
checks inequality of two matrices More... | |
template<typename T , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M > | nil::crypto3::algebra::operator* (const matrix< T, N, M > &a, const matrix< T, N, M > &b) |
computes the Hadamard product More... | |
template<typename T , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M > | nil::crypto3::algebra::operator* (const matrix< T, N, M > &m, T a) |
computes the product of a matrix and a scalar More... | |
template<typename T , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M > | nil::crypto3::algebra::operator* (T a, const matrix< T, N, M > &m) |
computes the product of a matrix and a scalar More... | |
template<typename T , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M > | nil::crypto3::algebra::operator+ (const matrix< T, N, M > &a, const matrix< T, N, M > &b) |
computes the matrix sum More... | |
template<typename T , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M > | nil::crypto3::algebra::operator+ (const matrix< T, N, M > &m, T a) |
computes the sum of a matrix and a scalar More... | |
template<typename T , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M > | nil::crypto3::algebra::operator+ (T a, const matrix< T, N, M > &m) |
computes the sum of a matrix and a scalar More... | |
template<typename T , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M > | nil::crypto3::algebra::operator/ (const matrix< T, N, M > &a, const matrix< T, N, M > &b) |
computes the elementwise matrix quotient More... | |
template<typename T , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M > | nil::crypto3::algebra::operator/ (T a, const matrix< T, N, M > &m) |
computes the quotient between a matrix and a scalar More... | |
template<typename T , std::size_t N, std::size_t M> | |
constexpr bool | nil::crypto3::algebra::operator== (const matrix< T, N, M > &a, const matrix< T, N, M > &b) |
checks equality of two matrices More... | |
template<typename T , std::size_t M, std::size_t N> | |
constexpr std::size_t | nil::crypto3::algebra::rank (const matrix< T, M, N > &m) |
Compute the rank. More... | |
template<typename T , std::size_t M, std::size_t N> | |
constexpr matrix< nil::crypto3::detail::remove_complex_t< T >, M, N > | nil::crypto3::algebra::real (const matrix< T, M, N > &m) |
computes the elementwise real More... | |
template<std::size_t Row, std::size_t Col, std::size_t M, std::size_t N, typename T > | |
constexpr matrix< T, M *Row, N *Col > | nil::crypto3::algebra::repmat (const matrix< T, M, N > &m) |
repeats a matrix More... | |
template<std::size_t P, std::size_t Q, std::size_t M, std::size_t N, typename T > | |
constexpr matrix< T, P, Q > | nil::crypto3::algebra::reshape (const matrix< T, M, N > &m) |
reshapes a matrix More... | |
template<typename T , std::size_t M, std::size_t N> | |
constexpr matrix< T, M, N > | nil::crypto3::algebra::rref (const matrix< T, M, N > &m) |
Compute the reduced row echelon form. More... | |
template<typename T , std::size_t M, std::size_t N> | |
constexpr matrix< T, M, N > | nil::crypto3::algebra::rref (const matrix< T, M, N > &m, T tolerance) |
Compute the reduced row echelon form. More... | |
template<std::size_t P, std::size_t Q, std::size_t M, std::size_t N, typename T > | |
constexpr matrix< T, P, Q > | nil::crypto3::algebra::submat (const matrix< T, M, N > &m, std::size_t a, std::size_t b) |
extracts the submatrix of a matrix More... | |
template<std::size_t M, std::size_t N, typename T > | |
constexpr matrix< T, M, N > | nil::crypto3::algebra::swapcol (matrix< T, M, N > m, std::size_t a, std::size_t b) |
swaps columns of a matrix More... | |
template<std::size_t M, std::size_t N, typename T > | |
constexpr matrix< T, M, N > | nil::crypto3::algebra::swaprow (matrix< T, M, N > m, std::size_t a, std::size_t b) |
swaps rows of a matrix More... | |
template<typename T , std::size_t M> | |
constexpr T | nil::crypto3::algebra::trace (const matrix< T, M, M > &m) |
computes the trace More... | |
template<typename T , std::size_t M, std::size_t N> | |
constexpr matrix< T, N, M > | nil::crypto3::algebra::transpose (const matrix< T, M, N > &m) |
computes the transpose More... | |
template<typename T , std::size_t M, std::size_t N> | |
constexpr vector< T, N > | nil::crypto3::algebra::vectmatmul (const vector< T, M > &v, const matrix< T, M, N > &m) |
computes the product of vector and matrix More... | |
template<std::size_t M, std::size_t N, std::size_t P, typename T > | |
constexpr matrix< T, M+N, P > | nil::crypto3::algebra::vertcat (const matrix< T, M, P > &a, const matrix< T, N, P > &b) |
vertically concatenates two matrices More... | |
Variables | |
template<typename T , std::size_t N> | |
const matrix< T, N, N > | nil::crypto3::algebra::identity |
the matrix identity More... | |
matrix deduction guides | |
template<typename T , std::size_t M, std::size_t N> | |
nil::crypto3::algebra::matrix (const T(&)[M][N]) -> matrix< T, M, N > | |
deduction guide for aggregate initialization More... | |
template<typename T , std::size_t M, std::size_t N> | |
matrix (const T(&)[M][N]) -> matrix< T, M, N > | |
deduction guide for aggregate initialization More... | |
Detailed Description
Function Documentation
◆ as_column()
|
constexpr |
converts a vector into a column vector
- Parameters
-
v an N-vector of type T
- Returns
- an matrix of type T
Converts a vector into a column vector.
◆ as_row()
|
constexpr |
converts a vector into a row vector
- Parameters
-
v an N-vector of type T
- Returns
- a matrix of type T
Converts a vector into a row vector.
◆ cast()
|
constexpr |
casts a vector to another type
- Parameters
-
m an matrix of type U
- Returns
- an matrix of type T containing the casted elements of
Casts a matrix to another type by static_cast
ing each element.
◆ conj()
|
constexpr |
computes the elementwise complex conjugate
- Parameters
-
m an matrix of type T
- Returns
- an matrix of type T such that
Computes the elementwise complex conjugate of a matrix
◆ det()
|
constexpr |
Compute the determinant.
- Parameters
-
m matrix of type T
- Returns
- a scalar of type T
Computes the determinant using the reduced row echelon form.
◆ elementwise()
|
constexpr |
applies a function elementwise between many matrices
- Parameters
-
f a function of type F that operates on many scalars of type T and returns a scalar of type U m an matrix of type T matrices additional matrices of type T
- Returns
- an matrix of type T with elements described by
Applies a function elementwise between many matrices.
◆ fill()
|
constexpr |
generates a matrix containing a single value
- Parameters
-
value the scalar value of all elements
- Returns
- an matrix of type T such that
Generates a matrix with all elements equal to a single value.
◆ generate()
|
constexpr |
generates a matrix as a function of its indices
- Parameters
-
f a function that operates on two integer indices
- Returns
- an matrix with type matching the return type of f such that
Generates a matrix as a function of its indices.
◆ get_identity()
|
constexpr |
◆ hermitian()
|
constexpr |
computes the Hermitian transpose
- Parameters
-
m an matrix of type T
- Returns
- an matrix of type T such that
Computes the Hermitian (conjugate) transpose.
◆ horzcat()
|
constexpr |
horizontally concatenates two matrices
- Parameters
-
a an matrix of type T b an matrix of type T
- Returns
- an matrix of type T such that
Horizontally concatenates two matrices.
◆ imag()
|
constexpr |
computes the elementwise imag
- Parameters
-
m an matrix of type T
- Returns
- an matrix of type T such that
Computes the elementwise imag of a matrix
◆ inverse()
|
constexpr |
computes the matrix inverse
- Parameters
-
m an matrix of type T
- Returns
- The inverse of , such that
Computes the inverse of a matrix using the reduced row echelon form.
◆ kron()
|
constexpr |
Computes the kronecker tensor product.
- Parameters
-
a an matrix b an matrix
- Returns
- An matrix of type T such that where is the remainder of
Computes the kronecker tensor product of two matrices.
◆ macs()
|
constexpr |
Computes the maximum absolute column sum norm.
- Parameters
-
m an matrix
- Returns
- a scalar of type T such that
Computes the maximum absolute column sum norm of a matrix.
◆ mars()
|
constexpr |
Computes the maximum absolute row sum norm.
- Parameters
-
m an matrix
- Returns
- a scalar of type T such that
Computes the maximum absolute row sum norm of a matrix.
◆ matmul()
|
constexpr |
computes the matrix product
- Parameters
-
a an matrix b an matrix
- Returns
- an matrix of type T such that
Computes the product of two matrices.
◆ matrix() [1/2]
deduction guide for aggregate initialization
This deduction guide allows matrix to be constructed like this:
◆ matrix() [2/2]
|
related |
deduction guide for aggregate initialization
This deduction guide allows matrix to be constructed like this:
◆ matvectmul()
|
constexpr |
computes the product of matrix and vector
- Parameters
-
m an matrix v an N-vector
- Returns
- an M-vector of type T
◆ operator!=()
|
constexpr |
checks inequality of two matrices
- Parameters
-
a an matrix of type T b an matrix of type T
- Returns
- false if and only if
Checks the inequality of two matrices.
◆ operator*() [1/3]
|
constexpr |
computes the Hadamard product
- Parameters
-
a an matrix of type T b an matrix of type T
- Returns
- such that
Computes the Hadamard, or elementwise, product of two vectors.
◆ operator*() [2/3]
|
constexpr |
computes the product of a matrix and a scalar
- Parameters
-
m an matrix of type T a a scalar of type T
- Returns
- such that
Computes the sum of a matrix and a scalar.
◆ operator*() [3/3]
|
constexpr |
computes the product of a matrix and a scalar
- Parameters
-
a a scalar of type T m an matrix of type T
- Returns
- such that
Computes the sum of a matrix and a scalar.
◆ operator+() [1/3]
|
constexpr |
computes the matrix sum
- Parameters
-
a an matrix of type T b an matrix of type T
- Returns
- such that
Computes the vector sum.
◆ operator+() [2/3]
|
constexpr |
computes the sum of a matrix and a scalar
- Parameters
-
m an matrix of type T a a scalar of type T
- Returns
- such that
Computes the sum of a matrix and a scalar.
◆ operator+() [3/3]
|
constexpr |
computes the sum of a matrix and a scalar
- Parameters
-
a a scalar of type T m an matrix of type T
- Returns
- such that
Computes the sum of a matrix and a scalar.
◆ operator/() [1/2]
|
constexpr |
computes the elementwise matrix quotient
- Parameters
-
a an matrix of type T b an matrix of type T
- Returns
- such that and
Computes elementwise division between two matrices
◆ operator/() [2/2]
|
constexpr |
computes the quotient between a matrix and a scalar
- Parameters
-
m an matrix of type T a a scalar of type T
- Returns
- such that
Computes division between a matrix and a scalar.
◆ operator==()
|
constexpr |
checks equality of two matrices
- Parameters
-
a an matrix of type T b an matrix of type T
- Returns
- true if and only if
Checks the equality of two matrices.
◆ rank()
|
constexpr |
Compute the rank.
- Parameters
-
m matrix of type T
- Returns
- a scalar
Computes the rank using the reduced row echelon form.
◆ real()
|
constexpr |
computes the elementwise real
- Parameters
-
m an matrix of type T
- Returns
- an matrix of type T such that
Computes the elementwise real of a matrix
◆ repmat()
|
constexpr |
repeats a matrix
- Template Parameters
-
Row the number of times to repeat in the row direction Col the number of times to repeat in the column direction
- Parameters
-
m an matrix of type T
- Returns
- an matrix of type T such that
Repeats copies of a matrix.
◆ reshape()
|
constexpr |
reshapes a matrix
- Parameters
-
m an matrix of type T
- Returns
- a matrix of type T
Reshapes a matrix without changing the order of the elements in memory (in row-major order).
◆ rref() [1/2]
|
constexpr |
Compute the reduced row echelon form.
- Parameters
-
m an matrix of type T
- Returns
- an matrix of type T, the reduced row echelon form of
Computes the reduced row echelon form of a matrix using Gauss-Jordan elimination. The tolerance for determining negligible elements is .
◆ rref() [2/2]
|
constexpr |
Compute the reduced row echelon form.
- Parameters
-
m an matrix of type T tolerance the tolerance used to determine when an element is negligible (near zero)
- Returns
- an matrix of type T, the reduced row echelon form of
Computes the reduced row echelon form of a matrix using Gauss-Jordan elimination.
◆ submat()
|
constexpr |
extracts the submatrix of a matrix
- Parameters
-
m an matrix of type T a the starting index into the rows b the starting index into the columns
- Returns
- an submatrix of type T such that
Extracts the submatrix of a matrix.
◆ swapcol()
|
constexpr |
swaps columns of a matrix
- Parameters
-
m an matrix of type T a the index of a column to swap b the index of a column to swap
- Returns
- an matrix of type T such that
Swap two rows of a matrix.
◆ swaprow()
|
constexpr |
swaps rows of a matrix
- Parameters
-
m an matrix of type T a the index of a row to swap b the index of a row to swap
- Returns
- an matrix of type T such that
Swap two rows of a matrix.
◆ trace()
|
constexpr |
computes the trace
- Parameters
-
m an matrix of type T
- Returns
- the trace of , such that
Computes the trace of a matrix.
◆ transpose()
|
constexpr |
computes the transpose
- Parameters
-
m an matrix of type T
- Returns
- an matrix of type T such that
Computes the matrix transpose.
◆ vectmatmul()
|
constexpr |
computes the product of vector and matrix
- Parameters
-
v an M-vector m an matrix
- Returns
- an N-vector of type T
◆ vertcat()
|
constexpr |
vertically concatenates two matrices
- Parameters
-
a an matrix of type T b an matrix of type T
- Returns
- an matrix of type T such that
Vertically concatenates two matrices.
Variable Documentation
◆ identity
const matrix<T, N, N> nil::crypto3::algebra::identity |
the matrix identity
The matrix identity .