Quantum Gate Decomposer  v1.3
Powerful decomposition of almost any unitary into U3 and CNOT gates
matrix.cpp
Go to the documentation of this file.
1 #include "qgd/matrix.h"
2 #include <cstring>
3 #include <iostream>
4 #include "tbb/tbb.h"
5 
6 
12 
13 }
14 
22 Matrix::Matrix( QGD_Complex16* data_in, size_t rows_in, size_t cols_in) : matrix_base<QGD_Complex16>(data_in, rows_in, cols_in) {
23 
24 }
25 
26 
33 Matrix::Matrix( size_t rows_in, size_t cols_in) : matrix_base<QGD_Complex16>(rows_in, cols_in) {
34 
35 
36 }
37 
38 
44 
45 }
46 
47 
48 
53 Matrix
55 
56  Matrix ret = Matrix(rows, cols);
57 
58  // logical variable indicating whether the matrix needs to be conjugated in CBLAS operations
59  ret.conjugated = conjugated;
60  // logical variable indicating whether the matrix needs to be transposed in CBLAS operations
61  ret.transposed = transposed;
62  // 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)
63  ret.owner = true;
64 
65  memcpy( ret.data, data, rows*cols*sizeof(QGD_Complex16));
66 
67  return ret;
68 
69 }
70 
71 
72 
73 
Matrix()
Default constructor of the class.
Definition: matrix.cpp:11
size_t rows
The number of rows.
Definition: matrix_base.h:23
bool owner
logical value indicating whether the class instance is the owner of the stored data or not....
Definition: matrix_base.h:36
scalar * data
pointer to the stored data
Definition: matrix_base.h:27
bool transposed
logical variable indicating whether the matrix needs to be transposed in CBLAS operations
Definition: matrix_base.h:34
bool conjugated
logical variable indicating whether the matrix needs to be conjugated in CBLAS operations
Definition: matrix_base.h:32
Base Class to store data of arrays and its properties.
Definition: matrix_base.h:19
size_t cols
The number of columns.
Definition: matrix_base.h:25
Structure type representing complex numbers in the QGD package.
Definition: QGDTypes.h:39
Class to store data of complex arrays and its properties.
Definition: matrix.h:12
Matrix copy()
Call to create a copy of the matrix.
Definition: matrix.cpp:54