|
| __host__ __device__ constexpr | SmallMatrix ()=default |
| | Default constructor.
|
| |
| template<typename... Ts, int MM = NRows, int NN = NCols, std::enable_if_t< MM==1||NN==1, int > = 0> |
| __host__ __device__ constexpr | SmallMatrix (Ts... vs) |
| | Constructs column- or row-vector.
|
| |
| __host__ __device__ | SmallMatrix (std::initializer_list< std::initializer_list< T > > const &init) |
| | Constructs SmallMatrix with nested std::initializer_list.
|
| |
| __host__ __device__ const T & | operator() (int i, int j) const noexcept |
| | Returns a const reference to the element at row i and column j.
|
| |
| __host__ __device__ T & | operator() (int i, int j) noexcept |
| | Returns a reference to the element at row i and column j.
|
| |
| template<int MM = NRows, int NN = NCols, std::enable_if_t<(MM==1||NN==1), int > = 0> |
| __host__ __device__ const T & | operator() (int i) const noexcept |
| | Returns a const reference to element i of a vector.
|
| |
| template<int MM = NRows, int NN = NCols, std::enable_if_t<(MM==1||NN==1), int > = 0> |
| __host__ __device__ T & | operator() (int i) noexcept |
| | Returns a reference to element i of a vector.
|
| |
| template<int MM = NRows, int NN = NCols, std::enable_if_t<(MM==1||NN==1), int > = 0> |
| __host__ __device__ const T & | operator[] (int i) const noexcept |
| | Returns a const reference to element i of a vector.
|
| |
| template<int MM = NRows, int NN = NCols, std::enable_if_t<(MM==1||NN==1), int > = 0> |
| __host__ __device__ T & | operator[] (int i) noexcept |
| | Returns a reference to element i of a vector.
|
| |
| __host__ __device__ const T * | begin () const noexcept |
| |
| __host__ __device__ const T * | end () const noexcept |
| |
| __host__ __device__ T * | begin () noexcept |
| |
| __host__ __device__ T * | end () noexcept |
| |
| __host__ __device__ SmallMatrix< T, NRows, NCols, ORDER, StartIndex > & | setVal (T val) |
| | Set all elements in the matrix to the given value.
|
| |
| __host__ __device__ SmallMatrix< T, NCols, NRows, ORDER, StartIndex > | transpose () const |
| | Returns transposed matrix.
|
| |
| template<int MM = NRows, int NN = NCols, std::enable_if_t< MM==NN, int > = 0> |
| __host__ __device__ SmallMatrix< T, NRows, NCols, ORDER, StartIndex > & | transposeInPlace () |
| | Transposes a square matrix in-place.
|
| |
| __host__ __device__ T | product () const |
| | Returns the product of all elements in the matrix.
|
| |
| __host__ __device__ T | sum () const |
| | Returns the sum of all elements in the matrix.
|
| |
| template<int MM = NRows, int NN = NCols, std::enable_if_t< MM==NN, int > = 0> |
| __host__ __device__ T | trace () const |
| | Returns the trace of a square matrix.
|
| |
| __host__ __device__ SmallMatrix< T, NRows, NCols, ORDER, StartIndex > & | operator+= (SmallMatrix< T, NRows, NCols, ORDER, StartIndex > const &rhs) |
| | Operator += performing matrix addition as in (*this) += rhs.
|
| |
| __host__ __device__ SmallMatrix< T, NRows, NCols, ORDER, StartIndex > & | operator-= (SmallMatrix< T, NRows, NCols, ORDER, StartIndex > const &rhs) |
| | Operator -= performing matrix subtraction as in (*this) -= rhs.
|
| |
| __host__ __device__ SmallMatrix< T, NRows, NCols, ORDER, StartIndex > | operator- () const |
| | Unary minus operator.
|
| |
| __host__ __device__ SmallMatrix< T, NRows, NCols, ORDER, StartIndex > & | operator*= (T a) |
| | Operator *= that scales this matrix in place by a scalar.
|
| |
| __host__ __device__ T | dot (SmallMatrix< T, NRows, NCols, ORDER, StartIndex > const &rhs) const |
| | Returns the dot product of two vectors.
|
| |
| template<int N, std::enable_if_t<(N< NRows *NCols), int > = 0> |
| __host__ __device__ constexpr T const & | get () const |
| |
| template<int N, std::enable_if_t<(N< NRows *NCols), int > = 0> |
| __host__ __device__ constexpr T & | get () |
| |
|
| __host__ __device__ 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.
|
| |
| __host__ __device__ 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.
|
| |
| __host__ __device__ 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.
|
| |
| __host__ __device__ 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.
|
| |
| template<class U , class V , int N1, int N2, int N3, Order Ord, int SI> |
| __host__ __device__ friend decltype(auto) | operator* (SmallMatrix< U, N1, N2, Ord, SI > const &lhs, SmallMatrix< V, N2, N3, Ord, SI > const &rhs) |
| | Returns matrix product of two matrices.
|
| |
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. |