24 #ifndef GENERATIVE_QUANTUM_MACHINE_LEARNING_BASE_H 25 #define GENERATIVE_QUANTUM_MACHINE_LEARNING_BASE_H 107 Generative_Quantum_Machine_Learning_Base( std::vector<int> sample_indices_in, std::vector<std::vector<int>> sample_bitstrings_in,
Matrix_real P_star_in,
Matrix_real sigma_in,
int qbit_num_in,
bool use_lookup_table_in, std::vector<std::vector<int>> cliques_in,
bool use_exact, std::map<std::string, Config_Element>& config_in);
257 void generate_clique_circuit(
int i, std::vector<int>& qbits, std::vector<std::vector<int>>& res, std::vector<int>& subset);
264 void MultyRZ(std::vector<int>& qbits);
virtual double optimization_problem(Matrix_real ¶meters) override
The optimization problem of the final optimization.
virtual ~Generative_Quantum_Machine_Learning_Base()
Destructor of the class.
ansatz_type
Type definition of the fifferent types of ansatz.
std::vector< std::vector< int > > cliques
static void optimization_problem_grad_vqe(Matrix_real parameters, void *void_instance, Matrix_real &grad)
Calculate the derivative of the cost function with respect to the free parameters.
void set_gate_structure(std::string filename)
Call to set custom layers to the gate structure that are intended to be used in the GQML process...
double expectation_value_P_star_P_star_exact()
Call to evaluate the expectation value of the square of the distribution.
void generate_circuit(int layers, int inner_blocks)
Call to generate the circuit ansatz.
double Gaussian_kernel(int x, int y, Matrix_real &sigma)
Call to evaluate the value of one gaussian kernel function.
double MMD_of_the_distributions_approx(Matrix &State_right)
Call to evaluate the approximated maximum mean discrepancy of the given distribution and the one crea...
void set_ansatz(ansatz_type ansatz_in)
Call to set the ansatz type.
Generative_Quantum_Machine_Learning_Base()
Nullary constructor of the class.
virtual void optimization_problem_combined_non_static(Matrix_real parameters, void *void_instance, double *f0, Matrix_real &grad) override
Call to calculate both the cost function and the its gradient components.
double MMD_of_the_distributions_exact(Matrix &State_right)
Call to evaluate the maximum mean discrepancy of the given distribution and the one created by our ci...
double ev_P_star_P_star
The expectation value of the the square of the given ditribution (only needed to calculate once) ...
double expectation_value_P_star_P_star_approx()
Call to evaluate the approximated expectation value of the square of the distribution.
std::vector< std::vector< int > > sample_bitstrings
Same as the x_vectors but in binary.
double TV_of_the_distributions(Matrix &State_right)
Call to evaluate the total variational distance of the given distribution and the one created by our ...
void export_current_cost_fnc(double current_minimum, Matrix_real ¶meters) override
Call to print out into a file the current cost function and the second Rényi entropy on the subsyste...
Matrix initial_state
Quantum state used as an initial state in the VQE iterations.
A base class to determine the decomposition of an N-qubit unitary into a sequence of CNOT and U3 gate...
A base class to solve GQML problems This class can be used to approximate a given distribution via a ...
virtual void optimization_problem_combined(Matrix_real parameters, double *f0, Matrix_real grad) override
Call to calculate both the cost function and the its gradient components.
std::vector< std::vector< int > > all_bitstrings
void start_optimization()
Call to start solving the GQML problem.
Double-precision complex matrix (float64).
Matrix_real sigma
Parameter of the Gaussian kernel.
void fill_lookup_table()
Call to calculate and save the values of the gaussian kernel needed for traing.
ansatz_type ansatz
Ansatz type (HEA stands for hardware efficient ansatz)
virtual double optimization_problem_non_static(Matrix_real parameters, void *void_instance) override
The optimization problem of the final optimization.
void set_initial_state(Matrix initial_state_in)
Call to set the initial quantum state in the VQE iterations.
std::vector< std::vector< double > > gaussian_lookup_table
double(Generative_Quantum_Machine_Learning_Base::* MMD_of_the_distributions)(Matrix &)
void generate_clique_circuit(int i, std::vector< int > &qbits, std::vector< std::vector< int >> &res, std::vector< int > &subset)
Call to generate the circuit ansatz for the given clique.
Matrix_real P_star
The distribution we are trying to approximate.
void initialize_zero_state()
Initialize the state used in the quantun circuit.
volatile double current_minimum
The current minimum of the optimization problem.
void MultyRZ(std::vector< int > &qbits)
Call to generate a MultiRZ gate.
std::vector< int > sample_indices
The state vector's corresponding indices of the training data.
Class to store data of complex arrays and its properties.
virtual double optimization_problem(const double *parameters)
This is an abstact definition of function giving the cost functions measuring the entaglement of the ...