Eigen: Added non linear functor

git-svn-id: svn://ultimatepp.org/upp/trunk@6022 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
koldo 2013-05-02 19:03:11 +00:00
parent 2075e5a9cd
commit d4e4fefc0b
3 changed files with 30 additions and 10 deletions

View file

@ -21,10 +21,33 @@
//#undef Success
#include "Eigen/Eigen"
#include <plugin/Eigen/unsupported/Eigen/NonLinearOptimization>
NAMESPACE_UPP
using namespace Eigen;
template<typename _Scalar, ptrdiff_t nx = Dynamic, ptrdiff_t ny = Dynamic>
struct NonLinearOptimizationFunctor {
typedef _Scalar Scalar;
enum {
InputsAtCompileTime = nx,
ValuesAtCompileTime = ny
};
typedef Matrix<double, InputsAtCompileTime, 1> InputType;
typedef Matrix<double, ValuesAtCompileTime, 1> ValueType;
typedef Matrix<double, ValuesAtCompileTime, InputsAtCompileTime> JacobianType;
int64 unknowns, datasetLen;
NonLinearOptimizationFunctor() : unknowns(InputsAtCompileTime), datasetLen(ValuesAtCompileTime) {}
NonLinearOptimizationFunctor(int unknowns, int datasetLen) : unknowns(unknowns), datasetLen(datasetLen) {}
ptrdiff_t inputs() const {return ptrdiff_t(unknowns);}
ptrdiff_t values() const {return ptrdiff_t(datasetLen);}
virtual void operator() (const InputType& x, ValueType* v, JacobianType* j = 0) const {};
};
template <class T>
void Xmlize(XmlIO &xml, Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> &mat) {
Size_<int64> sz(mat.cols(), mat.rows());

View file

@ -458,7 +458,7 @@ struct solve_retval<ColPivHouseholderQR<_MatrixType>, Rhs>
{
eigen_assert(rhs().rows() == dec().rows());
const int cols = dec().cols(),
const ptrdiff_t cols = dec().cols(),
nonzero_pivots = dec().nonzeroPivots();
if(nonzero_pivots == 0)

View file

@ -25,11 +25,11 @@ is a simple weak copyleft license. Common questions about the
MPL2 are answered in the official ][^http`:`/`/www`.mozilla`.org`/MPL`/2`.0`/FAQ`.html^2 M
PL2 FAQ][2 .]&]
[s0;#2 &]
[s0;# [2 In addition Bazaar/Eigen package includes a sample package
(Eigen`_demo) to ease even more its use for U`+`+ users. It has
many samples from Eigen library and nonlinear equation solving
and optimization like ][^http`:`/`/www`.itl`.nist`.gov`/div898`/strd`/nls`/data`/eckerle4`.shtml^2 E
ckerle4][2 and ][^http`:`/`/www`.itl`.nist`.gov`/div898`/strd`/nls`/data`/thurber`.shtml^2 T
[s0;# [2 Bazaar/Eigen package includes a sample package (Eigen`_demo)
to ease its use for U`+`+ users. It has many samples from Eigen
library and nonlinear equation solving and optimization like
][^http`:`/`/www`.itl`.nist`.gov`/div898`/strd`/nls`/data`/eckerle4`.shtml^2 Eckerl
e4][2 and ][^http`:`/`/www`.itl`.nist`.gov`/div898`/strd`/nls`/data`/thurber`.shtml^2 T
hurber][2 (see the graphs).]&]
[s0;#2 &]
[s0;= [2
@ -99,9 +99,6 @@ hurber][2 (see the graphs).]&]
]&]
[s0;#2 &]
[s0;#2 &]
[s0;# [2 It is not necessary to install anything or set `"Build methods`".
As it is a template library no libraries or binaries are required.]&]
[s0;#2 &]
[s0;# [2 Eigen packages have been prepared by ][^http`:`/`/www`.ultimatepp`.org`/forum`/index`.php`?t`=usrinfo`&id`=647`&^2 d
olik.rce][2 and ][^http`:`/`/www`.ultimatepp`.org`/forum`/index`.php`?t`=usrinfo`&id`=648`&^2 k
oldo][2 .]&]