24 #ifndef DECOMPOSITION_BASE_H 25 #define DECOMPOSITION_BASE_H 35 #include "gsl/gsl_multimin.h" 36 #include "gsl/gsl_statistics.h" 195 std::vector<Matrix, tbb::cache_aligned_allocator<Matrix>>
get_operation_products(
double* parameters, std::vector<Operation*>::iterator operations_it,
int num_of_operations);
355 #endif //DECOMPOSITION_BASE Matrix get_finalizing_operations(Matrix &mtx, Operation_block *finalizing_operations, double *finalizing_parameters)
This method determine the operations needed to rotate the indepent qubits into the state |0>
Matrix get_transformed_matrix(const double *parameters, std::vector< Operation * >::iterator operations_it, int num_of_operations)
Calculate the transformed matrix resulting by an array of operations on the matrix Umtx.
void finalize_decomposition()
After the main optimization problem is solved, the indepent qubits can be rotated into state |0> by t...
void prepare_operations_to_export()
Call to prepare the optimized operations to export.
Matrix get_decomposed_matrix()
Calculate the decomposed matrix resulted by the effect of the optimized operations on the unitary Umt...
int target_qbit
The index of the qubit on which the operation acts (target_qbit >= 0)
int control_qbit
The index of the qubit which acts as a control qubit (control_qbit >= 0) in controlled operations.
bool decomposition_finalized
logical value describing whether the decomposition was finalized or not (i.e. whether the decomposed ...
Matrix get_Umtx()
Call to retrive a pointer to the unitary to be transformed.
double current_minimum
The current minimum of the optimization problem.
bool optimization_problem_solved
logical value describing whether the optimization problem was solved or not
Matrix apply_operation(Matrix &operation_mtx, Matrix &input_matrix)
Apply an operations on the input matrix.
int set_max_layer_num(int n, int max_layer_num_in)
Set the maximal number of layers used in the subdecomposition of the n-th qubit.
std::map< int, int > max_layer_num
A map of <int n: int num> indicating that how many layers should be used in the subdecomposition proc...
guess_type initial_guess
type to guess the initial values for the optimization. Possible values: ZEROS=0, RANDOM=1,...
static void Init_max_layer_num()
Initializes default layer numbers.
std::vector< Matrix, tbb::cache_aligned_allocator< Matrix > > get_operation_products(double *parameters, std::vector< Operation * >::iterator operations_it, int num_of_operations)
Calculate the list of gate operation matrices such that the i>0-th element in the result list is the ...
int finalizing_operations_num
number of finalizing (deterministic) opertaions rotating the disentangled qubits into state |0>.
double * get_optimized_parameters()
Call to get the optimized parameters.
Header file for a class representing a CNOT operation.
Decomposition_Base(Matrix Umtx_in, int qbit_num_in, guess_type initial_guess_in)
Contructor of the class.
double optimization_tolerance
The maximal allowed error of the optimization problem.
operation_type type
The type of the operation (see enumeration operation_type)
double get_decomposition_error()
Call to get the error of the decomposition.
int get_Umtx_size()
Call to get the size of the unitary to be transformed.
virtual void solve_layer_optimization_problem(int num_of_parameters, gsl_vector *solution_guess_gsl)
Abstarct function to be used to solve a single sub-layer optimization problem.
A class responsible for grouping CNOT and U3 operations into layers.
void set_max_iteration(int max_iterations_in)
Call to set the maximal number of the iterations in the optimization process.
std::map< int, int > iteration_loops
A map of <int n: int num> indicating the number of iteration in each step of the decomposition.
int num_threads
Number of outer OpenMP threads. (During the calculations OpenMP multithreading is turned off....
A class containing basic methods for the decomposition process.
Class to store data of complex arrays and its properties.
virtual ~Decomposition_Base()
Destructor of the class.
Header file for a class representing a U3 operation.
void reorder_qubits(std::vector< int > qbit_list)
Call to reorder the qubits in the matrix of the operation.
bool verbose
Logical variable. Set true for verbose mode, or to false to suppress output messages.
guess_type
Type definition of the types of the initial guess.
double * optimized_parameters
The optimized parameters for the operations.
int get_operation(unsigned int n, operation_type &type, int &target_qbit, int &control_qbit, double *parameters)
Call to prepare the optimized operations to export.
void solve_optimization_problem(double *solution_guess, int solution_guess_num)
This method can be used to solve the main optimization problem which is devidid into sub-layer optimi...
Matrix Umtx
The unitary to be decomposed.
static std::map< int, int > max_layer_num_def
A map of <int n: int num> indicating that how many layers should be used in the subdecomposition proc...
void set_verbose(bool verbose_in)
Call to set the verbose attribute to true or false.
int finalizing_parameter_num
the number of the finalizing (deterministic) parameters of operations rotating the disentangled qubit...
bool check_optimization_solution()
check_optimization_solution
int optimization_block
number of operation blocks used in one shot of the optimization process
Header file for a class responsible for grouping CNOT and U3 operations into layers.
double decomposition_error
error of the unitarity of the final decomposition
int set_iteration_loops(int n, int iteration_loops_in)
Set the number of iteration loops during the subdecomposition of the n-th qubit.
operation_type
Type definition of operation types (also generalized for decomposition classes derived from the class...
void list_operations(int start_index)
Call to print the operations decomposing the initial unitary.
double global_target_minimum
The global target minimum of the optimization problem.
void set_optimization_blocks(int optimization_block_in)
Call to set the number of operation blocks to be optimized in one shot.
int max_iterations
Maximal number of iterations allowed in the optimization process.
virtual double optimization_problem(const double *parameters)
This is an abstact definition of function giving the cost functions measuring the entaglement of the ...