|
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE | SmallMatrix ()=default |
| Default constructor. More...
|
|
template<typename... Ts, int MM = NRows, int NN = NCols, std::enable_if_t< MM==1||NN==1, int > = 0> |
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE | SmallMatrix (Ts... vs) |
| Constructs column- or row-vector. More...
|
|
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE | SmallMatrix (std::initializer_list< std::initializer_list< T >> const &init) |
| Constructs SmallMatrix with nested std::initializer_list. More...
|
|
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE const T & | operator() (int i, int j) const noexcept |
| Returns a const reference to the element at row i and column j. More...
|
|
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T & | operator() (int i, int j) noexcept |
| Returns a reference to the element at row i and column j. More...
|
|
template<int MM = NRows, int NN = NCols, std::enable_if_t<(MM==1||NN==1), int > = 0> |
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE const T & | operator() (int i) const noexcept |
| Returns a const reference to element i of a vector. More...
|
|
template<int MM = NRows, int NN = NCols, std::enable_if_t<(MM==1||NN==1), int > = 0> |
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T & | operator() (int i) noexcept |
| Returns a reference to element i of a vector. More...
|
|
template<int MM = NRows, int NN = NCols, std::enable_if_t<(MM==1||NN==1), int > = 0> |
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE const T & | operator[] (int i) const noexcept |
| Returns a const reference to element i of a vector. More...
|
|
template<int MM = NRows, int NN = NCols, std::enable_if_t<(MM==1||NN==1), int > = 0> |
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T & | operator[] (int i) noexcept |
| Returns a reference to element i of a vector. More...
|
|
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE const T * | begin () const noexcept |
|
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE const T * | end () const noexcept |
|
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T * | begin () noexcept |
|
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T * | end () noexcept |
|
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SmallMatrix< T, NRows, NCols, ORDER, StartIndex > & | setVal (T val) |
| Set all elements in the matrix to the given value. More...
|
|
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SmallMatrix< T, NCols, NRows, ORDER, StartIndex > | transpose () const |
| Returns transposed matrix. More...
|
|
template<int MM = NRows, int NN = NCols, std::enable_if_t< MM==NN, int > = 0> |
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SmallMatrix< T, NRows, NCols, ORDER, StartIndex > & | transposeInPlace () |
| Transposes a square matrix in-place. More...
|
|
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T | product () const |
| Returns the product of all elements in the matrix. More...
|
|
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T | sum () const |
| Returns the sum of all elements in the matrix. More...
|
|
template<int MM = NRows, int NN = NCols, std::enable_if_t< MM==NN, int > = 0> |
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T | trace () const |
| Returns the trace of a square matrix. More...
|
|
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SmallMatrix< T, NRows, NCols, ORDER, StartIndex > & | operator+= (SmallMatrix< T, NRows, NCols, ORDER, StartIndex > const &rhs) |
| Operator += performing matrix addition as in (*this) += rhs. More...
|
|
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SmallMatrix< T, NRows, NCols, ORDER, StartIndex > & | operator-= (SmallMatrix< T, NRows, NCols, ORDER, StartIndex > const &rhs) |
| Operator -= performing matrix subtraction as in (*this) -= rhs. More...
|
|
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SmallMatrix< T, NRows, NCols, ORDER, StartIndex > | operator- () const |
| Unary minus operator. More...
|
|
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SmallMatrix< T, NRows, NCols, ORDER, StartIndex > & | operator*= (T a) |
| Operator *= that scales this matrix in place by a scalar. More...
|
|
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T | dot (SmallMatrix< T, NRows, NCols, ORDER, StartIndex > const &rhs) const |
| Returns the dot product of two vectors. More...
|
|
template<int N, std::enable_if_t<(N< NRows *NCols), int > = 0> |
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE T const & | get () const |
|
template<int N, std::enable_if_t<(N< NRows *NCols), int > = 0> |
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE T & | get () |
|
|
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE friend SmallMatrix< T, NRows, NCols, ORDER, StartIndex > | operator+ (SmallMatrix< T, NRows, NCols, ORDER, StartIndex > lhs, SmallMatrix< T, NRows, NCols, ORDER, StartIndex > const &rhs) |
| Binary operator + returning the result of maxtrix addition, lhs+rhs. More...
|
|
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE friend SmallMatrix< T, NRows, NCols, ORDER, StartIndex > | operator- (SmallMatrix< T, NRows, NCols, ORDER, StartIndex > lhs, SmallMatrix< T, NRows, NCols, ORDER, StartIndex > const &rhs) |
| Binary operator - returning the result of maxtrix subtraction, lhs-rhs. More...
|
|
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE friend SmallMatrix< T, NRows, NCols, ORDER, StartIndex > | operator* (SmallMatrix< T, NRows, NCols, ORDER, StartIndex > m, T a) |
| Returns the product of a matrix and a scalar. More...
|
|
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE friend SmallMatrix< T, NRows, NCols, ORDER, StartIndex > | operator* (T a, SmallMatrix< T, NRows, NCols, ORDER, StartIndex > m) |
| Returns the product of a scalar and a matrix. More...
|
|
template<class U , int N1, int N2, int N3, Order Ord, int SI> |
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE friend SmallMatrix< U, N1, N3, Ord, SI > | operator* (SmallMatrix< U, N1, N2, Ord, SI > const &lhs, SmallMatrix< U, N2, N3, Ord, SI > const &rhs) |
| Returns matrix product of two matrices. More...
|
|
template<class T, int NRows, int NCols, Order ORDER = Order::F, int StartIndex = 0>
struct amrex::SmallMatrix< T, NRows, NCols, ORDER, StartIndex >
Matrix class with compile-time size.
Note that column vectors and row vectors are special cases of a Matrix.
- Template Parameters
-
T | Matrix element data type. |
NRows | Number of rows. |
NCols | Number of columns. |
ORDER | Memory layout order. Order::F (i.e., column-major) by default. |
StartIndex | Starting index. Either 0 or 1. |