Sequential Quantum Gate Decomposer  v1.9.3
Powerful decomposition of general unitarias into one- and two-qubit gates gates
Powells_method.h
Go to the documentation of this file.
1 /*
2 Copyright 2020 Peter Rakyta, Ph.D.
3 
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 
16 */
17 
18 # ifndef __POWELLS_METHOD__H
19 # define __POWELLS_METHOD__H
20 
21 #include "matrix_real.h"
22 #include <vector>
23 #include <random>
28  protected:
31 
33 
35 
37  double (*costfnc) (Matrix_real x, void * params);
38 
40  void* meta_data;
41 
42  protected:
43  double direction(double s,Matrix_real x);
44 
45  void bracket(double x1, double h, double& a, double& b, Matrix_real x);
46 
47  void search(double a, double b, double& s, double& f_val, double tol, Matrix_real x);
48  public:
49  double Start_Optimization(Matrix_real& x, long max_iter);
50 
51  Powells_method(double (* f_pointer) (Matrix_real, void *), void* meta_data_in);
52 
54 };
55 
56 
57 # endif
void search(double a, double b, double &s, double &f_val, double tol, Matrix_real x)
double(* costfnc)(Matrix_real x, void *params)
function pointer to evaluate the cost function and its gradient vector
Matrix_real v
Powells_method(double(*f_pointer)(Matrix_real, void *), void *meta_data_in)
Constructor of the class.
void bracket(double x1, double h, double &a, double &b, Matrix_real x)
Matrix_real u
double Start_Optimization(Matrix_real &x, long max_iter)
~Powells_method()
Destructor of the class.
A class implementing the Powells-algorithm as seen in: https://academic.oup.com/comjnl/article-abstra...
double direction(double s, Matrix_real x)
void * meta_data
additional data needed to evaluate the cost function
int variable_num
number of independent variables in the problem
Class to store data of complex arrays and its properties.
Definition: matrix_real.h:39