|
TRIQS/nda 2.0.0
Multi-dimensional array library for C++
|
Functions to compute various norms of arrays and views as well as other numbers like determinants.
Functions | |
| template<Matrix M> requires (get_algebra<M> == 'M' and nda::mem::have_host_compatible_addr_space<M> and is_blas_lapack_v<get_value_t<M>>) | |
| auto | nda::linalg::det (M const &m) |
| Compute the determinant of an \( n \times n \) matrix \( \mathbf{M} \). | |
| template<blas_lapack::BlasArray< 2 > M> requires (get_algebra<M> == 'M' and nda::mem::have_host_compatible_addr_space<M>) | |
| auto | nda::linalg::det_in_place (M &&m) |
| Compute the determinant of an \( n \times n \) matrix \( \mathbf{M} \) in place. | |
| template<ArrayOfRank< 1 > X> requires (Scalar<get_value_t<X>>) | |
| double | nda::linalg::norm (X const &x, double p=2.0) |
| Calculate the \( p \)-norm of a 1-dimensional array/view with scalar elements. | |
| auto nda::linalg::det | ( | M const & | m | ) |
#include <nda/linalg/det.hpp>
Compute the determinant of an \( n \times n \) matrix \( \mathbf{M} \).
The given matrix/view is not modified. It first makes a copy of the matrix/view and then calls nda::linalg::det_in_place.
| M | nda::Matrix type. |
| m | Input matrix \( \mathbf{M} \). |
| auto nda::linalg::det_in_place | ( | M && | m | ) |
#include <nda/linalg/det.hpp>
Compute the determinant of an \( n \times n \) matrix \( \mathbf{M} \) in place.
For small matrices ( \( n < 4 \)), it uses optimized inline implementations.
For larger matrices, it calls nda::lapack::getrf and calculates the determinant from its LU decomposition.
An exception is thrown, if the call to nda::lapack::getrf fails.
| M | nda::blas_lapack::BlasArray<2> type. |
| m | Input/output matrix. On entry, the matrix \( \mathbf{M} \). On exit, the matrix \( \mathbf{M} \) ( \(n < 4 \)) or the LU decomposition from nda::lapack::getrf ( \( n \geq 4 \)). |
| double nda::linalg::norm | ( | X const & | x, |
| double | p = 2.0 ) |
#include <nda/linalg/norm.hpp>
Calculate the \( p \)-norm of a 1-dimensional array/view with scalar elements.
The \( p \)-norm is defined as
\[ || \mathbf{x} ||_p = \left( \sum_{i=0}^{N-1} |x_i|^p \right)^{1/p} \]
with the special cases (following numpy.linalg.norm convention)
| X | nda::ArrayOfRank<1> type. |
| x | 1-dimensional array \( \mathbf{x} \). |
| p | Order of the norm. |