big huge changes, so i dont remember everything.

* renaming, e.g. LU ---> FullPivLU
* split tests framework: more robust, e.g. dont generate empty tests if a number is skipped
* make all remaining tests use that splitting, as needed.
* Fix 4x4 inversion (see stable branch)
* Transform::inverse() and geo_transform test : adapt to new inverse() API, it was also trying to instantiate inverse() for 3x4 matrices.
* CMakeLists: more robust regexp to parse the version number
* misc fixes in unit tests
This commit is contained in:
Benoit Jacob 2009-10-28 18:19:29 -04:00
parent 1f1c04cac1
commit 2840ac7e94
99 changed files with 816 additions and 710 deletions

View File

@ -3,12 +3,12 @@ project(Eigen)
cmake_minimum_required(VERSION 2.6.2)
# automatically parse the version number
file(READ "${CMAKE_SOURCE_DIR}/Eigen/src/Core/util/Macros.h" _eigen2_version_header LIMIT 5000 OFFSET 1000)
string(REGEX MATCH "define *EIGEN_WORLD_VERSION ([0-9]*)" _eigen2_world_version_match "${_eigen2_version_header}")
file(READ "${CMAKE_SOURCE_DIR}/Eigen/src/Core/util/Macros.h" _eigen2_version_header)
string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen2_world_version_match "${_eigen2_version_header}")
set(EIGEN2_WORLD_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define *EIGEN_MAJOR_VERSION ([0-9]*)" _eigen2_major_version_match "${_eigen2_version_header}")
string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen2_major_version_match "${_eigen2_version_header}")
set(EIGEN2_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define *EIGEN_MINOR_VERSION ([0-9]*)" _eigen2_minor_version_match "${_eigen2_version_header}")
string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen2_minor_version_match "${_eigen2_version_header}")
set(EIGEN2_MINOR_VERSION "${CMAKE_MATCH_1}")
set(EIGEN_VERSION_NUMBER ${EIGEN2_WORLD_VERSION}.${EIGEN2_MAJOR_VERSION}.${EIGEN2_MINOR_VERSION})

View File

