38 void*
qgd_calloc(
size_t element_num,
size_t size,
size_t alignment ) {
40 void* ret = scalable_aligned_malloc( size*element_num,
CACHELINE);
41 memset(ret, 0, element_num*size);
54 void*
qgd_realloc(
void* aligned_ptr,
size_t element_num,
size_t size,
size_t alignment ) {
56 void* ret = scalable_aligned_realloc(aligned_ptr, size*element_num,
CACHELINE);
70 scalable_aligned_free(ptr);
97 if ( involved_qbits.size() == 0 ) {
98 involved_qbits.push_back( qbit );
101 for(std::vector<int>::iterator it = involved_qbits.begin(); it != involved_qbits.end(); ++it) {
103 int current_val = *it;
105 if (current_val == qbit) {
108 else if (current_val > qbit) {
109 involved_qbits.insert( it, qbit );
116 involved_qbits.push_back( qbit );
137 mtx[element_index].real = 1.0;
160 matrix[element_index].
real = 1.0;
190 cblas_zgemm3m (CblasRowMajor, CblasNoTrans, CblasConjTrans, 1, 1, vector_size, &alpha, A, vector_size, B, vector_size, &beta, &C, 1);
192 cblas_zgemm (CblasRowMajor, CblasNoTrans, CblasConjTrans, 1, 1, vector_size, &alpha, A, vector_size, B, vector_size, &beta, &C, 1);
219 cblas_zgemm3m (CblasRowMajor, CblasNoTrans, CblasConjTrans,
matrix_size,
matrix_size,
matrix_size, &alpha, A,
matrix_size, B,
matrix_size, &beta, C,
matrix_size);
221 cblas_zgemm (CblasRowMajor, CblasNoTrans, CblasConjTrans,
matrix_size,
matrix_size,
matrix_size, &alpha, A,
matrix_size, B,
matrix_size, &beta, C,
matrix_size);
251 cblas_zgemm3m (CblasRowMajor, CblasNoTrans, CblasNoTrans,
matrix_size,
matrix_size,
matrix_size, &alpha, A,
matrix_size, B,
matrix_size, &beta, C,
matrix_size);
253 cblas_zgemm (CblasRowMajor, CblasNoTrans, CblasNoTrans,
matrix_size,
matrix_size,
matrix_size, &alpha, A,
matrix_size, B,
matrix_size, &beta, C,
matrix_size);
280 cblas_zgemm3m (CblasRowMajor, CblasNoTrans, CblasNoTrans,
matrix_size,
matrix_size,
matrix_size, &alpha, A,
matrix_size, B,
matrix_size, &beta, C,
matrix_size);
282 cblas_zgemm (CblasRowMajor, CblasNoTrans, CblasNoTrans,
matrix_size,
matrix_size,
matrix_size, &alpha, A,
matrix_size, B,
matrix_size, &beta, C,
matrix_size);
301 if (mtxs.size() == 0 ) {
317 for(std::vector<Matrix>::iterator it=++mtxs.begin(); it != mtxs.end(); ++it) {
352 mtx[element_idx].real = mtx[element_idx].real - scalar.
real;
353 mtx[element_idx].imag = mtx[element_idx].imag - scalar.
imag;
402 size_t element_num = b.
size();
404 for (
size_t idx=0; idx<element_num; idx++) {
Matrix dot(Matrix &A, Matrix &B)
Call to calculate the product of two complex matrices by calling method zgemm3m from the CBLAS librar...
size_t rows
The number of rows.
void * qgd_calloc(size_t element_num, size_t size, size_t alignment)
custom defined memory allocation function.
void qgd_free(void *ptr)
custom defined memory release function.
scalar * get_data()
Call to get the pointer to the stored data.
QGD_Complex16 mult(QGD_Complex16 a, QGD_Complex16 b)
Call to calculate the product of two complex scalars.
QGD_Complex16 * zgemm3m_wrapper(QGD_Complex16 *A, QGD_Complex16 *B, int matrix_size)
Call to calculate the product of two square shaped complex matrices using function cblas_zgemm3m or c...
Matrix reduce_zgemm(std::vector< Matrix > &mtxs)
Calculate the product of several square shaped complex matrices stored in a vector.
int zgemm3m_wrapper_adj(QGD_Complex16 *A, QGD_Complex16 *B, QGD_Complex16 *C, int matrix_size)
Call to calculate the product of a square shaped complex matrix and a complex transpose of a second s...
void * qgd_realloc(void *aligned_ptr, size_t element_num, size_t size, size_t alignment)
custom defined memory reallocation function.
Structure type representing complex numbers in the QGD package.
int Power_of_2(int n)
Calculates the n-th power of 2.
Class to store data of complex arrays and its properties.
void subtract_diag(Matrix &mtx, QGD_Complex16 scalar)
Call to subtract a scalar from the diagonal of a complex matrix.
Matrix create_identity(int matrix_size)
Call to create an identity matrix.
Header file for commonly used functions and wrappers to CBLAS functions.
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.
double real
the real part of a complex number
size_t size()
Call to get the number of the allocated elements.
QGD_Complex16 scalar_product(QGD_Complex16 *A, QGD_Complex16 *B, int vector_size)
Call to calculate the scalar product of two complex vectors using function cblas_zgemm3m or cblas_zge...
double imag
the imaginary part of a complex number