Sequential Quantum Gate Decomposer
v1.9.3
Powerful decomposition of general unitarias into one- and two-qubit gates gates
|
Provides commonly used functions and wrappers to CBLAS functions. More...
Go to the source code of this file.
Functions | |
double | activation_function (double Phi, int limit) |
????? More... | |
void | add_unique_elelement (std::vector< int > &involved_qbits, int qbit) |
Add an integer to a vector of integers if the integer is not already an element of the vector. More... | |
double | arg (const QGD_Complex16 &a) |
Call to retrieve the phase of a complex number. More... | |
void | conjugate_gradient (Matrix_real A, Matrix_real b, Matrix_real &x0, double tol) |
Matrix | create_identity (int matrix_size) |
Call to create an identity matrix. More... | |
QGD_Complex16 | mult (QGD_Complex16 &a, QGD_Complex16 &b) |
Call to calculate the product of two complex scalars. More... | |
QGD_Complex16 | mult (double a, QGD_Complex16 b) |
calculate the product of a real scalar and a complex scalar More... | |
void | mult (QGD_Complex16 a, Matrix &b) |
Multiply the elements of matrix b by a scalar a. More... | |
Matrix | mult (Matrix_sparse a, Matrix &b) |
Multiply the elements of a sparse matrix a and a dense vector b. More... | |
int | Power_of_2 (int n) |
Calculates the n-th power of 2. More... | |
void * | qgd_calloc (int element_num, int size, int alignment) |
custom defined memory allocation function. More... | |
void | qgd_free (void *ptr) |
custom defined memory release function. More... | |
void * | qgd_realloc (void *aligned_ptr, int element_num, int size, int alignment) |
custom defined memory reallocation function. More... | |
Matrix | reduce_zgemm (std::vector< Matrix > &mtxs) |
Calculate the product of several square shaped complex matrices stored in a vector. More... | |
void | subtract_diag (Matrix &mtx, QGD_Complex16 scalar) |
Call to subtract a scalar from the diagonal of a complex matrix. More... | |
Provides commonly used functions and wrappers to CBLAS functions.
Definition in file common.cpp.
double activation_function | ( | double | Phi, |
int | limit | ||
) |
Add an integer to a vector of integers if the integer is not already an element of the vector.
The ascending order is kept during the process.
involved_qbits | The vector of integer to be updated by the new integer. The result is returned via this vector. |
qbit | The integer to be added to the vector |
Definition at line 131 of file common.cpp.
double arg | ( | const QGD_Complex16 & | a | ) |
Call to retrieve the phase of a complex number.
a | A complex numberr. |
Definition at line 354 of file common.cpp.
void conjugate_gradient | ( | Matrix_real | A, |
Matrix_real | b, | ||
Matrix_real & | x0, | ||
double | tol | ||
) |
Call to create an identity matrix.
matrix_size | The number of rows in the resulted identity matrix |
Definition at line 164 of file common.cpp.
QGD_Complex16 mult | ( | QGD_Complex16 & | a, |
QGD_Complex16 & | b | ||
) |
Call to calculate the product of two complex scalars.
a | The firs scalar |
b | The second scalar |
Definition at line 259 of file common.cpp.
QGD_Complex16 mult | ( | double | a, |
QGD_Complex16 | b | ||
) |
calculate the product of a real scalar and a complex scalar
a | The real scalar. |
b | The complex scalar. |
Definition at line 275 of file common.cpp.
void mult | ( | QGD_Complex16 | a, |
Matrix & | b | ||
) |
Multiply the elements of matrix b by a scalar a.
a | A complex scalar. |
b | A complex matrix. |
Definition at line 292 of file common.cpp.
Matrix mult | ( | Matrix_sparse | a, |
Matrix & | b | ||
) |
Multiply the elements of a sparse matrix a and a dense vector b.
a | A complex sparse matrix in CSR format. |
b | A complex dense vector. |
Definition at line 313 of file common.cpp.
Calculates the n-th power of 2.
n | An natural number |
Definition at line 117 of file common.cpp.
custom defined memory allocation function.
Memory allocated with aligned realloc MUST be freed using qgd_free.
element_num | The number of elements in the array to be allocated. |
size | A size of one element (such as sizeof(double) ) |
alignment | The number of bytes to which memory must be aligned. This value must be <= 255. |
Definition at line 74 of file common.cpp.
void qgd_free | ( | void * | ptr | ) |
custom defined memory release function.
Definition at line 102 of file common.cpp.
custom defined memory reallocation function.
Memory allocated with aligned realloc MUST be freed using qgd_free. The reallocation is done by either: a) expanding or contracting the existing area pointed to by aligned_ptr, if possible. The contents of the area remain unchanged up to the lesser of the new and old sizes. If the area is expanded, the contents of the new part of the array is set to zero. b) allocating a new memory block of size new_size bytes, copying memory area with size equal the lesser of the new and the old sizes, and freeing the old block.
aligned_ptr | The aligned pointer created by qgd_calloc |
element_num | The number of elements in the array to be allocated. |
size | A size of one element (such as sizeof(double) ) |
alignment | The number of bytes to which memory must be aligned. This value must be <= 255. |
Definition at line 90 of file common.cpp.
Calculate the product of several square shaped complex matrices stored in a vector.
mtxs | The vector of matrices. |
matrix_size | The number rows in the matrices |
Definition at line 189 of file common.cpp.
void subtract_diag | ( | Matrix & | mtx, |
QGD_Complex16 | scalar | ||
) |
Call to subtract a scalar from the diagonal of a complex matrix.
mtx | The input-output matrix |
scalar | The complex scalar to be subtracked from the diagonal elements of the matrix |
Definition at line 238 of file common.cpp.