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

View File

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