Sequential Quantum Gate Decomposer  v1.9.6
Powerful decomposition of general unitarias into one- and two-qubit gates gates
List of all members | Public Member Functions | Public Attributes | Protected Attributes | Private Attributes | Static Private Attributes
Matrix_T< ComplexType > Class Template Reference

#include <matrix_template.hpp>

Inheritance diagram for Matrix_T< ComplexType >:
Inheritance graph
[legend]

Public Member Functions

void conjugate ()
 Call to conjugate (or un-conjugate) the matrix for CBLAS functions. More...
 
Matrix_T copy () const
 
void copy_to (matrix_base< ComplexType > &target) const
 Copy the current matrix storage into a reusable target matrix. More...
 
void ensure_aligned ()
 
ComplexType * get_data () const
 Call to get the pointer to the stored data. More...
 
bool is_conjugated () const
 Call to get whether the matrix should be conjugated in CBLAS functions or not. More...
 
bool is_transposed () const
 Call to get whether the matrix should be conjugated in CBLAS functions or not. More...
 
bool isnan ()
 
 Matrix_T ()
 
 Matrix_T (ComplexType *data_in, int rows_in, int cols_in)
 
 Matrix_T (ComplexType *data_in, int rows_in, int cols_in, int stride_in)
 
 Matrix_T (int rows_in, int cols_in)
 
 Matrix_T (int rows_in, int cols_in, int stride_in)
 
 Matrix_T (const Matrix_T &other)
 
 Matrix_T (Matrix_T &&other) noexcept
 
bool operator< (const matrix_base< ComplexType > &other) const
 
Matrix_Toperator= (const Matrix_T &other)
 
Matrix_Toperator= (Matrix_T &&other) noexcept
 
ComplexType & operator[] (int idx) const
 Operator [] to access elements in array style (does not check the boundaries of the stored array) More...
 
void print_matrix () const
 
void release_data ()
 Call to release the data stored by the matrix. More...
 
void replace_data (ComplexType *data_in, bool owner_in)
 Call to replace the stored data by an another data array. More...
 
void set_owner (bool owner_in)
 Call to set the current class instance to be (or not to be) the owner of the stored data array. More...
 
int size () const
 Call to get the number of the allocated elements. More...
 
void transpose ()
 Call to transpose (or un-transpose) the matrix for CBLAS functions. More...
 
 ~Matrix_T ()=default
 

Public Attributes

int cols
 The number of columns. More...
 
ComplexType * data
 pointer to the stored data More...
 
int rows
 The number of rows. More...
 
int stride
 The column stride of the array. (The array elements in one row are a_0, a_1, ... a_{cols-1}, 0, 0, 0, 0. The number of zeros is stride-cols) More...
 

Protected Attributes

bool conjugated
 logical variable indicating whether the matrix needs to be conjugated in CBLAS operations More...
 
bool owner
 logical value indicating whether the class instance is the owner of the stored data or not. (If true, the data array is released in the destructor) More...
 
std::atomic< int64_t > * references
 the number of the current references of the present object More...
 
bool transposed
 logical variable indicating whether the matrix needs to be transposed in CBLAS operations More...
 

Private Attributes

char padding_ [padding_size]
 

Static Private Attributes

static constexpr size_t base_size = sizeof(matrix_base<ComplexType>)
 
static constexpr size_t padding_size
 

Detailed Description

template<typename ComplexType>
class Matrix_T< ComplexType >

Definition at line 8 of file matrix_template.hpp.

Constructor & Destructor Documentation

◆ Matrix_T() [1/7]

template<typename ComplexType >
Matrix_T< ComplexType >::Matrix_T ( )

Definition at line 8 of file matrix_template.cpp.

◆ Matrix_T() [2/7]

template<typename ComplexType>
Matrix_T< ComplexType >::Matrix_T ( ComplexType *  data_in,
int  rows_in,
int  cols_in 
)

Definition at line 11 of file matrix_template.cpp.

◆ Matrix_T() [3/7]

