Sequential Quantum Gate Decomposer  v1.9.3
Powerful decomposition of general unitarias into one- and two-qubit gates gates
UN.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 UN_H
24 #define UN_H
25 
26 #include <vector>
27 #include "common.h"
28 #include "matrix.h"
29 #include "matrix_real.h"
30 #include "Gate.h"
31 
35 class UN : public Gate {
36 
37 
38 protected:
39 
42 
43 public:
44 
49 UN();
50 
54 virtual ~UN();
55 
56 
62 UN(int qbit_num_in);
63 
64 
69 Matrix get_matrix(Matrix_real& parameters);
70 
71 
77 Matrix get_matrix(Matrix_real& parameters, int parallel);
78 
79 
85 void apply_to( Matrix_real& parameters, Matrix& input, int parallel );
86 
87 
91 Matrix get_submatrix( Matrix_real& parameters );
92 
97 void apply_from_right( Matrix_real& parameters, Matrix& input );
98 
99 
100 
105 virtual void set_qbit_num( int qbit_num_in );
106 
111 virtual void reorder_qubits( std::vector<int> qbit_list );
112 
113 
118 void set_optimized_parameters( Matrix_real parameters_ );
119 
124 
129 int get_parameter_num();
130 
131 
137 
142 int get_qbit_num();
143 
148 UN* clone();
149 
150 };
151 
152 
153 #endif //OPERATION
Header file for a class for the representation of general gate operations.
virtual ~UN()
Destructor of the class.
Definition: UN.cpp:84
Matrix_real get_optimized_parameters()
Call to get the final optimized parameters of the gate.
Definition: UN.cpp:288
virtual Matrix get_matrix()
Call to retrieve the operation matrix.
Definition: Gate.cpp:129
Matrix_real parameters
Parameters theta, phi, lambda of the U3 gate after the decomposition of the unitary is done...
Definition: UN.h:41
UN()
Default constructor of the class.
Definition: UN.cpp:36
virtual void set_qbit_num(int qbit_num_in)
Set the number of qubits spanning the matrix of the operation.
Definition: UN.cpp:91
virtual void reorder_qubits(std::vector< int > qbit_list)
Call to reorder the qubits in the matrix of the operation.
Definition: UN.cpp:246
void apply_from_right(Matrix_real &parameters, Matrix &input)
Call to apply the gate on the input array/matrix by input*Gate.
Definition: UN.cpp:186
UN * clone()
Call to create a clone of the present class.
Definition: UN.cpp:326
int get_parameter_num()
Call to get the number of free parameters.
Definition: UN.cpp:299
Header file of complex array storage array with automatic and thread safe reference counting...
Class to store data of complex arrays and its properties.
Definition: matrix.h:38
void apply_to(Matrix_real &parameters, Matrix &input, int parallel)
Call to apply the gate on the input array/matrix.
Definition: UN.cpp:148
void set_optimized_parameters(Matrix_real parameters_)
Call to set the final optimized parameters of the gate.
Definition: UN.cpp:278
Base class for the representation of general gate operations.
Definition: Gate.h:73
Base class for the representation of general gate operations.
Definition: UN.h:35
Matrix get_submatrix(Matrix_real &parameters)
Call to retrieve the qbit_num-1 kernel of the UN gate.
Definition: UN.cpp:226
Header file for commonly used functions and wrappers to CBLAS functions.
gate_type get_type()
Call to get the type of the operation.
Definition: UN.cpp:308
int get_qbit_num()
Call to get the number of qubits composing the unitary.
Definition: UN.cpp:317
gate_type
Type definition of operation types (also generalized for decomposition classes derived from the class...
Definition: Gate.h:34
Class to store data of complex arrays and its properties.
Definition: matrix_real.h:39