Sequential Quantum Gate Decomposer  v1.9.3
Powerful decomposition of general unitarias into one- and two-qubit gates gates
CZ_NU.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 CZ_NU_H
24 #define CZ_NU_H
25 
26 #include "matrix.h"
27 #include "Gate.h"
28 #define _USE_MATH_DEFINES
29 #include <math.h>
30 #include "CNOT.h"
31 
32 
36 class CZ_NU: public CNOT {
37 
38 protected:
39 
42 
43 
44 public:
45 
49 CZ_NU();
50 
51 
58 CZ_NU(int qbit_num_in, int target_qbit_in, int control_qbit_in);
59 
63 ~CZ_NU();
64 
65 
71 Matrix get_matrix( Matrix_real& parameters );
72 
79 Matrix get_matrix(Matrix_real& parameters, int parallel);
80 
86 void apply_to( Matrix_real& parameters, Matrix& input, int parallel );
87 
92 void apply_from_right( Matrix_real& parameters, Matrix& input );
93 
94 
101 void apply_to_list( Matrix_real& parameters, std::vector<Matrix>& inputs, int parallel );
102 
103 
110 std::vector<Matrix>
111 apply_derivate_to( Matrix_real& parameters_mtx, Matrix& input, int parallel );
112 
113 
114 
115 
120 void set_optimized_parameters(double param );
121 
122 
128 
129 
130 
135 void set_qbit_num(int qbit_num);
136 
141 void reorder_qubits( std::vector<int> qbit_list);
142 
143 
149 Matrix calc_one_qubit_u3( double& param);
150 
155 virtual CZ_NU* clone();
156 
157 };
158 
159 #endif //CZ_NU
Matrix calc_one_qubit_u3()
Set static values for matrix of the gates.
Definition: CNOT.cpp:211
CZ_NU()
Nullary constructor of the class.
Definition: CZ_NU.cpp:33
Header file for a class for the representation of general gate operations.
void apply_to(Matrix_real &parameters, Matrix &input, int parallel)
Call to apply the gate on the input array/matrix CZ*input.
Definition: CZ_NU.cpp:141
void set_optimized_parameters(double param)
Call to set the final optimized parameters of the gate.
Definition: CZ_NU.cpp:257
void apply_from_right(Matrix_real &parameters, Matrix &input)
Call to apply the gate on the input array/matrix by input*CZ.
Definition: CZ_NU.cpp:162
Matrix_real parameters
Parameters of the gate after the decomposition of the unitary is done.
Definition: CZ_NU.h:41
void apply_to_list(Matrix_real &parameters, std::vector< Matrix > &inputs, int parallel)
Call to apply the gate on the input array/matrix by CZ_NU*input.
Definition: CZ_NU.cpp:186
Header file for a class representing a CNOT operation.
Header file of complex array storage array with automatic and thread safe reference counting...
~CZ_NU()
Destructor of the class.
Definition: CZ_NU.cpp:104
virtual CZ_NU * clone()
Call to create a clone of the present class.
Definition: CZ_NU.cpp:320
A class representing a CNOT operation.
Definition: CNOT.h:35
Matrix_real get_optimized_parameters()
Call to get the final optimized parameters of the gate.
Definition: CZ_NU.cpp:270
Class to store data of complex arrays and its properties.
Definition: matrix.h:38
A class representing a CZ operation.
Definition: CZ_NU.h:36
void set_qbit_num(int qbit_num)
Call to set the number of qubits spanning the matrix of the operation.
Definition: CZ_NU.cpp:282
void reorder_qubits(std::vector< int > qbit_list)
Call to reorder the qubits in the matrix of the operation.
Definition: CZ_NU.cpp:294
Matrix get_matrix()
Call to retrieve the operation matrix.
Definition: CNOT.cpp:118
int qbit_num
number of qubits spanning the matrix of the operation
Definition: Gate.h:81
Class to store data of complex arrays and its properties.
Definition: matrix_real.h:39
std::vector< Matrix > apply_derivate_to(Matrix_real &parameters_mtx, Matrix &input, int parallel)
Call to evaluate the derivate of the circuit on an input with respect to all of the free parameters...
Definition: CZ_NU.cpp:219