Commit 6b22e2ce authored by Max Lyon's avatar Max Lyon
Browse files

more int/size_t fixes

parent f3c59a17
...@@ -63,9 +63,9 @@ public: ...@@ -63,9 +63,9 @@ public:
COMISO::StopWatch sw; sw.start(); COMISO::StopWatch sw; sw.start();
// number of unknowns // number of unknowns
int n = _quadratic_problem->n_unknowns(); auto n = _quadratic_problem->n_unknowns();
// number of constraints // number of constraints
int m = _b.size(); auto m = _b.size();
std::cerr << "optmize via AQP with " << n << " unknowns and " << m << " linear constraints" << std::endl; std::cerr << "optmize via AQP with " << n << " unknowns and " << m << " linear constraints" << std::endl;
...@@ -193,7 +193,7 @@ protected: ...@@ -193,7 +193,7 @@ protected:
double backtracking_line_search(NProblemInterface* _quadratic_problem, NProblemInterface* _nonlinear_problem, VectorD& _x, VectorD& _g, VectorD& _dx, double& _rel_df, double _t_start = 1.0) double backtracking_line_search(NProblemInterface* _quadratic_problem, NProblemInterface* _nonlinear_problem, VectorD& _x, VectorD& _g, VectorD& _dx, double& _rel_df, double _t_start = 1.0)
{ {
int n = _x.size(); auto n = _x.size();
// pre-compute objective // pre-compute objective
double fx = _quadratic_problem->eval_f(_x.data()) + _nonlinear_problem->eval_f(_x.data()); double fx = _quadratic_problem->eval_f(_x.data()) + _nonlinear_problem->eval_f(_x.data());
......
...@@ -62,8 +62,8 @@ remove_dependent_linear_constraints_only_linear_equality( std::vector<NConstrain ...@@ -62,8 +62,8 @@ remove_dependent_linear_constraints_only_linear_equality( std::vector<NConstrain
if(_constraints.empty()) return; if(_constraints.empty()) return;
// 1. copy (normalized) data into gmm dynamic sparse matrix // 1. copy (normalized) data into gmm dynamic sparse matrix
unsigned int n(_constraints[0]->n_unknowns()); size_t n(_constraints[0]->n_unknowns());
unsigned int m(_constraints.size()); size_t m(_constraints.size());
std::vector<double> x(n, 0.0); std::vector<double> x(n, 0.0);
NConstraintInterface::SVectorNC g; NConstraintInterface::SVectorNC g;
RMatrixGMM A; RMatrixGMM A;
...@@ -92,27 +92,28 @@ remove_dependent_linear_constraints_only_linear_equality( std::vector<NConstrain ...@@ -92,27 +92,28 @@ remove_dependent_linear_constraints_only_linear_equality( std::vector<NConstrain
// 3. initialize priorityqueue for sorting // 3. initialize priorityqueue for sorting
// init priority queue // init priority queue
MutablePriorityQueueT<unsigned int, unsigned int> queue; MutablePriorityQueueT<gmm::size_type, gmm::size_type> queue;
queue.clear(m); queue.clear(m);
for(unsigned int i=0; i<m; ++i) for (gmm::size_type i = 0; i<m; ++i)
{ {
int cur_nnz = gmm::nnz( gmm::mat_row(A,i)); gmm::size_type cur_nnz = gmm::nnz( gmm::mat_row(A,i));
if( A(i,n) != 0.0) --cur_nnz; if (A(i,n) != 0.0)
--cur_nnz;
queue.update(i, cur_nnz); queue.update(i, cur_nnz);
} }
// track row status -1=undecided, 0=remove, 1=keep // track row status -1=undecided, 0=remove, 1=keep
std::vector<int> row_status(m, -1); std::vector<int> row_status(m, -1);
std::vector<int> keep; std::vector<gmm::size_type> keep;
// std::vector<int> remove; // std::vector<int> remove;
// for all conditions // for all conditions
while(!queue.empty()) while(!queue.empty())
{ {
// get next row // get next row
unsigned int i = queue.get_next(); gmm::size_type i = queue.get_next();
unsigned int j = find_max_abs_coeff(A.row(i)); gmm::size_type j = find_max_abs_coeff(A.row(i));
double aij = A(i,j); double aij = A(i,j);
if(std::abs(aij) <= _eps) if(std::abs(aij) <= _eps)
{ {
...@@ -145,7 +146,7 @@ remove_dependent_linear_constraints_only_linear_equality( std::vector<NConstrain ...@@ -145,7 +146,7 @@ remove_dependent_linear_constraints_only_linear_equality( std::vector<NConstrain
if( row_status[c_it.index()] == -1) // only process unvisited rows if( row_status[c_it.index()] == -1) // only process unvisited rows
{ {
// row idx // row idx
int k = c_it.index(); gmm::size_type k = c_it.index();
double s = -(*c_it)/aij; double s = -(*c_it)/aij;
add_row_simultaneously( k, s, row, A, Ac, _eps); add_row_simultaneously( k, s, row, A, Ac, _eps);
...@@ -153,8 +154,9 @@ remove_dependent_linear_constraints_only_linear_equality( std::vector<NConstrain ...@@ -153,8 +154,9 @@ remove_dependent_linear_constraints_only_linear_equality( std::vector<NConstrain
A( k, j) = 0; A( k, j) = 0;
Ac(k, j) = 0; Ac(k, j) = 0;
int cur_nnz = gmm::nnz( gmm::mat_row(A,k)); gmm::size_type cur_nnz = gmm::nnz( gmm::mat_row(A,k));
if( A(k,n) != 0.0) --cur_nnz; if( A(k,n) != 0.0)
--cur_nnz;
queue.update(k, cur_nnz); queue.update(k, cur_nnz);
} }
...@@ -177,12 +179,12 @@ remove_dependent_linear_constraints_only_linear_equality( std::vector<NConstrain ...@@ -177,12 +179,12 @@ remove_dependent_linear_constraints_only_linear_equality( std::vector<NConstrain
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
unsigned int gmm::size_type
ConstraintTools:: ConstraintTools::
find_max_abs_coeff(SVectorGMM& _v) find_max_abs_coeff(SVectorGMM& _v)
{ {
unsigned int n = _v.size(); size_t n = _v.size();
unsigned int imax(0); gmm::size_type imax(0);
double vmax(0.0); double vmax(0.0);
gmm::linalg_traits<SVectorGMM>::const_iterator c_it = gmm::vect_const_begin(_v); gmm::linalg_traits<SVectorGMM>::const_iterator c_it = gmm::vect_const_begin(_v);
...@@ -205,7 +207,7 @@ find_max_abs_coeff(SVectorGMM& _v) ...@@ -205,7 +207,7 @@ find_max_abs_coeff(SVectorGMM& _v)
void void
ConstraintTools:: ConstraintTools::
add_row_simultaneously( int _row_i, add_row_simultaneously( gmm::size_type _row_i,
double _coeff, double _coeff,
SVectorGMM& _row, SVectorGMM& _row,
RMatrixGMM& _rmat, RMatrixGMM& _rmat,
......
...@@ -58,13 +58,13 @@ public: ...@@ -58,13 +58,13 @@ public:
static void remove_dependent_linear_constraints(std::vector<NConstraintInterface*>& _constraints, const double _eps = 1e-8); static void remove_dependent_linear_constraints(std::vector<NConstraintInterface*>& _constraints, const double _eps = 1e-8);
// same as above but assumes already that all constraints are linear equality constraints // same as above but assumes already that all constraints are linear equality constraints
static void remove_dependent_linear_constraints_only_linear_equality( std::vector<NConstraintInterface*>& _constraints, const double _eps = 1e-8); static void remove_dependent_linear_constraints_only_linear_equality(std::vector<NConstraintInterface*>& _constraints, const double _eps = 1e-8);
private: private:
static unsigned int find_max_abs_coeff(SVectorGMM& _v); static gmm::size_type find_max_abs_coeff(SVectorGMM& _v);
static void add_row_simultaneously( int _row_i, static void add_row_simultaneously( gmm::size_type _row_i,
double _coeff, double _coeff,
SVectorGMM& _row, SVectorGMM& _row,
RMatrixGMM& _rmat, RMatrixGMM& _rmat,
......
...@@ -187,8 +187,8 @@ public: ...@@ -187,8 +187,8 @@ public:
for(unsigned int j=0; j<triplets_.size(); ++j) for(unsigned int j=0; j<triplets_.size(); ++j)
{ {
// add re-indexed Triplet // add re-indexed Triplet
_triplets.push_back(Triplet( instances_.index(i,triplets_[j].row()), _triplets.push_back(Triplet( (int)instances_.index(i,triplets_[j].row()),
instances_.index(i,triplets_[j].col()), (int)instances_.index(i,triplets_[j].col()),
triplets_[j].value() )); triplets_[j].value() ));
} }
} }
......
...@@ -122,9 +122,9 @@ int NewtonSolver::solve(NProblemInterface* _problem, const SMatrixD& _A, ...@@ -122,9 +122,9 @@ int NewtonSolver::solve(NProblemInterface* _problem, const SMatrixD& _A,
DEB_time_func_def; DEB_time_func_def;
// number of unknowns // number of unknowns
int n = _problem->n_unknowns(); size_t n = _problem->n_unknowns();
// number of constraints // number of constraints
int m = _b.size(); size_t m = _b.size();
DEB_line(2, "optimize via Newton with " << n << " unknowns and " << m << " linear constraints"); DEB_line(2, "optimize via Newton with " << n << " unknowns and " << m << " linear constraints");
...@@ -280,7 +280,7 @@ double NewtonSolver::backtracking_line_search(NProblemInterface* _problem, ...@@ -280,7 +280,7 @@ double NewtonSolver::backtracking_line_search(NProblemInterface* _problem,
double& _fx, const double _t_start) double& _fx, const double _t_start)
{ {
DEB_enter_func; DEB_enter_func;
int n = _x.size(); size_t n = _x.size();
// pre-compute objective // pre-compute objective
double fx = _problem->eval_f(_x.data()); double fx = _problem->eval_f(_x.data());
......
...@@ -82,7 +82,7 @@ bool CholmodSolver::calc_system( const std::vector<int>& _colptr, ...@@ -82,7 +82,7 @@ bool CholmodSolver::calc_system( const std::vector<int>& _colptr,
rowind_ = _rowind; rowind_ = _rowind;
values_ = _values; values_ = _values;
int n = colptr_.size()-1; size_t n = colptr_.size()-1;
cholmod_sparse matA; cholmod_sparse matA;
...@@ -167,7 +167,7 @@ bool CholmodSolver::calc_system_prepare_pattern( const std::vector<int>& _col ...@@ -167,7 +167,7 @@ bool CholmodSolver::calc_system_prepare_pattern( const std::vector<int>& _col
rowind_ = _rowind; rowind_ = _rowind;
values_ = _values; values_ = _values;
int n = colptr_.size()-1; size_t n = colptr_.size() - 1;
// setup matrix matA // setup matrix matA
cholmod_sparse matA; cholmod_sparse matA;
...@@ -282,7 +282,7 @@ bool CholmodSolver::update_system( const std::vector<int>& _colptr, ...@@ -282,7 +282,7 @@ bool CholmodSolver::update_system( const std::vector<int>& _colptr,
colptr_ = _colptr; colptr_ = _colptr;
rowind_ = _rowind; rowind_ = _rowind;
values_ = _values; values_ = _values;
int n = colptr_.size()-1; size_t n = colptr_.size() - 1;
cholmod_sparse matA; cholmod_sparse matA;
...@@ -329,7 +329,7 @@ bool CholmodSolver::update_downdate_factor( const std::vector<int>& _colptr, ...@@ -329,7 +329,7 @@ bool CholmodSolver::update_downdate_factor( const std::vector<int>& _colptr,
rowind_ = _rowind; rowind_ = _rowind;
values_ = _values; values_ = _values;
int n = colptr_.size()-1; size_t n = colptr_.size() - 1;
cholmod_sparse matA; cholmod_sparse matA;
...@@ -387,7 +387,7 @@ bool CholmodSolver::update_downdate_factor( const std::vector<int>& _colptr, ...@@ -387,7 +387,7 @@ bool CholmodSolver::update_downdate_factor( const std::vector<int>& _colptr,
bool CholmodSolver::solve( double * _x, double * _b) bool CholmodSolver::solve( double * _x, double * _b)
{ {
const unsigned int n = mp_L->n; const size_t n = mp_L->n;
cholmod_dense *x, b; cholmod_dense *x, b;
......
...@@ -217,7 +217,6 @@ solve( ...@@ -217,7 +217,6 @@ solve(
if( _show_miso_settings) if( _show_miso_settings)
miso_.show_options_dialog(); miso_.show_options_dialog();
gmm::size_type nrows = gmm::mat_nrows(_A); gmm::size_type nrows = gmm::mat_nrows(_A);
gmm::size_type ncols = gmm::mat_ncols(_A); gmm::size_type ncols = gmm::mat_ncols(_A);
gmm::size_type ncons = gmm::mat_nrows(_constraints); gmm::size_type ncons = gmm::mat_nrows(_constraints);
...@@ -462,7 +461,7 @@ make_constraints_independent( ...@@ -462,7 +461,7 @@ make_constraints_independent(
{ {
if( fabs(*row_it) > max_elim_val) if( fabs(*row_it) > max_elim_val)
{ {
elim_j = cur_j; elim_j = (int)cur_j;
max_elim_val = fabs(*row_it); max_elim_val = fabs(*row_it);
} }
//break; //break;
...@@ -473,12 +472,11 @@ make_constraints_independent( ...@@ -473,12 +472,11 @@ make_constraints_independent(
// gcd // gcd
// if the coefficient of an integer variable is not an integer, then // if the coefficient of an integer variable is not an integer, then
// the variable most problably will not be (expect if all coeffs are the same, e.g. 0.5) // the variable most problably will not be (expect if all coeffs are the same, e.g. 0.5)
if( (double(int(cur_row_val))- cur_row_val) != 0.0) if ((double(int(cur_row_val))- cur_row_val) != 0.0)
{ {
// std::cerr << __FUNCTION__ << " Warning: coefficient of integer variable is NOT integer: " DEB_warning(2, "coefficient of integer variable is NOT integer : " << cur_row_val)
// << cur_row_val << std::endl; gcd_update_valid = false;
gcd_update_valid = false; }
}
v_gcd[n_ints] = static_cast<int>(cur_row_val); v_gcd[n_ints] = static_cast<int>(cur_row_val);
++n_ints; ++n_ints;
...@@ -558,7 +556,7 @@ make_constraints_independent( ...@@ -558,7 +556,7 @@ make_constraints_independent(
// sw.start(); // sw.start();
double val = -(*c_it)/elim_val_cur; double val = -(*c_it)/elim_val_cur;
add_row_simultaneously( c_it.index(), val, gmm::mat_row(_constraints, i), _constraints, constraints_c); add_row_simultaneously((int)c_it.index(), val, gmm::mat_row(_constraints, i), _constraints, constraints_c);
// make sure the eliminated entry is 0 on all other rows and not 1e-17 // make sure the eliminated entry is 0 on all other rows and not 1e-17
_constraints( c_it.index(), elim_j) = 0; _constraints( c_it.index(), elim_j) = 0;
constraints_c(c_it.index(), elim_j) = 0; constraints_c(c_it.index(), elim_j) = 0;
...@@ -589,7 +587,9 @@ make_constraints_independent_reordering( ...@@ -589,7 +587,9 @@ make_constraints_independent_reordering(
gmm::size_type nr = gmm::mat_nrows(_constraints); gmm::size_type nr = gmm::mat_nrows(_constraints);
gmm::resize(rhs_update_table_.D_, nr, nr); gmm::resize(rhs_update_table_.D_, nr, nr);
gmm::clear(rhs_update_table_.D_); gmm::clear(rhs_update_table_.D_);
for(gmm::size_type i=0; i<nr; ++i) rhs_update_table_.D_(i,i) = 1.0;
for(gmm::size_type i=0; i<nr; ++i)
rhs_update_table_.D_(i,i) = 1.0;
// Base::StopWatch sw; // Base::StopWatch sw;
// number of variables // number of variables
...@@ -602,7 +602,7 @@ make_constraints_independent_reordering( ...@@ -602,7 +602,7 @@ make_constraints_independent_reordering(
// build round map // build round map
std::vector<bool> roundmap( n_vars, false); std::vector<bool> roundmap( n_vars, false);
for(unsigned int i=0; i<_idx_to_round.size(); ++i) for(size_t i=0; i<_idx_to_round.size(); ++i)
roundmap[_idx_to_round[i]] = true; roundmap[_idx_to_round[i]] = true;
// copy constraints into column matrix (for faster update via iterators) // copy constraints into column matrix (for faster update via iterators)
...@@ -618,13 +618,15 @@ make_constraints_independent_reordering( ...@@ -618,13 +618,15 @@ make_constraints_independent_reordering(
for(unsigned int i=0; i<nr; ++i) for(unsigned int i=0; i<nr; ++i)
{ {
gmm::size_type cur_nnz = gmm::nnz( gmm::mat_row(_constraints,i)); gmm::size_type cur_nnz = gmm::nnz( gmm::mat_row(_constraints,i));
if( _constraints(i,n_vars-1) != 0.0) --cur_nnz; if( _constraints(i,n_vars-1) != 0.0)
--cur_nnz;
queue.update(i, static_cast<int>(cur_nnz)); queue.update(i, static_cast<int>(cur_nnz));
} }
std::vector<bool> row_visited(nr, false); std::vector<bool> row_visited(nr, false);
std::vector<unsigned int> row_ordering; row_ordering.reserve(nr); std::vector<gmm::size_type> row_ordering;
row_ordering.reserve(nr);
// for all conditions // for all conditions
...@@ -632,7 +634,7 @@ make_constraints_independent_reordering( ...@@ -632,7 +634,7 @@ make_constraints_independent_reordering(
while(!queue.empty()) while(!queue.empty())
{ {
// get next row // get next row
unsigned int i = queue.get_next(); auto i = queue.get_next();
row_ordering.push_back(i); row_ordering.push_back(i);
row_visited[i] = true; row_visited[i] = true;
...@@ -666,14 +668,14 @@ make_constraints_independent_reordering( ...@@ -666,14 +668,14 @@ make_constraints_independent_reordering(
{ {
int cur_j = static_cast<int>(row_it.index()); int cur_j = static_cast<int>(row_it.index());
// do not use the constant part // do not use the constant part
if( cur_j != n_vars - 1 ) if (cur_j != n_vars - 1)
{ {
// found real valued var? -> finished (UPDATE: no not any more, find biggest real value to avoid x/1e-13) // found real valued var? -> finished (UPDATE: no not any more, find biggest real value to avoid x/1e-13)
if( !roundmap[ cur_j ]) if (!roundmap[ cur_j ])
{ {
if( fabs(*row_it) > max_elim_val) if (fabs(*row_it) > max_elim_val)
{ {
elim_j = cur_j; elim_j = (int)cur_j;
max_elim_val = fabs(*row_it); max_elim_val = fabs(*row_it);
} }
//break; //break;
...@@ -684,12 +686,11 @@ make_constraints_independent_reordering( ...@@ -684,12 +686,11 @@ make_constraints_independent_reordering(
// gcd // gcd
// if the coefficient of an integer variable is not an integer, then // if the coefficient of an integer variable is not an integer, then
// the variable most problably will not be (expect if all coeffs are the same, e.g. 0.5) // the variable most problably will not be (expect if all coeffs are the same, e.g. 0.5)
if( (double(int(cur_row_val))- cur_row_val) != 0.0) if ((double(int(cur_row_val))- cur_row_val) != 0.0)
{ {
// std::cerr << __FUNCTION__ << " Warning: coefficient of integer variable is NOT integer: " DEB_warning(2, "coefficient of integer variable is NOT integer : " << cur_row_val);
// << cur_row_val << std::endl; gcd_update_valid = false;
gcd_update_valid = false; }
}
v_gcd[n_ints] = static_cast<int>(cur_row_val); v_gcd[n_ints] = static_cast<int>(cur_row_val);
++n_ints; ++n_ints;
...@@ -697,7 +698,7 @@ make_constraints_independent_reordering( ...@@ -697,7 +698,7 @@ make_constraints_independent_reordering(
// store integer closest to 1, must be greater than epsilon_ // store integer closest to 1, must be greater than epsilon_
if( fabs(cur_row_val-1.0) < elim_val && cur_row_val > epsilon_) if( fabs(cur_row_val-1.0) < elim_val && cur_row_val > epsilon_)
{ {
elim_int_j = cur_j; elim_int_j = (int)cur_j;
elim_val = fabs(cur_row_val-1.0); elim_val = fabs(cur_row_val-1.0);
} }
} }
...@@ -735,7 +736,7 @@ make_constraints_independent_reordering( ...@@ -735,7 +736,7 @@ make_constraints_independent_reordering(
if( do_gcd_ && gcd_update_valid) if( do_gcd_ && gcd_update_valid)
{ {
// perform gcd update // perform gcd update
bool gcd_ok = update_constraint_gcd( _constraints, i, elim_j, v_gcd, n_ints); bool gcd_ok = update_constraint_gcd( _constraints, (int)i, elim_j, v_gcd, n_ints);
DEB_warning_if( !gcd_ok && (noisy_ > 0), 1, " GCD update failed! " DEB_warning_if( !gcd_ok && (noisy_ > 0), 1, " GCD update failed! "
<< DEB_os_str(gmm::mat_const_row(_constraints, i)) ) << DEB_os_str(gmm::mat_const_row(_constraints, i)) )
} }
...@@ -756,7 +757,7 @@ make_constraints_independent_reordering( ...@@ -756,7 +757,7 @@ make_constraints_independent_reordering(
// is this condition dependent? // is this condition dependent?
if( elim_j != -1 ) if (elim_j != -1)
{ {
// get elim variable value // get elim variable value
double elim_val_cur = _constraints(i, elim_j); double elim_val_cur = _constraints(i, elim_j);
...@@ -765,31 +766,34 @@ make_constraints_independent_reordering( ...@@ -765,31 +766,34 @@ make_constraints_independent_reordering(
CVector col = constraints_c.col(elim_j); CVector col = constraints_c.col(elim_j);
// iterate over column // iterate over column
typename gmm::linalg_traits<CVector>::const_iterator c_it = gmm::vect_const_begin(col); typename gmm::linalg_traits<CVector>::const_iterator c_it = gmm::vect_const_begin(col);
typename gmm::linalg_traits<CVector>::const_iterator c_end = gmm::vect_const_end(col); typename gmm::linalg_traits<CVector>::const_iterator c_end = gmm::vect_const_end(col);
for(; c_it != c_end; ++c_it) for (; c_it != c_end; ++c_it)
// if( c_it.index() > i) {
if( !row_visited[c_it.index()]) // if( c_it.index() > i)
if (!row_visited[c_it.index()])
{ {
// sw.start(); // sw.start();
double val = -(*c_it)/elim_val_cur; double val = -(*c_it) / elim_val_cur;
add_row_simultaneously( c_it.index(), val, gmm::mat_row(_constraints, i), _constraints, constraints_c); add_row_simultaneously((int)c_it.index(), val, gmm::mat_row(_constraints, i), _constraints, constraints_c);
// make sure the eliminated entry is 0 on all other rows and not 1e-17 // make sure the eliminated entry is 0 on all other rows and not 1e-17
_constraints( c_it.index(), elim_j) = 0; _constraints(c_it.index(), elim_j) = 0;
constraints_c(c_it.index(), elim_j) = 0; constraints_c(c_it.index(), elim_j) = 0;
gmm::size_type cur_idx = c_it.index(); gmm::size_type cur_idx = c_it.index();
gmm::size_type cur_nnz = gmm::nnz( gmm::mat_row(_constraints,cur_idx)); gmm::size_type cur_nnz = gmm::nnz( gmm::mat_row(_constraints,cur_idx));
if( _constraints(cur_idx,n_vars-1) != 0.0) --cur_nnz; if( _constraints(cur_idx,n_vars-1) != 0.0)
--cur_nnz;
queue.update(static_cast<int>(cur_idx), queue.update(static_cast<int>(cur_idx),
static_cast<int>(cur_nnz)); static_cast<int>(cur_nnz));
// update linear transition of rhs // update linear transition of rhs
gmm::add(gmm::scaled(gmm::mat_row(rhs_update_table_.D_, i), val), gmm::add(gmm::scaled(gmm::mat_row(rhs_update_table_.D_, i), val),
gmm::mat_row(rhs_update_table_.D_, c_it.index())); gmm::mat_row(rhs_update_table_.D_, c_it.index()));
} }
}
} }
} }
// // check result // // check result
...@@ -862,7 +866,7 @@ update_constraint_gcd( RMatrixT& _constraints, ...@@ -862,7 +866,7 @@ update_constraint_gcd( RMatrixT& _constraints,
gmm::size_type cur_j = row_it.index(); gmm::size_type cur_j = row_it.index();
_constraints(_row_i, cur_j) = (*row_it)/i_gcd; _constraints(_row_i, cur_j) = (*row_it)/i_gcd;
} }
gmm::size_type elim_coeff = static_cast<gmm::size_type>(abs(_constraints(_row_i, _elim_j))); gmm::size_type elim_coeff = static_cast<gmm::size_type>(std::abs(_constraints(_row_i, _elim_j)));
DEB_error_if( elim_coeff != 1, "elimination coefficient " << elim_coeff DEB_error_if( elim_coeff != 1, "elimination coefficient " << elim_coeff
<< " will (most probably) NOT lead to an integer solution!") << " will (most probably) NOT lead to an integer solution!")
return true; return true;
...@@ -1261,7 +1265,7 @@ restore_eliminated_vars( RMatrixT& _constraints, ...@@ -1261,7 +1265,7 @@ restore_eliminated_vars( RMatrixT& _constraints,
} }
// reverse iterate // reverse iterate
for(int i= static_cast<int>(_c_elim.size())-1; i>=0; --i) // AF: Can this be negative? for(int i = static_cast<int>(_c_elim.size())-1; i>=0; --i) // AF: Can this be negative?
{ {
int cur_var = _c_elim[i];