ADD implement Container assignment without temporary for dense and sparse vector/matrix
This commit is contained in:
parent
1ba0d69054
commit
c04f25e1a0
@ -182,9 +182,9 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
data () = m.data ();
|
||||
return *this;
|
||||
}
|
||||
template<class L2, class A2> // Generic matrix assignment without temporary
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
matrix &operator = (const matrix<T, L2, A2> &m) {
|
||||
matrix &operator = (const matrix_container<C> &m) {
|
||||
resize (m.size1 (), m.size2 ());
|
||||
assign (m);
|
||||
return *this;
|
||||
@ -212,6 +212,12 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this + ae);
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
matrix &operator += (const matrix_container<C> &m) {
|
||||
plus_assign (m);
|
||||
return *this;
|
||||
}
|
||||
template<class AE>
|
||||
BOOST_UBLAS_INLINE
|
||||
matrix &plus_assign (const matrix_expression<AE> &ae) {
|
||||
@ -224,6 +230,12 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this - ae);
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
matrix &operator -= (const matrix_container<C> &m) {
|
||||
minus_assign (m);
|
||||
return *this;
|
||||
}
|
||||
template<class AE>
|
||||
BOOST_UBLAS_INLINE
|
||||
matrix &minus_assign (const matrix_expression<AE> &ae) {
|
||||
@ -958,7 +970,13 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
}
|
||||
template<class L2, class A2> // Generic matrix assignment
|
||||
BOOST_UBLAS_INLINE
|
||||
bounded_matrix &operator = (const matrix<T, L2, L2> &m) {
|
||||
bounded_matrix &operator = (const matrix<T, L2, A2> &m) {
|
||||
matrix_type::operator = (m);
|
||||
return *this;
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
bounded_matrix &operator = (const matrix_container<C> &m) {
|
||||
matrix_type::operator = (m);
|
||||
return *this;
|
||||
}
|
||||
@ -1111,6 +1129,13 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (ae);
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
vector_of_vector &operator = (const matrix_container<C> &m) {
|
||||
resize (m.size1 (), m.size2 ());
|
||||
assign (m);
|
||||
return *this;
|
||||
}
|
||||
template<class AE>
|
||||
BOOST_UBLAS_INLINE
|
||||
vector_of_vector &assign (const matrix_expression<AE> &ae) {
|
||||
@ -1123,6 +1148,12 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this + ae);
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
vector_of_vector &operator += (const matrix_container<C> &m) {
|
||||
plus_assign (m);
|
||||
return *this;
|
||||
}
|
||||
template<class AE>
|
||||
BOOST_UBLAS_INLINE
|
||||
vector_of_vector &plus_assign (const matrix_expression<AE> &ae) {
|
||||
@ -1135,6 +1166,12 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this - ae);
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
vector_of_vector &operator -= (const matrix_container<C> &m) {
|
||||
minus_assign (m);
|
||||
return *this;
|
||||
}
|
||||
template<class AE>
|
||||
BOOST_UBLAS_INLINE
|
||||
vector_of_vector &minus_assign (const matrix_expression<AE> &ae) {
|
||||
@ -3196,6 +3233,13 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
std::copy (m.data_ [i], m.data_ [i] + m.size2_, data_ [i]);
|
||||
return *this;
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
c_matrix &operator = (const matrix_container<C> &m) {
|
||||
resize (m.size1 (), m.size2 ());
|
||||
assign (m);
|
||||
return *this;
|
||||
}
|
||||
BOOST_UBLAS_INLINE
|
||||
c_matrix &assign_temporary (c_matrix &m) {
|
||||
swap (m);
|
||||
@ -3219,6 +3263,12 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this + ae);
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
c_matrix &operator += (const matrix_container<C> &m) {
|
||||
plus_assign (m);
|
||||
return *this;
|
||||
}
|
||||
template<class AE>
|
||||
BOOST_UBLAS_INLINE
|
||||
c_matrix &plus_assign (const matrix_expression<AE> &ae) {
|
||||
@ -3231,6 +3281,12 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this - ae);
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
c_matrix &operator -= (const matrix_container<C> &m) {
|
||||
minus_assign (m);
|
||||
return *this;
|
||||
}
|
||||
template<class AE>
|
||||
BOOST_UBLAS_INLINE
|
||||
c_matrix &minus_assign (const matrix_expression<AE> &ae) {
|
||||
|
@ -428,6 +428,13 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
mapped_matrix &operator = (const matrix_container<C> &m) {
|
||||
resize (m.size1 (), m.size2 ());
|
||||
assign (m);
|
||||
return *this;
|
||||
}
|
||||
BOOST_UBLAS_INLINE
|
||||
mapped_matrix &assign_temporary (mapped_matrix &m) {
|
||||
swap (m);
|
||||
@ -451,6 +458,12 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this + ae, detail::map_capacity (data ()));
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
mapped_matrix &operator += (const matrix_container<C> &m) {
|
||||
plus_assign (m);
|
||||
return *this;
|
||||
}
|
||||
template<class AE>
|
||||
BOOST_UBLAS_INLINE
|
||||
mapped_matrix &plus_assign (const matrix_expression<AE> &ae) {
|
||||
@ -463,6 +476,12 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this - ae, detail::map_capacity (data ()));
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
mapped_matrix &operator -= (const matrix_container<C> &m) {
|
||||
minus_assign (m);
|
||||
return *this;
|
||||
}
|
||||
template<class AE>
|
||||
BOOST_UBLAS_INLINE
|
||||
mapped_matrix &minus_assign (const matrix_expression<AE> &ae) {
|
||||
@ -1478,6 +1497,13 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
mapped_vector_of_mapped_vector &operator = (const matrix_container<C> &m) {
|
||||
resize (m.size1 (), m.size2 ());
|
||||
assign (m);
|
||||
return *this;
|
||||
}
|
||||
BOOST_UBLAS_INLINE
|
||||
mapped_vector_of_mapped_vector &assign_temporary (mapped_vector_of_mapped_vector &m) {
|
||||
swap (m);
|
||||
@ -1501,6 +1527,12 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this + ae);
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
mapped_vector_of_mapped_vector &operator += (const matrix_container<C> &m) {
|
||||
plus_assign (m);
|
||||
return *this;
|
||||
}
|
||||
template<class AE>
|
||||
BOOST_UBLAS_INLINE
|
||||
mapped_vector_of_mapped_vector &plus_assign (const matrix_expression<AE> &ae) {
|
||||
@ -1513,6 +1545,12 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this - ae);
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
mapped_vector_of_mapped_vector &operator -= (const matrix_container<C> &m) {
|
||||
minus_assign (m);
|
||||
return *this;
|
||||
}
|
||||
template<class AE>
|
||||
BOOST_UBLAS_INLINE
|
||||
mapped_vector_of_mapped_vector &minus_assign (const matrix_expression<AE> &ae) {
|
||||
@ -2802,6 +2840,13 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
storage_invariants ();
|
||||
return *this;
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
compressed_matrix &operator = (const matrix_container<C> &m) {
|
||||
resize (m.size1 (), m.size2 ());
|
||||
assign (m);
|
||||
return *this;
|
||||
}
|
||||
BOOST_UBLAS_INLINE
|
||||
compressed_matrix &assign_temporary (compressed_matrix &m) {
|
||||
swap (m);
|
||||
@ -2825,6 +2870,12 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this + ae, capacity_);
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
compressed_matrix &operator += (const matrix_container<C> &m) {
|
||||
plus_assign (m);
|
||||
return *this;
|
||||
}
|
||||
template<class AE>
|
||||
BOOST_UBLAS_INLINE
|
||||
compressed_matrix &plus_assign (const matrix_expression<AE> &ae) {
|
||||
@ -2837,6 +2888,12 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this - ae, capacity_);
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
compressed_matrix &operator -= (const matrix_container<C> &m) {
|
||||
minus_assign (m);
|
||||
return *this;
|
||||
}
|
||||
template<class AE>
|
||||
BOOST_UBLAS_INLINE
|
||||
compressed_matrix &minus_assign (const matrix_expression<AE> &ae) {
|
||||
@ -4091,6 +4148,13 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
storage_invariants ();
|
||||
return *this;
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
coordinate_matrix &operator = (const matrix_container<C> &m) {
|
||||
resize (m.size1 (), m.size2 ());
|
||||
assign (m);
|
||||
return *this;
|
||||
}
|
||||
BOOST_UBLAS_INLINE
|
||||
coordinate_matrix &assign_temporary (coordinate_matrix &m) {
|
||||
swap (m);
|
||||
@ -4114,6 +4178,12 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this + ae, capacity_);
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
coordinate_matrix &operator += (const matrix_container<C> &m) {
|
||||
plus_assign (m);
|
||||
return *this;
|
||||
}
|
||||
template<class AE>
|
||||
BOOST_UBLAS_INLINE
|
||||
coordinate_matrix &plus_assign (const matrix_expression<AE> &ae) {
|
||||
@ -4126,6 +4196,12 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this - ae, capacity_);
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
coordinate_matrix &operator -= (const matrix_container<C> &m) {
|
||||
minus_assign (m);
|
||||
return *this;
|
||||
}
|
||||
template<class AE>
|
||||
BOOST_UBLAS_INLINE
|
||||
coordinate_matrix &minus_assign (const matrix_expression<AE> &ae) {
|
||||
|
@ -150,9 +150,9 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
data () = v.data ();
|
||||
return *this;
|
||||
}
|
||||
template<class A2> // Generic vector assignment without temporary
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
vector &operator = (const vector<T, A2> &v) {
|
||||
vector &operator = (const vector_container<C> &v) {
|
||||
resize (v.size (), false);
|
||||
assign (v);
|
||||
return *this;
|
||||
@ -182,9 +182,9 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this + ae);
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class A2> // addative assignment without temporary
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
vector &operator += (const vector<T, A2> &v) {
|
||||
vector &operator += (const vector_container<C> &v) {
|
||||
plus_assign (v);
|
||||
return *this;
|
||||
}
|
||||
@ -200,9 +200,9 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this - ae);
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class A2> // addative assignment without temporary
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
vector &operator -= (const vector<T, A2> &v) {
|
||||
vector &operator -= (const vector_container<C> &v) {
|
||||
minus_assign (v);
|
||||
return *this;
|
||||
}
|
||||
@ -529,12 +529,18 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
vector_type::operator = (v);
|
||||
return *this;
|
||||
}
|
||||
template<class A2> // Generic vector assignment
|
||||
template<class A2> // Generic vector assignment
|
||||
BOOST_UBLAS_INLINE
|
||||
bounded_vector &operator = (const vector<T, A2> &v) {
|
||||
vector_type::operator = (v);
|
||||
return *this;
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
bounded_vector &operator = (const vector_container<C> &v) {
|
||||
vector_type::operator = (v);
|
||||
return *this;
|
||||
}
|
||||
template<class AE>
|
||||
BOOST_UBLAS_INLINE
|
||||
bounded_vector &operator = (const vector_expression<AE> &ae) {
|
||||
@ -1295,6 +1301,13 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
std::copy (v.data_, v.data_ + v.size_, data_);
|
||||
return *this;
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
c_vector &operator = (const vector_container<C> &v) {
|
||||
resize (v.size (), false);
|
||||
assign (v);
|
||||
return *this;
|
||||
}
|
||||
BOOST_UBLAS_INLINE
|
||||
c_vector &assign_temporary (c_vector &v) {
|
||||
swap (v);
|
||||
@ -1320,9 +1333,9 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this + ae);
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<std::size_t N2> // addative assignment without temporary
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
c_vector &operator += (const c_vector<T, N2> &v) {
|
||||
c_vector &operator += (const vector_container<C> &v) {
|
||||
plus_assign (v);
|
||||
return *this;
|
||||
}
|
||||
@ -1338,9 +1351,9 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this - ae);
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<std::size_t N2> // addative assignment without temporary
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
c_vector &operator -= (const c_vector<T, N2> &v) {
|
||||
c_vector &operator -= (const vector_container<C> &v) {
|
||||
minus_assign (v);
|
||||
return *this;
|
||||
}
|
||||
|
@ -444,6 +444,13 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
mapped_vector &operator = (const vector_container<C> &v) {
|
||||
resize (v.size (), false);
|
||||
assign (v);
|
||||
return *this;
|
||||
}
|
||||
BOOST_UBLAS_INLINE
|
||||
mapped_vector &assign_temporary (mapped_vector &v) {
|
||||
swap (v);
|
||||
@ -469,7 +476,7 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this + ae, detail::map_capacity (data()));
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class C> // addative assignment without temporary
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
mapped_vector &operator += (const vector_container<C> &v) {
|
||||
plus_assign (v);
|
||||
@ -487,7 +494,7 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this - ae, detail::map_capacity (data()));
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class C> // addative assignment without temporary
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
mapped_vector &operator -= (const vector_container<C> &v) {
|
||||
minus_assign (v);
|
||||
@ -987,6 +994,13 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
storage_invariants ();
|
||||
return *this;
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
compressed_vector &operator = (const vector_container<C> &v) {
|
||||
resize (v.size (), false);
|
||||
assign (v);
|
||||
return *this;
|
||||
}
|
||||
BOOST_UBLAS_INLINE
|
||||
compressed_vector &assign_temporary (compressed_vector &v) {
|
||||
swap (v);
|
||||
@ -1012,7 +1026,7 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this + ae, capacity_);
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class C> // addative assignment without temporary
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
compressed_vector &operator += (const vector_container<C> &v) {
|
||||
plus_assign (v);
|
||||
@ -1030,7 +1044,7 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this - ae, capacity_);
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class C> // addative assignment without temporary
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
compressed_vector &operator -= (const vector_container<C> &v) {
|
||||
minus_assign (v);
|
||||
@ -1598,6 +1612,13 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
storage_invariants ();
|
||||
return *this;
|
||||
}
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
coordinate_vector &operator = (const vector_container<C> &v) {
|
||||
resize (v.size (), false);
|
||||
assign (v);
|
||||
return *this;
|
||||
}
|
||||
BOOST_UBLAS_INLINE
|
||||
coordinate_vector &assign_temporary (coordinate_vector &v) {
|
||||
swap (v);
|
||||
@ -1623,7 +1644,7 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this + ae, capacity_);
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class C> // addative assignment without temporary
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
coordinate_vector &operator += (const vector_container<C> &v) {
|
||||
plus_assign (v);
|
||||
@ -1641,7 +1662,7 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
self_type temporary (*this - ae, capacity_);
|
||||
return assign_temporary (temporary);
|
||||
}
|
||||
template<class C> // addative assignment without temporary
|
||||
template<class C> // Container assignment without temporary
|
||||
BOOST_UBLAS_INLINE
|
||||
coordinate_vector &operator -= (const vector_container<C> &v) {
|
||||
minus_assign (v);
|
||||
|
Loading…
Reference in New Issue
Block a user