Quantum Gate Decomposer  v1.3
Powerful decomposition of almost any unitary into U3 and CNOT gates
dot.h
Go to the documentation of this file.
1 #ifndef Dot_H
2 #define Dot_H
3 
4 #ifdef __cplusplus
5 extern "C"
6 {
7 #endif
8 #include <gsl/gsl_blas_types.h>
9 #ifdef __cplusplus
10 }
11 #endif
12 
13 #ifndef CblasConjNoTrans
14 #define CblasConjNoTrans 114
15 #endif
16 
17 
18 #include "qgd/matrix.h"
19 
20 #ifdef CBLAS
21 #ifdef __cplusplus
22 extern "C"
23 {
24 #endif
25 
26 
28 void cblas_zgemm3m(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, const int M, const int N, const int K,
29  const void *alpha, const void *A, const int lda, const void *B, const int ldb, const void *beta, void *C, const int ldc);
30 
31 
32 #if BLAS==1 // MKL
33 
35 void vzConj(int num, pic::Complex16* input, pic::Complex16* output);
36 
37 #endif
38 
39 #ifdef __cplusplus
40 }
41 #endif
42 #endif
43 
44 
45 
52 Matrix dot( Matrix &A, Matrix &B );
53 
54 
55 
62 bool check_matrices( Matrix &A, Matrix &B );
63 
64 
65 
71 void get_cblas_transpose( Matrix &A, CBLAS_TRANSPOSE &transpose );
72 
77 struct row_indices {
78 
80  size_t Arows_start;
82  size_t Arows_end;
84  size_t Arows;
86  size_t Brows_start;
88  size_t Brows_end;
90  size_t Brows;
92  size_t Crows_start;
94  size_t Crows_end;
96  size_t Crows;
97 };
98 
103 struct col_indices {
105  size_t Acols_start;
107  size_t Acols_end;
109  size_t Acols;
111  size_t Bcols_start;
113  size_t Bcols_end;
115  size_t Bcols;
117  size_t Ccols_start;
119  size_t Ccols_end;
121  size_t Ccols;
122 };
123 
124 
128 class Cont_Task_rowsA: public tbb::task {
129 
130 public:
131 
137 
142 tbb::task* execute();
143 
144 };
145 
146 
151 
152 public:
164  CBLAS_ORDER order;
165 
166 
167 
168 
169 public:
170 
177 zgemm3m_Task_serial( Matrix &A_in, Matrix &B_in, Matrix &C_in);
178 
187 zgemm3m_Task_serial( Matrix &A_in, Matrix &B_in, Matrix &C_in, row_indices& rows_in, col_indices& cols_in);
188 
192 void zgemm3m_chunk();
193 
194 }; // zgemm3m_Task_serial
195 
196 
197 
201 class zgemm3m_Task: public tbb::task, public zgemm3m_Task_serial {
202 
203 
204 public:
205  // reuse the constructors of class zgemm3m_Task_serial
207 
208 
213 tbb::task* execute();
214 
215 
216 
217 }; // zgemm3m_Task
218 
219 
220 
221 #endif
tbb::task * execute()
This function is called when a task is spawned.
Definition: dot.cpp:324
size_t Ccols_start
The firs col in matrix C participating in the multiplication sub-problem.
Definition: dot.h:117
size_t Crows
The number of rows in matrix C participating in the multiplication sub-problem.
Definition: dot.h:96
Matrix C
The matrix C.
Definition: dot.h:158
size_t Ccols
The number of cols in matrix C participating in the multiplication sub-problem.
Definition: dot.h:121
Matrix B
The matrix B.
Definition: dot.h:156
Structure containing row limits for the partitioning of the matrix product calculations.
Definition: dot.h:77
Structure containing column limits for the partitioning of the matrix product calculations.
Definition: dot.h:103
tbb::task * execute()
Overriden execute function of class tbb::task.
Definition: dot.cpp:188
zgemm3m_Task_serial(Matrix &A_in, Matrix &B_in, Matrix &C_in)
Constructor of the class.
Definition: dot.cpp:201
size_t Brows_end
The last row in matrix B participating in the multiplication sub-problem. (The rows are picked from a...
Definition: dot.h:88
bool check_matrices(Matrix &A, Matrix &B)
Call to check the shape of the matrices for method dot.
Definition: dot.cpp:103
size_t Acols_start
The firs col in matrix A participating in the multiplication sub-problem.
Definition: dot.h:105
size_t Bcols_end
The last col in matrix B participating in the multiplication sub-problem. (The cols are picked from a...
Definition: dot.h:113
size_t Arows_start
The firs row in matrix A participating in the multiplication sub-problem.
Definition: dot.h:80
size_t Bcols_start
The firs col in matrix B participating in the multiplication sub-problem.
Definition: dot.h:111
size_t Arows_end
The last row in matrix A participating in the multiplication sub-problem. (The rows are picked from a...
Definition: dot.h:82
size_t Acols_end
The last col in matrix A participating in the multiplication sub-problem. (The cols are picked from a...
Definition: dot.h:107
size_t Crows_start
The firs row in matrix C participating in the multiplication sub-problem.
Definition: dot.h:92
size_t Crows_end
The last row in matrix C participating in the multiplication sub-problem. (The rows are picked from a...
Definition: dot.h:94
size_t Bcols
The number of cols in matrix B participating in the multiplication sub-problem.
Definition: dot.h:115
size_t Brows
The number of rows in matrix B participating in the multiplication sub-problem.
Definition: dot.h:90
Empty task class to utilize task continuation for saving stack space.
Definition: dot.h:128
Cont_Task_rowsA()
Default constructor of the class.
Definition: dot.cpp:179
Class to store data of complex arrays and its properties.
Definition: matrix.h:12
size_t Ccols_end
The last col in matrix C participating in the multiplication sub-problem. (The col are picked from a ...
Definition: dot.h:119
size_t Arows
The number of rows in matrix A participating in the multiplication sub-problem.
Definition: dot.h:84
row_indices rows
Structure containing row limits for the partitioning of the matrix product calculations.
Definition: dot.h:160
col_indices cols
Structure containing column limits for the partitioning of the matrix product calculations.
Definition: dot.h:162
Class to calculate a matrix product C=A*B in serial.
Definition: dot.h:150
size_t Brows_start
The firs row in matrix B participating in the multiplication sub-problem.
Definition: dot.h:86
Class to calculate a matrix product C=A*B in parallel.
Definition: dot.h:201
CBLAS_ORDER order
CBLAS storage order.
Definition: dot.h:164
Matrix A
The matrix A.
Definition: dot.h:154
size_t Acols
The number of cols in matrix A participating in the multiplication sub-problem.
Definition: dot.h:109
Matrix dot(Matrix &A, Matrix &B)
Call to calculate the product of two complex matrices by calling method zgemm3m from the CBLAS librar...
Definition: dot.cpp:20
void zgemm3m_chunk()
Call to calculate the product of matrix chunks defined by attributes rows, cols.
Definition: dot.cpp:258
void get_cblas_transpose(Matrix &A, CBLAS_TRANSPOSE &transpose)
Call to get the transpose properties of the input matrix for CBLAS calculations.
Definition: dot.cpp:153