Sequential Quantum Gate Decomposer  v1.9.3
Powerful decomposition of general unitarias into one- and two-qubit gates gates
ON.h
Go to the documentation of this file.
1 /*
2 Created on Fri JON 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 ON_H
24 #define ON_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 ON : public Gate {
36 
37 
38 protected:
39 
42 
43 public:
44 
49 ON();
50 
54 virtual ~ON();
55 
56 
62 ON(int qbit_num_in);
63 
64 
70 Matrix get_matrix(Matrix_real& parameters);
71 
77 Matrix get_matrix(Matrix_real& parameters, int parallel=0);
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 ON* clone();
149 
150 };
151 
152 
153 #endif //OPERATION
virtual void reorder_qubits(std::vector< int > qbit_list)
Call to reorder the qubits in the matrix of the operation.
Definition: ON.cpp:247
Header file for a class for the representation of general gate operations.
Matrix_real parameters
Parameters after the decomposition of the ONitary is done.
Definition: ON.h:41
virtual Matrix get_matrix()
Call to retrieve the operation matrix.
Definition: Gate.cpp:129
void apply_to(Matrix_real &parameters, Matrix &input, int parallel)
Call to apply the gate on the input array/matrix.
Definition: ON.cpp:151
ON()
Default constructor of the class.
Definition: ON.cpp:35
virtual void set_qbit_num(int qbit_num_in)
Set the number of qubits spanning the matrix of the operation.
Definition: ON.cpp:90
virtual ~ON()
Destructor of the class.
Definition: ON.cpp:83
Header file of complex array storage array with automatic and thread safe reference counting...
gate_type get_type()
Call to get the type of the operation.
Definition: ON.cpp:311
Matrix get_submatrix(Matrix_real &parameters)
Call to retrieve the qbut_num-1 kernel of the operation.
Definition: ON.cpp:230
Class to store data of complex arrays and its properties.
Definition: matrix.h:38
int get_parameter_num()
Call to get the number of free parameters.
Definition: ON.cpp:302
Base class for the representation of general gate operations.
Definition: Gate.h:73
Header file for commonly used functions and wrappers to CBLAS functions.
ON * clone()
Call to create a clone of the present class.
Definition: ON.cpp:329
void apply_from_right(Matrix_real &parameters, Matrix &input)
Call to apply the gate on the input array/matrix by input*Gate.
Definition: ON.cpp:189
gate_type
Type definition of operation types (also generalized for decomposition classes derived from the class...
Definition: Gate.h:34
Base class for the representation of general gate operations.
Definition: ON.h:35
int get_qbit_num()
Call to get the number of qubits composing the ONitary.
Definition: ON.cpp:320
void set_optimized_parameters(Matrix_real parameters_)
Call to set the final optimized parameters of the gate.
Definition: ON.cpp:281
Class to store data of complex arrays and its properties.
Definition: matrix_real.h:39
Matrix_real get_optimized_parameters()
Call to get the final optimized parameters of the gate.
Definition: ON.cpp:291