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.