mirror of
https://github.com/boostorg/ublas.git
synced 2026-02-21 15:32:12 +00:00
merged changes with the trunk after patch on assignment (only cosmetic changes)
[SVN r84594]
This commit is contained in:
@@ -451,7 +451,7 @@ public:
|
||||
* \endcode
|
||||
* \sa begin2()
|
||||
*/
|
||||
BOOST_UBLAS_INLINE begin1_manip begin1() {
|
||||
inline begin1_manip begin1() {
|
||||
return begin1_manip();
|
||||
}
|
||||
|
||||
@@ -495,7 +495,7 @@ public:
|
||||
* \endcode
|
||||
* \sa begin1() begin2_manip
|
||||
*/
|
||||
BOOST_UBLAS_INLINE begin2_manip begin2() {
|
||||
inline begin2_manip begin2() {
|
||||
return begin2_manip();
|
||||
}
|
||||
|
||||
@@ -540,7 +540,7 @@ public:
|
||||
* \endcode
|
||||
* \sa next_column()
|
||||
*/
|
||||
BOOST_UBLAS_INLINE next_row_manip next_row() {
|
||||
inline next_row_manip next_row() {
|
||||
return next_row_manip();
|
||||
}
|
||||
|
||||
@@ -584,7 +584,7 @@ public:
|
||||
* \endcode
|
||||
*
|
||||
*/
|
||||
BOOST_UBLAS_INLINE next_column_manip next_column() {
|
||||
inline next_column_manip next_column() {
|
||||
return next_column_manip();
|
||||
}
|
||||
|
||||
@@ -885,27 +885,27 @@ namespace traverse_policy {
|
||||
// Traverse policy namespace
|
||||
namespace traverse_policy {
|
||||
|
||||
by_row_policy<DEFAULT_WRAP_POLICY> by_row() {
|
||||
inline by_row_policy<DEFAULT_WRAP_POLICY> by_row() {
|
||||
return by_row_policy<DEFAULT_WRAP_POLICY>();
|
||||
}
|
||||
|
||||
by_row_policy<wrap> by_row_wrap() {
|
||||
inline by_row_policy<wrap> by_row_wrap() {
|
||||
return by_row_policy<wrap>();
|
||||
}
|
||||
|
||||
by_row_policy<no_wrap> by_row_no_wrap() {
|
||||
inline by_row_policy<no_wrap> by_row_no_wrap() {
|
||||
return by_row_policy<no_wrap>();
|
||||
}
|
||||
|
||||
by_column_policy<DEFAULT_WRAP_POLICY> by_column() {
|
||||
inline by_column_policy<DEFAULT_WRAP_POLICY> by_column() {
|
||||
return by_column_policy<DEFAULT_WRAP_POLICY>();
|
||||
}
|
||||
|
||||
by_column_policy<wrap> by_column_wrap() {
|
||||
inline by_column_policy<wrap> by_column_wrap() {
|
||||
return by_column_policy<wrap>();
|
||||
}
|
||||
|
||||
by_column_policy<no_wrap> by_column_no_wrap() {
|
||||
inline by_column_policy<no_wrap> by_column_no_wrap() {
|
||||
return by_column_policy<no_wrap>();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
//
|
||||
// Copyright (c) 2000-2002
|
||||
// Joerg Walter, Mathias Koch
|
||||
// Copyright (c) 2000-2011 Joerg Walter, Mathias Koch, David Bellot
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -8,7 +6,6 @@
|
||||
//
|
||||
// The authors gratefully acknowledge the support of
|
||||
// GeNeSys mbH & Co. KG in producing this work.
|
||||
//
|
||||
|
||||
#ifndef _BOOST_UBLAS_BLAS_
|
||||
#define _BOOST_UBLAS_BLAS_
|
||||
@@ -16,7 +13,7 @@
|
||||
#include <boost/numeric/ublas/traits.hpp>
|
||||
|
||||
namespace boost { namespace numeric { namespace ublas {
|
||||
|
||||
|
||||
|
||||
/** Interface and implementation of BLAS level 1
|
||||
* This includes functions which perform \b vector-vector operations.
|
||||
@@ -26,12 +23,12 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
namespace blas_1 {
|
||||
|
||||
/** 1-Norm: \f$\sum_i |x_i|\f$ (also called \f$\mathcal{L}_1\f$ or Manhattan norm)
|
||||
*
|
||||
* \param v a vector or vector expression
|
||||
* \return the 1-Norm with type of the vector's type
|
||||
*
|
||||
* \tparam V type of the vector (not needed by default)
|
||||
*/
|
||||
*
|
||||
* \param v a vector or vector expression
|
||||
* \return the 1-Norm with type of the vector's type
|
||||
*
|
||||
* \tparam V type of the vector (not needed by default)
|
||||
*/
|
||||
template<class V>
|
||||
typename type_traits<typename V::value_type>::real_type
|
||||
asum (const V &v) {
|
||||
@@ -39,12 +36,12 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
}
|
||||
|
||||
/** 2-Norm: \f$\sum_i |x_i|^2\f$ (also called \f$\mathcal{L}_2\f$ or Euclidean norm)
|
||||
*
|
||||
* \param v a vector or vector expression
|
||||
* \return the 2-Norm with type of the vector's type
|
||||
*
|
||||
* \tparam V type of the vector (not needed by default)
|
||||
*/
|
||||
*
|
||||
* \param v a vector or vector expression
|
||||
* \return the 2-Norm with type of the vector's type
|
||||
*
|
||||
* \tparam V type of the vector (not needed by default)
|
||||
*/
|
||||
template<class V>
|
||||
typename type_traits<typename V::value_type>::real_type
|
||||
nrm2 (const V &v) {
|
||||
@@ -52,12 +49,12 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
}
|
||||
|
||||
/** Infinite-norm: \f$\max_i |x_i|\f$ (also called \f$\mathcal{L}_\infty\f$ norm)
|
||||
*
|
||||
* \param v a vector or vector expression
|
||||
* \return the Infinite-Norm with type of the vector's type
|
||||
*
|
||||
* \tparam V type of the vector (not needed by default)
|
||||
*/
|
||||
*
|
||||
* \param v a vector or vector expression
|
||||
* \return the Infinite-Norm with type of the vector's type
|
||||
*
|
||||
* \tparam V type of the vector (not needed by default)
|
||||
*/
|
||||
template<class V>
|
||||
typename type_traits<typename V::value_type>::real_type
|
||||
amax (const V &v) {
|
||||
@@ -65,14 +62,14 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
}
|
||||
|
||||
/** Inner product of vectors \f$v_1\f$ and \f$v_2\f$
|
||||
*
|
||||
* \param v1 first vector of the inner product
|
||||
* \param v2 second vector of the inner product
|
||||
* \return the inner product of the type of the most generic type of the 2 vectors
|
||||
*
|
||||
* \tparam V1 type of first vector (not needed by default)
|
||||
* \tparam V2 type of second vector (not needed by default)
|
||||
*/
|
||||
*
|
||||
* \param v1 first vector of the inner product
|
||||
* \param v2 second vector of the inner product
|
||||
* \return the inner product of the type of the most generic type of the 2 vectors
|
||||
*
|
||||
* \tparam V1 type of first vector (not needed by default)
|
||||
* \tparam V2 type of second vector (not needed by default)
|
||||
*/
|
||||
template<class V1, class V2>
|
||||
typename promote_traits<typename V1::value_type, typename V2::value_type>::promote_type
|
||||
dot (const V1 &v1, const V2 &v2) {
|
||||
@@ -80,86 +77,86 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
}
|
||||
|
||||
/** Copy vector \f$v_2\f$ to \f$v_1\f$
|
||||
*
|
||||
* \param v1 target vector
|
||||
* \param v2 source vector
|
||||
* \return a reference to the target vector
|
||||
*
|
||||
* \tparam V1 type of first vector (not needed by default)
|
||||
* \tparam V2 type of second vector (not needed by default)
|
||||
*/
|
||||
*
|
||||
* \param v1 target vector
|
||||
* \param v2 source vector
|
||||
* \return a reference to the target vector
|
||||
*
|
||||
* \tparam V1 type of first vector (not needed by default)
|
||||
* \tparam V2 type of second vector (not needed by default)
|
||||
*/
|
||||
template<class V1, class V2>
|
||||
V1 & copy (V1 &v1, const V2 &v2)
|
||||
{
|
||||
{
|
||||
return v1.assign (v2);
|
||||
}
|
||||
|
||||
/** Swap vectors \f$v_1\f$ and \f$v_2\f$
|
||||
*
|
||||
* \param v1 first vector
|
||||
* \param v2 second vector
|
||||
*
|
||||
*
|
||||
* \param v1 first vector
|
||||
* \param v2 second vector
|
||||
*
|
||||
* \tparam V1 type of first vector (not needed by default)
|
||||
* \tparam V2 type of second vector (not needed by default)
|
||||
*/
|
||||
template<class V1, class V2>
|
||||
* \tparam V2 type of second vector (not needed by default)
|
||||
*/
|
||||
template<class V1, class V2>
|
||||
void swap (V1 &v1, V2 &v2)
|
||||
{
|
||||
{
|
||||
v1.swap (v2);
|
||||
}
|
||||
|
||||
/** scale vector \f$v\f$ with scalar \f$t\f$
|
||||
*
|
||||
* \param v vector to be scaled
|
||||
* \param t the scalar
|
||||
* \return \c t*v
|
||||
*
|
||||
* \tparam V type of the vector (not needed by default)
|
||||
* \tparam T type of the scalar (not needed by default)
|
||||
*/
|
||||
*
|
||||
* \param v vector to be scaled
|
||||
* \param t the scalar
|
||||
* \return \c t*v
|
||||
*
|
||||
* \tparam V type of the vector (not needed by default)
|
||||
* \tparam T type of the scalar (not needed by default)
|
||||
*/
|
||||
template<class V, class T>
|
||||
V & scal (V &v, const T &t)
|
||||
{
|
||||
{
|
||||
return v *= t;
|
||||
}
|
||||
|
||||
/** Compute \f$v_1= v_1 + t.v_2\f$
|
||||
*
|
||||
* \param v1 target and first vector
|
||||
* \param t the scalar
|
||||
* \param v2 second vector
|
||||
* \return a reference to the first and target vector
|
||||
*
|
||||
* \tparam V1 type of the first vector (not needed by default)
|
||||
* \tparam T type of the scalar (not needed by default)
|
||||
* \tparam V2 type of the second vector (not needed by default)
|
||||
*/
|
||||
*
|
||||
* \param v1 target and first vector
|
||||
* \param t the scalar
|
||||
* \param v2 second vector
|
||||
* \return a reference to the first and target vector
|
||||
*
|
||||
* \tparam V1 type of the first vector (not needed by default)
|
||||
* \tparam T type of the scalar (not needed by default)
|
||||
* \tparam V2 type of the second vector (not needed by default)
|
||||
*/
|
||||
template<class V1, class T, class V2>
|
||||
V1 & axpy (V1 &v1, const T &t, const V2 &v2)
|
||||
{
|
||||
{
|
||||
return v1.plus_assign (t * v2);
|
||||
}
|
||||
|
||||
/** Performs rotation of points in the plane and assign the result to the first vector
|
||||
*
|
||||
* Each point is defined as a pair \c v1(i) and \c v2(i), being respectively
|
||||
* the \f$x\f$ and \f$y\f$ coordinates. The parameters \c t1 and \t2 are respectively
|
||||
* the cosine and sine of the angle of the rotation.
|
||||
* Results are not returned but directly written into \c v1.
|
||||
*
|
||||
* \param t1 cosine of the rotation
|
||||
* \param v1 vector of \f$x\f$ values
|
||||
* \param t2 sine of the rotation
|
||||
* \param v2 vector of \f$y\f$ values
|
||||
*
|
||||
* \tparam T1 type of the cosine value (not needed by default)
|
||||
* \tparam V1 type of the \f$x\f$ vector (not needed by default)
|
||||
* \tparam T2 type of the sine value (not needed by default)
|
||||
* \tparam V2 type of the \f$y\f$ vector (not needed by default)
|
||||
*/
|
||||
/** Performs rotation of points in the plane and assign the result to the first vector
|
||||
*
|
||||
* Each point is defined as a pair \c v1(i) and \c v2(i), being respectively
|
||||
* the \f$x\f$ and \f$y\f$ coordinates. The parameters \c t1 and \t2 are respectively
|
||||
* the cosine and sine of the angle of the rotation.
|
||||
* Results are not returned but directly written into \c v1.
|
||||
*
|
||||
* \param t1 cosine of the rotation
|
||||
* \param v1 vector of \f$x\f$ values
|
||||
* \param t2 sine of the rotation
|
||||
* \param v2 vector of \f$y\f$ values
|
||||
*
|
||||
* \tparam T1 type of the cosine value (not needed by default)
|
||||
* \tparam V1 type of the \f$x\f$ vector (not needed by default)
|
||||
* \tparam T2 type of the sine value (not needed by default)
|
||||
* \tparam V2 type of the \f$y\f$ vector (not needed by default)
|
||||
*/
|
||||
template<class T1, class V1, class T2, class V2>
|
||||
void rot (const T1 &t1, V1 &v1, const T2 &t2, V2 &v2)
|
||||
{
|
||||
{
|
||||
typedef typename promote_traits<typename V1::value_type, typename V2::value_type>::promote_type promote_type;
|
||||
vector<promote_type> vt (t1 * v1 + t2 * v2);
|
||||
v2.assign (- t2 * v1 + t1 * v2);
|
||||
@@ -176,74 +173,74 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
namespace blas_2 {
|
||||
|
||||
/** \brief multiply vector \c v with triangular matrix \c m
|
||||
*
|
||||
* \param v a vector
|
||||
* \param m a triangular matrix
|
||||
* \return the result of the product
|
||||
*
|
||||
* \tparam V type of the vector (not needed by default)
|
||||
* \tparam M type of the matrix (not needed by default)
|
||||
*
|
||||
* \param v a vector
|
||||
* \param m a triangular matrix
|
||||
* \return the result of the product
|
||||
*
|
||||
* \tparam V type of the vector (not needed by default)
|
||||
* \tparam M type of the matrix (not needed by default)
|
||||
*/
|
||||
template<class V, class M>
|
||||
V & tmv (V &v, const M &m)
|
||||
{
|
||||
{
|
||||
return v = prod (m, v);
|
||||
}
|
||||
|
||||
/** \brief solve \f$m.x = v\f$ in place, where \c m is a triangular matrix
|
||||
*
|
||||
* \param v a vector
|
||||
* \param m a matrix
|
||||
* \param C (this parameter is not needed)
|
||||
* \return a result vector from the above operation
|
||||
*
|
||||
* \tparam V type of the vector (not needed by default)
|
||||
* \tparam M type of the matrix (not needed by default)
|
||||
* \tparam C n/a
|
||||
*
|
||||
* \param v a vector
|
||||
* \param m a matrix
|
||||
* \param C (this parameter is not needed)
|
||||
* \return a result vector from the above operation
|
||||
*
|
||||
* \tparam V type of the vector (not needed by default)
|
||||
* \tparam M type of the matrix (not needed by default)
|
||||
* \tparam C n/a
|
||||
*/
|
||||
template<class V, class M, class C>
|
||||
V & tsv (V &v, const M &m, C)
|
||||
{
|
||||
{
|
||||
return v = solve (m, v, C ());
|
||||
}
|
||||
|
||||
/** \brief compute \f$ v_1 = t_1.v_1 + t_2.(m.v_2)\f$, a general matrix-vector product
|
||||
*
|
||||
* \param v1 a vector
|
||||
* \param t1 a scalar
|
||||
* \param t2 another scalar
|
||||
* \param m a matrix
|
||||
* \param v2 another vector
|
||||
* \return the vector \c v1 with the result from the above operation
|
||||
*
|
||||
* \tparam V1 type of first vector (not needed by default)
|
||||
* \tparam T1 type of first scalar (not needed by default)
|
||||
* \tparam T2 type of second scalar (not needed by default)
|
||||
* \tparam M type of matrix (not needed by default)
|
||||
* \tparam V2 type of second vector (not needed by default)
|
||||
*
|
||||
* \param v1 a vector
|
||||
* \param t1 a scalar
|
||||
* \param t2 another scalar
|
||||
* \param m a matrix
|
||||
* \param v2 another vector
|
||||
* \return the vector \c v1 with the result from the above operation
|
||||
*
|
||||
* \tparam V1 type of first vector (not needed by default)
|
||||
* \tparam T1 type of first scalar (not needed by default)
|
||||
* \tparam T2 type of second scalar (not needed by default)
|
||||
* \tparam M type of matrix (not needed by default)
|
||||
* \tparam V2 type of second vector (not needed by default)
|
||||
*/
|
||||
template<class V1, class T1, class T2, class M, class V2>
|
||||
V1 & gmv (V1 &v1, const T1 &t1, const T2 &t2, const M &m, const V2 &v2)
|
||||
{
|
||||
{
|
||||
return v1 = t1 * v1 + t2 * prod (m, v2);
|
||||
}
|
||||
|
||||
/** \brief Rank 1 update: \f$ m = m + t.(v_1.v_2^T)\f$
|
||||
*
|
||||
* \param m a matrix
|
||||
* \param t a scalar
|
||||
* \param v1 a vector
|
||||
* \param v2 another vector
|
||||
* \return a matrix with the result from the above operation
|
||||
*
|
||||
* \tparam M type of matrix (not needed by default)
|
||||
* \tparam T type of scalar (not needed by default)
|
||||
* \tparam V1 type of first vector (not needed by default)
|
||||
* \tparam V2type of second vector (not needed by default)
|
||||
*/
|
||||
*
|
||||
* \param m a matrix
|
||||
* \param t a scalar
|
||||
* \param v1 a vector
|
||||
* \param v2 another vector
|
||||
* \return a matrix with the result from the above operation
|
||||
*
|
||||
* \tparam M type of matrix (not needed by default)
|
||||
* \tparam T type of scalar (not needed by default)
|
||||
* \tparam V1 type of first vector (not needed by default)
|
||||
* \tparam V2type of second vector (not needed by default)
|
||||
*/
|
||||
template<class M, class T, class V1, class V2>
|
||||
M & gr (M &m, const T &t, const V1 &v1, const V2 &v2)
|
||||
{
|
||||
{
|
||||
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
|
||||
return m += t * outer_prod (v1, v2);
|
||||
#else
|
||||
@@ -252,19 +249,19 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
}
|
||||
|
||||
/** \brief symmetric rank 1 update: \f$m = m + t.(v.v^T)\f$
|
||||
*
|
||||
* \param m a matrix
|
||||
* \param t a scalar
|
||||
* \param v a vector
|
||||
* \return a matrix with the result from the above operation
|
||||
*
|
||||
* \tparam M type of matrix (not needed by default)
|
||||
* \tparam T type of scalar (not needed by default)
|
||||
* \tparam V type of vector (not needed by default)
|
||||
*/
|
||||
*
|
||||
* \param m a matrix
|
||||
* \param t a scalar
|
||||
* \param v a vector
|
||||
* \return a matrix with the result from the above operation
|
||||
*
|
||||
* \tparam M type of matrix (not needed by default)
|
||||
* \tparam T type of scalar (not needed by default)
|
||||
* \tparam V type of vector (not needed by default)
|
||||
*/
|
||||
template<class M, class T, class V>
|
||||
M & sr (M &m, const T &t, const V &v)
|
||||
{
|
||||
{
|
||||
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
|
||||
return m += t * outer_prod (v, v);
|
||||
#else
|
||||
@@ -273,19 +270,19 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
}
|
||||
|
||||
/** \brief hermitian rank 1 update: \f$m = m + t.(v.v^H)\f$
|
||||
*
|
||||
* \param m a matrix
|
||||
* \param t a scalar
|
||||
* \param v a vector
|
||||
* \return a matrix with the result from the above operation
|
||||
*
|
||||
* \tparam M type of matrix (not needed by default)
|
||||
* \tparam T type of scalar (not needed by default)
|
||||
* \tparam V type of vector (not needed by default)
|
||||
*/
|
||||
*
|
||||
* \param m a matrix
|
||||
* \param t a scalar
|
||||
* \param v a vector
|
||||
* \return a matrix with the result from the above operation
|
||||
*
|
||||
* \tparam M type of matrix (not needed by default)
|
||||
* \tparam T type of scalar (not needed by default)
|
||||
* \tparam V type of vector (not needed by default)
|
||||
*/
|
||||
template<class M, class T, class V>
|
||||
M & hr (M &m, const T &t, const V &v)
|
||||
{
|
||||
{
|
||||
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
|
||||
return m += t * outer_prod (v, conj (v));
|
||||
#else
|
||||
@@ -294,21 +291,21 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
}
|
||||
|
||||
/** \brief symmetric rank 2 update: \f$ m=m+ t.(v_1.v_2^T + v_2.v_1^T)\f$
|
||||
*
|
||||
* \param m a matrix
|
||||
* \param t a scalar
|
||||
* \param v1 a vector
|
||||
* \param v2 another vector
|
||||
* \return a matrix with the result from the above operation
|
||||
*
|
||||
* \tparam M type of matrix (not needed by default)
|
||||
* \tparam T type of scalar (not needed by default)
|
||||
* \tparam V1 type of first vector (not needed by default)
|
||||
* \tparam V2type of second vector (not needed by default)
|
||||
*
|
||||
* \param m a matrix
|
||||
* \param t a scalar
|
||||
* \param v1 a vector
|
||||
* \param v2 another vector
|
||||
* \return a matrix with the result from the above operation
|
||||
*
|
||||
* \tparam M type of matrix (not needed by default)
|
||||
* \tparam T type of scalar (not needed by default)
|
||||
* \tparam V1 type of first vector (not needed by default)
|
||||
* \tparam V2type of second vector (not needed by default)
|
||||
*/
|
||||
template<class M, class T, class V1, class V2>
|
||||
M & sr2 (M &m, const T &t, const V1 &v1, const V2 &v2)
|
||||
{
|
||||
{
|
||||
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
|
||||
return m += t * (outer_prod (v1, v2) + outer_prod (v2, v1));
|
||||
#else
|
||||
@@ -317,21 +314,21 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
}
|
||||
|
||||
/** \brief hermitian rank 2 update: \f$m=m+t.(v_1.v_2^H) + v_2.(t.v_1)^H)\f$
|
||||
*
|
||||
* \param m a matrix
|
||||
* \param t a scalar
|
||||
* \param v1 a vector
|
||||
* \param v2 another vector
|
||||
* \return a matrix with the result from the above operation
|
||||
*
|
||||
* \tparam M type of matrix (not needed by default)
|
||||
* \tparam T type of scalar (not needed by default)
|
||||
* \tparam V1 type of first vector (not needed by default)
|
||||
* \tparam V2type of second vector (not needed by default)
|
||||
*
|
||||
* \param m a matrix
|
||||
* \param t a scalar
|
||||
* \param v1 a vector
|
||||
* \param v2 another vector
|
||||
* \return a matrix with the result from the above operation
|
||||
*
|
||||
* \tparam M type of matrix (not needed by default)
|
||||
* \tparam T type of scalar (not needed by default)
|
||||
* \tparam V1 type of first vector (not needed by default)
|
||||
* \tparam V2type of second vector (not needed by default)
|
||||
*/
|
||||
template<class M, class T, class V1, class V2>
|
||||
M & hr2 (M &m, const T &t, const V1 &v1, const V2 &v2)
|
||||
{
|
||||
{
|
||||
#ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
|
||||
return m += t * outer_prod (v1, conj (v2)) + type_traits<T>::conj (t) * outer_prod (v2, conj (v1));
|
||||
#else
|
||||
@@ -349,150 +346,150 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
namespace blas_3 {
|
||||
|
||||
/** \brief triangular matrix multiplication \f$m_1=t.m_2.m_3\f$ where \f$m_2\f$ and \f$m_3\f$ are triangular
|
||||
*
|
||||
* \param m1 a matrix for storing result
|
||||
* \param t a scalar
|
||||
* \param m2 a triangular matrix
|
||||
* \param m3 a triangular matrix
|
||||
* \return the matrix \c m1
|
||||
*
|
||||
* \tparam M1 type of the result matrix (not needed by default)
|
||||
* \tparam T type of the scalar (not needed by default)
|
||||
* \tparam M2 type of the first triangular matrix (not needed by default)
|
||||
* \tparam M3 type of the second triangular matrix (not needed by default)
|
||||
*
|
||||
*
|
||||
* \param m1 a matrix for storing result
|
||||
* \param t a scalar
|
||||
* \param m2 a triangular matrix
|
||||
* \param m3 a triangular matrix
|
||||
* \return the matrix \c m1
|
||||
*
|
||||
* \tparam M1 type of the result matrix (not needed by default)
|
||||
* \tparam T type of the scalar (not needed by default)
|
||||
* \tparam M2 type of the first triangular matrix (not needed by default)
|
||||
* \tparam M3 type of the second triangular matrix (not needed by default)
|
||||
*
|
||||
*/
|
||||
template<class M1, class T, class M2, class M3>
|
||||
M1 & tmm (M1 &m1, const T &t, const M2 &m2, const M3 &m3)
|
||||
{
|
||||
{
|
||||
return m1 = t * prod (m2, m3);
|
||||
}
|
||||
|
||||
/** \brief triangular solve \f$ m_2.x = t.m_1\f$ in place, \f$m_2\f$ is a triangular matrix
|
||||
*
|
||||
* \param m1 a matrix
|
||||
* \param t a scalar
|
||||
* \param m2 a triangular matrix
|
||||
* \param C (not used)
|
||||
* \return the \f$m_1\f$ matrix
|
||||
*
|
||||
* \tparam M1 type of the first matrix (not needed by default)
|
||||
* \tparam T type of the scalar (not needed by default)
|
||||
* \tparam M2 type of the triangular matrix (not needed by default)
|
||||
* \tparam C (n/a)
|
||||
*
|
||||
* \param m1 a matrix
|
||||
* \param t a scalar
|
||||
* \param m2 a triangular matrix
|
||||
* \param C (not used)
|
||||
* \return the \f$m_1\f$ matrix
|
||||
*
|
||||
* \tparam M1 type of the first matrix (not needed by default)
|
||||
* \tparam T type of the scalar (not needed by default)
|
||||
* \tparam M2 type of the triangular matrix (not needed by default)
|
||||
* \tparam C (n/a)
|
||||
*/
|
||||
template<class M1, class T, class M2, class C>
|
||||
M1 & tsm (M1 &m1, const T &t, const M2 &m2, C)
|
||||
{
|
||||
{
|
||||
return m1 = solve (m2, t * m1, C ());
|
||||
}
|
||||
|
||||
/** \brief general matrix multiplication \f$m_1=t_1.m_1 + t_2.m_2.m_3\f$
|
||||
*
|
||||
* \param m1 first matrix
|
||||
* \param t1 first scalar
|
||||
* \param t2 second scalar
|
||||
* \param m2 second matrix
|
||||
* \param m3 third matrix
|
||||
* \return the matrix \c m1
|
||||
*
|
||||
* \tparam M1 type of the first matrix (not needed by default)
|
||||
* \tparam T1 type of the first scalar (not needed by default)
|
||||
* \tparam T2 type of the second scalar (not needed by default)
|
||||
* \tparam M2 type of the second matrix (not needed by default)
|
||||
* \tparam M3 type of the third matrix (not needed by default)
|
||||
*
|
||||
* \param m1 first matrix
|
||||
* \param t1 first scalar
|
||||
* \param t2 second scalar
|
||||
* \param m2 second matrix
|
||||
* \param m3 third matrix
|
||||
* \return the matrix \c m1
|
||||
*
|
||||
* \tparam M1 type of the first matrix (not needed by default)
|
||||
* \tparam T1 type of the first scalar (not needed by default)
|
||||
* \tparam T2 type of the second scalar (not needed by default)
|
||||
* \tparam M2 type of the second matrix (not needed by default)
|
||||
* \tparam M3 type of the third matrix (not needed by default)
|
||||
*/
|
||||
template<class M1, class T1, class T2, class M2, class M3>
|
||||
M1 & gmm (M1 &m1, const T1 &t1, const T2 &t2, const M2 &m2, const M3 &m3)
|
||||
{
|
||||
{
|
||||
return m1 = t1 * m1 + t2 * prod (m2, m3);
|
||||
}
|
||||
|
||||
/** \brief symmetric rank \a k update: \f$m_1=t.m_1+t_2.(m_2.m_2^T)\f$
|
||||
*
|
||||
* \param m1 first matrix
|
||||
* \param t1 first scalar
|
||||
* \param t2 second scalar
|
||||
* \param m2 second matrix
|
||||
* \return matrix \c m1
|
||||
*
|
||||
* \tparam M1 type of the first matrix (not needed by default)
|
||||
* \tparam T1 type of the first scalar (not needed by default)
|
||||
* \tparam T2 type of the second scalar (not needed by default)
|
||||
* \tparam M2 type of the second matrix (not needed by default)
|
||||
* \todo use opb_prod()
|
||||
*
|
||||
* \param m1 first matrix
|
||||
* \param t1 first scalar
|
||||
* \param t2 second scalar
|
||||
* \param m2 second matrix
|
||||
* \return matrix \c m1
|
||||
*
|
||||
* \tparam M1 type of the first matrix (not needed by default)
|
||||
* \tparam T1 type of the first scalar (not needed by default)
|
||||
* \tparam T2 type of the second scalar (not needed by default)
|
||||
* \tparam M2 type of the second matrix (not needed by default)
|
||||
* \todo use opb_prod()
|
||||
*/
|
||||
template<class M1, class T1, class T2, class M2>
|
||||
M1 & srk (M1 &m1, const T1 &t1, const T2 &t2, const M2 &m2)
|
||||
{
|
||||
{
|
||||
return m1 = t1 * m1 + t2 * prod (m2, trans (m2));
|
||||
}
|
||||
|
||||
/** \brief hermitian rank \a k update: \f$m_1=t.m_1+t_2.(m_2.m2^H)\f$
|
||||
*
|
||||
* \param m1 first matrix
|
||||
* \param t1 first scalar
|
||||
* \param t2 second scalar
|
||||
* \param m2 second matrix
|
||||
* \return matrix \c m1
|
||||
*
|
||||
* \tparam M1 type of the first matrix (not needed by default)
|
||||
* \tparam T1 type of the first scalar (not needed by default)
|
||||
* \tparam T2 type of the second scalar (not needed by default)
|
||||
* \tparam M2 type of the second matrix (not needed by default)
|
||||
* \todo use opb_prod()
|
||||
*
|
||||
* \param m1 first matrix
|
||||
* \param t1 first scalar
|
||||
* \param t2 second scalar
|
||||
* \param m2 second matrix
|
||||
* \return matrix \c m1
|
||||
*
|
||||
* \tparam M1 type of the first matrix (not needed by default)
|
||||
* \tparam T1 type of the first scalar (not needed by default)
|
||||
* \tparam T2 type of the second scalar (not needed by default)
|
||||
* \tparam M2 type of the second matrix (not needed by default)
|
||||
* \todo use opb_prod()
|
||||
*/
|
||||
template<class M1, class T1, class T2, class M2>
|
||||
M1 & hrk (M1 &m1, const T1 &t1, const T2 &t2, const M2 &m2)
|
||||
{
|
||||
{
|
||||
return m1 = t1 * m1 + t2 * prod (m2, herm (m2));
|
||||
}
|
||||
|
||||
/** \brief generalized symmetric rank \a k update: \f$m_1=t_1.m_1+t_2.(m_2.m3^T)+t_2.(m_3.m2^T)\f$
|
||||
*
|
||||
* \param m1 first matrix
|
||||
* \param t1 first scalar
|
||||
* \param t2 second scalar
|
||||
* \param m2 second matrix
|
||||
* \param m3 third matrix
|
||||
* \return matrix \c m1
|
||||
*
|
||||
* \tparam M1 type of the first matrix (not needed by default)
|
||||
* \tparam T1 type of the first scalar (not needed by default)
|
||||
* \tparam T2 type of the second scalar (not needed by default)
|
||||
* \tparam M2 type of the second matrix (not needed by default)
|
||||
* \tparam M3 type of the third matrix (not needed by default)
|
||||
* \todo use opb_prod()
|
||||
*
|
||||
* \param m1 first matrix
|
||||
* \param t1 first scalar
|
||||
* \param t2 second scalar
|
||||
* \param m2 second matrix
|
||||
* \param m3 third matrix
|
||||
* \return matrix \c m1
|
||||
*
|
||||
* \tparam M1 type of the first matrix (not needed by default)
|
||||
* \tparam T1 type of the first scalar (not needed by default)
|
||||
* \tparam T2 type of the second scalar (not needed by default)
|
||||
* \tparam M2 type of the second matrix (not needed by default)
|
||||
* \tparam M3 type of the third matrix (not needed by default)
|
||||
* \todo use opb_prod()
|
||||
*/
|
||||
template<class M1, class T1, class T2, class M2, class M3>
|
||||
M1 & sr2k (M1 &m1, const T1 &t1, const T2 &t2, const M2 &m2, const M3 &m3)
|
||||
{
|
||||
{
|
||||
return m1 = t1 * m1 + t2 * (prod (m2, trans (m3)) + prod (m3, trans (m2)));
|
||||
}
|
||||
|
||||
/** \brief generalized hermitian rank \a k update: * \f$m_1=t_1.m_1+t_2.(m_2.m_3^H)+(m_3.(t_2.m_2)^H)\f$
|
||||
*
|
||||
* \param m1 first matrix
|
||||
* \param t1 first scalar
|
||||
* \param t2 second scalar
|
||||
* \param m2 second matrix
|
||||
* \param m3 third matrix
|
||||
* \return matrix \c m1
|
||||
*
|
||||
* \tparam M1 type of the first matrix (not needed by default)
|
||||
* \tparam T1 type of the first scalar (not needed by default)
|
||||
* \tparam T2 type of the second scalar (not needed by default)
|
||||
* \tparam M2 type of the second matrix (not needed by default)
|
||||
* \tparam M3 type of the third matrix (not needed by default)
|
||||
* \todo use opb_prod()
|
||||
*
|
||||
* \param m1 first matrix
|
||||
* \param t1 first scalar
|
||||
* \param t2 second scalar
|
||||
* \param m2 second matrix
|
||||
* \param m3 third matrix
|
||||
* \return matrix \c m1
|
||||
*
|
||||
* \tparam M1 type of the first matrix (not needed by default)
|
||||
* \tparam T1 type of the first scalar (not needed by default)
|
||||
* \tparam T2 type of the second scalar (not needed by default)
|
||||
* \tparam M2 type of the second matrix (not needed by default)
|
||||
* \tparam M3 type of the third matrix (not needed by default)
|
||||
* \todo use opb_prod()
|
||||
*/
|
||||
template<class M1, class T1, class T2, class M2, class M3>
|
||||
M1 & hr2k (M1 &m1, const T1 &t1, const T2 &t2, const M2 &m2, const M3 &m3)
|
||||
{
|
||||
{
|
||||
return m1 =
|
||||
t1 * m1
|
||||
+ t2 * prod (m2, herm (m3))
|
||||
+ type_traits<T2>::conj (t2) * prod (m3, herm (m2));
|
||||
t1 * m1
|
||||
+ t2 * prod (m2, herm (m3))
|
||||
+ type_traits<T2>::conj (t2) * prod (m3, herm (m2));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -123,6 +123,10 @@ namespace std {
|
||||
|
||||
#endif
|
||||
|
||||
// PGI compiler
|
||||
#ifdef __PGIC__
|
||||
#define BOOST_UBLAS_UNSUPPORTED_COMPILER 0
|
||||
#endif
|
||||
|
||||
// HP aCC C++ compiler
|
||||
#if defined (__HP_aCC) && ! defined (BOOST_STRICT_CONFIG)
|
||||
|
||||
@@ -1,65 +1,58 @@
|
||||
//
|
||||
// Copyright (c) 2010
|
||||
// David Bellot
|
||||
// Copyright (c) 2010-2011 David Bellot
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// And we acknowledge the support from all contributors.
|
||||
|
||||
/** \mainpage BOOST uBLAS: a Linear Algebra Library
|
||||
*
|
||||
* This is the API Reference Documentation.
|
||||
*
|
||||
* For introduction, documentations and tutorial, please refer
|
||||
* to http://www.boost.org/doc/libs/1_44_0/libs/numeric/ublas/doc/index.htm
|
||||
*
|
||||
* \section main_classes Main classes
|
||||
*
|
||||
* \subsection listvector Vectors
|
||||
* - \link #boost::numeric::ublas::vector vector \endlink
|
||||
* - \link #boost::numeric::ublas::bounded_vector bounded_vector \endlink
|
||||
* - \link #boost::numeric::ublas::zero_vector zero_vector \endlink
|
||||
* - \link #boost::numeric::ublas::unit_vector unit_vector \endlink
|
||||
* - \link #boost::numeric::ublas::scalar_vector scalar_vector \endlink
|
||||
* - \link #boost::numeric::ublas::c_vector c_vector \endlink
|
||||
* - \link #boost::numeric::ublas::vector_slice vector_slice \endlink
|
||||
* - \link #boost::numeric::ublas::vector_range vector_range \endlink
|
||||
* - \link #boost::numeric::ublas::vector_indirect vector_indirect \endlink
|
||||
* - \link #boost::numeric::ublas::mapped_vector mapped_vector \endlink
|
||||
* - \link #boost::numeric::ublas::compressed_vector compressed_vector \endlink
|
||||
* - \link #boost::numeric::ublas::coordinate_vector coordinate_vector \endlink
|
||||
* - \link #boost::numeric::ublas::matrix_row matrix_row \endlink
|
||||
* - \link #boost::numeric::ublas::matrix_column matrix_column \endlink
|
||||
* - \link #boost::numeric::ublas::vector vector \endlink
|
||||
* - \link #boost::numeric::ublas::bounded_vector bounded_vector \endlink
|
||||
* - \link #boost::numeric::ublas::zero_vector zero_vector \endlink
|
||||
* - \link #boost::numeric::ublas::unit_vector unit_vector \endlink
|
||||
* - \link #boost::numeric::ublas::scalar_vector scalar_vector \endlink
|
||||
* - \link #boost::numeric::ublas::c_vector c_vector \endlink
|
||||
* - \link #boost::numeric::ublas::vector_slice vector_slice \endlink
|
||||
* - \link #boost::numeric::ublas::vector_range vector_range \endlink
|
||||
* - \link #boost::numeric::ublas::vector_indirect vector_indirect \endlink
|
||||
* - \link #boost::numeric::ublas::mapped_vector mapped_vector \endlink
|
||||
* - \link #boost::numeric::ublas::compressed_vector compressed_vector \endlink
|
||||
* - \link #boost::numeric::ublas::coordinate_vector coordinate_vector \endlink
|
||||
* - \link #boost::numeric::ublas::matrix_row matrix_row \endlink
|
||||
* - \link #boost::numeric::ublas::matrix_column matrix_column \endlink
|
||||
*
|
||||
* \subsection listmatrix Matrices
|
||||
* - \link #boost::numeric::ublas::matrix matrix \endlink
|
||||
* - \link #boost::numeric::ublas::banded_matrix banded_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::diagonal_matrix diagonal_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::banded_adaptor banded_adaptor \endlink
|
||||
* - \link #boost::numeric::ublas::diagonal_adaptor diagonal_adaptor \endlink
|
||||
* - \link #boost::numeric::ublas::hermitian_matrix hermitian_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::hermitian_adaptor hermitian_adaptor \endlink
|
||||
* - \link #boost::numeric::ublas::symmetric_matrix symmetric_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::symmetric_adaptor symmetric_adaptor \endlink
|
||||
* - \link #boost::numeric::ublas::triangular_matrix triangular_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::triangular_adaptor triangular_adaptor \endlink
|
||||
* - \link #boost::numeric::ublas::vector_of_vector vector_of_vector \endlink
|
||||
* - \link #boost::numeric::ublas::bounded_matrix bounded_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::zero_matrix zero_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::identity_matrix identity_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::scalar_matrix scalar_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::c_matrix c_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::matrix_vector_range matrix_vector_range \endlink
|
||||
* - \link #boost::numeric::ublas::matrix_vector_slice matrix_vector_slice \endlink
|
||||
* - \link #boost::numeric::ublas::matrix_vector_indirect matrix_vector_indirect \endlink
|
||||
* - \link #boost::numeric::ublas::matrix_range matrix_range \endlink
|
||||
* - \link #boost::numeric::ublas::matrix_slice matrix_slice \endlink
|
||||
* - \link #boost::numeric::ublas::matrix_indirect matrix_indirect \endlink
|
||||
* - \link #boost::numeric::ublas::mapped_matrix mapped_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::mapped_vector_of_mapped_vector mapped_vector_of_mapped_vector \endlink
|
||||
* - \link #boost::numeric::ublas::compressed_matrix compressed_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::coordinate_matrix coordinate_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::generalized_vector_of_vector generalized_vector_of_vector \endlink
|
||||
* - \link #boost::numeric::ublas::matrix matrix \endlink
|
||||
* - \link #boost::numeric::ublas::banded_matrix banded_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::diagonal_matrix diagonal_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::banded_adaptor banded_adaptor \endlink
|
||||
* - \link #boost::numeric::ublas::diagonal_adaptor diagonal_adaptor \endlink
|
||||
* - \link #boost::numeric::ublas::hermitian_matrix hermitian_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::hermitian_adaptor hermitian_adaptor \endlink
|
||||
* - \link #boost::numeric::ublas::symmetric_matrix symmetric_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::symmetric_adaptor symmetric_adaptor \endlink
|
||||
* - \link #boost::numeric::ublas::triangular_matrix triangular_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::triangular_adaptor triangular_adaptor \endlink
|
||||
* - \link #boost::numeric::ublas::vector_of_vector vector_of_vector \endlink
|
||||
* - \link #boost::numeric::ublas::bounded_matrix bounded_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::zero_matrix zero_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::identity_matrix identity_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::scalar_matrix scalar_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::c_matrix c_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::matrix_vector_range matrix_vector_range \endlink
|
||||
* - \link #boost::numeric::ublas::matrix_vector_slice matrix_vector_slice \endlink
|
||||
* - \link #boost::numeric::ublas::matrix_vector_indirect matrix_vector_indirect \endlink
|
||||
* - \link #boost::numeric::ublas::matrix_range matrix_range \endlink
|
||||
* - \link #boost::numeric::ublas::matrix_slice matrix_slice \endlink
|
||||
* - \link #boost::numeric::ublas::matrix_indirect matrix_indirect \endlink
|
||||
* - \link #boost::numeric::ublas::mapped_matrix mapped_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::mapped_vector_of_mapped_vector mapped_vector_of_mapped_vector \endlink
|
||||
* - \link #boost::numeric::ublas::compressed_matrix compressed_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::coordinate_matrix coordinate_matrix \endlink
|
||||
* - \link #boost::numeric::ublas::generalized_vector_of_vector generalized_vector_of_vector \endlink
|
||||
*/
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
//
|
||||
// Copyright (c) 2000-2002
|
||||
// Joerg Walter, Mathias Koch
|
||||
// Copyright (c) 2000-2011 Joerg Walter, Mathias Koch, David Bellot
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// The authors gratefully acknowledge the support of
|
||||
// GeNeSys mbH & Co. KG in producing this work.
|
||||
//
|
||||
|
||||
#ifndef _BOOST_UBLAS_EXCEPTION_
|
||||
#define _BOOST_UBLAS_EXCEPTION_
|
||||
@@ -32,7 +26,7 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
#if ! defined (BOOST_NO_EXCEPTIONS) && ! defined (BOOST_UBLAS_NO_EXCEPTIONS)
|
||||
// Inherit from standard exceptions as requested during review.
|
||||
: public std::runtime_error
|
||||
{
|
||||
{
|
||||
explicit divide_by_zero (const char *s = "divide by zero") :
|
||||
std::runtime_error (s) {}
|
||||
void raise () {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//
|
||||
// Copyright (c) 2000-2010
|
||||
// Copyright (c) 2000-2013
|
||||
// Joerg Walter, Mathias Koch. David Bellot
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
|
||||
@@ -116,30 +116,30 @@ namespace boost { namespace numeric {
|
||||
// Construction and destruction
|
||||
|
||||
/// Default dense matrix constructor. Make a dense matrix of size (0,0)
|
||||
BOOST_UBLAS_INLINE
|
||||
matrix ():
|
||||
matrix_container<self_type> (),
|
||||
size1_ (0), size2_ (0), data_ () {}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
matrix ():
|
||||
matrix_container<self_type> (),
|
||||
size1_ (0), size2_ (0), data_ () {}
|
||||
|
||||
/** Dense matrix constructor with defined size
|
||||
* \param size1 number of rows
|
||||
* \param size2 number of columns
|
||||
*/
|
||||
BOOST_UBLAS_INLINE
|
||||
matrix (size_type size1, size_type size2):
|
||||
matrix_container<self_type> (),
|
||||
size1_ (size1), size2_ (size2), data_ (layout_type::storage_size (size1, size2)) {
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
matrix (size_type size1, size_type size2):
|
||||
matrix_container<self_type> (),
|
||||
size1_ (size1), size2_ (size2), data_ (layout_type::storage_size (size1, size2)) {
|
||||
}
|
||||
|
||||
/** Dense matrix constructor with defined size a initial value for all the matrix elements
|
||||
* \param size1 number of rows
|
||||
* \param size2 number of columns
|
||||
* \param init initial value assigned to all elements
|
||||
*/
|
||||
matrix (size_type size1, size_type size2, const value_type &init):
|
||||
matrix_container<self_type> (),
|
||||
size1_ (size1), size2_ (size2), data_ (layout_type::storage_size (size1, size2), init) {
|
||||
}
|
||||
matrix (size_type size1, size_type size2, const value_type &init):
|
||||
matrix_container<self_type> (),
|
||||
size1_ (size1), size2_ (size2), data_ (layout_type::storage_size (size1, size2), init) {
|
||||
}
|
||||
|
||||
/** Dense matrix constructor with defined size and an initial data array
|
||||
* \param size1 number of rows
|
||||
@@ -225,29 +225,67 @@ namespace boost { namespace numeric {
|
||||
}
|
||||
|
||||
// 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*/());
|
||||
|
||||
@@ -464,7 +464,12 @@ namespace boost { namespace numeric { namespace ublas {
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user