Sequential Quantum Gate Decomposer  v1.9.6
Powerful decomposition of general unitarias into one- and two-qubit gates gates
matrix_float.cpp
Go to the documentation of this file.
1 #include "matrix_float.h"
2 #include "matrix.h"
3 
9  Matrix ret(rows, cols, stride);
10  for (int row = 0; row < rows; row++) {
11  for (int col = 0; col < cols; col++) {
12  int idx = row * stride + col;
13  ret.data[idx].real = static_cast<double>(data[idx].real);
14  ret.data[idx].imag = static_cast<double>(data[idx].imag);
15  }
16  }
17  if (is_conjugated()) ret.conjugate();
18  if (is_transposed()) ret.transpose();
19  return ret;
20 }
Header file of single-precision complex array storage with automatic and thread safe reference counti...
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)
Definition: matrix_base.hpp:46
Matrix to_float64() const
Convert to double precision.
Definition: matrix_float.cpp:8
float real
real part
Definition: QGDTypes.h:47
scalar * data
pointer to the stored data
Definition: matrix_base.hpp:48
float imag
imaginary part
Definition: QGDTypes.h:48
int rows
The number of rows.
Definition: matrix_base.hpp:42
int cols
The number of columns.
Definition: matrix_base.hpp:44
Header file of complex array storage array with automatic and thread safe reference counting...
Double-precision complex matrix (float64).
Definition: matrix.h:38
void transpose()
Call to transpose (or un-transpose) the matrix for CBLAS functions.
bool is_conjugated() const
Call to get whether the matrix should be conjugated in CBLAS functions or not.
double real
the real part of a complex number
Definition: QGDTypes.h:40
void conjugate()
Call to conjugate (or un-conjugate) the matrix for CBLAS functions.
bool is_transposed() const
Call to get whether the matrix should be conjugated in CBLAS functions or not.
double imag
the imaginary part of a complex number
Definition: QGDTypes.h:42