summaryrefslogtreecommitdiff
path: root/boost/numeric/ublas
diff options
context:
space:
mode:
Diffstat (limited to 'boost/numeric/ublas')
-rw-r--r--boost/numeric/ublas/detail/matrix_assign.hpp16
-rw-r--r--boost/numeric/ublas/experimental/sparse_view.hpp1
-rw-r--r--boost/numeric/ublas/functional.hpp3
-rw-r--r--boost/numeric/ublas/matrix_expression.hpp2
-rw-r--r--boost/numeric/ublas/storage.hpp36
-rw-r--r--boost/numeric/ublas/traits.hpp3
-rw-r--r--boost/numeric/ublas/vector.hpp11
7 files changed, 61 insertions, 11 deletions
diff --git a/boost/numeric/ublas/detail/matrix_assign.hpp b/boost/numeric/ublas/detail/matrix_assign.hpp
index 5dea5920f..be172dd63 100644
--- a/boost/numeric/ublas/detail/matrix_assign.hpp
+++ b/boost/numeric/ublas/detail/matrix_assign.hpp
@@ -1259,20 +1259,20 @@ namespace detail {
void matrix_swap (M &m, matrix_expression<E> &e, dense_proxy_tag, row_major_tag) {
typedef F<typename M::iterator2::reference, typename E::reference> functor_type;
// R unnecessary, make_conformant not required
- typedef typename M::size_type size_type;
+ //typedef typename M::size_type size_type; // gcc is complaining that this is not used, although this is not right
typedef typename M::difference_type difference_type;
typename M::iterator1 it1 (m.begin1 ());
typename E::iterator1 it1e (e ().begin1 ());
- difference_type size1 (BOOST_UBLAS_SAME (m.size1 (), size_type (e ().end1 () - it1e)));
+ difference_type size1 (BOOST_UBLAS_SAME (m.size1 (), typename M::size_type (e ().end1 () - it1e)));
while (-- size1 >= 0) {
#ifndef BOOST_UBLAS_NO_NESTED_CLASS_RELATION
typename M::iterator2 it2 (it1.begin ());
typename E::iterator2 it2e (it1e.begin ());
- difference_type size2 (BOOST_UBLAS_SAME (m.size2 (), size_type (it1e.end () - it2e)));
+ difference_type size2 (BOOST_UBLAS_SAME (m.size2 (), typename M::size_type (it1e.end () - it2e)));
#else
typename M::iterator2 it2 (begin (it1, iterator1_tag ()));
typename E::iterator2 it2e (begin (it1e, iterator1_tag ()));
- difference_type size2 (BOOST_UBLAS_SAME (m.size2 (), size_type (end (it1e, iterator1_tag ()) - it2e)));
+ difference_type size2 (BOOST_UBLAS_SAME (m.size2 (), typename M::size_type (end (it1e, iterator1_tag ()) - it2e)));
#endif
while (-- size2 >= 0)
functor_type::apply (*it2, *it2e), ++ it2, ++ it2e;
@@ -1285,20 +1285,20 @@ namespace detail {
void matrix_swap (M &m, matrix_expression<E> &e, dense_proxy_tag, column_major_tag) {
typedef F<typename M::iterator1::reference, typename E::reference> functor_type;
// R unnecessary, make_conformant not required
- typedef typename M::size_type size_type;
+ // typedef typename M::size_type size_type; // gcc is complaining that this is not used, although this is not right
typedef typename M::difference_type difference_type;
typename M::iterator2 it2 (m.begin2 ());
typename E::iterator2 it2e (e ().begin2 ());
- difference_type size2 (BOOST_UBLAS_SAME (m.size2 (), size_type (e ().end2 () - it2e)));
+ difference_type size2 (BOOST_UBLAS_SAME (m.size2 (), typename M::size_type (e ().end2 () - it2e)));
while (-- size2 >= 0) {
#ifndef BOOST_UBLAS_NO_NESTED_CLASS_RELATION
typename M::iterator1 it1 (it2.begin ());
typename E::iterator1 it1e (it2e.begin ());
- difference_type size1 (BOOST_UBLAS_SAME (m.size1 (), size_type (it2e.end () - it1e)));
+ difference_type size1 (BOOST_UBLAS_SAME (m.size1 (), typename M::size_type (it2e.end () - it1e)));
#else
typename M::iterator1 it1 (begin (it2, iterator2_tag ()));
typename E::iterator1 it1e (begin (it2e, iterator2_tag ()));
- difference_type size1 (BOOST_UBLAS_SAME (m.size1 (), size_type (end (it2e, iterator2_tag ()) - it1e)));
+ difference_type size1 (BOOST_UBLAS_SAME (m.size1 (), typename M::size_type (end (it2e, iterator2_tag ()) - it1e)));
#endif
while (-- size1 >= 0)
functor_type::apply (*it1, *it1e), ++ it1, ++ it1e;
diff --git a/boost/numeric/ublas/experimental/sparse_view.hpp b/boost/numeric/ublas/experimental/sparse_view.hpp
index 52ad509e9..3a1641084 100644
--- a/boost/numeric/ublas/experimental/sparse_view.hpp
+++ b/boost/numeric/ublas/experimental/sparse_view.hpp
@@ -19,6 +19,7 @@
#include <boost/next_prior.hpp>
#include <boost/type_traits/remove_cv.hpp>
+#include <boost/numeric/ublas/storage.hpp>
namespace boost { namespace numeric { namespace ublas {
diff --git a/boost/numeric/ublas/functional.hpp b/boost/numeric/ublas/functional.hpp
index e6f92731f..c7c92614c 100644
--- a/boost/numeric/ublas/functional.hpp
+++ b/boost/numeric/ublas/functional.hpp
@@ -15,6 +15,8 @@
#include <functional>
+#include <boost/core/ignore_unused.hpp>
+
#include <boost/numeric/ublas/traits.hpp>
#ifdef BOOST_UBLAS_USE_DUFF_DEVICE
#include <boost/numeric/ublas/detail/duff.hpp>
@@ -1161,6 +1163,7 @@ namespace boost { namespace numeric { namespace ublas {
#elif defined(BOOST_UBLAS_HAVE_BINDINGS)
return boost::numeric::bindings::atlas::dot (c1 ().row (i), c2 ().column (j));
#else
+ boost::ignore_unused(j);
return apply (static_cast<const matrix_expression<C1> > (c1), static_cast<const matrix_expression<C2> > (c2, i));
#endif
}
diff --git a/boost/numeric/ublas/matrix_expression.hpp b/boost/numeric/ublas/matrix_expression.hpp
index 3953fad4c..a36313096 100644
--- a/boost/numeric/ublas/matrix_expression.hpp
+++ b/boost/numeric/ublas/matrix_expression.hpp
@@ -3946,7 +3946,9 @@ namespace boost { namespace numeric { namespace ublas {
// (m / t) [i] [j] = m [i] [j] / t
template<class E1, class T2>
BOOST_UBLAS_INLINE
+ typename enable_if< is_convertible<T2, typename E1::value_type>,
typename matrix_binary_scalar2_traits<E1, const T2, scalar_divides<typename E1::value_type, T2> >::result_type
+ >::type
operator / (const matrix_expression<E1> &e1,
const T2 &e2) {
typedef typename matrix_binary_scalar2_traits<E1, const T2, scalar_divides<typename E1::value_type, T2> >::expression_type expression_type;
diff --git a/boost/numeric/ublas/storage.hpp b/boost/numeric/ublas/storage.hpp
index 9dfaaee07..8821309dd 100644
--- a/boost/numeric/ublas/storage.hpp
+++ b/boost/numeric/ublas/storage.hpp
@@ -370,7 +370,7 @@ namespace boost { namespace numeric { namespace ublas {
// Random Access Container
BOOST_UBLAS_INLINE
size_type max_size () const {
- return ALLOC ().max_size();
+ return N;
}
BOOST_UBLAS_INLINE
@@ -537,6 +537,10 @@ namespace boost { namespace numeric { namespace ublas {
BOOST_UBLAS_INLINE
array_adaptor (size_type size, pointer data):
size_ (size), own_ (false), data_ (data) {}
+
+ template <size_t N>
+ BOOST_UBLAS_INLINE array_adaptor (T (&data)[N]):
+ size_ (N), own_ (false), data_ (data) {}
BOOST_UBLAS_INLINE
array_adaptor (const array_adaptor &a):
storage_array<self_type> (),
@@ -602,6 +606,16 @@ namespace boost { namespace numeric { namespace ublas {
resize_internal (size, data, init, true);
}
+ template <size_t N>
+ BOOST_UBLAS_INLINE void resize (T (&data)[N]) {
+ resize_internal (N, data, value_type (), false);
+ }
+
+ template <size_t N>
+ BOOST_UBLAS_INLINE void resize (T (&data)[N], value_type init) {
+ resize_internal (N, data, init, true);
+ }
+
BOOST_UBLAS_INLINE
size_type size () const {
return size_;
@@ -734,7 +748,7 @@ namespace boost { namespace numeric { namespace ublas {
typedef TT *argument_type;
BOOST_UBLAS_INLINE
- result_type operator () (argument_type x) {}
+ result_type operator () (argument_type /* x */) {}
};
public:
@@ -763,6 +777,10 @@ namespace boost { namespace numeric { namespace ublas {
BOOST_UBLAS_INLINE
shallow_array_adaptor (size_type size, pointer data):
size_ (size), own_ (false), data_ (data, leaker<value_type> ()) {}
+ BOOST_UBLAS_INLINE
+ template <size_t N>
+ shallow_array_adaptor (T (&data)[N]):
+ size_ (N), own_ (false), data_ (data, leaker<value_type> ()) {}
BOOST_UBLAS_INLINE
shallow_array_adaptor (const shallow_array_adaptor &a):
@@ -784,6 +802,7 @@ namespace boost { namespace numeric { namespace ublas {
std::fill (data.get () + (std::min) (size, size_), data.get () + size, init);
}
size_ = size;
+ own_ = true;
data_ = data;
}
}
@@ -794,7 +813,8 @@ namespace boost { namespace numeric { namespace ublas {
std::fill (data + (std::min) (size, size_), data + size, init);
}
size_ = size;
- data_ = data;
+ own_ = false;
+ data_.reset(data, leaker<value_type> ());
}
public:
BOOST_UBLAS_INLINE
@@ -813,6 +833,16 @@ namespace boost { namespace numeric { namespace ublas {
void resize (size_type size, pointer data, value_type init) {
resize_internal (size, data, init, true);
}
+ BOOST_UBLAS_INLINE
+ template <size_t N>
+ void resize (T (&data)[N]) {
+ resize_internal (N, data, value_type (), false);
+ }
+ BOOST_UBLAS_INLINE
+ template <size_t N>
+ void resize (T (&data)[N], value_type init) {
+ resize_internal (N, data, init, true);
+ }
BOOST_UBLAS_INLINE
size_type size () const {
diff --git a/boost/numeric/ublas/traits.hpp b/boost/numeric/ublas/traits.hpp
index 86ae9b50f..ecd52cad8 100644
--- a/boost/numeric/ublas/traits.hpp
+++ b/boost/numeric/ublas/traits.hpp
@@ -20,6 +20,9 @@
#include <boost/numeric/ublas/detail/config.hpp>
#include <boost/numeric/ublas/detail/iterator.hpp>
#include <boost/numeric/ublas/detail/returntype_deduction.hpp>
+#ifdef BOOST_UBLAS_USE_INTERVAL
+#include <boost/numeric/interval.hpp>
+#endif
#include <boost/type_traits.hpp>
#include <complex>
diff --git a/boost/numeric/ublas/vector.hpp b/boost/numeric/ublas/vector.hpp
index c90e42961..c1384c145 100644
--- a/boost/numeric/ublas/vector.hpp
+++ b/boost/numeric/ublas/vector.hpp
@@ -27,6 +27,9 @@
#ifdef BOOST_UBLAS_CPP_GE_2011
#include <array>
#include <initializer_list>
+#if defined(BOOST_MSVC) // For std::forward in fixed_vector
+#include <utility>
+#endif
#endif
// Iterators based on ideas of Jeremy Siek
@@ -903,10 +906,18 @@ namespace boost { namespace numeric { namespace ublas {
/// \brief Construct a fixed_vector from a list of values
/// This constructor enables initialization by using any of:
/// fixed_vector<double, 3> v = { 1, 2, 3 } or fixed_vector<double,3> v( {1, 2, 3} ) or fixed_vector<double,3> v( 1, 2, 3 )
+#if defined(BOOST_MSVC)
+ // This may or may not work. Maybe use this for all instead only for MSVC
+ template <typename... U>
+ fixed_vector(U&&... values) :
+ vector_container<self_type> (),
+ data_{{ std::forward<U>(values)... }} {}
+#else
template <typename... Types>
fixed_vector(value_type v0, Types... vrest) :
vector_container<self_type> (),
data_{ { v0, vrest... } } {}
+#endif
// -----------------------
// Random Access Container