Sequential Quantum Gate Decomposer  v1.9.3
Powerful decomposition of general unitarias into one- and two-qubit gates gates
List of all members | Public Member Functions | Public Attributes | Protected Attributes
Adam Class Reference

A class for Adam optimization according to https://towardsdatascience.com/how-to-implement-an-adam-optimizer-from-scratch-76e7b217f1cc. More...

#include <Adam.h>

Public Member Functions

 Adam ()
 Nullary constructor of the class. More...
 
 Adam (double beta1_in, double beta2_in, double epsilon_in, double eta_in)
 Contructor of the class. More...
 
double get_decreasing_test ()
 ????????????? More...
 
void initialize_moment_and_variance (int parameter_num)
 ????????????? More...
 
void reset ()
 ????????????? More...
 
int update (Matrix_real &parameters, Matrix_real &grad, const double &f0)
 Call to set the number of gate blocks to be optimized in one shot. More...
 
virtual ~Adam ()
 Destructor of the class. More...
 

Public Attributes

double eta
 

Protected Attributes

double beta1
 parameter beta1 of the Adam algorithm More...
 
double beta1_t
 beta1^t More...
 
double beta2
 parameter beta2 of the Adam algorithm More...
 
double beta2_t
 beta2^t More...
 
int decreasing_idx = 0
 current index in the decreasing_vec array More...
 
double decreasing_test
 decreasing_test More...
 
matrix_base< intdecreasing_vec
 vector containing 1 if cost function decreased from previous value, and -1 if it increased More...
 
double epsilon
 
int f0_idx
 current index in the f0_vec array More...
 
double f0_mean
 Mean of the latest cost function values to test local minimum. More...
 
double f0_prev
 previous value of the cost function More...
 
Matrix_real f0_vec
 vector stroing the lates values of cost function values to test local minimum More...
 
int64_t iter_t
 iteration index More...
 
Matrix_real mom
 momentum parameter of the Adam algorithm More...
 
int num_threads
 Store the number of OpenMP threads. (During the calculations OpenMP multithreading is turned off.) More...
 
Matrix_real var
 variance parameter of the Adam algorithm More...
 

Detailed Description

A class for Adam optimization according to https://towardsdatascience.com/how-to-implement-an-adam-optimizer-from-scratch-76e7b217f1cc.

Definition at line 36 of file Adam.h.

Constructor & Destructor Documentation

◆ Adam() [1/2]

Adam::Adam ( )

Nullary constructor of the class.

Returns
An instance of the class

Definition at line 31 of file common/Adam.cpp.

Here is the call graph for this function:

◆ Adam() [2/2]

Adam::Adam ( double  beta1_in,
double  beta2_in,
double  epsilon_in,
double  eta_in 
)

Contructor of the class.

Constructor of the class.

Parameters
Umtx_inThe unitary matrix to be decomposed
qbit_num_inThe number of qubits spanning the unitary to be decomposed.
initial_guess_inType to guess the initial values for the optimization. Possible values: ZEROS=0, RANDOM=1, CLOSE_TO_ZERO=2
Returns
An instance of the class

Constructor of the class.

Parameters
???????????????????????????????
???????????????????????????????
???????????????????????????????
Returns
An instance of the class

Definition at line 58 of file common/Adam.cpp.

Here is the call graph for this function:

◆ ~Adam()

Adam::~Adam ( )
virtual

Destructor of the class.

Definition at line 82 of file common/Adam.cpp.

Member Function Documentation

◆ get_decreasing_test()

double Adam::get_decreasing_test ( )

?????????????

Definition at line 273 of file common/Adam.cpp.

◆ initialize_moment_and_variance()

void Adam::initialize_moment_and_variance ( int  parameter_num)

?????????????

Definition at line 123 of file common/Adam.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset()

void Adam::reset ( )

?????????????

Definition at line 90 of file common/Adam.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update()

int Adam::update ( Matrix_real parameters,
Matrix_real grad,
const double &  f0 
)

Call to set the number of gate blocks to be optimized in one shot.

Parameters
optimization_block_inThe number of gate blocks to be optimized in one shot
optimization_block_inThe number of gate blocks to be optimized in one shot
Returns
0 optimizer is in decreasing stage, 1 converged to local minumum

Definition at line 138 of file common/Adam.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ beta1

double Adam::beta1
protected

parameter beta1 of the Adam algorithm

Definition at line 50 of file Adam.h.

◆ beta1_t

double Adam::beta1_t
protected

beta1^t

Definition at line 64 of file Adam.h.

◆ beta2

double Adam::beta2
protected

parameter beta2 of the Adam algorithm

Definition at line 52 of file Adam.h.

◆ beta2_t

double Adam::beta2_t
protected

beta2^t

Definition at line 66 of file Adam.h.

◆ decreasing_idx

int Adam::decreasing_idx = 0
protected

current index in the decreasing_vec array

Definition at line 78 of file Adam.h.

◆ decreasing_test

double Adam::decreasing_test
protected

decreasing_test

Definition at line 80 of file Adam.h.

◆ decreasing_vec

matrix_base<int> Adam::decreasing_vec
protected

vector containing 1 if cost function decreased from previous value, and -1 if it increased

Definition at line 76 of file Adam.h.

◆ epsilon

double Adam::epsilon
protected

Definition at line 54 of file Adam.h.

◆ eta

double Adam::eta

Definition at line 42 of file Adam.h.

◆ f0_idx

int Adam::f0_idx
protected

current index in the f0_vec array

Definition at line 73 of file Adam.h.

◆ f0_mean

double Adam::f0_mean
protected

Mean of the latest cost function values to test local minimum.

Definition at line 71 of file Adam.h.

◆ f0_prev

double Adam::f0_prev
protected

previous value of the cost function

Definition at line 82 of file Adam.h.

◆ f0_vec

Matrix_real Adam::f0_vec
protected

vector stroing the lates values of cost function values to test local minimum

Definition at line 69 of file Adam.h.

◆ iter_t

int64_t Adam::iter_t
protected

iteration index

Definition at line 61 of file Adam.h.

◆ mom

Matrix_real Adam::mom
protected

momentum parameter of the Adam algorithm

Definition at line 57 of file Adam.h.

◆ num_threads

int Adam::num_threads
protected

Store the number of OpenMP threads. (During the calculations OpenMP multithreading is turned off.)

Definition at line 48 of file Adam.h.

◆ var

Matrix_real Adam::var
protected

variance parameter of the Adam algorithm

Definition at line 59 of file Adam.h.


The documentation for this class was generated from the following files: