XGC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
 
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 row

More...
 
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

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

Use execution space where matrix views are allocated.

Member Enumeration Documentation

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

Constructor & Destructor Documentation

template<class Device>
Matrix< Device >::Matrix ( )
inline
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)
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

Here is the call graph for this function:

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

Here is the call graph for this function:

Member Function Documentation

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:

template<class Device>
template<class Device2 >
Matrix<Device2> Matrix< Device >::mirror ( ) const
inline
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:

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

Here is the call graph for this function:

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:

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
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:

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:

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:

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
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:

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:

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:

Member Data Documentation

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

columun index - nnz

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

row index for CSR - m+1

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

value of CSR - nnz

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

column index - 1-indexed!!

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

Whether the matrix is in CSR format.

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

of rows (size of each column)

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

of columns (size of each row)

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

of non-zero element of each row

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

if in CSR format, number of (nonzero) values

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

matrix value

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

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