10 template<
class Device>
13 using exspace =
typename Device::execution_space;
23 Kokkos::View<double**,Kokkos::LayoutRight, Device>
value;
24 Kokkos::View<int**,Kokkos::LayoutRight, Device>
eindex;
25 Kokkos::View<int*,Kokkos::LayoutRight, Device>
nelement;
30 Kokkos::View<int*,Kokkos::LayoutRight, Device>
csr_ridx;
31 Kokkos::View<double*,Kokkos::LayoutRight, Device>
csr_v;
32 Kokkos::View<int*,Kokkos::LayoutRight, Device>
csr_cidx;
49 value(
"value",m_in,w_in),
50 eindex(Kokkos::ViewAllocateWithoutInitializing(
"eindex"), m_in,w_in),
67 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)
75 csr_ridx = Kokkos::View<int*,Kokkos::LayoutRight, Device>(Kokkos::ViewAllocateWithoutInitializing(
"csr_ridx"),
m+1);
76 csr_v = Kokkos::View<double*,Kokkos::LayoutRight, Device>(Kokkos::ViewAllocateWithoutInitializing(
"csr_v"),
nnz);
77 csr_cidx = Kokkos::View<int*,Kokkos::LayoutRight, Device>(Kokkos::ViewAllocateWithoutInitializing(
"csr_cidx"),
nnz);
82 value = Kokkos::View<double**,Kokkos::LayoutRight, Device>(Kokkos::ViewAllocateWithoutInitializing(
"value"),
m,
width);
83 eindex = Kokkos::View<int**,Kokkos::LayoutRight, Device>(Kokkos::ViewAllocateWithoutInitializing(
"eindex"),
m,
width);
84 nelement = Kokkos::View<int*,Kokkos::LayoutRight, Device>(Kokkos::ViewAllocateWithoutInitializing(
"nelement"),
m);
198 void mult_org(
const Kokkos::View<double*,Kokkos::LayoutRight,Device>& x,
const Kokkos::View<double*,Kokkos::LayoutRight,Device>& y)
const{
202 for (
int j=0; j<mat.
nelement(i); j++){
215 void mult_csr(
const Kokkos::View<double*,Kokkos::LayoutRight,Device>& x,
const Kokkos::View<double*,Kokkos::LayoutRight,Device>& y)
const{
268 void mult_tensor_org(
const Kokkos::View<double**,Kokkos::LayoutRight,Device>& x,
const Kokkos::View<double**,Kokkos::LayoutRight,Device>& y)
const{
269 int nv = x.extent(1);
275 for (
int j=0; j<=mat.
nelement(i); j++){
288 void mult_tensor_csr(
const Kokkos::View<double**,Kokkos::LayoutRight,Device>& x,
const Kokkos::View<double**,Kokkos::LayoutRight,Device>& y)
const{
289 int nv = x.extent(1);
310 void mult(
const Kokkos::View<double*,Kokkos::LayoutRight,Device>& x,
const Kokkos::View<double*,Kokkos::LayoutRight,Device>& y)
const{
340 void mult_tensor(
const Kokkos::View<double**,Kokkos::LayoutRight,Device>& x,
const Kokkos::View<double**,Kokkos::LayoutRight,Device>& y)
const{
void array_deep_copy(T *array, const Kokkos::View< T *, Kokkos::LayoutRight, Device > &view)
Definition: array_deep_copy.hpp:11
Kokkos::View< int *, Kokkos::LayoutRight, Device > nelement
of non-zero element of each row
Definition: matrix.hpp:25
void mult_org(const Kokkos::View< double *, Kokkos::LayoutRight, Device > &x, const Kokkos::View< double *, Kokkos::LayoutRight, Device > &y) const
Definition: matrix.hpp:198
void mult_tensor_org(const Kokkos::View< double **, Kokkos::LayoutRight, Device > &x, const Kokkos::View< double **, Kokkos::LayoutRight, Device > &y) const
Definition: matrix.hpp:268
void mult_csr(const Kokkos::View< double *, Kokkos::LayoutRight, Device > &x, const Kokkos::View< double *, Kokkos::LayoutRight, Device > &y) const
Definition: matrix.hpp:215
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)
Definition: matrix.hpp:67
int nnz
if in CSR format, number of (nonzero) values
Definition: matrix.hpp:29
Kokkos::View< int *, Kokkos::LayoutRight, Device > csr_cidx
columun index - nnz
Definition: matrix.hpp:32
Definition: matrix.hpp:16
void mult(const Kokkos::View< double *, Kokkos::LayoutRight, Device > &x, const Kokkos::View< double *, Kokkos::LayoutRight, Device > &y) const
Definition: matrix.hpp:310
typename Device::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:21
idx
Definition: diag_f0_df_port1.hpp:32
int m
of rows (size of each column)
Definition: matrix.hpp:20
int width
Definition: matrix.hpp:22
Definition: matrix.hpp:11
bool is_csr
Whether the matrix is in CSR format.
Definition: matrix.hpp:28
Kokkos::View< int **, Kokkos::LayoutRight, Device > eindex
column index - 1-indexed!!
Definition: matrix.hpp:24
Matrix()
Definition: matrix.hpp:36
Matrix(int m_in, int n_in, int w_in)
Definition: matrix.hpp:45
SetValueOpt
Definition: matrix.hpp:15
Kokkos::View< double *, Kokkos::LayoutRight, Device > csr_v
value of CSR - nnz
Definition: matrix.hpp:31
Kokkos::View< int *, Kokkos::LayoutRight, Device > csr_ridx
row index for CSR - m+1
Definition: matrix.hpp:30
void parallel_for(const std::string name, int n_ptl, Function func, Option option, HostAoSoA aosoa_h, DeviceAoSoA aosoa_d)
Definition: streamed_parallel_for.hpp:252
void mult_tensor(const Kokkos::View< double **, Kokkos::LayoutRight, Device > &x, const Kokkos::View< double **, Kokkos::LayoutRight, Device > &y) const
Definition: matrix.hpp:340
void mult_tensor_csr(const Kokkos::View< double **, Kokkos::LayoutRight, Device > &x, const Kokkos::View< double **, Kokkos::LayoutRight, Device > &y) const
Definition: matrix.hpp:288
Kokkos::View< double **, Kokkos::LayoutRight, Device > value
matrix value
Definition: matrix.hpp:23