Quantum Gate Decomposer  v1.3
Powerful decomposition of almost any unitary into U3 and CNOT gates
List of all members | Public Member Functions | Public Attributes | Protected Attributes | Private Attributes
Matrix Class Reference

Class to store data of complex arrays and its properties. More...

#include <matrix.h>

Inheritance diagram for Matrix:
Inheritance graph
[legend]

Public Member Functions

void conjugate ()
 Call to conjugate (or un-conjugate) the matrix for CBLAS functions. More...
 
Matrix copy ()
 Call to create a copy of the matrix. More...
 
QGD_Complex16get_data ()
 Call to get the pointer to the stored data. More...
 
bool is_conjugated ()
 Call to get whether the matrix should be conjugated in CBLAS functions or not. More...
 
bool is_transposed ()
 Call to get whether the matrix should be conjugated in CBLAS functions or not. More...
 
 Matrix ()
 Default constructor of the class. More...
 
 Matrix (QGD_Complex16 *data_in, size_t rows_in, size_t cols_in)
 Constructor of the class. More...
 
 Matrix (size_t rows_in, size_t cols_in)
 Constructor of the class. More...
 
 Matrix (const Matrix &in)
 Copy constructor of the class. More...
 
QGD_Complex16operator[] (size_t idx)
 Operator [] to access elements in array style (does not check the boundaries of the stored array) More...
 
void print_matrix ()
 Call to prints the stored matrix on the standard output. More...
 
void release_data ()
 Call to release the data stored by the matrix. More...
 
void replace_data (QGD_Complex16 *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...
 
size_t size ()
 Call to get the number of the allocated elements. More...
 
void transpose ()
 Call to transpose (or un-transpose) the matrix for CBLAS functions. More...
 

Public Attributes

size_t cols
 The number of columns. More...
 
QGD_Complex16data
 pointer to the stored data More...
 
size_t rows
 The number of rows. 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...
 
tbb::spin_mutex * reference_mutex
 mutual exclusion to count the references for class instances referring to the same data. More...
 
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 [CACHELINE-48]
 padding class object to cache line borders More...
 

Detailed Description

Class to store data of complex arrays and its properties.

Compatible with the Picasso numpy interface.

Definition at line 12 of file matrix.h.

Constructor & Destructor Documentation

◆ Matrix() [1/4]

Matrix::Matrix ( )

Default constructor of the class.

Returns
Returns with the instance of the class.

Definition at line 11 of file matrix.cpp.

Here is the caller graph for this function:

◆ Matrix() [2/4]

Matrix::Matrix ( QGD_Complex16 data_in,
size_t  rows_in,
size_t  cols_in 
)

Constructor of the class.

By default the created class instance would not be owner of the stored data.

Parameters
data_inThe pointer pointing to the data
rows_inThe number of rows in the stored matrix
cols_inThe number of columns in the stored matrix
Returns
Returns with the instance of the class.

Definition at line 22 of file matrix.cpp.

◆ Matrix() [3/4]

Matrix::Matrix ( size_t  rows_in,
size_t  cols_in 
)

Constructor of the class.

Allocates data for matrix rows_in times cols_in. By default the created instance would be the owner of the stored data.

Parameters
rows_inThe number of rows in the stored matrix
cols_inThe number of columns in the stored matrix
Returns
Returns with the instance of the class.

Definition at line 33 of file matrix.cpp.

◆ Matrix() [4/4]

Matrix::Matrix ( const Matrix in)

Copy constructor of the class.

The new instance shares the stored memory with the input matrix. (Needed for TBB calls)

Parameters
Aninstance of class matrix to be copied.

Definition at line 43 of file matrix.cpp.

Member Function Documentation

◆ conjugate()

void matrix_base< QGD_Complex16 >::conjugate ( )
inlineinherited

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

Definition at line 188 of file matrix_base.h.

◆ copy()

Matrix Matrix::copy ( )

Call to create a copy of the matrix.

Returns
Returns with the instance of the class.

Definition at line 54 of file matrix.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_data()

QGD_Complex16 * matrix_base< QGD_Complex16 >::get_data ( )
inlineinherited

Call to get the pointer to the stored data.

Definition at line 221 of file matrix_base.h.

◆ is_conjugated()

bool matrix_base< QGD_Complex16 >::is_conjugated ( )
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 181 of file matrix_base.h.

◆ is_transposed()

bool matrix_base< QGD_Complex16 >::is_transposed ( )
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 199 of file matrix_base.h.

◆ operator[]()

QGD_Complex16 & matrix_base< QGD_Complex16 >::operator[] ( size_t  idx)
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 340 of file matrix_base.h.

◆ print_matrix()

void matrix_base< QGD_Complex16 >::print_matrix ( )
inlineinherited

Call to prints the stored matrix on the standard output.

Definition at line 384 of file matrix_base.h.

◆ release_data()

void matrix_base< QGD_Complex16 >::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 252 of file matrix_base.h.

◆ replace_data()

void matrix_base< QGD_Complex16 >::replace_data ( QGD_Complex16 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 233 of file matrix_base.h.

◆ set_owner()

void matrix_base< QGD_Complex16 >::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 295 of file matrix_base.h.

◆ size()

size_t matrix_base< QGD_Complex16 >::size ( )
inlineinherited

Call to get the number of the allocated elements.

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

Definition at line 374 of file matrix_base.h.

◆ transpose()

void matrix_base< QGD_Complex16 >::transpose ( )
inlineinherited

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

Definition at line 209 of file matrix_base.h.

Member Data Documentation

◆ cols

size_t matrix_base< QGD_Complex16 >::cols
inherited

The number of columns.

Definition at line 25 of file matrix_base.h.

◆ conjugated

bool matrix_base< QGD_Complex16 >::conjugated
protectedinherited

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

Definition at line 32 of file matrix_base.h.

◆ data

QGD_Complex16 * matrix_base< QGD_Complex16 >::data
inherited

pointer to the stored data

Definition at line 27 of file matrix_base.h.

◆ owner

bool matrix_base< QGD_Complex16 >::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 36 of file matrix_base.h.

◆ padding

char Matrix::padding[CACHELINE-48]
private

padding class object to cache line borders

Definition at line 15 of file matrix.h.

◆ reference_mutex

tbb::spin_mutex* matrix_base< QGD_Complex16 >::reference_mutex
protectedinherited

mutual exclusion to count the references for class instances referring to the same data.

Definition at line 38 of file matrix_base.h.

◆ references

int64_t* matrix_base< QGD_Complex16 >::references
protectedinherited

the number of the current references of the present object

Definition at line 40 of file matrix_base.h.

◆ rows

size_t matrix_base< QGD_Complex16 >::rows
inherited

The number of rows.

Definition at line 23 of file matrix_base.h.

◆ transposed

bool matrix_base< QGD_Complex16 >::transposed
protectedinherited

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

Definition at line 34 of file matrix_base.h.


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