23 #ifndef DECOMPOSITION_BASE_H 24 #define DECOMPOSITION_BASE_H 56 #include <tbb/cache_aligned_allocator.h> 65 #ifndef OPENBLAS_CONST 66 # define OPENBLAS_CONST const 68 #if defined(OS_WINDOWS) && defined(__64BIT__) 76 #if defined(OS_WINDOWS) && defined(__64BIT__) 77 #define blasabs(x) llabs(x) 79 #define blasabs(x) labs(x) 108 std::map<std::string, Config_Element>
config;
427 #endif //DECOMPOSITION_BASE void list_gates(int start_index)
Call to print the gates decomposing the initial unitary.
std::string get_project_name()
Call to get the current name of the project.
A class representing a U3 gate.
Header file for a class representing a rotation gate around the X axis.
Header file for a class for a composite gate operation.
Matrix get_decomposed_matrix()
Calculate the decomposed matrix resulted by the effect of the optimized gates on the unitary Umtx...
void set_project_name(std::string &project_name_new)
Call to set the name of the project.
bool decomposition_finalized
The optimized parameters for the gates.
Header file for a class representing the X gate.
Matrix get_Umtx()
Call to retrive a pointer to the unitary to be transformed.
Header file for a class representing the Y gate.
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
Header file for a class representing a controlled rotation gate around the Y axis.
int finalizing_gates_num
number of finalizing (deterministic) opertaions rotating the disentangled qubits into state |0>...
Header file for a class representing the SX axis.
Header file for a class representing a controlled rotation gate around the Y axis.
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.
double get_current_minimum()
Call to get the obtained minimum of the cost function.
Header file for a class representing a CH operation.
Header file for a class responsible for grouping gates into subcircuits. (Subcircuits can be nested) ...
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...
Header file for a class representing a rotation gate around the Z axis.
Matrix apply_gate(Matrix &gate_mtx, Matrix &input_matrix)
Apply an gates on the input matrix.
guess_type initial_guess
type to guess the initial values for the optimization. Possible values: ZEROS=0, RANDOM=1, CLOSE_TO_ZERO=2
static void Init_max_layer_num()
Initializes default layer numbers.
void apply_global_phase_factor()
Call to apply the current global phase to the unitary matrix.
void set_qbit_num(int qbit_num_in)
Set the number of qubits spanning the matrix of the gates stored in the block of gates.
int max_outer_iterations
Maximal number of iterations allowed in the optimization process.
Header file for a class representing a CNOT operation.
std::string project_name
the name of the project
double optimization_tolerance
The maximal allowed error of the optimization problem (The error of the decomposition would scale wit...
void set_global_phase(double new_global_phase)
Call to set global phase.
QGD_Complex16 get_global_phase_factor()
Get the global phase of the Unitary matrix.
Header file for a class representing a rotation gate around the Z axis.
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.
double convergence_threshold
The convergence threshold in the optimization process.
Header file for a class describing a universal parameter with name and value stored in a config map...
Header file for a class representing the Hadamard gate.
Matrix_real get_optimized_parameters()
Call to get the optimized parameters.
double cblas_dznrm2(OPENBLAS_CONST blasint N, OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX)
Header file for a class for the representation of general gate operations on the first qbit_num-1 qub...
std::map< int, int > iteration_loops
A map of <int n: int num> indicating the number of iteration in each step of the decomposition.
void set_optimized_parameters(double *parameters, int num_of_parameters)
Call to set the optimized parameters for initial optimization.
Header file for a class representing a CZ operation.
int num_threads
Store the number of OpenMP threads. (During the calculations OpenMP multithreading is turned off...
Structure type representing complex numbers in the SQUANDER package.
A class containing basic methods for the decomposition process.
void set_optimization_tolerance(double tolerance_in)
Call to set the tolerance of the optimization processes.
Class to store data of complex arrays and its properties.
virtual ~Decomposition_Base()
Destructor of the class.
Header file for a class representing a gate used in adaptive decomposition.
QGD_Complex16 global_phase_factor
The global phase.
void set_convergence_threshold(double convergence_threshold_in)
Call to set the threshold of convergence in the optimization processes.
A class responsible for grouping two-qubit (CNOT,CZ,CH) and one-qubit gates into layers.
void calculate_new_global_phase_factor(QGD_Complex16 global_phase_factor_new)
Calculate the new global phase of the Unitary matrix after removing a trivial U3 matrix.
Header file for a class representing a U3 gate.
void reorder_qubits(std::vector< int > qbit_list)
Call to reorder the qubits in the matrix of the gate.
guess_type
Type definition of the types of the initial guess.
Header file for a class representing a rotation gate around the X axis.
std::map< std::string, Config_Element > config
config metadata utilized during the optimization
Header file for a class representing a rotation gate around the Y axis.
virtual void solve_layer_optimization_problem(int num_of_parameters, Matrix_real solution_guess_gsl)
Abstarct function to be used to solve a single sub-layer optimization problem.
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 export_unitary(std::string &filename)
exports unitary matrix to binary file
Header file for a class representing the Z gate.
Header file for a class for the representation of general gate operations on the first qbit_num-1 qub...
int finalizing_parameter_num
the number of the finalizing (deterministic) parameters of gates rotating the disentangled qubits int...
void set_max_iteration(int max_outer_iterations_in)
Call to set the maximal number of the iterations in the optimization process.
bool check_optimization_solution()
check_optimization_solution
int optimization_block
number of gate blocks used in one shot of the optimization process
double decomposition_error
error 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.
Matrix import_unitary_from_binary(std::string &filename)
Import a Unitary matrix from a file.
Matrix_real optimized_parameters_mtx
The optimized parameters for the gates.
int get_parallel_configuration()
Get the parallel configuration from the config.
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 gate blocks to be optimized in one shot.
Class to store data of complex arrays and its properties.
Decomposition_Base()
Nullary constructor of the class.
std::mt19937 gen
Standard mersenne_twister_engine seeded with rd()
Header file for a class representing a Sycamore gate.
virtual double optimization_problem(const double *parameters)
This is an abstact definition of function giving the cost functions measuring the entaglement of the ...