template<typename ComplexType>
Matrix_T< ComplexType >::Matrix_T ( ComplexType *  data_in,
int  rows_in,
int  cols_in,
int  stride_in 
)

Definition at line 15 of file matrix_template.cpp.

◆ Matrix_T() [4/7]

template<typename ComplexType>
Matrix_T< ComplexType >::Matrix_T ( int  rows_in,
int  cols_in 
)

Definition at line 19 of file matrix_template.cpp.

◆ Matrix_T() [5/7]

template<typename ComplexType>
Matrix_T< ComplexType >::Matrix_T ( int  rows_in,
int  cols_in,
int  stride_in 
)

Definition at line 23 of file matrix_template.cpp.

◆ Matrix_T() [6/7]

template<typename ComplexType>
Matrix_T< ComplexType >::Matrix_T ( const Matrix_T< ComplexType > &  other)

Definition at line 27 of file matrix_template.cpp.

◆ Matrix_T() [7/7]

template<typename ComplexType>
Matrix_T< ComplexType >::Matrix_T ( Matrix_T< ComplexType > &&  other)
noexcept

Definition at line 31 of file matrix_template.cpp.

◆ ~Matrix_T()

template<typename ComplexType>
Matrix_T< ComplexType >::~Matrix_T ( )
default

Member Function Documentation

◆ conjugate()

void matrix_base< ComplexType >::conjugate ( )
inlineinherited

Call to conjugate (or un-conjugate) the matrix for CBLAS functions.

Definition at line 252 of file matrix_base.hpp.

◆ copy()

template<typename ComplexType >
Matrix_T< ComplexType > Matrix_T< ComplexType >::copy ( ) const

Definition at line 51 of file matrix_template.cpp.

◆ copy_to()

void matrix_base< ComplexType >::copy_to ( matrix_base< ComplexType > &  target) const
inlineinherited

Copy the current matrix storage into a reusable target matrix.

The target is reallocated when dimensions or stride differ; otherwise its existing allocation is reused.

Parameters
targetThe matrix receiving a deep copy of the current storage.

Definition at line 433 of file matrix_base.hpp.

◆ ensure_aligned()

void matrix_base< ComplexType >::ensure_aligned ( )
inlineinherited

Definition at line 448 of file matrix_base.hpp.

◆ get_data()

ComplexType * matrix_base< ComplexType >::get_data ( ) const
inlineinherited

Call to get the pointer to the stored data.

Definition at line 285 of file matrix_base.hpp.

◆ is_conjugated()

bool matrix_base< ComplexType >::is_conjugated ( ) const
inlineinherited

Call to get whether the matrix should be conjugated in CBLAS functions or not.

Returns
Returns with true if the matrix should be conjugated in CBLAS functions or false otherwise.

Definition at line 245 of file matrix_base.hpp.

◆ is_transposed()

bool matrix_base< ComplexType >::is_transposed ( ) const
inlineinherited

Call to get whether the matrix should be conjugated in CBLAS functions or not.

Returns
Returns with true if the matrix should be conjugated in CBLAS functions or false otherwise.

Definition at line 263 of file matrix_base.hpp.

◆ isnan()

template<typename ComplexType >
bool Matrix_T< ComplexType >::isnan ( )

Definition at line 60 of file matrix_template.cpp.

Here is the caller graph for this function:

◆ operator<()

bool matrix_base< ComplexType >::operator< ( const matrix_base< ComplexType > &  other) const
inlineinherited

Definition at line 394 of file matrix_base.hpp.

◆ operator=() [1/2]

template<typename ComplexType >
Matrix_T< ComplexType > & Matrix_T< ComplexType >::operator= ( const Matrix_T< ComplexType > &  other)

Definition at line 35 of file matrix_template.cpp.

◆ operator=() [2/2]

template<typename ComplexType >
Matrix_T< ComplexType > & Matrix_T< ComplexType >::operator= ( Matrix_T< ComplexType > &&  other)
noexcept

Definition at line 43 of file matrix_template.cpp.

◆ operator[]()

ComplexType & matrix_base< ComplexType >::operator[] ( int  idx) const
inlineinherited

