use typedef

This commit is contained in:
Thomas Capricelli 2009-11-25 23:08:46 +01:00
parent a6380ae272
commit dca80b5f22
2 changed files with 47 additions and 46 deletions

View File

@ -71,50 +71,49 @@ public:
int nb_of_superdiagonals; int nb_of_superdiagonals;
Scalar epsfcn; Scalar epsfcn;
}; };
typedef Matrix< Scalar, Dynamic, 1 > FVectorType;
typedef Matrix< Scalar, Dynamic, Dynamic > JacobianType;
Status hybrj1( Status hybrj1(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const Scalar tol = ei_sqrt(epsilon<Scalar>()) const Scalar tol = ei_sqrt(epsilon<Scalar>())
); );
Status solveInit( Status solveInit(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode=1 const int mode=1
); );
Status solveOneStep( Status solveOneStep(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode=1 const int mode=1
); );
Status solve( Status solve(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode=1 const int mode=1
); );
Status hybrd1( Status hybrd1(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const Scalar tol = ei_sqrt(epsilon<Scalar>()) const Scalar tol = ei_sqrt(epsilon<Scalar>())
); );
Status solveNumericalDiffInit( Status solveNumericalDiffInit(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode=1 const int mode=1
); );
Status solveNumericalDiffOneStep( Status solveNumericalDiffOneStep(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode=1 const int mode=1
); );
Status solveNumericalDiff( Status solveNumericalDiff(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode=1 const int mode=1
); );
void resetParameters(void) { parameters = Parameters(); } void resetParameters(void) { parameters = Parameters(); }
Parameters parameters; Parameters parameters;
Matrix< Scalar, Dynamic, 1 > fvec; FVectorType fvec, R, qtf, diag;
Matrix< Scalar, Dynamic, Dynamic > fjac; JacobianType fjac;
Matrix< Scalar, Dynamic, 1 > R;
Matrix< Scalar, Dynamic, 1 > qtf;
Matrix< Scalar, Dynamic, 1 > diag;
int nfev; int nfev;
int njev; int njev;
int iter; int iter;
@ -133,7 +132,7 @@ private:
int nslow1, nslow2; int nslow1, nslow2;
int ncfail; int ncfail;
Scalar actred, prered; Scalar actred, prered;
Matrix< Scalar, Dynamic, 1 > wa1, wa2, wa3, wa4; FVectorType wa1, wa2, wa3, wa4;
}; };
@ -141,7 +140,7 @@ private:
template<typename FunctorType, typename Scalar> template<typename FunctorType, typename Scalar>
typename HybridNonLinearSolver<FunctorType,Scalar>::Status typename HybridNonLinearSolver<FunctorType,Scalar>::Status
HybridNonLinearSolver<FunctorType,Scalar>::hybrj1( HybridNonLinearSolver<FunctorType,Scalar>::hybrj1(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const Scalar tol const Scalar tol
) )
{ {
@ -164,7 +163,7 @@ HybridNonLinearSolver<FunctorType,Scalar>::hybrj1(
template<typename FunctorType, typename Scalar> template<typename FunctorType, typename Scalar>
typename HybridNonLinearSolver<FunctorType,Scalar>::Status typename HybridNonLinearSolver<FunctorType,Scalar>::Status
HybridNonLinearSolver<FunctorType,Scalar>::solveInit( HybridNonLinearSolver<FunctorType,Scalar>::solveInit(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode const int mode
) )
{ {
@ -214,7 +213,7 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveInit(
template<typename FunctorType, typename Scalar> template<typename FunctorType, typename Scalar>
typename HybridNonLinearSolver<FunctorType,Scalar>::Status typename HybridNonLinearSolver<FunctorType,Scalar>::Status
HybridNonLinearSolver<FunctorType,Scalar>::solveOneStep( HybridNonLinearSolver<FunctorType,Scalar>::solveOneStep(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode const int mode
) )
{ {
@ -435,7 +434,7 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveOneStep(
template<typename FunctorType, typename Scalar> template<typename FunctorType, typename Scalar>
typename HybridNonLinearSolver<FunctorType,Scalar>::Status typename HybridNonLinearSolver<FunctorType,Scalar>::Status
HybridNonLinearSolver<FunctorType,Scalar>::solve( HybridNonLinearSolver<FunctorType,Scalar>::solve(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode const int mode
) )
{ {
@ -450,7 +449,7 @@ HybridNonLinearSolver<FunctorType,Scalar>::solve(
template<typename FunctorType, typename Scalar> template<typename FunctorType, typename Scalar>
typename HybridNonLinearSolver<FunctorType,Scalar>::Status typename HybridNonLinearSolver<FunctorType,Scalar>::Status
HybridNonLinearSolver<FunctorType,Scalar>::hybrd1( HybridNonLinearSolver<FunctorType,Scalar>::hybrd1(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const Scalar tol const Scalar tol
) )
{ {
@ -474,7 +473,7 @@ HybridNonLinearSolver<FunctorType,Scalar>::hybrd1(
template<typename FunctorType, typename Scalar> template<typename FunctorType, typename Scalar>
typename HybridNonLinearSolver<FunctorType,Scalar>::Status typename HybridNonLinearSolver<FunctorType,Scalar>::Status
HybridNonLinearSolver<FunctorType,Scalar>::solveNumericalDiffInit( HybridNonLinearSolver<FunctorType,Scalar>::solveNumericalDiffInit(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode const int mode
) )
{ {
@ -529,7 +528,7 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveNumericalDiffInit(
template<typename FunctorType, typename Scalar> template<typename FunctorType, typename Scalar>
typename HybridNonLinearSolver<FunctorType,Scalar>::Status typename HybridNonLinearSolver<FunctorType,Scalar>::Status
HybridNonLinearSolver<FunctorType,Scalar>::solveNumericalDiffOneStep( HybridNonLinearSolver<FunctorType,Scalar>::solveNumericalDiffOneStep(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode const int mode
) )
{ {
@ -752,7 +751,7 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveNumericalDiffOneStep(
template<typename FunctorType, typename Scalar> template<typename FunctorType, typename Scalar>
typename HybridNonLinearSolver<FunctorType,Scalar>::Status typename HybridNonLinearSolver<FunctorType,Scalar>::Status
HybridNonLinearSolver<FunctorType,Scalar>::solveNumericalDiff( HybridNonLinearSolver<FunctorType,Scalar>::solveNumericalDiff(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode const int mode
) )
{ {

View File

@ -72,56 +72,58 @@ public:
Scalar epsfcn; Scalar epsfcn;
}; };
typedef Matrix< Scalar, Dynamic, 1 > FVectorType;
typedef Matrix< Scalar, Dynamic, Dynamic > JacobianType;
Status lmder1( Status lmder1(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const Scalar tol = ei_sqrt(epsilon<Scalar>()) const Scalar tol = ei_sqrt(epsilon<Scalar>())
); );
Status minimize( Status minimize(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode=1 const int mode=1
); );
Status minimizeInit( Status minimizeInit(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode=1 const int mode=1
); );
Status minimizeOneStep( Status minimizeOneStep(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode=1 const int mode=1
); );
static Status lmdif1( static Status lmdif1(
FunctorType &functor, FunctorType &functor,
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
int *nfev, int *nfev,
const Scalar tol = ei_sqrt(epsilon<Scalar>()) const Scalar tol = ei_sqrt(epsilon<Scalar>())
); );
Status lmstr1( Status lmstr1(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const Scalar tol = ei_sqrt(epsilon<Scalar>()) const Scalar tol = ei_sqrt(epsilon<Scalar>())
); );
Status minimizeOptimumStorage( Status minimizeOptimumStorage(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode=1 const int mode=1
); );
Status minimizeOptimumStorageInit( Status minimizeOptimumStorageInit(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode=1 const int mode=1
); );
Status minimizeOptimumStorageOneStep( Status minimizeOptimumStorageOneStep(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode=1 const int mode=1
); );
void resetParameters(void) { parameters = Parameters(); } void resetParameters(void) { parameters = Parameters(); }
Parameters parameters; Parameters parameters;
Matrix< Scalar, Dynamic, 1 > fvec; FVectorType fvec, qtf, diag;
Matrix< Scalar, Dynamic, Dynamic > fjac; JacobianType fjac;
VectorXi ipvt; VectorXi ipvt;
Matrix< Scalar, Dynamic, 1 > qtf;
Matrix< Scalar, Dynamic, 1 > diag;
int nfev; int nfev;
int njev; int njev;
int iter; int iter;
@ -130,7 +132,7 @@ private:
FunctorType &functor; FunctorType &functor;
int n; int n;
int m; int m;
Matrix< Scalar, Dynamic, 1 > wa1, wa2, wa3, wa4; FVectorType wa1, wa2, wa3, wa4;
Scalar par, sum; Scalar par, sum;
Scalar temp, temp1, temp2; Scalar temp, temp1, temp2;
@ -142,7 +144,7 @@ private:
template<typename FunctorType, typename Scalar> template<typename FunctorType, typename Scalar>
typename LevenbergMarquardt<FunctorType,Scalar>::Status typename LevenbergMarquardt<FunctorType,Scalar>::Status
LevenbergMarquardt<FunctorType,Scalar>::lmder1( LevenbergMarquardt<FunctorType,Scalar>::lmder1(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const Scalar tol const Scalar tol
) )
{ {
@ -165,7 +167,7 @@ LevenbergMarquardt<FunctorType,Scalar>::lmder1(
template<typename FunctorType, typename Scalar> template<typename FunctorType, typename Scalar>
typename LevenbergMarquardt<FunctorType,Scalar>::Status typename LevenbergMarquardt<FunctorType,Scalar>::Status
LevenbergMarquardt<FunctorType,Scalar>::minimize( LevenbergMarquardt<FunctorType,Scalar>::minimize(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode const int mode
) )
{ {
@ -178,7 +180,7 @@ LevenbergMarquardt<FunctorType,Scalar>::minimize(
template<typename FunctorType, typename Scalar> template<typename FunctorType, typename Scalar>
typename LevenbergMarquardt<FunctorType,Scalar>::Status typename LevenbergMarquardt<FunctorType,Scalar>::Status
LevenbergMarquardt<FunctorType,Scalar>::minimizeInit( LevenbergMarquardt<FunctorType,Scalar>::minimizeInit(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode const int mode
) )
{ {
@ -228,7 +230,7 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeInit(
template<typename FunctorType, typename Scalar> template<typename FunctorType, typename Scalar>
typename LevenbergMarquardt<FunctorType,Scalar>::Status typename LevenbergMarquardt<FunctorType,Scalar>::Status
LevenbergMarquardt<FunctorType,Scalar>::minimizeOneStep( LevenbergMarquardt<FunctorType,Scalar>::minimizeOneStep(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode const int mode
) )
{ {
@ -424,13 +426,13 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeOneStep(
template<typename FunctorType, typename Scalar> template<typename FunctorType, typename Scalar>
typename LevenbergMarquardt<FunctorType,Scalar>::Status typename LevenbergMarquardt<FunctorType,Scalar>::Status
LevenbergMarquardt<FunctorType,Scalar>::lmstr1( LevenbergMarquardt<FunctorType,Scalar>::lmstr1(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const Scalar tol const Scalar tol
) )
{ {
n = x.size(); n = x.size();
m = functor.values(); m = functor.values();
Matrix< Scalar, Dynamic, Dynamic > fjac(m, n); JacobianType fjac(m, n);
VectorXi ipvt; VectorXi ipvt;
/* check the input parameters for errors. */ /* check the input parameters for errors. */
@ -448,7 +450,7 @@ LevenbergMarquardt<FunctorType,Scalar>::lmstr1(
template<typename FunctorType, typename Scalar> template<typename FunctorType, typename Scalar>
typename LevenbergMarquardt<FunctorType,Scalar>::Status typename LevenbergMarquardt<FunctorType,Scalar>::Status
LevenbergMarquardt<FunctorType,Scalar>::minimizeOptimumStorageInit( LevenbergMarquardt<FunctorType,Scalar>::minimizeOptimumStorageInit(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode const int mode
) )
{ {
@ -499,7 +501,7 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeOptimumStorageInit(
template<typename FunctorType, typename Scalar> template<typename FunctorType, typename Scalar>
typename LevenbergMarquardt<FunctorType,Scalar>::Status typename LevenbergMarquardt<FunctorType,Scalar>::Status
LevenbergMarquardt<FunctorType,Scalar>::minimizeOptimumStorageOneStep( LevenbergMarquardt<FunctorType,Scalar>::minimizeOptimumStorageOneStep(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode const int mode
) )
{ {
@ -708,7 +710,7 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeOptimumStorageOneStep(
template<typename FunctorType, typename Scalar> template<typename FunctorType, typename Scalar>
typename LevenbergMarquardt<FunctorType,Scalar>::Status typename LevenbergMarquardt<FunctorType,Scalar>::Status
LevenbergMarquardt<FunctorType,Scalar>::minimizeOptimumStorage( LevenbergMarquardt<FunctorType,Scalar>::minimizeOptimumStorage(
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
const int mode const int mode
) )
{ {
@ -722,7 +724,7 @@ template<typename FunctorType, typename Scalar>
typename LevenbergMarquardt<FunctorType,Scalar>::Status typename LevenbergMarquardt<FunctorType,Scalar>::Status
LevenbergMarquardt<FunctorType,Scalar>::lmdif1( LevenbergMarquardt<FunctorType,Scalar>::lmdif1(
FunctorType &functor, FunctorType &functor,
Matrix< Scalar, Dynamic, 1 > &x, FVectorType &x,
int *nfev, int *nfev,
const Scalar tol const Scalar tol
) )