@ -18,8 +18,8 @@ namespace Eigen {
* \endcode
*/
#include "src/LU/LU.h"
#include "src/LU/PartialLU.h"
#include "src/LU/FullPivLU.h"
#include "src/LU/PartialPivLU.h"
#include "src/LU/Determinant.h"
#include "src/LU/Inverse.h"

View File

@ -34,8 +34,8 @@ namespace Eigen {
*/
#include "src/QR/HouseholderQR.h"
#include "src/QR/FullPivotingHouseholderQR.h"
#include "src/QR/ColPivotingHouseholderQR.h"
#include "src/QR/FullPivHouseholderQR.h"
#include "src/QR/ColPivHouseholderQR.h"
// declare all classes for a given matrix type
#define EIGEN_QR_MODULE_INSTANTIATE_TYPE(MATRIXTYPE,PREFIX) \

View File

@ -88,7 +88,7 @@ template<typename MatrixType> class LDLT
/** \returns a vector of integers, whose size is the number of rows of the matrix being decomposed,
* representing the P permutation i.e. the permutation of the rows. For its precise meaning,
* see the examples given in the documentation of class LU.
* see the examples given in the documentation of class FullPivLU.
*/
inline const IntColVectorType& permutationP() const
{

View File

@ -699,8 +699,9 @@ template<typename Derived> class MatrixBase
/////////// LU module ///////////
const LU<PlainMatrixType> lu() const;
const PartialLU<PlainMatrixType> partialLu() const;
const FullPivLU<PlainMatrixType> fullPivLu() const;
const PartialPivLU<PlainMatrixType> partialPivLu() const;
const PartialPivLU<PlainMatrixType> lu() const;
const ei_inverse_impl<Derived> inverse() const;
template<typename ResultType>
void computeInverseAndDetWithCheck(
@ -725,8 +726,8 @@ template<typename Derived> class MatrixBase
/////////// QR module ///////////
const HouseholderQR<PlainMatrixType> householderQr() const;
const ColPivotingHouseholderQR<PlainMatrixType> colPivotingHouseholderQr() const;
const FullPivotingHouseholderQR<PlainMatrixType> fullPivotingHouseholderQr() const;
const ColPivHouseholderQR<PlainMatrixType> colPivHouseholderQr() const;
const FullPivHouseholderQR<PlainMatrixType> fullPivHouseholderQr() const;
EigenvaluesReturnType eigenvalues() const;
RealScalar operatorNorm() const;

View File

@ -34,7 +34,14 @@ struct ei_traits<ReturnByValue<Derived> >
: public ei_traits<typename ei_traits<Derived>::ReturnMatrixType>
{
enum {
Flags = ei_traits<typename ei_traits<Derived>::ReturnMatrixType>::Flags | EvalBeforeNestingBit
// FIXME had to remove the DirectAccessBit for usage like
// matrix.inverse().block(...)
// because the Block ctor with direct access
// wants to call coeffRef() to get an address, and that fails (infinite recursion) as ReturnByValue
// doesnt implement coeffRef(). The better fix is probably rather to make Block work directly
// on the nested type, right?
Flags = (ei_traits<typename ei_traits<Derived>::ReturnMatrixType>::Flags
| EvalBeforeNestingBit) & ~DirectAccessBit
};
};

View File

@ -114,12 +114,12 @@ template<typename ExpressionType, int Direction> class VectorwiseOp;
template<typename MatrixType,int RowFactor,int ColFactor> class Replicate;
template<typename MatrixType, int Direction = BothDirections> class Reverse;
template<typename MatrixType> class LU;
template<typename MatrixType> class PartialLU;
template<typename MatrixType> class FullPivLU;
template<typename MatrixType> class PartialPivLU;
template<typename MatrixType> struct ei_inverse_impl;
template<typename MatrixType> class HouseholderQR;
template<typename MatrixType> class ColPivotingHouseholderQR;
template<typename MatrixType> class FullPivotingHouseholderQR;
template<typename MatrixType> class ColPivHouseholderQR;
template<typename MatrixType> class FullPivHouseholderQR;
template<typename MatrixType> class SVD;
template<typename MatrixType, unsigned int Options = 0> class JacobiSVD;
template<typename MatrixType, int UpLo = LowerTriangular> class LLT;

View File

@ -30,7 +30,7 @@
#define EIGEN_WORLD_VERSION 2
#define EIGEN_MAJOR_VERSION 90
#define EIGEN_MINOR_VERSION 0
#define EIGEN_MINOR_VERSION 1
#define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \
(EIGEN_MAJOR_VERSION>y || (EIGEN_MAJOR_VERSION>=y && \

View File

@ -876,6 +876,24 @@ Transform<Scalar,Dim,Mode>::fromPositionOrientationScale(const MatrixBase<Positi
return *this;
}
// selector needed to avoid taking the inverse of a 3x4 matrix
template<typename TransformType, int Mode=TransformType::Mode>
struct ei_projective_transform_inverse
{
static inline void run(const TransformType&, TransformType&)
{}
};
template<typename TransformType>
struct ei_projective_transform_inverse<TransformType, Projective>
{
static inline void run(const TransformType& m, TransformType& res)
{
res.matrix() = m.matrix().inverse();
}
};
/** \nonstableyet
*
* \returns the inverse transformation according to some given knowledge
@ -902,7 +920,7 @@ Transform<Scalar,Dim,Mode>::inverse(TransformTraits hint) const
Transform res;
if (hint == Projective)
{
res.matrix() = m_matrix.inverse();
ei_projective_transform_inverse<Transform>::run(*this, res);
}
else
{

View File

@ -53,7 +53,7 @@ template<typename Derived,
{
static inline typename ei_traits<Derived>::Scalar run(const Derived& m)
{
return m.partialLu().determinant();
return m.partialPivLu().determinant();
}
};

View File

@ -31,7 +31,7 @@ template<typename MatrixType> struct ei_lu_image_impl;
/** \ingroup LU_Module
*
* \class LU
* \class FullPivLU
*
* \brief LU decomposition of a matrix with complete pivoting, and related features
*
@ -54,12 +54,12 @@ template<typename MatrixType> struct ei_lu_image_impl;
* permutationP(), permutationQ().
*
* As an exemple, here is how the original matrix can be retrieved:
* \include class_LU.cpp
* Output: \verbinclude class_LU.out
* \include class_FullPivLU.cpp
* Output: \verbinclude class_FullPivLU.out
*
* \sa MatrixBase::lu(), MatrixBase::determinant(), MatrixBase::inverse()
* \sa MatrixBase::fullPivLu(), MatrixBase::determinant(), MatrixBase::inverse()
*/
template<typename MatrixType> class LU
template<typename MatrixType> class FullPivLU
{
public:
@ -81,14 +81,14 @@ template<typename MatrixType> class LU
* The default constructor is useful in cases in which the user intends to
* perform decompositions via LU::compute(const MatrixType&).
*/
LU();
FullPivLU();
/** Constructor.
*
* \param matrix the matrix of which to compute the LU decomposition.
* It is required to be nonzero.
*/
LU(const MatrixType& matrix);
FullPivLU(const MatrixType& matrix);
/** Computes the LU decomposition of the given matrix.
*
@ -97,11 +97,11 @@ template<typename MatrixType> class LU
*
* \returns a reference to *this
*/
LU& compute(const MatrixType& matrix);
FullPivLU& compute(const MatrixType& matrix);
/** \returns the LU decomposition matrix: the upper-triangular part is U, the
* unit-lower-triangular part is L (at least for square matrices; in the non-square
* case, special care is needed, see the documentation of class LU).
* case, special care is needed, see the documentation of class FullPivLU).
*
* \sa matrixL(), matrixU()
*/
@ -131,7 +131,7 @@ template<typename MatrixType> class LU
/** \returns a vector of integers, whose size is the number of rows of the matrix being decomposed,
* representing the P permutation i.e. the permutation of the rows. For its precise meaning,
* see the examples given in the documentation of class LU.
* see the examples given in the documentation of class FullPivLU.
*
* \sa permutationQ()
*/
@ -143,7 +143,7 @@ template<typename MatrixType> class LU
/** \returns a vector of integers, whose size is the number of columns of the matrix being
* decomposed, representing the Q permutation i.e. the permutation of the columns.
* For its precise meaning, see the examples given in the documentation of class LU.
* For its precise meaning, see the examples given in the documentation of class FullPivLU.
*
* \sa permutationP()
*/
@ -162,8 +162,8 @@ template<typename MatrixType> class LU
* For that, it uses the threshold value that you can control by calling
* setThreshold(const RealScalar&).
*
* Example: \include LU_kernel.cpp
* Output: \verbinclude LU_kernel.out
* Example: \include FullPivLU_kernel.cpp
* Output: \verbinclude FullPivLU_kernel.out
*
* \sa image()
*/
@ -187,8 +187,8 @@ template<typename MatrixType> class LU
* For that, it uses the threshold value that you can control by calling
* setThreshold(const RealScalar&).
*
* Example: \include LU_image.cpp
* Output: \verbinclude LU_image.out
* Example: \include FullPivLU_image.cpp
* Output: \verbinclude FullPivLU_image.out
*
* \sa kernel()
*/
@ -214,8 +214,8 @@ template<typename MatrixType> class LU
* \note_about_arbitrary_choice_of_solution
* \note_about_using_kernel_to_study_multiple_solutions
*
* Example: \include LU_solve.cpp
* Output: \verbinclude LU_solve.out
* Example: \include FullPivLU_solve.cpp
* Output: \verbinclude FullPivLU_solve.out
*
* \sa TriangularView::solve(), kernel(), inverse()
*/
@ -260,7 +260,7 @@ template<typename MatrixType> class LU
*
* If you want to come back to the default behavior, call setThreshold(Default_t)
*/
LU& setThreshold(const RealScalar& threshold)
FullPivLU& setThreshold(const RealScalar& threshold)
{
m_usePrescribedThreshold = true;
m_prescribedThreshold = threshold;
@ -274,7 +274,7 @@ template<typename MatrixType> class LU
*
* See the documentation of setThreshold(const RealScalar&).
*/
LU& setThreshold(Default_t)
FullPivLU& setThreshold(Default_t)
{
m_usePrescribedThreshold = false;
}
@ -383,20 +383,20 @@ template<typename MatrixType> class LU
};
template<typename MatrixType>
LU<MatrixType>::LU()
FullPivLU<MatrixType>::FullPivLU()
: m_isInitialized(false), m_usePrescribedThreshold(false)
{
}
template<typename MatrixType>
LU<MatrixType>::LU(const MatrixType& matrix)
FullPivLU<MatrixType>::FullPivLU(const MatrixType& matrix)
: m_isInitialized(false), m_usePrescribedThreshold(false)
{
compute(matrix);
}
template<typename MatrixType>
LU<MatrixType>& LU<MatrixType>::compute(const MatrixType& matrix)
FullPivLU<MatrixType>& FullPivLU<MatrixType>::compute(const MatrixType& matrix)
{
m_isInitialized = true;
m_lu = matrix;
@ -483,7 +483,7 @@ LU<MatrixType>& LU<MatrixType>::compute(const MatrixType& matrix)
}
template<typename MatrixType>
typename ei_traits<MatrixType>::Scalar LU<MatrixType>::determinant() const
typename ei_traits<MatrixType>::Scalar FullPivLU<MatrixType>::determinant() const
{
ei_assert(m_isInitialized && "LU is not initialized.");
ei_assert(m_lu.rows() == m_lu.cols() && "You can't take the determinant of a non-square matrix!");
@ -511,7 +511,7 @@ struct ei_traits<ei_lu_kernel_impl<MatrixType> >
template<typename MatrixType>
struct ei_lu_kernel_impl : public ReturnByValue<ei_lu_kernel_impl<MatrixType> >
{
typedef LU<MatrixType> LUType;
typedef FullPivLU<MatrixType> LUType;
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::RealScalar RealScalar;
const LUType& m_lu;
@ -615,7 +615,7 @@ struct ei_traits<ei_lu_image_impl<MatrixType> >
template<typename MatrixType>
struct ei_lu_image_impl : public ReturnByValue<ei_lu_image_impl<MatrixType> >
{
typedef LU<MatrixType> LUType;
typedef FullPivLU<MatrixType> LUType;
typedef typename MatrixType::RealScalar RealScalar;
const LUType& m_lu;
int m_rank, m_cols;
@ -670,7 +670,7 @@ template<typename MatrixType, typename Rhs>
struct ei_lu_solve_impl : public ReturnByValue<ei_lu_solve_impl<MatrixType, Rhs> >
{
typedef typename ei_cleantype<typename Rhs::Nested>::type RhsNested;
typedef LU<MatrixType> LUType;
typedef FullPivLU<MatrixType> LUType;
const LUType& m_lu;
const typename Rhs::Nested m_rhs;
@ -739,15 +739,15 @@ struct ei_lu_solve_impl : public ReturnByValue<ei_lu_solve_impl<MatrixType, Rhs>
/** \lu_module
*
* \return the LU decomposition of \c *this.
* \return the full-pivoting LU decomposition of \c *this.
*
* \sa class LU
* \sa class FullPivLU
*/
template<typename Derived>
inline const LU<typename MatrixBase<Derived>::PlainMatrixType>
MatrixBase<Derived>::lu() const
inline const FullPivLU<typename MatrixBase<Derived>::PlainMatrixType>
MatrixBase<Derived>::fullPivLu() const
{
return LU<PlainMatrixType>(eval());
return FullPivLU<PlainMatrixType>(eval());
}
#endif // EIGEN_LU_H

View File

@ -34,7 +34,7 @@ struct ei_compute_inverse
{
static inline void run(const MatrixType& matrix, ResultType& result)
{
result = matrix.partialLu().inverse();
result = matrix.partialPivLu().inverse();
}
};
@ -232,22 +232,31 @@ struct ei_compute_inverse<MatrixType, ResultType, 4>
typename MatrixType::PlainMatrixType matrix(_matrix);
// let's extract from the 2 first colums a 2x2 block whose determinant is as big as possible.
int good_row0=0, good_row1=1;
RealScalar good_absdet(-1);
// this double for loop shouldn't be too costly: only 6 iterations
for(int row0=0; row0<4; ++row0) {
for(int row1=row0+1; row1<4; ++row1)
{
RealScalar absdet = ei_abs(matrix.coeff(row0,0)*matrix.coeff(row1,1)
- matrix.coeff(row0,1)*matrix.coeff(row1,0));
if(absdet > good_absdet)
{
good_absdet = absdet;
good_row0 = row0;
good_row1 = row1;
}
}
}
int good_row0, good_row1, good_i;
Matrix<RealScalar,6,1> absdet;
// any 2x2 block with determinant above this threshold will be considered good enough
RealScalar d = (matrix.col(0).squaredNorm()+matrix.col(1).squaredNorm()) * RealScalar(1e-2);
#define ei_inv_size4_helper_macro(i,row0,row1) \
absdet[i] = ei_abs(matrix.coeff(row0,0)*matrix.coeff(row1,1) \
- matrix.coeff(row0,1)*matrix.coeff(row1,0)); \
if(absdet[i] > d) { good_row0=row0; good_row1=row1; goto good; }
ei_inv_size4_helper_macro(0,0,1)
ei_inv_size4_helper_macro(1,0,2)
ei_inv_size4_helper_macro(2,0,3)
ei_inv_size4_helper_macro(3,1,2)
ei_inv_size4_helper_macro(4,1,3)
ei_inv_size4_helper_macro(5,2,3)
// no 2x2 block has determinant bigger than the threshold. So just take the one that
// has the biggest determinant
absdet.maxCoeff(&good_i);
good_row0 = good_i <= 2 ? 0 : good_i <= 4 ? 1 : 2;
good_row1 = good_i <= 2 ? good_i+1 : good_i <= 4 ? good_i-1 : 3;
// now good_row0 and good_row1 are correctly set
good:
// do row permutations to move this 2x2 block to the top
matrix.row(0).swap(matrix.row(good_row0));
matrix.row(1).swap(matrix.row(good_row1));
@ -318,12 +327,12 @@ struct ei_inverse_impl : public ReturnByValue<ei_inverse_impl<MatrixType> >
* \returns the matrix inverse of this matrix.
*
* For small fixed sizes up to 4x4, this method uses ad-hoc methods (cofactors up to 3x3, Euler's trick for 4x4).
* In the general case, this method uses class PartialLU.
* In the general case, this method uses class PartialPivLU.
*
* \note This matrix must be invertible, otherwise the result is undefined. If you need an
* invertibility check, do the following:
* \li for fixed sizes up to 4x4, use computeInverseAndDetWithCheck().
* \li for the general case, use class LU.
* \li for the general case, use class FullPivLU.
*
* Example: \include MatrixBase_inverse.cpp
* Output: \verbinclude MatrixBase_inverse.out

View File

@ -30,7 +30,7 @@ template<typename MatrixType, typename Rhs> struct ei_partiallu_solve_impl;
/** \ingroup LU_Module
*
* \class PartialLU
* \class PartialPivLU
*
* \brief LU decomposition of a matrix with partial pivoting, and related features
*
@ -46,10 +46,10 @@ template<typename MatrixType, typename Rhs> struct ei_partiallu_solve_impl;
* matrix is invertible: it is your task to check that you only use this decomposition on invertible matrices.
*
* The guaranteed safe alternative, working for all matrices, is the full pivoting LU decomposition, provided
* by class LU.
* by class FullPivLU.
*
* This is \b not a rank-revealing LU decomposition. Many features are intentionally absent from this class,
* such as rank computation. If you need these features, use class LU.
* such as rank computation. If you need these features, use class FullPivLU.
*
* This LU decomposition is suitable to invert invertible matrices. It is what MatrixBase::inverse() uses
* in the general case.
@ -57,9 +57,9 @@ template<typename MatrixType, typename Rhs> struct ei_partiallu_solve_impl;
*
* The data of the LU decomposition can be directly accessed through the methods matrixLU(), permutationP().
*
* \sa MatrixBase::partialLu(), MatrixBase::determinant(), MatrixBase::inverse(), MatrixBase::computeInverse(), class LU
* \sa MatrixBase::partialPivLu(), MatrixBase::determinant(), MatrixBase::inverse(), MatrixBase::computeInverse(), class FullPivLU
*/
template<typename MatrixType> class PartialLU
template<typename MatrixType> class PartialPivLU
{
public:
@ -79,40 +79,40 @@ template<typename MatrixType> class PartialLU
* \brief Default Constructor.
*
* The default constructor is useful in cases in which the user intends to
* perform decompositions via PartialLU::compute(const MatrixType&).
* perform decompositions via PartialPivLU::compute(const MatrixType&).
*/
PartialLU();
PartialPivLU();
/** Constructor.
*
* \param matrix the matrix of which to compute the LU decomposition.
*
* \warning The matrix should have full rank (e.g. if it's square, it should be invertible).
* If you need to deal with non-full rank, use class LU instead.
* If you need to deal with non-full rank, use class FullPivLU instead.
*/
PartialLU(const MatrixType& matrix);
PartialPivLU(const MatrixType& matrix);
PartialLU& compute(const MatrixType& matrix);
PartialPivLU& compute(const MatrixType& matrix);
/** \returns the LU decomposition matrix: the upper-triangular part is U, the
* unit-lower-triangular part is L (at least for square matrices; in the non-square
* case, special care is needed, see the documentation of class LU).
* case, special care is needed, see the documentation of class FullPivLU).
*
* \sa matrixL(), matrixU()
*/
inline const MatrixType& matrixLU() const
{
ei_assert(m_isInitialized && "PartialLU is not initialized.");
ei_assert(m_isInitialized && "PartialPivLU is not initialized.");
return m_lu;
}
/** \returns a vector of integers, whose size is the number of rows of the matrix being decomposed,
* representing the P permutation i.e. the permutation of the rows. For its precise meaning,
* see the examples given in the documentation of class LU.
* see the examples given in the documentation of class FullPivLU.
*/
inline const IntColVectorType& permutationP() const
{
ei_assert(m_isInitialized && "PartialLU is not initialized.");
ei_assert(m_isInitialized && "PartialPivLU is not initialized.");
return m_p;
}
@ -125,10 +125,10 @@ template<typename MatrixType> class PartialLU
*
* \returns the solution.
*
* Example: \include PartialLU_solve.cpp
* Output: \verbinclude PartialLU_solve.out
* Example: \include PartialPivLU_solve.cpp
* Output: \verbinclude PartialPivLU_solve.out
*
* Since this PartialLU class assumes anyway that the matrix A is invertible, the solution
* Since this PartialPivLU class assumes anyway that the matrix A is invertible, the solution
* theoretically exists and is unique regardless of b.
*
* \note_about_checking_solutions
@ -146,7 +146,7 @@ template<typename MatrixType> class PartialLU
/** \returns the inverse of the matrix of which *this is the LU decomposition.
*
* \warning The matrix being decomposed here is assumed to be invertible. If you need to check for
* invertibility, use class LU instead.
* invertibility, use class FullPivLU instead.
*
* \sa MatrixBase::inverse(), LU::inverse()
*/
@ -180,7 +180,7 @@ template<typename MatrixType> class PartialLU
};
template<typename MatrixType>
PartialLU<MatrixType>::PartialLU()
PartialPivLU<MatrixType>::PartialPivLU()
: m_lu(),
m_p(),
m_det_p(0),
@ -189,7 +189,7 @@ PartialLU<MatrixType>::PartialLU()
}
template<typename MatrixType>
PartialLU<MatrixType>::PartialLU(const MatrixType& matrix)
PartialPivLU<MatrixType>::PartialPivLU(const MatrixType& matrix)
: m_lu(),
m_p(),
m_det_p(0),
@ -378,12 +378,12 @@ void ei_partial_lu_inplace(MatrixType& lu, IntVector& row_transpositions, int& n
}
template<typename MatrixType>
PartialLU<MatrixType>& PartialLU<MatrixType>::compute(const MatrixType& matrix)
PartialPivLU<MatrixType>& PartialPivLU<MatrixType>::compute(const MatrixType& matrix)
{
m_lu = matrix;
m_p.resize(matrix.rows());
ei_assert(matrix.rows() == matrix.cols() && "PartialLU is only for square (and moreover invertible) matrices");
ei_assert(matrix.rows() == matrix.cols() && "PartialPivLU is only for square (and moreover invertible) matrices");
const int size = matrix.rows();
IntColVectorType rows_transpositions(size);
@ -401,9 +401,9 @@ PartialLU<MatrixType>& PartialLU<MatrixType>::compute(const MatrixType& matrix)
}
template<typename MatrixType>
typename ei_traits<MatrixType>::Scalar PartialLU<MatrixType>::determinant() const
typename ei_traits<MatrixType>::Scalar PartialPivLU<MatrixType>::determinant() const
{
ei_assert(m_isInitialized && "PartialLU is not initialized.");
ei_assert(m_isInitialized && "PartialPivLU is not initialized.");
return Scalar(m_det_p) * m_lu.diagonal().prod();
}
@ -424,7 +424,7 @@ template<typename MatrixType, typename Rhs>
struct ei_partiallu_solve_impl : public ReturnByValue<ei_partiallu_solve_impl<MatrixType, Rhs> >
{
typedef typename ei_cleantype<typename Rhs::Nested>::type RhsNested;
typedef PartialLU<MatrixType> LUType;
typedef PartialPivLU<MatrixType> LUType;
const LUType& m_lu;
const typename Rhs::Nested m_rhs;
@ -464,15 +464,30 @@ struct ei_partiallu_solve_impl : public ReturnByValue<ei_partiallu_solve_impl<Ma
/** \lu_module
*
* \return the LU decomposition of \c *this.
* \return the partial-pivoting LU decomposition of \c *this.
*
* \sa class LU
* \sa class PartialPivLU
*/
template<typename Derived>
inline const PartialLU<typename MatrixBase<Derived>::PlainMatrixType>
MatrixBase<Derived>::partialLu() const
inline const PartialPivLU<typename MatrixBase<Derived>::PlainMatrixType>
MatrixBase<Derived>::partialPivLu() const
{
return PartialLU<PlainMatrixType>(eval());
return PartialPivLU<PlainMatrixType>(eval());
}
/** \lu_module
*
* Synonym of partialPivLu().
*
* \return the partial-pivoting LU decomposition of \c *this.
*
* \sa class PartialPivLU
*/
template<typename Derived>
inline const PartialPivLU<typename MatrixBase<Derived>::PlainMatrixType>
MatrixBase<Derived>::lu() const
{
return PartialPivLU<PlainMatrixType>(eval());
}
#endif // EIGEN_PARTIALLU_H

View File

@ -29,7 +29,7 @@
/** \ingroup QR_Module
* \nonstableyet
*
* \class ColPivotingHouseholderQR
* \class ColPivHouseholderQR
*
* \brief Householder rank-revealing QR decomposition of a matrix with column-pivoting
*
@ -38,11 +38,11 @@
* This class performs a rank-revealing QR decomposition using Householder transformations.
*
* This decomposition performs column pivoting in order to be rank-revealing and improve
* numerical stability. It is slower than HouseholderQR, and faster than FullPivotingHouseholderQR.
* numerical stability. It is slower than HouseholderQR, and faster than FullPivHouseholderQR.
*
* \sa MatrixBase::colPivotingHouseholderQr()
* \sa MatrixBase::colPivHouseholderQr()
*/
template<typename MatrixType> class ColPivotingHouseholderQR
template<typename MatrixType> class ColPivHouseholderQR
{
public:
@ -68,11 +68,11 @@ template<typename MatrixType> class ColPivotingHouseholderQR
* \brief Default Constructor.
*
* The default constructor is useful in cases in which the user intends to
* perform decompositions via ColPivotingHouseholderQR::compute(const MatrixType&).
* perform decompositions via ColPivHouseholderQR::compute(const MatrixType&).
*/
ColPivotingHouseholderQR() : m_qr(), m_hCoeffs(), m_isInitialized(false) {}
ColPivHouseholderQR() : m_qr(), m_hCoeffs(), m_isInitialized(false) {}
ColPivotingHouseholderQR(const MatrixType& matrix)
ColPivHouseholderQR(const MatrixType& matrix)
: m_qr(matrix.rows(), matrix.cols()),
m_hCoeffs(std::min(matrix.rows(),matrix.cols())),
m_isInitialized(false)
@ -94,8 +94,8 @@ template<typename MatrixType> class ColPivotingHouseholderQR
* \note The case where b is a matrix is not yet implemented. Also, this
* code is space inefficient.
*
* Example: \include ColPivotingHouseholderQR_solve.cpp
* Output: \verbinclude ColPivotingHouseholderQR_solve.out
* Example: \include ColPivHouseholderQR_solve.cpp
* Output: \verbinclude ColPivHouseholderQR_solve.out
*/
template<typename OtherDerived, typename ResultType>
bool solve(const MatrixBase<OtherDerived>& b, ResultType *result) const;
@ -106,15 +106,15 @@ template<typename MatrixType> class ColPivotingHouseholderQR
*/
const MatrixType& matrixQR() const
{
ei_assert(m_isInitialized && "ColPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
return m_qr;
}
ColPivotingHouseholderQR& compute(const MatrixType& matrix);
ColPivHouseholderQR& compute(const MatrixType& matrix);
const IntRowVectorType& colsPermutation() const
{
ei_assert(m_isInitialized && "ColPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
return m_cols_permutation;
}
@ -154,7 +154,7 @@ template<typename MatrixType> class ColPivotingHouseholderQR
*/
inline int rank() const
{
ei_assert(m_isInitialized && "ColPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
return m_rank;
}
@ -165,7 +165,7 @@ template<typename MatrixType> class ColPivotingHouseholderQR
*/
inline int dimensionOfKernel() const
{
ei_assert(m_isInitialized && "ColPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
return m_qr.cols() - m_rank;
}
@ -177,7 +177,7 @@ template<typename MatrixType> class ColPivotingHouseholderQR
*/
inline bool isInjective() const
{
ei_assert(m_isInitialized && "ColPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
return m_rank == m_qr.cols();
}
@ -189,7 +189,7 @@ template<typename MatrixType> class ColPivotingHouseholderQR
*/
inline bool isSurjective() const
{
ei_assert(m_isInitialized && "ColPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
return m_rank == m_qr.rows();
}
@ -200,7 +200,7 @@ template<typename MatrixType> class ColPivotingHouseholderQR
*/
inline bool isInvertible() const
{
ei_assert(m_isInitialized && "ColPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
return isInjective() && isSurjective();
}
@ -215,7 +215,7 @@ template<typename MatrixType> class ColPivotingHouseholderQR
*/
inline void computeInverse(MatrixType *result) const
{
ei_assert(m_isInitialized && "ColPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
ei_assert(m_qr.rows() == m_qr.cols() && "You can't take the inverse of a non-square matrix!");
solve(MatrixType::Identity(m_qr.rows(), m_qr.cols()), result);
}
@ -247,23 +247,23 @@ template<typename MatrixType> class ColPivotingHouseholderQR
#ifndef EIGEN_HIDE_HEAVY_CODE
template<typename MatrixType>
typename MatrixType::RealScalar ColPivotingHouseholderQR<MatrixType>::absDeterminant() const
typename MatrixType::RealScalar ColPivHouseholderQR<MatrixType>::absDeterminant() const
{
ei_assert(m_isInitialized && "ColPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
ei_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!");
return ei_abs(m_qr.diagonal().prod());
}
template<typename MatrixType>
typename MatrixType::RealScalar ColPivotingHouseholderQR<MatrixType>::logAbsDeterminant() const
typename MatrixType::RealScalar ColPivHouseholderQR<MatrixType>::logAbsDeterminant() const
{
ei_assert(m_isInitialized && "ColPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
ei_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!");
return m_qr.diagonal().cwise().abs().cwise().log().sum();
}
template<typename MatrixType>
ColPivotingHouseholderQR<MatrixType>& ColPivotingHouseholderQR<MatrixType>::compute(const MatrixType& matrix)
ColPivHouseholderQR<MatrixType>& ColPivHouseholderQR<MatrixType>::compute(const MatrixType& matrix)
{
int rows = matrix.rows();
int cols = matrix.cols();
@ -333,12 +333,12 @@ ColPivotingHouseholderQR<MatrixType>& ColPivotingHouseholderQR<MatrixType>::comp
template<typename MatrixType>
template<typename OtherDerived, typename ResultType>
bool ColPivotingHouseholderQR<MatrixType>::solve(
bool ColPivHouseholderQR<MatrixType>::solve(
const MatrixBase<OtherDerived>& b,
ResultType *result
) const
{
ei_assert(m_isInitialized && "ColPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
result->resize(m_qr.cols(), b.cols());
if(m_rank==0)
{
@ -378,9 +378,9 @@ bool ColPivotingHouseholderQR<MatrixType>::solve(
/** \returns the matrix Q as a sequence of householder transformations */
template<typename MatrixType>
typename ColPivotingHouseholderQR<MatrixType>::HouseholderSequenceType ColPivotingHouseholderQR<MatrixType>::matrixQ() const
typename ColPivHouseholderQR<MatrixType>::HouseholderSequenceType ColPivHouseholderQR<MatrixType>::matrixQ() const
{
ei_assert(m_isInitialized && "ColPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
return HouseholderSequenceType(m_qr, m_hCoeffs.conjugate());
}
@ -388,13 +388,13 @@ typename ColPivotingHouseholderQR<MatrixType>::HouseholderSequenceType ColPivoti
/** \return the column-pivoting Householder QR decomposition of \c *this.
*
* \sa class ColPivotingHouseholderQR
* \sa class ColPivHouseholderQR
*/
template<typename Derived>
const ColPivotingHouseholderQR<typename MatrixBase<Derived>::PlainMatrixType>
MatrixBase<Derived>::colPivotingHouseholderQr() const
const ColPivHouseholderQR<typename MatrixBase<Derived>::PlainMatrixType>
MatrixBase<Derived>::colPivHouseholderQr() const
{
return ColPivotingHouseholderQR<PlainMatrixType>(eval());
return ColPivHouseholderQR<PlainMatrixType>(eval());
}

View File

@ -29,7 +29,7 @@
/** \ingroup QR_Module
* \nonstableyet
*
* \class FullPivotingHouseholderQR
* \class FullPivHouseholderQR
*
* \brief Householder rank-revealing QR decomposition of a matrix with full pivoting
*
@ -38,11 +38,11 @@
* This class performs a rank-revealing QR decomposition using Householder transformations.
*
* This decomposition performs a very prudent full pivoting in order to be rank-revealing and achieve optimal
* numerical stability. The trade-off is that it is slower than HouseholderQR and ColPivotingHouseholderQR.
* numerical stability. The trade-off is that it is slower than HouseholderQR and ColPivHouseholderQR.
*
* \sa MatrixBase::fullPivotingHouseholderQr()
* \sa MatrixBase::fullPivHouseholderQr()
*/
template<typename MatrixType> class FullPivotingHouseholderQR
template<typename MatrixType> class FullPivHouseholderQR
{
public:
@ -65,11 +65,11 @@ template<typename MatrixType> class FullPivotingHouseholderQR
/** \brief Default Constructor.
*
* The default constructor is useful in cases in which the user intends to
* perform decompositions via FullPivotingHouseholderQR::compute(const MatrixType&).
* perform decompositions via FullPivHouseholderQR::compute(const MatrixType&).
*/
FullPivotingHouseholderQR() : m_isInitialized(false) {}
FullPivHouseholderQR() : m_isInitialized(false) {}
FullPivotingHouseholderQR(const MatrixType& matrix)
FullPivHouseholderQR(const MatrixType& matrix)
: m_isInitialized(false)
{
compute(matrix);
@ -89,8 +89,8 @@ template<typename MatrixType> class FullPivotingHouseholderQR
* \note The case where b is a matrix is not yet implemented. Also, this
* code is space inefficient.
*
* Example: \include FullPivotingHouseholderQR_solve.cpp
* Output: \verbinclude FullPivotingHouseholderQR_solve.out
* Example: \include FullPivHouseholderQR_solve.cpp
* Output: \verbinclude FullPivHouseholderQR_solve.out
*/
template<typename OtherDerived, typename ResultType>
bool solve(const MatrixBase<OtherDerived>& b, ResultType *result) const;
@ -101,21 +101,21 @@ template<typename MatrixType> class FullPivotingHouseholderQR
*/
const MatrixType& matrixQR() const
{
ei_assert(m_isInitialized && "FullPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
return m_qr;
}
FullPivotingHouseholderQR& compute(const MatrixType& matrix);
FullPivHouseholderQR& compute(const MatrixType& matrix);
const IntRowVectorType& colsPermutation() const
{
ei_assert(m_isInitialized && "FullPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
return m_cols_permutation;
}
const IntColVectorType& rowsTranspositions() const
{
ei_assert(m_isInitialized && "FullPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
return m_rows_transpositions;
}
@ -155,7 +155,7 @@ template<typename MatrixType> class FullPivotingHouseholderQR
*/
inline int rank() const
{
ei_assert(m_isInitialized && "FullPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
return m_rank;
}
@ -166,7 +166,7 @@ template<typename MatrixType> class FullPivotingHouseholderQR
*/
inline int dimensionOfKernel() const
{
ei_assert(m_isInitialized && "FullPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
return m_qr.cols() - m_rank;
}
@ -178,7 +178,7 @@ template<typename MatrixType> class FullPivotingHouseholderQR
*/
inline bool isInjective() const
{
ei_assert(m_isInitialized && "FullPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
return m_rank == m_qr.cols();
}
@ -190,7 +190,7 @@ template<typename MatrixType> class FullPivotingHouseholderQR
*/
inline bool isSurjective() const
{
ei_assert(m_isInitialized && "FullPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
return m_rank == m_qr.rows();
}
@ -201,7 +201,7 @@ template<typename MatrixType> class FullPivotingHouseholderQR
*/
inline bool isInvertible() const
{
ei_assert(m_isInitialized && "FullPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
return isInjective() && isSurjective();
}
@ -216,7 +216,7 @@ template<typename MatrixType> class FullPivotingHouseholderQR
*/
inline void computeInverse(MatrixType *result) const
{
ei_assert(m_isInitialized && "FullPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
ei_assert(m_qr.rows() == m_qr.cols() && "You can't take the inverse of a non-square matrix!");
solve(MatrixType::Identity(m_qr.rows(), m_qr.cols()), result);
}
@ -249,23 +249,23 @@ template<typename MatrixType> class FullPivotingHouseholderQR
#ifndef EIGEN_HIDE_HEAVY_CODE
template<typename MatrixType>
typename MatrixType::RealScalar FullPivotingHouseholderQR<MatrixType>::absDeterminant() const
typename MatrixType::RealScalar FullPivHouseholderQR<MatrixType>::absDeterminant() const
{
ei_assert(m_isInitialized && "FullPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
ei_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!");
return ei_abs(m_qr.diagonal().prod());
}
template<typename MatrixType>
typename MatrixType::RealScalar FullPivotingHouseholderQR<MatrixType>::logAbsDeterminant() const
typename MatrixType::RealScalar FullPivHouseholderQR<MatrixType>::logAbsDeterminant() const
{
ei_assert(m_isInitialized && "FullPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
ei_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!");
return m_qr.diagonal().cwise().abs().cwise().log().sum();
}
template<typename MatrixType>
FullPivotingHouseholderQR<MatrixType>& FullPivotingHouseholderQR<MatrixType>::compute(const MatrixType& matrix)
FullPivHouseholderQR<MatrixType>& FullPivHouseholderQR<MatrixType>::compute(const MatrixType& matrix)
{
int rows = matrix.rows();
int cols = matrix.cols();
@ -342,12 +342,12 @@ FullPivotingHouseholderQR<MatrixType>& FullPivotingHouseholderQR<MatrixType>::co
template<typename MatrixType>
template<typename OtherDerived, typename ResultType>
bool FullPivotingHouseholderQR<MatrixType>::solve(
bool FullPivHouseholderQR<MatrixType>::solve(
const MatrixBase<OtherDerived>& b,
ResultType *result
) const
{
ei_assert(m_isInitialized && "FullPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
result->resize(m_qr.cols(), b.cols());
if(m_rank==0)
{
@ -393,9 +393,9 @@ bool FullPivotingHouseholderQR<MatrixType>::solve(
/** \returns the matrix Q */
template<typename MatrixType>
typename FullPivotingHouseholderQR<MatrixType>::MatrixQType FullPivotingHouseholderQR<MatrixType>::matrixQ() const
typename FullPivHouseholderQR<MatrixType>::MatrixQType FullPivHouseholderQR<MatrixType>::matrixQ() const
{
ei_assert(m_isInitialized && "FullPivotingHouseholderQR is not initialized.");
ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
// compute the product H'_0 H'_1 ... H'_n-1,
// where H_k is the k-th Householder transformation I - h_k v_k v_k'
// and v_k is the k-th Householder vector [1,m_qr(k+1,k), m_qr(k+2,k), ...]
@ -417,13 +417,13 @@ typename FullPivotingHouseholderQR<MatrixType>::MatrixQType FullPivotingHousehol
/** \return the full-pivoting Householder QR decomposition of \c *this.
*
* \sa class FullPivotingHouseholderQR
* \sa class FullPivHouseholderQR
*/
template<typename Derived>
const FullPivotingHouseholderQR<typename MatrixBase<Derived>::PlainMatrixType>
MatrixBase<Derived>::fullPivotingHouseholderQr() const
const FullPivHouseholderQR<typename MatrixBase<Derived>::PlainMatrixType>
MatrixBase<Derived>::fullPivHouseholderQr() const
{
return FullPivotingHouseholderQR<PlainMatrixType>(eval());
return FullPivHouseholderQR<PlainMatrixType>(eval());
}
#endif // EIGEN_FULLPIVOTINGHOUSEHOLDERQR_H

View File

@ -39,10 +39,10 @@
* stored in a compact way compatible with LAPACK.
*
* Note that no pivoting is performed. This is \b not a rank-revealing decomposition.
* If you want that feature, use FullPivotingHouseholderQR or ColPivotingHouseholderQR instead.
* If you want that feature, use FullPivHouseholderQR or ColPivHouseholderQR instead.
*
* This Householder QR decomposition is faster, but less numerically stable and less feature-full than
* FullPivotingHouseholderQR or ColPivotingHouseholderQR.
* FullPivHouseholderQR or ColPivHouseholderQR.
*
* \sa MatrixBase::householderQr()
*/

View File

@ -233,7 +233,7 @@ struct ei_svd_precondition_if_more_rows_than_cols<MatrixType, Options, true>
int diagSize = cols;
if(rows > cols)
{
FullPivotingHouseholderQR<MatrixType> qr(matrix);
FullPivHouseholderQR<MatrixType> qr(matrix);
work_matrix = qr.matrixQR().block(0,0,diagSize,diagSize).template triangularView<UpperTriangular>();
if(ComputeU) svd.m_matrixU = qr.matrixQ();
if(ComputeV)
@ -278,7 +278,7 @@ struct ei_svd_precondition_if_more_cols_than_rows<MatrixType, Options, true>
typedef Matrix<Scalar,ColsAtCompileTime,RowsAtCompileTime,
MatrixOptions,MaxColsAtCompileTime,MaxRowsAtCompileTime>
TransposeTypeWithSameStorageOrder;
FullPivotingHouseholderQR<TransposeTypeWithSameStorageOrder> qr(matrix.adjoint());
FullPivHouseholderQR<TransposeTypeWithSameStorageOrder> qr(matrix.adjoint());
work_matrix = qr.matrixQR().block(0,0,diagSize,diagSize).template triangularView<UpperTriangular>().adjoint();
if(ComputeV) svd.m_matrixV = qr.matrixQ();
if(ComputeU)

View File

@ -39,7 +39,7 @@ enum {
*
* \param MatrixType the type of the matrix of which we are computing the LU factorization
*
* \sa class LU, class SparseLLT
* \sa class FullPivLU, class SparseLLT
*/
template<typename MatrixType, int Backend = DefaultBackend>
class SparseLU

View File

@ -218,7 +218,7 @@ public :
}
static inline void partial_lu_decomp(const gene_matrix & X, gene_matrix & C, int N){
C = X.partialLu().matrixLU();
C = X.partialPivLu().matrixLU();
}
static inline void tridiagonalization(const gene_matrix & X, gene_matrix & C, int N){

View File

@ -98,7 +98,7 @@ int main(int argc, char *argv[])
BenchTimer timer;
timer.start();
LU<DenseMatrix> lu(m1);
FullPivLU<DenseMatrix> lu(m1);
timer.stop();
std::cout << "Eigen/dense:\t" << timer.value() << endl;

View File

@ -70,6 +70,10 @@ macro(ei_add_test_internal testname testname_with_suffix)
# for the debug target, add full debug options
if(CMAKE_COMPILER_IS_GNUCXX)
# disable debug symbols: i get 2 GB of them!
# the user can still use the debug targets as needed.
# for MSVC, the equivalent (release mode) does the same.
ei_add_target_property(${targetname} COMPILE_FLAGS "-g0")
# O0 is in principle redundant here, but doesn't hurt
ei_add_target_property(${debug_targetname} COMPILE_FLAGS "-O0 -g3")
elseif(MSVC)
@ -139,7 +143,7 @@ endmacro(ei_add_test_internal)
# B. Multi-part behavior
#
# If the source file matches the regexp
# CALL_SUBTEST[0-9]+|EIGEN_TEST_PART_[0-9]+
# CALL_SUBTEST(-9]+|EIGEN_TEST_PART_[0-9]+
# then it is interpreted as a multi-part test. The behavior then depends on the
# CMake option EIGEN_SPLIT_LARGE_TESTS, which is ON by default.
#
@ -162,33 +166,31 @@ endmacro(ei_add_test_internal)
macro(ei_add_test testname)
file(READ "${testname}.cpp" test_source)
set(parts 0)
string(REGEX MATCHALL "CALL_SUBTEST[0-9]+|EIGEN_TEST_PART_[0-9]+" occurences "${test_source}")
foreach(occurence ${occurences})
string(REGEX MATCH "([0-9]+)" _number_in_occurence "${occurence}")
set(number ${CMAKE_MATCH_1})
if(${number} GREATER ${parts})
set(parts ${number})
endif(${number} GREATER ${parts})
endforeach(occurence)
if(EIGEN_SPLIT_LARGE_TESTS AND (parts GREATER 0))
string(REGEX MATCHALL "CALL_SUBTEST_[0-9]+|EIGEN_TEST_PART_[0-9]+"
occurences "${test_source}")
string(REGEX REPLACE "CALL_SUBTEST_|EIGEN_TEST_PART_" "" suffixes "${occurences}")
list(REMOVE_DUPLICATES suffixes)
if(EIGEN_SPLIT_LARGE_TESTS AND suffixes)
add_custom_target(test_${testname})
if(NOT MSVC_IDE)
add_custom_target(debug_${testname})
endif(NOT MSVC_IDE)
foreach(part RANGE 1 ${parts})
ei_add_test_internal(${testname} ${testname}_${part} "${ARGV1} -DEIGEN_TEST_PART_${part}" "${ARGV2}")
add_dependencies(test_${testname} test_${testname}_${part})
foreach(suffix ${suffixes})
ei_add_test_internal(${testname} ${testname}_${suffix}
"${ARGV1} -DEIGEN_TEST_PART_${suffix}=1" "${ARGV2}")
add_dependencies(test_${testname} test_${testname}_${suffix})
if(NOT MSVC_IDE)
add_dependencies(debug_${testname} debug_${testname}_${part})
add_dependencies(debug_${testname} debug_${testname}_${suffix})
endif(NOT MSVC_IDE)
endforeach(part)
else(EIGEN_SPLIT_LARGE_TESTS AND (parts GREATER 0))
endforeach(suffix)
else(EIGEN_SPLIT_LARGE_TESTS AND suffixes)
set(symbols_to_enable_all_parts "")
foreach(part RANGE 1 ${parts})
set(symbols_to_enable_all_parts "${symbols_to_enable_all_parts} -DEIGEN_TEST_PART_${part}")
endforeach(part)
foreach(suffix ${suffixes})
set(symbols_to_enable_all_parts
"${symbols_to_enable_all_parts} -DEIGEN_TEST_PART_${suffix}=1")
endforeach(suffix)
ei_add_test_internal(${testname} ${testname} "${ARGV1} ${symbols_to_enable_all_parts}" "${ARGV2}")
endif(EIGEN_SPLIT_LARGE_TESTS AND (parts GREATER 0))
endif(EIGEN_SPLIT_LARGE_TESTS AND suffixes)
endmacro(ei_add_test)
# print a summary of the different options

View File

@ -55,8 +55,8 @@ matrix with a vector or another matrix: \f$ A^{-1} \mathbf{v} \f$ or \f$ A^{-1}
This is a general-purpose algorithm which performs well in most cases (provided the matrix \f$ A \f$
is invertible), so if you are unsure about which algorithm to pick, choose this. The method proceeds
in two steps. First, the %LU decomposition with partial pivoting is computed using the
MatrixBase::partialLu() function. This yields an object of the class PartialLU. Then, the
PartialLU::solve() method is called to compute a solution.
MatrixBase::partialPivLu() function. This yields an object of the class PartialPivLU. Then, the
PartialPivLU::solve() method is called to compute a solution.
As an example, suppose we want to solve the following system of linear equations:
@ -69,9 +69,9 @@ As an example, suppose we want to solve the following system of linear equations
The following program solves this system:
<table class="tutorial_code"><tr><td>
\include Tutorial_PartialLU_solve.cpp
\include Tutorial_PartialPivLU_solve.cpp
</td><td>
output: \include Tutorial_PartialLU_solve.out
output: \include Tutorial_PartialPivLU_solve.out
</td></tr></table>
There are many situations in which we want to solve the same system of equations with different
@ -91,7 +91,7 @@ problem, and whether you want to solve it at all, after you solved the first pro
case, it's best to save the %LU decomposition and reuse it to solve the second problem. This is
worth the effort because computing the %LU decomposition is much more expensive than using it to
solve the equation. Here is some code to illustrate the procedure. It uses the constructor
PartialLU::PartialLU(const MatrixType&) to compute the %LU decomposition.
PartialPivLU::PartialPivLU(const MatrixType&) to compute the %LU decomposition.
<table class="tutorial_code"><tr><td>
\include Tutorial_solve_reuse_decomposition.cpp
@ -102,7 +102,7 @@ output: \include Tutorial_solve_reuse_decomposition.out
\b Warning: All this code presumes that the matrix \f$ A \f$ is invertible, so that the system
\f$ A \mathbf{x} = \mathbf{b} \f$ has a unique solution. If the matrix \f$ A \f$ is not invertible,
then the system \f$ A \mathbf{x} = \mathbf{b} \f$ has either zero or infinitely many solutions. In
both cases, PartialLU::solve() will give nonsense results. For example, suppose that we want to
both cases, PartialPivLU::solve() will give nonsense results. For example, suppose that we want to
solve the same system as above, but with the 10 in the last equation replaced by 9. Then the system
of equations is inconsistent: adding the first and the third equation gives \f$ 8x + 10y + 12z = 7 \f$,
which implies \f$ 4x + 5y + 6z = 3\frac12 \f$, in contradiction with the second equation. If we try
@ -114,10 +114,10 @@ to solve this inconsistent system with Eigen, we find:
output: \include Tutorial_solve_singular.out
</td></tr></table>
The %LU decomposition with \b full pivoting (class LU) and the singular value decomposition (class
The %LU decomposition with \b full pivoting (class FullPivLU) and the singular value decomposition (class
SVD) may be helpful in this case, as explained in the section \ref TutorialAdvSolvers_Misc below.
\sa LU_Module, MatrixBase::partialLu(), PartialLU::solve(), class PartialLU.
\sa LU_Module, MatrixBase::partialPivLu(), PartialPivLU::solve(), class PartialPivLU.
\subsection TutorialAdvSolvers_Cholesky Cholesky decomposition
@ -228,7 +228,7 @@ Note that the function inverse() is defined in the \ref LU_Module.
Finally, Eigen also offer solvers based on a singular value decomposition (%SVD) or the %LU
decomposition with full pivoting. These have the same API as the solvers based on the %LU
decomposition with partial pivoting (PartialLU).
decomposition with partial pivoting (PartialPivLU).
The solver based on the %SVD uses the class SVD. It can handle singular matrices. Here is an example
of its use:
@ -245,7 +245,7 @@ svdOfA.solve(b, &x);
\endcode
%LU decomposition with full pivoting has better numerical stability than %LU decomposition with
partial pivoting. It is defined in the class LU. The solver can also handle singular matrices.
partial pivoting. It is defined in the class FullPivLU. The solver can also handle singular matrices.
\code
#include <Eigen/LU>
@ -254,13 +254,13 @@ MatrixXf A = MatrixXf::Random(20,20);
VectorXf b = VectorXf::Random(20);
VectorXf x;
A.lu().solve(b, &x);
LU<MatrixXf> luOfA(A);
FullPivLU<MatrixXf> luOfA(A);
luOfA.solve(b, &x);
\endcode
See the section \ref TutorialAdvLU below.
\sa class SVD, SVD::solve(), SVD_Module, class LU, LU::solve(), LU_Module.
\sa class SVD, SVD::solve(), SVD_Module, class FullPivLU, LU::solve(), LU_Module.
@ -281,7 +281,7 @@ Alternatively, you can construct a named LU decomposition, which allows you to r
\code
#include <Eigen/LU>
MatrixXf A = MatrixXf::Random(20,20);
Eigen::LU<MatrixXf> lu(A);
Eigen::FullPivLU<MatrixXf> lu(A);
cout << "The rank of A is" << lu.rank() << endl;
if(lu.isInvertible()) {
cout << "A is invertible, its inverse is:" << endl << lu.inverse() << endl;
@ -292,7 +292,7 @@ else {
}
\endcode
\sa LU_Module, LU::solve(), class LU
\sa LU_Module, LU::solve(), class FullPivLU
<a href="#" class="top">top</a>\section TutorialAdvCholesky Cholesky
todo

View File

@ -12,6 +12,6 @@ int main(int, char *[])
b << 3, 3, 4;
cout << "Here is the matrix A:" << endl << A << endl;
cout << "Here is the vector b:" << endl << b << endl;
Vector3f x = A.partialLu().solve(b);
Vector3f x = A.lu().solve(b);
cout << "The solution is:" << endl << x << endl;
}

View File

@ -2,6 +2,6 @@ MatrixXd A = MatrixXd::Random(3,3);
MatrixXd B = MatrixXd::Random(3,2);
cout << "Here is the invertible matrix A:" << endl << A << endl;
cout << "Here is the matrix B:" << endl << B << endl;
MatrixXd X = A.partialLu().solve(B);
MatrixXd X = A.lu().solve(B);
cout << "Here is the (unique) solution X to the equation AX=B:" << endl << X << endl;
cout << "Relative error: " << (A*X-B).norm() / B.norm() << endl;

View File

@ -3,7 +3,7 @@ A << 1,2,3, 4,5,6, 7,8,10;
Matrix<float,3,2> B;
B << 3,1, 3,1, 4,1;
Matrix<float,3,2> X;
X = A.partialLu().solve(B);
X = A.lu().solve(B);
cout << "The solution with right-hand side (3,3,4) is:" << endl;
cout << X.col(0) << endl;
cout << "The solution with right-hand side (1,1,1) is:" << endl;

View File

@ -1,6 +1,6 @@
Matrix3f A(3,3);
A << 1,2,3, 4,5,6, 7,8,10;
PartialLU<Matrix3f> luOfA(A); // compute LU decomposition of A
PartialPivLU<Matrix3f> luOfA(A); // compute LU decomposition of A
Vector3f b;
b << 3,3,4;
Vector3f x;

View File

@ -5,5 +5,5 @@ b << 3, 3, 4;
cout << "Here is the matrix A:" << endl << A << endl;
cout << "Here is the vector b:" << endl << b << endl;
Vector3f x;
x = A.partialLu().solve(b);
x = A.lu().solve(b);
cout << "The solution is:" << endl << x << endl;

View File

@ -2,7 +2,7 @@ typedef Matrix<double, 5, 3> Matrix5x3;
typedef Matrix<double, 5, 5> Matrix5x5;
Matrix5x3 m = Matrix5x3::Random();
cout << "Here is the matrix m:" << endl << m << endl;
Eigen::LU<Matrix5x3> lu(m);
Eigen::FullPivLU<Matrix5x3> lu(m);
cout << "Here is, up to permutations, its LU decomposition matrix:"
<< endl << lu.matrixLU() << endl;
cout << "Here is the L part:" << endl;

View File

@ -108,16 +108,17 @@ template<typename MatrixType> void adjoint(const MatrixType& m)
void test_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>()) );
#ifdef EIGEN_TEST_PART_4
{
MatrixXcf a(10,10), b(10,10);
VERIFY_RAISES_ASSERT(a = a.transpose());
@ -128,5 +129,6 @@ void test_adjoint()
VERIFY_RAISES_ASSERT(a = a.adjoint() + b);
VERIFY_RAISES_ASSERT(a = b + a.adjoint());
}
#endif
}

View File

@ -146,26 +146,26 @@ template<typename VectorType> void lpNorm(const VectorType& v)
void test_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_7( lpNorm(Vector3d()) );
CALL_SUBTEST_8( lpNorm(Vector4f()) );
CALL_SUBTEST_5( lpNorm(VectorXf(16)) );
CALL_SUBTEST_4( lpNorm(VectorXcf(10)) );
}
}

View File

@ -76,11 +76,11 @@ template<typename MatrixType> void replicate(const MatrixType& m)
void test_array_replicate()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( replicate(Matrix<float, 1, 1>()) );
CALL_SUBTEST( replicate(Vector2f()) );
CALL_SUBTEST( replicate(Vector3d()) );
CALL_SUBTEST( replicate(Vector4f()) );
CALL_SUBTEST( replicate(VectorXf(16)) );
CALL_SUBTEST( replicate(VectorXcd(10)) );
CALL_SUBTEST_1( replicate(Matrix<float, 1, 1>()) );
CALL_SUBTEST_2( replicate(Vector2f()) );
CALL_SUBTEST_3( replicate(Vector3d()) );
CALL_SUBTEST_4( replicate(Vector4f()) );
CALL_SUBTEST_5( replicate(VectorXf(16)) );
CALL_SUBTEST_6( replicate(VectorXcd(10)) );
}
}

View File

@ -163,19 +163,20 @@ template<typename MatrixType> void reverse(const MatrixType& m)
void test_array_reverse()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( reverse(Matrix<float, 1, 1>()) );
CALL_SUBTEST( reverse(Matrix2f()) );
CALL_SUBTEST( reverse(Matrix4f()) );
CALL_SUBTEST( reverse(Matrix4d()) );
CALL_SUBTEST( reverse(MatrixXcf(3, 3)) );
CALL_SUBTEST( reverse(MatrixXi(6, 3)) );
CALL_SUBTEST( reverse(MatrixXcd(20, 20)) );
CALL_SUBTEST( reverse(Matrix<float, 100, 100>()) );
CALL_SUBTEST( reverse(Matrix<float,Dynamic,Dynamic,RowMajor>(6,3)) );
CALL_SUBTEST_1( reverse(Matrix<float, 1, 1>()) );
CALL_SUBTEST_2( reverse(Matrix2f()) );
CALL_SUBTEST_3( reverse(Matrix4f()) );
CALL_SUBTEST_4( reverse(Matrix4d()) );
CALL_SUBTEST_5( reverse(MatrixXcf(3, 3)) );
CALL_SUBTEST_6( reverse(MatrixXi(6, 3)) );
CALL_SUBTEST_7( reverse(MatrixXcd(20, 20)) );
CALL_SUBTEST_8( reverse(Matrix<float, 100, 100>()) );
CALL_SUBTEST_9( reverse(Matrix<float,Dynamic,Dynamic,RowMajor>(6,3)) );
}
#ifdef EIGEN_TEST_PART_3
Vector4f x; x << 1, 2, 3, 4;
Vector4f y; y << 4, 3, 2, 1;
VERIFY(x.reverse()[1] == 3);
VERIFY(x.reverse() == y);
#endif
}

View File

@ -79,6 +79,6 @@ void test_bandmatrix()
int cols = ei_random<int>(1,10);
int sups = ei_random<int>(0,cols-1);
int subs = ei_random<int>(0,rows-1);
CALL_SUBTEST( bandmatrix(BandMatrix<float>(rows,cols,sups,subs)) );
CALL_SUBTEST(bandmatrix(BandMatrix<float>(rows,cols,sups,subs)) );
}
}

View File

@ -146,17 +146,17 @@ void casting()
void test_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)) );
CALL_SUBTEST( basicStuffComplex(MatrixXcf(21, 17)) );
CALL_SUBTEST( basicStuffComplex(MatrixXcd(2, 3)) );
CALL_SUBTEST_3( basicStuffComplex(MatrixXcf(21, 17)) );
CALL_SUBTEST_5( basicStuffComplex(MatrixXcd(2, 3)) );
}
CALL_SUBTEST(casting());
CALL_SUBTEST_2(casting());
}

View File

@ -148,17 +148,17 @@ template<typename MatrixType> void cholesky_verify_assert()
void test_cholesky()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( cholesky(Matrix<double,1,1>()) );
CALL_SUBTEST( cholesky(MatrixXd(1,1)) );
CALL_SUBTEST( cholesky(Matrix2d()) );
CALL_SUBTEST( cholesky(Matrix3f()) );
CALL_SUBTEST( cholesky(Matrix4d()) );
CALL_SUBTEST( cholesky(MatrixXd(200,200)) );
CALL_SUBTEST( cholesky(MatrixXcd(100,100)) );
CALL_SUBTEST_1( cholesky(Matrix<double,1,1>()) );
CALL_SUBTEST_2( cholesky(MatrixXd(1,1)) );
CALL_SUBTEST_3( cholesky(Matrix2d()) );
CALL_SUBTEST_4( cholesky(Matrix3f()) );
CALL_SUBTEST_5( cholesky(Matrix4d()) );
CALL_SUBTEST_2( cholesky(MatrixXd(200,200)) );
CALL_SUBTEST_6( cholesky(MatrixXcd(100,100)) );
}
CALL_SUBTEST( cholesky_verify_assert<Matrix3f>() );
CALL_SUBTEST( cholesky_verify_assert<Matrix3d>() );
CALL_SUBTEST( cholesky_verify_assert<MatrixXf>() );
CALL_SUBTEST( cholesky_verify_assert<MatrixXd>() );
CALL_SUBTEST_4( cholesky_verify_assert<Matrix3f>() );
CALL_SUBTEST_7( cholesky_verify_assert<Matrix3d>() );
CALL_SUBTEST_8( cholesky_verify_assert<MatrixXf>() );
CALL_SUBTEST_2( cholesky_verify_assert<MatrixXd>() );
}

View File

@ -110,20 +110,20 @@ void run_vector_tests()
void test_conservative_resize()
{
run_matrix_tests<int, Eigen::RowMajor>();
run_matrix_tests<int, Eigen::ColMajor>();
run_matrix_tests<float, Eigen::RowMajor>();
run_matrix_tests<float, Eigen::ColMajor>();
run_matrix_tests<double, Eigen::RowMajor>();
run_matrix_tests<double, Eigen::ColMajor>();
run_matrix_tests<std::complex<float>, Eigen::RowMajor>();
run_matrix_tests<std::complex<float>, Eigen::ColMajor>();
run_matrix_tests<std::complex<double>, Eigen::RowMajor>();
run_matrix_tests<std::complex<double>, Eigen::ColMajor>();
CALL_SUBTEST_1((run_matrix_tests<int, Eigen::RowMajor>()));
CALL_SUBTEST_1((run_matrix_tests<int, Eigen::ColMajor>()));
CALL_SUBTEST_2((run_matrix_tests<float, Eigen::RowMajor>()));
CALL_SUBTEST_2((run_matrix_tests<float, Eigen::ColMajor>()));
CALL_SUBTEST_3((run_matrix_tests<double, Eigen::RowMajor>()));
CALL_SUBTEST_3((run_matrix_tests<double, Eigen::ColMajor>()));
CALL_SUBTEST_4((run_matrix_tests<std::complex<float>, Eigen::RowMajor>()));
CALL_SUBTEST_4((run_matrix_tests<std::complex<float>, Eigen::ColMajor>()));
CALL_SUBTEST_5((run_matrix_tests<std::complex<double>, Eigen::RowMajor>()));
CALL_SUBTEST_6((run_matrix_tests<std::complex<double>, Eigen::ColMajor>()));
run_vector_tests<int>();
run_vector_tests<float>();
run_vector_tests<double>();
run_vector_tests<std::complex<float> >();
run_vector_tests<std::complex<double> >();
CALL_SUBTEST_1((run_vector_tests<int>()));
CALL_SUBTEST_2((run_vector_tests<float>()));
CALL_SUBTEST_3((run_vector_tests<double>()));
CALL_SUBTEST_4((run_vector_tests<std::complex<float> >()));
CALL_SUBTEST_5((run_vector_tests<std::complex<double> >()));
}

View File

@ -163,11 +163,11 @@ template<typename MatrixType> void cwiseops(const MatrixType& m)
void test_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_4( cwiseops(MatrixXf(22, 22)) );
CALL_SUBTEST_5( cwiseops(MatrixXi(8, 12)) );
CALL_SUBTEST_6( cwiseops(MatrixXd(20, 20)) );
}
}

View File

@ -65,12 +65,12 @@ template<typename MatrixType> void determinant(const MatrixType& m)
void test_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)) );
}

View File

@ -95,14 +95,14 @@ template<typename MatrixType> void diagonalmatrices(const MatrixType& m)
void test_diagonalmatrices()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( diagonalmatrices(Matrix<float, 1, 1>()) );
CALL_SUBTEST( diagonalmatrices(Matrix3f()) );
CALL_SUBTEST( diagonalmatrices(Matrix<double,3,3,RowMajor>()) );
CALL_SUBTEST( diagonalmatrices(Matrix4d()) );
CALL_SUBTEST( diagonalmatrices(Matrix<float,4,4,RowMajor>()) );
CALL_SUBTEST( diagonalmatrices(MatrixXcf(3, 5)) );
CALL_SUBTEST( diagonalmatrices(MatrixXi(10, 8)) );
CALL_SUBTEST( diagonalmatrices(Matrix<double,Dynamic,Dynamic,RowMajor>(20, 20)) );
CALL_SUBTEST( diagonalmatrices(MatrixXf(21, 24)) );
CALL_SUBTEST_1( diagonalmatrices(Matrix<float, 1, 1>()) );
CALL_SUBTEST_2( diagonalmatrices(Matrix3f()) );
CALL_SUBTEST_3( diagonalmatrices(Matrix<double,3,3,RowMajor>()) );
CALL_SUBTEST_4( diagonalmatrices(Matrix4d()) );
CALL_SUBTEST_5( diagonalmatrices(Matrix<float,4,4,RowMajor>()) );
CALL_SUBTEST_6( diagonalmatrices(MatrixXcf(3, 5)) );
CALL_SUBTEST_7( diagonalmatrices(MatrixXi(10, 8)) );
CALL_SUBTEST_8( diagonalmatrices(Matrix<double,Dynamic,Dynamic,RowMajor>(20, 20)) );
CALL_SUBTEST_9( diagonalmatrices(MatrixXf(21, 24)) );
}
}

View File

@ -112,11 +112,11 @@ void test_dynalloc()
for (int i=0; i<g_repeat*100; ++i)
{
CALL_SUBTEST( check_dynaligned<Vector4f>() );
CALL_SUBTEST( check_dynaligned<Vector2d>() );
CALL_SUBTEST( check_dynaligned<Matrix4f>() );
CALL_SUBTEST( check_dynaligned<Vector4d>() );
CALL_SUBTEST( check_dynaligned<Vector4i>() );
CALL_SUBTEST(check_dynaligned<Vector4f>() );
CALL_SUBTEST(check_dynaligned<Vector2d>() );
CALL_SUBTEST(check_dynaligned<Matrix4f>() );
CALL_SUBTEST(check_dynaligned<Vector4d>() );
CALL_SUBTEST(check_dynaligned<Vector4i>() );
}
// check static allocation, who knows ?

View File

@ -54,8 +54,8 @@ template<typename MatrixType> void eigensolver(const MatrixType& m)
void test_eigensolver_complex()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST1( eigensolver(Matrix4cf()) );
CALL_SUBTEST2( eigensolver(MatrixXcd(14,14)) );
CALL_SUBTEST_1( eigensolver(Matrix4cf()) );
CALL_SUBTEST_2( eigensolver(MatrixXcd(14,14)) );
}
}

View File

@ -75,18 +75,18 @@ template<typename MatrixType> void eigensolver_verify_assert()
void test_eigensolver_generic()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST1( eigensolver(Matrix4f()) );
CALL_SUBTEST2( eigensolver(MatrixXd(17,17)) );
CALL_SUBTEST_1( eigensolver(Matrix4f()) );
CALL_SUBTEST_2( eigensolver(MatrixXd(17,17)) );
// some trivial but implementation-wise tricky cases
CALL_SUBTEST2( eigensolver(MatrixXd(1,1)) );
CALL_SUBTEST2( eigensolver(MatrixXd(2,2)) );
CALL_SUBTEST3( eigensolver(Matrix<double,1,1>()) );
CALL_SUBTEST4( eigensolver(Matrix2d()) );
CALL_SUBTEST_2( eigensolver(MatrixXd(1,1)) );
CALL_SUBTEST_2( eigensolver(MatrixXd(2,2)) );
CALL_SUBTEST_3( eigensolver(Matrix<double,1,1>()) );
CALL_SUBTEST_4( eigensolver(Matrix2d()) );
}
CALL_SUBTEST1( eigensolver_verify_assert<Matrix4f>() );
CALL_SUBTEST2( eigensolver_verify_assert<MatrixXd>() );
CALL_SUBTEST4( eigensolver_verify_assert<Matrix2d>() );
CALL_SUBTEST5( eigensolver_verify_assert<MatrixXf>() );
CALL_SUBTEST_1( eigensolver_verify_assert<Matrix4f>() );
CALL_SUBTEST_2( eigensolver_verify_assert<MatrixXd>() );
CALL_SUBTEST_4( eigensolver_verify_assert<Matrix2d>() );
CALL_SUBTEST_5( eigensolver_verify_assert<MatrixXf>() );
}

View File

@ -117,17 +117,17 @@ void test_eigensolver_selfadjoint()
{
for(int i = 0; i < g_repeat; i++) {
// very important to test a 3x3 matrix since we provide a special path for it
CALL_SUBTEST1( selfadjointeigensolver(Matrix3f()) );
CALL_SUBTEST2( selfadjointeigensolver(Matrix4d()) );
CALL_SUBTEST3( selfadjointeigensolver(MatrixXf(10,10)) );
CALL_SUBTEST4( selfadjointeigensolver(MatrixXd(19,19)) );
CALL_SUBTEST5( selfadjointeigensolver(MatrixXcd(17,17)) );
CALL_SUBTEST_1( selfadjointeigensolver(Matrix3f()) );
CALL_SUBTEST_2( selfadjointeigensolver(Matrix4d()) );
CALL_SUBTEST_3( selfadjointeigensolver(MatrixXf(10,10)) );
CALL_SUBTEST_4( selfadjointeigensolver(MatrixXd(19,19)) );
CALL_SUBTEST_5( selfadjointeigensolver(MatrixXcd(17,17)) );
// some trivial but implementation-wise tricky cases
CALL_SUBTEST4( selfadjointeigensolver(MatrixXd(1,1)) );
CALL_SUBTEST4( selfadjointeigensolver(MatrixXd(2,2)) );
CALL_SUBTEST6( selfadjointeigensolver(Matrix<double,1,1>()) );
CALL_SUBTEST7( selfadjointeigensolver(Matrix<double,2,2>()) );
CALL_SUBTEST_4( selfadjointeigensolver(MatrixXd(1,1)) );
CALL_SUBTEST_4( selfadjointeigensolver(MatrixXd(2,2)) );
CALL_SUBTEST_6( selfadjointeigensolver(Matrix<double,1,1>()) );
CALL_SUBTEST_7( selfadjointeigensolver(Matrix<double,2,2>()) );
}
}

View File

@ -75,8 +75,8 @@ template<typename BoxType> void alignedbox(const BoxType& _box)
void test_geo_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>()) );
}
}

View File

@ -64,7 +64,7 @@ template<typename Scalar> void eulerangles(void)
void test_geo_eulerangles()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( eulerangles<float>() );
CALL_SUBTEST( eulerangles<double>() );
CALL_SUBTEST_1( eulerangles<float>() );
CALL_SUBTEST_2( eulerangles<double>() );
}
}

View File

@ -104,8 +104,8 @@ template<typename Scalar,int Size> void homogeneous(void)
void test_geo_homogeneous()
{
for(int i = 0; i < g_repeat; i++) {
// CALL_SUBTEST(( homogeneous<float,1>() ));
CALL_SUBTEST(( homogeneous<double,3>() ));
// CALL_SUBTEST(( homogeneous<double,8>() ));
CALL_SUBTEST_1(( homogeneous<float,1>() ));
CALL_SUBTEST_2(( homogeneous<double,3>() ));
CALL_SUBTEST_3(( homogeneous<double,8>() ));
}
}

View File

@ -130,11 +130,11 @@ template<typename Scalar> void lines()
void test_geo_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_1( lines<float>() );
CALL_SUBTEST_2( lines<double>() );
}
}

View File

@ -113,15 +113,15 @@ template<typename Scalar, int Size> void orthomethods(int size=Size)
void test_geo_orthomethods()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( orthomethods_3<float>() );
CALL_SUBTEST( orthomethods_3<double>() );
CALL_SUBTEST( (orthomethods<float,2>()) );
CALL_SUBTEST( (orthomethods<double,2>()) );
CALL_SUBTEST( (orthomethods<float,3>()) );
CALL_SUBTEST( (orthomethods<double,3>()) );
CALL_SUBTEST( (orthomethods<float,7>()) );
CALL_SUBTEST( (orthomethods<std::complex<double>,8>()) );
CALL_SUBTEST( (orthomethods<float,Dynamic>(36)) );
CALL_SUBTEST( (orthomethods<double,Dynamic>(35)) );
CALL_SUBTEST_1( orthomethods_3<float>() );
CALL_SUBTEST_2( orthomethods_3<double>() );
CALL_SUBTEST_1( (orthomethods<float,2>()) );
CALL_SUBTEST_2( (orthomethods<double,2>()) );
CALL_SUBTEST_1( (orthomethods<float,3>()) );
CALL_SUBTEST_2( (orthomethods<double,3>()) );
CALL_SUBTEST_3( (orthomethods<float,7>()) );
CALL_SUBTEST_4( (orthomethods<std::complex<double>,8>()) );
CALL_SUBTEST_5( (orthomethods<float,Dynamic>(36)) );
CALL_SUBTEST_6( (orthomethods<double,Dynamic>(35)) );
}
}

View File

@ -69,9 +69,9 @@ template<typename LineType> void parametrizedline(const LineType& _line)
void test_geo_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>()) );
}
}

View File

@ -92,9 +92,12 @@ template<typename Scalar> void quaternion(void)
VERIFY_IS_APPROX( v2.normalized(),(q2.setFromTwoVectors(v1, v2)*v1).normalized());
VERIFY_IS_APPROX( v1.normalized(),(q2.setFromTwoVectors(v1, v1)*v1).normalized());
VERIFY_IS_APPROX(-v1.normalized(),(q2.setFromTwoVectors(v1,-v1)*v1).normalized());
v3 = v1.cwise()+eps;
VERIFY_IS_APPROX( v3.normalized(),(q2.setFromTwoVectors(v1, v3)*v1).normalized());
VERIFY_IS_APPROX(-v3.normalized(),(q2.setFromTwoVectors(v1,-v3)*v1).normalized());
if (ei_is_same_type<Scalar,double>::ret)
{
v3 = v1.cwise()+eps;
VERIFY_IS_APPROX( v3.normalized(),(q2.setFromTwoVectors(v1, v3)*v1).normalized());
VERIFY_IS_APPROX(-v3.normalized(),(q2.setFromTwoVectors(v1,-v3)*v1).normalized());
}
// inverse and conjugate
VERIFY_IS_APPROX(q1 * (q1.inverse() * v1), v1);
@ -110,7 +113,7 @@ template<typename Scalar> void quaternion(void)
void test_geo_quaternion()
{
for(int i = 0; i < g_repeat; i++) {
// CALL_SUBTEST( quaternion<float>() );
CALL_SUBTEST( quaternion<double>() );
CALL_SUBTEST_1( quaternion<float>() );
CALL_SUBTEST_2( quaternion<double>() );
}
}

View File

@ -298,16 +298,19 @@ template<typename Scalar, int Mode> void transformations(void)
VERIFY_IS_APPROX((t0 * v1).template start<3>(), AlignedScaling3(v0) * v1);
// test transform inversion
if(Mode!=AffineCompact)
{
t0.setIdentity();
t0.translate(v0);
t0.linear().setRandom();
VERIFY_IS_APPROX(t0.inverse(Affine).matrix(), t0.matrix().inverse());
t0.setIdentity();
t0.translate(v0).rotate(q1);
VERIFY_IS_APPROX(t0.inverse(Isometry).matrix(), t0.matrix().inverse());
}
t0.setIdentity();
t0.translate(v0);
t0.linear().setRandom();
Matrix4 t044 = Matrix4::Zero();
t044(3,3) = 1;
t044.block(0,0,t0.matrix().rows(),4) = t0.matrix();
VERIFY_IS_APPROX(t0.inverse(Affine).matrix(), t044.inverse().block(0,0,t0.matrix().rows(),4));
t0.setIdentity();
t0.translate(v0).rotate(q1);
t044 = Matrix4::Zero();
t044(3,3) = 1;
t044.block(0,0,t0.matrix().rows(),4) = t0.matrix();
VERIFY_IS_APPROX(t0.inverse(Isometry).matrix(), t044.inverse().block(0,0,t0.matrix().rows(),4));
// test extract rotation and aligned scaling
// t0.setIdentity();
@ -354,9 +357,8 @@ template<typename Scalar, int Mode> void transformations(void)
void test_geo_transformations()
{
for(int i = 0; i < g_repeat; i++) {
// CALL_SUBTEST( transformations<float>() );
CALL_SUBTEST(( transformations<double,Affine>() ));
CALL_SUBTEST(( transformations<double,AffineCompact>() ));
CALL_SUBTEST(( transformations<double,Projective>() ));
CALL_SUBTEST_1(( transformations<double,Affine>() ));
CALL_SUBTEST_2(( transformations<float,AffineCompact>() ));
CALL_SUBTEST_3(( transformations<double,Projective>() ));
}
}

View File

@ -92,12 +92,12 @@ template<typename MatrixType> void householder(const MatrixType& m)
void test_householder()
{
for(int i = 0; i < 2*g_repeat; i++) {
CALL_SUBTEST( householder(Matrix<double,2,2>()) );
CALL_SUBTEST( householder(Matrix<float,2,3>()) );
CALL_SUBTEST( householder(Matrix<double,3,5>()) );
CALL_SUBTEST( householder(Matrix<float,4,4>()) );
CALL_SUBTEST( householder(MatrixXd(10,12)) );
CALL_SUBTEST( householder(MatrixXcf(16,17)) );
CALL_SUBTEST_1( householder(Matrix<double,2,2>()) );
CALL_SUBTEST_2( householder(Matrix<float,2,3>()) );
CALL_SUBTEST_3( householder(Matrix<double,3,5>()) );
CALL_SUBTEST_4( householder(Matrix<float,4,4>()) );
CALL_SUBTEST_5( householder(MatrixXd(10,12)) );
CALL_SUBTEST_6( householder(MatrixXcf(16,17)) );
}
}

View File

@ -95,14 +95,14 @@ void test_inverse()
{
int s;
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST1( inverse(Matrix<double,1,1>()) );
CALL_SUBTEST2( inverse(Matrix2d()) );
CALL_SUBTEST3( inverse(Matrix3f()) );
CALL_SUBTEST4( inverse(Matrix4f()) );
CALL_SUBTEST_1( inverse(Matrix<double,1,1>()) );
CALL_SUBTEST_2( inverse(Matrix2d()) );
CALL_SUBTEST_3( inverse(Matrix3f()) );
CALL_SUBTEST_4( inverse(Matrix4f()) );
s = ei_random<int>(50,320);
CALL_SUBTEST5( inverse(MatrixXf(s,s)) );
CALL_SUBTEST_5( inverse(MatrixXf(s,s)) );
s = ei_random<int>(25,100);
CALL_SUBTEST6( inverse(MatrixXcd(s,s)) );
CALL_SUBTEST_6( inverse(MatrixXcd(s,s)) );
}
#ifdef EIGEN_TEST_PART_4

View File

@ -80,27 +80,27 @@ void test_jacobisvd()
Matrix2cd m;
m << 0, 1,
0, 1;
CALL_SUBTEST(( svd<Matrix2cd,0>(m, false) ));
CALL_SUBTEST_1(( svd<Matrix2cd,0>(m, false) ));
m << 1, 0,
1, 0;
CALL_SUBTEST(( svd<Matrix2cd,0>(m, false) ));
CALL_SUBTEST_1(( svd<Matrix2cd,0>(m, false) ));
Matrix2d n;
n << 1, 1,
1, -1;
CALL_SUBTEST(( svd<Matrix2d,0>(n, false) ));
CALL_SUBTEST(( svd<Matrix3f,0>() ));
CALL_SUBTEST(( svd<Matrix4d,Square>() ));
CALL_SUBTEST(( svd<Matrix<float,3,5> , AtLeastAsManyColsAsRows>() ));
CALL_SUBTEST(( svd<Matrix<double,Dynamic,2> , AtLeastAsManyRowsAsCols>(Matrix<double,Dynamic,2>(10,2)) ));
CALL_SUBTEST_2(( svd<Matrix2d,0>(n, false) ));
CALL_SUBTEST_3(( svd<Matrix3f,0>() ));
CALL_SUBTEST_4(( svd<Matrix4d,Square>() ));
CALL_SUBTEST_5(( svd<Matrix<float,3,5> , AtLeastAsManyColsAsRows>() ));
CALL_SUBTEST_6(( svd<Matrix<double,Dynamic,2> , AtLeastAsManyRowsAsCols>(Matrix<double,Dynamic,2>(10,2)) ));
CALL_SUBTEST(( svd<MatrixXf,Square>(MatrixXf(50,50)) ));
CALL_SUBTEST(( svd<MatrixXcd,AtLeastAsManyRowsAsCols>(MatrixXcd(14,7)) ));
CALL_SUBTEST_7(( svd<MatrixXf,Square>(MatrixXf(50,50)) ));
CALL_SUBTEST_8(( svd<MatrixXcd,AtLeastAsManyRowsAsCols>(MatrixXcd(14,7)) ));
}
CALL_SUBTEST(( svd<MatrixXf,0>(MatrixXf(300,200)) ));
CALL_SUBTEST(( svd<MatrixXcd,AtLeastAsManyColsAsRows>(MatrixXcd(100,150)) ));
CALL_SUBTEST_9(( svd<MatrixXf,0>(MatrixXf(300,200)) ));
CALL_SUBTEST_10(( svd<MatrixXcd,AtLeastAsManyColsAsRows>(MatrixXcd(100,150)) ));
CALL_SUBTEST(( svd_verify_assert<Matrix3f>() ));
CALL_SUBTEST(( svd_verify_assert<Matrix3d>() ));
CALL_SUBTEST(( svd_verify_assert<MatrixXf>() ));
CALL_SUBTEST(( svd_verify_assert<MatrixXd>() ));
CALL_SUBTEST_3(( svd_verify_assert<Matrix3f>() ));
CALL_SUBTEST_3(( svd_verify_assert<Matrix3d>() ));
CALL_SUBTEST_9(( svd_verify_assert<MatrixXf>() ));
CALL_SUBTEST_11(( svd_verify_assert<MatrixXd>() ));
}

View File

@ -87,13 +87,13 @@ template<typename MatrixType> void linearStructure(const MatrixType& m)
void test_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)) );
}
}

View File

@ -58,13 +58,13 @@ template<typename MatrixType> void lu_non_invertible()
int rank = ei_random<int>(1, std::min(rows, cols)-1);
// The image of the zero matrix should consist of a single (zero) column vector
VERIFY((MatrixType::Zero(rows,cols).lu().image(MatrixType::Zero(rows,cols)).cols() == 1));
VERIFY((MatrixType::Zero(rows,cols).fullPivLu().image(MatrixType::Zero(rows,cols)).cols() == 1));
MatrixType m1(rows, cols), m3(rows, cols2);
CMatrixType m2(cols, cols2);
createRandomMatrixOfRank(rank, rows, cols, m1);
LU<MatrixType> lu(m1);
FullPivLU<MatrixType> lu(m1);
KernelMatrixType m1kernel = lu.kernel();
ImageMatrixType m1image = lu.image(m1);
@ -75,20 +75,16 @@ template<typename MatrixType> void lu_non_invertible()
VERIFY(!lu.isInvertible());
VERIFY(!lu.isSurjective());
VERIFY((m1 * m1kernel).isMuchSmallerThan(m1));
VERIFY(m1image.lu().rank() == rank);
VERIFY(m1image.fullPivLu().rank() == rank);
DynamicMatrixType sidebyside(m1.rows(), m1.cols() + m1image.cols());
sidebyside << m1, m1image;
VERIFY(sidebyside.lu().rank() == rank);
VERIFY(sidebyside.fullPivLu().rank() == rank);
m2 = CMatrixType::Random(cols,cols2);
m3 = m1*m2;
m2 = CMatrixType::Random(cols,cols2);
// test that the code, which does resize(), may be applied to an xpr
m2.block(0,0,m2.rows(),m2.cols()) = lu.solve(m3);
VERIFY_IS_APPROX(m3, m1*m2);
CMatrixType m4(cols, cols), m5(cols, cols);
createRandomMatrixOfRank(cols/2, cols, cols, m4);
VERIFY(!m4.computeInverseWithCheck(&m5));
}
template<typename MatrixType> void lu_invertible()
@ -109,14 +105,14 @@ template<typename MatrixType> void lu_invertible()
m1 += a * a.adjoint();
}
LU<MatrixType> lu(m1);
FullPivLU<MatrixType> lu(m1);
VERIFY(0 == lu.dimensionOfKernel());
VERIFY(lu.kernel().cols() == 1); // the kernel() should consist of a single (zero) column vector
VERIFY(size == lu.rank());
VERIFY(lu.isInjective());
VERIFY(lu.isSurjective());
VERIFY(lu.isInvertible());
VERIFY(lu.image(m1).lu().isInvertible());
VERIFY(lu.image(m1).fullPivLu().isInvertible());
m3 = MatrixType::Random(size,size);
m2 = lu.solve(m3);
VERIFY_IS_APPROX(m3, m1*m2);
@ -127,7 +123,7 @@ template<typename MatrixType> void lu_verify_assert()
{
MatrixType tmp;
LU<MatrixType> lu;
FullPivLU<MatrixType> lu;
VERIFY_RAISES_ASSERT(lu.matrixLU())
VERIFY_RAISES_ASSERT(lu.permutationP())
VERIFY_RAISES_ASSERT(lu.permutationQ())
@ -142,10 +138,10 @@ template<typename MatrixType> void lu_verify_assert()
VERIFY_RAISES_ASSERT(lu.isInvertible())
VERIFY_RAISES_ASSERT(lu.inverse())
PartialLU<MatrixType> plu;
PartialPivLU<MatrixType> plu;
VERIFY_RAISES_ASSERT(plu.matrixLU())
VERIFY_RAISES_ASSERT(plu.permutationP())
VERIFY_RAISES_ASSERT(plu.solve(tmp,&tmp))
VERIFY_RAISES_ASSERT(plu.solve(tmp))
VERIFY_RAISES_ASSERT(plu.determinant())
VERIFY_RAISES_ASSERT(plu.inverse())
}
@ -153,26 +149,26 @@ template<typename MatrixType> void lu_verify_assert()
void test_lu()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST1( lu_non_invertible<Matrix3f>() );
CALL_SUBTEST1( lu_verify_assert<Matrix3f>() );
CALL_SUBTEST_1( lu_non_invertible<Matrix3f>() );
CALL_SUBTEST_1( lu_verify_assert<Matrix3f>() );
CALL_SUBTEST2( (lu_non_invertible<Matrix<double, 4, 6> >()) );
CALL_SUBTEST2( (lu_verify_assert<Matrix<double, 4, 6> >()) );
CALL_SUBTEST_2( (lu_non_invertible<Matrix<double, 4, 6> >()) );
CALL_SUBTEST_2( (lu_verify_assert<Matrix<double, 4, 6> >()) );
CALL_SUBTEST3( lu_non_invertible<MatrixXf>() );
CALL_SUBTEST3( lu_invertible<MatrixXf>() );
CALL_SUBTEST3( lu_verify_assert<MatrixXf>() );
CALL_SUBTEST_3( lu_non_invertible<MatrixXf>() );
CALL_SUBTEST_3( lu_invertible<MatrixXf>() );
CALL_SUBTEST_3( lu_verify_assert<MatrixXf>() );
CALL_SUBTEST4( lu_non_invertible<MatrixXd>() );
CALL_SUBTEST4( lu_invertible<MatrixXd>() );
CALL_SUBTEST4( lu_verify_assert<MatrixXd>() );
CALL_SUBTEST_4( lu_non_invertible<MatrixXd>() );
CALL_SUBTEST_4( lu_invertible<MatrixXd>() );
CALL_SUBTEST_4( lu_verify_assert<MatrixXd>() );
CALL_SUBTEST5( lu_non_invertible<MatrixXcf>() );
CALL_SUBTEST5( lu_invertible<MatrixXcf>() );
CALL_SUBTEST5( lu_verify_assert<MatrixXcf>() );
CALL_SUBTEST_5( lu_non_invertible<MatrixXcf>() );
CALL_SUBTEST_5( lu_invertible<MatrixXcf>() );
CALL_SUBTEST_5( lu_verify_assert<MatrixXcf>() );
CALL_SUBTEST6( lu_non_invertible<MatrixXcd>() );
CALL_SUBTEST6( lu_invertible<MatrixXcd>() );
CALL_SUBTEST6( lu_verify_assert<MatrixXcd>() );
CALL_SUBTEST_6( lu_non_invertible<MatrixXcd>() );
CALL_SUBTEST_6( lu_invertible<MatrixXcd>() );
CALL_SUBTEST_6( lu_verify_assert<MatrixXcd>() );
}
}

