Compare commits

..

28 Commits

Author SHA1 Message Date
Benoit Jacob
4931a719f4 bump 2011-03-14 14:10:05 -04:00
Jitse Niesen
27f34269d5 Document EIGEN_DEFAULT_DENSE_INDEX_TYPE.
Also, expand description of EIGEN_DONT_ALIGN.
2011-03-11 11:15:44 +00:00
Jitse Niesen
e7d2376688 Change int to Index in equalsIdentity().
This fixes compilation errors in nullary test on 64-bits machines.
2011-03-11 11:06:13 +00:00
Benoit Jacob
dc36efbb8f fix bug #219: Map Flags AlignedBit was miscomputed, didn't account for EIGEN_ALIGN 2011-03-10 10:17:17 -05:00
Benoit Jacob
9a47fb289b add test for EIGEN_DONT_ALIGN and EIGEN_DONT_ALIGN_STATICALLY, cf recent bugs (214 etc) and changeset 56818d907e 2011-03-10 09:44:59 -05:00
Jitse Niesen
151e3294cf Fix equalsIdentity() for rectangular matrices. 2011-03-10 13:49:06 +00:00
Oliver Ruepp
5d1263e7c5 bug #37: fix resizing when the destination sparse matrix is row major 2011-03-08 16:37:59 +01:00
Gael Guennebaud
c6c6c34909 repeat nullary tests, and fix some tests 2011-03-07 16:41:59 +01:00
Jitse Niesen
931edea57d Tweak geo_quaternion test to squash intermittent failures. 2011-03-07 11:42:55 +00:00
Benoit Jacob
bfcad536e8 * bug #206: correctly forward computationOptions and work towards avoiding mallocs after preallocation, with unit test.
* added EIGEN_RUNTIME_NO_MALLOC and new set_is_malloc_allowed() function to implement that test
2011-03-06 20:59:25 -05:00
Benoit Jacob
b464fc19bc try to fix a ICC 11.1 compiler error (bug #217) 2011-03-06 19:27:31 -05:00
Benoit Jacob
c541d0a62e disable ICC 12 warning 279 - controlling expression is constant 2011-03-06 19:06:44 -05:00
Benoit Jacob
b43d92a5a2 The Eigen2 intrusive std::vector hack really can't be supported in eigen3 (bug #215) 2011-03-04 10:24:41 -05:00
Benoit Jacob
56818d907e Make EIGEN_ALIGN16 always align to fix crashes with EIGEN_DONT_ALIGN_STATICALLY. New macro EIGEN_USER_ALIGN16 had the old behavior i.e. honors user preference. 2011-03-04 09:57:49 -05:00
Sameer Sheorey
e9868f438b Changed debug/gdb/printers.py to correctly display variable sized matrices.
There is no python error now.
2011-03-02 10:47:54 -06:00
Gael Guennebaud
4f0909b5f0 fix bug #212 (installation of Eigen2Support/Geometry) 2011-03-04 14:16:58 +01:00
Jitse Niesen
6cac61ca3e Copy fix of unit test when GSL is enabled to eigen2 test suite. 2011-03-04 11:04:07 +00:00
Jitse Niesen
1180ede36d Escape hash character in docs as required by doxygen. 2011-03-03 15:19:11 +00:00
Jitse Niesen
99fa279ed1 Use copy_bool() workaround in Eigen2 test suite.
See bug #89 and changeset 59596efdf7
.
2011-03-03 14:17:23 +00:00
Jitse Niesen
dbab12d6b0 Fix bug #205: eigen2_adjoint_5 test fails. 2011-03-02 22:00:48 +00:00
Gael Guennebaud
dc727d86f1 extend unit tests of Transform * MatrixBase and Transform * Homogeneous 2011-03-02 19:34:39 +01:00
Gael Guennebaud
5cec29162b fix compilation in the case of 1D Transform 2011-03-02 19:29:55 +01:00
Gael Guennebaud
703c8a0cc6 fix compilation when mixing CompactAffine with Homogeneous objects 2011-03-02 19:27:13 +01:00
Gael Guennebaud
d30f0c0953 fix transform * matrix products: in particular it now truely considers the rhs as a set of (homogeneous) points and do not neglect the homogeneous coordinates in the case of affine transform 2011-03-02 19:26:38 +01:00
Gael Guennebaud
adacacb285 fix bug #204: limit integer values to numbers which are representable using float 2011-03-02 14:24:26 +01:00
Gael Guennebaud
c8e1b679fa re-enable fast pset1-pstore by introducing a new higher level pstore1 function 2011-03-02 10:55:44 +01:00
Gael Guennebaud
951e238430 now fixing "unsupported" "legacy" code... 2011-03-01 16:45:46 +01:00
Benoit Jacob
9c5c8d8916 Added tag 3.0-beta4 for changeset 77fc6a9914 2011-02-28 00:55:59 -05:00
32 changed files with 392 additions and 101 deletions

View File

@@ -56,7 +56,13 @@ template<typename Derived> class DenseBase
class InnerIterator;
typedef typename internal::traits<Derived>::StorageKind StorageKind;
typedef typename internal::traits<Derived>::Index Index; /**< The type of indices */
/** \brief The type of indices
* \details To change this, \c \#define the preprocessor symbol \c EIGEN_DEFAULT_DENSE_INDEX_TYPE.
* \sa \ref TopicPreprocessorDirectives.
*/
typedef typename internal::traits<Derived>::Index Index;
typedef typename internal::traits<Derived>::Scalar Scalar;
typedef typename internal::packet_traits<Scalar>::type PacketScalar;
typedef typename NumTraits<Scalar>::Real RealScalar;

View File

@@ -65,7 +65,7 @@ struct plain_array
template <typename T, int Size, int MatrixOrArrayOptions>
struct plain_array<T, Size, MatrixOrArrayOptions, 16>
{
EIGEN_ALIGN16 T array[Size];
EIGEN_USER_ALIGN16 T array[Size];
plain_array() { EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(0xf) }
plain_array(constructor_without_unaligned_array_assert) {}
};
@@ -73,7 +73,7 @@ struct plain_array<T, Size, MatrixOrArrayOptions, 16>
template <typename T, int MatrixOrArrayOptions, int Alignment>
struct plain_array<T, 0, MatrixOrArrayOptions, Alignment>
{
EIGEN_ALIGN16 T array[1];
EIGEN_USER_ALIGN16 T array[1];
plain_array() {}
plain_array(constructor_without_unaligned_array_assert) {}
};

View File

@@ -270,6 +270,14 @@ Packet psqrt(const Packet& a) { return sqrt(a); }
* The following functions might not have to be overwritten for vectorized types
***************************************************************************/
/** \internal copy a packet with constant coeficient \a a (e.g., [a,a,a,a]) to \a *to. \a to must be 16 bytes aligned */
// NOTE: this function must really be templated on the packet type (think about different packet types for the same scalar type)
template<typename Packet>
inline void pstore1(typename unpacket_traits<Packet>::type* to, const typename unpacket_traits<Packet>::type& a)
{
pstore(to, pset1<Packet>(a));
}
/** \internal \returns a * b + c (coeff-wise) */
template<typename Packet> inline Packet
pmadd(const Packet& a,

View File

@@ -95,7 +95,7 @@ struct traits<Map<PlainObjectType, MapOptions, StrideType> >
HasNoInnerStride = InnerStrideAtCompileTime == 1,
HasNoOuterStride = StrideType::OuterStrideAtCompileTime == 0,
HasNoStride = HasNoInnerStride && HasNoOuterStride,
IsAligned = int(int(MapOptions)&Aligned)==Aligned,
IsAligned = bool(EIGEN_ALIGN) && ((int(MapOptions)&Aligned)==Aligned),
IsDynamicSize = PlainObjectType::SizeAtCompileTime==Dynamic,
KeepsPacketAccess = bool(HasNoInnerStride)
&& ( bool(IsDynamicSize)

View File

@@ -85,6 +85,8 @@ template<typename Derived> class MapBase<Derived, ReadOnlyAccessors>
using Base::rowStride;
using Base::colStride;
// bug 217 - compile error on ICC 11.1
using Base::operator=;
typedef typename Base::CoeffReturnType CoeffReturnType;

View File

@@ -305,6 +305,19 @@ template<> EIGEN_STRONG_INLINE void pstoreu<double>(double* to, const Packet2d&
template<> EIGEN_STRONG_INLINE void pstoreu<float>(float* to, const Packet4f& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((double*)to, _mm_castps_pd(from)); }
template<> EIGEN_STRONG_INLINE void pstoreu<int>(int* to, const Packet4i& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((double*)to, _mm_castsi128_pd(from)); }
// some compilers might be tempted to perform multiple moves instead of using a vector path.
template<> EIGEN_STRONG_INLINE void pstore1<Packet4f>(float* to, const float& a)
{
Packet4f pa = _mm_set_ss(a);
pstore(to, vec4f_swizzle1(pa,0,0,0,0));
}
// some compilers might be tempted to perform multiple moves instead of using a vector path.
template<> EIGEN_STRONG_INLINE void pstore1<Packet2d>(double* to, const double& a)
{
Packet2d pa = _mm_set_sd(a);
pstore(to, vec2d_swizzle1(pa,0,0));
}
template<> EIGEN_STRONG_INLINE void prefetch<float>(const float* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
template<> EIGEN_STRONG_INLINE void prefetch<double>(const double* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
template<> EIGEN_STRONG_INLINE void prefetch<int>(const int* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }

View File

@@ -199,7 +199,7 @@ public:
EIGEN_STRONG_INLINE void unpackRhs(DenseIndex n, const RhsScalar* rhs, RhsScalar* b)
{
for(DenseIndex k=0; k<n; k++)
pstore(&b[k*RhsPacketSize], pset1<RhsPacket>(rhs[k]));
pstore1<RhsPacket>(&b[k*RhsPacketSize], rhs[k]);
}
EIGEN_STRONG_INLINE void loadRhs(const RhsScalar* b, RhsPacket& dest) const
@@ -270,7 +270,7 @@ public:
EIGEN_STRONG_INLINE void unpackRhs(DenseIndex n, const RhsScalar* rhs, RhsScalar* b)
{
for(DenseIndex k=0; k<n; k++)
pstore(&b[k*RhsPacketSize], pset1<RhsPacket>(rhs[k]));
pstore1<RhsPacket>(&b[k*RhsPacketSize], rhs[k]);
}
EIGEN_STRONG_INLINE void loadRhs(const RhsScalar* b, RhsPacket& dest) const
@@ -363,8 +363,8 @@ public:
{
if(Vectorizable)
{
pstore((RealScalar*)&b[k*ResPacketSize*2+0], pset1<RealPacket>(real(rhs[k])));
pstore((RealScalar*)&b[k*ResPacketSize*2+ResPacketSize], pset1<RealPacket>(imag(rhs[k])));
pstore1<RealPacket>((RealScalar*)&b[k*ResPacketSize*2+0], real(rhs[k]));
pstore1<RealPacket>((RealScalar*)&b[k*ResPacketSize*2+ResPacketSize], imag(rhs[k]));
}
else
b[k] = rhs[k];
@@ -475,7 +475,7 @@ public:
EIGEN_STRONG_INLINE void unpackRhs(DenseIndex n, const RhsScalar* rhs, RhsScalar* b)
{
for(DenseIndex k=0; k<n; k++)
pstore(&b[k*RhsPacketSize], pset1<RhsPacket>(rhs[k]));
pstore1<RhsPacket>(&b[k*RhsPacketSize], rhs[k]);
}
EIGEN_STRONG_INLINE void loadRhs(const RhsScalar* b, RhsPacket& dest) const
@@ -1009,12 +1009,7 @@ EIGEN_ASM_COMMENT("mybegin4");
for(Index j2=packet_cols; j2<cols; j2++)
{
// unpack B
{
traits.unpackRhs(depth, &blockB[j2*strideB+offsetB], unpackedB);
// const RhsScalar* blB = &blockB[j2*strideB+offsetB];
// for(Index k=0; k<depth; k++)
// pstore(&unpackedB[k*RhsPacketSize], pset1<RhsPacket>(blB[k]));
}
traits.unpackRhs(depth, &blockB[j2*strideB+offsetB], unpackedB);
for(Index i=0; i<peeled_mc; i+=mr)
{

View File

@@ -24,10 +24,12 @@
// 2536 - type qualifiers are meaningless here
// ICC 12 generates this warning when a function return type is const qualified, even if that type is a template-parameter-dependent
// typedef that may be a reference type.
// 279 - controlling expression is constant
// ICC 12 generates this warning on assert(constant_expression_depending_on_template_params) and frankly this is a legitimate use case.
#ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
#pragma warning push
#endif
#pragma warning disable 2196 2536
#pragma warning disable 2196 2536 279
#elif defined __clang__
// -Wconstant-logical-operand - warning: use of logical && with constant operand; switch to bitwise & or remove constant
// this is really a stupid warning as it warns on compile-time expressions involving enums

View File

@@ -27,7 +27,7 @@
#define EIGEN_MACROS_H
#define EIGEN_WORLD_VERSION 2
#define EIGEN_MAJOR_VERSION 94
#define EIGEN_MAJOR_VERSION 95
#define EIGEN_MINOR_VERSION 0
#define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \
@@ -261,9 +261,7 @@
* If we made alignment depend on whether or not EIGEN_VECTORIZE is defined, it would be impossible to link
* vectorized and non-vectorized code.
*/
#if !EIGEN_ALIGN_STATICALLY
#define EIGEN_ALIGN_TO_BOUNDARY(n)
#elif (defined __GNUC__) || (defined __PGI) || (defined __IBMCPP__)
#if (defined __GNUC__) || (defined __PGI) || (defined __IBMCPP__)
#define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n)))
#elif (defined _MSC_VER)
#define EIGEN_ALIGN_TO_BOUNDARY(n) __declspec(align(n))
@@ -276,6 +274,14 @@
#define EIGEN_ALIGN16 EIGEN_ALIGN_TO_BOUNDARY(16)
#if EIGEN_ALIGN_STATICALLY
#define EIGEN_USER_ALIGN_TO_BOUNDARY(n) EIGEN_ALIGN_TO_BOUNDARY(n)
#define EIGEN_USER_ALIGN16 EIGEN_ALIGN16
#else
#define EIGEN_USER_ALIGN_TO_BOUNDARY(n)
#define EIGEN_USER_ALIGN16
#endif
#ifdef EIGEN_DONT_USE_RESTRICT_KEYWORD
#define EIGEN_RESTRICT
#endif

View File

@@ -167,14 +167,36 @@ inline void* generic_aligned_realloc(void* ptr, size_t size, size_t old_size)
*** Implementation of portable aligned versions of malloc/free/realloc ***
*****************************************************************************/
#ifdef EIGEN_NO_MALLOC
inline void check_that_malloc_is_allowed()
{
eigen_assert(false && "heap allocation is forbidden (EIGEN_NO_MALLOC is defined)");
}
#elif defined EIGEN_RUNTIME_NO_MALLOC
inline bool is_malloc_allowed_impl(bool update, bool new_value = false)
{
static bool value = true;
if (update == 1)
value = new_value;
return value;
}
inline bool is_malloc_allowed() { return is_malloc_allowed_impl(false); }
inline bool set_is_malloc_allowed(bool new_value) { return is_malloc_allowed_impl(true, new_value); }
inline void check_that_malloc_is_allowed()
{
eigen_assert(is_malloc_allowed() && "heap allocation is forbidden (EIGEN_RUNTIME_NO_MALLOC is defined and g_is_malloc_allowed is false)");
}
#else
inline void check_that_malloc_is_allowed()
{}
#endif
/** \internal Allocates \a size bytes. The returned pointer is guaranteed to have 16 bytes alignment.
* On allocation error, the returned pointer is null, and if exceptions are enabled then a std::bad_alloc is thrown.
*/
inline void* aligned_malloc(size_t size)
{
#ifdef EIGEN_NO_MALLOC
eigen_assert(false && "heap allocation is forbidden (EIGEN_NO_MALLOC is defined)");
#endif
check_that_malloc_is_allowed();
void *result;
#if !EIGEN_ALIGN
@@ -268,9 +290,7 @@ template<bool Align> inline void* conditional_aligned_malloc(size_t size)
template<> inline void* conditional_aligned_malloc<false>(size_t size)
{
#ifdef EIGEN_NO_MALLOC
eigen_assert(false && "heap allocation is forbidden (EIGEN_NO_MALLOC is defined)");
#endif
check_that_malloc_is_allowed();
void *result = std::malloc(size);
#ifdef EIGEN_EXCEPTIONS

View File

@@ -4,3 +4,5 @@ INSTALL(FILES
${Eigen_Eigen2Support_SRCS}
DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigen2Support COMPONENT Devel
)
ADD_SUBDIRECTORY(Geometry)

View File

@@ -1,6 +1,6 @@
FILE(GLOB Eigen_Geometry_SRCS "*.h")
FILE(GLOB Eigen_Eigen2Support_Geometry_SRCS "*.h")
INSTALL(FILES
${Eigen_Geometry_SRCS}
${Eigen_Eigen2Support_Geometry_SRCS}
DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigen2Support/Geometry
)

View File

@@ -232,13 +232,15 @@ template<typename MatrixType,typename Lhs>
struct traits<homogeneous_left_product_impl<Homogeneous<MatrixType,Vertical>,Lhs> >
{
typedef typename take_matrix_for_product<Lhs>::type LhsMatrixType;
typedef typename remove_all<MatrixType>::type MatrixTypeCleaned;
typedef typename remove_all<LhsMatrixType>::type LhsMatrixTypeCleaned;
typedef typename make_proper_matrix_type<
typename traits<MatrixType>::Scalar,
LhsMatrixType::RowsAtCompileTime,
MatrixType::ColsAtCompileTime,
MatrixType::PlainObject::Options,
LhsMatrixType::MaxRowsAtCompileTime,
MatrixType::MaxColsAtCompileTime>::type ReturnType;
typename traits<MatrixTypeCleaned>::Scalar,
LhsMatrixTypeCleaned::RowsAtCompileTime,
MatrixTypeCleaned::ColsAtCompileTime,
MatrixTypeCleaned::PlainObject::Options,
LhsMatrixTypeCleaned::MaxRowsAtCompileTime,
MatrixTypeCleaned::MaxColsAtCompileTime>::type ReturnType;
};
template<typename MatrixType,typename Lhs>
@@ -246,7 +248,8 @@ struct homogeneous_left_product_impl<Homogeneous<MatrixType,Vertical>,Lhs>
: public ReturnByValue<homogeneous_left_product_impl<Homogeneous<MatrixType,Vertical>,Lhs> >
{
typedef typename traits<homogeneous_left_product_impl>::LhsMatrixType LhsMatrixType;
typedef typename remove_all<typename LhsMatrixType::Nested>::type LhsMatrixTypeNested;
typedef typename remove_all<LhsMatrixType>::type LhsMatrixTypeCleaned;
typedef typename remove_all<typename LhsMatrixTypeCleaned::Nested>::type LhsMatrixTypeNested;
typedef typename MatrixType::Index Index;
homogeneous_left_product_impl(const Lhs& lhs, const MatrixType& rhs)
: m_lhs(take_matrix_for_product<Lhs>::run(lhs)),
@@ -267,7 +270,7 @@ struct homogeneous_left_product_impl<Homogeneous<MatrixType,Vertical>,Lhs>
.template replicate<MatrixType::ColsAtCompileTime>(m_rhs.cols());
}
const typename LhsMatrixType::Nested m_lhs;
const typename LhsMatrixTypeCleaned::Nested m_lhs;
const typename MatrixType::Nested m_rhs;
};

View File

@@ -43,7 +43,9 @@ struct transform_traits
template< typename TransformType,
typename MatrixType,
bool IsProjective = transform_traits<TransformType>::IsProjective>
int Case = transform_traits<TransformType>::IsProjective ? 0
: int(MatrixType::RowsAtCompileTime) == int(transform_traits<TransformType>::HDim) ? 1
: 2>
struct transform_right_product_impl;
template< typename Other,
@@ -199,7 +201,7 @@ public:
typedef _Scalar Scalar;
typedef DenseIndex Index;
/** type of the matrix used to represent the transformation */
typedef Matrix<Scalar,Rows,HDim,Options> MatrixType;
typedef typename internal::make_proper_matrix_type<Scalar,Rows,HDim,Options>::type MatrixType;
/** constified MatrixType */
typedef const MatrixType ConstMatrixType;
/** type of the matrix used to represent the linear part of the transformation */
@@ -1204,7 +1206,7 @@ struct transform_product_result
};
template< typename TransformType, typename MatrixType >
struct transform_right_product_impl< TransformType, MatrixType, true >
struct transform_right_product_impl< TransformType, MatrixType, 0 >
{
typedef typename MatrixType::PlainObject ResultType;
@@ -1215,7 +1217,7 @@ struct transform_right_product_impl< TransformType, MatrixType, true >
};
template< typename TransformType, typename MatrixType >
struct transform_right_product_impl< TransformType, MatrixType, false >
struct transform_right_product_impl< TransformType, MatrixType, 1 >
{
enum {
Dim = TransformType::Dim,
@@ -1228,20 +1230,39 @@ struct transform_right_product_impl< TransformType, MatrixType, false >
EIGEN_STRONG_INLINE static ResultType run(const TransformType& T, const MatrixType& other)
{
EIGEN_STATIC_ASSERT(OtherRows==Dim || OtherRows==HDim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
EIGEN_STATIC_ASSERT(OtherRows==HDim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
typedef Block<ResultType, Dim, OtherCols> TopLeftLhs;
typedef Block<const MatrixType, Dim, OtherCols> TopLeftRhs;
ResultType res(other.rows(),other.cols());
TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() = T.affine() * other;
res.row(OtherRows-1) = other.row(OtherRows-1);
return res;
}
};
TopLeftLhs(res, 0, 0, Dim, other.cols()) =
( T.linear() * TopLeftRhs(other, 0, 0, Dim, other.cols()) ).colwise() +
T.translation();
template< typename TransformType, typename MatrixType >
struct transform_right_product_impl< TransformType, MatrixType, 2 >
{
enum {
Dim = TransformType::Dim,
HDim = TransformType::HDim,
OtherRows = MatrixType::RowsAtCompileTime,
OtherCols = MatrixType::ColsAtCompileTime
};
// we need to take .rows() because OtherRows might be Dim or HDim
if (OtherRows==HDim)
res.row(other.rows()) = other.row(other.rows());
typedef typename MatrixType::PlainObject ResultType;
EIGEN_STRONG_INLINE static ResultType run(const TransformType& T, const MatrixType& other)
{
EIGEN_STATIC_ASSERT(OtherRows==Dim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
typedef Block<ResultType, Dim, OtherCols> TopLeftLhs;
ResultType res(other.rows(),other.cols());
TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() = T.linear() * other;
TopLeftLhs(res, 0, 0, Dim, other.cols()).colwise() += T.translation();
return res;
}

View File

@@ -376,7 +376,12 @@ template<typename _MatrixType, int QRPreconditioner> class JacobiSVD
* The default constructor is useful in cases in which the user intends to
* perform decompositions via JacobiSVD::compute(const MatrixType&).
*/
JacobiSVD() : m_isInitialized(false) {}
JacobiSVD()
: m_isInitialized(false),
m_isAllocated(false),
m_computationOptions(0),
m_rows(-1), m_cols(-1)
{}
/** \brief Default Constructor with memory preallocation
@@ -386,6 +391,10 @@ template<typename _MatrixType, int QRPreconditioner> class JacobiSVD
* \sa JacobiSVD()
*/
JacobiSVD(Index rows, Index cols, unsigned int computationOptions = 0)
: m_isInitialized(false),
m_isAllocated(false),
m_computationOptions(0),
m_rows(-1), m_cols(-1)
{
allocate(rows, cols, computationOptions);
}
@@ -401,11 +410,15 @@ template<typename _MatrixType, int QRPreconditioner> class JacobiSVD
* available with the (non-default) FullPivHouseholderQR preconditioner.
*/
JacobiSVD(const MatrixType& matrix, unsigned int computationOptions = 0)
: m_isInitialized(false),
m_isAllocated(false),
m_computationOptions(0),
m_rows(-1), m_cols(-1)
{
compute(matrix, computationOptions);
}
/** \brief Method performing the decomposition of given matrix.
/** \brief Method performing the decomposition of given matrix using custom options.
*
* \param matrix the matrix to decompose
* \param computationOptions optional parameter allowing to specify if you want full or thin U or V unitaries to be computed.
@@ -415,7 +428,18 @@ template<typename _MatrixType, int QRPreconditioner> class JacobiSVD
* Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not
* available with the (non-default) FullPivHouseholderQR preconditioner.
*/
JacobiSVD& compute(const MatrixType& matrix, unsigned int computationOptions = 0);
JacobiSVD& compute(const MatrixType& matrix, unsigned int computationOptions);
/** \brief Method performing the decomposition of given matrix using current options.
*
* \param matrix the matrix to decompose
*
* This method uses the current \a computationOptions, as already passed to the constructor or to compute(const MatrixType&, unsigned int).
*/
JacobiSVD& compute(const MatrixType& matrix)
{
return compute(matrix, m_computationOptions);
}
/** \returns the \a U matrix.
*
@@ -494,16 +518,17 @@ template<typename _MatrixType, int QRPreconditioner> class JacobiSVD
inline Index cols() const { return m_cols; }
private:
void allocate(Index rows, Index cols, unsigned int computationOptions = 0);
void allocate(Index rows, Index cols, unsigned int computationOptions);
protected:
MatrixUType m_matrixU;
MatrixVType m_matrixV;
SingularValuesType m_singularValues;
WorkMatrixType m_workMatrix;
bool m_isInitialized;
bool m_isInitialized, m_isAllocated;
bool m_computeFullU, m_computeThinU;
bool m_computeFullV, m_computeThinV;
unsigned int m_computationOptions;
Index m_nonzeroSingularValues, m_rows, m_cols, m_diagSize;
template<typename __MatrixType, int _QRPreconditioner, bool _IsComplex>
@@ -515,9 +540,21 @@ template<typename _MatrixType, int QRPreconditioner> class JacobiSVD
template<typename MatrixType, int QRPreconditioner>
void JacobiSVD<MatrixType, QRPreconditioner>::allocate(Index rows, Index cols, unsigned int computationOptions)
{
eigen_assert(rows >= 0 && cols >= 0);
if (m_isAllocated &&
rows == m_rows &&
cols == m_cols &&
computationOptions == m_computationOptions)
{
return;
}
m_rows = rows;
m_cols = cols;
m_isInitialized = false;
m_isAllocated = true;
m_computationOptions = computationOptions;
m_computeFullU = (computationOptions & ComputeFullU) != 0;
m_computeThinU = (computationOptions & ComputeThinU) != 0;
m_computeFullV = (computationOptions & ComputeFullV) != 0;

View File

@@ -133,7 +133,12 @@ static void sparse_product_impl(const Lhs& lhs, const Rhs& rhs, ResultType& res)
float avgNnzPerRhsColumn = float(rhs.nonZeros())/float(cols);
float ratioRes = std::min(ratioLhs * avgNnzPerRhsColumn, 1.f);
res.resize(rows, cols);
// mimics a resizeByInnerOuter:
if(ResultType::IsRowMajor)
res.resize(cols, rows);
else
res.resize(rows, cols);
res.reserve(Index(ratioRes*rows*cols));
for (Index j=0; j<cols; ++j)
{

View File

@@ -56,20 +56,22 @@ class EigenMatrixPrinter:
template_params = m.split(',')
template_params = map(lambda x:x.replace(" ", ""), template_params)
self.rows = int(template_params[1])
self.cols = int(template_params[2])
if template_params[1] == '-0x00000000000000001':
self.rows = val['m_storage']['m_rows']
else:
self.rows = int(template_params[1])
if template_params[2] == '-0x00000000000000001':
self.cols = val['m_storage']['m_cols']
else:
self.cols = int(template_params[2])
self.options = 0 # default value
if len(template_params) > 3:
self.options = template_params[3];
self.rowMajor = (int(self.options) & 0x1)
if self.rows == 10000:
self.rows = val['m_storage']['m_rows']
if self.cols == 10000:
self.cols = val['m_storage']['m_cols']
self.innerType = self.type.template_argument(0)
self.val = val

View File

@@ -21,6 +21,7 @@ and gives tips to help porting your application from Eigen2 to Eigen3.
- \ref LazyVsNoalias
- \ref AlignMacros
- \ref AlignedMap
- \ref StdContainers
- \ref eiPrefix
\section CompatibilitySupport Eigen2 compatibility support
@@ -295,6 +296,18 @@ There also are related convenience static methods, which actually are the prefer
result = Vector4f::MapAligned(some_aligned_array);
\endcode
\section StdContainers STL Containers
In Eigen2, #include<Eigen/StdVector> tweaked std::vector to automatically align elements. The problem was that that was quite invasive. In Eigen3, we only override standard behavior if you use Eigen::aligned_allocator<T> as your allocator type. So for example, if you use std::vector<Matrix4f>, you need to do the following change (note that aligned_allocator is under namespace Eigen):
<table class="manual">
<tr><th>Eigen 2</th><th>Eigen 3</th></tr>
<tr>
<td> \code std::vector<Matrix4f> \endcode </td>
<td> \code std::vector<Matrix4f, aligned_allocator<Matrix4f> > \endcode </td>
</tr>
</table>
\section eiPrefix Internal ei_ prefix
In Eigen2, global internal functions and structures were prefixed by \c ei_. In Eigen3, they all have been moved into the more explicit \c internal namespace. So, e.g., \c ei_sqrt(x) now becomes \c internal::sqrt(x). Of course it is not recommended to rely on Eigen's internal features.

View File

@@ -47,6 +47,7 @@ The parts of the API that are still not 100% Eigen 2 compatible in this mode are
\li Dot products over complex numbers. Eigen 2's dot product was linear in the first variable. Eigen 3's dot product is linear in the second variable. In other words, the Eigen 2 code \code x.dot(y) \endcode is equivalent to the Eigen 3 code \code y.dot(x) \endcode In yet other words, dot products are complex-conjugated in Eigen 3 compared to Eigen 2. The switch to the new convention was commanded by common usage, especially with the notation \f$ x^Ty \f$ for dot products of column-vectors.
\li The Sparse module.
\li Certain fine details of linear algebraic decompositions. For example, LDLT decomposition is now pivoting in Eigen 3 whereas it wasn't in Eigen 2, so code that was relying on its underlying matrix structure will break.
\li Usage of Eigen types in STL containers, \ref Eigen2ToEigen3 "as explained on this page".
\section Stage20 Stage 20: define EIGEN2_SUPPORT_STAGE20_RESOLVE_API_CONFLICTS

View File

@@ -2,7 +2,7 @@ namespace Eigen {
/** \page TopicPreprocessorDirectives Preprocessor directives
You can control some aspects of Eigen by defining the preprocessor tokens using \c #define. These macros
You can control some aspects of Eigen by defining the preprocessor tokens using \c \#define. These macros
should be defined before any Eigen headers are included. Often they are best set in the project options.
This page lists the preprocesor tokens recognised by Eigen.
@@ -22,6 +22,8 @@ This page lists the preprocesor tokens recognised by Eigen.
Eigen3; see \ref Eigen2SupportModes.
- \b EIGEN_DEFAULT_TO_ROW_MAJOR - when defined, the default storage order for matrices becomes row-major
instead of column-major. Not defined by default.
- \b EIGEN_DEFAULT_DENSE_INDEX_TYPE - the type for column and row indices in matrices, vectors and array
(DenseBase::Index). Set to \c std::ptrdiff_t by default.
- \b EIGEN_DEFAULT_IO_FORMAT - the IOFormat to use when printing a matrix if no #IOFormat is specified.
Defaults to the #IOFormat constructed by the default constructor IOFormat().
- \b EIGEN_INITIALIZE_MATRICES_BY_ZERO - if defined, all entries of newly constructed matrices and arrays are
@@ -43,7 +45,8 @@ run time. However, these assertions do cost time and can thus be turned off.
\section TopicPreprocessorDirectivesPerformance Alignment, vectorization and performance tweaking
- \b EIGEN_DONT_ALIGN - disables alignment.
- \b EIGEN_DONT_ALIGN - disables alignment completely. Eigen will not try to align its objects and does not
expect that any objects passed to it are aligned. This will turn off vectorization. Not defined by default.
- \b EIGEN_DONT_ALIGN_STATICALLY - disables alignment of arrays on the stack. Not defined by default, unless
\c EIGEN_DONT_ALIGN is defined.
- \b EIGEN_DONT_VECTORIZE - disables explicit vectorization when defined. Not defined by default, unless

View File

@@ -119,6 +119,7 @@ ei_add_test(eigen2support)
ei_add_test(nullary)
ei_add_test(nesting_ops "${CMAKE_CXX_FLAGS_DEBUG}")
ei_add_test(zerosized)
ei_add_test(dontalign)
ei_add_test(prec_inverse_4x4)

78
test/dontalign.cpp Normal file
View File

@@ -0,0 +1,78 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2011 Benoit Jacob <jacob.benoit.1@gmail.com>
//
// 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/>.
#if defined EIGEN_TEST_PART_1 || defined EIGEN_TEST_PART_2 || defined EIGEN_TEST_PART_3 || defined EIGEN_TEST_PART_4
#define EIGEN_DONT_ALIGN
#elif defined EIGEN_TEST_PART_5 || defined EIGEN_TEST_PART_6 || defined EIGEN_TEST_PART_7 || defined EIGEN_TEST_PART_8
#define EIGEN_DONT_ALIGN_STATICALLY
#endif
#include "main.h"
#include <Eigen/Dense>
template<typename MatrixType>
void dontalign(const MatrixType& m)
{
typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> SquareMatrixType;
Index rows = m.rows();
Index cols = m.cols();
MatrixType a = MatrixType::Random(rows,cols);
SquareMatrixType square = SquareMatrixType::Random(rows,rows);
VectorType v = VectorType::Random(rows);
VERIFY_IS_APPROX(v, square * square.colPivHouseholderQr().solve(v));
square = square.inverse().eval();
a = square * a;
square = square*square;
v = square * v;
v = a.adjoint() * v;
VERIFY(square.determinant() != Scalar(0));
// bug 219: MapAligned() was giving an assert with EIGEN_DONT_ALIGN, because Map Flags were miscomputed
Scalar* array = internal::aligned_new<Scalar>(rows);
v = VectorType::MapAligned(array, rows);
internal::aligned_delete(array, rows);
}
void test_dontalign()
{
#if defined EIGEN_TEST_PART_1 || defined EIGEN_TEST_PART_5
dontalign(Matrix3d());
dontalign(Matrix4f());
#elif defined EIGEN_TEST_PART_2 || defined EIGEN_TEST_PART_6
dontalign(Matrix3cd());
dontalign(Matrix4cf());
#elif defined EIGEN_TEST_PART_3 || defined EIGEN_TEST_PART_7
dontalign(Matrix<float, 32, 32>());
dontalign(Matrix<std::complex<float>, 32, 32>());
#elif defined EIGEN_TEST_PART_4 || defined EIGEN_TEST_PART_8
dontalign(MatrixXd(32, 32));
dontalign(MatrixXcf(32, 32));
#endif
}

View File

@@ -68,7 +68,7 @@ template<typename MatrixType> void adjoint(const MatrixType& m)
VERIFY(ei_isApprox((s1 * v1 + s2 * v2).eigen2_dot(v3), s1 * v1.eigen2_dot(v3) + s2 * v2.eigen2_dot(v3), largerEps));
VERIFY(ei_isApprox(v3.eigen2_dot(s1 * v1 + s2 * v2), ei_conj(s1)*v3.eigen2_dot(v1)+ei_conj(s2)*v3.eigen2_dot(v2), largerEps));
VERIFY_IS_APPROX(ei_conj(v1.eigen2_dot(v2)), v2.eigen2_dot(v1));
VERIFY_IS_APPROX(ei_abs(v1.eigen2_dot(v1)), v1.squaredNorm());
VERIFY_IS_APPROX(ei_real(v1.eigen2_dot(v1)), v1.squaredNorm());
if(NumTraits<Scalar>::HasFloatingPoint)
VERIFY_IS_APPROX(v1.squaredNorm(), v1.norm() * v1.norm());
VERIFY_IS_MUCH_SMALLER_THAN(ei_abs(vzero.eigen2_dot(v1)), static_cast<RealScalar>(1));

View File

@@ -89,10 +89,9 @@ template<typename MatrixType> void selfadjointeigensolver(const MatrixType& m)
VERIFY((symmA * _evec).isApprox(symmB * (_evec * _eval.asDiagonal()), largerEps));
// compare with eigen
// std::cerr << _eval.transpose() << "\n" << eiSymmGen.eigenvalues().transpose() << "\n\n";
// std::cerr << _evec.format(6) << "\n\n" << eiSymmGen.eigenvectors().format(6) << "\n\n\n";
MatrixType normalized_eivec = eiSymmGen.eigenvectors()*eiSymmGen.eigenvectors().colwise().norm().asDiagonal().inverse();
VERIFY_IS_APPROX(_eval, eiSymmGen.eigenvalues());
VERIFY_IS_APPROX(_evec.cwise().abs(), eiSymmGen.eigenvectors().cwise().abs());
VERIFY_IS_APPROX(_evec.cwiseAbs(), normalized_eivec.cwiseAbs());
Gsl::free(gSymmA);
Gsl::free(gSymmB);

View File

@@ -32,7 +32,7 @@ void check_stdvector_matrix(const MatrixType& m)
int rows = m.rows();
int cols = m.cols();
MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols);
std::vector<MatrixType> v(10, MatrixType(rows,cols)), w(20, y);
std::vector<MatrixType, aligned_allocator<MatrixType> > v(10, MatrixType(rows,cols)), w(20, y);
v[5] = x;
w[6] = v[5];
VERIFY_IS_APPROX(w[6], v[5]);
@@ -67,7 +67,7 @@ void check_stdvector_transform(const TransformType&)
{
typedef typename TransformType::MatrixType MatrixType;
TransformType x(MatrixType::Random()), y(MatrixType::Random());
std::vector<TransformType> v(10), w(20, y);
std::vector<TransformType, aligned_allocator<TransformType> > v(10), w(20, y);
v[5] = x;
w[6] = v[5];
VERIFY_IS_APPROX(w[6], v[5]);
@@ -102,7 +102,7 @@ void check_stdvector_quaternion(const QuaternionType&)
{
typedef typename QuaternionType::Coefficients Coefficients;
QuaternionType x(Coefficients::Random()), y(Coefficients::Random());
std::vector<QuaternionType> v(10), w(20, y);
std::vector<QuaternionType, aligned_allocator<QuaternionType> > v(10), w(20, y);
v[5] = x;
w[6] = v[5];
VERIFY_IS_APPROX(w[6], v[5]);

View File

@@ -111,8 +111,10 @@ namespace Eigen
#else // EIGEN_DEBUG_ASSERTS
#undef eigen_assert
// see bug 89. The copy_bool here is working around a bug in gcc <= 4.3
#define eigen_assert(a) \
if( (!(a)) && (!no_more_assert) ) \
if( (!Eigen::internal::copy_bool(a)) && (!no_more_assert) ) \
{ \
Eigen::no_more_assert = true; \
throw Eigen::eigen_assert_exception(); \

View File

@@ -87,15 +87,29 @@ template<typename Scalar,int Size> void homogeneous(void)
m0.transpose().rowwise().homogeneous() * t3);
// test product with a Transform object
Transform<Scalar, Size, Affine> Rt;
Matrix<Scalar, Size, Dynamic> pts, Rt_pts1;
Transform<Scalar, Size, Affine> aff;
Transform<Scalar, Size, AffineCompact> caff;
Transform<Scalar, Size, Projective> proj;
Matrix<Scalar, Size, Dynamic> pts;
Matrix<Scalar, Size+1, Dynamic> pts1, pts2;
Rt.setIdentity();
pts.setRandom(Size,5);
Rt_pts1 = Rt * pts.colwise().homogeneous();
// std::cerr << (Rt_pts1 - pts).sum() << "\n";
VERIFY_IS_MUCH_SMALLER_THAN( (Rt_pts1 - pts).sum(), Scalar(1));
aff.affine().setRandom();
proj = caff = aff;
pts.setRandom(Size,internal::random<int>(1,20));
pts1 = pts.colwise().homogeneous();
VERIFY_IS_APPROX(aff * pts.colwise().homogeneous(), (aff * pts1).colwise().hnormalized());
VERIFY_IS_APPROX(caff * pts.colwise().homogeneous(), (caff * pts1).colwise().hnormalized());
VERIFY_IS_APPROX(proj * pts.colwise().homogeneous(), (proj * pts1));
VERIFY_IS_APPROX((aff * pts1).colwise().hnormalized(), aff * pts);
VERIFY_IS_APPROX((caff * pts1).colwise().hnormalized(), caff * pts);
pts2 = pts1;
pts2.row(Size).setRandom();
VERIFY_IS_APPROX((aff * pts2).colwise().hnormalized(), aff * pts2.colwise().hnormalized());
VERIFY_IS_APPROX((caff * pts2).colwise().hnormalized(), caff * pts2.colwise().hnormalized());
VERIFY_IS_APPROX((proj * pts2).colwise().hnormalized(), (proj * pts2.colwise().hnormalized().colwise().homogeneous()).colwise().hnormalized());
}
void test_geo_homogeneous()

View File

@@ -72,7 +72,7 @@ template<typename Scalar, int Options> void quaternion(void)
if((q1.coeffs()-q2.coeffs()).norm() > 10*largeEps)
{
VERIFY(internal::isApprox(q1.angularDistance(q2), refangle, largeEps));
VERIFY_IS_MUCH_SMALLER_THAN(internal::abs(q1.angularDistance(q2) - refangle), Scalar(1));
}
// rotation matrix conversion
@@ -90,7 +90,15 @@ template<typename Scalar, int Options> void quaternion(void)
// angle-axis conversion
AngleAxisx aa = AngleAxisx(q1);
VERIFY_IS_APPROX(q1 * v1, Quaternionx(aa) * v1);
VERIFY_IS_NOT_APPROX(q1 * v1, Quaternionx(AngleAxisx(aa.angle()*2,aa.axis())) * v1);
// Do not execute the test if the rotation angle is almost zero, or
// the rotation axis and v1 are almost parallel.
if (internal::abs(aa.angle()) > 5*test_precision<Scalar>()
&& (aa.axis() - v1.normalized()).norm() < 1.99
&& (aa.axis() + v1.normalized()).norm() < 1.99)
{
VERIFY_IS_NOT_APPROX(q1 * v1, Quaternionx(AngleAxisx(aa.angle()*2,aa.axis())) * v1);
}
// from two vector creation
VERIFY_IS_APPROX( v2.normalized(),(q2.setFromTwoVectors(v1, v2)*v1).normalized());

View File

@@ -23,6 +23,9 @@
// License and a copy of the GNU General Public License along with
// Eigen. If not, see <http://www.gnu.org/licenses/>.
// discard stack allocation as that too bypasses malloc
#define EIGEN_STACK_ALLOCATION_LIMIT 0
#define EIGEN_RUNTIME_NO_MALLOC
#include "main.h"
#include <Eigen/SVD>
@@ -241,6 +244,46 @@ void jacobisvd_inf_nan()
svd.compute(m, ComputeFullU | ComputeFullV);
}
void jacobisvd_preallocate()
{
Vector3f v(3.f, 2.f, 1.f);
MatrixXf m = v.asDiagonal();
internal::set_is_malloc_allowed(false);
VERIFY_RAISES_ASSERT(VectorXf v(10);)
JacobiSVD<MatrixXf> svd;
internal::set_is_malloc_allowed(true);
svd.compute(m);
VERIFY_IS_APPROX(svd.singularValues(), v);
JacobiSVD<MatrixXf> svd2(3,3);
internal::set_is_malloc_allowed(false);
svd2.compute(m);
internal::set_is_malloc_allowed(true);
VERIFY_IS_APPROX(svd2.singularValues(), v);
VERIFY_RAISES_ASSERT(svd2.matrixU());
VERIFY_RAISES_ASSERT(svd2.matrixV());
svd2.compute(m, ComputeFullU | ComputeFullV);
VERIFY_IS_APPROX(svd2.matrixU(), Matrix3f::Identity());
VERIFY_IS_APPROX(svd2.matrixV(), Matrix3f::Identity());
internal::set_is_malloc_allowed(false);
svd2.compute(m);
internal::set_is_malloc_allowed(true);
JacobiSVD<MatrixXf> svd3(3,3,ComputeFullU|ComputeFullV);
internal::set_is_malloc_allowed(false);
svd2.compute(m);
internal::set_is_malloc_allowed(true);
VERIFY_IS_APPROX(svd2.singularValues(), v);
VERIFY_IS_APPROX(svd2.matrixU(), Matrix3f::Identity());
VERIFY_IS_APPROX(svd2.matrixV(), Matrix3f::Identity());
internal::set_is_malloc_allowed(false);
svd2.compute(m, ComputeFullU|ComputeFullV);
internal::set_is_malloc_allowed(true);
}
void test_jacobisvd()
{
CALL_SUBTEST_3(( jacobisvd_verify_assert(Matrix3f()) ));
@@ -290,4 +333,7 @@ void test_jacobisvd()
// Test problem size constructors
CALL_SUBTEST_7( JacobiSVD<MatrixXf>(10,10) );
// Check that preallocation avoids subsequent mallocs
CALL_SUBTEST_9( jacobisvd_preallocate() );
}

View File

@@ -27,17 +27,18 @@
template<typename MatrixType>
bool equalsIdentity(const MatrixType& A)
{
typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
Scalar zero = static_cast<Scalar>(0);
bool offDiagOK = true;
for (int i = 0; i < A.rows(); ++i) {
for (int j = i+1; j < A.cols(); ++j) {
for (Index i = 0; i < A.rows(); ++i) {
for (Index j = i+1; j < A.cols(); ++j) {
offDiagOK = offDiagOK && (A(i,j) == zero);
}
}
for (int i = 0; i < A.rows(); ++i) {
for (int j = 0; j < i; ++j) {
for (Index i = 0; i < A.rows(); ++i) {
for (Index j = 0; j < std::min(i, A.cols()); ++j) {
offDiagOK = offDiagOK && (A(i,j) == zero);
}
}
@@ -65,22 +66,22 @@ void testVectorType(const VectorType& base)
for (int i=0; i<size; ++i)
n(i) = low+i*step;
VERIFY( (m-n).norm() < std::numeric_limits<Scalar>::epsilon()*10e3 );
VERIFY_IS_APPROX(m,n);
// random access version
m = VectorType::LinSpaced(size,low,high);
VERIFY( (m-n).norm() < std::numeric_limits<Scalar>::epsilon()*10e3 );
VERIFY_IS_APPROX(m,n);
// Assignment of a RowVectorXd to a MatrixXd (regression test for bug #79).
VERIFY( (MatrixXd(RowVectorXd::LinSpaced(3, 0, 1)) - RowVector3d(0, 0.5, 1)).norm() < std::numeric_limits<Scalar>::epsilon() );
// These guys sometimes fail! This is not good. Any ideas how to fix them!?
//VERIFY( m(m.size()-1) == high );
//VERIFY( m(0) == low );
// VERIFY( m(m.size()-1) == high );
// VERIFY( m(0) == low );
// sequential access version
m = VectorType::LinSpaced(Sequential,size,low,high);
VERIFY( (m-n).norm() < std::numeric_limits<Scalar>::epsilon()*10e3 );
VERIFY_IS_APPROX(m,n);
// These guys sometimes fail! This is not good. Any ideas how to fix them!?
//VERIFY( m(m.size()-1) == high );
@@ -114,12 +115,15 @@ void testMatrixType(const MatrixType& m)
void test_nullary()
{
CALL_SUBTEST_1( testMatrixType(Matrix2d()) );
CALL_SUBTEST_2( testMatrixType(MatrixXcf(50,50)) );
CALL_SUBTEST_3( testMatrixType(MatrixXf(5,7)) );
CALL_SUBTEST_4( testVectorType(VectorXd(51)) );
CALL_SUBTEST_5( testVectorType(VectorXd(41)) );
CALL_SUBTEST_6( testVectorType(Vector3d()) );
CALL_SUBTEST_7( testVectorType(VectorXf(51)) );
CALL_SUBTEST_8( testVectorType(VectorXf(41)) );
CALL_SUBTEST_9( testVectorType(Vector3f()) );
CALL_SUBTEST_2( testMatrixType(MatrixXcf(internal::random<int>(1,300),internal::random<int>(1,300))) );
CALL_SUBTEST_3( testMatrixType(MatrixXf(internal::random<int>(1,300),internal::random<int>(1,300))) );
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST_4( testVectorType(VectorXd(internal::random<int>(1,300))) );
CALL_SUBTEST_5( testVectorType(VectorXd(internal::random<int>(1,300))) );
CALL_SUBTEST_6( testVectorType(Vector3d()) );
CALL_SUBTEST_7( testVectorType(VectorXf(internal::random<int>(1,300))) );
CALL_SUBTEST_8( testVectorType(VectorXf(internal::random<int>(1,300))) );
CALL_SUBTEST_9( testVectorType(Vector3f()) );
}
}

View File

@@ -441,7 +441,7 @@ void SparseLDLT<_MatrixType,Cholmod>::compute(const _MatrixType& a)
m_cholmod.supernodal = CHOLMOD_SIMPLICIAL;
//m_cholmod.supernodal = CHOLMOD_SUPERNODAL;
// TODO
if (this->m_flags & Base::IncompleteFactorization)
if (this->m_flags & IncompleteFactorization)
{
m_cholmod.nmethods = 1;
//m_cholmod.method[0].ordering = CHOLMOD_NATURAL;

View File

@@ -57,7 +57,7 @@ using namespace Eigen;
}
#define VERIFY_UNIFORMi(NAME,TYPE) { \
TYPE value; value.setRandom(); \
TYPE value = TYPE::Random().eval().cast<float>().cast<TYPE::Scalar>(); \
TYPE data; \
int loc = glGetUniformLocation(prg_id, #NAME); \
VERIFY((loc!=-1) && "uniform not found"); \