thurber_functor Struct Reference
+ Inheritance diagram for thurber_functor:

Public Member Functions

 thurber_functor (void)
 
int operator() (const VectorXd &b, VectorXd &fvec)
 
int df (const VectorXd &b, MatrixXd &fjac)
 
 thurber_functor (void)
 
int operator() (const VectorXd &b, VectorXd &fvec)
 
int df (const VectorXd &b, MatrixXd &fjac)
 
- Public Member Functions inherited from Eigen::DenseFunctor< double >
 DenseFunctor ()
 
 DenseFunctor (int inputs, int values)
 
int inputs () const
 
int values () 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
 

Static Public Attributes

static const double _x [37]
 
static const double _y [37]
 

Additional Inherited Members

- Public Types inherited from Eigen::DenseFunctor< double >
enum  
 
typedef double Scalar
 
typedef Matrix< Scalar, InputsAtCompileTime, 1 > InputType
 
typedef Matrix< Scalar, ValuesAtCompileTime, 1 > ValueType
 
typedef Matrix< Scalar, ValuesAtCompileTime, InputsAtCompileTimeJacobianType
 
typedef ColPivHouseholderQR< JacobianTypeQRSolver
 
- 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 Eigen::DenseFunctor< double >
const int m_inputs
 
const int m_values
 
- Public Attributes inherited from Functor< double >
const int m_inputs
 
int m_inputs
 
const int m_values
 
int m_values
 

Constructor & Destructor Documentation

◆ thurber_functor() [1/2]

thurber_functor::thurber_functor ( void  )
inline

◆ thurber_functor() [2/2]

thurber_functor::thurber_functor ( void  )
inline

Member Function Documentation

◆ df() [1/2]

int thurber_functor::df ( const VectorXd &  b,
MatrixXd &  fjac 
)
inline
1268  {
1269  assert(b.size() == 7);
1270  assert(fjac.rows() == 37);
1271  assert(fjac.cols() == 7);
1272  for (int i = 0; i < 37; i++) {
1273  double x = _x[i], xx = x * x, xxx = xx * x;
1274  double fact = 1. / (1. + b[4] * x + b[5] * xx + b[6] * xxx);
1275  fjac(i, 0) = 1. * fact;
1276  fjac(i, 1) = x * fact;
1277  fjac(i, 2) = xx * fact;
1278  fjac(i, 3) = xxx * fact;
1279  fact = -(b[0] + b[1] * x + b[2] * xx + b[3] * xxx) * fact * fact;
1280  fjac(i, 4) = x * fact;
1281  fjac(i, 5) = xx * fact;
1282  fjac(i, 6) = xxx * fact;
1283  }
1284  return 0;
1285  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
#define assert(e,...)
Definition: Logger.h:744
Scalar * b
Definition: benchVecAdd.cpp:17
list x
Definition: plotDoE.py:28
static const double _x[37]
Definition: levenberg_marquardt.cpp:1255

References _x, assert, b, i, and plotDoE::x.

◆ df() [2/2]

int thurber_functor::df ( const VectorXd &  b,
MatrixXd &  fjac 
)
inline
1571  {
1572  assert(b.size() == 7);
1573  assert(fjac.rows() == 37);
1574  assert(fjac.cols() == 7);
1575  for (int i = 0; i < 37; i++) {
1576  double x = _x[i], xx = x * x, xxx = xx * x;
1577  double fact = 1. / (1. + b[4] * x + b[5] * xx + b[6] * xxx);
1578  fjac(i, 0) = 1. * fact;
1579  fjac(i, 1) = x * fact;
1580  fjac(i, 2) = xx * fact;
1581  fjac(i, 3) = xxx * fact;
1582  fact = -(b[0] + b[1] * x + b[2] * xx + b[3] * xxx) * fact * fact;
1583  fjac(i, 4) = x * fact;
1584  fjac(i, 5) = xx * fact;
1585  fjac(i, 6) = xxx * fact;
1586  }
1587  return 0;
1588  }

References _x, assert, b, i, and plotDoE::x.

◆ operator()() [1/2]

int thurber_functor::operator() ( const VectorXd &  b,
VectorXd &  fvec 
)
inline
1257  {
1258  // int called=0; printf("call hahn1_functor with iflag=%d, called=%d\n", iflag, called); if (iflag==1)
1259  // called++;
1260  assert(b.size() == 7);
1261  assert(fvec.size() == 37);
1262  for (int i = 0; i < 37; i++) {
1263  double x = _x[i], xx = x * x, xxx = xx * x;
1264  fvec[i] = (b[0] + b[1] * x + b[2] * xx + b[3] * xxx) / (1. + b[4] * x + b[5] * xx + b[6] * xxx) - _y[i];
1265  }
1266  return 0;
1267  }
static const double _y[37]
Definition: levenberg_marquardt.cpp:1256

References _x, _y, assert, b, i, and plotDoE::x.

◆ operator()() [2/2]

int thurber_functor::operator() ( const VectorXd &  b,
VectorXd &  fvec 
)
inline
1560  {
1561  // int called=0; printf("call hahn1_functor with iflag=%d, called=%d\n", iflag, called); if (iflag==1)
1562  // called++;
1563  assert(b.size() == 7);
1564  assert(fvec.size() == 37);
1565  for (int i = 0; i < 37; i++) {
1566  double x = _x[i], xx = x * x, xxx = xx * x;
1567  fvec[i] = (b[0] + b[1] * x + b[2] * xx + b[3] * xxx) / (1. + b[4] * x + b[5] * xx + b[6] * xxx) - _y[i];
1568  }
1569  return 0;
1570  }

References _x, _y, assert, b, i, and plotDoE::x.

Member Data Documentation

◆ _x

const double thurber_functor::_x
static
Initial value:
= {-3.067E0, -2.981E0, -2.921E0, -2.912E0, -2.840E0, -2.797E0, -2.702E0, -2.699E0,
-2.633E0, -2.481E0, -2.363E0, -2.322E0, -1.501E0, -1.460E0, -1.274E0, -1.212E0,
-1.100E0, -1.046E0, -0.915E0, -0.714E0, -0.566E0, -0.545E0, -0.400E0, -0.309E0,
-0.109E0, -0.103E0, 0.010E0, 0.119E0, 0.377E0, 0.790E0, 0.963E0, 1.006E0,
1.115E0, 1.572E0, 1.841E0, 2.047E0, 2.200E0}

Referenced by df(), and operator()().

◆ _y

const double thurber_functor::_y
static
Initial value:
= {
80.574E0, 84.248E0, 87.264E0, 87.195E0, 89.076E0, 89.608E0, 89.868E0, 90.101E0,
92.405E0, 95.854E0, 100.696E0, 101.060E0, 401.672E0, 390.724E0, 567.534E0, 635.316E0,
733.054E0, 759.087E0, 894.206E0, 990.785E0, 1090.109E0, 1080.914E0, 1122.643E0, 1178.351E0,
1260.531E0, 1273.514E0, 1288.339E0, 1327.543E0, 1353.863E0, 1414.509E0, 1425.208E0, 1421.384E0,
1442.962E0, 1464.350E0, 1468.705E0, 1447.894E0, 1457.628E0}

Referenced by operator()().


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