diff --git a/dune/matrix-vector/triangularsolve.hh b/dune/matrix-vector/triangularsolve.hh index 46012ae249e8408757327c4d0763167273917181..fa014d17bf84aa34f652a2469b3c0012c9aa7752 100644 --- a/dune/matrix-vector/triangularsolve.hh +++ b/dune/matrix-vector/triangularsolve.hh @@ -3,30 +3,6 @@ namespace Dune { namespace MatrixVector { - // From http://stackoverflow.com/a/28139075/179927 - // Note: free rbegin()/rend() still missing gcc 4.9.x version of libstdc++ - namespace { - template <typename T> - struct reversion_wrapper { - T& iterable; - }; - - template <typename T> - auto begin(reversion_wrapper<T> w) { - return w.iterable.rbegin(); - } - - template <typename T> - auto end(reversion_wrapper<T> w) { - return w.iterable.rend(); - } - - template <typename T> - reversion_wrapper<T> reverse(T&& iterable) { - return {iterable}; - } - } - template <class Matrix, class Vector, class BitVector> static void lowerTriangularSolve(Matrix const& A, Vector const& b, Vector& x, BitVector const* ignore, @@ -62,11 +38,7 @@ namespace MatrixVector { if (transpose) { // TODO: not yet handled } else { - std::vector<typename Matrix::ConstIterator> rows(U.N()); - for (auto it = U.begin(); it != U.end(); ++it) - rows[it.index()] = it; - - for (auto it : reverse(rows)) { + for (auto it = U.beforeEnd(); it != U.beforeBegin(); --it) { size_t i = it.index(); if (ignore != nullptr and (*ignore)[i].all()) continue;