From d3ce3db011d33c3db26f643ff23c3a74d54c2020 Mon Sep 17 00:00:00 2001 From: Michael Stevens Date: Wed, 16 Mar 2005 09:26:54 +0000 Subject: [PATCH] _adaptor Add insert_element Fix bogus const reference (proxy) [SVN r27689] --- include/boost/numeric/ublas/hermitian.hpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/include/boost/numeric/ublas/hermitian.hpp b/include/boost/numeric/ublas/hermitian.hpp index bebf832c..3d614e3d 100644 --- a/include/boost/numeric/ublas/hermitian.hpp +++ b/include/boost/numeric/ublas/hermitian.hpp @@ -1114,6 +1114,7 @@ namespace boost { namespace numeric { namespace ublas { public matrix_expression > { typedef hermitian_adaptor self_type; + typedef typename M::value_type &true_reference; public: #ifndef BOOST_UBLAS_NO_PROXY_SHORTCUTS using matrix_expression::operator (); @@ -1132,7 +1133,7 @@ namespace boost { namespace numeric { namespace ublas { #else typedef typename boost::mpl::if_, typename M::value_type, - hermitian_matrix_element >::type reference; + hermitian_matrix_element >::type reference; #endif typedef typename boost::mpl::if_, typename M::const_closure_type, @@ -1217,20 +1218,20 @@ namespace boost { namespace numeric { namespace ublas { #endif } BOOST_UBLAS_INLINE - void at (size_type i, size_type j, value_type t) { + true_reference insert_element (size_type i, size_type j, value_type t) { BOOST_UBLAS_CHECK (i < size1 (), bad_index ()); BOOST_UBLAS_CHECK (j < size2 (), bad_index ()); // if (i == j) // data () (i, i) = type_traits::real (t); // else if (triangular_type::other (i, j)) - data () (i, j) = t; + return data () (i, j) = t; else - data () (j, i) = type_traits::conj (t); + return data () (j, i) = type_traits::conj (t); } #else BOOST_UBLAS_INLINE - reference operator () (size_type i, size_type j) const { + reference operator () (size_type i, size_type j) { BOOST_UBLAS_CHECK (i < size1 (), bad_index ()); BOOST_UBLAS_CHECK (j < size2 (), bad_index ()); #ifndef BOOST_UBLAS_STRICT_HERMITIAN @@ -1248,16 +1249,16 @@ namespace boost { namespace numeric { namespace ublas { #endif } BOOST_UBLAS_INLINE - void at (size_type i, size_type j, value_type t) const { + true_reference insert_element (size_type i, size_type j, value_type t) { BOOST_UBLAS_CHECK (i < size1 (), bad_index ()); BOOST_UBLAS_CHECK (j < size2 (), bad_index ()); // if (i == j) // data () (i, i) = type_traits::real (t); // else if (triangular_type::other (i, j)) - data () (i, j) = t; + return data () (i, j) = t; else - data () (j, i) = type_traits::conj (t); + return data () (j, i) = type_traits::conj (t); } #endif