num::mat¶
Defined in header <container/matrix.hpp>
template <std::floating_point T>
class mat;
Dense row-major matrix \(A \in \mathbb{K}^{m \times n}\).
Members¶
| member | description |
|---|---|
using value_type = T |
|
mat() |
Construct an empty matrix. |
mat(idx rows, idx cols) |
Construct a rows x cols matrix of zeros. |
mat(idx rows, idx cols, T val) |
Construct a rows x cols matrix with every entry equal to val. |
mat(const mat &o) |
|
mat(mat &&o) noexcept |
|
mat &operator=(const mat &o) |
|
mat &operator=(mat &&o) noexcept |
|
constexpr idx rows() const noexcept |
Return the number of rows, columns and entries. |
constexpr idx cols() const noexcept |
|
constexpr idx size() const noexcept |
|
T *data() noexcept |
Return the row-major storage; the base pointer is aligned to storage_alignment. |
const T *data() const noexcept |
|
T &operator()(idx i, idx j) |
|
T operator()(idx i, idx j) const |
|
void to_gpu() |
Copy the matrix to the device, allocating a copy there on first use. |
void to_cpu() |
Copy the matrix back from the device and free the device copy. |
T *gpu_data() |
Return the device copy, or null when there is none. |
const T *gpu_data() const |
|
bool on_gpu() const |
|
template <class X = vec<real>, class Y = vec<real>> void apply(const X &x, Y &y) const |
Apply the matrix to a vector: \(y \leftarrow A x\). |