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

Base class for affine matrix functions of one parameter. More...

#include <c_affine_matrix_function.h>

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

Public Member Functions

 cAffineMatrixFunction ()
 Constructor.
 
virtual ~cAffineMatrixFunction ()
 Virtual destructor.
 
virtual void set_symmetry (FlagType symmetric)=0
 
DataType get_eigenvalue (const DataType *known_parameters, const DataType known_eigenvalue, const DataType *inquiry_parameters) const
 This function defines an analytic relationship between a given set of parameters and the corresponding eigenvalue of the operator. Namely, given a set of parameters and a known eigenvalue of the operator for that specific set of parameters, this function obtains the eigenvalue of the operator for an other given set of parameters.
 
- Public Member Functions inherited from cLinearOperator< DataType >
 cLinearOperator ()
 Default constructor.
 
virtual ~cLinearOperator ()
 Destructor.
 
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 Member Functions

void _add_scaled_vector (const DataType *input_vector, const LongIndexType vector_size, const DataType scale, DataType *output_vector) const
 Performs the operation \( \boldsymbol{c} = \boldsymbol{c} + \alpha \boldsymbol{b} \), where \( \boldsymbol{b} \) is an input vector scaled by \( \alpha \) and \( \boldsymbol{c} \) it the output vector.
 

Protected Attributes

bool B_is_identity
 
- Protected Attributes inherited from cLinearOperator< DataType >
DataType * parameters
 
- Protected Attributes inherited from cLinearOperatorBase
const LongIndexType num_rows
 
const LongIndexType num_columns
 
FlagType eigenvalue_relation_known
 
IndexType num_parameters
 

Detailed Description

template<typename DataType>
class cAffineMatrixFunction< DataType >

Base class for affine matrix functions of one parameter.

The cAffineMatrixFunction holds a two two-dimensional dense matrices \( \mathbf{A} \) and \( \mathbf{B} \). The affine matrix function with the parameter \( t \) is defined by:

\[ t \mapsto \mathbf{A} + t \mathbf{B}. \]

This operoator can perofrom matrix-vector product and transposed matrix-vector product.

Note
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
cMatrix, cDenseAffineMatricFunction, cCSRAffineMatrixFunction, cCSCAffineMatrixFunction, cLinearOperator, cuAffineMatrixFunction

Definition at line 55 of file c_affine_matrix_function.h.

Constructor & Destructor Documentation

◆ cAffineMatrixFunction()

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

Constructor.

Definition at line 29 of file c_affine_matrix_function.cpp.

29 :
30 B_is_identity(false)
31{
32 // This class has one parameter that is t in A+tB
33 this->num_parameters = 1;
34}

References cLinearOperatorBase::num_parameters.

◆ ~cAffineMatrixFunction()

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

Virtual destructor.

Definition at line 45 of file c_affine_matrix_function.cpp.

46{
47}

Member Function Documentation

◆ _add_scaled_vector()

template<typename DataType >
void cAffineMatrixFunction< DataType >::_add_scaled_vector ( const DataType *  input_vector,
const LongIndexType  vector_size,
const DataType  scale,
DataType *  output_vector 
) const
protected

Performs the operation \( \boldsymbol{c} = \boldsymbol{c} + \alpha \boldsymbol{b} \), where \( \boldsymbol{b} \) is an input vector scaled by \( \alpha \) and \( \boldsymbol{c} \) it the output vector.

Parameters
[in]input_vectorThe input 1D vector of size vector_size.
[in]vector_sizeThe size of both input_vector and output_vector
[in]scaleThe scalar scale at whch the input vector is multiplied by.
[in,out]output_vectorThe output 1D vector of size vector_size. This array will be written in-place.

Definition at line 130 of file c_affine_matrix_function.cpp.

135{
136 // Subtracting two vectors with minus scale sign, which is adding.
138 input_vector, vector_size, -scale, output_vector);
139}
static void subtract_scaled_vector(const DataType *RESTRICT input_vector, const LongIndexType vector_size, const DataType scale, DataType *RESTRICT output_vector)
Subtracts the scaled input vector from the output vector.

References cVectorOperations< DataType >::subtract_scaled_vector().

Here is the call graph for this function:

◆ get_eigenvalue()

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

This function defines an analytic relationship between a given set of parameters and the corresponding eigenvalue of the operator. Namely, given a set of parameters and a known eigenvalue of the operator for that specific set of parameters, this function obtains the eigenvalue of the operator for an other given set of parameters.

A relation between eigenvalue(s) and the set of parameters can be made when the matrix \( \mathbf{B} \) is equal to the identity matrix \( \mathbf{I} \), and corresponding linear operator is as follows:

\[ \mathbf{A}(t) = \mathbf{A} + t \mathbf{I} \]

Then, the eigenvalues \( \lambda \) of the operator is

\[ \lambda(\mathbf{A}(t)) = \lambda(\mathbf{A}) + t. \]

Thus, by knowing the eigenvalue \( \lambda_{t_0} \) at the known parameter \( t_0 \), the eigenvalue \( \lambda_{t} \) at the inquiry parameter \( t \) can be obtained.

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 cLinearOperator< DataType >.

Definition at line 92 of file c_affine_matrix_function.cpp.

96{
97 assert((this->eigenvalue_relation_known == 1) && \
98 "An eigenvalue relation is not known. This function should be "
99 "called only when the matrix B is a scalar multiple of the "
100 "identity matrix");
101
102 // Shift the eigenvalue by the parameter
103 DataType inquiry_eigenvalue = \
104 known_eigenvalue - known_parameters[0] + inquiry_parameters[0];
105
106 return inquiry_eigenvalue;
107}

◆ set_symmetry()

template<typename DataType >
virtual void cAffineMatrixFunction< DataType >::set_symmetry ( FlagType  symmetric)
pure virtual

Member Data Documentation

◆ B_is_identity


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