aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2008-08-26 19:12:23 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2008-08-26 19:12:23 +0000
commit00a8d314c592e63aff39e305b6c5f6a6df20ca70 (patch)
tree4e742004ee665ad42f9e782daee2f500e3890914 /Eigen
parent3e526dcdbd48f32e733219b8793208f9cbe0f4cf (diff)
* move memory related stuff to util/Memory.h
* clean ugly doxygen inheritence of expressions * keep improving the documentation... slowly !
Diffstat (limited to 'Eigen')
-rw-r--r--Eigen/Core23
-rw-r--r--Eigen/Geometry4
-rw-r--r--Eigen/src/Array/PartialRedux.h12
-rw-r--r--Eigen/src/Core/Block.h8
-rw-r--r--Eigen/src/Core/CwiseBinaryOp.h6
-rw-r--r--Eigen/src/Core/CwiseNullaryOp.h4
-rw-r--r--Eigen/src/Core/CwiseUnaryOp.h4
-rw-r--r--Eigen/src/Core/DiagonalCoeffs.h6
-rw-r--r--Eigen/src/Core/DiagonalMatrix.h6
-rw-r--r--Eigen/src/Core/DiagonalProduct.h4
-rw-r--r--Eigen/src/Core/Flagged.h4
-rw-r--r--Eigen/src/Core/GenericPacketMath.h (renamed from Eigen/src/Core/DummyPacketMath.h)82
-rw-r--r--Eigen/src/Core/Map.h4
-rw-r--r--Eigen/src/Core/Matrix.h9
-rw-r--r--Eigen/src/Core/MatrixStorage.h38
-rw-r--r--Eigen/src/Core/Minor.h4
-rw-r--r--Eigen/src/Core/NestByValue.h4
-rw-r--r--Eigen/src/Core/Part.h4
-rw-r--r--Eigen/src/Core/Product.h4
-rw-r--r--Eigen/src/Core/Swap.h4
-rw-r--r--Eigen/src/Core/Transpose.h4
-rw-r--r--Eigen/src/Core/util/Constants.h1
-rw-r--r--Eigen/src/Core/util/Macros.h12
-rw-r--r--Eigen/src/Core/util/Memory.h109
-rw-r--r--Eigen/src/Regression/Regression.h24
-rw-r--r--Eigen/src/Sparse/HashMatrix.h7
-rw-r--r--Eigen/src/Sparse/LinkedVectorMatrix.h7
-rw-r--r--Eigen/src/Sparse/SparseMatrix.h9
-rw-r--r--Eigen/src/Sparse/SparseProduct.h4
29 files changed, 286 insertions, 125 deletions
diff --git a/Eigen/Core b/Eigen/Core
index 102f23229..9e753a517 100644
--- a/Eigen/Core
+++ b/Eigen/Core
@@ -6,16 +6,27 @@
#include <cstring>
#include <string>
-#ifdef EIGEN_VECTORIZE
-// it seems we cannot assume posix_memalign is defined in the stdlib header
-extern "C" int posix_memalign (void **, size_t, size_t) throw ();
-#endif
-
namespace Eigen {
+/** \defgroup Core_Module Core module
+ * This is the main module of Eigen providing dense matrix and vector support with
+ * features equivalent to a BLAS library and much more...
+ *
+ * \code
+ * #include <Eigen/Core>
+ * \endcode
+ *
+ * To speedup compilation, in header files you might only include the following file:
+ * \code
+ * #include <Eigen/CoreDeclaration>
+ * \endcode
+ * which gives access to matrix and vector types as well as coefficient accessor operators.
+ */
+
+#include "src/Core/util/Memory.h"
#include "src/Core/NumTraits.h"
#include "src/Core/MathFunctions.h"
-#include "src/Core/DummyPacketMath.h"
+#include "src/Core/GenericPacketMath.h"
#if defined EIGEN_VECTORIZE_SSE
#include "src/Core/arch/SSE/PacketMath.h"
diff --git a/Eigen/Geometry b/Eigen/Geometry
index d62723188..b5a80bd50 100644
--- a/Eigen/Geometry
+++ b/Eigen/Geometry
@@ -15,8 +15,8 @@ namespace Eigen {
* - 2D and 3D rotations
* - quaternions
* - \ref MatrixBase::cross() "cross product"
- * - \ref MatrixBase::someOrthognal() "orthognal vector generation"
- *
+ * - \ref MatrixBase::unitOrthogonal() "orthognal vector generation"
+ *
* \code
* #include <Eigen/Geometry>
* \endcode
diff --git a/Eigen/src/Array/PartialRedux.h b/Eigen/src/Array/PartialRedux.h
index 3c511d5b9..27c315d6e 100644
--- a/Eigen/src/Array/PartialRedux.h
+++ b/Eigen/src/Array/PartialRedux.h
@@ -27,7 +27,7 @@
#define EIGEN_PARTIAL_REDUX_H
/** \array_module \ingroup Array
- *
+ *
* \class PartialReduxExpr
*
* \brief Generic expression of a partially reduxed matrix
@@ -69,7 +69,11 @@ struct ei_traits<PartialReduxExpr<MatrixType, MemberOp, Direction> >
template< typename MatrixType, typename MemberOp, int Direction>
class PartialReduxExpr : ei_no_assignment_operator,
+#ifndef EIGEN_PARSED_BY_DOXYGEN
public MatrixBase<PartialReduxExpr<MatrixType, MemberOp, Direction> >
+#else
+ public MapBase
+#endif
{
public:
@@ -186,7 +190,7 @@ template<typename ExpressionType, int Direction> class PartialRedux
*
* Example: \include PartialRedux_minCoeff.cpp
* Output: \verbinclude PartialRedux_minCoeff.out
- *
+ *
* \sa MatrixBase::minCoeff() */
const typename ReturnType<ei_member_minCoeff>::Type minCoeff() const
{ return _expression(); }
@@ -196,7 +200,7 @@ template<typename ExpressionType, int Direction> class PartialRedux
*
* Example: \include PartialRedux_maxCoeff.cpp
* Output: \verbinclude PartialRedux_maxCoeff.out
- *
+ *
* \sa MatrixBase::maxCoeff() */
const typename ReturnType<ei_member_maxCoeff>::Type maxCoeff() const
{ return _expression(); }
@@ -206,7 +210,7 @@ template<typename ExpressionType, int Direction> class PartialRedux
*
* Example: \include PartialRedux_norm2.cpp
* Output: \verbinclude PartialRedux_norm2.out
- *
+ *
* \sa MatrixBase::norm2() */
const typename ReturnType<ei_member_norm2>::Type norm2() const
{ return _expression(); }
diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h
index 11583d042..4fb4794a4 100644
--- a/Eigen/src/Core/Block.h
+++ b/Eigen/src/Core/Block.h
@@ -88,7 +88,11 @@ struct ei_traits<Block<MatrixType, BlockRows, BlockCols, _PacketAccess, _DirectA
};
template<typename MatrixType, int BlockRows, int BlockCols, int PacketAccess, int _DirectAccessStatus> class Block
+#ifndef EIGEN_PARSED_BY_DOXYGEN
: public MatrixBase<Block<MatrixType, BlockRows, BlockCols, PacketAccess, _DirectAccessStatus> >
+#else
+ : public MatrixBase
+#endif
{
public:
@@ -211,7 +215,11 @@ template<typename MatrixType, int BlockRows, int BlockCols, int PacketAccess, in
/** \internal */
template<typename MatrixType, int BlockRows, int BlockCols, int PacketAccess>
class Block<MatrixType,BlockRows,BlockCols,PacketAccess,HasDirectAccess>
+#ifndef EIGEN_PARSED_BY_DOXYGEN
: public MapBase<Block<MatrixType, BlockRows, BlockCols,PacketAccess,HasDirectAccess> >
+#else
+ : public MapBase
+#endif
{
public:
diff --git a/Eigen/src/Core/CwiseBinaryOp.h b/Eigen/src/Core/CwiseBinaryOp.h
index 2f506377f..da76ac100 100644
--- a/Eigen/src/Core/CwiseBinaryOp.h
+++ b/Eigen/src/Core/CwiseBinaryOp.h
@@ -76,7 +76,11 @@ struct ei_traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
template<typename BinaryOp, typename Lhs, typename Rhs>
class CwiseBinaryOp : ei_no_assignment_operator,
+#ifndef EIGEN_PARSED_BY_DOXYGEN
public MatrixBase<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
+#else
+ public MatrixBase
+#endif
{
public:
@@ -183,7 +187,7 @@ MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other)
*
* Example: \include Cwise_product.cpp
* Output: \verbinclude Cwise_product.out
- *
+ *
* \sa class CwiseBinaryOp, operator/(), square()
*/
template<typename ExpressionType>
diff --git a/Eigen/src/Core/CwiseNullaryOp.h b/Eigen/src/Core/CwiseNullaryOp.h
index caa86fa97..723340cef 100644
--- a/Eigen/src/Core/CwiseNullaryOp.h
+++ b/Eigen/src/Core/CwiseNullaryOp.h
@@ -60,7 +60,11 @@ struct ei_traits<CwiseNullaryOp<NullaryOp, MatrixType> >
template<typename NullaryOp, typename MatrixType>
class CwiseNullaryOp : ei_no_assignment_operator,
+#ifndef EIGEN_PARSED_BY_DOXYGEN
public MatrixBase<CwiseNullaryOp<NullaryOp, MatrixType> >
+#else
+ public MatrixBase
+#endif
{
public:
diff --git a/Eigen/src/Core/CwiseUnaryOp.h b/Eigen/src/Core/CwiseUnaryOp.h
index a50a9c30d..a6577a31e 100644
--- a/Eigen/src/Core/CwiseUnaryOp.h
+++ b/Eigen/src/Core/CwiseUnaryOp.h
@@ -63,7 +63,11 @@ struct ei_traits<CwiseUnaryOp<UnaryOp, MatrixType> >
template<typename UnaryOp, typename MatrixType>
class CwiseUnaryOp : ei_no_assignment_operator,
+#ifndef EIGEN_PARSED_BY_DOXYGEN
public MatrixBase<CwiseUnaryOp<UnaryOp, MatrixType> >
+#else
+ public MatrixBase
+#endif
{
public:
diff --git a/Eigen/src/Core/DiagonalCoeffs.h b/Eigen/src/Core/DiagonalCoeffs.h
index 9e2641039..83a11807e 100644
--- a/Eigen/src/Core/DiagonalCoeffs.h
+++ b/Eigen/src/Core/DiagonalCoeffs.h
@@ -60,7 +60,11 @@ struct ei_traits<DiagonalCoeffs<MatrixType> >
};
template<typename MatrixType> class DiagonalCoeffs
- : public MatrixBase<DiagonalCoeffs<MatrixType> >
+#ifndef EIGEN_PARSED_BY_DOXYGEN
+ : public MatrixBase<DiagonalCoeffs<MatrixType> >
+#else
+ : public MatrixBase
+#endif
{
public:
diff --git a/Eigen/src/Core/DiagonalMatrix.h b/Eigen/src/Core/DiagonalMatrix.h
index 029e273e5..da7bf2dd4 100644
--- a/Eigen/src/Core/DiagonalMatrix.h
+++ b/Eigen/src/Core/DiagonalMatrix.h
@@ -56,7 +56,11 @@ struct ei_traits<DiagonalMatrix<CoeffsVectorType> >
template<typename CoeffsVectorType>
class DiagonalMatrix : ei_no_assignment_operator,
- public MatrixBase<DiagonalMatrix<CoeffsVectorType> >
+#ifndef EIGEN_PARSED_BY_DOXYGEN
+ public MatrixBase<DiagonalMatrix<CoeffsVectorType> >
+#else
+ public MatrixBase
+#endif
{
public:
diff --git a/Eigen/src/Core/DiagonalProduct.h b/Eigen/src/Core/DiagonalProduct.h
index 4ee3c46c3..83ca8d1b3 100644
--- a/Eigen/src/Core/DiagonalProduct.h
+++ b/Eigen/src/Core/DiagonalProduct.h
@@ -61,7 +61,11 @@ struct ei_traits<Product<LhsNested, RhsNested, DiagonalProduct> >
};
template<typename LhsNested, typename RhsNested> class Product<LhsNested, RhsNested, DiagonalProduct> : ei_no_assignment_operator,
+#ifndef EIGEN_PARSED_BY_DOXYGEN
public MatrixBase<Product<LhsNested, RhsNested, DiagonalProduct> >
+#else
+ public MatrixBase
+#endif
{
typedef typename ei_traits<Product>::_LhsNested _LhsNested;
typedef typename ei_traits<Product>::_RhsNested _RhsNested;
diff --git a/Eigen/src/Core/Flagged.h b/Eigen/src/Core/Flagged.h
index a6abe617b..4dbcbd56d 100644
--- a/Eigen/src/Core/Flagged.h
+++ b/Eigen/src/Core/Flagged.h
@@ -55,7 +55,11 @@ struct ei_traits<Flagged<ExpressionType, Added, Removed> >
};
template<typename ExpressionType, unsigned int Added, unsigned int Removed> class Flagged
+#ifndef EIGEN_PARSED_BY_DOXYGEN
: public MatrixBase<Flagged<ExpressionType, Added, Removed> >
+#else
+ : public MatrixBase
+#endif
{
public:
diff --git a/Eigen/src/Core/DummyPacketMath.h b/Eigen/src/Core/GenericPacketMath.h
index 313001f2f..7bf4d4c29 100644
--- a/Eigen/src/Core/DummyPacketMath.h
+++ b/Eigen/src/Core/GenericPacketMath.h
@@ -2,6 +2,7 @@
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
+// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -22,88 +23,95 @@
// License and a copy of the GNU General Public License along with
// Eigen. If not, see <http://www.gnu.org/licenses/>.
-#ifndef EIGEN_DUMMY_PACKET_MATH_H
-#define EIGEN_DUMMY_PACKET_MATH_H
+#ifndef EIGEN_GENERIC_PACKET_MATH_H
+#define EIGEN_GENERIC_PACKET_MATH_H
+
+/** \internal
+ * \file GenericPacketMath.h
+ *
+ * Default implementation for types not supported by the vectorization.
+ * In practice these functions are provided to make easier the writting
+ * of generic vectorized code.
+ */
-// Default implementation for types not supported by the vectorization.
-// In practice these functions are provided to make easier the writting
-// of generic vectorized code. However, at runtime, they should never be
-// called, TODO so sould we raise an assertion or not ?
/** \internal \returns a + b (coeff-wise) */
-template <typename Packet> inline Packet
+template<typename Packet> inline Packet
ei_padd(const Packet& a,
const Packet& b) { return a+b; }
/** \internal \returns a - b (coeff-wise) */
-template <typename Packet> inline Packet
+template<typename Packet> inline Packet
ei_psub(const Packet& a,
const Packet& b) { return a-b; }
/** \internal \returns a * b (coeff-wise) */
-template <typename Packet> inline Packet
+template<typename Packet> inline Packet
ei_pmul(const Packet& a,
const Packet& b) { return a*b; }
/** \internal \returns a / b (coeff-wise) */
-template <typename Packet> inline Packet
+template<typename Packet> inline Packet
ei_pdiv(const Packet& a,
const Packet& b) { return a/b; }
/** \internal \returns the min of \a a and \a b (coeff-wise) */
-template <typename Packet> inline Packet
+template<typename Packet> inline Packet
ei_pmin(const Packet& a,
const Packet& b) { return std::min(a, b); }
/** \internal \returns the max of \a a and \a b (coeff-wise) */
-template <typename Packet> inline Packet
+template<typename Packet> inline Packet
ei_pmax(const Packet& a,
const Packet& b) { return std::max(a, b); }
/** \internal \returns a packet version of \a *from, from must be 16 bytes aligned */
-template <typename Scalar> inline typename ei_packet_traits<Scalar>::type
+template<typename Scalar> inline typename ei_packet_traits<Scalar>::type
ei_pload(const Scalar* from) { return *from; }
/** \internal \returns a packet version of \a *from, (un-aligned load) */
-template <typename Scalar> inline typename ei_packet_traits<Scalar>::type
+template<typename Scalar> inline typename ei_packet_traits<Scalar>::type
ei_ploadu(const Scalar* from) { return *from; }
/** \internal \returns a packet with constant coefficients \a a, e.g.: (a,a,a,a) */
-template <typename Scalar> inline typename ei_packet_traits<Scalar>::type
+template<typename Scalar> inline typename ei_packet_traits<Scalar>::type
ei_pset1(const Scalar& a) { return a; }
/** \internal copy the packet \a from to \a *to, \a to must be 16 bytes aligned */
-template <typename Scalar, typename Packet> inline void ei_pstore(Scalar* to, const Packet& from)
+template<typename Scalar, typename Packet> inline void ei_pstore(Scalar* to, const Packet& from)
{ (*to) = from; }
/** \internal copy the packet \a from to \a *to, (un-aligned store) */
-template <typename Scalar, typename Packet> inline void ei_pstoreu(Scalar* to, const Packet& from)
+template<typename Scalar, typename Packet> inline void ei_pstoreu(Scalar* to, const Packet& from)
{ (*to) = from; }
/** \internal \returns the first element of a packet */
-template <typename Packet> inline typename ei_unpacket_traits<Packet>::type ei_pfirst(const Packet& a)
+template<typename Packet> inline typename ei_unpacket_traits<Packet>::type ei_pfirst(const Packet& a)
{ return a; }
/** \internal \returns a packet where the element i contains the sum of the packet of \a vec[i] */
-template <typename Packet> inline Packet
+template<typename Packet> inline Packet
ei_preduxp(const Packet* vecs) { return vecs[0]; }
/** \internal \returns the sum of the elements of \a a*/
-template <typename Packet> inline typename ei_unpacket_traits<Packet>::type ei_predux(const Packet& a)
+template<typename Packet> inline typename ei_unpacket_traits<Packet>::type ei_predux(const Packet& a)
{ return a; }
-////////////
-
+/***************************************************************************
+* The following functions might not have to be overwritten for vectorized types
+***************************************************************************/
/** \internal \returns a * b + c (coeff-wise) */
-template <typename Packet> inline Packet
+template<typename Packet> inline Packet
ei_pmadd(const Packet& a,
const Packet& b,
const Packet& c)
{ return ei_padd(ei_pmul(a, b),c); }
-/** \internal \returns a packet version of \a *from. If LoadMode equals Aligned, \a from must be 16 bytes aligned */
-template <typename Scalar, int LoadMode> inline typename ei_packet_traits<Scalar>::type ei_ploadt(const Scalar* from)
+/** \internal \returns a packet version of \a *from.
+ * \If LoadMode equals Aligned, \a from must be 16 bytes aligned */
+template<typename Scalar, int LoadMode>
+inline typename ei_packet_traits<Scalar>::type ei_ploadt(const Scalar* from)
{
if(LoadMode == Aligned)
return ei_pload(from);
@@ -111,8 +119,10 @@ template <typename Scalar, int LoadMode> inline typename ei_packet_traits<Scalar
return ei_ploadu(from);
}
-/** \internal copy the packet \a from to \a *to. If StoreMode equals Aligned, \a to must be 16 bytes aligned */
-template <typename Scalar, typename Packet, int LoadMode> inline void ei_pstoret(Scalar* to, const Packet& from)
+/** \internal copy the packet \a from to \a *to.
+ * If StoreMode equals Aligned, \a to must be 16 bytes aligned */
+template<typename Scalar, typename Packet, int LoadMode>
+inline void ei_pstoret(Scalar* to, const Packet& from)
{
if(LoadMode == Aligned)
ei_pstore(to, from);
@@ -120,21 +130,7 @@ template <typename Scalar, typename Packet, int LoadMode> inline void ei_pstoret
ei_pstoreu(to, from);
}
-/** \internal \returns the number of elements which have to be skipped such that data are aligned */
-template<typename Scalar>
-inline static int ei_alignmentOffset(const Scalar* ptr, int maxOffset)
-{
- typedef typename ei_packet_traits<Scalar>::type Packet;
- const int PacketSize = ei_packet_traits<Scalar>::size;
- const int PacketAlignedMask = PacketSize-1;
- const bool Vectorized = PacketSize>1;
- return Vectorized
- ? std::min<int>( (PacketSize - ((size_t(ptr)/sizeof(Scalar)) & PacketAlignedMask))
- & PacketAlignedMask, maxOffset)
- : 0;
-}
-
-/** \internal specialization of ei_palign() */
+/** \internal default implementation of ei_palign() allowing partial specialization */
template<int Offset,typename PacketType>
struct ei_palign_impl
{
@@ -150,5 +146,5 @@ inline void ei_palign(PacketType& first, const PacketType& second)
ei_palign_impl<Offset,PacketType>::run(first,second);
}
-#endif // EIGEN_DUMMY_PACKET_MATH_H
+#endif // EIGEN_GENERIC_PACKET_MATH_H
diff --git a/Eigen/src/Core/Map.h b/Eigen/src/Core/Map.h
index 7dfaac273..4da6b942a 100644
--- a/Eigen/src/Core/Map.h
+++ b/Eigen/src/Core/Map.h
@@ -57,7 +57,11 @@ struct ei_traits<Map<MatrixType, _PacketAccess> > : public ei_traits<MatrixType>
};
template<typename MatrixType, int PacketAccess> class Map
+#ifndef EIGEN_PARSED_BY_DOXYGEN
: public MapBase<Map<MatrixType, PacketAccess> >
+#else
+ : public MapBase
+#endif
{
public:
diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h
index e5d06d21c..fb531c1e8 100644
--- a/Eigen/src/Core/Matrix.h
+++ b/Eigen/src/Core/Matrix.h
@@ -96,7 +96,12 @@ struct ei_traits<Matrix<_Scalar, _Rows, _Cols, _StorageOrder, _MaxRows, _MaxCols
};
template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder, int _MaxRows, int _MaxCols>
-class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _StorageOrder, _MaxRows, _MaxCols> >
+class Matrix
+#ifndef EIGEN_PARSED_BY_DOXYGEN
+ : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _StorageOrder, _MaxRows, _MaxCols> >
+#else
+ : public MatrixBase
+#endif
{
public:
EIGEN_GENERIC_PUBLIC_INTERFACE(Matrix)
@@ -370,6 +375,8 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _StorageOrder, _M
/** \defgroup matrixtypedefs Global matrix typedefs
*
+ * \ingroup Core_Module
+ *
* Eigen defines several typedef shortcuts for most common matrix and vector types.
*
* The general patterns are the following:
diff --git a/Eigen/src/Core/MatrixStorage.h b/Eigen/src/Core/MatrixStorage.h
index 2b13018bf..95fa89809 100644
--- a/Eigen/src/Core/MatrixStorage.h
+++ b/Eigen/src/Core/MatrixStorage.h
@@ -39,44 +39,6 @@
*/
template<typename T, int Size, int _Rows, int _Cols> class ei_matrix_storage;
-template <typename T, int Size, bool Align> struct ei_aligned_array
-{
- EIGEN_ALIGN_128 T array[Size];
-};
-
-template <typename T, int Size> struct ei_aligned_array<T,Size,false>
-{
- T array[Size];
-};
-
-template<typename T>
-inline T* ei_aligned_malloc(size_t size)
-{
- #ifdef EIGEN_VECTORIZE
- if (ei_packet_traits<T>::size>1)
- {
- void* ptr;
- if (posix_memalign(&ptr, 16, size*sizeof(T))==0)
- return static_cast<T*>(ptr);
- else
- return 0;
- }
- else
- #endif
- return new T[size];
-}
-
-template<typename T>
-inline void ei_aligned_free(T* ptr)
-{
- #ifdef EIGEN_VECTORIZE
- if (ei_packet_traits<T>::size>1)
- free(ptr);
- else
- #endif
- delete[] ptr;
-}
-
// purely fixed-size matrix
template<typename T, int Size, int _Rows, int _Cols> class ei_matrix_storage
{
diff --git a/Eigen/src/Core/Minor.h b/Eigen/src/Core/Minor.h
index 9e87c9b9b..70e358741 100644
--- a/Eigen/src/Core/Minor.h
+++ b/Eigen/src/Core/Minor.h
@@ -58,7 +58,11 @@ struct ei_traits<Minor<MatrixType> >
};
template<typename MatrixType> class Minor
+#ifndef EIGEN_PARSED_BY_DOXYGEN
: public MatrixBase<Minor<MatrixType> >
+#else
+ : public MatrixBase
+#endif
{
public:
diff --git a/Eigen/src/Core/NestByValue.h b/Eigen/src/Core/NestByValue.h
index 86d8795cd..198e9df78 100644
--- a/Eigen/src/Core/NestByValue.h
+++ b/Eigen/src/Core/NestByValue.h
@@ -52,7 +52,11 @@ struct ei_traits<NestByValue<ExpressionType> >
};
template<typename ExpressionType> class NestByValue
+#ifndef EIGEN_PARSED_BY_DOXYGEN
: public MatrixBase<NestByValue<ExpressionType> >
+#else
+ : public MatrixBase
+#endif
{
public:
diff --git a/Eigen/src/Core/Part.h b/Eigen/src/Core/Part.h
index 4d39c4c08..61c8507ef 100644
--- a/Eigen/src/Core/Part.h
+++ b/Eigen/src/Core/Part.h
@@ -59,7 +59,11 @@ struct ei_traits<Part<MatrixType, Mode> >
};
template<typename MatrixType, unsigned int Mode> class Part
+#ifndef EIGEN_PARSED_BY_DOXYGEN
: public MatrixBase<Part<MatrixType, Mode> >
+#else
+ : public MatrixBase
+#endif
{
public:
diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h
index f18bc1e4a..3132d4e46 100644
--- a/Eigen/src/Core/Product.h
+++ b/Eigen/src/Core/Product.h
@@ -168,7 +168,11 @@ struct ei_traits<Product<LhsNested, RhsNested, ProductMode> >
};
template<typename LhsNested, typename RhsNested, int ProductMode> class Product : ei_no_assignment_operator,
+#ifndef EIGEN_PARSED_BY_DOXYGEN
public MatrixBase<Product<LhsNested, RhsNested, ProductMode> >
+#else
+ public MatrixBase
+#endif
{
public:
diff --git a/Eigen/src/Core/Swap.h b/Eigen/src/Core/Swap.h
index 835fa61b2..f1918c12b 100644
--- a/Eigen/src/Core/Swap.h
+++ b/Eigen/src/Core/Swap.h
@@ -46,7 +46,11 @@ struct ei_traits<SwapWrapper<ExpressionType> >
};
template<typename ExpressionType> class SwapWrapper
+#ifndef EIGEN_PARSED_BY_DOXYGEN
: public MatrixBase<SwapWrapper<ExpressionType> >
+#else
+ : public MatrixBase
+#endif
{
public:
diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h
index dba19f025..5f8b263da 100644
--- a/Eigen/src/Core/Transpose.h
+++ b/Eigen/src/Core/Transpose.h
@@ -57,7 +57,11 @@ struct ei_traits<Transpose<MatrixType> >
};
template<typename MatrixType> class Transpose
+#ifndef EIGEN_PARSED_BY_DOXYGEN
: public MatrixBase<Transpose<MatrixType> >
+#else
+ : public MatrixBase
+#endif
{
public:
diff --git a/Eigen/src/Core/util/Constants.h b/Eigen/src/Core/util/Constants.h
index 3be6aba92..3090dad19 100644
--- a/Eigen/src/Core/util/Constants.h
+++ b/Eigen/src/Core/util/Constants.h
@@ -29,6 +29,7 @@
const int Dynamic = 10000;
/** \defgroup flags
+ * \ingroup Core_Module
*
* These are the possible bits which can be OR'ed to constitute the flags of a matrix or
* expression.
diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h
index ae2041875..e3429e146 100644
--- a/Eigen/src/Core/util/Macros.h
+++ b/Eigen/src/Core/util/Macros.h
@@ -153,16 +153,4 @@ _EIGEN_GENERIC_PUBLIC_INTERFACE(Derived, Eigen::MatrixBase<Derived>)
#define EIGEN_ENUM_MIN(a,b) (((int)a <= (int)b) ? (int)a : (int)b)
#define EIGEN_ENUM_MAX(a,b) (((int)a >= (int)b) ? (int)a : (int)b)
-/* ei_alloc_stack(TYPE,SIZE) allocates sizeof(TYPE)*SIZE bytes on the stack if sizeof(TYPE)*SIZE is smaller
- * than EIGEN_STACK_ALLOCATION_LIMIT. Otherwise the memory is allocated using the operator new.
- * Data allocated with ei_alloc_stack must be freed calling ei_free_stack(PTR,TYPE,SIZE)
- */
-#ifdef __linux__
-# define ei_alloc_stack(TYPE,SIZE) ((sizeof(TYPE)*(SIZE)>16000000) ? new TYPE[SIZE] : (TYPE*)alloca(sizeof(TYPE)*(SIZE)))
-# define ei_free_stack(PTR,TYPE,SIZE) if (sizeof(TYPE)*SIZE>16000000) delete[] PTR
-#else
-# define ei_alloc_stack(TYPE,SIZE) new TYPE[SIZE]
-# define ei_free_stack(PTR,TYPE,SIZE) delete[] PTR
-#endif
-
#endif // EIGEN_MACROS_H
diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h
new file mode 100644
index 000000000..24ae4b509
--- /dev/null
+++ b/Eigen/src/Core/util/Memory.h
@@ -0,0 +1,109 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra. Eigen itself is part of the KDE project.
+//
+// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
+// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
+//
+// Eigen is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 3 of the License, or (at your option) any later version.
+//
+// Alternatively, you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of
+// the License, or (at your option) any later version.
+//
+// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License and a copy of the GNU General Public License along with
+// Eigen. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef EIGEN_MEMORY_H
+#define EIGEN_MEMORY_H
+
+#ifdef EIGEN_VECTORIZE
+// it seems we cannot assume posix_memalign is defined in the stdlib header
+extern "C" int posix_memalign (void **, size_t, size_t) throw ();
+#endif
+
+/** \internal
+ * Static array automatically aligned if the total byte size is a multiple of 16
+ */
+template <typename T, int Size, bool Align> struct ei_aligned_array
+{
+ EIGEN_ALIGN_128 T array[Size];
+};
+
+template <typename T, int Size> struct ei_aligned_array<T,Size,false>
+{
+ T array[Size];
+};
+
+/** \internal allocates \a size * sizeof(\a T) bytes with a 16 bytes based alignement */
+template<typename T>
+inline T* ei_aligned_malloc(size_t size)
+{
+ #ifdef EIGEN_VECTORIZE
+ if (ei_packet_traits<T>::size>1)
+ {
+ void* ptr;
+ if (posix_memalign(&ptr, 16, size*sizeof(T))==0)
+ return static_cast<T*>(ptr);
+ else
+ return 0;
+ }
+ else
+ #endif
+ return new T[size];
+}
+
+/** \internal free memory allocated with ei_aligned_malloc */
+template<typename T>
+inline void ei_aligned_free(T* ptr)
+{
+ #ifdef EIGEN_VECTORIZE
+ if (ei_packet_traits<T>::size>1)
+ free(ptr);
+ else
+ #endif
+ delete[] ptr;
+}
+
+/** \internal \returns the number of elements which have to be skipped such that data are 16 bytes aligned */
+template<typename Scalar>
+inline static int ei_alignmentOffset(const Scalar* ptr, int maxOffset)
+{
+ typedef typename ei_packet_traits<Scalar>::type Packet;
+ const int PacketSize = ei_packet_traits<Scalar>::size;
+ const int PacketAlignedMask = PacketSize-1;
+ const bool Vectorized = PacketSize>1;
+ return Vectorized
+ ? std::min<int>( (PacketSize - ((size_t(ptr)/sizeof(Scalar)) & PacketAlignedMask))
+ & PacketAlignedMask, maxOffset)
+ : 0;
+}
+
+/** \internal
+ * ei_alloc_stack(TYPE,SIZE) allocates sizeof(TYPE)*SIZE bytes on the stack if sizeof(TYPE)*SIZE is
+ * smaller than EIGEN_STACK_ALLOCATION_LIMIT. Otherwise the memory is allocated using the operator new.
+ * Data allocated with ei_alloc_stack \b must be freed calling ei_free_stack(PTR,TYPE,SIZE).
+ * \code
+ * float * data = ei_alloc_stack(float,array.size());
+ * // ...
+ * ei_free_stack(data,float,array.size());
+ * \endcode
+ */
+#ifdef __linux__
+# define ei_alloc_stack(TYPE,SIZE) ((sizeof(TYPE)*(SIZE)>16000000) ? new TYPE[SIZE] : (TYPE*)alloca(sizeof(TYPE)*(SIZE)))
+# define ei_free_stack(PTR,TYPE,SIZE) if (sizeof(TYPE)*SIZE>16000000) delete[] PTR
+#else
+# define ei_alloc_stack(TYPE,SIZE) new TYPE[SIZE]
+# define ei_free_stack(PTR,TYPE,SIZE) delete[] PTR
+#endif
+
+#endif // EIGEN_MEMORY_H
diff --git a/Eigen/src/Regression/Regression.h b/Eigen/src/Regression/Regression.h
index 88e4e8921..b03799f49 100644
--- a/Eigen/src/Regression/Regression.h
+++ b/Eigen/src/Regression/Regression.h
@@ -76,17 +76,17 @@
* Let's now describe precisely the parameters:
* @param numPoints the number of points
* @param points the array of pointers to the points on which to perform the linear regression
- * @param retCoefficients pointer to the vector in which to store the result.
- This vector must be of the same type and size as the
- data points. The meaning of its coords is as follows.
- For brevity, let \f$n=Size\f$,
- \f$r_i=retCoefficients[i]\f$,
- and \f$f=funcOfOthers\f$. Denote by
- \f$x_0,\ldots,x_{n-1}\f$
- the n coordinates in the n-dimensional space.
- Then the result equation is:
- \f[ x_f = r_0 x_0 + \cdots + r_{f-1}x_{f-1}
- + r_{f+1}x_{f+1} + \cdots + r_{n-1}x_{n-1} + r_n. \f]
+ * @param result pointer to the vector in which to store the result.
+ This vector must be of the same type and size as the
+ data points. The meaning of its coords is as follows.
+ For brevity, let \f$n=Size\f$,
+ \f$r_i=retCoefficients[i]\f$,
+ and \f$f=funcOfOthers\f$. Denote by
+ \f$x_0,\ldots,x_{n-1}\f$
+ the n coordinates in the n-dimensional space.
+ Then the result equation is:
+ \f[ x_f = r_0 x_0 + \cdots + r_{f-1}x_{f-1}
+ + r_{f+1}x_{f+1} + \cdots + r_{n-1}x_{n-1} + r_n. \f]
* @param funcOfOthers Determines which coord to express as a function of the
others. Coords are numbered starting from 0, so that a
value of 0 means \f$x\f$, 1 means \f$y\f$,
@@ -183,7 +183,7 @@ void fitHyperplane(int numPoints,
VectorType diff = (*(points[i]) - mean).conjugate();
covMat += diff * diff.adjoint();
}
-
+
// now we just have to pick the eigen vector with smallest eigen value
SelfAdjointEigenSolver<CovMatrixType> eig(covMat);
result->start(size) = eig.eigenvectors().col(0);
diff --git a/Eigen/src/Sparse/HashMatrix.h b/Eigen/src/Sparse/HashMatrix.h
index 992486f5a..0017d1998 100644
--- a/Eigen/src/Sparse/HashMatrix.h
+++ b/Eigen/src/Sparse/HashMatrix.h
@@ -42,7 +42,12 @@ struct ei_traits<HashMatrix<_Scalar, _Flags> >
// TODO reimplement this class using custom linked lists
template<typename _Scalar, int _Flags>
-class HashMatrix : public SparseMatrixBase<HashMatrix<_Scalar, _Flags> >
+class HashMatrix
+#ifndef EIGEN_PARSED_BY_DOXYGEN
+ : public SparseMatrixBase<HashMatrix<_Scalar, _Flags> >
+#else
+ : public SparseMatrixBase
+#endif
{
public:
EIGEN_GENERIC_PUBLIC_INTERFACE(HashMatrix)
diff --git a/Eigen/src/Sparse/LinkedVectorMatrix.h b/Eigen/src/Sparse/LinkedVectorMatrix.h
index 969aee57b..2ffb1d930 100644
--- a/Eigen/src/Sparse/LinkedVectorMatrix.h
+++ b/Eigen/src/Sparse/LinkedVectorMatrix.h
@@ -52,7 +52,12 @@ struct LinkedVectorChunk
};
template<typename _Scalar, int _Flags>
-class LinkedVectorMatrix : public SparseMatrixBase<LinkedVectorMatrix<_Scalar,_Flags> >
+class LinkedVectorMatrix
+#ifndef EIGEN_PARSED_BY_DOXYGEN
+ : public SparseMatrixBase<LinkedVectorMatrix<_Scalar,_Flags> >
+#else
+ : public SparseMatrixBase
+#endif
{
public:
EIGEN_GENERIC_PUBLIC_INTERFACE(LinkedVectorMatrix)
diff --git a/Eigen/src/Sparse/SparseMatrix.h b/Eigen/src/Sparse/SparseMatrix.h
index dbc436f80..acf0e10b2 100644
--- a/Eigen/src/Sparse/SparseMatrix.h
+++ b/Eigen/src/Sparse/SparseMatrix.h
@@ -52,7 +52,12 @@ struct ei_traits<SparseMatrix<_Scalar, _Flags> >
template<typename _Scalar, int _Flags>
-class SparseMatrix : public SparseMatrixBase<SparseMatrix<_Scalar, _Flags> >
+class SparseMatrix
+#ifndef EIGEN_PARSED_BY_DOXYGEN
+ : public SparseMatrixBase<SparseMatrix<_Scalar, _Flags> >
+#else
+ : public SparseMatrixBase
+#endif
{
public:
EIGEN_GENERIC_PUBLIC_INTERFACE(SparseMatrix)
@@ -92,7 +97,7 @@ class SparseMatrix : public SparseMatrixBase<SparseMatrix<_Scalar, _Flags> >
return m_data.value(end-1);
// ^^ optimization: let's first check if it is the last coefficient
// (very common in high level algorithms)
-
+
const int* r = std::lower_bound(&m_data.index(start),&m_data.index(end),inner);
const int id = r-&m_data.index(0);
return ((*r==inner) && (id<end)) ? m_data.value(id) : Scalar(0);
diff --git a/Eigen/src/Sparse/SparseProduct.h b/Eigen/src/Sparse/SparseProduct.h
index a4d9a4590..e1659c49e 100644
--- a/Eigen/src/Sparse/SparseProduct.h
+++ b/Eigen/src/Sparse/SparseProduct.h
@@ -88,7 +88,11 @@ struct ei_traits<Product<LhsNested, RhsNested, SparseProduct> >
};
template<typename LhsNested, typename RhsNested> class Product<LhsNested,RhsNested,SparseProduct> : ei_no_assignment_operator,
+#ifndef EIGEN_PARSED_BY_DOXYGEN
public MatrixBase<Product<LhsNested, RhsNested, SparseProduct> >
+#else
+ public MatrixBase
+#endif
{
public: