Commit d64f46f6 authored by David Bommes's avatar David Bommes

Merge branch 'gmm5.2-compat' into 'master'

Fix compile error with GMM++-5.2, cf. #3

See merge request !25
parents 10761aa2 a2645659
Pipeline #6027 passed with stages
in 7 minutes and 14 seconds
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <Base/Utils/StopWatch.hh> #include <Base/Utils/StopWatch.hh>
#include <Base/Debug/DebOut.hh> #include <Base/Debug/DebOut.hh>
#include <type_traits>
//== NAMESPACES =============================================================== //== NAMESPACES ===============================================================
...@@ -48,6 +49,11 @@ namespace COMISO { ...@@ -48,6 +49,11 @@ namespace COMISO {
//== IMPLEMENTATION ========================================================== //== IMPLEMENTATION ==========================================================
// cf. issue #3 - gmm5.2 compat
template <typename T>
using linalg_traits = typename gmm::linalg_traits<typename std::remove_const<typename std::remove_reference<T>::type>::type>;
template<class RMatrixT, class CMatrixT, class VectorT, class VectorIT > template<class RMatrixT, class CMatrixT, class VectorT, class VectorIT >
void void
ConstrainedSolver::solve_const(const RMatrixT& _constraints, ConstrainedSolver::solve_const(const RMatrixT& _constraints,
...@@ -286,10 +292,10 @@ ConstrainedSolver::resolve( ...@@ -286,10 +292,10 @@ ConstrainedSolver::resolve(
gmm::size_type m = gmm::mat_nrows(_B); gmm::size_type m = gmm::mat_nrows(_B);
gmm::size_type n = gmm::mat_ncols(_B); gmm::size_type n = gmm::mat_ncols(_B);
typedef typename gmm::linalg_traits<RMatrixT>::const_sub_row_type CRowT; typedef typename linalg_traits<RMatrixT>::const_sub_row_type CRowT;
typedef typename gmm::linalg_traits<RMatrixT>::sub_row_type RowT; typedef typename linalg_traits<RMatrixT>::sub_row_type RowT;
typedef typename gmm::linalg_traits<CRowT>::const_iterator RIter; typedef typename linalg_traits<CRowT>::const_iterator RIter;
typedef typename gmm::linalg_traits<CRowT>::value_type VecValT; typedef typename linalg_traits<CRowT>::value_type VecValT;
gmm::resize(rhs, n - 1); gmm::resize(rhs, n - 1);
gmm::clear(rhs); gmm::clear(rhs);
...@@ -425,9 +431,9 @@ ConstrainedSolver::make_constraints_independent( ...@@ -425,9 +431,9 @@ ConstrainedSolver::make_constraints_independent(
// if not found for integers with value +-1 // if not found for integers with value +-1
// and finally take the smallest integer variable // and finally take the smallest integer variable
typedef typename gmm::linalg_traits<RMatrixT>::const_sub_row_type CRowT; typedef typename linalg_traits<RMatrixT>::const_sub_row_type CRowT;
typedef typename gmm::linalg_traits<RMatrixT>::sub_row_type RowT; typedef typename linalg_traits<RMatrixT>::sub_row_type RowT;
typedef typename gmm::linalg_traits<CRowT>::const_iterator RIter; typedef typename linalg_traits<CRowT>::const_iterator RIter;
// get current condition row // get current condition row
CRowT row = gmm::mat_const_row(_constraints, i); CRowT row = gmm::mat_const_row(_constraints, i);
...@@ -535,8 +541,8 @@ ConstrainedSolver::make_constraints_independent( ...@@ -535,8 +541,8 @@ ConstrainedSolver::make_constraints_independent(
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 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 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)
{ {
...@@ -635,9 +641,9 @@ ConstrainedSolver::make_constraints_independent_reordering( ...@@ -635,9 +641,9 @@ ConstrainedSolver::make_constraints_independent_reordering(
// if not found for integers with value +-1 // if not found for integers with value +-1
// and finally take the smallest integer variable // and finally take the smallest integer variable
typedef typename gmm::linalg_traits<RMatrixT>::const_sub_row_type CRowT; typedef typename linalg_traits<RMatrixT>::const_sub_row_type CRowT;
typedef typename gmm::linalg_traits<RMatrixT>::sub_row_type RowT; typedef typename linalg_traits<RMatrixT>::sub_row_type RowT;
typedef typename gmm::linalg_traits<CRowT>::const_iterator RIter; typedef typename linalg_traits<CRowT>::const_iterator RIter;
// get current condition row // get current condition row
CRowT row = gmm::mat_const_row(_constraints, i); CRowT row = gmm::mat_const_row(_constraints, i);
...@@ -744,8 +750,8 @@ ConstrainedSolver::make_constraints_independent_reordering( ...@@ -744,8 +750,8 @@ ConstrainedSolver::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 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 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)
{ {
...@@ -828,8 +834,8 @@ ConstrainedSolver::update_constraint_gcd(RMatrixT& _constraints, ...@@ -828,8 +834,8 @@ ConstrainedSolver::update_constraint_gcd(RMatrixT& _constraints,
return false; return false;
// divide by gcd // divide by gcd
typedef typename gmm::linalg_traits<RMatrixT>::const_sub_row_type CRowT; typedef typename linalg_traits<RMatrixT>::const_sub_row_type CRowT;
typedef typename gmm::linalg_traits<CRowT>::const_iterator RIter; typedef typename linalg_traits<CRowT>::const_iterator RIter;
// get current constraint row // get current constraint row
RIter row_it = gmm::vect_const_begin(gmm::mat_const_row(_constraints, _row_i)); RIter row_it = gmm::vect_const_begin(gmm::mat_const_row(_constraints, _row_i));
...@@ -882,8 +888,8 @@ ConstrainedSolver::eliminate_constraints( ...@@ -882,8 +888,8 @@ ConstrainedSolver::eliminate_constraints(
SVector3T col = _Bcol.col(cur_j); SVector3T col = _Bcol.col(cur_j);
// iterate over column // iterate over column
typename gmm::linalg_traits<SVector3T>::const_iterator c_it = gmm::vect_const_begin(col); typename linalg_traits<SVector3T>::const_iterator c_it = gmm::vect_const_begin(col);
typename gmm::linalg_traits<SVector3T>::const_iterator c_end = gmm::vect_const_end(col); typename linalg_traits<SVector3T>::const_iterator c_end = gmm::vect_const_end(col);
for (; c_it != c_end; ++c_it) for (; c_it != c_end; ++c_it)
add_row(c_it.index(), -(*c_it) / cur_val, gmm::mat_row(_constraints, i), _Bcol); add_row(c_it.index(), -(*c_it) / cur_val, gmm::mat_row(_constraints, i), _Bcol);
...@@ -946,8 +952,8 @@ ConstrainedSolver::eliminate_constraints( ...@@ -946,8 +952,8 @@ ConstrainedSolver::eliminate_constraints(
Base::StopWatch sw; Base::StopWatch sw;
sw.start(); sw.start();
// define iterator on matrix A and on constraints C // define iterator on matrix A and on constraints C
typedef typename gmm::linalg_traits<SVector2T>::const_iterator AIter; typedef typename linalg_traits<SVector2T>::const_iterator AIter;
typedef typename gmm::linalg_traits<SVector1T>::const_iterator CIter; typedef typename linalg_traits<SVector1T>::const_iterator CIter;
// store variable indices to be eliminated // store variable indices to be eliminated
std::vector<int> elim_varids; std::vector<int> elim_varids;
...@@ -1091,7 +1097,7 @@ ConstrainedSolver::add_row(gmm::size_type _row_i, ...@@ -1091,7 +1097,7 @@ ConstrainedSolver::add_row(gmm::size_type _row_i,
RowT _row, RowT _row,
MatrixT& _mat) MatrixT& _mat)
{ {
typedef typename gmm::linalg_traits<RowT>::const_iterator RIter; typedef typename linalg_traits<RowT>::const_iterator RIter;
RIter r_it = gmm::vect_const_begin(_row); RIter r_it = gmm::vect_const_begin(_row);
RIter r_end = gmm::vect_const_end(_row); RIter r_end = gmm::vect_const_end(_row);
...@@ -1111,7 +1117,7 @@ ConstrainedSolver::add_row_simultaneously(gmm::size_type _row_i, ...@@ -1111,7 +1117,7 @@ ConstrainedSolver::add_row_simultaneously(gmm::size_type _row_i,
RMatrixT& _rmat, RMatrixT& _rmat,
CMatrixT& _cmat) CMatrixT& _cmat)
{ {
typedef typename gmm::linalg_traits<RowT>::const_iterator RIter; typedef typename linalg_traits<RowT>::const_iterator RIter;
RIter r_it = gmm::vect_const_begin(_row); RIter r_it = gmm::vect_const_begin(_row);
RIter r_end = gmm::vect_const_end(_row); RIter r_end = gmm::vect_const_end(_row);
...@@ -1325,8 +1331,8 @@ ConstrainedSolver::verify_constrained_system( ...@@ -1325,8 +1331,8 @@ ConstrainedSolver::verify_constrained_system(
double _eps) double _eps)
{ {
DEB_enter_func; DEB_enter_func;
typedef typename gmm::linalg_traits<RMatrixT>::const_sub_row_type RowT; typedef typename linalg_traits<RMatrixT>::const_sub_row_type RowT;
typedef typename gmm::linalg_traits<RowT>::const_iterator RIter; typedef typename linalg_traits<RowT>::const_iterator RIter;
VectorT Ax(_x.size()); VectorT Ax(_x.size());
gmm::mult(_A, _x, Ax); gmm::mult(_A, _x, Ax);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment