Skip to content

Class Matrix

ClassList > Matrix

Represents a matrix and provides matrix operations.

  • #include <Matrix.hpp>

Public Attributes

Type Name
Comm & comm

Public Functions

Type Name
Matrix (Comm & comm, unsigned int cols, unsigned int rows, unsigned int block_size, bool global_sizes=false, bool QoI=false, const MatvecPrecisionConfig & p_config=MatvecPrecisionConfig())
Constructs a Matrix object.
Matrix (Comm & comm, std::string path, std::string aux_path="", bool QoI=false, const MatvecPrecisionConfig & p_config=MatvecPrecisionConfig())
Constructs a Matrix object from a meta file.
unsigned int get_block_size ()
int get_checksum ()
ComplexD * get_col_vec_freq ()
ComplexF * get_col_vec_freq_F ()
ComplexD * get_col_vec_freq_TOSI ()
ComplexF * get_col_vec_freq_TOSI_F ()
double * get_col_vec_pad ()
float * get_col_vec_pad_F ()
double * get_col_vec_unpad ()
float * get_col_vec_unpad_F ()
cufftHandle get_forward_plan ()
cufftHandle get_forward_plan_conj ()
unsigned int get_glob_num_cols ()
unsigned int get_glob_num_rows ()
cufftHandle get_inverse_plan ()
cufftHandle get_inverse_plan_conj ()
ComplexD * get_mat_freq_TOSI ()
ComplexF * get_mat_freq_TOSI_F ()
ComplexD * get_mat_freq_TOSI_aux ()
ComplexF * get_mat_freq_TOSI_aux_F ()
unsigned int get_num_cols ()
unsigned int get_num_rows ()
unsigned int get_padded_size ()
MatvecPrecisionConfig get_precision_config ()
double * get_res_pad ()
ComplexD * get_row_vec_freq ()
ComplexF * get_row_vec_freq_F ()
ComplexD * get_row_vec_freq_TOSI ()
ComplexF * get_row_vec_freq_TOSI_F ()
double * get_row_vec_pad ()
float * get_row_vec_pad_F ()
double * get_row_vec_unpad ()
float * get_row_vec_unpad_F ()
Vector get_vec (std::string input_or_output)
Get an input or output vector compatible with the matrix.
bool has_aux_mat ()
void init_mat_doubles (bool aux_mat=false)
Initializes the matrix with double precision floating point numbers (used for precision testing).
void init_mat_from_file (std::string dirname, bool aux_mat=false)
Initializes the matrix from a file.
void init_mat_ones (bool aux_mat=false)
Initializes the matrix with ones.
bool is_initialized ()
bool is_p2q_mat ()
void matvec (Vector & x, Vector & y, bool use_aux_mat=false, bool full=false)
Performs matrix-vector multiplication.
void transpose_matvec (Vector & x, Vector & y, bool use_aux_mat=false, bool full=false)
Performs conjugate transpose matrix-vector multiplication.
~Matrix ()
Destroys the Matrix object. Frees the memory allocated for the matrix data.

Public Attributes Documentation

variable comm

Comm& Matrix::comm;

Reference to the communication object.


Public Functions Documentation

function Matrix [1/2]

Constructs a Matrix object.

Matrix::Matrix (
    Comm & comm,
    unsigned int cols,
    unsigned int rows,
    unsigned int block_size,
    bool global_sizes=false,
    bool QoI=false,
    const MatvecPrecisionConfig & p_config=MatvecPrecisionConfig()
) 

Parameters:

  • comm The communication object (passed as reference).
  • cols The number of columns in the matrix (local or global based on value of global_sizes).
  • rows The number of rows in the matrix (local or global based on value of global_sizes).
  • block_size The block size of the matrix without padding.
  • global_sizes Flag indicating whether the sizes are global.
  • QoI Flag indicating if the matrix is the p2q map instead of the p2o map.
  • p_config The precision configuration for matrix-vector operations.

function Matrix [2/2]

Constructs a Matrix object from a meta file.

Matrix::Matrix (
    Comm & comm,
    std::string path,
    std::string aux_path="",
    bool QoI=false,
    const MatvecPrecisionConfig & p_config=MatvecPrecisionConfig()
) 

Parameters:

  • comm The communication object (passed as reference).
  • path Path to the directory containing the matrix data.
  • aux_path Path to the directory containing the auxiliary matrix data. Cannot be nonempty if path is empty.
  • QoI Flag indicating if the matrix is the p2q map instead of the p2o map.
  • p_config The precision configuration for matrix-vector operations.

function get_block_size

inline unsigned int Matrix::get_block_size () 

Returns the unpadded block size of the matrix.


function get_checksum

inline int Matrix::get_checksum () 

Returns the checksum for the matrix.


function get_col_vec_freq

inline ComplexD * Matrix::get_col_vec_freq () 

Returns the column vector frequency.


function get_col_vec_freq_F

inline ComplexF * Matrix::get_col_vec_freq_F () 

Returns the column vector frequency (float).


function get_col_vec_freq_TOSI

inline ComplexD * Matrix::get_col_vec_freq_TOSI () 

Returns the column vector frequency in TOSI format.


function get_col_vec_freq_TOSI_F

inline ComplexF * Matrix::get_col_vec_freq_TOSI_F () 

Returns the column vector frequency in TOSI format (float).


function get_col_vec_pad

inline double * Matrix::get_col_vec_pad () 

Returns the padded column vector.


function get_col_vec_pad_F

inline float * Matrix::get_col_vec_pad_F () 

Returns the padded column vector (float).


function get_col_vec_unpad

inline double * Matrix::get_col_vec_unpad () 

Returns the unpadded column vector.


function get_col_vec_unpad_F

inline float * Matrix::get_col_vec_unpad_F () 

