Sequential Quantum Gate Decomposer  v1.9.3
Powerful decomposition of general unitarias into one- and two-qubit gates gates
Sub_Matrix_Decomposition.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 SUB_MATRIX_DECOMPOSITION_H
24 #define SUB_MATRIX_DECOMPOSITION_H
25 
26 #include "Decomposition_Base.h"
27 
28 
29 
34 
35 
36 public:
37 
40 
43 
46 
48  std::map<int,int> identical_blocks;
49 
52 
55 
56 
57 public:
58 
64 
73 Sub_Matrix_Decomposition( Matrix Umtx_in, int qbit_num_in, bool optimize_layer_num_in, std::map<std::string, Config_Element>& config_in, guess_type initial_guess_in );
74 
79 
80 
85 
89 virtual void add_gate_layers();
90 
91 
96 
97 
102 void set_custom_gate_layers( Gates_block* block_in);
103 
104 
105 
111 void solve_layer_optimization_problem( int num_of_parameters, Matrix_real solution_guess_gsl);
112 
113 
114 
115 
121 double optimization_problem( double* parameters);
122 
123 
124 
131 static double optimization_problem( Matrix_real parameters, void* void_instance );
132 
133 
140 static void optimization_problem_grad( Matrix_real parameters, void* void_instance, Matrix_real& grad );
141 
142 
150 static void optimization_problem_combined( Matrix_real parameters, void* void_instance, double* f0, Matrix_real& grad );
151 
158 int set_identical_blocks( int qbit, int identical_blocks_in );
159 
160 
166 int set_identical_blocks( std::map<int, int> identical_blocks_in );
167 
168 
174 
175 
176 };
177 
178 
179 #endif //SUB_MATRIX_DECOMPOSITION
bool optimize_layer_num
logical value. Set true to optimize the minimum number of gate layers required in the decomposition...
Sub_Matrix_Decomposition()
Nullary constructor of the class.
static void optimization_problem_grad(Matrix_real parameters, void *void_instance, Matrix_real &grad)
Calculate the approximate derivative (f-f0)/(x-x0) of the cost function with respect to the free para...
void set_custom_gate_layers(Gates_block *block_in)
Call to set custom layers to the gate structure that are intended to be used in the subdecomposition...
Gates_block * unit_gate_structure
Custom gate structure describing the gate structure used in the decomposition. The gate structure is ...
void disentangle_submatrices()
Start the optimization process to disentangle the most significant qubit from the others...
long long max_inner_iterations
maximal number of inner iterations
std::map< int, int > identical_blocks
A map of <int n: int num> indicating that how many identical succesive blocks should be used in the d...
int set_identical_blocks(int qbit, int identical_blocks_in)
Set the number of identical successive blocks during the subdecomposition of the qbit-th qubit...
bool subdisentaglement_done
logical value indicating whether the disentamglement of a qubit from the othetrs was done or not ...
virtual void add_gate_layers()
Call to add further layer to the gate structure used in the subdecomposition.
Sub_Matrix_Decomposition * clone()
Call to create a clone of the present class.
~Sub_Matrix_Decomposition()
Destructor of the class.
void add_default_gate_layers()
Call to add default gate layers to the gate structure used in the subdecomposition.
A class containing basic methods for the decomposition process.
Class to store data of complex arrays and its properties.
Definition: matrix.h:38
Header file for a class containing basic methods for the decomposition process.
A class responsible for grouping two-qubit (CNOT,CZ,CH) and one-qubit gates into layers.
Definition: Gates_block.h:41
Matrix subdecomposed_mtx
The subdecomposed matrix.
guess_type
Type definition of the types of the initial guess.
static void optimization_problem_combined(Matrix_real parameters, void *void_instance, double *f0, Matrix_real &grad)
Call to calculate both the cost function and the its gradient components.
double optimization_problem(double *parameters)
The optimization problem of the final optimization.
A class responsible for the disentanglement of one qubit from the others.
Class to store data of complex arrays and its properties.
Definition: matrix_real.h:39
void solve_layer_optimization_problem(int num_of_parameters, Matrix_real solution_guess_gsl)
Call to solve layer by layer the optimization problem.