View File

@ -171,63 +171,99 @@ namespace Eigen
} while (0)
#ifdef EIGEN_TEST_PART_1
#define CALL_SUBTEST1(FUNC) CALL_SUBTEST(FUNC)
#define CALL_SUBTEST_1(FUNC) CALL_SUBTEST(FUNC)
#else
#define CALL_SUBTEST1(FUNC)
#define CALL_SUBTEST_1(FUNC)
#endif
#ifdef EIGEN_TEST_PART_2
#define CALL_SUBTEST2(FUNC) CALL_SUBTEST(FUNC)
#define CALL_SUBTEST_2(FUNC) CALL_SUBTEST(FUNC)
#else
#define CALL_SUBTEST2(FUNC)
#define CALL_SUBTEST_2(FUNC)
#endif
#ifdef EIGEN_TEST_PART_3
#define CALL_SUBTEST3(FUNC) CALL_SUBTEST(FUNC)
#define CALL_SUBTEST_3(FUNC) CALL_SUBTEST(FUNC)
#else
#define CALL_SUBTEST3(FUNC)
#define CALL_SUBTEST_3(FUNC)
#endif
#ifdef EIGEN_TEST_PART_4
#define CALL_SUBTEST4(FUNC) CALL_SUBTEST(FUNC)
#define CALL_SUBTEST_4(FUNC) CALL_SUBTEST(FUNC)
#else
#define CALL_SUBTEST4(FUNC)
#define CALL_SUBTEST_4(FUNC)
#endif
#ifdef EIGEN_TEST_PART_5
#define CALL_SUBTEST5(FUNC) CALL_SUBTEST(FUNC)
#define CALL_SUBTEST_5(FUNC) CALL_SUBTEST(FUNC)
#else
#define CALL_SUBTEST5(FUNC)
#define CALL_SUBTEST_5(FUNC)
#endif
#ifdef EIGEN_TEST_PART_6
#define CALL_SUBTEST6(FUNC) CALL_SUBTEST(FUNC)
#define CALL_SUBTEST_6(FUNC) CALL_SUBTEST(FUNC)
#else
#define CALL_SUBTEST6(FUNC)
#define CALL_SUBTEST_6(FUNC)
#endif
#ifdef EIGEN_TEST_PART_7
#define CALL_SUBTEST7(FUNC) CALL_SUBTEST(FUNC)
#define CALL_SUBTEST_7(FUNC) CALL_SUBTEST(FUNC)
#else
#define CALL_SUBTEST7(FUNC)
#define CALL_SUBTEST_7(FUNC)
#endif
#ifdef EIGEN_TEST_PART_8
#define CALL_SUBTEST8(FUNC) CALL_SUBTEST(FUNC)
#define CALL_SUBTEST_8(FUNC) CALL_SUBTEST(FUNC)
#else
#define CALL_SUBTEST8(FUNC)
#define CALL_SUBTEST_8(FUNC)
#endif
#ifdef EIGEN_TEST_PART_9
#define CALL_SUBTEST9(FUNC) CALL_SUBTEST(FUNC)
#define CALL_SUBTEST_9(FUNC) CALL_SUBTEST(FUNC)
#else
#define CALL_SUBTEST9(FUNC)
#define CALL_SUBTEST_9(FUNC)
#endif
#ifdef EIGEN_TEST_PART_10
#define CALL_SUBTEST10(FUNC) CALL_SUBTEST(FUNC)
#define CALL_SUBTEST_10(FUNC) CALL_SUBTEST(FUNC)
#else
#define CALL_SUBTEST10(FUNC)
#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
namespace Eigen {

View File

@ -80,16 +80,16 @@ template<typename VectorType> void map_static_methods(const VectorType& m)
void test_map()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( map_class(Matrix<float, 1, 1>()) );
CALL_SUBTEST( map_class(Vector4d()) );
CALL_SUBTEST( map_class(RowVector4f()) );
CALL_SUBTEST( map_class(VectorXcf(8)) );
CALL_SUBTEST( map_class(VectorXi(12)) );
CALL_SUBTEST_1( map_class(Matrix<float, 1, 1>()) );
CALL_SUBTEST_2( map_class(Vector4d()) );
CALL_SUBTEST_3( map_class(RowVector4f()) );
CALL_SUBTEST_4( map_class(VectorXcf(8)) );
CALL_SUBTEST_5( map_class(VectorXi(12)) );
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_6( map_static_methods(Matrix<double, 1, 1>()) );
CALL_SUBTEST_7( map_static_methods(Vector3f()) );
CALL_SUBTEST_8( map_static_methods(RowVector3d()) );
CALL_SUBTEST_9( map_static_methods(VectorXcd(8)) );
CALL_SUBTEST_10( map_static_methods(VectorXf(12)) );
}
}

