diff --git a/include/boost/numeric/ublas/banded.hpp b/include/boost/numeric/ublas/banded.hpp index 539ff70d..cc63a52b 100644 --- a/include/boost/numeric/ublas/banded.hpp +++ b/include/boost/numeric/ublas/banded.hpp @@ -199,6 +199,10 @@ namespace boost { namespace numeric { namespace ublas { reference insert_element (size_type i, size_type j, const_reference t) { return (operator () (i, j) = t); } + BOOST_UBLAS_INLINE + void erase_element (size_type i, size_type j) { + return (operator () (i, j) = value_type/*zero*/()); + } // Zeroing BOOST_UBLAS_INLINE diff --git a/include/boost/numeric/ublas/hermitian.hpp b/include/boost/numeric/ublas/hermitian.hpp index b83bf4e8..9366ee00 100644 --- a/include/boost/numeric/ublas/hermitian.hpp +++ b/include/boost/numeric/ublas/hermitian.hpp @@ -384,6 +384,12 @@ namespace boost { namespace numeric { namespace ublas { return (data () [triangular_type::element (layout_type (), j, size_, i, size_)] = type_traits::conj (t)); } } + BOOST_UBLAS_INLINE + void erase_element (size_type i, size_type j) { + BOOST_UBLAS_CHECK (i < size_, bad_index ()); + BOOST_UBLAS_CHECK (j < size_, bad_index ()); + data () [triangular_type::element (layout_type (), i, size_, j, size_)] = value_type/*zero*/(); + } // Zeroing BOOST_UBLAS_INLINE diff --git a/include/boost/numeric/ublas/matrix.hpp b/include/boost/numeric/ublas/matrix.hpp index ff44d202..e5aff74e 100644 --- a/include/boost/numeric/ublas/matrix.hpp +++ b/include/boost/numeric/ublas/matrix.hpp @@ -163,7 +163,10 @@ namespace boost { namespace numeric { namespace ublas { reference insert_element (size_type i, size_type j, const_reference t) { return (at_element (i, j) = t); } - + void erase_element (size_type i, size_type j) { + return (at_element (i, j) = value_type/*zero*/()); + } + // Zeroing BOOST_UBLAS_INLINE void clear () { @@ -1075,6 +1078,10 @@ namespace boost { namespace numeric { namespace ublas { reference insert_element (size_type i, size_type j, const_reference t) { return (at_element (i, j) = t); } + BOOST_UBLAS_INLINE + void erase_element (size_type i, size_type j) { + return (at_element (i, j) = value_type/*zero*/()); + } // Zeroing BOOST_UBLAS_INLINE diff --git a/include/boost/numeric/ublas/symmetric.hpp b/include/boost/numeric/ublas/symmetric.hpp index 96ac348c..5b0e178b 100644 --- a/include/boost/numeric/ublas/symmetric.hpp +++ b/include/boost/numeric/ublas/symmetric.hpp @@ -171,6 +171,10 @@ namespace boost { namespace numeric { namespace ublas { reference insert_element (size_type i, size_type j, const_reference t) { return (operator () (i, j) = t); } + BOOST_UBLAS_INLINE + void erase_element (size_type i, size_type j) { + return (operator () (i, j) = value_type/*zero*/()); + } // Zeroing BOOST_UBLAS_INLINE diff --git a/include/boost/numeric/ublas/triangular.hpp b/include/boost/numeric/ublas/triangular.hpp index f0b60465..fb0e1709 100644 --- a/include/boost/numeric/ublas/triangular.hpp +++ b/include/boost/numeric/ublas/triangular.hpp @@ -153,6 +153,10 @@ namespace boost { namespace numeric { namespace ublas { reference insert_element (size_type i, size_type j, const_reference t) { return (operator () (i, j) = t); } + BOOST_UBLAS_INLINE + void erase_element (size_type i, size_type j) { + return (operator () (i, j) = value_type/*zero*/()); + } // Zeroing BOOST_UBLAS_INLINE diff --git a/include/boost/numeric/ublas/vector.hpp b/include/boost/numeric/ublas/vector.hpp index 24b7a831..9e86b596 100644 --- a/include/boost/numeric/ublas/vector.hpp +++ b/include/boost/numeric/ublas/vector.hpp @@ -132,6 +132,10 @@ namespace boost { namespace numeric { namespace ublas { reference insert_element (size_type i, const_reference t) { return (data () [i] = t); } + BOOST_UBLAS_INLINE + void erase_element (size_type i) { + data () [i] = value_type/*zero*/(); + } // Zeroing BOOST_UBLAS_INLINE @@ -1258,6 +1262,11 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_CHECK (i < size_, bad_index ()); return (data_ [i] = t); } + BOOST_UBLAS_INLINE + void erase_element (size_type i) { + BOOST_UBLAS_CHECK (i < size_, bad_index ()); + return (data_ [i] = value_type/*zero*/()); + } // Zeroing BOOST_UBLAS_INLINE