MCPcopy Create free account
hub / github.com/Derious/cuMPC / test_sparseLM_T

Function test_sparseLM_T

dependence/eigen-3.4.0/test/sparseLM.cpp:129–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127
128template<typename T>
129void test_sparseLM_T()
130{
131 typedef Matrix<T,Dynamic,1> VectorType;
132
133 int inputs = 10;
134 int values = 2000;
135 sparseGaussianTest<T> sparse_gaussian(inputs, values);
136 VectorType uv(inputs),uv_ref(inputs);
137 VectorType x(values);
138 // Generate the reference solution
139 uv_ref << -2, 1, 4 ,8, 6, 1.8, 1.2, 1.1, 1.9 , 3;
140 //Generate the reference data points
141 x.setRandom();
142 x = 10*x;
143 x.array() += 10;
144 sparse_gaussian.initPoints(uv_ref, x);
145
146
147 // Generate the initial parameters
148 VectorBlock<VectorType> u(uv, 0, inputs/2);
149 VectorBlock<VectorType> v(uv, inputs/2, inputs/2);
150 v.setOnes();
151 //Generate u or Solve for u from v
152 u.setOnes();
153
154 // Solve the optimization problem
155 LevenbergMarquardt<sparseGaussianTest<T> > lm(sparse_gaussian);
156 int info;
157// info = lm.minimize(uv);
158
159 VERIFY_IS_EQUAL(info,1);
160 // Do a step by step solution and save the residual
161 int maxiter = 200;
162 int iter = 0;
163 MatrixXd Err(values, maxiter);
164 MatrixXd Mod(values, maxiter);
165 LevenbergMarquardtSpace::Status status;
166 status = lm.minimizeInit(uv);
167 if (status==LevenbergMarquardtSpace::ImproperInputParameters)
168 return ;
169
170}
171EIGEN_DECLARE_TEST(sparseLM)
172{
173 CALL_SUBTEST_1(test_sparseLM_T<double>());

Callers

nothing calls this directly

Calls 3

arrayMethod · 0.45
initPointsMethod · 0.45
minimizeInitMethod · 0.45

Tested by

no test coverage detected