// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Desire Nuentsa <desire.nuentsa_wakam@inria.fr> // Copyright (C) 2012 Gael Guennebaud <gael.guennebaud@inria.fr> // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include <iostream> #include <fstream> #include <iomanip>
int inputs = 10; int values = 2000;
sparseGaussianTest<T> sparse_gaussian(inputs, values);
VectorType uv(inputs),uv_ref(inputs);
VectorType x(values); // Generate the reference solution
uv_ref << -2, 1, 4 ,8, 6, 1.8, 1.2, 1.1, 1.9 , 3; //Generate the reference data points
x.setRandom();
x = 10*x;
x.array() += 10;
sparse_gaussian.initPoints(uv_ref, x);
// Generate the initial parameters
VectorBlock<VectorType> u(uv, 0, inputs/2);
VectorBlock<VectorType> v(uv, inputs/2, inputs/2);
v.setOnes(); //Generate u or Solve for u from v
u.setOnes();
// Solve the optimization problem
LevenbergMarquardt<sparseGaussianTest<T> > lm(sparse_gaussian); int info; // info = lm.minimize(uv);
VERIFY_IS_EQUAL(info,1); // Do a step by step solution and save the residual int maxiter = 200; int iter = 0;
MatrixXd Err(values, maxiter);
MatrixXd Mod(values, maxiter);
LevenbergMarquardtSpace::Status status;
status = lm.minimizeInit(uv); if (status==LevenbergMarquardtSpace::ImproperInputParameters) return ;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.