Sequential Quantum Gate Decomposer  v1.9.3
Powerful decomposition of general unitarias into one- and two-qubit gates gates
CROT.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 CROT_H
24 #define CROT_H
25 
26 #include "RY.h"
27 #include "CNOT.h"
28 #include "matrix.h"
29 #include "matrix_real.h"
30 #define _USE_MATH_DEFINES
31 #include <math.h>
32 
33 
35 
39 class CROT: public Gate {
40 
41 protected:
42 
43 
45 
47 public:
48 
52 CROT();
53 
54 CROT(int qbit_num_in, int target_qbit_in, int control_qbit_in, crot_type subtype_in);
55 
56 virtual ~CROT();
57 
58 void apply_to_list( Matrix_real& parameters_mtx, std::vector<Matrix>& input );
59 
60 void apply_to_list( Matrix_real& parameters_mtx, std::vector<Matrix>& inputs, int parallel );
61 
62 virtual void apply_to( Matrix_real& parameters_mtx, Matrix& input, int parallel );
63 
64 virtual void apply_from_right( Matrix_real& parameters, Matrix& input );
65 
66 virtual std::vector<Matrix> apply_derivate_to( Matrix_real& parameters_mtx, Matrix& input, int parallel );
67 
68 virtual void set_qbit_num(int qbit_num_in);
69 
70 virtual void reorder_qubits( std::vector<int> qbit_list);
71 
72 
74 
75 virtual CROT* clone();
76 
77 Matrix calc_one_qubit_rotation(double ThetaOver2, double Phi);
78 
79 Matrix calc_one_qubit_rotation_deriv_Phi(double ThetaOver2, double Phi);
80 
81 virtual Matrix_real extract_parameters( Matrix_real& parameters );
82 
83 
84 
85 };
86 
87 
88 #endif //CROT
89 
virtual Matrix_real extract_parameters(Matrix_real &parameters)
Call to extract parameters from the parameter array corresponding to the circuit, in which the gate i...
Definition: CROT.cpp:609
crot_type get_subtype()
Definition: CROT.cpp:527
virtual void apply_from_right(Matrix_real &parameters, Matrix &input)
Call to apply the gate on the input array/matrix by input*CROT.
Definition: CROT.cpp:265
A class representing a CROT gate.
Definition: CROT.h:39
void apply_to_list(Matrix_real &parameters_mtx, std::vector< Matrix > &input)
Call to apply the gate on the input array/matrix by U3*input.
Definition: CROT.cpp:123
Header file for a class representing a CNOT operation.
virtual void reorder_qubits(std::vector< int > qbit_list)
Call to reorder the qubits in the matrix of the gate.
Definition: CROT.cpp:547
Matrix calc_one_qubit_rotation_deriv_Phi(double ThetaOver2, double Phi)
Definition: CROT.cpp:586
Header file of complex array storage array with automatic and thread safe reference counting...
Matrix calc_one_qubit_rotation(double ThetaOver2, double Phi)
Definition: CROT.cpp:569
virtual void apply_to(Matrix_real &parameters_mtx, Matrix &input, int parallel)
Call to apply the gate on the input array/matrix by CROT3*input.
Definition: CROT.cpp:170
Class to store data of complex arrays and its properties.
Definition: matrix.h:38
Matrix_real parameters
Definition: CROT.h:46
Base class for the representation of general gate operations.
Definition: Gate.h:73
Header file for a class representing a rotation gate around the Y axis.
virtual void set_qbit_num(int qbit_num_in)
Call to set the number of qubits spanning the matrix of the gate.
Definition: CROT.cpp:535
virtual CROT * clone()
Call to create a clone of the present class.
Definition: CROT.cpp:559
Definition: CROT.h:34
CROT()
Nullary constructor of the class.
Definition: CROT.cpp:33
virtual ~CROT()
Destructor of the class.
Definition: CROT.cpp:112
crot_type subtype
Definition: CROT.h:44
virtual std::vector< Matrix > apply_derivate_to(Matrix_real &parameters_mtx, Matrix &input, int parallel)
Call to evaluate the derivate of the circuit on an inout with respect to all of the free parameters...
Definition: CROT.cpp:278
Class to store data of complex arrays and its properties.
Definition: matrix_real.h:39
crot_type
Definition: CROT.h:34