Upgraded Eigen from 3.0.2 to 3.0.3
parent
a24f23374d
commit
6787248f9a
|
|
@ -279,9 +279,15 @@ install(FILES
|
||||||
)
|
)
|
||||||
|
|
||||||
if(EIGEN_BUILD_PKGCONFIG)
|
if(EIGEN_BUILD_PKGCONFIG)
|
||||||
|
SET(path_separator ":")
|
||||||
|
STRING(REPLACE ${path_separator} ";" pkg_config_libdir_search "$ENV{PKG_CONFIG_LIBDIR}")
|
||||||
|
message(STATUS "searching for 'pkgconfig' directory in PKG_CONFIG_LIBDIR ( $ENV{PKG_CONFIG_LIBDIR} ), ${CMAKE_INSTALL_PREFIX}/share, and ${CMAKE_INSTALL_PREFIX}/lib")
|
||||||
|
FIND_PATH(pkg_config_libdir pkgconfig ${pkg_config_libdir_search} ${CMAKE_INSTALL_PREFIX}/share ${CMAKE_INSTALL_PREFIX}/lib ${pkg_config_libdir_search})
|
||||||
|
message(STATUS "found ${pkg_config_libdir}/pkgconfig" )
|
||||||
|
|
||||||
configure_file(eigen3.pc.in eigen3.pc)
|
configure_file(eigen3.pc.in eigen3.pc)
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eigen3.pc
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eigen3.pc
|
||||||
DESTINATION share/pkgconfig
|
DESTINATION ${pkg_config_libdir}/pkgconfig
|
||||||
)
|
)
|
||||||
endif(EIGEN_BUILD_PKGCONFIG)
|
endif(EIGEN_BUILD_PKGCONFIG)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -158,10 +158,19 @@ template<typename _MatrixType, int _UpLo> class LDLT
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \returns a solution x of \f$ A x = b \f$ using the current decomposition of A.
|
/** \returns a solution x of \f$ A x = b \f$ using the current decomposition of A.
|
||||||
|
*
|
||||||
|
* This function also supports in-place solves using the syntax <tt>x = decompositionObject.solve(x)</tt> .
|
||||||
*
|
*
|
||||||
* \note_about_checking_solutions
|
* \note_about_checking_solutions
|
||||||
*
|
*
|
||||||
* \sa solveInPlace(), MatrixBase::ldlt()
|
* More precisely, this method solves \f$ A x = b \f$ using the decomposition \f$ A = P^T L D L^* P \f$
|
||||||
|
* by solving the systems \f$ P^T y_1 = b \f$, \f$ L y_2 = y_1 \f$, \f$ D y_3 = y_2 \f$,
|
||||||
|
* \f$ L^* y_4 = y_3 \f$ and \f$ P x = y_4 \f$ in succession. If the matrix \f$ A \f$ is singular, then
|
||||||
|
* \f$ D \f$ will also be singular (all the other matrices are invertible). In that case, the
|
||||||
|
* least-square solution of \f$ D y_3 = y_2 \f$ is computed. This does not mean that this function
|
||||||
|
* computes the least-square solution of \f$ A x = b \f$ is \f$ A \f$ is singular.
|
||||||
|
*
|
||||||
|
* \sa MatrixBase::ldlt()
|
||||||
*/
|
*/
|
||||||
template<typename Rhs>
|
template<typename Rhs>
|
||||||
inline const internal::solve_retval<LDLT, Rhs>
|
inline const internal::solve_retval<LDLT, Rhs>
|
||||||
|
|
@ -376,7 +385,21 @@ struct solve_retval<LDLT<_MatrixType,_UpLo>, Rhs>
|
||||||
dec().matrixL().solveInPlace(dst);
|
dec().matrixL().solveInPlace(dst);
|
||||||
|
|
||||||
// dst = D^-1 (L^-1 P b)
|
// dst = D^-1 (L^-1 P b)
|
||||||
dst = dec().vectorD().asDiagonal().inverse() * dst;
|
// more precisely, use pseudo-inverse of D (see bug 241)
|
||||||
|
using std::abs;
|
||||||
|
using std::max;
|
||||||
|
typedef typename LDLTType::MatrixType MatrixType;
|
||||||
|
typedef typename LDLTType::Scalar Scalar;
|
||||||
|
typedef typename LDLTType::RealScalar RealScalar;
|
||||||
|
const Diagonal<const MatrixType> vectorD = dec().vectorD();
|
||||||
|
RealScalar tolerance = (max)(vectorD.array().abs().maxCoeff() * NumTraits<Scalar>::epsilon(),
|
||||||
|
RealScalar(1) / NumTraits<RealScalar>::highest()); // motivated by LAPACK's xGELSS
|
||||||
|
for (Index i = 0; i < vectorD.size(); ++i) {
|
||||||
|
if(abs(vectorD(i)) > tolerance)
|
||||||
|
dst.row(i) /= vectorD(i);
|
||||||
|
else
|
||||||
|
dst.row(i).setZero();
|
||||||
|
}
|
||||||
|
|
||||||
// dst = L^-T (D^-1 L^-1 P b)
|
// dst = L^-T (D^-1 L^-1 P b)
|
||||||
dec().matrixU().solveInPlace(dst);
|
dec().matrixU().solveInPlace(dst);
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ struct isMuchSmallerThan_scalar_selector<Derived, true>
|
||||||
*
|
*
|
||||||
* \note The fuzzy compares are done multiplicatively. Two vectors \f$ v \f$ and \f$ w \f$
|
* \note The fuzzy compares are done multiplicatively. Two vectors \f$ v \f$ and \f$ w \f$
|
||||||
* are considered to be approximately equal within precision \f$ p \f$ if
|
* are considered to be approximately equal within precision \f$ p \f$ if
|
||||||
* \f[ \Vert v - w \Vert \leqslant p\,\(min)(\Vert v\Vert, \Vert w\Vert). \f]
|
* \f[ \Vert v - w \Vert \leqslant p\,\min(\Vert v\Vert, \Vert w\Vert). \f]
|
||||||
* For matrices, the comparison is done using the Hilbert-Schmidt norm (aka Frobenius norm
|
* For matrices, the comparison is done using the Hilbert-Schmidt norm (aka Frobenius norm
|
||||||
* L2 norm).
|
* L2 norm).
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
* \tparam PlainObjectType the equivalent matrix type of the mapped data
|
* \tparam PlainObjectType the equivalent matrix type of the mapped data
|
||||||
* \tparam MapOptions specifies whether the pointer is \c #Aligned, or \c #Unaligned.
|
* \tparam MapOptions specifies whether the pointer is \c #Aligned, or \c #Unaligned.
|
||||||
* The default is \c #Unaligned.
|
* The default is \c #Unaligned.
|
||||||
* \tparam StrideType optionnally specifies strides. By default, Map assumes the memory layout
|
* \tparam StrideType optionally specifies strides. By default, Map assumes the memory layout
|
||||||
* of an ordinary, contiguous array. This can be overridden by specifying strides.
|
* of an ordinary, contiguous array. This can be overridden by specifying strides.
|
||||||
* The type passed here must be a specialization of the Stride template, see examples below.
|
* The type passed here must be a specialization of the Stride template, see examples below.
|
||||||
*
|
*
|
||||||
|
|
@ -72,9 +72,9 @@
|
||||||
* Example: \include Map_placement_new.cpp
|
* Example: \include Map_placement_new.cpp
|
||||||
* Output: \verbinclude Map_placement_new.out
|
* Output: \verbinclude Map_placement_new.out
|
||||||
*
|
*
|
||||||
* This class is the return type of Matrix::Map() but can also be used directly.
|
* This class is the return type of PlainObjectBase::Map() but can also be used directly.
|
||||||
*
|
*
|
||||||
* \sa Matrix::Map(), \ref TopicStorageOrders
|
* \sa PlainObjectBase::Map(), \ref TopicStorageOrders
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,8 @@ template<typename Derived> class MatrixBase
|
||||||
|
|
||||||
// huuuge hack. make Eigen2's matrix.part<Diagonal>() work in eigen3. Problem: Diagonal is now a class template instead
|
// huuuge hack. make Eigen2's matrix.part<Diagonal>() work in eigen3. Problem: Diagonal is now a class template instead
|
||||||
// of an integer constant. Solution: overload the part() method template wrt template parameters list.
|
// of an integer constant. Solution: overload the part() method template wrt template parameters list.
|
||||||
template<template<typename T, int n> class U>
|
// Note: replacing next line by "template<template<typename T, int n> class U>" produces a mysterious error C2082 in MSVC.
|
||||||
|
template<template<typename, int> class U>
|
||||||
const DiagonalWrapper<ConstDiagonalReturnType> part() const
|
const DiagonalWrapper<ConstDiagonalReturnType> part() const
|
||||||
{ return diagonal().asDiagonal(); }
|
{ return diagonal().asDiagonal(); }
|
||||||
#endif // EIGEN2_SUPPORT
|
#endif // EIGEN2_SUPPORT
|
||||||
|
|
|
||||||
|
|
@ -425,9 +425,6 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
|
||||||
* while the AlignedMap() functions return aligned Map objects and thus should be called only with 16-byte-aligned
|
* while the AlignedMap() functions return aligned Map objects and thus should be called only with 16-byte-aligned
|
||||||
* \a data pointers.
|
* \a data pointers.
|
||||||
*
|
*
|
||||||
* These methods do not allow to specify strides. If you need to specify strides, you have to
|
|
||||||
* use the Map class directly.
|
|
||||||
*
|
|
||||||
* \see class Map
|
* \see class Map
|
||||||
*/
|
*/
|
||||||
//@{
|
//@{
|
||||||
|
|
|
||||||
|
|
@ -256,16 +256,16 @@ class ScaledProduct
|
||||||
: Base(prod.lhs(),prod.rhs()), m_prod(prod), m_alpha(x) {}
|
: Base(prod.lhs(),prod.rhs()), m_prod(prod), m_alpha(x) {}
|
||||||
|
|
||||||
template<typename Dest>
|
template<typename Dest>
|
||||||
inline void evalTo(Dest& dst) const { dst.setZero(); scaleAndAddTo(dst,m_alpha); }
|
inline void evalTo(Dest& dst) const { dst.setZero(); scaleAndAddTo(dst, Scalar(1)); }
|
||||||
|
|
||||||
template<typename Dest>
|
template<typename Dest>
|
||||||
inline void addTo(Dest& dst) const { scaleAndAddTo(dst,m_alpha); }
|
inline void addTo(Dest& dst) const { scaleAndAddTo(dst, Scalar(1)); }
|
||||||
|
|
||||||
template<typename Dest>
|
template<typename Dest>
|
||||||
inline void subTo(Dest& dst) const { scaleAndAddTo(dst,-m_alpha); }
|
inline void subTo(Dest& dst) const { scaleAndAddTo(dst, Scalar(-1)); }
|
||||||
|
|
||||||
template<typename Dest>
|
template<typename Dest>
|
||||||
inline void scaleAndAddTo(Dest& dst,Scalar alpha) const { m_prod.derived().scaleAndAddTo(dst,alpha); }
|
inline void scaleAndAddTo(Dest& dst,Scalar alpha) const { m_prod.derived().scaleAndAddTo(dst,alpha * m_alpha); }
|
||||||
|
|
||||||
const Scalar& alpha() const { return m_alpha; }
|
const Scalar& alpha() const { return m_alpha; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@ void TriangularView<MatrixType,Mode>::solveInPlace(const MatrixBase<OtherDerived
|
||||||
eigen_assert(cols() == rows());
|
eigen_assert(cols() == rows());
|
||||||
eigen_assert( (Side==OnTheLeft && cols() == other.rows()) || (Side==OnTheRight && cols() == other.cols()) );
|
eigen_assert( (Side==OnTheLeft && cols() == other.rows()) || (Side==OnTheRight && cols() == other.cols()) );
|
||||||
eigen_assert(!(Mode & ZeroDiag));
|
eigen_assert(!(Mode & ZeroDiag));
|
||||||
eigen_assert(Mode & (Upper|Lower));
|
eigen_assert((Mode & (Upper|Lower)) != 0);
|
||||||
|
|
||||||
enum { copy = internal::traits<OtherDerived>::Flags & RowMajorBit && OtherDerived::IsVectorAtCompileTime };
|
enum { copy = internal::traits<OtherDerived>::Flags & RowMajorBit && OtherDerived::IsVectorAtCompileTime };
|
||||||
typedef typename internal::conditional<copy,
|
typedef typename internal::conditional<copy,
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#define EIGEN_WORLD_VERSION 3
|
#define EIGEN_WORLD_VERSION 3
|
||||||
#define EIGEN_MAJOR_VERSION 0
|
#define EIGEN_MAJOR_VERSION 0
|
||||||
#define EIGEN_MINOR_VERSION 2
|
#define EIGEN_MINOR_VERSION 3
|
||||||
|
|
||||||
#define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \
|
#define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \
|
||||||
(EIGEN_MAJOR_VERSION>y || (EIGEN_MAJOR_VERSION>=y && \
|
(EIGEN_MAJOR_VERSION>y || (EIGEN_MAJOR_VERSION>=y && \
|
||||||
|
|
|
||||||
|
|
@ -51,19 +51,19 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim==
|
||||||
{ if (AmbientDimAtCompileTime!=Dynamic) setNull(); }
|
{ if (AmbientDimAtCompileTime!=Dynamic) setNull(); }
|
||||||
|
|
||||||
/** Constructs a null box with \a _dim the dimension of the ambient space. */
|
/** Constructs a null box with \a _dim the dimension of the ambient space. */
|
||||||
inline explicit AlignedBox(int _dim) : m_(min)(_dim), m_(max)(_dim)
|
inline explicit AlignedBox(int _dim) : m_min(_dim), m_max(_dim)
|
||||||
{ setNull(); }
|
{ setNull(); }
|
||||||
|
|
||||||
/** Constructs a box with extremities \a _min and \a _max. */
|
/** Constructs a box with extremities \a _min and \a _max. */
|
||||||
inline AlignedBox(const VectorType& _min, const VectorType& _max) : m_(min)(_min), m_(max)(_max) {}
|
inline AlignedBox(const VectorType& _min, const VectorType& _max) : m_min(_min), m_max(_max) {}
|
||||||
|
|
||||||
/** Constructs a box containing a single point \a p. */
|
/** Constructs a box containing a single point \a p. */
|
||||||
inline explicit AlignedBox(const VectorType& p) : m_(min)(p), m_(max)(p) {}
|
inline explicit AlignedBox(const VectorType& p) : m_min(p), m_max(p) {}
|
||||||
|
|
||||||
~AlignedBox() {}
|
~AlignedBox() {}
|
||||||
|
|
||||||
/** \returns the dimension in which the box holds */
|
/** \returns the dimension in which the box holds */
|
||||||
inline int dim() const { return AmbientDimAtCompileTime==Dynamic ? m_min.size()-1 : AmbientDimAtCompileTime; }
|
inline int dim() const { return AmbientDimAtCompileTime==Dynamic ? m_min.size()-1 : int(AmbientDimAtCompileTime); }
|
||||||
|
|
||||||
/** \returns true if the box is null, i.e, empty. */
|
/** \returns true if the box is null, i.e, empty. */
|
||||||
inline bool isNull() const { return (m_min.cwise() > m_max).any(); }
|
inline bool isNull() const { return (m_min.cwise() > m_max).any(); }
|
||||||
|
|
@ -71,8 +71,8 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim==
|
||||||
/** Makes \c *this a null/empty box. */
|
/** Makes \c *this a null/empty box. */
|
||||||
inline void setNull()
|
inline void setNull()
|
||||||
{
|
{
|
||||||
m_min.setConstant( std::numeric_limits<Scalar>::(max)());
|
m_min.setConstant( (std::numeric_limits<Scalar>::max)());
|
||||||
m_max.setConstant(-std::numeric_limits<Scalar>::(max)());
|
m_max.setConstant(-(std::numeric_limits<Scalar>::max)());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \returns the minimal corner */
|
/** \returns the minimal corner */
|
||||||
|
|
@ -90,19 +90,19 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim==
|
||||||
|
|
||||||
/** \returns true if the box \a b is entirely inside the box \c *this. */
|
/** \returns true if the box \a b is entirely inside the box \c *this. */
|
||||||
inline bool contains(const AlignedBox& b) const
|
inline bool contains(const AlignedBox& b) const
|
||||||
{ return (m_min.cwise()<=b.(min)()).all() && (b.(max)().cwise()<=m_max).all(); }
|
{ return (m_min.cwise()<=(b.min)()).all() && ((b.max)().cwise()<=m_max).all(); }
|
||||||
|
|
||||||
/** Extends \c *this such that it contains the point \a p and returns a reference to \c *this. */
|
/** Extends \c *this such that it contains the point \a p and returns a reference to \c *this. */
|
||||||
inline AlignedBox& extend(const VectorType& p)
|
inline AlignedBox& extend(const VectorType& p)
|
||||||
{ m_min = m_min.cwise().(min)(p); m_max = m_max.cwise().(max)(p); return *this; }
|
{ m_min = (m_min.cwise().min)(p); m_max = (m_max.cwise().max)(p); return *this; }
|
||||||
|
|
||||||
/** Extends \c *this such that it contains the box \a b and returns a reference to \c *this. */
|
/** Extends \c *this such that it contains the box \a b and returns a reference to \c *this. */
|
||||||
inline AlignedBox& extend(const AlignedBox& b)
|
inline AlignedBox& extend(const AlignedBox& b)
|
||||||
{ m_min = m_min.cwise().(min)(b.m_min); m_max = m_max.cwise().(max)(b.m_max); return *this; }
|
{ m_min = (m_min.cwise().min)(b.m_min); m_max = (m_max.cwise().max)(b.m_max); return *this; }
|
||||||
|
|
||||||
/** Clamps \c *this by the box \a b and returns a reference to \c *this. */
|
/** Clamps \c *this by the box \a b and returns a reference to \c *this. */
|
||||||
inline AlignedBox& clamp(const AlignedBox& b)
|
inline AlignedBox& clamp(const AlignedBox& b)
|
||||||
{ m_min = m_min.cwise().(max)(b.m_min); m_max = m_max.cwise().(min)(b.m_max); return *this; }
|
{ m_min = (m_min.cwise().max)(b.m_min); m_max = (m_max.cwise().min)(b.m_max); return *this; }
|
||||||
|
|
||||||
/** Translate \c *this by the vector \a t and returns a reference to \c *this. */
|
/** Translate \c *this by the vector \a t and returns a reference to \c *this. */
|
||||||
inline AlignedBox& translate(const VectorType& t)
|
inline AlignedBox& translate(const VectorType& t)
|
||||||
|
|
@ -138,8 +138,8 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim==
|
||||||
template<typename OtherScalarType>
|
template<typename OtherScalarType>
|
||||||
inline explicit AlignedBox(const AlignedBox<OtherScalarType,AmbientDimAtCompileTime>& other)
|
inline explicit AlignedBox(const AlignedBox<OtherScalarType,AmbientDimAtCompileTime>& other)
|
||||||
{
|
{
|
||||||
m_min = other.(min)().template cast<Scalar>();
|
m_min = (other.min)().template cast<Scalar>();
|
||||||
m_max = other.(max)().template cast<Scalar>();
|
m_max = (other.max)().template cast<Scalar>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \returns \c true if \c *this is approximately equal to \a other, within the precision
|
/** \returns \c true if \c *this is approximately equal to \a other, within the precision
|
||||||
|
|
|
||||||
|
|
@ -590,6 +590,9 @@ JacobiSVD<MatrixType, QRPreconditioner>::compute(const MatrixType& matrix, unsig
|
||||||
// only worsening the precision of U and V as we accumulate more rotations
|
// only worsening the precision of U and V as we accumulate more rotations
|
||||||
const RealScalar precision = RealScalar(2) * NumTraits<Scalar>::epsilon();
|
const RealScalar precision = RealScalar(2) * NumTraits<Scalar>::epsilon();
|
||||||
|
|
||||||
|
// limit for very small denormal numbers to be considered zero in order to avoid infinite loops (see bug 286)
|
||||||
|
const RealScalar considerAsZero = RealScalar(2) * std::numeric_limits<RealScalar>::denorm_min();
|
||||||
|
|
||||||
/*** step 1. The R-SVD step: we use a QR decomposition to reduce to the case of a square matrix */
|
/*** step 1. The R-SVD step: we use a QR decomposition to reduce to the case of a square matrix */
|
||||||
|
|
||||||
if(!internal::qr_preconditioner_impl<MatrixType, QRPreconditioner, internal::PreconditionIfMoreColsThanRows>::run(*this, matrix)
|
if(!internal::qr_preconditioner_impl<MatrixType, QRPreconditioner, internal::PreconditionIfMoreColsThanRows>::run(*this, matrix)
|
||||||
|
|
@ -617,10 +620,11 @@ JacobiSVD<MatrixType, QRPreconditioner>::compute(const MatrixType& matrix, unsig
|
||||||
{
|
{
|
||||||
// if this 2x2 sub-matrix is not diagonal already...
|
// if this 2x2 sub-matrix is not diagonal already...
|
||||||
// notice that this comparison will evaluate to false if any NaN is involved, ensuring that NaN's don't
|
// notice that this comparison will evaluate to false if any NaN is involved, ensuring that NaN's don't
|
||||||
// keep us iterating forever.
|
// keep us iterating forever. Similarly, small denormal numbers are considered zero.
|
||||||
using std::max;
|
using std::max;
|
||||||
if((max)(internal::abs(m_workMatrix.coeff(p,q)),internal::abs(m_workMatrix.coeff(q,p)))
|
RealScalar threshold = (max)(considerAsZero, precision * (max)(internal::abs(m_workMatrix.coeff(p,p)),
|
||||||
> (max)(internal::abs(m_workMatrix.coeff(p,p)),internal::abs(m_workMatrix.coeff(q,q)))*precision)
|
internal::abs(m_workMatrix.coeff(q,q))));
|
||||||
|
if((max)(internal::abs(m_workMatrix.coeff(p,q)),internal::abs(m_workMatrix.coeff(q,p))) > threshold)
|
||||||
{
|
{
|
||||||
finished = false;
|
finished = false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ void SparseTriangularView<ExpressionType,Mode>::solveInPlace(MatrixBase<OtherDer
|
||||||
eigen_assert(m_matrix.cols() == m_matrix.rows());
|
eigen_assert(m_matrix.cols() == m_matrix.rows());
|
||||||
eigen_assert(m_matrix.cols() == other.rows());
|
eigen_assert(m_matrix.cols() == other.rows());
|
||||||
eigen_assert(!(Mode & ZeroDiag));
|
eigen_assert(!(Mode & ZeroDiag));
|
||||||
eigen_assert(Mode & (Upper|Lower));
|
eigen_assert((Mode & (Upper|Lower)) != 0);
|
||||||
|
|
||||||
enum { copy = internal::traits<OtherDerived>::Flags & RowMajorBit };
|
enum { copy = internal::traits<OtherDerived>::Flags & RowMajorBit };
|
||||||
|
|
||||||
|
|
@ -298,7 +298,7 @@ void SparseTriangularView<ExpressionType,Mode>::solveInPlace(SparseMatrixBase<Ot
|
||||||
eigen_assert(m_matrix.cols() == m_matrix.rows());
|
eigen_assert(m_matrix.cols() == m_matrix.rows());
|
||||||
eigen_assert(m_matrix.cols() == other.rows());
|
eigen_assert(m_matrix.cols() == other.rows());
|
||||||
eigen_assert(!(Mode & ZeroDiag));
|
eigen_assert(!(Mode & ZeroDiag));
|
||||||
eigen_assert(Mode & (Upper|Lower));
|
eigen_assert((Mode & (Upper|Lower)) != 0);
|
||||||
|
|
||||||
// enum { copy = internal::traits<OtherDerived>::Flags & RowMajorBit };
|
// enum { copy = internal::traits<OtherDerived>::Flags & RowMajorBit };
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ OpenGL compatibility \b 3D </td><td>\code
|
||||||
glLoadMatrixf(t.data());\endcode</td></tr>
|
glLoadMatrixf(t.data());\endcode</td></tr>
|
||||||
<tr class="alt"><td>
|
<tr class="alt"><td>
|
||||||
OpenGL compatibility \b 2D </td><td>\code
|
OpenGL compatibility \b 2D </td><td>\code
|
||||||
Affine3f aux(Affine3f::Identity);
|
Affine3f aux(Affine3f::Identity());
|
||||||
aux.linear().topLeftCorner<2,2>() = t.linear();
|
aux.linear().topLeftCorner<2,2>() = t.linear();
|
||||||
aux.translation().start<2>() = t.translation();
|
aux.translation().start<2>() = t.translation();
|
||||||
glLoadMatrixf(aux.data());\endcode</td></tr>
|
glLoadMatrixf(aux.data());\endcode</td></tr>
|
||||||
|
|
|
||||||
|
|
@ -245,6 +245,22 @@ template<typename MatrixType> void cholesky_cplx(const MatrixType& m)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// regression test for bug 241
|
||||||
|
template<typename MatrixType> void cholesky_bug241(const MatrixType& m)
|
||||||
|
{
|
||||||
|
eigen_assert(m.rows() == 2 && m.cols() == 2);
|
||||||
|
|
||||||
|
typedef typename MatrixType::Scalar Scalar;
|
||||||
|
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
|
||||||
|
|
||||||
|
MatrixType matA;
|
||||||
|
matA << 1, 1, 1, 1;
|
||||||
|
VectorType vecB;
|
||||||
|
vecB << 1, 1;
|
||||||
|
VectorType vecX = matA.ldlt().solve(vecB);
|
||||||
|
VERIFY_IS_APPROX(matA * vecX, vecB);
|
||||||
|
}
|
||||||
|
|
||||||
template<typename MatrixType> void cholesky_verify_assert()
|
template<typename MatrixType> void cholesky_verify_assert()
|
||||||
{
|
{
|
||||||
MatrixType tmp;
|
MatrixType tmp;
|
||||||
|
|
@ -271,6 +287,7 @@ void test_cholesky()
|
||||||
for(int i = 0; i < g_repeat; i++) {
|
for(int i = 0; i < g_repeat; i++) {
|
||||||
CALL_SUBTEST_1( cholesky(Matrix<double,1,1>()) );
|
CALL_SUBTEST_1( cholesky(Matrix<double,1,1>()) );
|
||||||
CALL_SUBTEST_3( cholesky(Matrix2d()) );
|
CALL_SUBTEST_3( cholesky(Matrix2d()) );
|
||||||
|
CALL_SUBTEST_3( cholesky_bug241(Matrix2d()) );
|
||||||
CALL_SUBTEST_4( cholesky(Matrix3f()) );
|
CALL_SUBTEST_4( cholesky(Matrix3f()) );
|
||||||
CALL_SUBTEST_5( cholesky(Matrix4d()) );
|
CALL_SUBTEST_5( cholesky(Matrix4d()) );
|
||||||
s = internal::random<int>(1,200);
|
s = internal::random<int>(1,200);
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,10 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#ifdef NDEBUG
|
||||||
|
#undef NDEBUG
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef EIGEN_TEST_FUNC
|
#ifndef EIGEN_TEST_FUNC
|
||||||
#error EIGEN_TEST_FUNC must be defined
|
#error EIGEN_TEST_FUNC must be defined
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ template<typename MatrixType> void householder(const MatrixType& m)
|
||||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, Dynamic> VBlockMatrixType;
|
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, Dynamic> VBlockMatrixType;
|
||||||
typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, MatrixType::RowsAtCompileTime> TMatrixType;
|
typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, MatrixType::RowsAtCompileTime> TMatrixType;
|
||||||
|
|
||||||
Matrix<Scalar, EIGEN_SIZE_MAX(MatrixType::RowsAtCompileTime,MatrixType::ColsAtCompileTime), 1> _tmp(std::max(rows,cols));
|
Matrix<Scalar, EIGEN_SIZE_MAX(MatrixType::RowsAtCompileTime,MatrixType::ColsAtCompileTime), 1> _tmp((std::max)(rows,cols));
|
||||||
Scalar* tmp = &_tmp.coeffRef(0,0);
|
Scalar* tmp = &_tmp.coeffRef(0,0);
|
||||||
|
|
||||||
Scalar beta;
|
Scalar beta;
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ void jacobisvd_compare_to_full(const MatrixType& m,
|
||||||
typedef typename MatrixType::Index Index;
|
typedef typename MatrixType::Index Index;
|
||||||
Index rows = m.rows();
|
Index rows = m.rows();
|
||||||
Index cols = m.cols();
|
Index cols = m.cols();
|
||||||
Index diagSize = std::min(rows, cols);
|
Index diagSize = (std::min)(rows, cols);
|
||||||
|
|
||||||
JacobiSVD<MatrixType, QRPreconditioner> svd(m, computationOptions);
|
JacobiSVD<MatrixType, QRPreconditioner> svd(m, computationOptions);
|
||||||
|
|
||||||
|
|
@ -244,6 +244,17 @@ void jacobisvd_inf_nan()
|
||||||
svd.compute(m, ComputeFullU | ComputeFullV);
|
svd.compute(m, ComputeFullU | ComputeFullV);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Regression test for bug 286: JacobiSVD loops indefinitely with some
|
||||||
|
// matrices containing denormal numbers.
|
||||||
|
void jacobisvd_bug286()
|
||||||
|
{
|
||||||
|
Matrix2d M;
|
||||||
|
M << -7.90884e-313, -4.94e-324,
|
||||||
|
0, 5.60844e-313;
|
||||||
|
JacobiSVD<Matrix2d> svd;
|
||||||
|
svd.compute(M); // just check we don't loop indefinitely
|
||||||
|
}
|
||||||
|
|
||||||
void jacobisvd_preallocate()
|
void jacobisvd_preallocate()
|
||||||
{
|
{
|
||||||
Vector3f v(3.f, 2.f, 1.f);
|
Vector3f v(3.f, 2.f, 1.f);
|
||||||
|
|
@ -280,8 +291,6 @@ void jacobisvd_preallocate()
|
||||||
internal::set_is_malloc_allowed(false);
|
internal::set_is_malloc_allowed(false);
|
||||||
svd2.compute(m, ComputeFullU|ComputeFullV);
|
svd2.compute(m, ComputeFullU|ComputeFullV);
|
||||||
internal::set_is_malloc_allowed(true);
|
internal::set_is_malloc_allowed(true);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_jacobisvd()
|
void test_jacobisvd()
|
||||||
|
|
@ -336,4 +345,7 @@ void test_jacobisvd()
|
||||||
|
|
||||||
// Check that preallocation avoids subsequent mallocs
|
// Check that preallocation avoids subsequent mallocs
|
||||||
CALL_SUBTEST_9( jacobisvd_preallocate() );
|
CALL_SUBTEST_9( jacobisvd_preallocate() );
|
||||||
|
|
||||||
|
// Regression check for bug 286
|
||||||
|
CALL_SUBTEST_2( jacobisvd_bug286() );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ template<typename MatrixType> void lu_non_invertible()
|
||||||
typedef Matrix<typename MatrixType::Scalar, RowsAtCompileTime, RowsAtCompileTime>
|
typedef Matrix<typename MatrixType::Scalar, RowsAtCompileTime, RowsAtCompileTime>
|
||||||
RMatrixType;
|
RMatrixType;
|
||||||
|
|
||||||
Index rank = internal::random<Index>(1, std::min(rows, cols)-1);
|
Index rank = internal::random<Index>(1, (std::min)(rows, cols)-1);
|
||||||
|
|
||||||
// The image of the zero matrix should consist of a single (zero) column vector
|
// The image of the zero matrix should consist of a single (zero) column vector
|
||||||
VERIFY((MatrixType::Zero(rows,cols).fullPivLu().image(MatrixType::Zero(rows,cols)).cols() == 1));
|
VERIFY((MatrixType::Zero(rows,cols).fullPivLu().image(MatrixType::Zero(rows,cols)).cols() == 1));
|
||||||
|
|
@ -84,8 +84,8 @@ template<typename MatrixType> void lu_non_invertible()
|
||||||
MatrixType u(rows,cols);
|
MatrixType u(rows,cols);
|
||||||
u = lu.matrixLU().template triangularView<Upper>();
|
u = lu.matrixLU().template triangularView<Upper>();
|
||||||
RMatrixType l = RMatrixType::Identity(rows,rows);
|
RMatrixType l = RMatrixType::Identity(rows,rows);
|
||||||
l.block(0,0,rows,std::min(rows,cols)).template triangularView<StrictlyLower>()
|
l.block(0,0,rows,(std::min)(rows,cols)).template triangularView<StrictlyLower>()
|
||||||
= lu.matrixLU().block(0,0,rows,std::min(rows,cols));
|
= lu.matrixLU().block(0,0,rows,(std::min)(rows,cols));
|
||||||
|
|
||||||
VERIFY_IS_APPROX(lu.permutationP() * m1 * lu.permutationQ(), l*u);
|
VERIFY_IS_APPROX(lu.permutationP() * m1 * lu.permutationQ(), l*u);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,6 @@
|
||||||
// License and a copy of the GNU General Public License along with
|
// License and a copy of the GNU General Public License along with
|
||||||
// Eigen. If not, see <http://www.gnu.org/licenses/>.
|
// Eigen. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#define min(A,B) please_protect_your_min_with_parentheses
|
|
||||||
#define max(A,B) please_protect_your_max_with_parentheses
|
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
@ -33,6 +30,15 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
#include <limits>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <sstream>
|
||||||
|
#include <complex>
|
||||||
|
#include <deque>
|
||||||
|
#include <queue>
|
||||||
|
|
||||||
|
#define min(A,B) please_protect_your_min_with_parentheses
|
||||||
|
#define max(A,B) please_protect_your_max_with_parentheses
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
#undef NDEBUG
|
#undef NDEBUG
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ bool equalsIdentity(const MatrixType& A)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Index i = 0; i < A.rows(); ++i) {
|
for (Index i = 0; i < A.rows(); ++i) {
|
||||||
for (Index j = 0; j < std::min(i, A.cols()); ++j) {
|
for (Index j = 0; j < (std::min)(i, A.cols()); ++j) {
|
||||||
offDiagOK = offDiagOK && (A(i,j) == zero);
|
offDiagOK = offDiagOK && (A(i,j) == zero);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ template<typename Scalar> void packetmath()
|
||||||
{
|
{
|
||||||
data1[i] = internal::random<Scalar>()/RealScalar(PacketSize);
|
data1[i] = internal::random<Scalar>()/RealScalar(PacketSize);
|
||||||
data2[i] = internal::random<Scalar>()/RealScalar(PacketSize);
|
data2[i] = internal::random<Scalar>()/RealScalar(PacketSize);
|
||||||
refvalue = std::max(refvalue,internal::abs(data1[i]));
|
refvalue = (std::max)(refvalue,internal::abs(data1[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal::pstore(data2, internal::pload<Packet>(data1));
|
internal::pstore(data2, internal::pload<Packet>(data1));
|
||||||
|
|
@ -264,16 +264,16 @@ template<typename Scalar> void packetmath_real()
|
||||||
|
|
||||||
ref[0] = data1[0];
|
ref[0] = data1[0];
|
||||||
for (int i=0; i<PacketSize; ++i)
|
for (int i=0; i<PacketSize; ++i)
|
||||||
ref[0] = std::min(ref[0],data1[i]);
|
ref[0] = (std::min)(ref[0],data1[i]);
|
||||||
VERIFY(internal::isApprox(ref[0], internal::predux_min(internal::pload<Packet>(data1))) && "internal::predux_min");
|
VERIFY(internal::isApprox(ref[0], internal::predux_min(internal::pload<Packet>(data1))) && "internal::predux_min");
|
||||||
|
|
||||||
CHECK_CWISE2(std::min, internal::pmin);
|
CHECK_CWISE2((std::min), internal::pmin);
|
||||||
CHECK_CWISE2(std::max, internal::pmax);
|
CHECK_CWISE2((std::max), internal::pmax);
|
||||||
CHECK_CWISE1(internal::abs, internal::pabs);
|
CHECK_CWISE1(internal::abs, internal::pabs);
|
||||||
|
|
||||||
ref[0] = data1[0];
|
ref[0] = data1[0];
|
||||||
for (int i=0; i<PacketSize; ++i)
|
for (int i=0; i<PacketSize; ++i)
|
||||||
ref[0] = std::max(ref[0],data1[i]);
|
ref[0] = (std::max)(ref[0],data1[i]);
|
||||||
VERIFY(internal::isApprox(ref[0], internal::predux_max(internal::pload<Packet>(data1))) && "internal::predux_max");
|
VERIFY(internal::isApprox(ref[0], internal::predux_max(internal::pload<Packet>(data1))) && "internal::predux_max");
|
||||||
|
|
||||||
for (int i=0; i<PacketSize; ++i)
|
for (int i=0; i<PacketSize; ++i)
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ template<typename MatrixType> void inverse_general_4x4(int repeat)
|
||||||
MatrixType inv = m.inverse();
|
MatrixType inv = m.inverse();
|
||||||
double error = double( (m*inv-MatrixType::Identity()).norm() * absdet / NumTraits<Scalar>::epsilon() );
|
double error = double( (m*inv-MatrixType::Identity()).norm() * absdet / NumTraits<Scalar>::epsilon() );
|
||||||
error_sum += error;
|
error_sum += error;
|
||||||
error_max = std::max(error_max, error);
|
error_max = (std::max)(error_max, error);
|
||||||
}
|
}
|
||||||
std::cerr << "inverse_general_4x4, Scalar = " << type_name<Scalar>() << std::endl;
|
std::cerr << "inverse_general_4x4, Scalar = " << type_name<Scalar>() << std::endl;
|
||||||
double error_avg = error_sum / repeat;
|
double error_avg = error_sum / repeat;
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ template<typename Derived1, typename Derived2>
|
||||||
bool areNotApprox(const MatrixBase<Derived1>& m1, const MatrixBase<Derived2>& m2, typename Derived1::RealScalar epsilon = NumTraits<typename Derived1::RealScalar>::dummy_precision())
|
bool areNotApprox(const MatrixBase<Derived1>& m1, const MatrixBase<Derived2>& m2, typename Derived1::RealScalar epsilon = NumTraits<typename Derived1::RealScalar>::dummy_precision())
|
||||||
{
|
{
|
||||||
return !((m1-m2).cwiseAbs2().maxCoeff() < epsilon * epsilon
|
return !((m1-m2).cwiseAbs2().maxCoeff() < epsilon * epsilon
|
||||||
* std::max(m1.cwiseAbs2().maxCoeff(), m2.cwiseAbs2().maxCoeff()));
|
* (std::max)(m1.cwiseAbs2().maxCoeff(), m2.cwiseAbs2().maxCoeff()));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename MatrixType> void product(const MatrixType& m)
|
template<typename MatrixType> void product(const MatrixType& m)
|
||||||
|
|
@ -102,7 +102,7 @@ template<typename MatrixType> void product(const MatrixType& m)
|
||||||
|
|
||||||
// test the previous tests were not screwed up because operator* returns 0
|
// test the previous tests were not screwed up because operator* returns 0
|
||||||
// (we use the more accurate default epsilon)
|
// (we use the more accurate default epsilon)
|
||||||
if (!NumTraits<Scalar>::IsInteger && std::min(rows,cols)>1)
|
if (!NumTraits<Scalar>::IsInteger && (std::min)(rows,cols)>1)
|
||||||
{
|
{
|
||||||
VERIFY(areNotApprox(m1.transpose()*m2,m2.transpose()*m1));
|
VERIFY(areNotApprox(m1.transpose()*m2,m2.transpose()*m1));
|
||||||
}
|
}
|
||||||
|
|
@ -111,7 +111,7 @@ template<typename MatrixType> void product(const MatrixType& m)
|
||||||
res = square;
|
res = square;
|
||||||
res.noalias() += m1 * m2.transpose();
|
res.noalias() += m1 * m2.transpose();
|
||||||
VERIFY_IS_APPROX(res, square + m1 * m2.transpose());
|
VERIFY_IS_APPROX(res, square + m1 * m2.transpose());
|
||||||
if (!NumTraits<Scalar>::IsInteger && std::min(rows,cols)>1)
|
if (!NumTraits<Scalar>::IsInteger && (std::min)(rows,cols)>1)
|
||||||
{
|
{
|
||||||
VERIFY(areNotApprox(res,square + m2 * m1.transpose()));
|
VERIFY(areNotApprox(res,square + m2 * m1.transpose()));
|
||||||
}
|
}
|
||||||
|
|
@ -123,7 +123,7 @@ template<typename MatrixType> void product(const MatrixType& m)
|
||||||
res = square;
|
res = square;
|
||||||
res.noalias() -= m1 * m2.transpose();
|
res.noalias() -= m1 * m2.transpose();
|
||||||
VERIFY_IS_APPROX(res, square - (m1 * m2.transpose()));
|
VERIFY_IS_APPROX(res, square - (m1 * m2.transpose()));
|
||||||
if (!NumTraits<Scalar>::IsInteger && std::min(rows,cols)>1)
|
if (!NumTraits<Scalar>::IsInteger && (std::min)(rows,cols)>1)
|
||||||
{
|
{
|
||||||
VERIFY(areNotApprox(res,square - m2 * m1.transpose()));
|
VERIFY(areNotApprox(res,square - m2 * m1.transpose()));
|
||||||
}
|
}
|
||||||
|
|
@ -147,7 +147,7 @@ template<typename MatrixType> void product(const MatrixType& m)
|
||||||
res2 = square2;
|
res2 = square2;
|
||||||
res2.noalias() += m1.transpose() * m2;
|
res2.noalias() += m1.transpose() * m2;
|
||||||
VERIFY_IS_APPROX(res2, square2 + m1.transpose() * m2);
|
VERIFY_IS_APPROX(res2, square2 + m1.transpose() * m2);
|
||||||
if (!NumTraits<Scalar>::IsInteger && std::min(rows,cols)>1)
|
if (!NumTraits<Scalar>::IsInteger && (std::min)(rows,cols)>1)
|
||||||
{
|
{
|
||||||
VERIFY(areNotApprox(res2,square2 + m2.transpose() * m1));
|
VERIFY(areNotApprox(res2,square2 + m2.transpose() * m1));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,16 @@ template<typename MatrixType> void product_extra(const MatrixType& m)
|
||||||
VERIFY_IS_APPROX(tmp, m1 * m1.adjoint() * s1);
|
VERIFY_IS_APPROX(tmp, m1 * m1.adjoint() * s1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Regression test for bug reported at http://forum.kde.org/viewtopic.php?f=74&t=96947
|
||||||
|
void mat_mat_scalar_scalar_product()
|
||||||
|
{
|
||||||
|
Eigen::Matrix2Xd dNdxy(2, 3);
|
||||||
|
dNdxy << -0.5, 0.5, 0,
|
||||||
|
-0.3, 0, 0.3;
|
||||||
|
double det = 6.0, wt = 0.5;
|
||||||
|
VERIFY_IS_APPROX(dNdxy.transpose()*dNdxy*det*wt, det*wt*dNdxy.transpose()*dNdxy);
|
||||||
|
}
|
||||||
|
|
||||||
void zero_sized_objects()
|
void zero_sized_objects()
|
||||||
{
|
{
|
||||||
// Bug 127
|
// Bug 127
|
||||||
|
|
@ -145,6 +155,7 @@ void test_product_extra()
|
||||||
for(int i = 0; i < g_repeat; i++) {
|
for(int i = 0; i < g_repeat; i++) {
|
||||||
CALL_SUBTEST_1( product_extra(MatrixXf(internal::random<int>(1,320), internal::random<int>(1,320))) );
|
CALL_SUBTEST_1( product_extra(MatrixXf(internal::random<int>(1,320), internal::random<int>(1,320))) );
|
||||||
CALL_SUBTEST_2( product_extra(MatrixXd(internal::random<int>(1,320), internal::random<int>(1,320))) );
|
CALL_SUBTEST_2( product_extra(MatrixXd(internal::random<int>(1,320), internal::random<int>(1,320))) );
|
||||||
|
CALL_SUBTEST_2( mat_mat_scalar_scalar_product() );
|
||||||
CALL_SUBTEST_3( product_extra(MatrixXcf(internal::random<int>(1,150), internal::random<int>(1,150))) );
|
CALL_SUBTEST_3( product_extra(MatrixXcf(internal::random<int>(1,150), internal::random<int>(1,150))) );
|
||||||
CALL_SUBTEST_4( product_extra(MatrixXcd(internal::random<int>(1,150), internal::random<int>(1,150))) );
|
CALL_SUBTEST_4( product_extra(MatrixXcd(internal::random<int>(1,150), internal::random<int>(1,150))) );
|
||||||
CALL_SUBTEST_5( zero_sized_objects() );
|
CALL_SUBTEST_5( zero_sized_objects() );
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ template<typename MatrixType> void qr()
|
||||||
typedef typename MatrixType::Index Index;
|
typedef typename MatrixType::Index Index;
|
||||||
|
|
||||||
Index rows = internal::random<Index>(2,200), cols = internal::random<Index>(2,200), cols2 = internal::random<Index>(2,200);
|
Index rows = internal::random<Index>(2,200), cols = internal::random<Index>(2,200), cols2 = internal::random<Index>(2,200);
|
||||||
Index rank = internal::random<Index>(1, std::min(rows, cols)-1);
|
Index rank = internal::random<Index>(1, (std::min)(rows, cols)-1);
|
||||||
|
|
||||||
typedef typename MatrixType::Scalar Scalar;
|
typedef typename MatrixType::Scalar Scalar;
|
||||||
typedef typename MatrixType::RealScalar RealScalar;
|
typedef typename MatrixType::RealScalar RealScalar;
|
||||||
|
|
@ -64,7 +64,7 @@ template<typename MatrixType, int Cols2> void qr_fixedsize()
|
||||||
{
|
{
|
||||||
enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime };
|
enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime };
|
||||||
typedef typename MatrixType::Scalar Scalar;
|
typedef typename MatrixType::Scalar Scalar;
|
||||||
int rank = internal::random<int>(1, std::min(int(Rows), int(Cols))-1);
|
int rank = internal::random<int>(1, (std::min)(int(Rows), int(Cols))-1);
|
||||||
Matrix<Scalar,Rows,Cols> m1;
|
Matrix<Scalar,Rows,Cols> m1;
|
||||||
createRandomPIMatrixOfRank(rank,Rows,Cols,m1);
|
createRandomPIMatrixOfRank(rank,Rows,Cols,m1);
|
||||||
ColPivHouseholderQR<Matrix<Scalar,Rows,Cols> > qr(m1);
|
ColPivHouseholderQR<Matrix<Scalar,Rows,Cols> > qr(m1);
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ template<typename MatrixType> void qr()
|
||||||
typedef typename MatrixType::Index Index;
|
typedef typename MatrixType::Index Index;
|
||||||
|
|
||||||
Index rows = internal::random<Index>(20,200), cols = internal::random<int>(20,200), cols2 = internal::random<int>(20,200);
|
Index rows = internal::random<Index>(20,200), cols = internal::random<int>(20,200), cols2 = internal::random<int>(20,200);
|
||||||
Index rank = internal::random<Index>(1, std::min(rows, cols)-1);
|
Index rank = internal::random<Index>(1, (std::min)(rows, cols)-1);
|
||||||
|
|
||||||
typedef typename MatrixType::Scalar Scalar;
|
typedef typename MatrixType::Scalar Scalar;
|
||||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> MatrixQType;
|
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> MatrixQType;
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,8 @@ template<typename MatrixType> void matrixRedux(const MatrixType& m)
|
||||||
{
|
{
|
||||||
s += m1(i,j);
|
s += m1(i,j);
|
||||||
p *= m1(i,j);
|
p *= m1(i,j);
|
||||||
minc = std::min(internal::real(minc), internal::real(m1(i,j)));
|
minc = (std::min)(internal::real(minc), internal::real(m1(i,j)));
|
||||||
maxc = std::max(internal::real(maxc), internal::real(m1(i,j)));
|
maxc = (std::max)(internal::real(maxc), internal::real(m1(i,j)));
|
||||||
}
|
}
|
||||||
const Scalar mean = s/Scalar(RealScalar(rows*cols));
|
const Scalar mean = s/Scalar(RealScalar(rows*cols));
|
||||||
|
|
||||||
|
|
@ -86,8 +86,8 @@ template<typename VectorType> void vectorRedux(const VectorType& w)
|
||||||
{
|
{
|
||||||
s += v[j];
|
s += v[j];
|
||||||
p *= v[j];
|
p *= v[j];
|
||||||
minc = std::min(minc, internal::real(v[j]));
|
minc = (std::min)(minc, internal::real(v[j]));
|
||||||
maxc = std::max(maxc, internal::real(v[j]));
|
maxc = (std::max)(maxc, internal::real(v[j]));
|
||||||
}
|
}
|
||||||
VERIFY_IS_MUCH_SMALLER_THAN(internal::abs(s - v.head(i).sum()), Scalar(1));
|
VERIFY_IS_MUCH_SMALLER_THAN(internal::abs(s - v.head(i).sum()), Scalar(1));
|
||||||
VERIFY_IS_APPROX(p, v.head(i).prod());
|
VERIFY_IS_APPROX(p, v.head(i).prod());
|
||||||
|
|
@ -103,8 +103,8 @@ template<typename VectorType> void vectorRedux(const VectorType& w)
|
||||||
{
|
{
|
||||||
s += v[j];
|
s += v[j];
|
||||||
p *= v[j];
|
p *= v[j];
|
||||||
minc = std::min(minc, internal::real(v[j]));
|
minc = (std::min)(minc, internal::real(v[j]));
|
||||||
maxc = std::max(maxc, internal::real(v[j]));
|
maxc = (std::max)(maxc, internal::real(v[j]));
|
||||||
}
|
}
|
||||||
VERIFY_IS_MUCH_SMALLER_THAN(internal::abs(s - v.tail(size-i).sum()), Scalar(1));
|
VERIFY_IS_MUCH_SMALLER_THAN(internal::abs(s - v.tail(size-i).sum()), Scalar(1));
|
||||||
VERIFY_IS_APPROX(p, v.tail(size-i).prod());
|
VERIFY_IS_APPROX(p, v.tail(size-i).prod());
|
||||||
|
|
@ -120,8 +120,8 @@ template<typename VectorType> void vectorRedux(const VectorType& w)
|
||||||
{
|
{
|
||||||
s += v[j];
|
s += v[j];
|
||||||
p *= v[j];
|
p *= v[j];
|
||||||
minc = std::min(minc, internal::real(v[j]));
|
minc = (std::min)(minc, internal::real(v[j]));
|
||||||
maxc = std::max(maxc, internal::real(v[j]));
|
maxc = (std::max)(maxc, internal::real(v[j]));
|
||||||
}
|
}
|
||||||
VERIFY_IS_MUCH_SMALLER_THAN(internal::abs(s - v.segment(i, size-2*i).sum()), Scalar(1));
|
VERIFY_IS_MUCH_SMALLER_THAN(internal::abs(s - v.segment(i, size-2*i).sum()), Scalar(1));
|
||||||
VERIFY_IS_APPROX(p, v.segment(i, size-2*i).prod());
|
VERIFY_IS_APPROX(p, v.segment(i, size-2*i).prod());
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,15 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
#if EIGEN_GNUC_AT_LEAST(4,0) && !defined __ICC && !defined(__clang__)
|
#if EIGEN_GNUC_AT_LEAST(4,0) && !defined __ICC && !defined(__clang__)
|
||||||
|
|
||||||
|
#ifdef min
|
||||||
|
#undef min
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef max
|
||||||
|
#undef max
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <tr1/unordered_map>
|
#include <tr1/unordered_map>
|
||||||
#define EIGEN_UNORDERED_MAP_SUPPORT
|
#define EIGEN_UNORDERED_MAP_SUPPORT
|
||||||
namespace std {
|
namespace std {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
|
||||||
typedef typename SparseMatrixType::Scalar Scalar;
|
typedef typename SparseMatrixType::Scalar Scalar;
|
||||||
enum { Flags = SparseMatrixType::Flags };
|
enum { Flags = SparseMatrixType::Flags };
|
||||||
|
|
||||||
double density = std::max(8./(rows*cols), 0.01);
|
double density = (std::max)(8./(rows*cols), 0.01);
|
||||||
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
|
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
|
||||||
typedef Matrix<Scalar,Dynamic,1> DenseVector;
|
typedef Matrix<Scalar,Dynamic,1> DenseVector;
|
||||||
Scalar eps = 1e-6;
|
Scalar eps = 1e-6;
|
||||||
|
|
@ -206,7 +206,7 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
|
||||||
initSparse<Scalar>(density, refMat2, m2);
|
initSparse<Scalar>(density, refMat2, m2);
|
||||||
int j0 = internal::random(0,rows-2);
|
int j0 = internal::random(0,rows-2);
|
||||||
int j1 = internal::random(0,rows-2);
|
int j1 = internal::random(0,rows-2);
|
||||||
int n0 = internal::random<int>(1,rows-std::max(j0,j1));
|
int n0 = internal::random<int>(1,rows-(std::max)(j0,j1));
|
||||||
VERIFY_IS_APPROX(m2.innerVectors(j0,n0), refMat2.block(0,j0,rows,n0));
|
VERIFY_IS_APPROX(m2.innerVectors(j0,n0), refMat2.block(0,j0,rows,n0));
|
||||||
VERIFY_IS_APPROX(m2.innerVectors(j0,n0)+m2.innerVectors(j1,n0),
|
VERIFY_IS_APPROX(m2.innerVectors(j0,n0)+m2.innerVectors(j1,n0),
|
||||||
refMat2.block(0,j0,rows,n0)+refMat2.block(0,j1,rows,n0));
|
refMat2.block(0,j0,rows,n0)+refMat2.block(0,j1,rows,n0));
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ template<typename SparseMatrixType> void sparse_product(const SparseMatrixType&
|
||||||
typedef typename SparseMatrixType::Scalar Scalar;
|
typedef typename SparseMatrixType::Scalar Scalar;
|
||||||
enum { Flags = SparseMatrixType::Flags };
|
enum { Flags = SparseMatrixType::Flags };
|
||||||
|
|
||||||
double density = std::max(8./(rows*cols), 0.01);
|
double density = (std::max)(8./(rows*cols), 0.01);
|
||||||
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
|
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
|
||||||
typedef Matrix<Scalar,Dynamic,1> DenseVector;
|
typedef Matrix<Scalar,Dynamic,1> DenseVector;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ initSPD(double density,
|
||||||
|
|
||||||
template<typename Scalar> void sparse_solvers(int rows, int cols)
|
template<typename Scalar> void sparse_solvers(int rows, int cols)
|
||||||
{
|
{
|
||||||
double density = std::max(8./(rows*cols), 0.01);
|
double density = (std::max)(8./(rows*cols), 0.01);
|
||||||
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
|
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
|
||||||
typedef Matrix<Scalar,Dynamic,1> DenseVector;
|
typedef Matrix<Scalar,Dynamic,1> DenseVector;
|
||||||
// Scalar eps = 1e-6;
|
// Scalar eps = 1e-6;
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@
|
||||||
|
|
||||||
template<typename Scalar> void sparse_vector(int rows, int cols)
|
template<typename Scalar> void sparse_vector(int rows, int cols)
|
||||||
{
|
{
|
||||||
double densityMat = std::max(8./(rows*cols), 0.01);
|
double densityMat = (std::max)(8./(rows*cols), 0.01);
|
||||||
double densityVec = std::max(8./float(rows), 0.1);
|
double densityVec = (std::max)(8./float(rows), 0.1);
|
||||||
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
|
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
|
||||||
typedef Matrix<Scalar,Dynamic,1> DenseVector;
|
typedef Matrix<Scalar,Dynamic,1> DenseVector;
|
||||||
typedef SparseVector<Scalar> SparseVectorType;
|
typedef SparseVector<Scalar> SparseVectorType;
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,8 @@ template<typename MatrixType> void stable_norm(const MatrixType& m)
|
||||||
Index rows = m.rows();
|
Index rows = m.rows();
|
||||||
Index cols = m.cols();
|
Index cols = m.cols();
|
||||||
|
|
||||||
Scalar big = internal::random<Scalar>() * (std::numeric_limits<RealScalar>::max() * RealScalar(1e-4));
|
Scalar big = internal::random<Scalar>() * ((std::numeric_limits<RealScalar>::max)() * RealScalar(1e-4));
|
||||||
Scalar small = internal::random<Scalar>() * (std::numeric_limits<RealScalar>::min() * RealScalar(1e4));
|
Scalar small = internal::random<Scalar>() * ((std::numeric_limits<RealScalar>::min)() * RealScalar(1e4));
|
||||||
|
|
||||||
MatrixType vzero = MatrixType::Zero(rows, cols),
|
MatrixType vzero = MatrixType::Zero(rows, cols),
|
||||||
vrand = MatrixType::Random(rows, cols),
|
vrand = MatrixType::Random(rows, cols),
|
||||||
|
|
|
||||||
|
|
@ -331,7 +331,7 @@ class FFT
|
||||||
// if the vector is strided, then we need to copy it to a packed temporary
|
// if the vector is strided, then we need to copy it to a packed temporary
|
||||||
Matrix<src_type,1,Dynamic> tmp;
|
Matrix<src_type,1,Dynamic> tmp;
|
||||||
if ( resize_input ) {
|
if ( resize_input ) {
|
||||||
size_t ncopy = std::min(src.size(),src.size() + resize_input);
|
size_t ncopy = (std::min)(src.size(),src.size() + resize_input);
|
||||||
tmp.setZero(src.size() + resize_input);
|
tmp.setZero(src.size() + resize_input);
|
||||||
if ( realfft && HasFlag(HalfSpectrum) ) {
|
if ( realfft && HasFlag(HalfSpectrum) ) {
|
||||||
// pad at the Nyquist bin
|
// pad at the Nyquist bin
|
||||||
|
|
|
||||||
|
|
@ -231,7 +231,7 @@ private:
|
||||||
template<typename BVH, typename Minimizer>
|
template<typename BVH, typename Minimizer>
|
||||||
typename Minimizer::Scalar BVMinimize(const BVH &tree, Minimizer &minimizer)
|
typename Minimizer::Scalar BVMinimize(const BVH &tree, Minimizer &minimizer)
|
||||||
{
|
{
|
||||||
return internal::minimize_helper(tree, minimizer, tree.getRootIndex(), std::numeric_limits<typename Minimizer::Scalar>::max());
|
return internal::minimize_helper(tree, minimizer, tree.getRootIndex(), (std::numeric_limits<typename Minimizer::Scalar>::max)());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Given two BVH's, runs the query on their cartesian product encapsulated by \a minimizer.
|
/** Given two BVH's, runs the query on their cartesian product encapsulated by \a minimizer.
|
||||||
|
|
@ -264,7 +264,7 @@ typename Minimizer::Scalar BVMinimize(const BVH1 &tree1, const BVH2 &tree2, Mini
|
||||||
ObjIter2 oBegin2 = ObjIter2(), oEnd2 = ObjIter2(), oCur2 = ObjIter2();
|
ObjIter2 oBegin2 = ObjIter2(), oEnd2 = ObjIter2(), oCur2 = ObjIter2();
|
||||||
std::priority_queue<QueueElement, std::vector<QueueElement>, std::greater<QueueElement> > todo; //smallest is at the top
|
std::priority_queue<QueueElement, std::vector<QueueElement>, std::greater<QueueElement> > todo; //smallest is at the top
|
||||||
|
|
||||||
Scalar minimum = std::numeric_limits<Scalar>::max();
|
Scalar minimum = (std::numeric_limits<Scalar>::max)();
|
||||||
todo.push(std::make_pair(Scalar(), std::make_pair(tree1.getRootIndex(), tree2.getRootIndex())));
|
todo.push(std::make_pair(Scalar(), std::make_pair(tree1.getRootIndex(), tree2.getRootIndex())));
|
||||||
|
|
||||||
while(!todo.empty()) {
|
while(!todo.empty()) {
|
||||||
|
|
|
||||||
|
|
@ -259,7 +259,7 @@ void MatrixExponential<MatrixType>::computeUV(float)
|
||||||
pade5(m_M);
|
pade5(m_M);
|
||||||
} else {
|
} else {
|
||||||
const float maxnorm = 3.925724783138660f;
|
const float maxnorm = 3.925724783138660f;
|
||||||
m_squarings = max(0, (int)ceil(log2(m_l1norm / maxnorm)));
|
m_squarings = (max)(0, (int)ceil(log2(m_l1norm / maxnorm)));
|
||||||
MatrixType A = m_M / pow(Scalar(2), Scalar(static_cast<RealScalar>(m_squarings)));
|
MatrixType A = m_M / pow(Scalar(2), Scalar(static_cast<RealScalar>(m_squarings)));
|
||||||
pade7(A);
|
pade7(A);
|
||||||
}
|
}
|
||||||
|
|
@ -281,7 +281,7 @@ void MatrixExponential<MatrixType>::computeUV(double)
|
||||||
pade9(m_M);
|
pade9(m_M);
|
||||||
} else {
|
} else {
|
||||||
const double maxnorm = 5.371920351148152;
|
const double maxnorm = 5.371920351148152;
|
||||||
m_squarings = max(0, (int)ceil(log2(m_l1norm / maxnorm)));
|
m_squarings = (max)(0, (int)ceil(log2(m_l1norm / maxnorm)));
|
||||||
MatrixType A = m_M / pow(Scalar(2), Scalar(m_squarings));
|
MatrixType A = m_M / pow(Scalar(2), Scalar(m_squarings));
|
||||||
pade13(A);
|
pade13(A);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,13 +90,13 @@ struct BallPointStuff //this class provides functions to be both an intersector
|
||||||
}
|
}
|
||||||
|
|
||||||
double minimumOnVolume(const BoxType &r) { ++calls; return r.squaredExteriorDistance(p); }
|
double minimumOnVolume(const BoxType &r) { ++calls; return r.squaredExteriorDistance(p); }
|
||||||
double minimumOnObject(const BallType &b) { ++calls; return std::max(0., (b.center - p).squaredNorm() - SQR(b.radius)); }
|
double minimumOnObject(const BallType &b) { ++calls; return (std::max)(0., (b.center - p).squaredNorm() - SQR(b.radius)); }
|
||||||
double minimumOnVolumeVolume(const BoxType &r1, const BoxType &r2) { ++calls; return r1.squaredExteriorDistance(r2); }
|
double minimumOnVolumeVolume(const BoxType &r1, const BoxType &r2) { ++calls; return r1.squaredExteriorDistance(r2); }
|
||||||
double minimumOnVolumeObject(const BoxType &r, const BallType &b) { ++calls; return SQR(std::max(0., r.exteriorDistance(b.center) - b.radius)); }
|
double minimumOnVolumeObject(const BoxType &r, const BallType &b) { ++calls; return SQR((std::max)(0., r.exteriorDistance(b.center) - b.radius)); }
|
||||||
double minimumOnObjectVolume(const BallType &b, const BoxType &r) { ++calls; return SQR(std::max(0., r.exteriorDistance(b.center) - b.radius)); }
|
double minimumOnObjectVolume(const BallType &b, const BoxType &r) { ++calls; return SQR((std::max)(0., r.exteriorDistance(b.center) - b.radius)); }
|
||||||
double minimumOnObjectObject(const BallType &b1, const BallType &b2){ ++calls; return SQR(std::max(0., (b1.center - b2.center).norm() - b1.radius - b2.radius)); }
|
double minimumOnObjectObject(const BallType &b1, const BallType &b2){ ++calls; return SQR((std::max)(0., (b1.center - b2.center).norm() - b1.radius - b2.radius)); }
|
||||||
double minimumOnVolumeObject(const BoxType &r, const VectorType &v) { ++calls; return r.squaredExteriorDistance(v); }
|
double minimumOnVolumeObject(const BoxType &r, const VectorType &v) { ++calls; return r.squaredExteriorDistance(v); }
|
||||||
double minimumOnObjectObject(const BallType &b, const VectorType &v){ ++calls; return SQR(std::max(0., (b.center - v).norm() - b.radius)); }
|
double minimumOnObjectObject(const BallType &b, const VectorType &v){ ++calls; return SQR((std::max)(0., (b.center - v).norm() - b.radius)); }
|
||||||
|
|
||||||
VectorType p;
|
VectorType p;
|
||||||
int calls;
|
int calls;
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ double binom(int n, int k)
|
||||||
template <typename Derived, typename OtherDerived>
|
template <typename Derived, typename OtherDerived>
|
||||||
double relerr(const MatrixBase<Derived>& A, const MatrixBase<OtherDerived>& B)
|
double relerr(const MatrixBase<Derived>& A, const MatrixBase<OtherDerived>& B)
|
||||||
{
|
{
|
||||||
return std::sqrt((A - B).cwiseAbs2().sum() / std::min(A.cwiseAbs2().sum(), B.cwiseAbs2().sum()));
|
return std::sqrt((A - B).cwiseAbs2().sum() / (std::min)(A.cwiseAbs2().sum(), B.cwiseAbs2().sum()));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ template<typename SparseMatrixType> void sparse_extra(const SparseMatrixType& re
|
||||||
typedef typename SparseMatrixType::Scalar Scalar;
|
typedef typename SparseMatrixType::Scalar Scalar;
|
||||||
enum { Flags = SparseMatrixType::Flags };
|
enum { Flags = SparseMatrixType::Flags };
|
||||||
|
|
||||||
double density = std::max(8./(rows*cols), 0.01);
|
double density = (std::max)(8./(rows*cols), 0.01);
|
||||||
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
|
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
|
||||||
typedef Matrix<Scalar,Dynamic,1> DenseVector;
|
typedef Matrix<Scalar,Dynamic,1> DenseVector;
|
||||||
Scalar eps = 1e-6;
|
Scalar eps = 1e-6;
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ template<typename Scalar> void sparse_ldlt(int rows, int cols)
|
||||||
{
|
{
|
||||||
static bool odd = true;
|
static bool odd = true;
|
||||||
odd = !odd;
|
odd = !odd;
|
||||||
double density = std::max(8./(rows*cols), 0.01);
|
double density = (std::max)(8./(rows*cols), 0.01);
|
||||||
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
|
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
|
||||||
typedef Matrix<Scalar,Dynamic,1> DenseVector;
|
typedef Matrix<Scalar,Dynamic,1> DenseVector;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
template<typename Scalar> void sparse_llt(int rows, int cols)
|
template<typename Scalar> void sparse_llt(int rows, int cols)
|
||||||
{
|
{
|
||||||
double density = std::max(8./(rows*cols), 0.01);
|
double density = (std::max)(8./(rows*cols), 0.01);
|
||||||
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
|
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
|
||||||
typedef Matrix<Scalar,Dynamic,1> DenseVector;
|
typedef Matrix<Scalar,Dynamic,1> DenseVector;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
template<typename Scalar> void sparse_lu(int rows, int cols)
|
template<typename Scalar> void sparse_lu(int rows, int cols)
|
||||||
{
|
{
|
||||||
double density = std::max(8./(rows*cols), 0.01);
|
double density = (std::max)(8./(rows*cols), 0.01);
|
||||||
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
|
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
|
||||||
typedef Matrix<Scalar,Dynamic,1> DenseVector;
|
typedef Matrix<Scalar,Dynamic,1> DenseVector;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue