imate
C++/CUDA Reference
cAffineMatrixFunction< DataType > Class Template Reference

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 (const LongIndexType num_rows_, const LongIndexType num_columns_)
 Constructor. More...
 
virtual ~cAffineMatrixFunction ()
 Virtual destructor. More...
 
void set_parameters (DataType *t)
 
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. More...
 
- Public Member Functions inherited from cLinearOperator< DataType >
 cLinearOperator ()
 Default constructor. More...
 
 cLinearOperator (const LongIndexType num_rows_, const LongIndexType num_columns_)
 Constructor with setting num_rows and num_columns. More...
 
virtual ~cLinearOperator ()
 
LongIndexType get_num_rows () const
 
LongIndexType get_num_columns () const
 
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. More...
 
IndexType get_num_parameters () const
 
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. More...
 
virtual void dot (const DataType *vector, DataType *product)=0
 
virtual void transpose_dot (const DataType *vector, DataType *product)=0
 

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

Protected Attributes

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

Detailed Description

template<typename DataType>
class cAffineMatrixFunction< DataType >

Base class for affine matrix functions of one parameter.

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

Definition at line 40 of file c_affine_matrix_function.h.

Constructor & Destructor Documentation

◆ cAffineMatrixFunction()

template<typename DataType >
cAffineMatrixFunction< DataType >::cAffineMatrixFunction ( const LongIndexType  num_rows_,
const LongIndexType  num_columns_ 
)

Constructor.

Definition at line 29 of file c_affine_matrix_function.cpp.

31  :
32 
33  // Base class constructor
34  cLinearOperator<DataType>(num_rows_, num_columns_),
35 
36  B_is_identity(false)
37 {
38  // This class has one parameter that is t in A+tB
39  this->num_parameters = 1;
40 }
Base class for linear operators. This class serves as interface for all derived classes.
IndexType num_parameters

References cLinearOperator< DataType >::num_parameters.

◆ ~cAffineMatrixFunction()

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

Virtual destructor.

Definition at line 51 of file c_affine_matrix_function.cpp.

52 {
53 }

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 136 of file c_affine_matrix_function.cpp.

141 {
142  // Subtracting two vectors with minus scale sign, which is adding.
144  input_vector, vector_size, -scale, output_vector);
145 }
static void subtract_scaled_vector(const DataType *input_vector, const LongIndexType vector_size, const DataType scale, DataType *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 :math:\\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 98 of file c_affine_matrix_function.cpp.

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

◆ set_parameters()

template<typename DataType >
void cAffineMatrixFunction< DataType >::set_parameters ( DataType *  t)

Member Data Documentation

◆ B_is_identity


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