XGC1
|
#include <matrix.hpp>
Public Types | |
enum | SetValueOpt { Replace =0, Add =1 } |
enum | Type { Identity =0 } |
Public Member Functions | |
Matrix () | |
Matrix (int m_in, int n_in, int w_in) | |
Matrix (Type matrix_type, int m_in) | |
Matrix (int m_in, int n_in, int w_in, int nnz_in, bool is_csr_in, int *csr_ridx_or_eindex, int *csr_cidx_or_nelement, double *values) | |
template<class Device2 > | |
Matrix< Device2 > | mirror () const |
void | convert_org_to_csr () |
KOKKOS_INLINE_FUNCTION void | set_value (int i, int j, double value_in, SetValueOpt flag) const |
void | mult_org (const View< double *, CLayout, Device > &x, const View< double *, Kokkos::LayoutRight, Device > &y) const |
void | mult_csr (const View< double *, CLayout, Device > &x, const View< double *, Kokkos::LayoutRight, Device > &y) const |
void | mult_tensor_org (const View< double **, CLayout, Device > &x, const View< double **, Kokkos::LayoutRight, Device > &y) const |
void | mult_tensor_csr (const View< double **, CLayout, Device > &x, const View< double **, Kokkos::LayoutRight, Device > &y) const |
void | transpose_mult_org (const View< double *, CLayout, Device > &x, const View< double *, Kokkos::LayoutRight, Device > &y) const |
void | transpose_mult_csr (const View< double *, CLayout, Device > &x, const View< double *, Kokkos::LayoutRight, Device > &y) const |
void | mult (const View< double *, CLayout, Device > &x, const View< double *, Kokkos::LayoutRight, Device > &y) const |
void | mult_tensor (const View< double **, CLayout, Device > &x, const View< double **, Kokkos::LayoutRight, Device > &y) const |
void | transpose_mult (const View< double *, CLayout, Device > &x, const View< double *, Kokkos::LayoutRight, Device > &y) const |
void | write (const std::string stream_name, const std::string filename) const |
Public Attributes | |
int | m |
of rows (size of each column)More... | |
int | n |
of columns (size of each row)More... | |
int | width |
View< double **, CLayout, Device > | value |
matrix value More... | |
View< int **, CLayout, Device > | eindex |
column index - 1-indexed!! More... | |
View< int *, CLayout, Device > | nelement |
of non-zero element of each rowMore... | |
bool | is_csr |
Whether the matrix is in CSR format. More... | |
int | nnz |
if in CSR format, number of (nonzero) values More... | |
View< int *, CLayout, Device > | csr_ridx |
row index for CSR - m+1 More... | |
View< double *, CLayout, Device > | csr_v |
value of CSR - nnz More... | |
View< int *, CLayout, Device > | csr_cidx |
columun index - nnz More... | |
Private Types | |
using | exspace = typename Device::execution_space |
Use execution space where matrix views are allocated. More... | |
Use execution space where matrix views are allocated.
enum Matrix::SetValueOpt |
enum Matrix::Type |
Constructor that allocates the original format
[in] | m_in | is the # of rows |
[in] | n_in | is the # of columns |
[in] | w_in | is the width you think you will need (youll get an error later if its too small) |
Constructor of identity matrix
[in] | m_in | is the # of rows and columns |
Matrix< Device >::Matrix | ( | int | m_in, |
int | n_in, | ||
int | w_in, | ||
int | nnz_in, | ||
bool | is_csr_in, | ||
int * | csr_ridx_or_eindex, | ||
int * | csr_cidx_or_nelement, | ||
double * | values | ||
) |
Constructor that deep copies the matrix from pointers (to copy from Fortran mat_type)
[in] | m_in | is the # of rows |
[in] | n_in | is the # of columns |
[in] | w_in | is the width you think you will need (youll get an error later if its too small) |
[in] | nnz_in | is the number of nonzero entries |
[in] | is_csr_in | is whether the matrix is in CSR format |
[in] | csr_ridx_or_eindex | points to csr_ridx if in CSR, otherwise to eindex |
[in] | csr_cidx_or_nelement | points to csr_cidx if in CSR, otherwise to nelement |
[in] | values | is the pointer to the matrix entries |
void Matrix< Device >::convert_org_to_csr | ( | ) |
Converts matrix from original format to CSR.
|
inline |
void Matrix< Device >::mult | ( | const View< double *, CLayout, Device > & | x, |
const View< double *, Kokkos::LayoutRight, Device > & | y | ||
) | const |
Matrix multiplication of the form: y = Ax. Dispatch for the two matrix formats
[in] | x | is the input vector |
[out] | y | is the result |
void Matrix< Device >::mult_tensor | ( | const View< double **, CLayout, Device > & | x, |
const View< double **, Kokkos::LayoutRight, Device > & | y | ||
) | const |
Matrix multiplication using the transpose, i.e.: y = A^T x. Dispatch for the two matrix formats
[in] | x | is the input vector |
[out] | y | is the result |
[in] | x | is the input tensor |
[out] | y | is the result |
|
inline |
Set value of matrix component. Inlined since this will presumably be called a lot in a loop
[in] | i | is the row index |
[in] | j | is the column index |
[in] | value_in | is the value to set |
[in] | flag | is whether to add or replace if there is an existing value in the chosen matrix element |
void Matrix< Device >::transpose_mult | ( | const View< double *, CLayout, Device > & | x, |
const View< double *, Kokkos::LayoutRight, Device > & | y | ||
) | const |
Matrix multiplication using the transpose, i.e.: y = A^T x. Dispatch for the two matrix formats
[in] | x | is the input vector |
[out] | y | is the result |
void Matrix< Device >::write | ( | const std::string | stream_name, |
const std::string | filename | ||
) | const |
row index for CSR - m+1
column index - 1-indexed!!
bool Matrix< Device >::is_csr |
Whether the matrix is in CSR format.
int Matrix< Device >::m |
int Matrix< Device >::n |
int Matrix< Device >::nnz |
if in CSR format, number of (nonzero) values
int Matrix< Device >::width |