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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user