imate
C++/CUDA Reference
Loading...
Searching...
No Matches
cuMatrix< DataType > Class Template Referenceabstract

Base class for constant matrices. More...

#include <cu_matrix.h>

Inheritance diagram for cuMatrix< DataType >:
Collaboration diagram for cuMatrix< DataType >:

Public Member Functions

 cuMatrix ()
 Default constructor.
 
 cuMatrix (const FlagType A_is_symmetric_)
 Constructor.
 
virtual ~cuMatrix ()
 Destructor.
 
virtual void copy_host_to_device ()=0
 
DataType get_eigenvalue (const DataType *known_parameters, const DataType known_eigenvalue, const DataType *inquiry_parameters) const
 This virtual function is implemented from its pure virtual function of the base class. In this class, this functio has no use and was only implemented so that this class be able to be instantiated (due to the pure virtual function).
 
virtual FlagType is_identity_matrix () const =0
 
virtual void set_symmetry (const FlagType symmetric)
 Specify whether the matrix is symmetic or non-symmetric.
 
virtual void dot_plus (const DataType *vector, const DataType alpha, DataType *product)=0
 
virtual void transpose_dot_plus (const DataType *vector, const DataType alpha, DataType *product)=0
 
- Public Member Functions inherited from cuLinearOperator< DataType >
 cuLinearOperator ()
 Default constructor.
 
 cuLinearOperator (const int num_gpu_devices_)
 Constructor with setting num_rows and num_columns.
 
virtual ~cuLinearOperator ()
 Destructor.
 
cublasHandle_t get_cublas_handle () const
 This function returns a reference to the cublasHandle_t object. The object will be created, if it is not created already.
 
void set_parameters (DataType *parameters_)
 Sets the scalar parameter this->parameters. Parameter is initialized to NULL. However, before calling dot or transpose_dot functions, the parameters must be set.
 
virtual void dot (const DataType *vector, DataType *product)=0
 
virtual void transpose_dot (const DataType *vector, DataType *product)=0
 
- Public Member Functions inherited from cLinearOperatorBase
 cLinearOperatorBase ()
 Default constructor.
 
 cLinearOperatorBase (const LongIndexType num_rows_, const LongIndexType num_columns_)
 Constructor with setting num_rows and num_columns.
 
virtual ~cLinearOperatorBase ()
 Destructor.
 
LongIndexType get_num_rows () const
 Returns the number of rows of the matrix.
 
LongIndexType get_num_columns () const
 Returns the number of columns of the matrix.
 
IndexType get_num_parameters () const
 Returns the number of parameters of the linear operator.
 
FlagType is_eigenvalue_relation_known () const
 Returns a flag that determines whether a relation between the parameters of the operator and its eigenvalue(s) is known.
 

Protected Attributes

FlagType A_is_symmetric
 
- Protected Attributes inherited from cuLinearOperator< DataType >
int num_gpu_devices
 
bool copied_host_to_device
 
cublasHandle_t * cublas_handle
 
cusparseHandle_t * cusparse_handle
 
DataType * parameters
 
- Protected Attributes inherited from cLinearOperatorBase
const LongIndexType num_rows
 
const LongIndexType num_columns
 
FlagType eigenvalue_relation_known
 
IndexType num_parameters
 

Additional Inherited Members

- Protected Member Functions inherited from cuLinearOperator< DataType >
int query_gpu_devices () const
 Before any numerical computation, this method chechs if any gpu device is available on the machine, or notifies the user if nothing was found.
 
void initialize_cublas_handle ()
 Creates a cublasHandle_t object, if not created already.
 
void initialize_cusparse_handle ()
 Creates a cusparseHandle_t object, if not created already.
 

Detailed Description

template<typename DataType>
class cuMatrix< DataType >

Base class for constant matrices.

The prefix c in this class's name (and its derivatves), stands for the cpp code, intrast to the cu prefix, which stands for the cuda code. Most derived classes have a cuda counterpart.

