aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2011-01-26 16:36:07 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2011-01-26 16:36:07 +0100
commit98285ba81c8e90c95434bfa262484f2aa5d2664b (patch)
tree27348c602174eea9b650df8e9d0abca3881ed974
parent7ef9d82b39b338c814f4c120ef3dea58a244a391 (diff)
parent76c630d185b4a9eda5261a6f4651cafdebb91508 (diff)
merge
-rw-r--r--Eigen/Eigen2Support22
-rw-r--r--Eigen/LU4
-rw-r--r--Eigen/QR6
-rw-r--r--Eigen/SVD4
-rw-r--r--Eigen/src/Core/DenseBase.h19
-rw-r--r--Eigen/src/Core/MatrixBase.h31
-rw-r--r--Eigen/src/Core/SelfAdjointView.h40
-rw-r--r--Eigen/src/Core/TriangularMatrix.h72
-rw-r--r--Eigen/src/Core/Visitor.h65
-rw-r--r--Eigen/src/Core/util/ForwardDeclarations.h6
-rw-r--r--Eigen/src/Eigen2Support/Geometry/Hyperplane.h4
-rw-r--r--Eigen/src/Eigen2Support/LU.h133
-rw-r--r--Eigen/src/Eigen2Support/QR.h79
-rw-r--r--Eigen/src/Eigen2Support/SVD.h649
-rw-r--r--Eigen/src/LU/PartialPivLU.h2
-rw-r--r--Eigen/src/SVD/UpperBidiagonalization.h2
-rw-r--r--Eigen/src/Sparse/SparseDiagonalProduct.h8
-rw-r--r--cmake/EigenTesting.cmake6
-rw-r--r--test/eigen2/CMakeLists.txt174
-rw-r--r--test/eigen2/eigen2_adjoint.cpp (renamed from test/eigen2/adjoint.cpp)16
-rw-r--r--test/eigen2/eigen2_alignedbox.cpp (renamed from test/eigen2/alignedbox.cpp)8
-rw-r--r--test/eigen2/eigen2_array.cpp (renamed from test/eigen2/array.cpp)36
-rw-r--r--test/eigen2/eigen2_basicstuff.cpp (renamed from test/eigen2/basicstuff.cpp)16
-rw-r--r--test/eigen2/eigen2_bug_132.cpp (renamed from test/eigen2/bug_132.cpp)4
-rw-r--r--test/eigen2/eigen2_cholesky.cpp (renamed from test/eigen2/cholesky.cpp)18
-rw-r--r--test/eigen2/eigen2_commainitializer.cpp (renamed from test/eigen2/commainitializer.cpp)2
-rw-r--r--test/eigen2/eigen2_cwiseop.cpp (renamed from test/eigen2/cwiseop.cpp)14
-rw-r--r--test/eigen2/eigen2_determinant.cpp (renamed from test/eigen2/determinant.cpp)16
-rw-r--r--test/eigen2/eigen2_dynalloc.cpp (renamed from test/eigen2/dynalloc.cpp)2
-rw-r--r--test/eigen2/eigen2_eigensolver.cpp (renamed from test/eigen2/eigensolver.cpp)18
-rw-r--r--test/eigen2/eigen2_first_aligned.cpp (renamed from test/eigen2/first_aligned.cpp)6
-rw-r--r--test/eigen2/eigen2_geometry.cpp (renamed from test/eigen2/geometry.cpp)6
-rw-r--r--test/eigen2/eigen2_hyperplane.cpp (renamed from test/eigen2/hyperplane.cpp)14
-rw-r--r--test/eigen2/eigen2_inverse.cpp (renamed from test/eigen2/inverse.cpp)14
-rw-r--r--test/eigen2/eigen2_linearstructure.cpp (renamed from test/eigen2/linearstructure.cpp)18
-rw-r--r--test/eigen2/eigen2_lu.cpp (renamed from test/eigen2/lu.cpp)26
-rw-r--r--test/eigen2/eigen2_map.cpp (renamed from test/eigen2/map.cpp)32
-rw-r--r--test/eigen2/eigen2_meta.cpp (renamed from test/eigen2/meta.cpp)2
-rw-r--r--test/eigen2/eigen2_miscmatrices.cpp (renamed from test/eigen2/miscmatrices.cpp)12
-rw-r--r--test/eigen2/eigen2_mixingtypes.cpp (renamed from test/eigen2/mixingtypes.cpp)8
-rw-r--r--test/eigen2/eigen2_newstdvector.cpp (renamed from test/eigen2/newstdvector.cpp)34
-rw-r--r--test/eigen2/eigen2_nomalloc.cpp (renamed from test/eigen2/nomalloc.cpp)8
-rw-r--r--test/eigen2/eigen2_packetmath.cpp (renamed from test/eigen2/packetmath.cpp)10
-rw-r--r--test/eigen2/eigen2_parametrizedline.cpp (renamed from test/eigen2/parametrizedline.cpp)10
-rw-r--r--test/eigen2/eigen2_prec_inverse_4x4.cpp (renamed from test/eigen2/prec_inverse_4x4.cpp)14
-rw-r--r--test/eigen2/eigen2_product_large.cpp (renamed from test/eigen2/product_large.cpp)14
-rw-r--r--test/eigen2/eigen2_product_small.cpp (renamed from test/eigen2/product_small.cpp)12
-rw-r--r--test/eigen2/eigen2_qr.cpp (renamed from test/eigen2/qr.cpp)27
-rw-r--r--test/eigen2/eigen2_qtvector.cpp (renamed from test/eigen2/qtvector.cpp)36
-rw-r--r--test/eigen2/eigen2_regression.cpp (renamed from test/eigen2/regression.cpp)13
-rw-r--r--test/eigen2/eigen2_sizeof.cpp (renamed from test/eigen2/sizeof.cpp)2
-rw-r--r--test/eigen2/eigen2_smallvectors.cpp (renamed from test/eigen2/smallvectors.cpp)2
-rw-r--r--test/eigen2/eigen2_sparse_basic.cpp (renamed from test/eigen2/sparse_basic.cpp)10
-rw-r--r--test/eigen2/eigen2_sparse_product.cpp (renamed from test/eigen2/sparse_product.cpp)10
-rw-r--r--test/eigen2/eigen2_sparse_solvers.cpp (renamed from test/eigen2/sparse_solvers.cpp)8
-rw-r--r--test/eigen2/eigen2_sparse_vector.cpp (renamed from test/eigen2/sparse_vector.cpp)8
-rw-r--r--test/eigen2/eigen2_stdvector.cpp (renamed from test/eigen2/stdvector.cpp)36
-rw-r--r--test/eigen2/eigen2_submatrices.cpp (renamed from test/eigen2/submatrices.cpp)14
-rw-r--r--test/eigen2/eigen2_sum.cpp (renamed from test/eigen2/sum.cpp)20
-rw-r--r--test/eigen2/eigen2_svd.cpp (renamed from test/eigen2/svd.cpp)10
-rw-r--r--test/eigen2/eigen2_swap.cpp (renamed from test/eigen2/swap.cpp)10
-rw-r--r--test/eigen2/eigen2_triangular.cpp (renamed from test/eigen2/triangular.cpp)51
-rw-r--r--test/eigen2/eigen2_unalignedassert.cpp (renamed from test/eigen2/unalignedassert.cpp)2
-rw-r--r--test/eigen2/eigen2_visitor.cpp (renamed from test/eigen2/visitor.cpp)22
-rw-r--r--test/eigen2/main.h98
-rw-r--r--test/selfadjoint.cpp7
-rw-r--r--test/triangular.cpp7
67 files changed, 1550 insertions, 559 deletions
diff --git a/Eigen/Eigen2Support b/Eigen/Eigen2Support
index 560f1d2ff..9fa378795 100644
--- a/Eigen/Eigen2Support
+++ b/Eigen/Eigen2Support
@@ -67,16 +67,16 @@ namespace Eigen {
EIGEN_USING_MATRIX_TYPEDEFS \
using Eigen::Matrix; \
using Eigen::MatrixBase; \
-namespace ei_random = Eigen::internal::random; \
-namespace ei_real = Eigen::internal::real; \
-namespace ei_imag = Eigen::internal::imag; \
-namespace ei_conj = Eigen::internal::conj; \
-namespace ei_abs = Eigen::internal::abs; \
-namespace ei_abs2 = Eigen::internal::abs2; \
-namespace ei_sqrt = Eigen::internal::sqrt; \
-namespace ei_exp = Eigen::internal::exp; \
-namespace ei_log = Eigen::internal::log; \
-namespace ei_sin = Eigen::internal::sin; \
-namespace ei_cos = Eigen::internal::cos;
+using Eigen::ei_random; \
+using Eigen::ei_real; \
+using Eigen::ei_imag; \
+using Eigen::ei_conj; \
+using Eigen::ei_abs; \
+using Eigen::ei_abs2; \
+using Eigen::ei_sqrt; \
+using Eigen::ei_exp; \
+using Eigen::ei_log; \
+using Eigen::ei_sin; \
+using Eigen::ei_cos;
#endif // EIGEN2SUPPORT_H
diff --git a/Eigen/LU b/Eigen/LU
index 9ef9c97ec..cca3af154 100644
--- a/Eigen/LU
+++ b/Eigen/LU
@@ -30,6 +30,10 @@ namespace Eigen {
#include "src/LU/arch/Inverse_SSE.h"
#endif
+#ifdef EIGEN2_SUPPORT
+ #include "src/Eigen2Support/LU.h"
+#endif
+
} // namespace Eigen
#include "src/Core/util/EnableMSVCWarnings.h"
diff --git a/Eigen/QR b/Eigen/QR
index fc3937114..4dfb23782 100644
--- a/Eigen/QR
+++ b/Eigen/QR
@@ -29,13 +29,17 @@ namespace Eigen {
#include "src/QR/FullPivHouseholderQR.h"
#include "src/QR/ColPivHouseholderQR.h"
+#ifdef EIGEN2_SUPPORT
+#include "src/Eigen2Support/QR.h"
+#endif
} // namespace Eigen
#include "src/Core/util/EnableMSVCWarnings.h"
-// FIXME for compatibility we include Eigenvalues here:
+#ifdef EIGEN2_SUPPORT
#include "Eigenvalues"
+#endif
#endif // EIGEN_QR_MODULE_H
/* vim: set filetype=cpp et sw=2 ts=2 ai: */
diff --git a/Eigen/SVD b/Eigen/SVD
index 93277dbc3..c621f6da4 100644
--- a/Eigen/SVD
+++ b/Eigen/SVD
@@ -26,6 +26,10 @@ namespace Eigen {
#include "src/SVD/JacobiSVD.h"
#include "src/SVD/UpperBidiagonalization.h"
+#ifdef EIGEN2_SUPPORT
+#include "src/Eigen2Support/SVD.h"
+#endif
+
} // namespace Eigen
#include "src/Core/util/EnableMSVCWarnings.h"
diff --git a/Eigen/src/Core/DenseBase.h b/Eigen/src/Core/DenseBase.h
index 9c3c6432b..b8fa9d1cd 100644
--- a/Eigen/src/Core/DenseBase.h
+++ b/Eigen/src/Core/DenseBase.h
@@ -415,17 +415,14 @@ template<typename Derived> class DenseBase
typename internal::traits<Derived>::Scalar minCoeff() const;
typename internal::traits<Derived>::Scalar maxCoeff() const;
- typename internal::traits<Derived>::Scalar minCoeff(Index* row, Index* col) const;
- typename internal::traits<Derived>::Scalar maxCoeff(Index* row, Index* col) const;
- typename internal::traits<Derived>::Scalar minCoeff(Index* index) const;
- typename internal::traits<Derived>::Scalar maxCoeff(Index* index) const;
-
- #ifdef EIGEN2_SUPPORT
- typename internal::traits<Derived>::Scalar minCoeff(int* row, int* col) const;
- typename internal::traits<Derived>::Scalar maxCoeff(int* row, int* col) const;
- typename internal::traits<Derived>::Scalar minCoeff(int* index) const;
- typename internal::traits<Derived>::Scalar maxCoeff(int* index) const;
- #endif
+ template<typename IndexType>
+ typename internal::traits<Derived>::Scalar minCoeff(IndexType* row, IndexType* col) const;
+ template<typename IndexType>
+ typename internal::traits<Derived>::Scalar maxCoeff(IndexType* row, IndexType* col) const;
+ template<typename IndexType>
+ typename internal::traits<Derived>::Scalar minCoeff(IndexType* index) const;
+ template<typename IndexType>
+ typename internal::traits<Derived>::Scalar maxCoeff(IndexType* index) const;
template<typename BinaryOp>
typename internal::result_of<BinaryOp(typename internal::traits<Derived>::Scalar)>::type
diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h
index 40e44c9b3..3b854ca5e 100644
--- a/Eigen/src/Core/MatrixBase.h
+++ b/Eigen/src/Core/MatrixBase.h
@@ -243,8 +243,8 @@ template<typename Derived> class MatrixBase
typename MatrixBase::template ConstDiagonalIndexReturnType<Dynamic>::Type diagonal(Index index) const;
#ifdef EIGEN2_SUPPORT
- template<unsigned int Mode> TriangularView<Derived, Mode> part();
- template<unsigned int Mode> const TriangularView<Derived, Mode> part() const;
+ template<unsigned int Mode> typename internal::eigen2_part_return_type<Derived, Mode>::type part();
+ template<unsigned int Mode> const typename internal::eigen2_part_return_type<Derived, Mode>::type part() const;
// huuuge hack. make Eigen2's matrix.part<Diagonal>() work in eigen3. Problem: Diagonal is now a class template instead
// of an integer constant. Solution: overload the part() method template wrt template parameters list.
@@ -334,7 +334,26 @@ template<typename Derived> class MatrixBase
const FullPivLU<PlainObject> fullPivLu() const;
const PartialPivLU<PlainObject> partialPivLu() const;
+
+ #if EIGEN2_SUPPORT_STAGE < STAGE20_RESOLVE_API_CONFLICTS
+ const LU<PlainObject> lu() const;
+ #endif
+
+ #ifdef EIGEN2_SUPPORT
+ const LU<PlainObject> eigen2_lu() const;
+ #endif
+
+ #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS
const PartialPivLU<PlainObject> lu() const;
+ #endif
+
+ #ifdef EIGEN2_SUPPORT
+ template<typename ResultType>
+ void computeInverse(MatrixBase<ResultType> *result) const {
+ *result = this->inverse();
+ }
+ #endif
+
const internal::inverse_impl<Derived> inverse() const;
template<typename ResultType>
void computeInverseAndDetWithCheck(
@@ -361,6 +380,10 @@ template<typename Derived> class MatrixBase
const HouseholderQR<PlainObject> householderQr() const;
const ColPivHouseholderQR<PlainObject> colPivHouseholderQr() const;
const FullPivHouseholderQR<PlainObject> fullPivHouseholderQr() const;
+
+ #ifdef EIGEN2_SUPPORT
+ const QR<PlainObject> qr() const;
+ #endif
EigenvaluesReturnType eigenvalues() const;
RealScalar operatorNorm() const;
@@ -369,6 +392,10 @@ template<typename Derived> class MatrixBase
JacobiSVD<PlainObject> jacobiSvd(unsigned int computationOptions = 0) const;
+ #ifdef EIGEN2_SUPPORT
+ SVD<PlainObject> svd() const;
+ #endif
+
/////////// Geometry module ///////////
template<typename OtherDerived>
diff --git a/Eigen/src/Core/SelfAdjointView.h b/Eigen/src/Core/SelfAdjointView.h
index 5d8468884..0e9872bf5 100644
--- a/Eigen/src/Core/SelfAdjointView.h
+++ b/Eigen/src/Core/SelfAdjointView.h
@@ -46,13 +46,14 @@ template<typename MatrixType, unsigned int UpLo>
struct traits<SelfAdjointView<MatrixType, UpLo> > : traits<MatrixType>
{
typedef typename nested<MatrixType>::type MatrixTypeNested;
- typedef typename remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
+ typedef typename remove_all<MatrixTypeNested>::type MatrixTypeNestedCleaned;
typedef MatrixType ExpressionType;
+ typedef typename MatrixType::PlainObject DenseMatrixType;
enum {
Mode = UpLo | SelfAdjoint,
- Flags = _MatrixTypeNested::Flags & (HereditaryBits)
+ Flags = MatrixTypeNestedCleaned::Flags & (HereditaryBits)
& (~(PacketAccessBit | DirectAccessBit | LinearAccessBit)), // FIXME these flags should be preserved
- CoeffReadCost = _MatrixTypeNested::CoeffReadCost
+ CoeffReadCost = MatrixTypeNestedCleaned::CoeffReadCost
};
};
}
@@ -68,6 +69,8 @@ template<typename MatrixType, unsigned int UpLo> class SelfAdjointView
public:
typedef TriangularBase<SelfAdjointView> Base;
+ typedef typename internal::traits<SelfAdjointView>::MatrixTypeNested MatrixTypeNested;
+ typedef typename internal::traits<SelfAdjointView>::MatrixTypeNestedCleaned MatrixTypeNestedCleaned;
/** \brief The type of coefficients in this matrix */
typedef typename internal::traits<SelfAdjointView>::Scalar Scalar;
@@ -106,10 +109,10 @@ template<typename MatrixType, unsigned int UpLo> class SelfAdjointView
}
/** \internal */
- const MatrixType& _expression() const { return m_matrix; }
+ const MatrixTypeNestedCleaned& _expression() const { return m_matrix; }
- const MatrixType& nestedExpression() const { return m_matrix; }
- MatrixType& nestedExpression() { return const_cast<MatrixType&>(m_matrix); }
+ const MatrixTypeNestedCleaned& nestedExpression() const { return m_matrix; }
+ MatrixTypeNestedCleaned& nestedExpression() { return *const_cast<MatrixTypeNestedCleaned*>(&m_matrix); }
/** Efficient self-adjoint matrix times vector/matrix product */
template<typename OtherDerived>
@@ -171,9 +174,32 @@ template<typename MatrixType, unsigned int UpLo> class SelfAdjointView
EigenvaluesReturnType eigenvalues() const;
RealScalar operatorNorm() const;
+
+ #ifdef EIGEN2_SUPPORT
+ template<typename OtherDerived>
+ SelfAdjointView& operator=(const MatrixBase<OtherDerived>& other)
+ {
+ enum {
+ OtherPart = UpLo == Upper ? StrictlyLower : StrictlyUpper
+ };
+ m_matrix.const_cast_derived().template triangularView<UpLo>() = other;
+ m_matrix.const_cast_derived().template triangularView<OtherPart>() = other.adjoint();
+ return *this;
+ }
+ template<typename OtherMatrixType, unsigned int OtherMode>
+ SelfAdjointView& operator=(const TriangularView<OtherMatrixType, OtherMode>& other)
+ {
+ enum {
+ OtherPart = UpLo == Upper ? StrictlyLower : StrictlyUpper
+ };
+ m_matrix.const_cast_derived().template triangularView<UpLo>() = other.toDenseMatrix();
+ m_matrix.const_cast_derived().template triangularView<OtherPart>() = other.toDenseMatrix().adjoint();
+ return *this;
+ }
+ #endif
protected:
- const typename MatrixType::Nested m_matrix;
+ const MatrixTypeNested m_matrix;
};
diff --git a/Eigen/src/Core/TriangularMatrix.h b/Eigen/src/Core/TriangularMatrix.h
index ce5b53631..40dd2e4bc 100644
--- a/Eigen/src/Core/TriangularMatrix.h
+++ b/Eigen/src/Core/TriangularMatrix.h
@@ -48,6 +48,7 @@ template<typename Derived> class TriangularBase : public EigenBase<Derived>
typedef typename internal::traits<Derived>::Scalar Scalar;
typedef typename internal::traits<Derived>::StorageKind StorageKind;
typedef typename internal::traits<Derived>::Index Index;
+ typedef typename internal::traits<Derived>::DenseMatrixType DenseMatrixType;
inline TriangularBase() { eigen_assert(!((Mode&UnitDiag) && (Mode&ZeroDiag))); }
@@ -88,6 +89,13 @@ template<typename Derived> class TriangularBase : public EigenBase<Derived>
template<typename DenseDerived>
void evalToLazy(MatrixBase<DenseDerived> &other) const;
+ DenseMatrixType toDenseMatrix() const
+ {
+ DenseMatrixType res(rows(), cols());
+ evalToLazy(res);
+ return res;
+ }
+
protected:
void check_coordinates(Index row, Index col) const
@@ -135,12 +143,14 @@ template<typename MatrixType, unsigned int _Mode>
struct traits<TriangularView<MatrixType, _Mode> > : traits<MatrixType>
{
typedef typename nested<MatrixType>::type MatrixTypeNested;
- typedef typename remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
+ typedef typename remove_reference<MatrixTypeNested>::type MatrixTypeNestedNonRef;
+ typedef typename remove_all<MatrixTypeNested>::type MatrixTypeNestedCleaned;
typedef MatrixType ExpressionType;
+ typedef typename MatrixType::PlainObject DenseMatrixType;
enum {
Mode = _Mode,
- Flags = (_MatrixTypeNested::Flags & (HereditaryBits) & (~(PacketAccessBit | DirectAccessBit | LinearAccessBit))) | Mode,
- CoeffReadCost = _MatrixTypeNested::CoeffReadCost
+ Flags = (MatrixTypeNestedCleaned::Flags & (HereditaryBits) & (~(PacketAccessBit | DirectAccessBit | LinearAccessBit))) | Mode,
+ CoeffReadCost = MatrixTypeNestedCleaned::CoeffReadCost
};
};
}
@@ -159,11 +169,13 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
typedef typename internal::traits<TriangularView>::Scalar Scalar;
typedef _MatrixType MatrixType;
- typedef typename MatrixType::PlainObject DenseMatrixType;
+ typedef typename internal::traits<TriangularView>::DenseMatrixType DenseMatrixType;
protected:
- typedef typename MatrixType::Nested MatrixTypeNested;
- typedef typename internal::remove_all<MatrixTypeNested>::type _MatrixTypeNested;
+ typedef typename internal::traits<TriangularView>::MatrixTypeNested MatrixTypeNested;
+ typedef typename internal::traits<TriangularView>::MatrixTypeNestedNonRef MatrixTypeNestedNonRef;
+ typedef typename internal::traits<TriangularView>::MatrixTypeNestedCleaned MatrixTypeNestedCleaned;
+
typedef typename internal::remove_all<typename MatrixType::ConjugateReturnType>::type MatrixConjugateReturnType;
public:
@@ -226,8 +238,8 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
return m_matrix.const_cast_derived().coeffRef(row, col);
}
- const MatrixType& nestedExpression() const { return m_matrix; }
- MatrixType& nestedExpression() { return const_cast<MatrixType&>(m_matrix); }
+ const MatrixTypeNestedCleaned& nestedExpression() const { return m_matrix; }
+ MatrixTypeNestedCleaned& nestedExpression() { return *const_cast<MatrixTypeNestedCleaned*>(&m_matrix); }
/** Assigns a triangular matrix to a triangular part of a dense matrix */
template<typename OtherDerived>
@@ -269,13 +281,6 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
inline const TriangularView<Transpose<MatrixType>,TransposeMode> transpose() const
{ return m_matrix.transpose(); }
- DenseMatrixType toDenseMatrix() const
- {
- DenseMatrixType res(rows(), cols());
- evalToLazy(res);
- return res;
- }
-
/** Efficient triangular matrix times vector/matrix product */
template<typename OtherDerived>
TriangularProduct<Mode,true,MatrixType,false,OtherDerived,OtherDerived::IsVectorAtCompileTime>
@@ -310,18 +315,18 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
const typename eigen2_product_return_type<OtherMatrixType>::type
operator*(const TriangularView<OtherMatrixType, Mode>& rhs) const
{
- return toDenseMatrix() * rhs.toDenseMatrix();
+ return this->toDenseMatrix() * rhs.toDenseMatrix();
}
template<typename OtherMatrixType>
bool isApprox(const TriangularView<OtherMatrixType, Mode>& other, typename NumTraits<Scalar>::Real precision = NumTraits<Scalar>::dummy_precision()) const
{
- return toDenseMatrix().isApprox(other.toDenseMatrix(), precision);
+ return this->toDenseMatrix().isApprox(other.toDenseMatrix(), precision);
}
template<typename OtherDerived>
bool isApprox(const MatrixBase<OtherDerived>& other, typename NumTraits<Scalar>::Real precision = NumTraits<Scalar>::dummy_precision()) const
{
- return toDenseMatrix().isApprox(other, precision);
+ return this->toDenseMatrix().isApprox(other, precision);
}
#endif // EIGEN2_SUPPORT
@@ -342,15 +347,15 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
void solveInPlace(const MatrixBase<OtherDerived>& other) const
{ return solveInPlace<OnTheLeft>(other); }
- const SelfAdjointView<_MatrixTypeNested,Mode> selfadjointView() const
+ const SelfAdjointView<MatrixTypeNestedNonRef,Mode> selfadjointView() const
{
EIGEN_STATIC_ASSERT((Mode&UnitDiag)==0,PROGRAMMING_ERROR);
- return SelfAdjointView<_MatrixTypeNested,Mode>(m_matrix);
+ return SelfAdjointView<MatrixTypeNestedNonRef,Mode>(m_matrix);
}
- SelfAdjointView<_MatrixTypeNested,Mode> selfadjointView()
+ SelfAdjointView<MatrixTypeNestedNonRef,Mode> selfadjointView()
{
EIGEN_STATIC_ASSERT((Mode&UnitDiag)==0,PROGRAMMING_ERROR);
- return SelfAdjointView<_MatrixTypeNested,Mode>(m_matrix);
+ return SelfAdjointView<MatrixTypeNestedNonRef,Mode>(m_matrix);
}
template<typename OtherDerived>
@@ -692,7 +697,7 @@ void TriangularBase<Derived>::evalToLazy(MatrixBase<DenseDerived> &other) const
eigen_assert(this->rows() == other.rows() && this->cols() == other.cols());
internal::triangular_assignment_selector
- <DenseDerived, typename internal::traits<Derived>::ExpressionType, Derived::Mode,
+ <DenseDerived, typename internal::traits<Derived>::MatrixTypeNestedCleaned, Derived::Mode,
unroll ? int(DenseDerived::SizeAtCompileTime) : Dynamic,
true // clear the opposite triangular part
>::run(other.derived(), derived().nestedExpression());
@@ -707,10 +712,27 @@ void TriangularBase<Derived>::evalToLazy(MatrixBase<DenseDerived> &other) const
***************************************************************************/
#ifdef EIGEN2_SUPPORT
+
+// implementation of part<>(), including the SelfAdjoint case.
+
+namespace internal {
+template<typename MatrixType, unsigned int Mode>
+struct eigen2_part_return_type
+{
+ typedef TriangularView<MatrixType, Mode> type;
+};
+
+template<typename MatrixType>
+struct eigen2_part_return_type<MatrixType, SelfAdjoint>
+{
+ typedef SelfAdjointView<MatrixType, Upper> type;
+};
+}
+
/** \deprecated use MatrixBase::triangularView() */
template<typename Derived>
template<unsigned int Mode>
-const TriangularView<Derived, Mode> MatrixBase<Derived>::part() const
+const typename internal::eigen2_part_return_type<Derived, Mode>::type MatrixBase<Derived>::part() const
{
return derived();
}
@@ -718,7 +740,7 @@ const TriangularView<Derived, Mode> MatrixBase<Derived>::part() const
/** \deprecated use MatrixBase::triangularView() */
template<typename Derived>
template<unsigned int Mode>
-TriangularView<Derived, Mode> MatrixBase<Derived>::part()
+typename internal::eigen2_part_return_type<Derived, Mode>::type MatrixBase<Derived>::part()
{
return derived();
}
diff --git a/Eigen/src/Core/Visitor.h b/Eigen/src/Core/Visitor.h
index 556c6fcd7..378ebcba1 100644
--- a/Eigen/src/Core/Visitor.h
+++ b/Eigen/src/Core/Visitor.h
@@ -183,8 +183,9 @@ struct functor_traits<max_coeff_visitor<Scalar> > {
* \sa DenseBase::minCoeff(Index*), DenseBase::maxCoeff(Index*,Index*), DenseBase::visitor(), DenseBase::minCoeff()
*/
template<typename Derived>
+template<typename IndexType>
typename internal::traits<Derived>::Scalar
-DenseBase<Derived>::minCoeff(Index* row, Index* col) const
+DenseBase<Derived>::minCoeff(IndexType* row, IndexType* col) const
{
internal::min_coeff_visitor<Derived> minVisitor;
this->visit(minVisitor);
@@ -196,11 +197,12 @@ DenseBase<Derived>::minCoeff(Index* row, Index* col) const
/** \returns the minimum of all coefficients of *this
* and puts in *index its location.
*
- * \sa DenseBase::minCoeff(Index*,Index*), DenseBase::maxCoeff(Index*,Index*), DenseBase::visitor(), DenseBase::minCoeff()
+ * \sa DenseBase::minCoeff(IndexType*,IndexType*), DenseBase::maxCoeff(IndexType*,IndexType*), DenseBase::visitor(), DenseBase::minCoeff()
*/
template<typename Derived>
+template<typename IndexType>
typename internal::traits<Derived>::Scalar
-DenseBase<Derived>::minCoeff(Index* index) const
+DenseBase<Derived>::minCoeff(IndexType* index) const
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
internal::min_coeff_visitor<Derived> minVisitor;
@@ -212,11 +214,12 @@ DenseBase<Derived>::minCoeff(Index* index) const
/** \returns the maximum of all coefficients of *this
* and puts in *row and *col its location.
*
- * \sa DenseBase::minCoeff(Index*,Index*), DenseBase::visitor(), DenseBase::maxCoeff()
+ * \sa DenseBase::minCoeff(IndexType*,IndexType*), DenseBase::visitor(), DenseBase::maxCoeff()
*/
template<typename Derived>
+template<typename IndexType>
typename internal::traits<Derived>::Scalar
-DenseBase<Derived>::maxCoeff(Index* row, Index* col) const
+DenseBase<Derived>::maxCoeff(IndexType* row, IndexType* col) const
{
internal::max_coeff_visitor<Derived> maxVisitor;
this->visit(maxVisitor);
@@ -228,11 +231,12 @@ DenseBase<Derived>::maxCoeff(Index* row, Index* col) const
/** \returns the maximum of all coefficients of *this
* and puts in *index its location.
*
- * \sa DenseBase::maxCoeff(Index*,Index*), DenseBase::minCoeff(Index*,Index*), DenseBase::visitor(), DenseBase::maxCoeff()
+ * \sa DenseBase::maxCoeff(IndexType*,IndexType*), DenseBase::minCoeff(IndexType*,IndexType*), DenseBase::visitor(), DenseBase::maxCoeff()
*/
template<typename Derived>
+template<typename IndexType>
typename internal::traits<Derived>::Scalar
-DenseBase<Derived>::maxCoeff(Index* index) const
+DenseBase<Derived>::maxCoeff(IndexType* index) const
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
internal::max_coeff_visitor<Derived> maxVisitor;
@@ -241,51 +245,4 @@ DenseBase<Derived>::maxCoeff(Index* index) const
return maxVisitor.res;
}
-#ifdef EIGEN2_SUPPORT
-
-template<typename Derived>
-typename internal::traits<Derived>::Scalar
-DenseBase<Derived>::minCoeff(int* row, int* col) const
-{
- Index r, c;
- Scalar result = this->minCoeff(&r, &c);
- *row = int(r);
- *col = int(c);
- return result;
-}
-
-template<typename Derived>
-typename internal::traits<Derived>::Scalar
-DenseBase<Derived>::minCoeff(int* index) const
-{
- Index i;
- Scalar result = this->minCoeff(&i);
- *index = int(i);
- return result;
-}
-
-template<typename Derived>
-typename internal::traits<Derived>::Scalar
-DenseBase<Derived>::maxCoeff(int* row, int* col) const
-{
- Index r, c;
- Scalar result = this->maxCoeff(&r, &c);
- *row = int(r);
- *col = int(c);
- return result;
-}
-
-template<typename Derived>
-typename internal::traits<Derived>::Scalar
-DenseBase<Derived>::maxCoeff(int* index) const
-{
- Index i;
- Scalar result = this->maxCoeff(&i);
- *index = int(i);
- return result;
-}
-
-#endif // EIGEN2_SUPPORT
-
-
#endif // EIGEN_VISITOR_H
diff --git a/Eigen/src/Core/util/ForwardDeclarations.h b/Eigen/src/Core/util/ForwardDeclarations.h
index d4eb2c31c..5a2de7095 100644
--- a/Eigen/src/Core/util/ForwardDeclarations.h
+++ b/Eigen/src/Core/util/ForwardDeclarations.h
@@ -270,6 +270,12 @@ struct stem_function
#ifdef EIGEN2_SUPPORT
template<typename ExpressionType> class Cwise;
template<typename MatrixType> class Minor;
+template<typename MatrixType> class LU;
+template<typename MatrixType> class QR;
+template<typename MatrixType> class SVD;
+namespace internal {
+template<typename MatrixType, unsigned int Mode> struct eigen2_part_return_type;
+}
#endif
#endif // EIGEN_FORWARDDECLARATIONS_H
diff --git a/Eigen/src/Eigen2Support/Geometry/Hyperplane.h b/Eigen/src/Eigen2Support/Geometry/Hyperplane.h
index a9a46e33f..420b30fe9 100644
--- a/Eigen/src/Eigen2Support/Geometry/Hyperplane.h
+++ b/Eigen/src/Eigen2Support/Geometry/Hyperplane.h
@@ -122,7 +122,7 @@ public:
~Hyperplane() {}
/** \returns the dimension in which the plane holds */
- inline int dim() const { return AmbientDimAtCompileTime==Dynamic ? m_coeffs.size()-1 : AmbientDimAtCompileTime; }
+ inline int dim() const { return int(AmbientDimAtCompileTime)==Dynamic ? m_coeffs.size()-1 : int(AmbientDimAtCompileTime); }
/** normalizes \c *this */
void normalize(void)
@@ -147,7 +147,7 @@ public:
/** \returns a constant reference to the unit normal vector of the plane, which corresponds
* to the linear part of the implicit equation.
*/
- inline const NormalReturnType normal() const { return NormalReturnType(m_coeffs,0,0,dim(),1); }
+ inline const NormalReturnType normal() const { return NormalReturnType(*const_cast<Coefficients*>(&m_coeffs),0,0,dim(),1); }
/** \returns a non-constant reference to the unit normal vector of the plane, which corresponds
* to the linear part of the implicit equation.
diff --git a/Eigen/src/Eigen2Support/LU.h b/Eigen/src/Eigen2Support/LU.h
new file mode 100644
index 000000000..c23c11baa
--- /dev/null
+++ b/Eigen/src/Eigen2Support/LU.h
@@ -0,0 +1,133 @@
+// 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/>.
+
+#ifndef EIGEN2_LU_H
+#define EIGEN2_LU_H
+
+template<typename MatrixType>
+class LU : public FullPivLU<MatrixType>
+{
+ public:
+
+ typedef typename MatrixType::Scalar Scalar;
+ typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;
+ typedef Matrix<int, 1, MatrixType::ColsAtCompileTime, MatrixType::Options, 1, MatrixType::MaxColsAtCompileTime> IntRowVectorType;
+ typedef Matrix<int, MatrixType::RowsAtCompileTime, 1, MatrixType::Options, MatrixType::MaxRowsAtCompileTime, 1> IntColVectorType;
+ typedef Matrix<Scalar, 1, MatrixType::ColsAtCompileTime, MatrixType::Options, 1, MatrixType::MaxColsAtCompileTime> RowVectorType;
+ typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1, MatrixType::Options, MatrixType::MaxRowsAtCompileTime, 1> ColVectorType;
+
+ typedef Matrix<typename MatrixType::Scalar,
+ MatrixType::ColsAtCompileTime, // the number of rows in the "kernel matrix" is the number of cols of the original matrix
+ // so that the product "matrix * kernel = zero" makes sense
+ Dynamic, // we don't know at compile-time the dimension of the kernel
+ MatrixType::Options,
+ MatrixType::MaxColsAtCompileTime, // see explanation for 2nd template parameter
+ MatrixType::MaxColsAtCompileTime // the kernel is a subspace of the domain space, whose dimension is the number
+ // of columns of the original matrix
+ > KernelResultType;
+
+ typedef Matrix<typename MatrixType::Scalar,
+ MatrixType::RowsAtCompileTime, // the image is a subspace of the destination space, whose dimension is the number
+ // of rows of the original matrix
+ Dynamic, // we don't know at compile time the dimension of the image (the rank)
+ MatrixType::Options,
+ MatrixType::MaxRowsAtCompileTime, // the image matrix will consist of columns from the original matrix,
+ MatrixType::MaxColsAtCompileTime // so it has the same number of rows and at most as many columns.
+ > ImageResultType;
+
+ typedef FullPivLU<MatrixType> Base;
+ LU() : Base() {}
+
+ template<typename T>
+ explicit LU(const T& t) : Base(t), m_originalMatrix(t) {}
+
+ template<typename OtherDerived, typename ResultType>
+ bool solve(const MatrixBase<OtherDerived>& b, ResultType *result) const
+ {
+ *result = static_cast<const Base*>(this)->solve(b);
+ return true;
+ }
+
+ template<typename ResultType>
+ inline void computeInverse(ResultType *result) const
+ {
+ solve(MatrixType::Identity(this->rows(), this->cols()), result);
+ }
+
+ template<typename KernelMatrixType>
+ void computeKernel(KernelMatrixType *result) const
+ {
+ *result = static_cast<const Base*>(this)->kernel();
+ }
+
+ template<typename ImageMatrixType>
+ void computeImage(ImageMatrixType *result) const
+ {
+ *result = static_cast<const Base*>(this)->image(m_originalMatrix);
+ }
+
+ const ImageResultType image() const
+ {
+ return static_cast<const Base*>(this)->image(m_originalMatrix);
+ }
+
+ const MatrixType& m_originalMatrix;
+};
+
+#if EIGEN2_SUPPORT_STAGE < STAGE20_RESOLVE_API_CONFLICTS
+/** \lu_module
+ *
+ * Synonym of partialPivLu().
+ *
+ * \return the partial-pivoting LU decomposition of \c *this.
+ *
+ * \sa class PartialPivLU
+ */
+template<typename Derived>
+inline const LU<typename MatrixBase<Derived>::PlainObject>
+MatrixBase<Derived>::lu() const
+{
+ return LU<PlainObject>(eval());
+}
+#endif
+
+#ifdef EIGEN2_SUPPORT
+/** \lu_module
+ *
+ * Synonym of partialPivLu().
+ *
+ * \return the partial-pivoting LU decomposition of \c *this.
+ *
+ * \sa class PartialPivLU
+ */
+template<typename Derived>
+inline const LU<typename MatrixBase<Derived>::PlainObject>
+MatrixBase<Derived>::eigen2_lu() const
+{
+ return LU<PlainObject>(eval());
+}
+#endif
+
+
+#endif // EIGEN2_LU_H
diff --git a/Eigen/src/Eigen2Support/QR.h b/Eigen/src/Eigen2Support/QR.h
new file mode 100644
index 000000000..64f5d5ccb
--- /dev/null
+++ b/Eigen/src/Eigen2Support/QR.h
@@ -0,0 +1,79 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
+// 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/>.
+
+#ifndef EIGEN2_QR_H
+#define EIGEN2_QR_H
+
+template<typename MatrixType>
+class QR : public HouseholderQR<MatrixType>
+{
+ public:
+
+ typedef HouseholderQR<MatrixType> Base;
+ typedef Block<const MatrixType, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime> MatrixRBlockType;
+
+ QR() : Base() {}
+
+ template<typename T>
+ explicit QR(const T& t) : Base(t) {}
+
+ template<typename OtherDerived, typename ResultType>
+ bool solve(const MatrixBase<OtherDerived>& b, ResultType *result) const
+ {
+ *result = static_cast<const Base*>(this)->solve(b);
+ return true;
+ }
+
+ MatrixType matrixQ(void) const {
+ MatrixType ret = MatrixType::Identity(this->rows(), this->cols());
+ ret = this->householderQ() * ret;
+ return ret;
+ }
+
+ bool isFullRank() const {
+ return true;
+ }
+
+ const TriangularView<MatrixRBlockType, UpperTriangular>
+ matrixR(void) const
+ {
+ int cols = this->cols();
+ return MatrixRBlockType(this->matrixQR(), 0, 0, cols, cols).template triangularView<UpperTriangular>();
+ }
+};
+
+/** \return the QR decomposition of \c *this.
+ *
+ * \sa class QR
+ */
+template<typename Derived>
+const QR<typename MatrixBase<Derived>::PlainObject>
+MatrixBase<Derived>::qr() const
+{
+ return QR<PlainObject>(eval());
+}
+
+
+#endif // EIGEN2_QR_H
diff --git a/Eigen/src/Eigen2Support/SVD.h b/Eigen/src/Eigen2Support/SVD.h
new file mode 100644
index 000000000..dfb43ac7c
--- /dev/null
+++ b/Eigen/src/Eigen2Support/SVD.h
@@ -0,0 +1,649 @@
+// 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>
+//
+// 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_SVD_H
+#define EIGEN_SVD_H
+
+/** \ingroup SVD_Module
+ * \nonstableyet
+ *
+ * \class SVD
+ *
+ * \brief Standard SVD decomposition of a matrix and associated features
+ *
+ * \param MatrixType the type of the matrix of which we are computing the SVD decomposition
+ *
+ * This class performs a standard SVD decomposition of a real matrix A of size \c M x \c N
+ * with \c M \>= \c N.
+ *
+ *
+ * \sa MatrixBase::SVD()
+ */
+template<typename MatrixType> class SVD
+{
+ private:
+ typedef typename MatrixType::Scalar Scalar;
+ typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;
+
+ enum {
+ PacketSize = internal::packet_traits<Scalar>::size,
+ AlignmentMask = int(PacketSize)-1,
+ MinSize = EIGEN_SIZE_MIN_PREFER_DYNAMIC(MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime)
+ };
+
+ typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> ColVector;
+ typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, 1> RowVector;
+
+ typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MinSize> MatrixUType;
+ typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime> MatrixVType;
+ typedef Matrix<Scalar, MinSize, 1> SingularValuesType;
+
+ public:
+
+ SVD() {} // a user who relied on compiler-generated default compiler reported problems with MSVC in 2.0.7
+
+ SVD(const MatrixType& matrix)
+ : m_matU(matrix.rows(), std::min(matrix.rows(), matrix.cols())),
+ m_matV(matrix.cols(),matrix.cols()),
+ m_sigma(std::min(matrix.rows(),matrix.cols()))
+ {
+ compute(matrix);
+ }
+
+ template<typename OtherDerived, typename ResultType>
+ bool solve(const MatrixBase<OtherDerived> &b, ResultType* result) const;
+
+ const MatrixUType& matrixU() const { return m_matU; }
+ const SingularValuesType& singularValues() const { return m_sigma; }
+ const MatrixVType& matrixV() const { return m_matV; }
+
+ void compute(const MatrixType& matrix);
+ SVD& sort();
+
+ template<typename UnitaryType, typename PositiveType>
+ void computeUnitaryPositive(UnitaryType *unitary, PositiveType *positive) const;
+ template<typename PositiveType, typename UnitaryType>
+ void computePositiveUnitary(PositiveType *positive, UnitaryType *unitary) const;
+ template<typename RotationType, typename ScalingType>
+ void computeRotationScaling(RotationType *unitary, ScalingType *positive) const;
+ template<typename ScalingType, typename RotationType>
+ void computeScalingRotation(ScalingType *positive, RotationType *unitary) const;
+
+ protected:
+ /** \internal */
+ MatrixUType m_matU;
+ /** \internal */
+ MatrixVType m_matV;
+ /** \internal */
+ SingularValuesType m_sigma;
+};
+
+/** Computes / recomputes the SVD decomposition A = U S V^* of \a matrix
+ *
+ * \note this code has been adapted from JAMA (public domain)
+ */
+template<typename MatrixType>
+void SVD<MatrixType>::compute(const MatrixType& matrix)
+{
+ const int m = matrix.rows();
+ const int n = matrix.cols();
+ const int nu = std::min(m,n);
+ ei_assert(m>=n && "In Eigen 2.0, SVD only works for MxN matrices with M>=N. Sorry!");
+ ei_assert(m>1 && "In Eigen 2.0, SVD doesn't work on 1x1 matrices");
+
+ m_matU.resize(m, nu);
+ m_matU.setZero();
+ m_sigma.resize(std::min(m,n));
+ m_matV.resize(n,n);
+
+ RowVector e(n);
+ ColVector work(m);
+ MatrixType matA(matrix);
+ const bool wantu = true;
+ const bool wantv = true;
+ int i=0, j=0, k=0;
+
+ // Reduce A to bidiagonal form, storing the diagonal elements
+ // in s and the super-diagonal elements in e.
+ int nct = std::min(m-1,n);
+ int nrt = std::max(0,std::min(n-2,m));
+ for (k = 0; k < std::max(nct,nrt); ++k)
+ {
+ if (k < nct)
+ {
+ // Compute the transformation for the k-th column and
+ // place the k-th diagonal in m_sigma[k].
+ m_sigma[k] = matA.col(k).end(m-k).norm();
+ if (m_sigma[k] != 0.0) // FIXME
+ {
+ if (matA(k,k) < 0.0)
+ m_sigma[k] = -m_sigma[k];
+ matA.col(k).end(m-k) /= m_sigma[k];
+ matA(k,k) += 1.0;
+ }
+ m_sigma[k] = -m_sigma[k];
+ }
+
+ for (j = k+1; j < n; ++j)
+ {
+ if ((k < nct) && (m_sigma[k] != 0.0))
+ {
+ // Apply the transformation.
+ Scalar t = matA.col(k).end(m-k).dot(matA.col(j).end(m-k)); // FIXME dot product or cwise prod + .sum() ??
+ t = -t/matA(k,k);
+ matA.col(j).end(m-k) += t * matA.col(k).end(m-k);
+ }
+
+ // Place the k-th row of A into e for the
+ // subsequent calculation of the row transformation.
+ e[j] = matA(k,j);
+ }
+
+ // Place the transformation in U for subsequent back multiplication.
+ if (wantu & (k < nct))
+ m_matU.col(k).end(m-k) = matA.col(k).end(m-k);
+
+ if (k < nrt)
+ {
+ // Compute the k-th row transformation and place the
+ // k-th super-diagonal in e[k].
+ e[k] = e.end(n-k-1).norm();
+ if (e[k] != 0.0)
+ {
+ if (e[k+1] < 0.0)
+ e[k] = -e[k];
+ e.end(n-k-1) /= e[k];
+ e[k+1] += 1.0;
+ }
+ e[k] = -e[k];
+ if ((k+1 < m) & (e[k] != 0.0))
+ {
+ // Apply the transformation.
+ work.end(m-k-1) = matA.corner(BottomRight,m-k-1,n-k-1) * e.end(n-k-1);
+ for (j = k+1; j < n; ++j)
+ matA.col(j).end(m-k-1) += (-e[j]/e[k+1]) * work.end(m-k-1);
+ }
+
+ // Place the transformation in V for subsequent back multiplication.
+ if (wantv)
+ m_matV.col(k).end(n-k-1) = e.end(n-k-1);
+ }
+ }
+
+
+ // Set up the final bidiagonal matrix or order p.
+ int p = std::min(n,m+1);
+ if (nct < n)
+ m_sigma[nct] = matA(nct,nct);
+ if (m < p)
+ m_sigma[p-1] = 0.0;
+ if (nrt+1 < p)
+ e[nrt] = matA(nrt,p-1);
+ e[p-1] = 0.0;
+
+ // If required, generate U.
+ if (wantu)
+ {
+ for (j = nct; j < nu; ++j)
+ {
+ m_matU.col(j).setZero();
+ m_matU(j,j) = 1.0;
+ }
+ for (k = nct-1; k >= 0; k--)
+ {
+ if (m_sigma[k] != 0.0)
+ {
+ for (j = k+1; j < nu; ++j)
+ {
+ Scalar t = m_matU.col(k).end(m-k).dot(m_matU.col(j).end(m-k)); // FIXME is it really a dot product we want ?
+ t = -t/m_matU(k,k);
+ m_matU.col(j).end(m-k) += t * m_matU.col(k).end(m-k);
+ }
+ m_matU.col(k).end(m-k) = - m_matU.col(k).end(m-k);
+ m_matU(k,k) = Scalar(1) + m_matU(k,k);
+ if (k-1>0)
+ m_matU.col(k).start(k-1).setZero();
+ }
+ else
+ {
+ m_matU.col(k).setZero();
+ m_matU(k,k) = 1.0;
+ }
+ }
+ }
+
+ // If required, generate V.
+ if (wantv)
+ {
+ for (k = n-1; k >= 0; k--)
+ {
+ if ((k < nrt) & (e[k] != 0.0))
+ {
+ for (j = k+1; j < nu; ++j)
+ {
+ Scalar t = m_matV.col(k).end(n-k-1).dot(m_matV.col(j).end(n-k-1)); // FIXME is it really a dot product we want ?
+ t = -t/m_matV(k+1,k);
+ m_matV.col(j).end(n-k-1) += t * m_matV.col(k).end(n-k-1);
+ }
+ }
+ m_matV.col(k).setZero();
+ m_matV(k,k) = 1.0;
+ }
+ }
+
+ // Main iteration loop for the singular values.
+ int pp = p-1;
+ int iter = 0;
+ Scalar eps = ei_pow(Scalar(2),ei_is_same_type<Scalar,float>::ret ? Scalar(-23) : Scalar(-52));
+ while (p > 0)
+ {
+ int k=0;
+ int kase=0;
+
+ // Here is where a test for too many iterations would go.
+
+ // This section of the program inspects for
+ // negligible elements in the s and e arrays. On
+ // completion the variables kase and k are set as follows.
+
+ // kase = 1 if s(p) and e[k-1] are negligible and k<p
+ // kase = 2 if s(k) is negligible and k<p
+ // kase = 3 if e[k-1] is negligible, k<p, and
+ // s(k), ..., s(p) are not negligible (qr step).
+ // kase = 4 if e(p-1) is negligible (convergence).
+
+ for (k = p-2; k >= -1; --k)
+ {
+ if (k == -1)
+ break;
+ if (ei_abs(e[k]) <= eps*(ei_abs(m_sigma[k]) + ei_abs(m_sigma[k+1])))
+ {
+ e[k] = 0.0;
+ break;
+ }
+ }
+ if (k == p-2)
+ {
+ kase = 4;
+ }
+ else
+ {
+ int ks;
+ for (ks = p-1; ks >= k; --ks)
+ {
+ if (ks == k)
+ break;
+ Scalar t = (ks != p ? ei_abs(e[ks]) : Scalar(0)) + (ks != k+1 ? ei_abs(e[ks-1]) : Scalar(0));
+ if (ei_abs(m_sigma[ks]) <= eps*t)
+ {
+ m_sigma[ks] = 0.0;
+ break;
+ }
+ }
+ if (ks == k)
+ {
+ kase = 3;
+ }
+ else if (ks == p-1)
+ {
+ kase = 1;
+ }
+ else
+ {
+ kase = 2;
+ k = ks;
+ }
+ }
+ ++k;
+
+ // Perform the task indicated by kase.
+ switch (kase)
+ {
+
+ // Deflate negligible s(p).
+ case 1:
+ {
+ Scalar f(e[p-2]);
+ e[p-2] = 0.0;
+ for (j = p-2; j >= k; --j)
+ {
+ Scalar t(internal::hypot(m_sigma[j],f));
+ Scalar cs(m_sigma[j]/t);
+ Scalar sn(f/t);
+ m_sigma[j] = t;
+ if (j != k)
+ {
+ f = -sn*e[j-1];
+ e[j-1] = cs*e[j-1];
+ }
+ if (wantv)
+ {
+ for (i = 0; i < n; ++i)
+ {
+ t = cs*m_matV(i,j) + sn*m_matV(i,p-1);
+ m_matV(i,p-1) = -sn*m_matV(i,j) + cs*m_matV(i,p-1);
+ m_matV(i,j) = t;
+ }
+ }
+ }
+ }
+ break;
+
+ // Split at negligible s(k).
+ case 2:
+ {
+ Scalar f(e[k-1]);
+ e[k-1] = 0.0;
+ for (j = k; j < p; ++j)
+ {
+ Scalar t(internal::hypot(m_sigma[j],f));
+ Scalar cs( m_sigma[j]/t);
+ Scalar sn(f/t);
+ m_sigma[j] = t;
+ f = -sn*e[j];
+ e[j] = cs*e[j];
+ if (wantu)
+ {
+ for (i = 0; i < m; ++i)
+ {
+ t = cs*m_matU(i,j) + sn*m_matU(i,k-1);
+ m_matU(i,k-1) = -sn*m_matU(i,j) + cs*m_matU(i,k-1);
+ m_matU(i,j) = t;
+ }
+ }
+ }
+ }
+ break;
+
+ // Perform one qr step.
+ case 3:
+ {
+ // Calculate the shift.
+ Scalar scale = std::max(std::max(std::max(std::max(
+ ei_abs(m_sigma[p-1]),ei_abs(m_sigma[p-2])),ei_abs(e[p-2])),
+ ei_abs(m_sigma[k])),ei_abs(e[k]));
+ Scalar sp = m_sigma[p-1]/scale;
+ Scalar spm1 = m_sigma[p-2]/scale;
+ Scalar epm1 = e[p-2]/scale;
+ Scalar sk = m_sigma[k]/scale;
+ Scalar ek = e[k]/scale;
+ Scalar b = ((spm1 + sp)*(spm1 - sp) + epm1*epm1)/Scalar(2);
+ Scalar c = (sp*epm1)*(sp*epm1);
+ Scalar shift = 0.0;
+ if ((b != 0.0) || (c != 0.0))
+ {
+ shift = ei_sqrt(b*b + c);
+ if (b < 0.0)
+ shift = -shift;
+ shift = c/(b + shift);
+ }
+ Scalar f = (sk + sp)*(sk - sp) + shift;
+ Scalar g = sk*ek;
+
+ // Chase zeros.
+
+ for (j = k; j < p-1; ++j)
+ {
+ Scalar t = internal::hypot(f,g);
+ Scalar cs = f/t;
+ Scalar sn = g/t;
+ if (j != k)
+ e[j-1] = t;
+ f = cs*m_sigma[j] + sn*e[j];
+ e[j] = cs*e[j] - sn*m_sigma[j];
+ g = sn*m_sigma[j+1];
+ m_sigma[j+1] = cs*m_sigma[j+1];
+ if (wantv)
+ {
+ for (i = 0; i < n; ++i)
+ {
+ t = cs*m_matV(i,j) + sn*m_matV(i,j+1);
+ m_matV(i,j+1) = -sn*m_matV(i,j) + cs*m_matV(i,j+1);
+ m_matV(i,j) = t;
+ }
+ }
+ t = internal::hypot(f,g);
+ cs = f/t;
+ sn = g/t;
+ m_sigma[j] = t;
+ f = cs*e[j] + sn*m_sigma[j+1];
+ m_sigma[j+1] = -sn*e[j] + cs*m_sigma[j+1];
+ g = sn*e[j+1];
+ e[j+1] = cs*e[j+1];
+ if (wantu && (j < m-1))
+ {
+ for (i = 0; i < m; ++i)
+ {
+ t = cs*m_matU(i,j) + sn*m_matU(i,j+1);
+ m_matU(i,j+1) = -sn*m_matU(i,j) + cs*m_matU(i,j+1);
+ m_matU(i,j) = t;
+ }
+ }
+ }
+ e[p-2] = f;
+ iter = iter + 1;
+ }
+ break;
+
+ // Convergence.
+ case 4:
+ {
+ // Make the singular values positive.
+ if (m_sigma[k] <= 0.0)
+ {
+ m_sigma[k] = m_sigma[k] < Scalar(0) ? -m_sigma[k] : Scalar(0);
+ if (wantv)
+ m_matV.col(k).start(pp+1) = -m_matV.col(k).start(pp+1);
+ }
+
+ // Order the singular values.
+ while (k < pp)
+ {
+ if (m_sigma[k] >= m_sigma[k+1])
+ break;
+ Scalar t = m_sigma[k];
+ m_sigma[k] = m_sigma[k+1];
+ m_sigma[k+1] = t;
+ if (wantv && (k < n-1))
+ m_matV.col(k).swap(m_matV.col(k+1));
+ if (wantu && (k < m-1))
+ m_matU.col(k).swap(m_matU.col(k+1));
+ ++k;
+ }
+ iter = 0;
+ p--;
+ }
+ break;
+ } // end big switch
+ } // end iterations
+}
+
+template<typename MatrixType>
+SVD<MatrixType>& SVD<MatrixType>::sort()
+{
+ int mu = m_matU.rows();
+ int mv = m_matV.rows();
+ int n = m_matU.cols();
+
+ for (int i=0; i<n; ++i)
+ {
+ int k = i;
+ Scalar p = m_sigma.coeff(i);
+
+ for (int j=i+1; j<n; ++j)
+ {
+ if (m_sigma.coeff(j) > p)
+ {
+ k = j;
+ p = m_sigma.coeff(j);
+ }
+ }
+ if (k != i)
+ {
+ m_sigma.coeffRef(k) = m_sigma.coeff(i); // i.e.
+ m_sigma.coeffRef(i) = p; // swaps the i-th and the k-th elements
+
+ int j = mu;
+ for(int s=0; j!=0; ++s, --j)
+ std::swap(m_matU.coeffRef(s,i), m_matU.coeffRef(s,k));
+
+ j = mv;
+ for (int s=0; j!=0; ++s, --j)
+ std::swap(m_matV.coeffRef(s,i), m_matV.coeffRef(s,k));
+ }
+ }
+ return *this;
+}
+
+/** \returns the solution of \f$ A x = b \f$ using the current SVD decomposition of A.
+ * The parts of the solution corresponding to zero singular values are ignored.
+ *
+ * \sa MatrixBase::svd(), LU::solve(), LLT::solve()
+ */
+template<typename MatrixType>
+template<typename OtherDerived, typename ResultType>
+bool SVD<MatrixType>::solve(const MatrixBase<OtherDerived> &b, ResultType* result) const
+{
+ const int rows = m_matU.rows();
+ ei_assert(b.rows() == rows);
+
+ Scalar maxVal = m_sigma.cwise().abs().maxCoeff();
+ for (int j=0; j<b.cols(); ++j)
+ {
+ Matrix<Scalar,MatrixUType::RowsAtCompileTime,1> aux = m_matU.transpose() * b.col(j);
+
+ for (int i = 0; i <m_matU.cols(); ++i)
+ {
+ Scalar si = m_sigma.coeff(i);
+ if (ei_isMuchSmallerThan(ei_abs(si),maxVal))
+ aux.coeffRef(i) = 0;
+ else
+ aux.coeffRef(i) /= si;
+ }
+
+ result->col(j) = m_matV * aux;
+ }
+ return true;
+}
+
+/** Computes the polar decomposition of the matrix, as a product unitary x positive.
+ *
+ * If either pointer is zero, the corresponding computation is skipped.
+ *
+ * Only for square matrices.
+ *
+ * \sa computePositiveUnitary(), computeRotationScaling()
+ */
+template<typename MatrixType>
+template<typename UnitaryType, typename PositiveType>
+void SVD<MatrixType>::computeUnitaryPositive(UnitaryType *unitary,
+ PositiveType *positive) const
+{
+ ei_assert(m_matU.cols() == m_matV.cols() && "Polar decomposition is only for square matrices");
+ if(unitary) *unitary = m_matU * m_matV.adjoint();
+ if(positive) *positive = m_matV * m_sigma.asDiagonal() * m_matV.adjoint();
+}
+
+/** Computes the polar decomposition of the matrix, as a product positive x unitary.
+ *
+ * If either pointer is zero, the corresponding computation is skipped.
+ *
+ * Only for square matrices.
+ *
+ * \sa computeUnitaryPositive(), computeRotationScaling()
+ */
+template<typename MatrixType>
+template<typename UnitaryType, typename PositiveType>
+void SVD<MatrixType>::computePositiveUnitary(UnitaryType *positive,
+ PositiveType *unitary) const
+{
+ ei_assert(m_matU.rows() == m_matV.rows() && "Polar decomposition is only for square matrices");
+ if(unitary) *unitary = m_matU * m_matV.adjoint();
+ if(positive) *positive = m_matU * m_sigma.asDiagonal() * m_matU.adjoint();
+}
+
+/** decomposes the matrix as a product rotation x scaling, the scaling being
+ * not necessarily positive.
+ *
+ * If either pointer is zero, the corresponding computation is skipped.
+ *
+ * This method requires the Geometry module.
+ *
+ * \sa computeScalingRotation(), computeUnitaryPositive()
+ */
+template<typename MatrixType>
+template<typename RotationType, typename ScalingType>
+void SVD<MatrixType>::computeRotationScaling(RotationType *rotation, ScalingType *scaling) const
+{
+ ei_assert(m_matU.rows() == m_matV.rows() && "Polar decomposition is only for square matrices");
+ Scalar x = (m_matU * m_matV.adjoint()).determinant(); // so x has absolute value 1
+ Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> sv(m_sigma);
+ sv.coeffRef(0) *= x;
+ if(scaling) scaling->lazyAssign(m_matV * sv.asDiagonal() * m_matV.adjoint());
+ if(rotation)
+ {
+ MatrixType m(m_matU);
+ m.col(0) /= x;
+ rotation->lazyAssign(m * m_matV.adjoint());
+ }
+}
+
+/** decomposes the matrix as a product scaling x rotation, the scaling being
+ * not necessarily positive.
+ *
+ * If either pointer is zero, the corresponding computation is skipped.
+ *
+ * This method requires the Geometry module.
+ *
+ * \sa computeRotationScaling(), computeUnitaryPositive()
+ */
+template<typename MatrixType>
+template<typename ScalingType, typename RotationType>
+void SVD<MatrixType>::computeScalingRotation(ScalingType *scaling, RotationType *rotation) const
+{
+ ei_assert(m_matU.rows() == m_matV.rows() && "Polar decomposition is only for square matrices");
+ Scalar x = (m_matU * m_matV.adjoint()).determinant(); // so x has absolute value 1
+ Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> sv(m_sigma);
+ sv.coeffRef(0) *= x;
+ if(scaling) scaling->lazyAssign(m_matU * sv.asDiagonal() * m_matU.adjoint());
+ if(rotation)
+ {
+ MatrixType m(m_matU);
+ m.col(0) /= x;
+ rotation->lazyAssign(m * m_matV.adjoint());
+ }
+}
+
+
+/** \svd_module
+ * \returns the SVD decomposition of \c *this
+ */
+template<typename Derived>
+inline SVD<typename MatrixBase<Derived>::PlainObject>
+MatrixBase<Derived>::svd() const
+{
+ return SVD<PlainObject>(derived());
+}
+
+#endif // EIGEN_SVD_H
diff --git a/Eigen/src/LU/PartialPivLU.h b/Eigen/src/LU/PartialPivLU.h
index f9e645ec1..2533a3874 100644
--- a/Eigen/src/LU/PartialPivLU.h
+++ b/Eigen/src/LU/PartialPivLU.h
@@ -489,6 +489,7 @@ MatrixBase<Derived>::partialPivLu() const
return PartialPivLU<PlainObject>(eval());
}
+#if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS
/** \lu_module
*
* Synonym of partialPivLu().
@@ -503,5 +504,6 @@ MatrixBase<Derived>::lu() const
{
return PartialPivLU<PlainObject>(eval());
}
+#endif
#endif // EIGEN_PARTIALLU_H
diff --git a/Eigen/src/SVD/UpperBidiagonalization.h b/Eigen/src/SVD/UpperBidiagonalization.h
index eef92fcbe..2de197da9 100644
--- a/Eigen/src/SVD/UpperBidiagonalization.h
+++ b/Eigen/src/SVD/UpperBidiagonalization.h
@@ -49,7 +49,7 @@ template<typename _MatrixType> class UpperBidiagonalization
typedef Matrix<Scalar, ColsAtCompileTimeMinusOne, 1> SuperDiagVectorType;
typedef HouseholderSequence<
const MatrixType,
- CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, Diagonal<const MatrixType,0> >
+ CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, const Diagonal<const MatrixType,0> >
> HouseholderUSequenceType;
typedef HouseholderSequence<
const MatrixType,
diff --git a/Eigen/src/Sparse/SparseDiagonalProduct.h b/Eigen/src/Sparse/SparseDiagonalProduct.h
index 994bf163e..fb9a29c05 100644
--- a/Eigen/src/Sparse/SparseDiagonalProduct.h
+++ b/Eigen/src/Sparse/SparseDiagonalProduct.h
@@ -115,9 +115,9 @@ namespace internal {
template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
class sparse_diagonal_product_inner_iterator_selector
<Lhs,Rhs,SparseDiagonalProductType,SDP_IsDiagonal,SDP_IsSparseRowMajor>
- : public CwiseUnaryOp<scalar_multiple_op<typename Lhs::Scalar>,Rhs>::InnerIterator
+ : public CwiseUnaryOp<scalar_multiple_op<typename Lhs::Scalar>,const Rhs>::InnerIterator
{
- typedef typename CwiseUnaryOp<scalar_multiple_op<typename Lhs::Scalar>,Rhs>::InnerIterator Base;
+ typedef typename CwiseUnaryOp<scalar_multiple_op<typename Lhs::Scalar>,const Rhs>::InnerIterator Base;
typedef typename Lhs::Index Index;
public:
inline sparse_diagonal_product_inner_iterator_selector(
@@ -149,9 +149,9 @@ class sparse_diagonal_product_inner_iterator_selector
template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
class sparse_diagonal_product_inner_iterator_selector
<Lhs,Rhs,SparseDiagonalProductType,SDP_IsSparseColMajor,SDP_IsDiagonal>
- : public CwiseUnaryOp<scalar_multiple_op<typename Rhs::Scalar>,Lhs>::InnerIterator
+ : public CwiseUnaryOp<scalar_multiple_op<typename Rhs::Scalar>,const Lhs>::InnerIterator
{
- typedef typename CwiseUnaryOp<scalar_multiple_op<typename Rhs::Scalar>,Lhs>::InnerIterator Base;
+ typedef typename CwiseUnaryOp<scalar_multiple_op<typename Rhs::Scalar>,const Lhs>::InnerIterator Base;
typedef typename Lhs::Index Index;
public:
inline sparse_diagonal_product_inner_iterator_selector(
diff --git a/cmake/EigenTesting.cmake b/cmake/EigenTesting.cmake
index e25b5e9da..f3dabfe6f 100644
--- a/cmake/EigenTesting.cmake
+++ b/cmake/EigenTesting.cmake
@@ -12,7 +12,11 @@ macro(ei_add_test_internal testname testname_with_suffix)
set(filename ${testname}.cpp)
add_executable(${targetname} ${filename})
- add_dependencies(buildtests ${targetname})
+ if (targetname MATCHES "^eigen2_")
+ add_dependencies(eigen2_buildtests ${targetname})
+ else()
+ add_dependencies(buildtests ${targetname})
+ endif()
if(EIGEN_NO_ASSERTION_CHECKING)
ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_NO_ASSERTION_CHECKING=1")
diff --git a/test/eigen2/CMakeLists.txt b/test/eigen2/CMakeLists.txt
index 9b128396f..45b0bbd84 100644
--- a/test/eigen2/CMakeLists.txt
+++ b/test/eigen2/CMakeLists.txt
@@ -1,132 +1,58 @@
-add_custom_target(buildtests_eigen2)
-add_custom_target(check_eigen2 COMMAND "ctest")
-add_dependencies(check_eigen2 buildtests_eigen2)
+add_custom_target(eigen2_buildtests)
+add_custom_target(eigen2_check COMMAND "ctest -R eigen2")
+add_dependencies(eigen2_check eigen2_buildtests)
+add_dependencies(buildtests eigen2_buildtests)
add_definitions("-DEIGEN2_SUPPORT_STAGE10_FULL_EIGEN2_API")
-# Macro to add a test
-#
-# the unique parameter testname must correspond to a file
-# <testname>.cpp which follows this pattern:
-#
-# #include "main.h"
-# void test_<testname>() { ... }
-#
-# this macro add an executable test_<testname> as well as a ctest test
-# named <testname>
-#
-# On platforms with bash simply run:
-# "ctest -V" or "ctest -V -R <testname>"
-# On other platform use ctest as usual
-#
-macro(ei_add_test_eigen2 testname)
-
- set(targetname test_eigen2_${testname})
-
- set(filename ${testname}.cpp)
- add_executable(${targetname} ${filename})
- add_dependencies(buildtests_eigen2 ${targetname})
-
- if(NOT EIGEN_NO_ASSERTION_CHECKING)
-
- if(MSVC)
- set_target_properties(${targetname} PROPERTIES COMPILE_FLAGS "/EHsc")
- else(MSVC)
- set_target_properties(${targetname} PROPERTIES COMPILE_FLAGS "-fexceptions")
- endif(MSVC)
-
- option(EIGEN_DEBUG_ASSERTS "Enable debuging of assertions" OFF)
- if(EIGEN_DEBUG_ASSERTS)
- set_target_properties(${targetname} PROPERTIES COMPILE_DEFINITIONS "EIGEN_DEBUG_ASSERTS=1")
- endif(EIGEN_DEBUG_ASSERTS)
-
- endif(NOT EIGEN_NO_ASSERTION_CHECKING)
-
- if(${ARGC} GREATER 1)
- ei_add_target_property(${targetname} COMPILE_FLAGS "${ARGV1}")
- endif(${ARGC} GREATER 1)
-
- ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_TEST_FUNC=${testname}")
-
- if(TEST_LIB)
- target_link_libraries(${targetname} Eigen2)
- endif(TEST_LIB)
-
- if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
- target_link_libraries(${targetname} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
- endif()
-
- target_link_libraries(${targetname} ${EXTERNAL_LIBS})
- if(${ARGC} GREATER 2)
- string(STRIP "${ARGV2}" ARGV2_stripped)
- string(LENGTH "${ARGV2_stripped}" ARGV2_stripped_length)
- if(${ARGV2_stripped_length} GREATER 0)
- target_link_libraries(${targetname} ${ARGV2})
- endif(${ARGV2_stripped_length} GREATER 0)
- endif(${ARGC} GREATER 2)
-
- if(WIN32)
- add_test(${testname} "${targetname}")
- else(WIN32)
- add_test(${testname} "${CMAKE_CURRENT_SOURCE_DIR}/runtest.sh" "${testname}")
- endif(WIN32)
-
-endmacro(ei_add_test_eigen2)
-
-enable_testing()
-
-if(TEST_LIB)
- add_definitions("-DEIGEN_EXTERN_INSTANTIATIONS=1")
-endif(TEST_LIB)
-
-ei_add_test_eigen2(meta)
-ei_add_test_eigen2(sizeof)
-ei_add_test_eigen2(dynalloc)
-ei_add_test_eigen2(nomalloc)
-ei_add_test_eigen2(first_aligned)
-ei_add_test_eigen2(mixingtypes)
-ei_add_test_eigen2(packetmath)
-ei_add_test_eigen2(unalignedassert)
-#ei_add_test_eigen2(vectorization_logic)
-ei_add_test_eigen2(basicstuff)
-ei_add_test_eigen2(linearstructure)
-ei_add_test_eigen2(cwiseop)
-ei_add_test_eigen2(sum)
-ei_add_test_eigen2(product_small)
-ei_add_test_eigen2(product_large ${EI_OFLAG})
-ei_add_test_eigen2(adjoint)
-ei_add_test_eigen2(submatrices)
-ei_add_test_eigen2(miscmatrices)
-ei_add_test_eigen2(commainitializer)
-ei_add_test_eigen2(smallvectors)
-ei_add_test_eigen2(map)
-ei_add_test_eigen2(array)
-ei_add_test_eigen2(triangular)
-ei_add_test_eigen2(cholesky " " "${GSL_LIBRARIES}")
-ei_add_test_eigen2(lu ${EI_OFLAG})
-ei_add_test_eigen2(determinant ${EI_OFLAG})
-ei_add_test_eigen2(inverse)
-ei_add_test_eigen2(qr)
-ei_add_test_eigen2(eigensolver " " "${GSL_LIBRARIES}")
-ei_add_test_eigen2(svd)
-ei_add_test_eigen2(geometry)
-ei_add_test_eigen2(hyperplane)
-ei_add_test_eigen2(parametrizedline)
-ei_add_test_eigen2(alignedbox)
-ei_add_test_eigen2(regression)
-ei_add_test_eigen2(stdvector)
-ei_add_test_eigen2(newstdvector)
+ei_add_test(eigen2_meta)
+ei_add_test(eigen2_sizeof)
+ei_add_test(eigen2_dynalloc)
+ei_add_test(eigen2_nomalloc)
+#ei_add_test(eigen2_first_aligned)
+ei_add_test(eigen2_mixingtypes)
+ei_add_test(eigen2_packetmath)
+ei_add_test(eigen2_unalignedassert)
+#ei_add_test(eigen2_vectorization_logic)
+ei_add_test(eigen2_basicstuff)
+ei_add_test(eigen2_linearstructure)
+ei_add_test(eigen2_cwiseop)
+ei_add_test(eigen2_sum)
+ei_add_test(eigen2_product_small)
+ei_add_test(eigen2_product_large ${EI_OFLAG})
+ei_add_test(eigen2_adjoint)
+ei_add_test(eigen2_submatrices)
+ei_add_test(eigen2_miscmatrices)
+ei_add_test(eigen2_commainitializer)
+ei_add_test(eigen2_smallvectors)
+ei_add_test(eigen2_map)
+ei_add_test(eigen2_array)
+ei_add_test(eigen2_triangular)
+ei_add_test(eigen2_cholesky " " "${GSL_LIBRARIES}")
+ei_add_test(eigen2_lu ${EI_OFLAG})
+ei_add_test(eigen2_determinant ${EI_OFLAG})
+ei_add_test(eigen2_inverse)
+ei_add_test(eigen2_qr)
+ei_add_test(eigen2_eigensolver " " "${GSL_LIBRARIES}")
+ei_add_test(eigen2_svd)
+ei_add_test(eigen2_geometry)
+ei_add_test(eigen2_hyperplane)
+ei_add_test(eigen2_parametrizedline)
+ei_add_test(eigen2_alignedbox)
+ei_add_test(eigen2_regression)
+ei_add_test(eigen2_stdvector)
+ei_add_test(eigen2_newstdvector)
if(QT4_FOUND)
- ei_add_test_eigen2(qtvector " " "${QT_QTCORE_LIBRARY}")
+ ei_add_test(eigen2_qtvector " " "${QT_QTCORE_LIBRARY}")
endif(QT4_FOUND)
if(NOT EIGEN_DEFAULT_TO_ROW_MAJOR)
- ei_add_test_eigen2(sparse_vector)
- ei_add_test_eigen2(sparse_basic)
- ei_add_test_eigen2(sparse_solvers " " "${SPARSE_LIBS}")
- ei_add_test_eigen2(sparse_product)
+ ei_add_test(eigen2_sparse_vector)
+ ei_add_test(eigen2_sparse_basic)
+ ei_add_test(eigen2_sparse_solvers " " "${SPARSE_LIBS}")
+ ei_add_test(eigen2_sparse_product)
endif()
-ei_add_test_eigen2(swap)
-ei_add_test_eigen2(visitor)
-ei_add_test_eigen2(bug_132)
+ei_add_test(eigen2_swap)
+ei_add_test(eigen2_visitor)
+ei_add_test(eigen2_bug_132)
-ei_add_test_eigen2(prec_inverse_4x4 ${EI_OFLAG})
+ei_add_test(eigen2_prec_inverse_4x4 ${EI_OFLAG})
diff --git a/test/eigen2/adjoint.cpp b/test/eigen2/eigen2_adjoint.cpp
index f553bad02..c090b9650 100644
--- a/test/eigen2/adjoint.cpp
+++ b/test/eigen2/eigen2_adjoint.cpp
@@ -100,17 +100,17 @@ template<typename MatrixType> void adjoint(const MatrixType& m)
}
-void test_adjoint()
+void test_eigen2_adjoint()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( adjoint(Matrix<float, 1, 1>()) );
- CALL_SUBTEST( adjoint(Matrix3d()) );
- CALL_SUBTEST( adjoint(Matrix4f()) );
- CALL_SUBTEST( adjoint(MatrixXcf(4, 4)) );
- CALL_SUBTEST( adjoint(MatrixXi(8, 12)) );
- CALL_SUBTEST( adjoint(MatrixXf(21, 21)) );
+ CALL_SUBTEST_1( adjoint(Matrix<float, 1, 1>()) );
+ CALL_SUBTEST_2( adjoint(Matrix3d()) );
+ CALL_SUBTEST_3( adjoint(Matrix4f()) );
+ CALL_SUBTEST_4( adjoint(MatrixXcf(4, 4)) );
+ CALL_SUBTEST_5( adjoint(MatrixXi(8, 12)) );
+ CALL_SUBTEST_6( adjoint(MatrixXf(21, 21)) );
}
// test a large matrix only once
- CALL_SUBTEST( adjoint(Matrix<float, 100, 100>()) );
+ CALL_SUBTEST_7( adjoint(Matrix<float, 100, 100>()) );
}
diff --git a/test/eigen2/alignedbox.cpp b/test/eigen2/eigen2_alignedbox.cpp
index 53d61b62d..c24c11d03 100644
--- a/test/eigen2/alignedbox.cpp
+++ b/test/eigen2/eigen2_alignedbox.cpp
@@ -65,11 +65,11 @@ template<typename BoxType> void alignedbox(const BoxType& _box)
VERIFY_IS_APPROX(hp1d.template cast<Scalar>(),b0);
}
-void test_alignedbox()
+void test_eigen2_alignedbox()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( alignedbox(AlignedBox<float,2>()) );
- CALL_SUBTEST( alignedbox(AlignedBox<float,3>()) );
- CALL_SUBTEST( alignedbox(AlignedBox<double,4>()) );
+ CALL_SUBTEST_1( alignedbox(AlignedBox<float,2>()) );
+ CALL_SUBTEST_2( alignedbox(AlignedBox<float,3>()) );
+ CALL_SUBTEST_3( alignedbox(AlignedBox<double,4>()) );
}
}
diff --git a/test/eigen2/array.cpp b/test/eigen2/eigen2_array.cpp
index 2ea5ebd65..03977e446 100644
--- a/test/eigen2/array.cpp
+++ b/test/eigen2/eigen2_array.cpp
@@ -129,29 +129,29 @@ template<typename VectorType> void lpNorm(const VectorType& v)
VERIFY_IS_APPROX(ei_pow(u.template lpNorm<5>(), typename VectorType::RealScalar(5)), u.cwise().abs().cwise().pow(5).sum());
}
-void test_array()
+void test_eigen2_array()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( array(Matrix<float, 1, 1>()) );
- CALL_SUBTEST( array(Matrix2f()) );
- CALL_SUBTEST( array(Matrix4d()) );
- CALL_SUBTEST( array(MatrixXcf(3, 3)) );
- CALL_SUBTEST( array(MatrixXf(8, 12)) );
- CALL_SUBTEST( array(MatrixXi(8, 12)) );
+ CALL_SUBTEST_1( array(Matrix<float, 1, 1>()) );
+ CALL_SUBTEST_2( array(Matrix2f()) );
+ CALL_SUBTEST_3( array(Matrix4d()) );
+ CALL_SUBTEST_4( array(MatrixXcf(3, 3)) );
+ CALL_SUBTEST_5( array(MatrixXf(8, 12)) );
+ CALL_SUBTEST_6( array(MatrixXi(8, 12)) );
}
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( comparisons(Matrix<float, 1, 1>()) );
- CALL_SUBTEST( comparisons(Matrix2f()) );
- CALL_SUBTEST( comparisons(Matrix4d()) );
- CALL_SUBTEST( comparisons(MatrixXf(8, 12)) );
- CALL_SUBTEST( comparisons(MatrixXi(8, 12)) );
+ CALL_SUBTEST_1( comparisons(Matrix<float, 1, 1>()) );
+ CALL_SUBTEST_2( comparisons(Matrix2f()) );
+ CALL_SUBTEST_3( comparisons(Matrix4d()) );
+ CALL_SUBTEST_5( comparisons(MatrixXf(8, 12)) );
+ CALL_SUBTEST_6( comparisons(MatrixXi(8, 12)) );
}
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( lpNorm(Matrix<float, 1, 1>()) );
- CALL_SUBTEST( lpNorm(Vector2f()) );
- CALL_SUBTEST( lpNorm(Vector3d()) );
- CALL_SUBTEST( lpNorm(Vector4f()) );
- CALL_SUBTEST( lpNorm(VectorXf(16)) );
- CALL_SUBTEST( lpNorm(VectorXcd(10)) );
+ CALL_SUBTEST_1( lpNorm(Matrix<float, 1, 1>()) );
+ CALL_SUBTEST_2( lpNorm(Vector2f()) );
+ CALL_SUBTEST_3( lpNorm(Vector3d()) );
+ CALL_SUBTEST_4( lpNorm(Vector4f()) );
+ CALL_SUBTEST_5( lpNorm(VectorXf(16)) );
+ CALL_SUBTEST_7( lpNorm(VectorXcd(10)) );
}
}
diff --git a/test/eigen2/basicstuff.cpp b/test/eigen2/eigen2_basicstuff.cpp
index 21473cf8a..a09930fae 100644
--- a/test/eigen2/basicstuff.cpp
+++ b/test/eigen2/eigen2_basicstuff.cpp
@@ -109,15 +109,15 @@ template<typename MatrixType> void basicStuff(const MatrixType& m)
}
}
-void test_basicstuff()
+void test_eigen2_basicstuff()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( basicStuff(Matrix<float, 1, 1>()) );
- CALL_SUBTEST( basicStuff(Matrix4d()) );
- CALL_SUBTEST( basicStuff(MatrixXcf(3, 3)) );
- CALL_SUBTEST( basicStuff(MatrixXi(8, 12)) );
- CALL_SUBTEST( basicStuff(MatrixXcd(20, 20)) );
- CALL_SUBTEST( basicStuff(Matrix<float, 100, 100>()) );
- CALL_SUBTEST( basicStuff(Matrix<long double,Dynamic,Dynamic>(10,10)) );
+ CALL_SUBTEST_1( basicStuff(Matrix<float, 1, 1>()) );
+ CALL_SUBTEST_2( basicStuff(Matrix4d()) );
+ CALL_SUBTEST_3( basicStuff(MatrixXcf(3, 3)) );
+ CALL_SUBTEST_4( basicStuff(MatrixXi(8, 12)) );
+ CALL_SUBTEST_5( basicStuff(MatrixXcd(20, 20)) );
+ CALL_SUBTEST_6( basicStuff(Matrix<float, 100, 100>()) );
+ CALL_SUBTEST_7( basicStuff(Matrix<long double,Dynamic,Dynamic>(10,10)) );
}
}
diff --git a/test/eigen2/bug_132.cpp b/test/eigen2/eigen2_bug_132.cpp
index aa9bf2c28..7c33e394f 100644
--- a/test/eigen2/bug_132.cpp
+++ b/test/eigen2/eigen2_bug_132.cpp
@@ -24,8 +24,8 @@
#include "main.h"
-void test_bug_132() {
- enum { size = 100 };
+void test_eigen2_bug_132() {
+ int size = 100;
MatrixXd A(size, size);
VectorXd b(size), c(size);
{
diff --git a/test/eigen2/cholesky.cpp b/test/eigen2/eigen2_cholesky.cpp
index 108db9a21..d1a23dd05 100644
--- a/test/eigen2/cholesky.cpp
+++ b/test/eigen2/eigen2_cholesky.cpp
@@ -113,19 +113,21 @@ template<typename MatrixType> void cholesky(const MatrixType& m)
#endif
}
-void test_cholesky()
+void test_eigen2_cholesky()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( cholesky(Matrix<double,1,1>()) );
- CALL_SUBTEST( cholesky(Matrix2d()) );
- CALL_SUBTEST( cholesky(Matrix3f()) );
- CALL_SUBTEST( cholesky(Matrix4d()) );
- CALL_SUBTEST( cholesky(MatrixXcd(7,7)) );
- CALL_SUBTEST( cholesky(MatrixXf(17,17)) );
- CALL_SUBTEST( cholesky(MatrixXd(33,33)) );
+ CALL_SUBTEST_1( cholesky(Matrix<double,1,1>()) );
+ CALL_SUBTEST_2( cholesky(Matrix2d()) );
+ CALL_SUBTEST_3( cholesky(Matrix3f()) );
+ CALL_SUBTEST_4( cholesky(Matrix4d()) );
+ CALL_SUBTEST_5( cholesky(MatrixXcd(7,7)) );
+ CALL_SUBTEST_6( cholesky(MatrixXf(17,17)) );
+ CALL_SUBTEST_7( cholesky(MatrixXd(33,33)) );
}
+#ifdef EIGEN_TEST_PART_6
MatrixXf m = MatrixXf::Zero(10,10);
VectorXf b = VectorXf::Zero(10);
VERIFY(!m.llt().isPositiveDefinite());
+#endif
}
diff --git a/test/eigen2/commainitializer.cpp b/test/eigen2/eigen2_commainitializer.cpp
index 503dd9be4..294ca446a 100644
--- a/test/eigen2/commainitializer.cpp
+++ b/test/eigen2/eigen2_commainitializer.cpp
@@ -24,7 +24,7 @@
#include "main.h"
-void test_commainitializer()
+void test_eigen2_commainitializer()
{
Matrix3d m3;
Matrix4d m4;
diff --git a/test/eigen2/cwiseop.cpp b/test/eigen2/eigen2_cwiseop.cpp
index 25966db9a..cc647d372 100644
--- a/test/eigen2/cwiseop.cpp
+++ b/test/eigen2/eigen2_cwiseop.cpp
@@ -160,14 +160,14 @@ template<typename MatrixType> void cwiseops(const MatrixType& m)
VERIFY( !(m1.cwise()>m1.unaryExpr(bind2nd(plus<Scalar>(), Scalar(1)))).any() );
}
-void test_cwiseop()
+void test_eigen2_cwiseop()
{
for(int i = 0; i < g_repeat ; i++) {
- CALL_SUBTEST( cwiseops(Matrix<float, 1, 1>()) );
- CALL_SUBTEST( cwiseops(Matrix4d()) );
- CALL_SUBTEST( cwiseops(MatrixXf(3, 3)) );
- CALL_SUBTEST( cwiseops(MatrixXf(22, 22)) );
- CALL_SUBTEST( cwiseops(MatrixXi(8, 12)) );
- CALL_SUBTEST( cwiseops(MatrixXd(20, 20)) );
+ CALL_SUBTEST_1( cwiseops(Matrix<float, 1, 1>()) );
+ CALL_SUBTEST_2( cwiseops(Matrix4d()) );
+ CALL_SUBTEST_3( cwiseops(MatrixXf(3, 3)) );
+ CALL_SUBTEST_3( cwiseops(MatrixXf(22, 22)) );
+ CALL_SUBTEST_4( cwiseops(MatrixXi(8, 12)) );
+ CALL_SUBTEST_5( cwiseops(MatrixXd(20, 20)) );
}
}
diff --git a/test/eigen2/determinant.cpp b/test/eigen2/eigen2_determinant.cpp
index bc647d25d..5a01856bf 100644
--- a/test/eigen2/determinant.cpp
+++ b/test/eigen2/eigen2_determinant.cpp
@@ -62,15 +62,15 @@ template<typename MatrixType> void determinant(const MatrixType& m)
VERIFY_IS_APPROX(m2.determinant(), m1.determinant() * x);
}
-void test_determinant()
+void test_eigen2_determinant()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( determinant(Matrix<float, 1, 1>()) );
- CALL_SUBTEST( determinant(Matrix<double, 2, 2>()) );
- CALL_SUBTEST( determinant(Matrix<double, 3, 3>()) );
- CALL_SUBTEST( determinant(Matrix<double, 4, 4>()) );
- CALL_SUBTEST( determinant(Matrix<std::complex<double>, 10, 10>()) );
- CALL_SUBTEST( determinant(MatrixXd(20, 20)) );
+ CALL_SUBTEST_1( determinant(Matrix<float, 1, 1>()) );
+ CALL_SUBTEST_2( determinant(Matrix<double, 2, 2>()) );
+ CALL_SUBTEST_3( determinant(Matrix<double, 3, 3>()) );
+ CALL_SUBTEST_4( determinant(Matrix<double, 4, 4>()) );
+ CALL_SUBTEST_5( determinant(Matrix<std::complex<double>, 10, 10>()) );
+ CALL_SUBTEST_6( determinant(MatrixXd(20, 20)) );
}
- CALL_SUBTEST( determinant(MatrixXd(200, 200)) );
+ CALL_SUBTEST_6( determinant(MatrixXd(200, 200)) );
}
diff --git a/test/eigen2/dynalloc.cpp b/test/eigen2/eigen2_dynalloc.cpp
index b7951a680..1902b7c94 100644
--- a/test/eigen2/dynalloc.cpp
+++ b/test/eigen2/eigen2_dynalloc.cpp
@@ -102,7 +102,7 @@ template<typename T> void check_dynaligned()
delete obj;
}
-void test_dynalloc()
+void test_eigen2_dynalloc()
{
// low level dynamic memory allocation
CALL_SUBTEST(check_handmade_aligned_malloc());
diff --git a/test/eigen2/eigensolver.cpp b/test/eigen2/eigen2_eigensolver.cpp
index 34b8a22bc..17111d559 100644
--- a/test/eigen2/eigensolver.cpp
+++ b/test/eigen2/eigen2_eigensolver.cpp
@@ -145,18 +145,18 @@ template<typename MatrixType> void eigensolver(const MatrixType& m)
}
-void test_eigensolver()
+void test_eigen2_eigensolver()
{
for(int i = 0; i < g_repeat; i++) {
// very important to test a 3x3 matrix since we provide a special path for it
- CALL_SUBTEST( selfadjointeigensolver(Matrix3f()) );
- CALL_SUBTEST( selfadjointeigensolver(Matrix4d()) );
- CALL_SUBTEST( selfadjointeigensolver(MatrixXf(7,7)) );
- CALL_SUBTEST( selfadjointeigensolver(MatrixXcd(5,5)) );
- CALL_SUBTEST( selfadjointeigensolver(MatrixXd(19,19)) );
-
- CALL_SUBTEST( eigensolver(Matrix4f()) );
- CALL_SUBTEST( eigensolver(MatrixXd(17,17)) );
+ CALL_SUBTEST_1( selfadjointeigensolver(Matrix3f()) );
+ CALL_SUBTEST_2( selfadjointeigensolver(Matrix4d()) );
+ CALL_SUBTEST_3( selfadjointeigensolver(MatrixXf(7,7)) );
+ CALL_SUBTEST_4( selfadjointeigensolver(MatrixXcd(5,5)) );
+ CALL_SUBTEST_5( selfadjointeigensolver(MatrixXd(19,19)) );
+
+ CALL_SUBTEST_6( eigensolver(Matrix4f()) );
+ CALL_SUBTEST_5( eigensolver(MatrixXd(17,17)) );
}
}
diff --git a/test/eigen2/first_aligned.cpp b/test/eigen2/eigen2_first_aligned.cpp
index f630e42f9..f6a4a3ba2 100644
--- a/test/eigen2/first_aligned.cpp
+++ b/test/eigen2/eigen2_first_aligned.cpp
@@ -25,21 +25,21 @@
#include "main.h"
template<typename Scalar>
-void test_first_aligned_helper(Scalar *array, int size)
+void test_eigen2_first_aligned_helper(Scalar *array, int size)
{
const int packet_size = sizeof(Scalar) * ei_packet_traits<Scalar>::size;
VERIFY(((std::size_t(array) + sizeof(Scalar) * ei_alignmentOffset(array, size)) % packet_size) == 0);
}
template<typename Scalar>
-void test_none_aligned_helper(Scalar *array, int size)
+void test_eigen2_none_aligned_helper(Scalar *array, int size)
{
VERIFY(ei_packet_traits<Scalar>::size == 1 || ei_alignmentOffset(array, size) == size);
}
struct some_non_vectorizable_type { float x; };
-void test_first_aligned()
+void test_eigen2_first_aligned()
{
EIGEN_ALIGN_128 float array_float[100];
test_first_aligned_helper(array_float, 50);
diff --git a/test/eigen2/geometry.cpp b/test/eigen2/eigen2_geometry.cpp
index d0e69439b..cec413a9b 100644
--- a/test/eigen2/geometry.cpp
+++ b/test/eigen2/eigen2_geometry.cpp
@@ -437,10 +437,10 @@ template<typename Scalar> void geometry(void)
}
-void test_geometry()
+void test_eigen2_geometry()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( geometry<float>() );
- CALL_SUBTEST( geometry<double>() );
+ CALL_SUBTEST_1( geometry<float>() );
+ CALL_SUBTEST_2( geometry<double>() );
}
}
diff --git a/test/eigen2/hyperplane.cpp b/test/eigen2/eigen2_hyperplane.cpp
index f1a96a717..de6265ec0 100644
--- a/test/eigen2/hyperplane.cpp
+++ b/test/eigen2/eigen2_hyperplane.cpp
@@ -128,14 +128,14 @@ template<typename Scalar> void lines()
}
}
-void test_hyperplane()
+void test_eigen2_hyperplane()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( hyperplane(Hyperplane<float,2>()) );
- CALL_SUBTEST( hyperplane(Hyperplane<float,3>()) );
- CALL_SUBTEST( hyperplane(Hyperplane<double,4>()) );
- CALL_SUBTEST( hyperplane(Hyperplane<std::complex<double>,5>()) );
- CALL_SUBTEST( lines<float>() );
- CALL_SUBTEST( lines<double>() );
+ CALL_SUBTEST_1( hyperplane(Hyperplane<float,2>()) );
+ CALL_SUBTEST_2( hyperplane(Hyperplane<float,3>()) );
+ CALL_SUBTEST_3( hyperplane(Hyperplane<double,4>()) );
+ CALL_SUBTEST_4( hyperplane(Hyperplane<std::complex<double>,5>()) );
+ CALL_SUBTEST_5( lines<float>() );
+ CALL_SUBTEST_6( lines<double>() );
}
}
diff --git a/test/eigen2/inverse.cpp b/test/eigen2/eigen2_inverse.cpp
index 9ddc9bb65..aa8b1146a 100644
--- a/test/eigen2/inverse.cpp
+++ b/test/eigen2/eigen2_inverse.cpp
@@ -65,14 +65,14 @@ template<typename MatrixType> void inverse(const MatrixType& m)
VERIFY_IS_APPROX(m1.transpose().inverse(), m1.inverse().transpose());
}
-void test_inverse()
+void test_eigen2_inverse()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( inverse(Matrix<double,1,1>()) );
- CALL_SUBTEST( inverse(Matrix2d()) );
- CALL_SUBTEST( inverse(Matrix3f()) );
- CALL_SUBTEST( inverse(Matrix4f()) );
- CALL_SUBTEST( inverse(MatrixXf(8,8)) );
- CALL_SUBTEST( inverse(MatrixXcd(7,7)) );
+ CALL_SUBTEST_1( inverse(Matrix<double,1,1>()) );
+ CALL_SUBTEST_2( inverse(Matrix2d()) );
+ CALL_SUBTEST_3( inverse(Matrix3f()) );
+ CALL_SUBTEST_4( inverse(Matrix4f()) );
+ CALL_SUBTEST_5( inverse(MatrixXf(8,8)) );
+ CALL_SUBTEST_6( inverse(MatrixXcd(7,7)) );
}
}
diff --git a/test/eigen2/linearstructure.cpp b/test/eigen2/eigen2_linearstructure.cpp
index f913e6480..0e970df55 100644
--- a/test/eigen2/linearstructure.cpp
+++ b/test/eigen2/eigen2_linearstructure.cpp
@@ -84,16 +84,16 @@ template<typename MatrixType> void linearStructure(const MatrixType& m)
VERIFY_IS_APPROX(m1.block(0,0,rows,cols) * s1, m1 * s1);
}
-void test_linearstructure()
+void test_eigen2_linearstructure()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( linearStructure(Matrix<float, 1, 1>()) );
- CALL_SUBTEST( linearStructure(Matrix2f()) );
- CALL_SUBTEST( linearStructure(Vector3d()) );
- CALL_SUBTEST( linearStructure(Matrix4d()) );
- CALL_SUBTEST( linearStructure(MatrixXcf(3, 3)) );
- CALL_SUBTEST( linearStructure(MatrixXf(8, 12)) );
- CALL_SUBTEST( linearStructure(MatrixXi(8, 12)) );
- CALL_SUBTEST( linearStructure(MatrixXcd(20, 20)) );
+ CALL_SUBTEST_1( linearStructure(Matrix<float, 1, 1>()) );
+ CALL_SUBTEST_2( linearStructure(Matrix2f()) );
+ CALL_SUBTEST_3( linearStructure(Vector3d()) );
+ CALL_SUBTEST_4( linearStructure(Matrix4d()) );
+ CALL_SUBTEST_5( linearStructure(MatrixXcf(3, 3)) );
+ CALL_SUBTEST_6( linearStructure(MatrixXf(8, 12)) );
+ CALL_SUBTEST_7( linearStructure(MatrixXi(8, 12)) );
+ CALL_SUBTEST_8( linearStructure(MatrixXcd(20, 20)) );
}
}
diff --git a/test/eigen2/lu.cpp b/test/eigen2/eigen2_lu.cpp
index 51e94870c..fcb375186 100644
--- a/test/eigen2/lu.cpp
+++ b/test/eigen2/eigen2_lu.cpp
@@ -83,8 +83,10 @@ template<typename MatrixType> void lu_non_invertible()
m2 = MatrixType::Random(cols,cols2);
lu.solve(m3, &m2);
VERIFY_IS_APPROX(m3, m1*m2);
+ /* solve now always returns true
m3 = MatrixType::Random(rows,cols2);
VERIFY(!lu.solve(m3, &m2));
+ */
}
template<typename MatrixType> void lu_invertible()
@@ -120,22 +122,16 @@ template<typename MatrixType> void lu_invertible()
VERIFY(lu.solve(m3, &m2));
}
-void test_lu()
+void test_eigen2_lu()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( lu_non_invertible<MatrixXf>() );
- CALL_SUBTEST( lu_non_invertible<MatrixXd>() );
- CALL_SUBTEST( lu_non_invertible<MatrixXcf>() );
- CALL_SUBTEST( lu_non_invertible<MatrixXcd>() );
- CALL_SUBTEST( lu_invertible<MatrixXf>() );
- CALL_SUBTEST( lu_invertible<MatrixXd>() );
- CALL_SUBTEST( lu_invertible<MatrixXcf>() );
- CALL_SUBTEST( lu_invertible<MatrixXcd>() );
+ CALL_SUBTEST_1( lu_non_invertible<MatrixXf>() );
+ CALL_SUBTEST_2( lu_non_invertible<MatrixXd>() );
+ CALL_SUBTEST_3( lu_non_invertible<MatrixXcf>() );
+ CALL_SUBTEST_4( lu_non_invertible<MatrixXcd>() );
+ CALL_SUBTEST_1( lu_invertible<MatrixXf>() );
+ CALL_SUBTEST_2( lu_invertible<MatrixXd>() );
+ CALL_SUBTEST_3( lu_invertible<MatrixXcf>() );
+ CALL_SUBTEST_4( lu_invertible<MatrixXcd>() );
}
-
- MatrixXf m = MatrixXf::Zero(10,10);
- VectorXf b = VectorXf::Zero(10);
- VectorXf x = VectorXf::Random(10);
- VERIFY(m.lu().solve(b,&x));
- VERIFY(x.isZero());
}
diff --git a/test/eigen2/map.cpp b/test/eigen2/eigen2_map.cpp
index 3c51eec16..296902a8f 100644
--- a/test/eigen2/map.cpp
+++ b/test/eigen2/eigen2_map.cpp
@@ -105,25 +105,25 @@ template<typename VectorType> void map_static_methods(const VectorType& m)
}
-void test_map()
+void test_eigen2_map()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( map_class_vector(Matrix<float, 1, 1>()) );
- CALL_SUBTEST( map_class_vector(Vector4d()) );
- CALL_SUBTEST( map_class_vector(RowVector4f()) );
- CALL_SUBTEST( map_class_vector(VectorXcf(8)) );
- CALL_SUBTEST( map_class_vector(VectorXi(12)) );
+ CALL_SUBTEST_1( map_class_vector(Matrix<float, 1, 1>()) );
+ CALL_SUBTEST_2( map_class_vector(Vector4d()) );
+ CALL_SUBTEST_3( map_class_vector(RowVector4f()) );
+ CALL_SUBTEST_4( map_class_vector(VectorXcf(8)) );
+ CALL_SUBTEST_5( map_class_vector(VectorXi(12)) );
- CALL_SUBTEST( map_class_matrix(Matrix<float, 1, 1>()) );
- CALL_SUBTEST( map_class_matrix(Matrix4d()) );
- CALL_SUBTEST( map_class_matrix(Matrix<float,3,5>()) );
- CALL_SUBTEST( map_class_matrix(MatrixXcf(ei_random<int>(1,10),ei_random<int>(1,10))) );
- CALL_SUBTEST( map_class_matrix(MatrixXi(ei_random<int>(1,10),ei_random<int>(1,10))) );
+ CALL_SUBTEST_1( map_class_matrix(Matrix<float, 1, 1>()) );
+ CALL_SUBTEST_2( map_class_matrix(Matrix4d()) );
+ CALL_SUBTEST_6( map_class_matrix(Matrix<float,3,5>()) );
+ CALL_SUBTEST_4( map_class_matrix(MatrixXcf(ei_random<int>(1,10),ei_random<int>(1,10))) );
+ CALL_SUBTEST_5( map_class_matrix(MatrixXi(ei_random<int>(1,10),ei_random<int>(1,10))) );
- CALL_SUBTEST( map_static_methods(Matrix<double, 1, 1>()) );
- CALL_SUBTEST( map_static_methods(Vector3f()) );
- CALL_SUBTEST( map_static_methods(RowVector3d()) );
- CALL_SUBTEST( map_static_methods(VectorXcd(8)) );
- CALL_SUBTEST( map_static_methods(VectorXf(12)) );
+ CALL_SUBTEST_1( map_static_methods(Matrix<double, 1, 1>()) );
+ CALL_SUBTEST_2( map_static_methods(Vector3f()) );
+ CALL_SUBTEST_7( map_static_methods(RowVector3d()) );
+ CALL_SUBTEST_4( map_static_methods(VectorXcd(8)) );
+ CALL_SUBTEST_5( map_static_methods(VectorXf(12)) );
}
}
diff --git a/test/eigen2/meta.cpp b/test/eigen2/eigen2_meta.cpp
index e77e46ba4..4afbafcdf 100644
--- a/test/eigen2/meta.cpp
+++ b/test/eigen2/eigen2_meta.cpp
@@ -24,7 +24,7 @@
#include "main.h"
-void test_meta()
+void test_eigen2_meta()
{
typedef float & FloatRef;
typedef const float & ConstFloatRef;
diff --git a/test/eigen2/miscmatrices.cpp b/test/eigen2/eigen2_miscmatrices.cpp
index 4d2cd4346..95cfa3df9 100644
--- a/test/eigen2/miscmatrices.cpp
+++ b/test/eigen2/eigen2_miscmatrices.cpp
@@ -51,13 +51,13 @@ template<typename MatrixType> void miscMatrices(const MatrixType& m)
VERIFY_IS_APPROX(square, MatrixType::Identity(rows, rows));
}
-void test_miscmatrices()
+void test_eigen2_miscmatrices()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( miscMatrices(Matrix<float, 1, 1>()) );
- CALL_SUBTEST( miscMatrices(Matrix4d()) );
- CALL_SUBTEST( miscMatrices(MatrixXcf(3, 3)) );
- CALL_SUBTEST( miscMatrices(MatrixXi(8, 12)) );
- CALL_SUBTEST( miscMatrices(MatrixXcd(20, 20)) );
+ CALL_SUBTEST_1( miscMatrices(Matrix<float, 1, 1>()) );
+ CALL_SUBTEST_2( miscMatrices(Matrix4d()) );
+ CALL_SUBTEST_3( miscMatrices(MatrixXcf(3, 3)) );
+ CALL_SUBTEST_4( miscMatrices(MatrixXi(8, 12)) );
+ CALL_SUBTEST_5( miscMatrices(MatrixXcd(20, 20)) );
}
}
diff --git a/test/eigen2/mixingtypes.cpp b/test/eigen2/eigen2_mixingtypes.cpp
index ad03639a9..3721a0047 100644
--- a/test/eigen2/mixingtypes.cpp
+++ b/test/eigen2/eigen2_mixingtypes.cpp
@@ -79,10 +79,10 @@ template<int SizeAtCompileType> void mixingtypes(int size = SizeAtCompileType)
VERIFY_RAISES_ASSERT(vcf.dot(vf)); // yeah eventually we should allow this but i'm too lazy to make that change now in Dot.h
} // especially as that might be rewritten as cwise product .sum() which would make that automatic.
-void test_mixingtypes()
+void test_eigen2_mixingtypes()
{
// check that our operator new is indeed called:
- CALL_SUBTEST(mixingtypes<3>());
- CALL_SUBTEST(mixingtypes<4>());
- CALL_SUBTEST(mixingtypes<Dynamic>(20));
+ CALL_SUBTEST_1(mixingtypes<3>());
+ CALL_SUBTEST_2(mixingtypes<4>());
+ CALL_SUBTEST_3(mixingtypes<Dynamic>(20));
}
diff --git a/test/eigen2/newstdvector.cpp b/test/eigen2/eigen2_newstdvector.cpp
index 5862ee27b..c107f4f8d 100644
--- a/test/eigen2/newstdvector.cpp
+++ b/test/eigen2/eigen2_newstdvector.cpp
@@ -133,32 +133,32 @@ void check_stdvector_quaternion(const QuaternionType&)
}
}
-void test_newstdvector()
+void test_eigen2_newstdvector()
{
// some non vectorizable fixed sizes
- CALL_SUBTEST(check_stdvector_matrix(Vector2f()));
- CALL_SUBTEST(check_stdvector_matrix(Matrix3f()));
- CALL_SUBTEST(check_stdvector_matrix(Matrix3d()));
+ CALL_SUBTEST_1(check_stdvector_matrix(Vector2f()));
+ CALL_SUBTEST_1(check_stdvector_matrix(Matrix3f()));
+ CALL_SUBTEST_1(check_stdvector_matrix(Matrix3d()));
// some vectorizable fixed sizes
- CALL_SUBTEST(check_stdvector_matrix(Matrix2f()));
- CALL_SUBTEST(check_stdvector_matrix(Vector4f()));
- CALL_SUBTEST(check_stdvector_matrix(Matrix4f()));
- CALL_SUBTEST(check_stdvector_matrix(Matrix4d()));
+ CALL_SUBTEST_2(check_stdvector_matrix(Matrix2f()));
+ CALL_SUBTEST_2(check_stdvector_matrix(Vector4f()));
+ CALL_SUBTEST_2(check_stdvector_matrix(Matrix4f()));
+ CALL_SUBTEST_2(check_stdvector_matrix(Matrix4d()));
// some dynamic sizes
- CALL_SUBTEST(check_stdvector_matrix(MatrixXd(1,1)));
- CALL_SUBTEST(check_stdvector_matrix(VectorXd(20)));
- CALL_SUBTEST(check_stdvector_matrix(RowVectorXf(20)));
- CALL_SUBTEST(check_stdvector_matrix(MatrixXcf(10,10)));
+ CALL_SUBTEST_3(check_stdvector_matrix(MatrixXd(1,1)));
+ CALL_SUBTEST_3(check_stdvector_matrix(VectorXd(20)));
+ CALL_SUBTEST_3(check_stdvector_matrix(RowVectorXf(20)));
+ CALL_SUBTEST_3(check_stdvector_matrix(MatrixXcf(10,10)));
// some Transform
- CALL_SUBTEST(check_stdvector_transform(Transform2f()));
- CALL_SUBTEST(check_stdvector_transform(Transform3f()));
- CALL_SUBTEST(check_stdvector_transform(Transform3d()));
+ CALL_SUBTEST_4(check_stdvector_transform(Transform2f()));
+ CALL_SUBTEST_4(check_stdvector_transform(Transform3f()));
+ CALL_SUBTEST_4(check_stdvector_transform(Transform3d()));
//CALL_SUBTEST(check_stdvector_transform(Transform4d()));
// some Quaternion
- CALL_SUBTEST(check_stdvector_quaternion(Quaternionf()));
- CALL_SUBTEST(check_stdvector_quaternion(Quaterniond()));
+ CALL_SUBTEST_5(check_stdvector_quaternion(Quaternionf()));
+ CALL_SUBTEST_5(check_stdvector_quaternion(Quaterniond()));
}
diff --git a/test/eigen2/nomalloc.cpp b/test/eigen2/eigen2_nomalloc.cpp
index 5497ca339..7d28e4cca 100644
--- a/test/eigen2/nomalloc.cpp
+++ b/test/eigen2/eigen2_nomalloc.cpp
@@ -68,11 +68,11 @@ template<typename MatrixType> void nomalloc(const MatrixType& m)
VERIFY_IS_APPROX((m1*m1.transpose())*m2, m1*(m1.transpose()*m2));
}
-void test_nomalloc()
+void test_eigen2_nomalloc()
{
// check that our operator new is indeed called:
VERIFY_RAISES_ASSERT(MatrixXd dummy = MatrixXd::Random(3,3));
- CALL_SUBTEST( nomalloc(Matrix<float, 1, 1>()) );
- CALL_SUBTEST( nomalloc(Matrix4d()) );
- CALL_SUBTEST( nomalloc(Matrix<float,32,32>()) );
+ CALL_SUBTEST_1( nomalloc(Matrix<float, 1, 1>()) );
+ CALL_SUBTEST_2( nomalloc(Matrix4d()) );
+ CALL_SUBTEST_3( nomalloc(Matrix<float,32,32>()) );
}
diff --git a/test/eigen2/packetmath.cpp b/test/eigen2/eigen2_packetmath.cpp
index 6fec9259d..11384b1a8 100644
--- a/test/eigen2/packetmath.cpp
+++ b/test/eigen2/eigen2_packetmath.cpp
@@ -136,12 +136,12 @@ template<typename Scalar> void packetmath()
VERIFY(areApprox(ref, data2, PacketSize) && "ei_preduxp");
}
-void test_packetmath()
+void test_eigen2_packetmath()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( packetmath<float>() );
- CALL_SUBTEST( packetmath<double>() );
- CALL_SUBTEST( packetmath<int>() );
- CALL_SUBTEST( packetmath<std::complex<float> >() );
+ CALL_SUBTEST_1( packetmath<float>() );
+ CALL_SUBTEST_2( packetmath<double>() );
+ CALL_SUBTEST_3( packetmath<int>() );
+ CALL_SUBTEST_4( packetmath<std::complex<float> >() );
}
}
diff --git a/test/eigen2/parametrizedline.cpp b/test/eigen2/eigen2_parametrizedline.cpp
index 4444432a6..a301be815 100644
--- a/test/eigen2/parametrizedline.cpp
+++ b/test/eigen2/eigen2_parametrizedline.cpp
@@ -66,12 +66,12 @@ template<typename LineType> void parametrizedline(const LineType& _line)
VERIFY_IS_APPROX(hp1d.template cast<Scalar>(),l0);
}
-void test_parametrizedline()
+void test_eigen2_parametrizedline()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( parametrizedline(ParametrizedLine<float,2>()) );
- CALL_SUBTEST( parametrizedline(ParametrizedLine<float,3>()) );
- CALL_SUBTEST( parametrizedline(ParametrizedLine<double,4>()) );
- CALL_SUBTEST( parametrizedline(ParametrizedLine<std::complex<double>,5>()) );
+ CALL_SUBTEST_1( parametrizedline(ParametrizedLine<float,2>()) );
+ CALL_SUBTEST_2( parametrizedline(ParametrizedLine<float,3>()) );
+ CALL_SUBTEST_3( parametrizedline(ParametrizedLine<double,4>()) );
+ CALL_SUBTEST_4( parametrizedline(ParametrizedLine<std::complex<double>,5>()) );
}
}
diff --git a/test/eigen2/prec_inverse_4x4.cpp b/test/eigen2/eigen2_prec_inverse_4x4.cpp
index 762c8ea32..5117c8095 100644
--- a/test/eigen2/prec_inverse_4x4.cpp
+++ b/test/eigen2/eigen2_prec_inverse_4x4.cpp
@@ -86,14 +86,14 @@ template<typename MatrixType> void inverse_general_4x4(int repeat)
VERIFY(error_max < (NumTraits<Scalar>::IsComplex ? 64.0 : 20.0));
}
-void test_prec_inverse_4x4()
+void test_eigen2_prec_inverse_4x4()
{
- CALL_SUBTEST((inverse_permutation_4x4<Matrix4f>()));
- CALL_SUBTEST(( inverse_general_4x4<Matrix4f>(200000 * g_repeat) ));
+ CALL_SUBTEST_1((inverse_permutation_4x4<Matrix4f>()));
+ CALL_SUBTEST_1(( inverse_general_4x4<Matrix4f>(200000 * g_repeat) ));
- CALL_SUBTEST((inverse_permutation_4x4<Matrix<double,4,4,RowMajor> >()));
- CALL_SUBTEST(( inverse_general_4x4<Matrix<double,4,4,RowMajor> >(200000 * g_repeat) ));
+ CALL_SUBTEST_2((inverse_permutation_4x4<Matrix<double,4,4,RowMajor> >()));
+ CALL_SUBTEST_2(( inverse_general_4x4<Matrix<double,4,4,RowMajor> >(200000 * g_repeat) ));
- CALL_SUBTEST((inverse_permutation_4x4<Matrix4cf>()));
- CALL_SUBTEST((inverse_general_4x4<Matrix4cf>(50000 * g_repeat)));
+ CALL_SUBTEST_3((inverse_permutation_4x4<Matrix4cf>()));
+ CALL_SUBTEST_3((inverse_general_4x4<Matrix4cf>(50000 * g_repeat)));
}
diff --git a/test/eigen2/product_large.cpp b/test/eigen2/eigen2_product_large.cpp
index 966d8ed76..0ecc5d623 100644
--- a/test/eigen2/product_large.cpp
+++ b/test/eigen2/eigen2_product_large.cpp
@@ -24,16 +24,17 @@
#include "product.h"
-void test_product_large()
+void test_eigen2_product_large()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( product(MatrixXf(ei_random<int>(1,320), ei_random<int>(1,320))) );
- CALL_SUBTEST( product(MatrixXd(ei_random<int>(1,320), ei_random<int>(1,320))) );
- CALL_SUBTEST( product(MatrixXi(ei_random<int>(1,320), ei_random<int>(1,320))) );
- CALL_SUBTEST( product(MatrixXcf(ei_random<int>(1,50), ei_random<int>(1,50))) );
- CALL_SUBTEST( product(Matrix<float,Dynamic,Dynamic,RowMajor>(ei_random<int>(1,320), ei_random<int>(1,320))) );
+ CALL_SUBTEST_1( product(MatrixXf(ei_random<int>(1,320), ei_random<int>(1,320))) );
+ CALL_SUBTEST_2( product(MatrixXd(ei_random<int>(1,320), ei_random<int>(1,320))) );
+ CALL_SUBTEST_3( product(MatrixXi(ei_random<int>(1,320), ei_random<int>(1,320))) );
+ CALL_SUBTEST_4( product(MatrixXcf(ei_random<int>(1,50), ei_random<int>(1,50))) );
+ CALL_SUBTEST_5( product(Matrix<float,Dynamic,Dynamic,RowMajor>(ei_random<int>(1,320), ei_random<int>(1,320))) );
}
+#ifdef EIGEN_TEST_PART_6
{
// test a specific issue in DiagonalProduct
int N = 1000000;
@@ -55,4 +56,5 @@ void test_product_large()
MatrixXf result = mat1.row(2)*mat2.transpose();
VERIFY_IS_APPROX(result, (mat1.row(2)*mat2.transpose()).eval());
}
+#endif
}
diff --git a/test/eigen2/product_small.cpp b/test/eigen2/eigen2_product_small.cpp
index 1845c2c73..2a445d12a 100644
--- a/test/eigen2/product_small.cpp
+++ b/test/eigen2/eigen2_product_small.cpp
@@ -25,13 +25,13 @@
#define EIGEN_NO_STATIC_ASSERT
#include "product.h"
-void test_product_small()
+void test_eigen2_product_small()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( product(Matrix<float, 3, 2>()) );
- CALL_SUBTEST( product(Matrix<int, 3, 5>()) );
- CALL_SUBTEST( product(Matrix3d()) );
- CALL_SUBTEST( product(Matrix4d()) );
- CALL_SUBTEST( product(Matrix4f()) );
+ CALL_SUBTEST_1( product(Matrix<float, 3, 2>()) );
+ CALL_SUBTEST_2( product(Matrix<int, 3, 5>()) );
+ CALL_SUBTEST_3( product(Matrix3d()) );
+ CALL_SUBTEST_4( product(Matrix4d()) );
+ CALL_SUBTEST_5( product(Matrix4f()) );
}
}
diff --git a/test/eigen2/qr.cpp b/test/eigen2/eigen2_qr.cpp
index 877945731..e6231208d 100644
--- a/test/eigen2/qr.cpp
+++ b/test/eigen2/eigen2_qr.cpp
@@ -42,6 +42,7 @@ template<typename MatrixType> void qr(const MatrixType& m)
VERIFY_IS_APPROX(a, qrOfA.matrixQ() * qrOfA.matrixR());
VERIFY_IS_NOT_APPROX(a+MatrixType::Identity(rows, cols), qrOfA.matrixQ() * qrOfA.matrixR());
+ #if 0 // eigenvalues module not yet ready
SquareMatrixType b = a.adjoint() * a;
// check tridiagonalization
@@ -55,31 +56,29 @@ template<typename MatrixType> void qr(const MatrixType& m)
b = SquareMatrixType::Random(cols,cols);
hess.compute(b);
VERIFY_IS_APPROX(b, hess.matrixQ() * hess.matrixH() * hess.matrixQ().adjoint());
+ #endif
}
-void test_qr()
+void test_eigen2_qr()
{
for(int i = 0; i < 1; i++) {
- CALL_SUBTEST( qr(Matrix2f()) );
- CALL_SUBTEST( qr(Matrix4d()) );
- CALL_SUBTEST( qr(MatrixXf(12,8)) );
- CALL_SUBTEST( qr(MatrixXcd(5,5)) );
- CALL_SUBTEST( qr(MatrixXcd(7,3)) );
+ CALL_SUBTEST_1( qr(Matrix2f()) );
+ CALL_SUBTEST_2( qr(Matrix4d()) );
+ CALL_SUBTEST_3( qr(MatrixXf(12,8)) );
+ CALL_SUBTEST_4( qr(MatrixXcd(5,5)) );
+ CALL_SUBTEST_4( qr(MatrixXcd(7,3)) );
}
+#ifdef EIGEN_TEST_PART_5
// small isFullRank test
{
Matrix3d mat;
mat << 1, 45, 1, 2, 2, 2, 1, 2, 3;
VERIFY(mat.qr().isFullRank());
mat << 1, 1, 1, 2, 2, 2, 1, 2, 3;
- VERIFY(!mat.qr().isFullRank());
- }
- {
- MatrixXf m = MatrixXf::Zero(10,10);
- VectorXf b = VectorXf::Zero(10);
- VectorXf x = VectorXf::Random(10);
- VERIFY(m.qr().solve(b,&x));
- VERIFY(x.isZero());
+ //always returns true in eigen2support
+ //VERIFY(!mat.qr().isFullRank());
}
+
+#endif
}
diff --git a/test/eigen2/qtvector.cpp b/test/eigen2/eigen2_qtvector.cpp
index 79c55b631..8c4446637 100644
--- a/test/eigen2/qtvector.cpp
+++ b/test/eigen2/eigen2_qtvector.cpp
@@ -142,32 +142,32 @@ void check_qtvector_quaternion(const QuaternionType&)
}
}
-void test_qtvector()
+void test_eigen2_qtvector()
{
// some non vectorizable fixed sizes
- CALL_SUBTEST(check_qtvector_matrix(Vector2f()));
- CALL_SUBTEST(check_qtvector_matrix(Matrix3f()));
- CALL_SUBTEST(check_qtvector_matrix(Matrix3d()));
+ CALL_SUBTEST_1(check_qtvector_matrix(Vector2f()));
+ CALL_SUBTEST_1(check_qtvector_matrix(Matrix3f()));
+ CALL_SUBTEST_1(check_qtvector_matrix(Matrix3d()));
// some vectorizable fixed sizes
- CALL_SUBTEST(check_qtvector_matrix(Matrix2f()));
- CALL_SUBTEST(check_qtvector_matrix(Vector4f()));
- CALL_SUBTEST(check_qtvector_matrix(Matrix4f()));
- CALL_SUBTEST(check_qtvector_matrix(Matrix4d()));
+ CALL_SUBTEST_2(check_qtvector_matrix(Matrix2f()));
+ CALL_SUBTEST_2(check_qtvector_matrix(Vector4f()));
+ CALL_SUBTEST_2(check_qtvector_matrix(Matrix4f()));
+ CALL_SUBTEST_2(check_qtvector_matrix(Matrix4d()));
// some dynamic sizes
- CALL_SUBTEST(check_qtvector_matrix(MatrixXd(1,1)));
- CALL_SUBTEST(check_qtvector_matrix(VectorXd(20)));
- CALL_SUBTEST(check_qtvector_matrix(RowVectorXf(20)));
- CALL_SUBTEST(check_qtvector_matrix(MatrixXcf(10,10)));
+ CALL_SUBTEST_3(check_qtvector_matrix(MatrixXd(1,1)));
+ CALL_SUBTEST_3(check_qtvector_matrix(VectorXd(20)));
+ CALL_SUBTEST_3(check_qtvector_matrix(RowVectorXf(20)));
+ CALL_SUBTEST_3(check_qtvector_matrix(MatrixXcf(10,10)));
// some Transform
- CALL_SUBTEST(check_qtvector_transform(Transform2f()));
- CALL_SUBTEST(check_qtvector_transform(Transform3f()));
- CALL_SUBTEST(check_qtvector_transform(Transform3d()));
- //CALL_SUBTEST(check_qtvector_transform(Transform4d()));
+ CALL_SUBTEST_4(check_qtvector_transform(Transform2f()));
+ CALL_SUBTEST_4(check_qtvector_transform(Transform3f()));
+ CALL_SUBTEST_4(check_qtvector_transform(Transform3d()));
+ //CALL_SUBTEST_4(check_qtvector_transform(Transform4d()));
// some Quaternion
- CALL_SUBTEST(check_qtvector_quaternion(Quaternionf()));
- CALL_SUBTEST(check_qtvector_quaternion(Quaternionf()));
+ CALL_SUBTEST_5(check_qtvector_quaternion(Quaternionf()));
+ CALL_SUBTEST_5(check_qtvector_quaternion(Quaternionf()));
}
diff --git a/test/eigen2/regression.cpp b/test/eigen2/eigen2_regression.cpp
index 534ad3d1c..9bc41de87 100644
--- a/test/eigen2/regression.cpp
+++ b/test/eigen2/eigen2_regression.cpp
@@ -91,10 +91,11 @@ void check_fitHyperplane(int numPoints,
VERIFY(ei_abs(error) < ei_abs(tolerance));
}
-void test_regression()
+void test_eigen2_regression()
{
for(int i = 0; i < g_repeat; i++)
{
+#ifdef EIGEN_TEST_PART_1
{
Vector2f points2f [1000];
Vector2f *points2f_ptrs [1000];
@@ -108,7 +109,8 @@ void test_regression()
CALL_SUBTEST(check_linearRegression(100, points2f_ptrs, coeffs2f, 0.01f));
CALL_SUBTEST(check_linearRegression(1000, points2f_ptrs, coeffs2f, 0.002f));
}
-
+#endif
+#ifdef EIGEN_TEST_PART_2
{
Vector2f points2f [1000];
Vector2f *points2f_ptrs [1000];
@@ -119,7 +121,8 @@ void test_regression()
CALL_SUBTEST(check_fitHyperplane(100, points2f_ptrs, coeffs3f, 0.01f));
CALL_SUBTEST(check_fitHyperplane(1000, points2f_ptrs, coeffs3f, 0.002f));
}
-
+#endif
+#ifdef EIGEN_TEST_PART_3
{
Vector4d points4d [1000];
Vector4d *points4d_ptrs [1000];
@@ -130,7 +133,8 @@ void test_regression()
CALL_SUBTEST(check_fitHyperplane(100, points4d_ptrs, coeffs5d, 0.01));
CALL_SUBTEST(check_fitHyperplane(1000, points4d_ptrs, coeffs5d, 0.002));
}
-
+#endif
+#ifdef EIGEN_TEST_PART_4
{
VectorXcd *points11cd_ptrs[1000];
for(int i = 0; i < 1000; i++) points11cd_ptrs[i] = new VectorXcd(11);
@@ -141,5 +145,6 @@ void test_regression()
delete coeffs12cd;
for(int i = 0; i < 1000; i++) delete points11cd_ptrs[i];
}
+#endif
}
}
diff --git a/test/eigen2/sizeof.cpp b/test/eigen2/eigen2_sizeof.cpp
index 6ccb2330c..73ed533e0 100644
--- a/test/eigen2/sizeof.cpp
+++ b/test/eigen2/eigen2_sizeof.cpp
@@ -33,7 +33,7 @@ template<typename MatrixType> void verifySizeOf(const MatrixType&)
VERIFY(sizeof(MatrixType)==sizeof(Scalar*) + 2 * sizeof(typename MatrixType::Index));
}
-void test_sizeof()
+void test_eigen2_sizeof()
{
CALL_SUBTEST( verifySizeOf(Matrix<float, 1, 1>()) );
CALL_SUBTEST( verifySizeOf(Matrix4d()) );
diff --git a/test/eigen2/smallvectors.cpp b/test/eigen2/eigen2_smallvectors.cpp
index eed30d99e..163c3e653 100644
--- a/test/eigen2/smallvectors.cpp
+++ b/test/eigen2/eigen2_smallvectors.cpp
@@ -47,7 +47,7 @@ template<typename Scalar> void smallVectors()
VERIFY_IS_APPROX(x4, v4.w());
}
-void test_smallvectors()
+void test_eigen2_smallvectors()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( smallVectors<int>() );
diff --git a/test/eigen2/sparse_basic.cpp b/test/eigen2/eigen2_sparse_basic.cpp
index 410ef96a6..4e9f8e9f2 100644
--- a/test/eigen2/sparse_basic.cpp
+++ b/test/eigen2/eigen2_sparse_basic.cpp
@@ -320,13 +320,13 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
}
}
-void test_sparse_basic()
+void test_eigen2_sparse_basic()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( sparse_basic(SparseMatrix<double>(8, 8)) );
- CALL_SUBTEST( sparse_basic(SparseMatrix<std::complex<double> >(16, 16)) );
- CALL_SUBTEST( sparse_basic(SparseMatrix<double>(33, 33)) );
+ CALL_SUBTEST_1( sparse_basic(SparseMatrix<double>(8, 8)) );
+ CALL_SUBTEST_2( sparse_basic(SparseMatrix<std::complex<double> >(16, 16)) );
+ CALL_SUBTEST_1( sparse_basic(SparseMatrix<double>(33, 33)) );
- CALL_SUBTEST( sparse_basic(DynamicSparseMatrix<double>(8, 8)) );
+ CALL_SUBTEST_3( sparse_basic(DynamicSparseMatrix<double>(8, 8)) );
}
}
diff --git a/test/eigen2/sparse_product.cpp b/test/eigen2/eigen2_sparse_product.cpp
index dcfc58a14..6260cdddb 100644
--- a/test/eigen2/sparse_product.cpp
+++ b/test/eigen2/eigen2_sparse_product.cpp
@@ -118,13 +118,13 @@ template<typename SparseMatrixType> void sparse_product(const SparseMatrixType&
}
-void test_sparse_product()
+void test_eigen2_sparse_product()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( sparse_product(SparseMatrix<double>(8, 8)) );
- CALL_SUBTEST( sparse_product(SparseMatrix<std::complex<double> >(16, 16)) );
- CALL_SUBTEST( sparse_product(SparseMatrix<double>(33, 33)) );
+ CALL_SUBTEST_1( sparse_product(SparseMatrix<double>(8, 8)) );
+ CALL_SUBTEST_2( sparse_product(SparseMatrix<std::complex<double> >(16, 16)) );
+ CALL_SUBTEST_1( sparse_product(SparseMatrix<double>(33, 33)) );
- CALL_SUBTEST( sparse_product(DynamicSparseMatrix<double>(8, 8)) );
+ CALL_SUBTEST_3( sparse_product(DynamicSparseMatrix<double>(8, 8)) );
}
}
diff --git a/test/eigen2/sparse_solvers.cpp b/test/eigen2/eigen2_sparse_solvers.cpp
index 3d7f5b91e..f141af314 100644
--- a/test/eigen2/sparse_solvers.cpp
+++ b/test/eigen2/eigen2_sparse_solvers.cpp
@@ -205,11 +205,11 @@ template<typename Scalar> void sparse_solvers(int rows, int cols)
}
-void test_sparse_solvers()
+void test_eigen2_sparse_solvers()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( sparse_solvers<double>(8, 8) );
- CALL_SUBTEST( sparse_solvers<std::complex<double> >(16, 16) );
- CALL_SUBTEST( sparse_solvers<double>(101, 101) );
+ CALL_SUBTEST_1( sparse_solvers<double>(8, 8) );
+ CALL_SUBTEST_2( sparse_solvers<std::complex<double> >(16, 16) );
+ CALL_SUBTEST_1( sparse_solvers<double>(101, 101) );
}
}
diff --git a/test/eigen2/sparse_vector.cpp b/test/eigen2/eigen2_sparse_vector.cpp
index 934719f2c..3289cbd20 100644
--- a/test/eigen2/sparse_vector.cpp
+++ b/test/eigen2/eigen2_sparse_vector.cpp
@@ -88,12 +88,12 @@ template<typename Scalar> void sparse_vector(int rows, int cols)
}
-void test_sparse_vector()
+void test_eigen2_sparse_vector()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( sparse_vector<double>(8, 8) );
- CALL_SUBTEST( sparse_vector<std::complex<double> >(16, 16) );
- CALL_SUBTEST( sparse_vector<double>(299, 535) );
+ CALL_SUBTEST_1( sparse_vector<double>(8, 8) );
+ CALL_SUBTEST_2( sparse_vector<std::complex<double> >(16, 16) );
+ CALL_SUBTEST_1( sparse_vector<double>(299, 535) );
}
}
diff --git a/test/eigen2/stdvector.cpp b/test/eigen2/eigen2_stdvector.cpp
index 8d205f310..46d0bf7dc 100644
--- a/test/eigen2/stdvector.cpp
+++ b/test/eigen2/eigen2_stdvector.cpp
@@ -132,32 +132,32 @@ void check_stdvector_quaternion(const QuaternionType&)
}
}
-void test_stdvector()
+void test_eigen2_stdvector()
{
// some non vectorizable fixed sizes
- CALL_SUBTEST(check_stdvector_matrix(Vector2f()));
- CALL_SUBTEST(check_stdvector_matrix(Matrix3f()));
- CALL_SUBTEST(check_stdvector_matrix(Matrix3d()));
+ CALL_SUBTEST_1(check_stdvector_matrix(Vector2f()));
+ CALL_SUBTEST_1(check_stdvector_matrix(Matrix3f()));
+ CALL_SUBTEST_1(check_stdvector_matrix(Matrix3d()));
// some vectorizable fixed sizes
- CALL_SUBTEST(check_stdvector_matrix(Matrix2f()));
- CALL_SUBTEST(check_stdvector_matrix(Vector4f()));
- CALL_SUBTEST(check_stdvector_matrix(Matrix4f()));
- CALL_SUBTEST(check_stdvector_matrix(Matrix4d()));
+ CALL_SUBTEST_2(check_stdvector_matrix(Matrix2f()));
+ CALL_SUBTEST_2(check_stdvector_matrix(Vector4f()));
+ CALL_SUBTEST_2(check_stdvector_matrix(Matrix4f()));
+ CALL_SUBTEST_2(check_stdvector_matrix(Matrix4d()));
// some dynamic sizes
- CALL_SUBTEST(check_stdvector_matrix(MatrixXd(1,1)));
- CALL_SUBTEST(check_stdvector_matrix(VectorXd(20)));
- CALL_SUBTEST(check_stdvector_matrix(RowVectorXf(20)));
- CALL_SUBTEST(check_stdvector_matrix(MatrixXcf(10,10)));
+ CALL_SUBTEST_3(check_stdvector_matrix(MatrixXd(1,1)));
+ CALL_SUBTEST_3(check_stdvector_matrix(VectorXd(20)));
+ CALL_SUBTEST_3(check_stdvector_matrix(RowVectorXf(20)));
+ CALL_SUBTEST_3(check_stdvector_matrix(MatrixXcf(10,10)));
// some Transform
- CALL_SUBTEST(check_stdvector_transform(Transform2f()));
- CALL_SUBTEST(check_stdvector_transform(Transform3f()));
- CALL_SUBTEST(check_stdvector_transform(Transform3d()));
- //CALL_SUBTEST(check_stdvector_transform(Transform4d()));
+ CALL_SUBTEST_4(check_stdvector_transform(Transform2f()));
+ CALL_SUBTEST_4(check_stdvector_transform(Transform3f()));
+ CALL_SUBTEST_4(check_stdvector_transform(Transform3d()));
+ //CALL_SUBTEST_4(check_stdvector_transform(Transform4d()));
// some Quaternion
- CALL_SUBTEST(check_stdvector_quaternion(Quaternionf()));
- CALL_SUBTEST(check_stdvector_quaternion(Quaternionf()));
+ CALL_SUBTEST_5(check_stdvector_quaternion(Quaternionf()));
+ CALL_SUBTEST_5(check_stdvector_quaternion(Quaternionf()));
}
diff --git a/test/eigen2/submatrices.cpp b/test/eigen2/eigen2_submatrices.cpp
index 71bb65482..37a084286 100644
--- a/test/eigen2/submatrices.cpp
+++ b/test/eigen2/eigen2_submatrices.cpp
@@ -150,14 +150,14 @@ template<typename MatrixType> void submatrices(const MatrixType& m)
VERIFY(ei_real(ones.row(r1).dot(ones.row(r2))) == RealScalar(cols));
}
-void test_submatrices()
+void test_eigen2_submatrices()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( submatrices(Matrix<float, 1, 1>()) );
- CALL_SUBTEST( submatrices(Matrix4d()) );
- CALL_SUBTEST( submatrices(MatrixXcf(3, 3)) );
- CALL_SUBTEST( submatrices(MatrixXi(8, 12)) );
- CALL_SUBTEST( submatrices(MatrixXcd(20, 20)) );
- CALL_SUBTEST( submatrices(MatrixXf(20, 20)) );
+ CALL_SUBTEST_1( submatrices(Matrix<float, 1, 1>()) );
+ CALL_SUBTEST_2( submatrices(Matrix4d()) );
+ CALL_SUBTEST_3( submatrices(MatrixXcf(3, 3)) );
+ CALL_SUBTEST_4( submatrices(MatrixXi(8, 12)) );
+ CALL_SUBTEST_5( submatrices(MatrixXcd(20, 20)) );
+ CALL_SUBTEST_6( submatrices(MatrixXf(20, 20)) );
}
}
diff --git a/test/eigen2/sum.cpp b/test/eigen2/eigen2_sum.cpp
index fe707e9b2..aabf49c22 100644
--- a/test/eigen2/sum.cpp
+++ b/test/eigen2/eigen2_sum.cpp
@@ -68,19 +68,19 @@ template<typename VectorType> void vectorSum(const VectorType& w)
}
}
-void test_sum()
+void test_eigen2_sum()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( matrixSum(Matrix<float, 1, 1>()) );
- CALL_SUBTEST( matrixSum(Matrix2f()) );
- CALL_SUBTEST( matrixSum(Matrix4d()) );
- CALL_SUBTEST( matrixSum(MatrixXcf(3, 3)) );
- CALL_SUBTEST( matrixSum(MatrixXf(8, 12)) );
- CALL_SUBTEST( matrixSum(MatrixXi(8, 12)) );
+ CALL_SUBTEST_1( matrixSum(Matrix<float, 1, 1>()) );
+ CALL_SUBTEST_2( matrixSum(Matrix2f()) );
+ CALL_SUBTEST_3( matrixSum(Matrix4d()) );
+ CALL_SUBTEST_4( matrixSum(MatrixXcf(3, 3)) );
+ CALL_SUBTEST_5( matrixSum(MatrixXf(8, 12)) );
+ CALL_SUBTEST_6( matrixSum(MatrixXi(8, 12)) );
}
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( vectorSum(VectorXf(5)) );
- CALL_SUBTEST( vectorSum(VectorXd(10)) );
- CALL_SUBTEST( vectorSum(VectorXf(33)) );
+ CALL_SUBTEST_5( vectorSum(VectorXf(5)) );
+ CALL_SUBTEST_7( vectorSum(VectorXd(10)) );
+ CALL_SUBTEST_5( vectorSum(VectorXf(33)) );
}
}
diff --git a/test/eigen2/svd.cpp b/test/eigen2/eigen2_svd.cpp
index 3158782d8..f74b13ea7 100644
--- a/test/eigen2/svd.cpp
+++ b/test/eigen2/eigen2_svd.cpp
@@ -85,13 +85,13 @@ template<typename MatrixType> void svd(const MatrixType& m)
}
}
-void test_svd()
+void test_eigen2_svd()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( svd(Matrix3f()) );
- CALL_SUBTEST( svd(Matrix4d()) );
- CALL_SUBTEST( svd(MatrixXf(7,7)) );
- CALL_SUBTEST( svd(MatrixXd(14,7)) );
+ CALL_SUBTEST_1( svd(Matrix3f()) );
+ CALL_SUBTEST_2( svd(Matrix4d()) );
+ CALL_SUBTEST_3( svd(MatrixXf(7,7)) );
+ CALL_SUBTEST_4( svd(MatrixXd(14,7)) );
// complex are not implemented yet
// CALL_SUBTEST( svd(MatrixXcd(6,6)) );
// CALL_SUBTEST( svd(MatrixXcf(3,3)) );
diff --git a/test/eigen2/swap.cpp b/test/eigen2/eigen2_swap.cpp
index 8b325992c..29688bd33 100644
--- a/test/eigen2/swap.cpp
+++ b/test/eigen2/eigen2_swap.cpp
@@ -89,10 +89,10 @@ template<typename MatrixType> void swap(const MatrixType& m)
VERIFY_RAISES_ASSERT(m1.row(0).swap(m1));
}
-void test_swap()
+void test_eigen2_swap()
{
- CALL_SUBTEST( swap(Matrix3f()) ); // fixed size, no vectorization
- CALL_SUBTEST( swap(Matrix4d()) ); // fixed size, possible vectorization
- CALL_SUBTEST( swap(MatrixXd(3,3)) ); // dyn size, no vectorization
- CALL_SUBTEST( swap(MatrixXf(30,30)) ); // dyn size, possible vectorization
+ CALL_SUBTEST( swap_1(Matrix3f()) ); // fixed size, no vectorization
+ CALL_SUBTEST( swap_2(Matrix4d()) ); // fixed size, possible vectorization
+ CALL_SUBTEST( swap_3(MatrixXd(3,3)) ); // dyn size, no vectorization
+ CALL_SUBTEST( swap_4(MatrixXf(30,30)) ); // dyn size, possible vectorization
}
diff --git a/test/eigen2/triangular.cpp b/test/eigen2/eigen2_triangular.cpp
index a74ca5e0b..30ef1b20b 100644
--- a/test/eigen2/triangular.cpp
+++ b/test/eigen2/eigen2_triangular.cpp
@@ -124,15 +124,50 @@ template<typename MatrixType> void triangular(const MatrixType& m)
}
-void test_triangular()
+void selfadjoint()
{
+ Matrix2i m;
+ m << 1, 2,
+ 3, 4;
+
+ Matrix2i m1 = Matrix2i::Zero();
+ m1.part<SelfAdjoint>() = m;
+ Matrix2i ref1;
+ ref1 << 1, 2,
+ 2, 4;
+ VERIFY(m1 == ref1);
+
+ Matrix2i m2 = Matrix2i::Zero();
+ m2.part<SelfAdjoint>() = m.part<UpperTriangular>();
+ Matrix2i ref2;
+ ref2 << 1, 2,
+ 2, 4;
+ VERIFY(m2 == ref2);
+
+ Matrix2i m3 = Matrix2i::Zero();
+ m3.part<SelfAdjoint>() = m.part<LowerTriangular>();
+ Matrix2i ref3;
+ ref3 << 1, 0,
+ 0, 4;
+ VERIFY(m3 == ref3);
+
+ // example inspired from bug 159
+ int array[] = {1, 2, 3, 4};
+ Matrix2i::Map(array).part<SelfAdjoint>() = Matrix2i::Random().part<LowerTriangular>();
+
+ std::cout << "hello\n" << array << std::endl;
+}
+
+void test_eigen2_triangular()
+{
+ CALL_SUBTEST_8( selfadjoint() );
for(int i = 0; i < g_repeat ; i++) {
- CALL_SUBTEST( triangular(Matrix<float, 1, 1>()) );
- CALL_SUBTEST( triangular(Matrix<float, 2, 2>()) );
- CALL_SUBTEST( triangular(Matrix3d()) );
- CALL_SUBTEST( triangular(MatrixXcf(4, 4)) );
- CALL_SUBTEST( triangular(Matrix<std::complex<float>,8, 8>()) );
- CALL_SUBTEST( triangular(MatrixXd(17,17)) );
- CALL_SUBTEST( triangular(Matrix<float,Dynamic,Dynamic,RowMajor>(5, 5)) );
+ CALL_SUBTEST_1( triangular(Matrix<float, 1, 1>()) );
+ CALL_SUBTEST_2( triangular(Matrix<float, 2, 2>()) );
+ CALL_SUBTEST_3( triangular(Matrix3d()) );
+ CALL_SUBTEST_4( triangular(MatrixXcf(4, 4)) );
+ CALL_SUBTEST_5( triangular(Matrix<std::complex<float>,8, 8>()) );
+ CALL_SUBTEST_6( triangular(MatrixXd(17,17)) );
+ CALL_SUBTEST_7( triangular(Matrix<float,Dynamic,Dynamic,RowMajor>(5, 5)) );
}
}
diff --git a/test/eigen2/unalignedassert.cpp b/test/eigen2/eigen2_unalignedassert.cpp
index cf6f1bdf6..80dd1188c 100644
--- a/test/eigen2/unalignedassert.cpp
+++ b/test/eigen2/eigen2_unalignedassert.cpp
@@ -125,7 +125,7 @@ void unalignedassert()
#endif
}
-void test_unalignedassert()
+void test_eigen2_unalignedassert()
{
CALL_SUBTEST(unalignedassert());
}
diff --git a/test/eigen2/visitor.cpp b/test/eigen2/eigen2_visitor.cpp
index 6ec442bc8..db650b73d 100644
--- a/test/eigen2/visitor.cpp
+++ b/test/eigen2/eigen2_visitor.cpp
@@ -112,20 +112,20 @@ template<typename VectorType> void vectorVisitor(const VectorType& w)
VERIFY_IS_APPROX(maxc, v.maxCoeff());
}
-void test_visitor()
+void test_eigen2_visitor()
{
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( matrixVisitor(Matrix<float, 1, 1>()) );
- CALL_SUBTEST( matrixVisitor(Matrix2f()) );
- CALL_SUBTEST( matrixVisitor(Matrix4d()) );
- CALL_SUBTEST( matrixVisitor(MatrixXd(8, 12)) );
- CALL_SUBTEST( matrixVisitor(Matrix<double,Dynamic,Dynamic,RowMajor>(20, 20)) );
- CALL_SUBTEST( matrixVisitor(MatrixXi(8, 12)) );
+ CALL_SUBTEST_1( matrixVisitor(Matrix<float, 1, 1>()) );
+ CALL_SUBTEST_2( matrixVisitor(Matrix2f()) );
+ CALL_SUBTEST_3( matrixVisitor(Matrix4d()) );
+ CALL_SUBTEST_4( matrixVisitor(MatrixXd(8, 12)) );
+ CALL_SUBTEST_5( matrixVisitor(Matrix<double,Dynamic,Dynamic,RowMajor>(20, 20)) );
+ CALL_SUBTEST_6( matrixVisitor(MatrixXi(8, 12)) );
}
for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST( vectorVisitor(Vector4f()) );
- CALL_SUBTEST( vectorVisitor(VectorXd(10)) );
- CALL_SUBTEST( vectorVisitor(RowVectorXd(10)) );
- CALL_SUBTEST( vectorVisitor(VectorXf(33)) );
+ CALL_SUBTEST_7( vectorVisitor(Vector4f()) );
+ CALL_SUBTEST_4( vectorVisitor(VectorXd(10)) );
+ CALL_SUBTEST_4( vectorVisitor(RowVectorXd(10)) );
+ CALL_SUBTEST_8( vectorVisitor(VectorXf(33)) );
}
}
diff --git a/test/eigen2/main.h b/test/eigen2/main.h
index e144a28b1..5b6c715e7 100644
--- a/test/eigen2/main.h
+++ b/test/eigen2/main.h
@@ -240,6 +240,104 @@ void EI_PP_CAT(test_,EIGEN_TEST_FUNC)();
using namespace Eigen;
+#ifdef EIGEN_TEST_PART_1
+#define CALL_SUBTEST_1(FUNC) CALL_SUBTEST(FUNC)
+#else
+#define CALL_SUBTEST_1(FUNC)
+#endif
+
+#ifdef EIGEN_TEST_PART_2
+#define CALL_SUBTEST_2(FUNC) CALL_SUBTEST(FUNC)
+#else
+#define CALL_SUBTEST_2(FUNC)
+#endif
+
+#ifdef EIGEN_TEST_PART_3
+#define CALL_SUBTEST_3(FUNC) CALL_SUBTEST(FUNC)
+#else
+#define CALL_SUBTEST_3(FUNC)
+#endif
+
+#ifdef EIGEN_TEST_PART_4
+#define CALL_SUBTEST_4(FUNC) CALL_SUBTEST(FUNC)
+#else
+#define CALL_SUBTEST_4(FUNC)
+#endif
+
+#ifdef EIGEN_TEST_PART_5
+#define CALL_SUBTEST_5(FUNC) CALL_SUBTEST(FUNC)
+#else
+#define CALL_SUBTEST_5(FUNC)
+#endif
+
+#ifdef EIGEN_TEST_PART_6
+#define CALL_SUBTEST_6(FUNC) CALL_SUBTEST(FUNC)
+#else
+#define CALL_SUBTEST_6(FUNC)
+#endif
+
+#ifdef EIGEN_TEST_PART_7
+#define CALL_SUBTEST_7(FUNC) CALL_SUBTEST(FUNC)
+#else
+#define CALL_SUBTEST_7(FUNC)
+#endif
+
+#ifdef EIGEN_TEST_PART_8
+#define CALL_SUBTEST_8(FUNC) CALL_SUBTEST(FUNC)
+#else
+#define CALL_SUBTEST_8(FUNC)
+#endif
+
+#ifdef EIGEN_TEST_PART_9
+#define CALL_SUBTEST_9(FUNC) CALL_SUBTEST(FUNC)
+#else
+#define CALL_SUBTEST_9(FUNC)
+#endif
+
+#ifdef EIGEN_TEST_PART_10
+#define CALL_SUBTEST_10(FUNC) CALL_SUBTEST(FUNC)
+#else
+#define CALL_SUBTEST_10(FUNC)
+#endif
+
+#ifdef EIGEN_TEST_PART_11
+#define CALL_SUBTEST_11(FUNC) CALL_SUBTEST(FUNC)
+#else
+#define CALL_SUBTEST_11(FUNC)
+#endif
+
+#ifdef EIGEN_TEST_PART_12
+#define CALL_SUBTEST_12(FUNC) CALL_SUBTEST(FUNC)
+#else
+#define CALL_SUBTEST_12(FUNC)
+#endif
+
+#ifdef EIGEN_TEST_PART_13
+#define CALL_SUBTEST_13(FUNC) CALL_SUBTEST(FUNC)
+#else
+#define CALL_SUBTEST_13(FUNC)
+#endif
+
+#ifdef EIGEN_TEST_PART_14
+#define CALL_SUBTEST_14(FUNC) CALL_SUBTEST(FUNC)
+#else
+#define CALL_SUBTEST_14(FUNC)
+#endif
+
+#ifdef EIGEN_TEST_PART_15
+#define CALL_SUBTEST_15(FUNC) CALL_SUBTEST(FUNC)
+#else
+#define CALL_SUBTEST_15(FUNC)
+#endif
+
+#ifdef EIGEN_TEST_PART_16
+#define CALL_SUBTEST_16(FUNC) CALL_SUBTEST(FUNC)
+#else
+#define CALL_SUBTEST_16(FUNC)
+#endif
+
+
+
int main(int argc, char *argv[])
{
bool has_set_repeat = false;
diff --git a/test/selfadjoint.cpp b/test/selfadjoint.cpp
index a92ad96b5..622045f20 100644
--- a/test/selfadjoint.cpp
+++ b/test/selfadjoint.cpp
@@ -52,6 +52,11 @@ template<typename MatrixType> void selfadjoint(const MatrixType& m)
VERIFY_IS_APPROX(m3, m3.adjoint());
}
+void bug_159()
+{
+ Matrix3d m = Matrix3d::Random().selfadjointView<Lower>();
+}
+
void test_selfadjoint()
{
for(int i = 0; i < g_repeat ; i++)
@@ -64,4 +69,6 @@ void test_selfadjoint()
CALL_SUBTEST_4( selfadjoint(MatrixXcd(s,s)) );
CALL_SUBTEST_5( selfadjoint(Matrix<float,Dynamic,Dynamic,RowMajor>(s, s)) );
}
+
+ CALL_SUBTEST_1( bug_159() );
}
diff --git a/test/triangular.cpp b/test/triangular.cpp
index 0c69749e0..69decb793 100644
--- a/test/triangular.cpp
+++ b/test/triangular.cpp
@@ -235,6 +235,11 @@ template<typename MatrixType> void triangular_rect(const MatrixType& m)
VERIFY_IS_APPROX(m2,m3);
}
+void bug_159()
+{
+ Matrix3d m = Matrix3d::Random().triangularView<Lower>();
+}
+
void test_triangular()
{
for(int i = 0; i < g_repeat ; i++)
@@ -255,4 +260,6 @@ void test_triangular()
CALL_SUBTEST_5( triangular_rect(MatrixXcd(r, c)) );
CALL_SUBTEST_6( triangular_rect(Matrix<float,Dynamic,Dynamic,RowMajor>(r, c)) );
}
+
+ CALL_SUBTEST_1( bug_159() );
}