View File

@ -54,10 +54,10 @@ template<typename MatrixType> void miscMatrices(const MatrixType& m)
void test_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)) );
}
}

View File

@ -174,10 +174,10 @@ template<int SizeAtCompileType> void mixingtypes_small()
void test_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));
CALL_SUBTEST(mixingtypes_small<4>());
CALL_SUBTEST(mixingtypes_large(20));
CALL_SUBTEST_4(mixingtypes_small<4>());
CALL_SUBTEST_5(mixingtypes_large(20));
}

View File

@ -77,7 +77,7 @@ void test_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(nomalloc(Matrix<float, 1, 1>()) );
CALL_SUBTEST(nomalloc(Matrix4d()) );
CALL_SUBTEST(nomalloc(Matrix<float,32,32>()) );
}

View File

@ -233,12 +233,12 @@ template<typename Scalar> void packetmath_real()
void test_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_1( packetmath<std::complex<float> >() );
CALL_SUBTEST( packetmath_real<float>() );
CALL_SUBTEST( packetmath_real<double>() );
CALL_SUBTEST_1( packetmath_real<float>() );
CALL_SUBTEST_2( packetmath_real<double>() );
}
}

View File

@ -119,8 +119,8 @@ template<typename MatrixType> void product_extra(const MatrixType& m)
void test_product_extra()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST1( product_extra(MatrixXf(ei_random<int>(2,320), ei_random<int>(2,320))) );
CALL_SUBTEST2( product_extra(MatrixXcf(ei_random<int>(50,50), ei_random<int>(50,50))) );
CALL_SUBTEST3( product_extra(Matrix<std::complex<double>,Dynamic,Dynamic,RowMajor>(ei_random<int>(2,50), ei_random<int>(2,50))) );
CALL_SUBTEST_1( product_extra(MatrixXf(ei_random<int>(2,320), ei_random<int>(2,320))) );
CALL_SUBTEST_2( product_extra(MatrixXcf(ei_random<int>(50,50), ei_random<int>(50,50))) );
CALL_SUBTEST_3( product_extra(Matrix<std::complex<double>,Dynamic,Dynamic,RowMajor>(ei_random<int>(2,50), ei_random<int>(2,50))) );
}
}

