XGCa
Public Types | Public Member Functions | Public Attributes | Private Types | List of all members
Matrix< Device > Class Template Reference

#include <matrix.hpp>

Collaboration diagram for Matrix< Device >:
Collaboration graph
[legend]

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
 
KOKKOS_INLINE_FUNCTION void normalize_row (int irow, double norm) const
 
KOKKOS_INLINE_FUNCTION void sort_row (int i) 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
 
int n
 
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
 
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...
 

Member Typedef Documentation

◆ exspace

template<class Device >
using Matrix< Device >::exspace = typename Device::execution_space
private

Use execution space where matrix views are allocated.

Member Enumeration Documentation

◆ SetValueOpt

template<class Device >
enum Matrix::SetValueOpt
Enumerator
Replace 
Add 

◆ Type

template<class Device >
enum Matrix::Type
Enumerator
Identity 

Constructor & Destructor Documentation

◆ Matrix() [1/4]

template<class Device >
Matrix< Device >::Matrix ( )
inline

◆ Matrix() [2/4]

template<class Device >
Matrix< Device >::Matrix ( int  m_in,
int  n_in,
int  w_in 
)

Constructor that allocates the original format

Parameters
[in]m_inis the # of rows
[in]n_inis the # of columns
[in]w_inis the width you think you will need (youll get an error later if its too small)

◆ Matrix() [3/4]

template<class Device >
Matrix< Device >::Matrix ( Type  matrix_type,
int  m_in 
)

Constructor of identity matrix

Parameters
[in]m_inis the # of rows and columns

◆ Matrix() [4/4]

template<class Device >
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)

Parameters
[in]m_inis the # of rows
[in]n_inis the # of columns
[in]w_inis the width you think you will need (youll get an error later if its too small)
[in]nnz_inis the number of nonzero entries
[in]is_csr_inis whether the matrix is in CSR format
[in]csr_ridx_or_eindexpoints to csr_ridx if in CSR, otherwise to eindex
[in]csr_cidx_or_nelementpoints to csr_cidx if in CSR, otherwise to nelement
[in]valuesis the pointer to the matrix entries

Member Function Documentation

◆ convert_org_to_csr()

template<class Device >
void Matrix< Device >::convert_org_to_csr

Converts matrix from original format to CSR.

Returns
void
Here is the caller graph for this function:

◆ mirror()

template<class Device >
template<class Device2 >
Matrix<Device2> Matrix< Device >::mirror ( ) const
inline
Here is the call graph for this function:

◆ mult()

template<class Device >
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

Parameters
[in]xis the input vector
[out]yis the result
Returns
void
Here is the caller graph for this function:

◆ mult_csr()

template<class Device >
void Matrix< Device >::mult_csr ( const View< double *, CLayout, Device > &  x,
const View< double *, Kokkos::LayoutRight, Device > &  y 
) const

Matrix multiplication of the form: y = Ax. Matrix is in CSR format.

Parameters
[in]xis the input vector
[out]yis the result
Returns
void

◆ mult_org()

template<class Device >
void Matrix< Device >::mult_org ( const View< double *, CLayout, Device > &  x,
const View< double *, Kokkos::LayoutRight, Device > &  y 
) const

Matrix multiplication of the form: y = Ax. Matrix is in original data format.

Parameters
[in]xis the input vector
[out]yis the result
Returns
void
Here is the call graph for this function:

◆ mult_tensor()

template<class Device >
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

Parameters
[in]xis the input vector
[out]yis the result
Returns
void Matrix multiplication of tensor of the form: y = Ax. Dispatch for the two matrix formats
Parameters
[in]xis the input tensor
[out]yis the result
Returns
void

◆ mult_tensor_csr()

template<class Device >
void Matrix< Device >::mult_tensor_csr ( const View< double **, CLayout, Device > &  x,
const View< double **, Kokkos::LayoutRight, Device > &  y 
) const

Matrix multiplication of tensor of the form: y = Ax. Matrix is in CSR format.

Parameters
[in]xis the input tensor
[in]yis the result
Returns
void
Here is the call graph for this function:

◆ mult_tensor_org()

template<class Device >
void Matrix< Device >::mult_tensor_org ( const View< double **, CLayout, Device > &  x,
const View< double **, Kokkos::LayoutRight, Device > &  y 
) const

Matrix multiplication of tensor of the form: y = Ax. Matrix is in original data format.

Parameters
[in]xis the input tensor
[in]yis the result
Returns
void
Here is the call graph for this function:

◆ normalize_row()

template<class Device >
KOKKOS_INLINE_FUNCTION void Matrix< Device >::normalize_row ( int  irow,
double  norm 
) const
inline

Normalize row so that it sums to the input value. Assumes still not in CSR!

Parameters
[in]irowis the row index
[in]normis the value to normalize to
Returns
void
Here is the caller graph for this function:

◆ set_value()

template<class Device >
KOKKOS_INLINE_FUNCTION void Matrix< Device >::set_value ( int  i,
int  j,
double  value_in,
SetValueOpt  flag 
) const
inline

Set value of matrix component. Inlined since this will presumably be called a lot in a loop

Parameters
[in]iis the row index
[in]jis the column index
[in]value_inis the value to set
[in]flagis whether to add or replace if there is an existing value in the chosen matrix element
Returns
void
Here is the caller graph for this function:

◆ sort_row()

template<class Device >
KOKKOS_INLINE_FUNCTION void Matrix< Device >::sort_row ( int  i) const
inline

◆ transpose_mult()

template<class Device >
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

Parameters
[in]xis the input vector
[out]yis the result
Returns
void

◆ transpose_mult_csr()

template<class Device >
void Matrix< Device >::transpose_mult_csr ( 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. Matrix is in CSR format

Parameters
[in]xis the input vector
[out]yis the result
Returns
void
Here is the call graph for this function:

◆ transpose_mult_org()

template<class Device >
void Matrix< Device >::transpose_mult_org ( 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. Matrix is in original data format.

Parameters
[in]xis the input vector
[out]yis the result
Returns
void
Here is the call graph for this function:

◆ write()

template<class Device >
void Matrix< Device >::write ( const std::string  stream_name,
const std::string  filename 
) const
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ csr_cidx

template<class Device >
View<int*,CLayout, Device> Matrix< Device >::csr_cidx

columun index - nnz

◆ csr_ridx

template<class Device >
View<int*,CLayout, Device> Matrix< Device >::csr_ridx

row index for CSR - m+1

◆ csr_v

template<class Device >
View<double*,CLayout, Device> Matrix< Device >::csr_v

value of CSR - nnz

◆ eindex

template<class Device >
View<int**,CLayout, Device> Matrix< Device >::eindex

column index - 1-indexed!!

◆ is_csr

template<class Device >
bool Matrix< Device >::is_csr

Whether the matrix is in CSR format.

◆ m

template<class Device >
int Matrix< Device >::m

of rows (size of each column)

◆ n

template<class Device >
int Matrix< Device >::n

of columns (size of each row)

◆ nelement

template<class Device >
View<int*,CLayout, Device> Matrix< Device >::nelement

of non-zero element of each row

◆ nnz

template<class Device >
int Matrix< Device >::nnz

if in CSR format, number of (nonzero) values

◆ value

template<class Device >
View<double**,CLayout, Device> Matrix< Device >::value

matrix value

◆ width

template<class Device >
int Matrix< Device >::width

The documentation for this class was generated from the following files: