my_functor Struct Reference
+ Inheritance diagram for my_functor:

Public Member Functions

 my_functor (void)
 
int operator() (const VectorXd &x, VectorXd &fvec) const
 
int actual_df (const VectorXd &x, MatrixXd &fjac) const
 
- Public Member Functions inherited from Functor< double >
 Functor ()
 
 Functor (int inputs, int values)
 
 Functor ()
 
 Functor (int inputs_, int values_)
 
int inputs () const
 
int inputs () const
 
int values () const
 
int values () const
 

Additional Inherited Members

- Public Types inherited from Functor< double >
enum  
 
enum  
 
typedef double Scalar
 
typedef double Scalar
 
typedef Matrix< Scalar, InputsAtCompileTime, 1 > InputType
 
typedef Matrix< Scalar, InputsAtCompileTime, 1 > InputType
 
typedef Matrix< Scalar, ValuesAtCompileTime, 1 > ValueType
 
typedef Matrix< Scalar, ValuesAtCompileTime, 1 > ValueType
 
typedef Matrix< Scalar, ValuesAtCompileTime, InputsAtCompileTimeJacobianType
 
typedef Matrix< Scalar, ValuesAtCompileTime, InputsAtCompileTimeJacobianType
 
- Public Attributes inherited from Functor< double >
const int m_inputs
 
int m_inputs
 
const int m_values
 
int m_values
 

Constructor & Destructor Documentation

◆ my_functor()

my_functor::my_functor ( void  )
inline

Member Function Documentation

◆ actual_df()

int my_functor::actual_df ( const VectorXd &  x,
MatrixXd &  fjac 
) const
inline
45  {
46  double tmp1, tmp2, tmp3, tmp4;
47  for (int i = 0; i < values(); i++) {
48  tmp1 = i + 1;
49  tmp2 = 16 - i - 1;
50  tmp3 = (i >= 8) ? tmp2 : tmp1;
51  tmp4 = (x[1] * tmp2 + x[2] * tmp3);
52  tmp4 = tmp4 * tmp4;
53  fjac(i, 0) = -1;
54  fjac(i, 1) = tmp1 * tmp2 / tmp4;
55  fjac(i, 2) = tmp1 * tmp3 / tmp4;
56  }
57  return 0;
58  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
list x
Definition: plotDoE.py:28
int values() const
Definition: NonLinearOptimization.cpp:110

References i, Functor< double >::values(), and plotDoE::x.

Referenced by test_central(), and test_forward().

◆ operator()()

int my_functor::operator() ( const VectorXd &  x,
VectorXd &  fvec 
) const
inline
31  {
32  double tmp1, tmp2, tmp3;
33  double y[15] = {1.4e-1, 1.8e-1, 2.2e-1, 2.5e-1, 2.9e-1, 3.2e-1, 3.5e-1, 3.9e-1,
34  3.7e-1, 5.8e-1, 7.3e-1, 9.6e-1, 1.34, 2.1, 4.39};
35 
36  for (int i = 0; i < values(); i++) {
37  tmp1 = i + 1;
38  tmp2 = 16 - i - 1;
39  tmp3 = (i >= 8) ? tmp2 : tmp1;
40  fvec[i] = y[i] - (x[0] + tmp1 / (x[1] * tmp2 + x[2] * tmp3));
41  }
42  return 0;
43  }
Scalar * y
Definition: level1_cplx_impl.h:128

References i, Functor< double >::values(), plotDoE::x, and y.


The documentation for this struct was generated from the following file: