Quantum Gate Decomposer  v1.3
Powerful decomposition of almost any unitary into U3 and CNOT gates
List of all members | Public Member Functions | Protected Attributes
functor_grad< decomp_class > Class Template Reference

Function operator class to calculate the gradient components of the cost function in parallel. More...

#include <Functor_Cost_Function_Gradient.h>

Public Member Functions

 functor_grad (const gsl_vector *parameters_in, decomp_class *instance_in, gsl_vector *f_in, double *f0_in, double dparam_in)
 Constructor of the class. More...
 
void operator() (int i) const
 Operator to calculate a gradient component of a cost function labeled by index i. More...
 

Protected Attributes

double dparam
 the difference in one direction in the parameter for the gradient calculaiton More...
 
gsl_vector * f
 A GNU Scientific Library vector containing the calculated values of the cost function at displaced points x = x0+dparam. More...
 
double * f0
 The value of the cost function at parameters_in. More...
 
decomp_class * instance
 A pointer pointing to the instance of a class Sub_Matrix_Decomposition. More...
 
const gsl_vector * parameters
 A GNU Scientific Library vector containing the free parameters to be optimized. More...
 

Detailed Description

template<typename decomp_class>
class functor_grad< decomp_class >

Function operator class to calculate the gradient components of the cost function in parallel.

Definition at line 34 of file Functor_Cost_Function_Gradient.h.

Constructor & Destructor Documentation

◆ functor_grad()

template<typename decomp_class >
functor_grad< decomp_class >::functor_grad ( const gsl_vector *  parameters_in,
decomp_class *  instance_in,
gsl_vector *  f_in,
double *  f0_in,
double  dparam_in 
)

Constructor of the class.

Parameters
parameters_inA GNU Scientific Library vector containing the free parameters to be optimized.
instance_inA pointer pointing to the instance of a class Sub_Matrix_Decomposition.
grad_inA GNU Scientific Library vector containing the calculated gradient components.
f0_inThe value of the cost function at parameters_in.
Returns
Returns with the instance of the class.
Parameters
parameters_inA GNU Scientific Library vector containing the free parameters to be optimized.
instance_inA pointer pointing to the instance of a class Sub_Matrix_Decomposition.
f_inA GNU Scientific Library vector to store the calculated function values at the displaced points x.
f0_inThe value of the cost function at parameters_in.
Returns
Returns with the instance of the class.

Definition at line 142 of file Functor_Cost_Function_Gradient.cpp.

Member Function Documentation

◆ operator()()

template<typename decomp_class >
void functor_grad< decomp_class >::operator() ( int  i) const

Operator to calculate a gradient component of a cost function labeled by index i.

Parameters
iThe index labeling the component of the gradien to be calculated.
iThe index labeling the component of the gradient to be calculated.

Definition at line 160 of file Functor_Cost_Function_Gradient.cpp.

Member Data Documentation

◆ dparam

template<typename decomp_class >
double functor_grad< decomp_class >::dparam
protected

the difference in one direction in the parameter for the gradient calculaiton

Definition at line 47 of file Functor_Cost_Function_Gradient.h.

◆ f

template<typename decomp_class >
gsl_vector* functor_grad< decomp_class >::f
protected

A GNU Scientific Library vector containing the calculated values of the cost function at displaced points x = x0+dparam.

Definition at line 43 of file Functor_Cost_Function_Gradient.h.

◆ f0

template<typename decomp_class >
double* functor_grad< decomp_class >::f0
protected

The value of the cost function at parameters_in.

Definition at line 45 of file Functor_Cost_Function_Gradient.h.

◆ instance

template<typename decomp_class >
decomp_class* functor_grad< decomp_class >::instance
protected

A pointer pointing to the instance of a class Sub_Matrix_Decomposition.

Definition at line 41 of file Functor_Cost_Function_Gradient.h.

◆ parameters

template<typename decomp_class >
const gsl_vector* functor_grad< decomp_class >::parameters
protected

A GNU Scientific Library vector containing the free parameters to be optimized.

Definition at line 39 of file Functor_Cost_Function_Gradient.h.


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