From b0e109cdebe7205345c951873a536f7f0a5ff2fd Mon Sep 17 00:00:00 2001 From: Gunter Winkler Date: Mon, 1 Sep 2008 21:32:55 +0000 Subject: [PATCH] - fix and close #2275 - added missing changes of triangular_adaptor (see rev. 48466) - fixed order of arguments in functional basic_strict_lower::global_restrict1(...) --- include/boost/numeric/ublas/functional.hpp | 4 ++-- include/boost/numeric/ublas/triangular.hpp | 24 ++++++++++++++-------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/include/boost/numeric/ublas/functional.hpp b/include/boost/numeric/ublas/functional.hpp index 7c4fefa8..2d420d41 100644 --- a/include/boost/numeric/ublas/functional.hpp +++ b/include/boost/numeric/ublas/functional.hpp @@ -2020,13 +2020,13 @@ namespace boost { namespace numeric { namespace ublas { static BOOST_UBLAS_INLINE size_type global_restrict1 (size_type index1, size_type size1, size_type index2, size_type size2) { - return global_mutable_restrict1(index1, index2, size1, size2); + return global_mutable_restrict1(index1, size1, index2, size2); } // return an index between the first and (1+last) filled column static BOOST_UBLAS_INLINE size_type global_restrict2 (size_type index1, size_type size1, size_type index2, size_type size2) { - return global_mutable_restrict2(index1, index2, size1, size2); + return global_mutable_restrict2(index1, size1, index2, size2); } }; diff --git a/include/boost/numeric/ublas/triangular.hpp b/include/boost/numeric/ublas/triangular.hpp index 8bbef2ee..fadba43f 100644 --- a/include/boost/numeric/ublas/triangular.hpp +++ b/include/boost/numeric/ublas/triangular.hpp @@ -1153,26 +1153,34 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_INLINE const_iterator1 find1 (int rank, size_type i, size_type j) const { if (rank == 1) - i = triangular_type::restrict1 (i, j); - return const_iterator1 (*this, data ().find1 (rank, i, j)); + i = triangular_type::restrict1 (i, j, size1(), size2()); + if (rank == 0) + i = triangular_type::global_restrict1 (i, size1(), j, size2()); + return const_iterator1 (*this, data ().find1 (rank, i, j)); } BOOST_UBLAS_INLINE iterator1 find1 (int rank, size_type i, size_type j) { if (rank == 1) - i = triangular_type::mutable_restrict1 (i, j); - return iterator1 (*this, data ().find1 (rank, i, j)); + i = triangular_type::mutable_restrict1 (i, j, size1(), size2()); + if (rank == 0) + i = triangular_type::global_mutable_restrict1 (i, size1(), j, size2()); + return iterator1 (*this, data ().find1 (rank, i, j)); } BOOST_UBLAS_INLINE const_iterator2 find2 (int rank, size_type i, size_type j) const { if (rank == 1) - j = triangular_type::restrict2 (i, j); - return const_iterator2 (*this, data ().find2 (rank, i, j)); + j = triangular_type::restrict2 (i, j, size1(), size2()); + if (rank == 0) + j = triangular_type::global_restrict2 (i, size1(), j, size2()); + return const_iterator2 (*this, data ().find2 (rank, i, j)); } BOOST_UBLAS_INLINE iterator2 find2 (int rank, size_type i, size_type j) { if (rank == 1) - j = triangular_type::mutable_restrict2 (i, j); - return iterator2 (*this, data ().find2 (rank, i, j)); + j = triangular_type::mutable_restrict2 (i, j, size1(), size2()); + if (rank == 0) + j = triangular_type::global_mutable_restrict2 (i, size1(), j, size2()); + return iterator2 (*this, data ().find2 (rank, i, j)); } // Iterators simply are indices.