Returns the unpadded column vector (float).


function get_forward_plan

inline cufftHandle Matrix::get_forward_plan () 

Returns the forward plan for FFT.


function get_forward_plan_conj

inline cufftHandle Matrix::get_forward_plan_conj () 

Returns the forward plan for conjugate FFT.


function get_glob_num_cols

inline unsigned int Matrix::get_glob_num_cols () 

Returns the global number of columns in the matrix.


function get_glob_num_rows

inline unsigned int Matrix::get_glob_num_rows () 

Returns the global number of rows in the matrix.


function get_inverse_plan

inline cufftHandle Matrix::get_inverse_plan () 

Returns the inverse plan for FFT.


function get_inverse_plan_conj

inline cufftHandle Matrix::get_inverse_plan_conj () 

Returns the inverse plan for conjugate FFT.


function get_mat_freq_TOSI

inline ComplexD * Matrix::get_mat_freq_TOSI () 

Returns the matrix frequency in TOSI format.


function get_mat_freq_TOSI_F

inline ComplexF * Matrix::get_mat_freq_TOSI_F () 

Returns the matrix frequency in TOSI format (float).


function get_mat_freq_TOSI_aux

inline ComplexD * Matrix::get_mat_freq_TOSI_aux () 

Returns the other matrix frequency in TOSI format.


function get_mat_freq_TOSI_aux_F

inline ComplexF * Matrix::get_mat_freq_TOSI_aux_F () 

Returns the other matrix frequency in TOSI format (float).


function get_num_cols

inline unsigned int Matrix::get_num_cols () 

Returns the number of columns in the matrix.


function get_num_rows

inline unsigned int Matrix::get_num_rows () 

Returns the number of rows in the matrix.


function get_padded_size

inline unsigned int Matrix::get_padded_size () 

Returns the padded block size of the matrix.


function get_precision_config

inline MatvecPrecisionConfig Matrix::get_precision_config () 

Returns the precision configuration for matrix-vector operations.


function get_res_pad

inline double * Matrix::get_res_pad () 

Returns the padded result vector.


function get_row_vec_freq

inline ComplexD * Matrix::get_row_vec_freq () 

Returns the row vector frequency.


function get_row_vec_freq_F

inline ComplexF * Matrix::get_row_vec_freq_F () 

Returns the row vector frequency (float).


function get_row_vec_freq_TOSI

inline ComplexD * Matrix::get_row_vec_freq_TOSI () 

Returns the row vector frequency in TOSI format.


function get_row_vec_freq_TOSI_F

inline ComplexF * Matrix::get_row_vec_freq_TOSI_F () 

Returns the row vector frequency in TOSI format (float).


function get_row_vec_pad

inline double * Matrix::get_row_vec_pad () 

Returns the padded row vector.


function get_row_vec_pad_F

inline float * Matrix::get_row_vec_pad_F () 

Returns the padded row vector (float).


function get_row_vec_unpad

inline double * Matrix::get_row_vec_unpad () 

Returns the unpadded row vector.


function get_row_vec_unpad_F

inline float * Matrix::get_row_vec_unpad_F () 

Returns the unpadded row vector (float).


function get_vec

Get an input or output vector compatible with the matrix.

Vector Matrix::get_vec (
    std::string input_or_output
) 

Parameters:

  • input_or_output The string "input" or "output". In the expression y = Fx, y is the output, and x is the input. x will have size glob_num_cols * block_size, and y will have size glob_num_rows * block_size.

Returns:

The input or output vector.


function has_aux_mat

inline bool Matrix::has_aux_mat () 

Returns true if the other matrix frequency in TOSI format exists (and is initialized), false otherwise.


function init_mat_doubles

Initializes the matrix with double precision floating point numbers (used for precision testing).

void Matrix::init_mat_doubles (
    bool aux_mat=false
) 

Parameters:

  • aux_mat Flag indicating if the matrix to be initialized is the auxiliary matrix. The

function init_mat_from_file

Initializes the matrix from a file.

void Matrix::init_mat_from_file (
    std::string dirname,
    bool aux_mat=false
) 

Parameters:

  • dirname The path to the directory containing the adjoint vectors.
  • aux_mat Flag indicating if the matrix to be initialized is the auxiliary matrix. The primary matrix must be initialized first.

function init_mat_ones

Initializes the matrix with ones.

void Matrix::init_mat_ones (
    bool aux_mat=false
) 

Parameters:

  • aux_mat Flag indicating if the matrix to be initialized is the auxiliary matrix. The primary matrix must be initialized first.

function is_initialized

inline bool Matrix::is_initialized () 

Returns true if the matrix is initialized, false otherwise.


function is_p2q_mat

inline bool Matrix::is_p2q_mat () 

Returns true if the matrix is the p2q map, false otherwise.


function matvec

Performs matrix-vector multiplication.

void Matrix::matvec (
    Vector & x,
    Vector & y,
    bool use_aux_mat=false,
    bool full=false
) 

Parameters:

  • x The input vector.
  • y The output vector.
  • use_aux_mat Flag indicating if the auxiliary matrix G is used for the matvec.
  • full Flag indicating if the matvec is with the full matrix F*F or just F.

function transpose_matvec

Performs conjugate transpose matrix-vector multiplication.

void Matrix::transpose_matvec (
    Vector & x,
    Vector & y,
    bool use_aux_mat=false,
    bool full=false
) 

Parameters:

  • x The input vector.
  • y The output vector.
  • use_aux_mat Flag indicating if the auxiliary matrix G is used for the matvec.
  • full Flag indicating if the matvec is with the full matrix FF* or just F*.

function ~Matrix

Destroys the Matrix object. Frees the memory allocated for the matrix data.

Matrix::~Matrix () 



The documentation for this class was generated from the following file src/Matrix.hpp