See also
cuLinearOperator, cuAffineMatrixFunction, cuDenseMatrix, cuCSRMatrix, cuCSCMatrix, cMatrix

Definition at line 44 of file cu_matrix.h.

Constructor & Destructor Documentation

◆ cuMatrix() [1/2]

template<typename DataType >
cuMatrix< DataType >::cuMatrix ( )

Default constructor.

Definition at line 30 of file cu_matrix.cu.

30 :
31
32 // Initializer list
34{
35}
FlagType A_is_symmetric
Definition cu_matrix.h:79

◆ cuMatrix() [2/2]

template<typename DataType >
cuMatrix< DataType >::cuMatrix ( const FlagType  A_is_symmetric_)
explicit

Constructor.

Parameters
[in]A_is_symmetric_If 1, it is assumed that the matrix is symmetric, otherwise set to 0.

Definition at line 49 of file cu_matrix.cu.

49 :
50
51 // Initializer list
52 A_is_symmetric(A_is_symmetric_)
53{
54}

◆ ~cuMatrix()

template<typename DataType >
cuMatrix< DataType >::~cuMatrix ( )
virtual

Destructor.

Definition at line 65 of file cu_matrix.cu.

66{
67}

Member Function Documentation

◆ copy_host_to_device()

template<typename DataType >
virtual void cuMatrix< DataType >::copy_host_to_device ( )
pure virtual

◆ dot_plus()

template<typename DataType >
virtual void cuMatrix< DataType >::dot_plus ( const DataType *  vector,
const DataType  alpha,
DataType *  product 
)
pure virtual

◆ get_eigenvalue()

template<typename DataType >
DataType cuMatrix< DataType >::get_eigenvalue ( const DataType *  known_parameters,
const DataType  known_eigenvalue,
const DataType *  inquiry_parameters 
) const
virtual

This virtual function is implemented from its pure virtual function of the base class. In this class, this functio has no use and was only implemented so that this class be able to be instantiated (due to the pure virtual function).

Parameters
[in]known_parametersA set of parameters of the operator where the corresponding eigenvalue of the parameter is known for.
[in]known_eigenvalueThe known eigenvalue of the operator for the known parameters.
[in]inquiry_parametersA set of inquiry parameters of the operator where the corresponding eigenvalue of the operator is sought.
Returns
The eigenvalue of the operator corresponding the inquiry parameters.

Implements cuLinearOperator< DataType >.

Definition at line 118 of file cu_matrix.cu.

122{
123 assert((false) && "This function should not be called within this class");
124
125 // Void unused variables to avoid compiler warnings (-Wno-unused-parameter)
126 (void) known_parameters;
127 (void) known_eigenvalue;
128 (void) inquiry_parameters;
129
130 return 0;
131}

◆ is_identity_matrix()

template<typename DataType >
virtual FlagType cuMatrix< DataType >::is_identity_matrix ( ) const
pure virtual

◆ set_symmetry()

template<typename DataType >
void cuMatrix< DataType >::set_symmetry ( const FlagType  symmetric)
virtual

Specify whether the matrix is symmetic or non-symmetric.

This function overwrites the symmetry status that has been set by the constructor.

Parameters
[in]symmetricBoolean. If set to 1, the matrix is assumed to be symmetric. Otherwiese non-symmetric.

Implements cLinearOperatorBase.

Definition at line 84 of file cu_matrix.cu.

85{
86 if (symmetric == 1)
87 {
88 this->A_is_symmetric = 1;
89 }
90 else
91 {
92 this->A_is_symmetric = 0;
93 }
94}

◆ transpose_dot_plus()

template<typename DataType >
virtual void cuMatrix< DataType >::transpose_dot_plus ( const DataType *  vector,
const DataType  alpha,
DataType *  product 
)
pure virtual

Member Data Documentation

◆ A_is_symmetric

template<typename DataType >
FlagType cuMatrix< DataType >::A_is_symmetric
protected

Definition at line 79 of file cu_matrix.h.


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