Operator [] to access elements in array style (does not check the boundaries of the stored array)

Parameters
idxthe index of the element
Returns
Returns with a reference to the idx-th element.

Definition at line 382 of file matrix_base.hpp.

◆ print_matrix()

template<typename ComplexType >
void Matrix_T< ComplexType >::print_matrix ( ) const

Definition at line 70 of file matrix_template.cpp.

◆ release_data()

void matrix_base< ComplexType >::release_data ( )
inlineinherited

Call to release the data stored by the matrix.

(If the class instance was not the owner of the data, then the data pointer is simply set to NULL pointer.)

Definition at line 311 of file matrix_base.hpp.

◆ replace_data()

void matrix_base< ComplexType >::replace_data ( ComplexType *  data_in,
bool  owner_in 
)
inlineinherited

Call to replace the stored data by an another data array.

If the class was the owner of the original data array, then it is released.

Parameters
data_inThe data array to be set as a new storage.
owner_inSet true to set the current class instance to be the owner of the data array, or false otherwise.

Definition at line 297 of file matrix_base.hpp.

◆ set_owner()

void matrix_base< ComplexType >::set_owner ( bool  owner_in)
inlineinherited

Call to set the current class instance to be (or not to be) the owner of the stored data array.

Parameters
owner_inSet true to set the current class instance to be the owner of the data array, or false otherwise.

Definition at line 337 of file matrix_base.hpp.

◆ size()

int matrix_base< ComplexType >::size ( ) const
inlineinherited

Call to get the number of the allocated elements.

Returns
Returns with the number of the allocated elements (rows*cols)

Definition at line 461 of file matrix_base.hpp.

◆ transpose()

void matrix_base< ComplexType >::transpose ( )
inlineinherited

Call to transpose (or un-transpose) the matrix for CBLAS functions.

Definition at line 273 of file matrix_base.hpp.

Member Data Documentation

◆ base_size

template<typename ComplexType>
constexpr size_t Matrix_T< ComplexType >::base_size = sizeof(matrix_base<ComplexType>)
staticprivate

Definition at line 10 of file matrix_template.hpp.

◆ cols

int matrix_base< ComplexType >::cols
inherited

The number of columns.

Definition at line 44 of file matrix_base.hpp.

◆ conjugated

bool matrix_base< ComplexType >::conjugated
protectedinherited

logical variable indicating whether the matrix needs to be conjugated in CBLAS operations

Definition at line 53 of file matrix_base.hpp.

◆ data

ComplexType * matrix_base< ComplexType >::data
inherited

pointer to the stored data

Definition at line 48 of file matrix_base.hpp.

◆ owner

bool matrix_base< ComplexType >::owner
protectedinherited

logical value indicating whether the class instance is the owner of the stored data or not. (If true, the data array is released in the destructor)

Definition at line 57 of file matrix_base.hpp.

◆ padding_

template<typename ComplexType>
char Matrix_T< ComplexType >::padding_[padding_size]
private

Definition at line 14 of file matrix_template.hpp.

◆ padding_size

template<typename ComplexType>
constexpr size_t Matrix_T< ComplexType >::padding_size
staticprivate
Initial value:

Definition at line 11 of file matrix_template.hpp.

◆ references

std::atomic<int64_t>* matrix_base< ComplexType >::references
protectedinherited

the number of the current references of the present object

Definition at line 59 of file matrix_base.hpp.

◆ rows

int matrix_base< ComplexType >::rows
inherited

The number of rows.

Definition at line 42 of file matrix_base.hpp.

◆ stride

int matrix_base< ComplexType >::stride
inherited

The column stride of the array. (The array elements in one row are a_0, a_1, ... a_{cols-1}, 0, 0, 0, 0. The number of zeros is stride-cols)

Definition at line 46 of file matrix_base.hpp.

◆ transposed

bool matrix_base< ComplexType >::transposed
protectedinherited

logical variable indicating whether the matrix needs to be transposed in CBLAS operations

Definition at line 55 of file matrix_base.hpp.


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