STORMM Source Documentation
|
A matrix object that can traverse CPU and GPU memory. More...
#include <matrix.h>
Public Member Functions | |
HybridLabel | getLabel () const |
Produce the label for this matrix (obtained from the label of its primary contents) | |
void | resize (size_t new_rows, size_t new_cols) |
Change the number of rows and columns. Elements outside the bounds of the new matrix will be discarded. If the new matrix is larger than the old one, all elements will be preserved and new elements will be initialized to zero. | |
void | reset () |
Empty the matrix and set its size to 0 by 0. | |
T | operator() (size_t row_idx, size_t col_idx, HybridTargetLevel tier=HybridTargetLevel::HOST) |
Element-wise access via the function call () operator. This entails two bounds checks. | |
T | atHost (size_t row_idx, size_t col_idx) |
Element-wise access to host data without bounds checks, following on the Armadillo naming conventions. | |
T | atDevice (size_t row_idx, size_t col_idx) |
Element-wise access to data on the GPU without bounds checks, following on the Armadillo naming conventions. | |
Hybrid< T > | colptr (size_t col_idx, const char *tag_in=nullptr) |
Get a Hybrid POINTER-kind object that is set directly to the column of interest. | |
HpcMatrix (const char *tag_in=nullptr, HybridFormat format_in=default_hpc_format) | |
Constructors must set public-facing reference variables in addition to private member variables. | |
HpcMatrix (size_t rows_in, size_t cols_in, const char *tag_in=nullptr, HybridFormat format_in=default_hpc_format, MatrixFillMode fill_method=MatrixFillMode::VALUE, T fill_value=static_cast< T >(0)) | |
HpcMatrix (size_t rows_in, size_t cols_in, MatrixFillMode fill_method, T fill_value=static_cast< T >(0), const char *tag_in=nullptr, HybridFormat format_in=default_hpc_format) | |
HpcMatrix (size_t rows_in, size_t cols_in, MatrixFillMode fill_method, Ran2Generator *matrng, const char *tag_in=nullptr, HybridFormat format_in=default_hpc_format) | |
const T * | memptr (HybridTargetLevel tier=HybridTargetLevel::HOST) const |
Pointer to the memory itself, on the host or the device. This takes its name from the Armadillo vec, mat, and cube classes. | |
T * | memptr (HybridTargetLevel tier=HybridTargetLevel::HOST) |
Public Attributes | |
const size_t & | n_rows |
const size_t & | n_cols |
const size_t & | n_elem |
A matrix object that can traverse CPU and GPU memory.
stormm::stmath::HpcMatrix< T >::HpcMatrix | ( | const char * | tag_in = nullptr, |
HybridFormat | format_in = default_hpc_format ) |
Constructors must set public-facing reference variables in addition to private member variables.
Overloaded:
rows_in | The number of rows to allocate |
cols_in | The number of columns to allocate |
fill_method | Manner in which to fill the indices |
fill_value | A scalar value for initializing all elements if fill_method is VALUE, or the random seed for initializing a random number generator if fill_method is RANDU or RANDN |
T stormm::stmath::HpcMatrix< T >::atDevice | ( | size_t | row_idx, |
size_t | col_idx ) |
Element-wise access to data on the GPU without bounds checks, following on the Armadillo naming conventions.
row_idx | Index of the row to access, starting at 0 |
col_idx | Index of the column to access, starting at 0 |
T stormm::stmath::HpcMatrix< T >::atHost | ( | size_t | row_idx, |
size_t | col_idx ) |
Element-wise access to host data without bounds checks, following on the Armadillo naming conventions.
row_idx | Index of the row to access, starting at 0 |
col_idx | Index of the column to access, starting at 0 |
Hybrid< T > stormm::stmath::HpcMatrix< T >::colptr | ( | size_t | col_idx, |
const char * | tag_in = nullptr ) |
Get a Hybrid POINTER-kind object that is set directly to the column of interest.
col_idx | The column of interest |
tag_in | A note to help identify the column pointer |
const T * stormm::stmath::HpcMatrix< T >::memptr | ( | HybridTargetLevel | tier = HybridTargetLevel::HOST | ) | const |
Pointer to the memory itself, on the host or the device. This takes its name from the Armadillo vec, mat, and cube classes.
Overloaded:
tier | Indicator of whether to offer a pointer to host or GPU device memory |
T stormm::stmath::HpcMatrix< T >::operator() | ( | size_t | row_idx, |
size_t | col_idx, | ||
HybridTargetLevel | tier = HybridTargetLevel::HOST ) |
Element-wise access via the function call () operator. This entails two bounds checks.
row_idx | Index of the row to access, starting at 0 |
col_idx | Index of the column to access, starting at 0 |
tier | Indicator of whether to access data on the host or on the GPU |
void stormm::stmath::HpcMatrix< T >::resize | ( | size_t | new_rows, |
size_t | new_cols ) |
Change the number of rows and columns. Elements outside the bounds of the new matrix will be discarded. If the new matrix is larger than the old one, all elements will be preserved and new elements will be initialized to zero.
new_rows | New number of rows to allocate |
new_cols | New number of columns to allocate |