View File

@ -27,11 +27,11 @@
void test_product_large()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST1( product(MatrixXf(ei_random<int>(1,320), ei_random<int>(1,320))) );
CALL_SUBTEST2( product(MatrixXd(ei_random<int>(1,320), ei_random<int>(1,320))) );
CALL_SUBTEST3( product(MatrixXi(ei_random<int>(1,320), ei_random<int>(1,320))) );
CALL_SUBTEST4( product(MatrixXcf(ei_random<int>(1,50), ei_random<int>(1,50))) );
CALL_SUBTEST5( 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))) );
}
#if defined EIGEN_TEST_PART_6

View File

@ -117,8 +117,8 @@ void test_product_notemporary()
int s;
for(int i = 0; i < g_repeat; i++) {
s = ei_random<int>(16,320);
CALL_SUBTEST1( product_notemporary(MatrixXf(s, s)) );
CALL_SUBTEST_1( product_notemporary(MatrixXf(s, s)) );
s = ei_random<int>(16,120);
CALL_SUBTEST2( product_notemporary(MatrixXcd(s,s)) );
CALL_SUBTEST_2( product_notemporary(MatrixXcd(s,s)) );
}
}

View File

@ -78,13 +78,13 @@ template<typename MatrixType> void product_selfadjoint(const MatrixType& m)
void test_product_selfadjoint()
{
for(int i = 0; i < g_repeat ; i++) {
CALL_SUBTEST1( product_selfadjoint(Matrix<float, 1, 1>()) );
CALL_SUBTEST2( product_selfadjoint(Matrix<float, 2, 2>()) );
CALL_SUBTEST3( product_selfadjoint(Matrix3d()) );
CALL_SUBTEST4( product_selfadjoint(MatrixXcf(4, 4)) );
CALL_SUBTEST5( product_selfadjoint(MatrixXcd(21,21)) );
CALL_SUBTEST6( product_selfadjoint(MatrixXd(14,14)) );
CALL_SUBTEST7( product_selfadjoint(Matrix<float,Dynamic,Dynamic,RowMajor>(17,17)) );
CALL_SUBTEST8( product_selfadjoint(Matrix<std::complex<double>,Dynamic,Dynamic,RowMajor>(19, 19)) );
CALL_SUBTEST_1( product_selfadjoint(Matrix<float, 1, 1>()) );
CALL_SUBTEST_2( product_selfadjoint(Matrix<float, 2, 2>()) );
CALL_SUBTEST_3( product_selfadjoint(Matrix3d()) );
CALL_SUBTEST_4( product_selfadjoint(MatrixXcf(4, 4)) );
CALL_SUBTEST_5( product_selfadjoint(MatrixXcd(21,21)) );
CALL_SUBTEST_6( product_selfadjoint(MatrixXd(14,14)) );
CALL_SUBTEST_7( product_selfadjoint(Matrix<float,Dynamic,Dynamic,RowMajor>(17,17)) );
CALL_SUBTEST_8( product_selfadjoint(Matrix<std::complex<double>,Dynamic,Dynamic,RowMajor>(19, 19)) );
}
}

