Index: boost/numeric/ublas/banded.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/numeric/ublas/banded.hpp,v retrieving revision 1.61 diff -u -p -r1.61 banded.hpp --- boost/numeric/ublas/banded.hpp 13 Jul 2005 16:28:20 -0000 1.61 +++ boost/numeric/ublas/banded.hpp 30 Aug 2005 06:38:06 -0000 @@ -30,9 +30,9 @@ namespace boost { namespace numeric { na public matrix_container > { typedef T *pointer; - typedef L layout_type; typedef banded_matrix self_type; public: + typedef L layout_type; #ifdef BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS using matrix_container::operator (); #endif Index: boost/numeric/ublas/functional.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/numeric/ublas/functional.hpp,v retrieving revision 1.33 diff -u -p -r1.33 functional.hpp --- boost/numeric/ublas/functional.hpp 25 Aug 2005 11:00:44 -0000 1.33 +++ boost/numeric/ublas/functional.hpp 30 Aug 2005 06:38:07 -0000 @@ -1302,18 +1303,22 @@ namespace boost { namespace numeric { na static BOOST_UBLAS_INLINE result_type apply (const matrix_expression &e) { real_type t = real_type (); - size_type size2 (e ().size2 ()); - for (size_type j = 0; j < size2; ++ j) { - real_type u = real_type (); - size_type size1 (e ().size1 ()); - for (size_type i = 0; i < size1; ++ i) { - real_type v (type_traits::norm_1 (e () (i, j))); + // This is inefficient for row major orientation, but we would + // need additional storage for a better algorithm + typename E::const_iterator2 it2 = e().begin2(); + typename E::const_iterator2 const end2 = e().end2(); + for (; it2 != end2; ++it2) { + real_type u = real_type(); + typename E::const_iterator1 it1 = it2.begin(); + typename E::const_iterator1 const end1 = it2.end(); + for (; it1 != end1; ++it1) { + real_type v(type_traits::norm_1(*it1)); u += v; } if (u > t) t = u; } - return t; + return t; } }; template @@ -1329,12 +1334,30 @@ namespace boost { namespace numeric { na static BOOST_UBLAS_INLINE result_type apply (const matrix_expression &e) { real_type t = real_type (); - size_type size1 (e ().size1 ()); - for (size_type i = 0; i < size1; ++ i) { - size_type size2 (e ().size2 ()); - for (size_type j = 0; j < size2; ++ j) { - real_type u (type_traits::norm_2 (e () (i, j))); - t += u * u; + if (E::layout_type::fast1()) { + // FIXME: this should be a compile time if! + // column major + typename E::const_iterator2 it2 = e().begin2(); + typename E::const_iterator2 const end2 = e().end2(); + for (; it2 != end2; ++it2) { + typename E::const_iterator1 it1 = it2.begin(); + typename E::const_iterator1 const end1 = it2.end(); + for (; it1 != end1; ++it1) { + real_type u(type_traits::norm_2(*it1)); + t += u * u; + } + } + } else { + // row major + typename E::const_iterator1 it1 = e().begin1(); + typename E::const_iterator1 const end1 = e().end1(); + for (; it1 != end1; ++it1) { + typename E::const_iterator2 it2 = it1.begin(); + typename E::const_iterator2 const end2 = it1.end(); + for (; it2 != end2; ++it2) { + real_type u(type_traits::norm_2(*it2)); + t += u * u; + } } } return type_traits::type_sqrt (t); @@ -1353,18 +1376,22 @@ namespace boost { namespace numeric { na static BOOST_UBLAS_INLINE result_type apply (const matrix_expression &e) { real_type t = real_type (); - size_type size1 (e ().size1 ()); - for (size_type i = 0; i < size1; ++ i) { - real_type u = real_type (); - size_type size2 (e ().size2 ()); - for (size_type j = 0; j < size2; ++ j) { - real_type v (type_traits::norm_inf (e () (i, j))); + // This is inefficient for column major orientation, but we would + // need additional storage for a better algorithm + typename E::const_iterator1 it1 = e().begin1(); + typename E::const_iterator1 const end1 = e().end1(); + for (; it1 != end1; ++it1) { + real_type u = real_type(); + typename E::const_iterator2 it2 = it1.begin(); + typename E::const_iterator2 const end2 = it1.end(); + for (; it2 != end2; ++it2) { + real_type v(type_traits::norm_inf(*it2)); u += v; } if (u > t) t = u; } - return t; + return t; } }; Index: boost/numeric/ublas/hermitian.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/numeric/ublas/hermitian.hpp,v retrieving revision 1.53 diff -u -p -r1.53 hermitian.hpp --- boost/numeric/ublas/hermitian.hpp 25 Aug 2005 11:00:44 -0000 1.53 +++ boost/numeric/ublas/hermitian.hpp 30 Aug 2005 06:38:07 -0000 @@ -237,9 +237,9 @@ namespace boost { namespace numeric { na typedef T &true_reference; typedef T *pointer; typedef TRI triangular_type; - typedef L layout_type; typedef hermitian_matrix self_type; public: + typedef L layout_type; #ifdef BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS using matrix_container::operator (); #endif Index: boost/numeric/ublas/matrix.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/numeric/ublas/matrix.hpp,v retrieving revision 1.63 diff -u -p -r1.63 matrix.hpp --- boost/numeric/ublas/matrix.hpp 12 Aug 2005 17:25:06 -0000 1.63 +++ boost/numeric/ublas/matrix.hpp 30 Aug 2005 06:38:08 -0000 @@ -63,12 +63,12 @@ namespace boost { namespace numeric { na public matrix_container > { typedef T *pointer; - typedef L layout_type; typedef matrix self_type; public: #ifdef BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS using matrix_container::operator (); #endif + typedef L layout_type; typedef typename A::size_type size_type; typedef typename A::difference_type difference_type; typedef T value_type; @@ -995,12 +995,12 @@ namespace boost { namespace numeric { na public matrix_container > { typedef T *pointer; - typedef L layout_type; typedef vector_of_vector self_type; public: #ifdef BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS using matrix_container::operator (); #endif + typedef L layout_type; typedef typename A::size_type size_type; typedef typename A::difference_type difference_type; typedef T value_type; @@ -2299,6 +2299,8 @@ namespace boost { namespace numeric { na typedef const T *const_pointer; typedef identity_matrix self_type; public: + // FIXME: wrong! + typedef row_major layout_type; #ifdef BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS using matrix_container::operator (); #endif Index: boost/numeric/ublas/matrix_expression.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/numeric/ublas/matrix_expression.hpp,v retrieving revision 1.60 diff -u -p -r1.60 matrix_expression.hpp --- boost/numeric/ublas/matrix_expression.hpp 29 Jul 2005 12:18:39 -0000 1.60 +++ boost/numeric/ublas/matrix_expression.hpp 30 Aug 2005 06:38:08 -0000 @@ -35,6 +35,7 @@ namespace boost { namespace numeric { na #ifdef BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS using matrix_expression::operator (); #endif + typedef typename E::layout_type layout_type; typedef typename E::size_type size_type; typedef typename E::difference_type difference_type; typedef typename E::value_type value_type; Index: boost/numeric/ublas/matrix_sparse.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/numeric/ublas/matrix_sparse.hpp,v retrieving revision 1.77 diff -u -p -r1.77 matrix_sparse.hpp --- boost/numeric/ublas/matrix_sparse.hpp 25 Aug 2005 11:00:44 -0000 1.77 +++ boost/numeric/ublas/matrix_sparse.hpp 30 Aug 2005 06:38:09 -0000 @@ -255,12 +255,12 @@ namespace boost { namespace numeric { na typedef T &true_reference; typedef T *pointer; typedef const T * const_pointer; - typedef L layout_type; typedef mapped_matrix self_type; public: #ifdef BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS using matrix_container::operator (); #endif + typedef L layout_type; typedef typename A::size_type size_type; typedef typename A::difference_type difference_type; typedef T value_type; @@ -1312,12 +1312,12 @@ namespace boost { namespace numeric { na typedef const T *const_pointer; typedef A array_type; typedef const A const_array_type; - typedef L layout_type; typedef mapped_vector_of_mapped_vector self_type; public: #ifdef BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS using matrix_container::operator (); #endif + typedef L layout_type; typedef typename A::size_type size_type; typedef typename A::difference_type difference_type; typedef T value_type; @@ -2498,12 +2498,12 @@ namespace boost { namespace numeric { na typedef T &true_reference; typedef T *pointer; typedef const T *const_pointer; - typedef L layout_type; typedef compressed_matrix self_type; public: #ifdef BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS using matrix_container::operator (); #endif + typedef L layout_type; // ISSUE require type consistency check // is_convertable (IA::size_type, TA::size_type) typedef typename IA::value_type size_type; @@ -3859,12 +3919,12 @@ namespace boost { namespace numeric { na typedef T &true_reference; typedef T *pointer; typedef const T *const_pointer; - typedef L layout_type; typedef coordinate_matrix self_type; public: #ifdef BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS using matrix_container::operator (); #endif + typedef L layout_type; // ISSUE require type consistency check // is_convertable (IA::size_type, TA::size_type) typedef typename IA::value_type size_type; Index: boost/numeric/ublas/symmetric.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/numeric/ublas/symmetric.hpp,v retrieving revision 1.52 diff -u -p -r1.52 symmetric.hpp --- boost/numeric/ublas/symmetric.hpp 13 Jul 2005 06:14:53 -0000 1.52 +++ boost/numeric/ublas/symmetric.hpp 30 Aug 2005 06:38:09 -0000 @@ -48,9 +48,9 @@ namespace boost { namespace numeric { na typedef T *pointer; typedef TRI triangular_type; - typedef L layout_type; typedef symmetric_matrix self_type; public: + typedef L layout_type; #ifdef BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS using matrix_container::operator (); #endif