Quantum Gate Decomposer  v1.3
Powerful decomposition of almost any unitary into U3 and CNOT 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 (C) 2020 Peter Rakyta, Ph.D.
4 
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see http://www.gnu.org/licenses/.
17 
18 @author: Peter Rakyta, Ph.D.
19 */
24 #ifndef SUB_MATRIX_DECOMPOSITION_H
25 #define SUB_MATRIX_DECOMPOSITION_H
26 
27 #include "qgd/Decomposition_Base.h"
30 
31 
36 
37 
38 public:
39 
42 
45 
48 
50  std::map<int,int> identical_blocks;
51 
52 
53 public:
54 
63 Sub_Matrix_Decomposition( Matrix Umtx_in, int qbit_num_in, bool optimize_layer_num_in, guess_type initial_guess_in );
64 
69 
70 
75 
76 
82 void solve_layer_optimization_problem( int num_of_parameters, gsl_vector *solution_guess_gsl);
83 
84 
85 
86 
92 double optimization_problem( const double* parameters);
93 
94 
95 
102 static double optimization_problem( const gsl_vector* parameters, void* void_instance );
103 
104 
111 static void optimization_problem_grad( const gsl_vector* parameters, void* void_instance, gsl_vector* grad );
112 
113 
121 static void optimization_problem_combined( const gsl_vector* parameters, void* void_instance, double* f0, gsl_vector* grad );
122 
129 int set_identical_blocks( int qbit, int identical_blocks_in );
130 
131 
137 int set_identical_blocks( std::map<int, int> identical_blocks_in );
138 
139 
145 
146 
147 };
148 
149 
150 #endif //SUB_MATRIX_DECOMPOSITION
bool optimize_layer_num
logical value. Set true to optimize the minimum number of operation layers required in the decomposit...
void solve_layer_optimization_problem(int num_of_parameters, gsl_vector *solution_guess_gsl)
Call to solve layer by layer the optimization problem.
Sub_Matrix_Decomposition(Matrix Umtx_in, int qbit_num_in, bool optimize_layer_num_in, guess_type initial_guess_in)
Constructor of the class.
void disentangle_submatrices()
Start the optimization process to disentangle the most significant qubit from the others.
static void optimization_problem_combined(const gsl_vector *parameters, void *void_instance, double *f0, gsl_vector *grad)
Call to calculate both the cost function and the its gradient components.
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.
Header file for the paralleized calculation of the gradient components of the cost functions (support...
bool subdisentaglement_done
logical value indicating whether the disentamglement of a qubit from the othetrs was done or not
Sub_Matrix_Decomposition * clone()
Call to create a clone of the present class.
double optimization_problem(const double *parameters)
The optimization problem of the final optimization.
~Sub_Matrix_Decomposition()
Destructor of the class.
A class containing basic methods for the decomposition process.
Class to store data of complex arrays and its properties.
Definition: matrix.h:12
Header file for a class containing basic methods for the decomposition process.
Matrix subdecomposed_mtx
The subdecomposed matrix.
guess_type
Type definition of the types of the initial guess.
static void optimization_problem_grad(const gsl_vector *parameters, void *void_instance, gsl_vector *grad)
Calculate the approximate derivative (f-f0)/(x-x0) of the cost function with respect to the free para...
A class responsible for the disentanglement of one qubit from the others.
Header file for the paralleized calculation of the cost function of the subdecomposition (supporting ...