sparseLM.cpp File Reference
#include <iostream>
#include <fstream>
#include <iomanip>
#include "main.h"
#include <Eigen/LevenbergMarquardt>

Classes

struct  sparseGaussianTest< Scalar >
 

Functions

template<typename T >
void test_sparseLM_T ()
 
 EIGEN_DECLARE_TEST (sparseLM)
 

Function Documentation

◆ EIGEN_DECLARE_TEST()

EIGEN_DECLARE_TEST ( sparseLM  )
148  {
149  CALL_SUBTEST_1(test_sparseLM_T<double>());
150 
151  // CALL_SUBTEST_2(test_sparseLM_T<std::complex<double>());
152 }
#define CALL_SUBTEST_1(FUNC)
Definition: split_test_helper.h:4

References CALL_SUBTEST_1.

◆ test_sparseLM_T()

template<typename T >
void test_sparseLM_T ( )
110  {
112 
113  int inputs = 10;
114  int values = 2000;
115  sparseGaussianTest<T> sparse_gaussian(inputs, values);
116  VectorType uv(inputs), uv_ref(inputs);
117  VectorType x(values);
118  // Generate the reference solution
119  uv_ref << -2, 1, 4, 8, 6, 1.8, 1.2, 1.1, 1.9, 3;
120  // Generate the reference data points
121  x.setRandom();
122  x = 10 * x;
123  x.array() += 10;
124  sparse_gaussian.initPoints(uv_ref, x);
125 
126  // Generate the initial parameters
127  VectorBlock<VectorType> u(uv, 0, inputs / 2);
128  VectorBlock<VectorType> v(uv, inputs / 2, inputs / 2);
129  v.setOnes();
130  // Generate u or Solve for u from v
131  u.setOnes();
132 
133  // Solve the optimization problem
134  LevenbergMarquardt<sparseGaussianTest<T> > lm(sparse_gaussian);
135  int info;
136  // info = lm.minimize(uv);
137 
138  VERIFY_IS_EQUAL(info, 1);
139  // Do a step by step solution and save the residual
140  int maxiter = 200;
141  int iter = 0;
142  MatrixXd Err(values, maxiter);
143  MatrixXd Mod(values, maxiter);
145  status = lm.minimizeInit(uv);
147 }
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
Performs non linear optimization over a non-linear function, using a variant of the Levenberg Marquar...
Definition: LevenbergMarquardt/LevenbergMarquardt.h:102
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
Expression of a fixed-size or dynamic-size sub-vector.
Definition: VectorBlock.h:58
int info
Definition: level2_cplx_impl.h:39
#define VERIFY_IS_EQUAL(a, b)
Definition: main.h:367
Status
Definition: LevenbergMarquardt/LevenbergMarquardt.h:27
@ ImproperInputParameters
Definition: LevenbergMarquardt/LevenbergMarquardt.h:30
list x
Definition: plotDoE.py:28
Definition: fft_test_shared.h:66
Definition: sparseLM.cpp:21

References Eigen::LevenbergMarquardtSpace::ImproperInputParameters, info, sparseGaussianTest< Scalar >::initPoints(), Eigen::LevenbergMarquardt< FunctorType_ >::minimizeInit(), v, VERIFY_IS_EQUAL, and plotDoE::x.