View File

@ -28,11 +28,11 @@
void test_product_small()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST1( product(Matrix<float, 3, 2>()) );
CALL_SUBTEST2( product(Matrix<int, 3, 5>()) );
CALL_SUBTEST3( product(Matrix3d()) );
CALL_SUBTEST4( product(Matrix4d()) );
CALL_SUBTEST5( 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()) );
}
#ifdef EIGEN_TEST_PART_6

View File

@ -108,10 +108,10 @@ void test_product_symm()
{
for(int i = 0; i < g_repeat ; i++)
{
CALL_SUBTEST1(( symm<float,Dynamic,Dynamic>(ei_random<int>(10,320),ei_random<int>(10,320)) ));
CALL_SUBTEST2(( symm<std::complex<double>,Dynamic,Dynamic>(ei_random<int>(10,320),ei_random<int>(10,320)) ));
CALL_SUBTEST_1(( symm<float,Dynamic,Dynamic>(ei_random<int>(10,320),ei_random<int>(10,320)) ));
CALL_SUBTEST_2(( symm<std::complex<double>,Dynamic,Dynamic>(ei_random<int>(10,320),ei_random<int>(10,320)) ));
CALL_SUBTEST3(( symm<float,Dynamic,1>(ei_random<int>(10,320)) ));
CALL_SUBTEST4(( symm<std::complex<double>,Dynamic,1>(ei_random<int>(10,320)) ));
CALL_SUBTEST_3(( symm<float,Dynamic,1>(ei_random<int>(10,320)) ));
CALL_SUBTEST_4(( symm<std::complex<double>,Dynamic,1>(ei_random<int>(10,320)) ));
}
}

