DenseLM< Scalar > Struct Template Reference
+ Inheritance diagram for DenseLM< Scalar >:

Public Types

typedef DenseFunctor< ScalarBase
 
typedef Base::JacobianType JacobianType
 
typedef Matrix< Scalar, Dynamic, 1 > VectorType
 
- Public Types inherited from Eigen::DenseFunctor< Scalar >
enum  
 
typedef Scalar Scalar
 
typedef Matrix< Scalar, InputsAtCompileTime, 1 > InputType
 
typedef Matrix< Scalar, ValuesAtCompileTime, 1 > ValueType
 
typedef Matrix< Scalar, ValuesAtCompileTime, InputsAtCompileTimeJacobianType
 
typedef ColPivHouseholderQR< JacobianTypeQRSolver
 

Public Member Functions

 DenseLM (int n, int m)
 
VectorType model (const VectorType &uv, VectorType &x)
 
void initPoints (VectorType &uv_ref, VectorType &x)
 
int operator() (const VectorType &uv, VectorType &fvec)
 
int df (const VectorType &uv, JacobianType &fjac)
 
- Public Member Functions inherited from Eigen::DenseFunctor< Scalar >
 DenseFunctor ()
 
 DenseFunctor (int inputs, int values)
 
int inputs () const
 
int values () const
 

Public Attributes

VectorType m_x
 
VectorType m_y
 
- Public Attributes inherited from Eigen::DenseFunctor< Scalar >
const int m_inputs
 
const int m_values
 

Member Typedef Documentation

◆ Base

template<typename Scalar >
typedef DenseFunctor<Scalar> DenseLM< Scalar >::Base

◆ JacobianType

template<typename Scalar >
typedef Base::JacobianType DenseLM< Scalar >::JacobianType

◆ VectorType

template<typename Scalar >
typedef Matrix<Scalar, Dynamic, 1> DenseLM< Scalar >::VectorType

Constructor & Destructor Documentation

◆ DenseLM()

template<typename Scalar >
DenseLM< Scalar >::DenseLM ( int  n,
int  m 
)
inline
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
int * m
Definition: level2_cplx_impl.h:294

Member Function Documentation

◆ df()

template<typename Scalar >
int DenseLM< Scalar >::df ( const VectorType uv,
JacobianType fjac 
)
inline
67  {
68  int m = Base::values();
69  int n = Base::inputs();
70  eigen_assert(n == uv.size());
71  eigen_assert(fjac.rows() == m);
72  eigen_assert(fjac.cols() == n);
73  int half = n / 2;
76  for (int j = 0; j < m; j++) {
77  for (int i = 0; i < half; i++) {
78  fjac.coeffRef(j, i) = -std::exp(-(m_x(j) - i) * (m_x(j) - i) / (v(i) * v(i)));
79  fjac.coeffRef(j, i + half) = -2. * u(i) * (m_x(j) - i) * (m_x(j) - i) / (std::pow(v(i), 3)) *
80  std::exp(-(m_x(j) - i) * (m_x(j) - i) / (v(i) * v(i)));
81  }
82  }
83  return 0;
84  }
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
int i
Definition: BiCGSTAB_step_by_step.cpp:9
#define eigen_assert(x)
Definition: Macros.h:910
Expression of a fixed-size or dynamic-size sub-vector.
Definition: VectorBlock.h:58
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 exp(const bfloat16 &a)
Definition: BFloat16.h:615
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 pow(const bfloat16 &a, const bfloat16 &b)
Definition: BFloat16.h:625
VectorType m_x
Definition: denseLM.cpp:85
int inputs() const
Definition: LevenbergMarquardt/LevenbergMarquardt.h:56
int values() const
Definition: LevenbergMarquardt/LevenbergMarquardt.h:57
Definition: Half.h:139
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References Eigen::Matrix< Scalar_, Rows_, Cols_, Options_, MaxRows_, MaxCols_ >::coeffRef(), Eigen::PlainObjectBase< Derived >::cols(), eigen_assert, Eigen::bfloat16_impl::exp(), i, j, m, n, Eigen::bfloat16_impl::pow(), Eigen::PlainObjectBase< Derived >::rows(), and v.

◆ initPoints()

template<typename Scalar >
void DenseLM< Scalar >::initPoints ( VectorType uv_ref,
VectorType x 
)
inline
44  {
45  m_x = x;
46  m_y = this->model(uv_ref, x);
47  }
list x
Definition: plotDoE.py:28
VectorType model(const VectorType &uv, VectorType &x)
Definition: denseLM.cpp:28
VectorType m_y
Definition: denseLM.cpp:85

References plotDoE::x.

Referenced by test_denseLM_T().

◆ model()

template<typename Scalar >
VectorType DenseLM< Scalar >::model ( const VectorType uv,
VectorType x 
)
inline
28  {
29  VectorType y; // Should change to use expression template
30  int m = Base::values();
31  int n = Base::inputs();
32  eigen_assert(uv.size() % 2 == 0);
33  eigen_assert(uv.size() == n);
34  eigen_assert(x.size() == m);
35  y.setZero(m);
36  int half = n / 2;
39  for (int j = 0; j < m; j++) {
40  for (int i = 0; i < half; i++) y(j) += u(i) * std::exp(-(x(j) - i) * (x(j) - i) / (v(i) * v(i)));
41  }
42  return y;
43  }
Scalar * y
Definition: level1_cplx_impl.h:128
Definition: fft_test_shared.h:66

References eigen_assert, Eigen::bfloat16_impl::exp(), i, j, m, n, v, plotDoE::x, and y.

◆ operator()()

template<typename Scalar >
int DenseLM< Scalar >::operator() ( const VectorType uv,
VectorType fvec 
)
inline
49  {
50  int m = Base::values();
51  int n = Base::inputs();
52  eigen_assert(uv.size() % 2 == 0);
53  eigen_assert(uv.size() == n);
54  eigen_assert(fvec.size() == m);
55  int half = n / 2;
58  for (int j = 0; j < m; j++) {
59  fvec(j) = m_y(j);
60  for (int i = 0; i < half; i++) {
61  fvec(j) -= u(i) * std::exp(-(m_x(j) - i) * (m_x(j) - i) / (v(i) * v(i)));
62  }
63  }
64 
65  return 0;
66  }

References eigen_assert, Eigen::bfloat16_impl::exp(), i, j, m, n, and v.

Member Data Documentation

◆ m_x

template<typename Scalar >
VectorType DenseLM< Scalar >::m_x

◆ m_y

template<typename Scalar >
VectorType DenseLM< Scalar >::m_y

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