10 template<
class Device>
13 using exspace =
typename Device::execution_space;
27 View<double**,CLayout, Device>
value;
35 View<double*,CLayout, Device>
csr_v;
42 Matrix(
int m_in,
int n_in,
int w_in);
46 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);
49 template<
class Device2>
91 DEVICE_PRINTF(
"\n Error: set_value is only allowed when matrix is not in csr format");
96 if(i>=
m || j>=
n || i<0 || j<0){
105 value(i,l) = value_in;
107 value(i,l) += value_in;
121 DEVICE_PRINTF(
"\nError in set_value: Not enough memory space for matrix.");
130 void mult_org(
const View<double*,CLayout,Device>& x,
const View<double*,Kokkos::LayoutRight,Device>& y)
const;
132 void mult_csr(
const View<double*,CLayout,Device>& x,
const View<double*,Kokkos::LayoutRight,Device>& y)
const;
134 void mult_tensor_org(
const View<double**,CLayout,Device>& x,
const View<double**,Kokkos::LayoutRight,Device>& y)
const;
136 void mult_tensor_csr(
const View<double**,CLayout,Device>& x,
const View<double**,Kokkos::LayoutRight,Device>& y)
const;
138 void transpose_mult_org(
const View<double*,CLayout,Device>& x,
const View<double*,Kokkos::LayoutRight,Device>& y)
const;
140 void transpose_mult_csr(
const View<double*,CLayout,Device>& x,
const View<double*,Kokkos::LayoutRight,Device>& y)
const;
144 void mult(
const View<double*,CLayout,Device>& x,
const View<double*,Kokkos::LayoutRight,Device>& y)
const;
146 void mult_tensor(
const View<double**,CLayout,Device>& x,
const View<double**,Kokkos::LayoutRight,Device>& y)
const;
148 void transpose_mult(
const View<double*,CLayout,Device>& x,
const View<double*,Kokkos::LayoutRight,Device>& y)
const;
150 void write(
const std::string stream_name,
const std::string filename)
const;
View< int **, CLayout, Device > eindex
column index - 1-indexed!!
Definition: matrix.hpp:28
void transpose_mult_org(const View< double *, CLayout, Device > &x, const View< double *, Kokkos::LayoutRight, Device > &y) const
Definition: matrix.cpp:178
void mirror_copy(T1 &view_dest, const T2 &view_src)
Definition: my_mirror_view.hpp:122
#define DEVICE_PRINTF(...)
Definition: space_settings.hpp:86
void mult_tensor(const View< double **, CLayout, Device > &x, const View< double **, Kokkos::LayoutRight, Device > &y) const
Definition: matrix.cpp:290
Matrix< Device2 > mirror() const
Definition: matrix.hpp:50
int nnz
if in CSR format, number of (nonzero) values
Definition: matrix.hpp:33
View< double *, CLayout, Device > csr_v
value of CSR - nnz
Definition: matrix.hpp:35
Definition: matrix.hpp:16
typename HostType::execution_space exspace
Use execution space where matrix views are allocated.
Definition: matrix.hpp:13
Definition: matrix.hpp:17
int n
of columns (size of each row)
Definition: matrix.hpp:25
void transpose_mult(const View< double *, CLayout, Device > &x, const View< double *, Kokkos::LayoutRight, Device > &y) const
Definition: matrix.cpp:306
View< int *, CLayout, Device > csr_cidx
columun index - nnz
Definition: matrix.hpp:36
void mult_tensor_csr(const View< double **, CLayout, Device > &x, const View< double **, Kokkos::LayoutRight, Device > &y) const
Definition: matrix.cpp:237
View< int *, CLayout, Device > csr_ridx
row index for CSR - m+1
Definition: matrix.hpp:34
int m
of rows (size of each column)
Definition: matrix.hpp:24
int width
Definition: matrix.hpp:26
Definition: matrix.hpp:11
bool is_csr
Whether the matrix is in CSR format.
Definition: matrix.hpp:32
Matrix()
Definition: matrix.hpp:40
void write(const std::string stream_name, const std::string filename) const
Definition: matrix.cpp:315
View< T *, CLayout, Device > my_mirror_view(const View< T *, CLayout, Device > &view, Device nd)
Definition: my_mirror_view.hpp:14
void convert_org_to_csr()
Definition: matrix.cpp:94
KOKKOS_INLINE_FUNCTION void set_value(int i, int j, double value_in, SetValueOpt flag) const
Definition: matrix.hpp:89
Type
Definition: matrix.hpp:20
SetValueOpt
Definition: matrix.hpp:15
void mult(const View< double *, CLayout, Device > &x, const View< double *, Kokkos::LayoutRight, Device > &y) const
Definition: matrix.cpp:259
View< int *, CLayout, Device > nelement
of non-zero element of each row
Definition: matrix.hpp:29
Definition: matrix.hpp:21
void transpose_mult_csr(const View< double *, CLayout, Device > &x, const View< double *, Kokkos::LayoutRight, Device > &y) const
Definition: matrix.cpp:197
void mult_org(const View< double *, CLayout, Device > &x, const View< double *, Kokkos::LayoutRight, Device > &y) const
Definition: matrix.cpp:141
View< double **, CLayout, Device > value
matrix value
Definition: matrix.hpp:27
void mult_tensor_org(const View< double **, CLayout, Device > &x, const View< double **, Kokkos::LayoutRight, Device > &y) const
Definition: matrix.cpp:216
void mult_csr(const View< double *, CLayout, Device > &x, const View< double *, Kokkos::LayoutRight, Device > &y) const
Definition: matrix.cpp:159