View File

@ -75,8 +75,8 @@ void test_product_syrk()
{
int s;
s = ei_random<int>(10,320);
CALL_SUBTEST1( syrk(MatrixXf(s, s)) );
CALL_SUBTEST_1( syrk(MatrixXf(s, s)) );
s = ei_random<int>(10,320);
CALL_SUBTEST2( syrk(MatrixXcd(s, s)) );
CALL_SUBTEST_2( syrk(MatrixXcd(s, s)) );
}
}

View File

@ -63,7 +63,7 @@ void test_product_trmm()
{
for(int i = 0; i < g_repeat ; i++)
{
CALL_SUBTEST1((trmm<float>(ei_random<int>(1,320),ei_random<int>(1,320))));
CALL_SUBTEST2((trmm<std::complex<double> >(ei_random<int>(1,320),ei_random<int>(1,320))));
CALL_SUBTEST_1((trmm<float>(ei_random<int>(1,320),ei_random<int>(1,320))));
CALL_SUBTEST_2((trmm<std::complex<double> >(ei_random<int>(1,320),ei_random<int>(1,320))));
}
}

View File

@ -82,11 +82,11 @@ template<typename MatrixType> void trmv(const MatrixType& m)
void test_product_trmv()
{
for(int i = 0; i < g_repeat ; i++) {
CALL_SUBTEST1( trmv(Matrix<float, 1, 1>()) );
CALL_SUBTEST2( trmv(Matrix<float, 2, 2>()) );
CALL_SUBTEST3( trmv(Matrix3d()) );
CALL_SUBTEST4( trmv(Matrix<std::complex<float>,23, 23>()) );
CALL_SUBTEST5( trmv(MatrixXcd(17,17)) );
CALL_SUBTEST6( trmv(Matrix<float,Dynamic,Dynamic,RowMajor>(19, 19)) );
CALL_SUBTEST_1( trmv(Matrix<float, 1, 1>()) );
CALL_SUBTEST_2( trmv(Matrix<float, 2, 2>()) );
CALL_SUBTEST_3( trmv(Matrix3d()) );
CALL_SUBTEST_4( trmv(Matrix<std::complex<float>,23, 23>()) );
CALL_SUBTEST_5( trmv(MatrixXcd(17,17)) );
CALL_SUBTEST_6( trmv(Matrix<float,Dynamic,Dynamic,RowMajor>(19, 19)) );
}
}

View File

@ -59,7 +59,7 @@ void test_product_trsm()
{
for(int i = 0; i < g_repeat ; i++)
{
CALL_SUBTEST1((trsm<float>(ei_random<int>(1,320),ei_random<int>(1,320))));
CALL_SUBTEST2((trsm<std::complex<double> >(ei_random<int>(1,320),ei_random<int>(1,320))));
CALL_SUBTEST_1((trsm<float>(ei_random<int>(1,320),ei_random<int>(1,320))));
CALL_SUBTEST_2((trsm<std::complex<double> >(ei_random<int>(1,320),ei_random<int>(1,320))));
}
}

View File

@ -115,24 +115,24 @@ template<typename MatrixType> void qr_verify_assert()
void test_qr()
{
for(int i = 0; i < 1; i++) {
CALL_SUBTEST( qr(MatrixXf(47,40)) );
CALL_SUBTEST( qr(MatrixXcd(17,7)) );
CALL_SUBTEST(( qr_fixedsize<Matrix<float,3,4>, 2 >() ));
CALL_SUBTEST(( qr_fixedsize<Matrix<double,6,2>, 4 >() ));
CALL_SUBTEST(( qr_fixedsize<Matrix<double,2,5>, 7 >() ));
CALL_SUBTEST_1( qr(MatrixXf(47,40)) );
CALL_SUBTEST_2( qr(MatrixXcd(17,7)) );
CALL_SUBTEST_3(( qr_fixedsize<Matrix<float,3,4>, 2 >() ));
CALL_SUBTEST_4(( qr_fixedsize<Matrix<double,6,2>, 4 >() ));
CALL_SUBTEST_5(( qr_fixedsize<Matrix<double,2,5>, 7 >() ));
}
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( qr_invertible<MatrixXf>() );
CALL_SUBTEST( qr_invertible<MatrixXd>() );
CALL_SUBTEST( qr_invertible<MatrixXcf>() );
CALL_SUBTEST( qr_invertible<MatrixXcd>() );
CALL_SUBTEST_1( qr_invertible<MatrixXf>() );
CALL_SUBTEST_6( qr_invertible<MatrixXd>() );
CALL_SUBTEST_7( qr_invertible<MatrixXcf>() );
CALL_SUBTEST_8( qr_invertible<MatrixXcd>() );
}
CALL_SUBTEST(qr_verify_assert<Matrix3f>());
CALL_SUBTEST(qr_verify_assert<Matrix3d>());
CALL_SUBTEST(qr_verify_assert<MatrixXf>());
CALL_SUBTEST(qr_verify_assert<MatrixXd>());
CALL_SUBTEST(qr_verify_assert<MatrixXcf>());
CALL_SUBTEST(qr_verify_assert<MatrixXcd>());
CALL_SUBTEST_9(qr_verify_assert<Matrix3f>());
CALL_SUBTEST_10(qr_verify_assert<Matrix3d>());
CALL_SUBTEST_1(qr_verify_assert<MatrixXf>());
CALL_SUBTEST_6(qr_verify_assert<MatrixXd>());
CALL_SUBTEST_7(qr_verify_assert<MatrixXcf>());
CALL_SUBTEST_8(qr_verify_assert<MatrixXcd>());
}

View File

@ -36,7 +36,7 @@ template<typename MatrixType> void qr()
typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, 1> VectorType;
MatrixType m1;
createRandomMatrixOfRank(rank,rows,cols,m1);
ColPivotingHouseholderQR<MatrixType> qr(m1);
ColPivHouseholderQR<MatrixType> qr(m1);
VERIFY_IS_APPROX(rank, qr.rank());
VERIFY(cols - qr.rank() == qr.dimensionOfKernel());
VERIFY(!qr.isInjective());
@ -74,7 +74,7 @@ template<typename MatrixType, int Cols2> void qr_fixedsize()
int rank = ei_random<int>(1, std::min(int(Rows), int(Cols))-1);
Matrix<Scalar,Rows,Cols> m1;
createRandomMatrixOfRank(rank,Rows,Cols,m1);
ColPivotingHouseholderQR<Matrix<Scalar,Rows,Cols> > qr(m1);
ColPivHouseholderQR<Matrix<Scalar,Rows,Cols> > qr(m1);
VERIFY_IS_APPROX(rank, qr.rank());
VERIFY(Cols - qr.rank() == qr.dimensionOfKernel());
VERIFY(!qr.isInjective());
@ -118,7 +118,7 @@ template<typename MatrixType> void qr_invertible()
m1 += a * a.adjoint();
}
ColPivotingHouseholderQR<MatrixType> qr(m1);
ColPivHouseholderQR<MatrixType> qr(m1);
m3 = MatrixType::Random(size,size);
qr.solve(m3, &m2);
VERIFY_IS_APPROX(m3, m1*m2);
@ -138,7 +138,7 @@ template<typename MatrixType> void qr_verify_assert()
{
MatrixType tmp;
ColPivotingHouseholderQR<MatrixType> qr;
ColPivHouseholderQR<MatrixType> qr;
VERIFY_RAISES_ASSERT(qr.matrixQR())
VERIFY_RAISES_ASSERT(qr.solve(tmp,&tmp))
VERIFY_RAISES_ASSERT(qr.matrixQ())
@ -155,24 +155,24 @@ template<typename MatrixType> void qr_verify_assert()
void test_qr_colpivoting()
{
for(int i = 0; i < 1; i++) {
CALL_SUBTEST( qr<MatrixXf>() );
CALL_SUBTEST( qr<MatrixXd>() );
CALL_SUBTEST( qr<MatrixXcd>() );
CALL_SUBTEST(( qr_fixedsize<Matrix<float,3,5>, 4 >() ));
CALL_SUBTEST(( qr_fixedsize<Matrix<double,6,2>, 3 >() ));
CALL_SUBTEST_1( qr<MatrixXf>() );
CALL_SUBTEST_2( qr<MatrixXd>() );
CALL_SUBTEST_3( qr<MatrixXcd>() );
CALL_SUBTEST_4(( qr_fixedsize<Matrix<float,3,5>, 4 >() ));
CALL_SUBTEST_5(( qr_fixedsize<Matrix<double,6,2>, 3 >() ));
}
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( qr_invertible<MatrixXf>() );
CALL_SUBTEST( qr_invertible<MatrixXd>() );
CALL_SUBTEST( qr_invertible<MatrixXcf>() );
CALL_SUBTEST( qr_invertible<MatrixXcd>() );
CALL_SUBTEST_1( qr_invertible<MatrixXf>() );
CALL_SUBTEST_2( qr_invertible<MatrixXd>() );
CALL_SUBTEST_6( qr_invertible<MatrixXcf>() );
CALL_SUBTEST_3( qr_invertible<MatrixXcd>() );
}
CALL_SUBTEST(qr_verify_assert<Matrix3f>());
CALL_SUBTEST(qr_verify_assert<Matrix3d>());
CALL_SUBTEST(qr_verify_assert<MatrixXf>());
CALL_SUBTEST(qr_verify_assert<MatrixXd>());
CALL_SUBTEST(qr_verify_assert<MatrixXcf>());
CALL_SUBTEST(qr_verify_assert<MatrixXcd>());
CALL_SUBTEST_7(qr_verify_assert<Matrix3f>());
CALL_SUBTEST_8(qr_verify_assert<Matrix3d>());
CALL_SUBTEST_1(qr_verify_assert<MatrixXf>());
CALL_SUBTEST_2(qr_verify_assert<MatrixXd>());
CALL_SUBTEST_6(qr_verify_assert<MatrixXcf>());
CALL_SUBTEST_3(qr_verify_assert<MatrixXcd>());
}

View File

@ -36,7 +36,7 @@ template<typename MatrixType> void qr()
typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, 1> VectorType;
MatrixType m1;
createRandomMatrixOfRank(rank,rows,cols,m1);
FullPivotingHouseholderQR<MatrixType> qr(m1);
FullPivHouseholderQR<MatrixType> qr(m1);
VERIFY_IS_APPROX(rank, qr.rank());
VERIFY(cols - qr.rank() == qr.dimensionOfKernel());
VERIFY(!qr.isInjective());
@ -84,7 +84,7 @@ template<typename MatrixType> void qr_invertible()
m1 += a * a.adjoint();
}
FullPivotingHouseholderQR<MatrixType> qr(m1);
FullPivHouseholderQR<MatrixType> qr(m1);
VERIFY(qr.isInjective());
VERIFY(qr.isInvertible());
VERIFY(qr.isSurjective());
@ -108,7 +108,7 @@ template<typename MatrixType> void qr_verify_assert()
{
MatrixType tmp;
FullPivotingHouseholderQR<MatrixType> qr;
FullPivHouseholderQR<MatrixType> qr;
VERIFY_RAISES_ASSERT(qr.matrixQR())
VERIFY_RAISES_ASSERT(qr.solve(tmp,&tmp))
VERIFY_RAISES_ASSERT(qr.matrixQ())
@ -126,23 +126,23 @@ void test_qr_fullpivoting()
{
for(int i = 0; i < 1; i++) {
// FIXME : very weird bug here
// CALL_SUBTEST( qr(Matrix2f()) );
CALL_SUBTEST( qr<MatrixXf>() );
CALL_SUBTEST( qr<MatrixXd>() );
CALL_SUBTEST( qr<MatrixXcd>() );
// CALL_SUBTEST(qr(Matrix2f()) );
CALL_SUBTEST_1( qr<MatrixXf>() );
CALL_SUBTEST_2( qr<MatrixXd>() );
CALL_SUBTEST_3( qr<MatrixXcd>() );
}
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( qr_invertible<MatrixXf>() );
CALL_SUBTEST( qr_invertible<MatrixXd>() );
CALL_SUBTEST( qr_invertible<MatrixXcf>() );
CALL_SUBTEST( qr_invertible<MatrixXcd>() );
CALL_SUBTEST_1( qr_invertible<MatrixXf>() );
CALL_SUBTEST_2( qr_invertible<MatrixXd>() );
CALL_SUBTEST_4( qr_invertible<MatrixXcf>() );
CALL_SUBTEST_3( qr_invertible<MatrixXcd>() );
}
CALL_SUBTEST(qr_verify_assert<Matrix3f>());
CALL_SUBTEST(qr_verify_assert<Matrix3d>());
CALL_SUBTEST(qr_verify_assert<MatrixXf>());
CALL_SUBTEST(qr_verify_assert<MatrixXd>());
CALL_SUBTEST(qr_verify_assert<MatrixXcf>());
CALL_SUBTEST(qr_verify_assert<MatrixXcd>());
CALL_SUBTEST_5(qr_verify_assert<Matrix3f>());
CALL_SUBTEST_6(qr_verify_assert<Matrix3d>());
CALL_SUBTEST_1(qr_verify_assert<MatrixXf>());
CALL_SUBTEST_2(qr_verify_assert<MatrixXd>());
CALL_SUBTEST_4(qr_verify_assert<MatrixXcf>());
CALL_SUBTEST_3(qr_verify_assert<MatrixXcd>());
}

