|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r66578 - trunk/boost/numeric/ublas
From: david.bellot_at_[hidden]
Date: 2010-11-14 14:35:14
Author: david.bellot
Date: 2010-11-14 14:35:11 EST (Sun, 14 Nov 2010)
New Revision: 66578
URL: http://svn.boost.org/trac/boost/changeset/66578
Log:
more doc
Text files modified:
trunk/boost/numeric/ublas/matrix.hpp | 38 ++++++++++++++++++++++++++++++++++++++
trunk/boost/numeric/ublas/storage.hpp | 5 +++++
trunk/boost/numeric/ublas/vector_expression.hpp | 12 ++++++++++++
3 files changed, 55 insertions(+), 0 deletions(-)
Modified: trunk/boost/numeric/ublas/matrix.hpp
==============================================================================
--- trunk/boost/numeric/ublas/matrix.hpp (original)
+++ trunk/boost/numeric/ublas/matrix.hpp 2010-11-14 14:35:11 EST (Sun, 14 Nov 2010)
@@ -225,29 +225,67 @@
}
// Element access
+
+ /** Access a matrix element. Here we return a const reference
+ * \param i the first coordinate of the element. By default it's the row
+ * \param j the second coordinate of the element. By default it's the column
+ * \return a const reference to the element
+ */
BOOST_UBLAS_INLINE
const_reference operator () (size_type i, size_type j) const {
return data () [layout_type::element (i, size1_, j, size2_)];
}
+
+ /** Access a matrix element. Here we return a reference
+ * \param i the first coordinate of the element. By default it's the row
+ * \param j the second coordinate of the element. By default it's the column
+ * \return a reference to the element
+ */
BOOST_UBLAS_INLINE
reference at_element (size_type i, size_type j) {
return data () [layout_type::element (i, size1_, j, size2_)];
}
+
+ /** Access a matrix element. Here we return a reference
+ * \param i the first coordinate of the element. By default it's the row
+ * \param j the second coordinate of the element. By default it's the column
+ * \return a reference to the element
+ */
BOOST_UBLAS_INLINE
reference operator () (size_type i, size_type j) {
return at_element (i, j);
}
// Element assignment
+
+ /** Change the value of a matrix element. Return back a reference to it
+ * \param i the first coordinate of the element. By default it's the row
+ * \param j the second coordinate of the element. By default it's the column
+ * \param t the new value of the element
+ * \return a reference to the newly changed element
+ */
BOOST_UBLAS_INLINE
reference insert_element (size_type i, size_type j, const_reference t) {
return (at_element (i, j) = t);
}
+
+ /** Erase the element
+ * For most types (int, double, etc...) it means setting 0 (zero) the element at zero in fact.
+ * For user-defined types, it could be another value if you decided it. Your type in that case must
+ * contain a default null value.
+ * \param i the first coordinate of the element. By default it's the row
+ * \param j the second coordinate of the element. By default it's the column
+ */
void erase_element (size_type i, size_type j) {
at_element (i, j) = value_type/*zero*/();
}
// Zeroing
+ /** Erase all elements in the matrix
+ * For most types (int, double, etc...) it means writing 0 (zero) everywhere.
+ * For user-defined types, it could be another value if you decided it. Your type in that case must
+ * contain a default null value.
+ */
BOOST_UBLAS_INLINE
void clear () {
std::fill (data ().begin (), data ().end (), value_type/*zero*/());
Modified: trunk/boost/numeric/ublas/storage.hpp
==============================================================================
--- trunk/boost/numeric/ublas/storage.hpp (original)
+++ trunk/boost/numeric/ublas/storage.hpp 2010-11-14 14:35:11 EST (Sun, 14 Nov 2010)
@@ -464,7 +464,12 @@
private:
size_type size_;
+// MSVC does not like arrays of size 0 in base classes. Hence, this conditionally changes the size to 1
+#ifdef _MSC_VER
+ BOOST_UBLAS_BOUNDED_ARRAY_ALIGN value_type data_ [(N>0)?N:1];
+#else
BOOST_UBLAS_BOUNDED_ARRAY_ALIGN value_type data_ [N];
+#endif
};
Modified: trunk/boost/numeric/ublas/vector_expression.hpp
==============================================================================
--- trunk/boost/numeric/ublas/vector_expression.hpp (original)
+++ trunk/boost/numeric/ublas/vector_expression.hpp 2010-11-14 14:35:11 EST (Sun, 14 Nov 2010)
@@ -1167,6 +1167,18 @@
#endif
};
+ // (t + v) [i] = scalar_vector<T1>(v.size(),t) + v;
+ template<class T1, class E2>
+ BOOST_UBLAS_INLINE
+ typename enable_if< is_convertible<T1, typename E2::value_type >,
+ typename vector_binary_scalar1_traits<const T1, E2, scalar_addtion<T1, typename E2::value_type> >::result_type
+ >::type
+ operator + (const T1 &e1,
+ const vector_expression<E2> &e2) {
+ typedef typename vector_binary_scalar1_traits<const T1, E2, scalar_addition<T1, typename E2::value_type> >::expression_type expression_type;
+ return expression_type (e1, e2 ());
+ }
+
// (t * v) [i] = t * v [i]
template<class T1, class E2>
BOOST_UBLAS_INLINE
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk