Sequential Quantum Gate Decomposer  v1.9.3
Powerful decomposition of general unitarias into one- and two-qubit gates gates
Variational_Quantum_Eigensolver_Base.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 */
24 #ifndef VARIATIONAL_QUANTUM_EIGENSOLVER_BASE_H
25 #define VARIATIONAL_QUANTUM_EIGENSOLVER_BASE_H
26 
27 #include "Optimization_Interface.h"
28 
31 
32 
33 
34 
40 public:
41 
42 
43 private:
44 
47 
50 
53 
54 public:
55 
56 
62 
63 
71 Variational_Quantum_Eigensolver_Base( Matrix_sparse Hamiltonian_in, int qbit_num_in, std::map<std::string, Config_Element>& config_in, int accelerator_num=0);
72 
77 
84 QGD_Complex16 Expectation_value_of_energy(Matrix& State_left, Matrix& State_right);
85 
86 
93 double Expectation_value_of_energy_real(Matrix& State_left, Matrix& State_right);
94 
95 
96 
102 virtual double optimization_problem(Matrix_real& parameters) override;
103 
104 
111 virtual double optimization_problem_non_static( Matrix_real parameters, void* void_instance) override;
112 
113 
114 #ifdef __GROQ__
115 
121 double optimization_problem_Groq(Matrix_real& parameters, int chosen_device) ;
122 #endif
123 
124 
125 
131 double optimization_problem( double* parameters);
132 
133 
141 virtual void optimization_problem_combined_non_static( Matrix_real parameters, void* void_instance, double* f0, Matrix_real& grad ) override;
142 
143 
150 virtual void optimization_problem_combined( Matrix_real parameters, double* f0, Matrix_real grad ) override;
151 
152 
159 static void optimization_problem_grad_vqe( Matrix_real parameters, void* void_instance, Matrix_real& grad );
160 
161 
165 void initialize_zero_state();
166 
167 
171 void start_optimization();
172 
173 
178 void set_ansatz(ansatz_type ansatz_in);
179 
180 
186 void generate_circuit( int layers, int inner_blocks );
187 
188 
193 void set_gate_structure( std::string filename );
194 
195 
200 void set_initial_state( Matrix initial_state_in );
201 
202 
203 
204 };
205 
206 #endif
void set_gate_structure(std::string filename)
Call to set custom layers to the gate structure that are intended to be used in the VQE process...
ansatz_type ansatz
Ansatz type (HEA stands for hardware efficient ansatz)
Variational_Quantum_Eigensolver_Base()
Nullary constructor of the class.
Class to store data of complex arrays and its properties.
Definition: matrix_sparse.h:38
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.
Matrix initial_state
Quantum state used as an initial state in the VQE iterations.
virtual double optimization_problem_non_static(Matrix_real parameters, void *void_instance) override
The optimization problem of the final optimization.
void generate_circuit(int layers, int inner_blocks)
Call to generate the circuit ansatz.
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.
int accelerator_num
number of utilized accelerators
void start_optimization()
Call to start solving the VQE problem to get the approximation for the ground state.
ansatz_type
Type definition of the fifferent types of ansatz.
A base class to determine the decomposition of an N-qubit unitary into a sequence of CNOT and U3 gate...
QGD_Complex16 Expectation_value_of_energy(Matrix &State_left, Matrix &State_right)
Call to evaluate the expectation value of the energy <State_left| H | State_right>.
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.
Structure type representing complex numbers in the SQUANDER package.
Definition: QGDTypes.h:38
void set_initial_state(Matrix initial_state_in)
Call to set the initial quantum state in the VQE iterations.
A base class to solve VQE problems This class can be used to approximate the ground state of the inpu...
void set_ansatz(ansatz_type ansatz_in)
Call to set the ansatz type.
Class to store data of complex arrays and its properties.
Definition: matrix.h:38
Matrix_sparse Hamiltonian
The Hamiltonian of the system.
double Expectation_value_of_energy_real(Matrix &State_left, Matrix &State_right)
Call to evaluate the expectation value of the energy <State_left| H | State_right>.
void initialize_zero_state()
Initialize the state used in the quantun circuit.
Class to store data of complex arrays and its properties.
Definition: matrix_real.h:39
virtual ~Variational_Quantum_Eigensolver_Base()
Destructor of the class.
virtual double optimization_problem(Matrix_real &parameters) override
The optimization problem of the final optimization.