1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2026-01-14 04:59:33 +00:00

dimension resized automatically for solvers

This commit is contained in:
2015-11-13 14:30:10 +00:00
parent ae62a3225d
commit aeda59adfa
12 changed files with 54 additions and 29 deletions

View File

@@ -26,15 +26,20 @@ using namespace Latan;
/******************************************************************************
* Solver implementation *
******************************************************************************/
// constructor /////////////////////////////////////////////////////////////////
Solver::Solver(const Index dim, const double precision,
const unsigned int maxIteration)
: x_(dim)
// constructors ////////////////////////////////////////////////////////////////
Solver::Solver(const double precision, const unsigned int maxIteration)
{
setMaxIteration(maxIteration);
setPrecision(precision);
}
Solver::Solver(const Index dim, const double precision,
const unsigned int maxIteration)
: Solver(precision, maxIteration)
{
resize(dim);
}
// access //////////////////////////////////////////////////////////////////////
Index Solver::getDim(void) const
{
@@ -65,12 +70,9 @@ void Solver::setInit(const DVec &x0)
{
if (x0.size() != x_.size())
{
LATAN_ERROR(Size, "initial vector state with invalid size");
}
else
{
x_ = x0;
resize(x0.size());
}
x_ = x0;
}
void Solver::setMaxIteration(const unsigned int maxIteration)
@@ -87,3 +89,8 @@ void Solver::setVerbosity(const Verbosity verbosity)
{
verbosity_ = verbosity;
}
void Solver::resize(const Index dim)
{
x_.resize(dim);
}