View File

@ -112,16 +112,16 @@ template<typename VectorType> void vectorRedux(const VectorType& w)
void test_redux()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( matrixRedux(Matrix<float, 1, 1>()) );
CALL_SUBTEST( matrixRedux(Matrix2f()) );
CALL_SUBTEST( matrixRedux(Matrix4d()) );
CALL_SUBTEST( matrixRedux(MatrixXcf(3, 3)) );
CALL_SUBTEST( matrixRedux(MatrixXd(8, 12)) );
CALL_SUBTEST( matrixRedux(MatrixXi(8, 12)) );
CALL_SUBTEST_1( matrixRedux(Matrix<float, 1, 1>()) );
CALL_SUBTEST_2( matrixRedux(Matrix2f()) );
CALL_SUBTEST_3( matrixRedux(Matrix4d()) );
CALL_SUBTEST_4( matrixRedux(MatrixXcf(3, 3)) );
CALL_SUBTEST_5( matrixRedux(MatrixXd(8, 12)) );
CALL_SUBTEST_6( matrixRedux(MatrixXi(8, 12)) );
}
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( vectorRedux(Vector4f()) );
CALL_SUBTEST( vectorRedux(VectorXd(10)) );
CALL_SUBTEST( vectorRedux(VectorXf(33)) );
CALL_SUBTEST_7( vectorRedux(Vector4f()) );
CALL_SUBTEST_5( vectorRedux(VectorXd(10)) );
CALL_SUBTEST_8( vectorRedux(VectorXf(33)) );
}
}

View File

@ -95,6 +95,7 @@ void test_regression()
{
for(int i = 0; i < g_repeat; i++)
{
#ifdef EIGEN_TEST_PART_1
{
Vector2f points2f [1000];
Vector2f *points2f_ptrs [1000];
@ -108,7 +109,9 @@ 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 +122,9 @@ 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 +135,9 @@ 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 +148,6 @@ void test_regression()
delete coeffs12cd;
for(int i = 0; i < 1000; i++) delete points11cd_ptrs[i];
}
#endif
}
}

View File

@ -50,7 +50,7 @@ void resizeLikeTest31() { resizeLikeTest<3,1>(); }
void test_resize()
{
CALL_SUBTEST( resizeLikeTest12() );
CALL_SUBTEST( resizeLikeTest1020() );
CALL_SUBTEST( resizeLikeTest31() );
CALL_SUBTEST(resizeLikeTest12() );
CALL_SUBTEST(resizeLikeTest1020() );
CALL_SUBTEST(resizeLikeTest31() );
}

View File

@ -35,14 +35,14 @@ template<typename MatrixType> void verifySizeOf(const MatrixType&)
void test_sizeof()
{
CALL_SUBTEST( verifySizeOf(Matrix<float, 1, 1>()) );
CALL_SUBTEST( verifySizeOf(Matrix4d()) );
CALL_SUBTEST( verifySizeOf(Matrix<double, 4, 2>()) );
CALL_SUBTEST( verifySizeOf(Matrix<bool, 7, 5>()) );
CALL_SUBTEST( verifySizeOf(MatrixXcf(3, 3)) );
CALL_SUBTEST( verifySizeOf(MatrixXi(8, 12)) );
CALL_SUBTEST( verifySizeOf(MatrixXcd(20, 20)) );
CALL_SUBTEST( verifySizeOf(Matrix<float, 100, 100>()) );
CALL_SUBTEST(verifySizeOf(Matrix<float, 1, 1>()) );
CALL_SUBTEST(verifySizeOf(Matrix4d()) );
CALL_SUBTEST(verifySizeOf(Matrix<double, 4, 2>()) );
CALL_SUBTEST(verifySizeOf(Matrix<bool, 7, 5>()) );
CALL_SUBTEST(verifySizeOf(MatrixXcf(3, 3)) );
CALL_SUBTEST(verifySizeOf(MatrixXi(8, 12)) );
CALL_SUBTEST(verifySizeOf(MatrixXcd(20, 20)) );
CALL_SUBTEST(verifySizeOf(Matrix<float, 100, 100>()) );
VERIFY(sizeof(std::complex<float>) == 2*sizeof(float));
VERIFY(sizeof(std::complex<double>) == 2*sizeof(double));

View File

@ -50,8 +50,8 @@ template<typename Scalar> void smallVectors()
void test_smallvectors()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( smallVectors<int>() );
CALL_SUBTEST( smallVectors<float>() );
CALL_SUBTEST( smallVectors<double>() );
CALL_SUBTEST(smallVectors<int>() );
CALL_SUBTEST(smallVectors<float>() );
CALL_SUBTEST(smallVectors<double>() );
}
}

View File

@ -344,10 +344,10 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
void test_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)) );
}
}

View File

@ -123,10 +123,10 @@ template<typename SparseMatrixType> void sparse_product(const SparseMatrixType&
void test_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)) );
}
}

View File

@ -172,8 +172,8 @@ template<typename Scalar> void sparse_solvers(int rows, int cols)
initSparse<Scalar>(density, refMat2, m2, ForceNonZeroDiag, &zeroCoords, &nonzeroCoords);
LU<DenseMatrix> refLu(refMat2);
refLu.solve(b, &refX);
FullPivLU<DenseMatrix> refLu(refMat2);
refX = refLu.solve(b);
#if defined(EIGEN_SUPERLU_SUPPORT) || defined(EIGEN_UMFPACK_SUPPORT)
Scalar refDet = refLu.determinant();
#endif
@ -229,8 +229,8 @@ template<typename Scalar> void sparse_solvers(int rows, int cols)
void test_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>(100, 100) );
// CALL_SUBTEST(sparse_solvers<double>(8, 8) );
CALL_SUBTEST(sparse_solvers<std::complex<double> >(16, 16) );
// CALL_SUBTEST(sparse_solvers<double>(100, 100) );
}
}

View File

@ -91,9 +91,9 @@ template<typename Scalar> void sparse_vector(int rows, int cols)
void test_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) );
}
}

View File

@ -84,10 +84,10 @@ template<typename MatrixType> void stable_norm(const MatrixType& m)
void test_stable_norm()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( stable_norm(Matrix<float, 1, 1>()) );
CALL_SUBTEST( stable_norm(Vector4d()) );
CALL_SUBTEST( stable_norm(VectorXd(ei_random<int>(10,2000))) );
CALL_SUBTEST( stable_norm(VectorXf(ei_random<int>(10,2000))) );
CALL_SUBTEST( stable_norm(VectorXcd(ei_random<int>(10,2000))) );
CALL_SUBTEST_1( stable_norm(Matrix<float, 1, 1>()) );
CALL_SUBTEST_2( stable_norm(Vector4d()) );
CALL_SUBTEST_3( stable_norm(VectorXd(ei_random<int>(10,2000))) );
CALL_SUBTEST_4( stable_norm(VectorXf(ei_random<int>(10,2000))) );
CALL_SUBTEST_5( stable_norm(VectorXcd(ei_random<int>(10,2000))) );
}
}

View File

@ -135,29 +135,29 @@ void check_stdvector_quaternion(const QuaternionType&)
void test_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_2(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_1(check_stdvector_matrix(Matrix2f()));
CALL_SUBTEST_1(check_stdvector_matrix(Vector4f()));
CALL_SUBTEST_1(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(heck_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()));
}

View File

@ -215,14 +215,14 @@ void data_and_stride(const MatrixType& m)
void test_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)) );
CALL_SUBTEST( data_and_stride(MatrixXf(ei_random(5,50), ei_random(5,50))) );
CALL_SUBTEST( data_and_stride(Matrix<int,Dynamic,Dynamic,RowMajor>(ei_random(5,50), ei_random(5,50))) );
CALL_SUBTEST_6( data_and_stride(MatrixXf(ei_random(5,50), ei_random(5,50))) );
CALL_SUBTEST_7( data_and_stride(Matrix<int,Dynamic,Dynamic,RowMajor>(ei_random(5,50), ei_random(5,50))) );
}
}

View File

@ -100,17 +100,17 @@ template<typename MatrixType> void svd_verify_assert()
void test_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)) );
// CALL_SUBTEST(svd(MatrixXcd(6,6)) );
// CALL_SUBTEST(svd(MatrixXcf(3,3)) );
}
CALL_SUBTEST( svd_verify_assert<Matrix3f>() );
CALL_SUBTEST( svd_verify_assert<Matrix3d>() );
CALL_SUBTEST( svd_verify_assert<MatrixXf>() );
CALL_SUBTEST( svd_verify_assert<MatrixXd>() );
CALL_SUBTEST_1( svd_verify_assert<Matrix3f>() );
CALL_SUBTEST_2( svd_verify_assert<Matrix4d>() );
CALL_SUBTEST_3( svd_verify_assert<MatrixXf>() );
CALL_SUBTEST_4( svd_verify_assert<MatrixXd>() );
}

View File

@ -91,8 +91,8 @@ template<typename MatrixType> void swap(const MatrixType& m)
void test_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_1( swap(Matrix3f()) ); // fixed size, no vectorization
CALL_SUBTEST_2( swap(Matrix4d()) ); // fixed size, possible vectorization
CALL_SUBTEST_3( swap(MatrixXd(3,3)) ); // dyn size, no vectorization
CALL_SUBTEST_4( swap(MatrixXf(30,30)) ); // dyn size, possible vectorization
}

View File

@ -137,12 +137,12 @@ template<typename MatrixType> void triangular(const MatrixType& m)
void test_triangular()
{
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(MatrixXcd(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(MatrixXcd(17,17)) );
CALL_SUBTEST_7( triangular(Matrix<float,Dynamic,Dynamic,RowMajor>(5, 5)) );
}
}

View File

@ -181,17 +181,17 @@ void test_umeyama()
// works also for dimensions bigger than 3...
for (int dim=2; dim<8; ++dim)
{
CALL_SUBTEST(run_test<MatrixXd>(dim, num_elements));
CALL_SUBTEST(run_test<MatrixXf>(dim, num_elements));
CALL_SUBTEST_1(run_test<MatrixXd>(dim, num_elements));
CALL_SUBTEST_2(run_test<MatrixXf>(dim, num_elements));
}
CALL_SUBTEST((run_fixed_size_test<float, 2>(num_elements)));
CALL_SUBTEST((run_fixed_size_test<float, 3>(num_elements)));
CALL_SUBTEST((run_fixed_size_test<float, 4>(num_elements)));
CALL_SUBTEST_3((run_fixed_size_test<float, 2>(num_elements)));
CALL_SUBTEST_4((run_fixed_size_test<float, 3>(num_elements)));
CALL_SUBTEST_5((run_fixed_size_test<float, 4>(num_elements)));
CALL_SUBTEST((run_fixed_size_test<double, 2>(num_elements)));
CALL_SUBTEST((run_fixed_size_test<double, 3>(num_elements)));
CALL_SUBTEST((run_fixed_size_test<double, 4>(num_elements)));
CALL_SUBTEST_6((run_fixed_size_test<double, 2>(num_elements)));
CALL_SUBTEST_7((run_fixed_size_test<double, 3>(num_elements)));
CALL_SUBTEST_8((run_fixed_size_test<double, 4>(num_elements)));
}
// Those two calls don't compile and result in meaningful error messages!

View File

@ -115,17 +115,17 @@ template<typename VectorType> void vectorVisitor(const VectorType& w)
void test_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_8( vectorVisitor(VectorXd(10)) );
CALL_SUBTEST_9( vectorVisitor(RowVectorXd(10)) );
CALL_SUBTEST_10( vectorVisitor(VectorXf(33)) );
}
}

View File

@ -192,7 +192,7 @@ MatrixExponential<MatrixType>::MatrixExponential(const MatrixType &M, MatrixType
computeUV(RealScalar());
m_tmp1 = m_U + m_V; // numerator of Pade approximant
m_tmp2 = -m_U + m_V; // denominator of Pade approximant
m_tmp2.partialLu().solve(m_tmp1, result);
*result = m_tmp2.partialPivLu().solve(m_tmp1);
for (int i=0; i<m_squarings; i++)
*result *= *result; // undo scaling by repeated squaring
}

View File

@ -206,22 +206,28 @@ struct TreeTest
void test_BVH()
{
for(int i = 0; i < g_repeat; i++) {
#ifdef EIGEN_TEST_PART_1
TreeTest<2> test2;
CALL_SUBTEST(test2.testIntersect1());
CALL_SUBTEST(test2.testMinimize1());
CALL_SUBTEST(test2.testIntersect2());
CALL_SUBTEST(test2.testMinimize2());
#endif
#ifdef EIGEN_TEST_PART_2
TreeTest<3> test3;
CALL_SUBTEST(test3.testIntersect1());
CALL_SUBTEST(test3.testMinimize1());
CALL_SUBTEST(test3.testIntersect2());
CALL_SUBTEST(test3.testMinimize2());
#endif
#ifdef EIGEN_TEST_PART_3
TreeTest<4> test4;
CALL_SUBTEST(test4.testIntersect1());
CALL_SUBTEST(test4.testMinimize1());
CALL_SUBTEST(test4.testIntersect2());
CALL_SUBTEST(test4.testMinimize2());
#endif
}
}

View File

@ -69,6 +69,6 @@ void alignedvector3()
void test_alignedvector3()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST(( alignedvector3<float>() ));
CALL_SUBTEST( alignedvector3<float>() );
}
}

View File

@ -110,18 +110,18 @@ void randomTest(const MatrixType& m, double tol)
void test_matrixExponential()
{
CALL_SUBTEST(test2dRotation<double>(1e-14));
CALL_SUBTEST(test2dRotation<float>(1e-5));
CALL_SUBTEST(test2dHyperbolicRotation<double>(1e-14));
CALL_SUBTEST(test2dHyperbolicRotation<float>(1e-5));
CALL_SUBTEST(testPascal<float>(1e-5));
CALL_SUBTEST(testPascal<double>(1e-14));
CALL_SUBTEST(randomTest(Matrix2d(), 1e-13));
CALL_SUBTEST(randomTest(Matrix<double,3,3,RowMajor>(), 1e-13));
CALL_SUBTEST(randomTest(Matrix4cd(), 1e-13));
CALL_SUBTEST(randomTest(MatrixXd(8,8), 1e-13));
CALL_SUBTEST(randomTest(Matrix2f(), 1e-4));
CALL_SUBTEST(randomTest(Matrix3cf(), 1e-4));
CALL_SUBTEST(randomTest(Matrix4f(), 1e-4));
CALL_SUBTEST(randomTest(MatrixXf(8,8), 1e-4));
CALL_SUBTEST_2(test2dRotation<double>(1e-14));
CALL_SUBTEST_1(test2dRotation<float>(1e-5));
CALL_SUBTEST_2(test2dHyperbolicRotation<double>(1e-14));
CALL_SUBTEST_1(test2dHyperbolicRotation<float>(1e-5));
CALL_SUBTEST_1(testPascal<float>(1e-5));
CALL_SUBTEST_2(testPascal<double>(1e-14));
CALL_SUBTEST_2(randomTest(Matrix2d(), 1e-13));
CALL_SUBTEST_2(randomTest(Matrix<double,3,3,RowMajor>(), 1e-13));
CALL_SUBTEST_3(randomTest(Matrix4cd(), 1e-13));
CALL_SUBTEST_4(randomTest(MatrixXd(8,8), 1e-13));
CALL_SUBTEST_1(randomTest(Matrix2f(), 1e-4));
CALL_SUBTEST_5(randomTest(Matrix3cf(), 1e-4));
CALL_SUBTEST_1(randomTest(Matrix4f(), 1e-4));
CALL_SUBTEST_6(randomTest(MatrixXf(8,8), 1e-4));
}