Sequential Quantum Gate Decomposer  v1.9.3
Powerful decomposition of general unitarias into one- and two-qubit gates gates
Composite.h
Go to the documentation of this file.
1 /*
2 Created on Fri Jun 26 14:13:26 2020
3 Copyright 2020 Peter Rakyta, Ph.D.
4 
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8 
9  http://www.apache.org/licenses/LICENSE-2.0
10 
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 
17 @author: Peter Rakyta, Ph.D.
18 */
23 #ifndef COM_H
24 #define COM_H
25 
26 #include <vector>
27 #include "common.h"
28 #include "matrix.h"
29 #include "matrix_real.h"
30 #include "Gates_block.h"
31 #include "CZ.h"
32 #include "CH.h"
33 #include "CNOT.h"
34 #include "U3.h"
35 #include "RX.h"
36 #include "RY.h"
37 #include "RZ.h"
38 #include "X.h"
39 #include "SX.h"
40 #include "SYC.h"
41 #include "UN.h"
42 #include "ON.h"
43 
47 class Composite : public Gates_block {
48 
49 
50 protected:
51 
54 
55 public:
56 
61 Composite();
62 
66 virtual ~Composite();
67 
68 
74 Composite(int qbit_num_in);
75 
76 
82 Matrix get_matrix(Matrix_real& parameters);
83 
84 
85 
91 Matrix get_matrix(Matrix_real& parameters, int parallel);
92 
93 
99 void apply_to( Matrix_real& parameters, Matrix& input, int parallel );
100 
101 
106 void apply_from_right( Matrix_real& parameters, Matrix& input );
107 
108 
109 
114 virtual void set_qbit_num( int qbit_num_in );
115 
120 virtual void reorder_qubits( std::vector<int> qbit_list );
121 
122 
127 int get_parameter_num();
128 
129 
135 
140 int get_qbit_num();
141 
146 Composite* clone();
147 
148 };
149 
150 
151 #endif //OPERATION
void apply_to(Matrix_real &parameters, Matrix &input, int parallel)
Call to apply the gate on the input array/matrix.
Definition: Composite.cpp:153
Base class for the representation of general gate operations.
Definition: Composite.h:47
virtual Matrix get_matrix()
Call to retrieve the operation matrix.
Definition: Gate.cpp:129
Header file for a class representing the X gate.
Composite()
Default constructor of the class.
Definition: Composite.cpp:35
Header file for a class representing the SX axis.
Header file for a class representing a CH operation.
Composite * clone()
Call to create a clone of the present class.
Definition: Composite.cpp:279
Header file for a class responsible for grouping gates into subcircuits. (Subcircuits can be nested) ...
virtual ~Composite()
Destructor of the class.
Definition: Composite.cpp:84
void apply_from_right(Matrix_real &parameters, Matrix &input)
Call to apply the gate on the input array/matrix by input*Gate.
Definition: Composite.cpp:183
Header file for a class representing a CNOT operation.
Header file for a class representing a rotation gate around the Z axis.
virtual void set_qbit_num(int qbit_num_in)
Set the number of qubits spanning the matrix of the operation.
Definition: Composite.cpp:91
Header file for a class for the representation of general gate operations on the first qbit_num-1 qub...
Header file of complex array storage array with automatic and thread safe reference counting...
Header file for a class representing a CZ operation.
gate_type get_type()
Call to get the type of the operation.
Definition: Composite.cpp:260
Class to store data of complex arrays and its properties.
Definition: matrix.h:38
A class responsible for grouping two-qubit (CNOT,CZ,CH) and one-qubit gates into layers.
Definition: Gates_block.h:41
Header file for a class representing a U3 gate.
Header file for a class representing a rotation gate around the X axis.
Header file for a class representing a rotation gate around the Y axis.
int get_parameter_num()
Call to get the number of free parameters.
Definition: Composite.cpp:250
Header file for commonly used functions and wrappers to CBLAS functions.
Header file for a class for the representation of general gate operations on the first qbit_num-1 qub...
gate_type
Type definition of operation types (also generalized for decomposition classes derived from the class...
Definition: Gate.h:34
int get_qbit_num()
Call to get the number of qubits composing the unitary.
Definition: Composite.cpp:270
Matrix_real parameters
Parameters theta, phi, lambda of the U3 gate after the decomposition of the unitary is done...
Definition: Composite.h:53
virtual void reorder_qubits(std::vector< int > qbit_list)
Call to reorder the qubits in the matrix of the operation.
Definition: Composite.cpp:216
Class to store data of complex arrays and its properties.
Definition: matrix_real.h:39
Header file for a class representing a Sycamore gate.