Compare commits

...

25 Commits

Author SHA1 Message Date
Benoit Jacob
8ebe822a20 bump 2011-12-06 08:18:54 -05:00
Thomas Capricelli
bd7475cc0c fix typo in doc for ParametrizedLine 2011-06-23 00:39:40 +02:00
Gael Guennebaud
e5203d46fe fix aligned_allocator::allocate interface 2011-06-14 08:52:38 +02:00
Gael Guennebaud
7065c3a398 Added tag 2.0.16 for changeset f90db64e6a 2011-05-28 10:16:30 +02:00
Gael Guennebaud
f90db64e6a bump to 2.0.16 2011-05-28 10:16:08 +02:00
Gael Guennebaud
d6293e6385 fix perf regression introduced by changeset 7852a48a2f
(matrix-vector product did not use the nesting rules....)
2011-05-27 22:05:39 +02:00
Gael Guennebaud
aaaa9301a8 fix bug #250 (gcc 4.6 compilation) 2011-04-19 16:35:48 +02:00
Gael Guennebaud
780f312228 fix LS documentation 2011-02-24 19:03:49 +01:00
Piotr Trojanek
ced86f3bfc class/struct mismatch for different template invocations 2011-01-16 00:32:13 +01:00
Benoit Jacob
1869a02f52 add part<SelfAdjoint>... it's never too late and I need this for eigen2support 2011-01-25 19:49:38 -05:00
DJ Marcin
0c8a25ef94 fix operator& precedence bug 2010-08-23 22:32:49 -04:00
Gael Guennebaud
70f355b51a backport fix on 3x3 triadiagonalization, this fix #149 2010-07-22 21:26:09 +02:00
Benoit Jacob
2d0963fb00 Added tag 2.0.15 for changeset 907fba9ea9 2010-07-16 22:25:12 -04:00
Benoit Jacob
907fba9ea9 bump 2010-07-16 22:25:08 -04:00
Gael Guennebaud
7e0b7b1f25 uncomment tests (sorry) 2010-07-16 11:50:40 +02:00
Gael Guennebaud
5ac00624ed adapted pactch from Nick Lewycky fixing a couple of issue with CLang 2010-07-15 22:48:44 +02:00
Gael Guennebaud
c0a0d2d181 add unit tests for 0 matrix 2010-07-15 20:00:50 +02:00
Gael Guennebaud
ec39a39cb6 fix LLT for zero matrix 2010-07-15 20:00:34 +02:00
Gael Guennebaud
ccc6731f86 fix use of rank in QR 2010-07-15 19:59:21 +02:00
Gael Guennebaud
b09bb50aeb fix QR solving with m>n 2010-07-15 19:52:11 +02:00
Gael Guennebaud
c7b8de77c0 fix aligned_delete for null pointers 2010-07-15 09:28:29 +02:00
Gael Guennebaud
c44bbabdcc fix LU and QR solve when rank==0, fix LLT when the matrix is purely 0 2010-07-12 16:42:38 +02:00
Gael Guennebaud
468863f3a0 fix bad Map in row-vector by matrix products 2010-07-09 20:27:05 +02:00
Gael Guennebaud
81f36b0e21 disable MSVC optimization when the underlying compiler is ICC 2010-07-09 19:36:43 +02:00
Benoit Jacob
c196a49f67 Added tag 2.0.14 for changeset e18e51d891 2010-06-22 22:23:39 -04:00
23 changed files with 161 additions and 66 deletions

View File

@@ -7,7 +7,7 @@ set(INCLUDE_INSTALL_DIR
"The directory where we install the header files"
FORCE)
set(EIGEN_VERSION_NUMBER "2.0.14")
set(EIGEN_VERSION_NUMBER "2.0.17")
set(EIGEN_VERSION "${EIGEN_VERSION_NUMBER}")
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

View File

@@ -52,6 +52,7 @@
#endif
#endif
#include <cstddef>
#include <cstdlib>
#include <cmath>
#include <complex>

View File

@@ -139,7 +139,7 @@ inline bool MatrixBase<Derived>::any() const
template<typename Derived>
inline int MatrixBase<Derived>::count() const
{
return this->cast<bool>().cast<int>().sum();
return this->cast<bool>().template cast<int>().sum();
}
#endif // EIGEN_ALLANDANY_H

View File

@@ -132,11 +132,12 @@ void LLT<MatrixType>::compute(const MatrixType& a)
m_isInitialized = true;
return;
}
m_matrix.col(0).end(size-1) = a.row(0).end(size-1).adjoint() / ei_real(m_matrix.coeff(0,0));
if(ei_real(m_matrix.coeff(0,0))>0)
m_matrix.col(0).end(size-1) = a.row(0).end(size-1).adjoint() / ei_real(m_matrix.coeff(0,0));
for (int j = 1; j < size; ++j)
{
x = ei_real(a.coeff(j,j)) - m_matrix.row(j).start(j).squaredNorm();
if (x < cutoff)
if (x <= cutoff)
{
m_isPositiveDefinite = false;
continue;

View File

@@ -32,7 +32,7 @@ namespace Eigen
{
#define EIGEN_INSTANTIATE_PRODUCT(TYPE) \
template static void ei_cache_friendly_product<TYPE>( \
template void ei_cache_friendly_product<TYPE>( \
int _rows, int _cols, int depth, \
bool _lhsRowMajor, const TYPE* _lhs, int _lhsStride, \
bool _rhsRowMajor, const TYPE* _rhs, int _rhsStride, \

View File

@@ -35,16 +35,6 @@ template<typename T> inline T ei_random_amplitude()
else return static_cast<T>(10);
}
template<typename T> inline T ei_hypot(T x, T y)
{
T _x = ei_abs(x);
T _y = ei_abs(y);
T p = std::max(_x, _y);
T q = std::min(_x, _y);
T qp = q/p;
return p * ei_sqrt(T(1) + qp*qp);
}
/**************
*** int ***
**************/
@@ -292,4 +282,14 @@ inline bool ei_isApproxOrLessThan(long double a, long double b, long double prec
return a <= b || ei_isApprox(a, b, prec);
}
template<typename T> inline T ei_hypot(T x, T y)
{
T _x = ei_abs(x);
T _y = ei_abs(y);
T p = std::max(_x, _y);
T q = std::min(_x, _y);
T qp = q/p;
return p * ei_sqrt(T(1) + qp*qp);
}
#endif // EIGEN_MATHFUNCTIONS_H

View File

@@ -187,6 +187,17 @@ template<typename LhsNested, typename RhsNested, int ProductMode> class Product
_LhsNested, _RhsNested, Scalar> ScalarCoeffImpl;
public:
typedef typename ei_nested<_LhsNested,_RhsNested::ColsAtCompileTime>::type LhsNestedX;
typedef typename ei_nested<_RhsNested,_LhsNested::RowsAtCompileTime>::type RhsNestedX;
typedef typename ei_cleantype<LhsNestedX>::type _LhsNestedX;
typedef typename ei_cleantype<RhsNestedX>::type _RhsNestedX;
enum {
LhsNestedFlags = _LhsNestedX::Flags,
RhsNestedFlags = _RhsNestedX::Flags
};
template<typename Lhs, typename Rhs>
inline Product(const Lhs& lhs, const Rhs& rhs)
@@ -522,11 +533,11 @@ static void ei_cache_friendly_product_rowmajor_times_vector(
template<typename ProductType,
int LhsRows = ei_traits<ProductType>::RowsAtCompileTime,
int LhsOrder = int(ei_traits<ProductType>::LhsFlags)&RowMajorBit ? RowMajor : ColMajor,
int LhsHasDirectAccess = int(ei_traits<ProductType>::LhsFlags)&DirectAccessBit? HasDirectAccess : NoDirectAccess,
int RhsCols = ei_traits<ProductType>::ColsAtCompileTime,
int RhsOrder = int(ei_traits<ProductType>::RhsFlags)&RowMajorBit ? RowMajor : ColMajor,
int RhsHasDirectAccess = int(ei_traits<ProductType>::RhsFlags)&DirectAccessBit? HasDirectAccess : NoDirectAccess>
int LhsOrder = int(ProductType::LhsNestedFlags)&RowMajorBit ? RowMajor : ColMajor,
int LhsHasDirectAccess = int(ProductType::LhsNestedFlags)&DirectAccessBit? HasDirectAccess : NoDirectAccess,
int RhsCols = ProductType::ColsAtCompileTime,
int RhsOrder = int(ProductType::RhsNestedFlags)&RowMajorBit ? RowMajor : ColMajor,
int RhsHasDirectAccess = int(ProductType::RhsNestedFlags)&DirectAccessBit? HasDirectAccess : NoDirectAccess>
struct ei_cache_friendly_product_selector
{
template<typename DestDerived>
@@ -543,9 +554,12 @@ struct ei_cache_friendly_product_selector<ProductType,LhsRows,ColMajor,NoDirectA
template<typename DestDerived>
inline static void run(DestDerived& res, const ProductType& product)
{
const int size = product.rhs().rows();
typename ProductType::LhsNestedX lhs(product.lhs());
typename ProductType::RhsNestedX rhs(product.rhs());
const int size = rhs.rows();
for (int k=0; k<size; ++k)
res += product.rhs().coeff(k) * product.lhs().col(k);
res += rhs.coeff(k) * lhs.col(k);
}
};
@@ -559,6 +573,9 @@ struct ei_cache_friendly_product_selector<ProductType,LhsRows,ColMajor,HasDirect
template<typename DestDerived>
inline static void run(DestDerived& res, const ProductType& product)
{
typename ProductType::LhsNestedX lhs(product.lhs());
typename ProductType::RhsNestedX rhs(product.rhs());
enum {
EvalToRes = (ei_packet_traits<Scalar>::size==1)
||((DestDerived::Flags&ActualPacketAccessBit) && (!(DestDerived::Flags & RowMajorBit))) };
@@ -571,8 +588,8 @@ struct ei_cache_friendly_product_selector<ProductType,LhsRows,ColMajor,HasDirect
Map<Matrix<Scalar,DestDerived::RowsAtCompileTime,1,ColMajor> >(_res, res.size()) = res;
}
ei_cache_friendly_product_colmajor_times_vector(res.size(),
&product.lhs().const_cast_derived().coeffRef(0,0), product.lhs().stride(),
product.rhs(), _res);
&lhs.const_cast_derived().coeffRef(0,0), lhs.stride(),
rhs, _res);
if (!EvalToRes)
{
@@ -589,9 +606,12 @@ struct ei_cache_friendly_product_selector<ProductType,1,LhsOrder,LhsAccess,RhsCo
template<typename DestDerived>
inline static void run(DestDerived& res, const ProductType& product)
{
const int cols = product.lhs().cols();
typename ProductType::LhsNestedX lhs(product.lhs());
typename ProductType::RhsNestedX rhs(product.rhs());
const int cols = lhs.cols();
for (int j=0; j<cols; ++j)
res += product.lhs().coeff(j) * product.rhs().row(j);
res += lhs.coeff(j) * rhs.row(j);
}
};
@@ -605,6 +625,9 @@ struct ei_cache_friendly_product_selector<ProductType,1,LhsOrder,LhsAccess,RhsCo
template<typename DestDerived>
inline static void run(DestDerived& res, const ProductType& product)
{
typename ProductType::LhsNestedX lhs(product.lhs());
typename ProductType::RhsNestedX rhs(product.rhs());
enum {
EvalToRes = (ei_packet_traits<Scalar>::size==1)
||((DestDerived::Flags & ActualPacketAccessBit) && (DestDerived::Flags & RowMajorBit)) };
@@ -614,15 +637,15 @@ struct ei_cache_friendly_product_selector<ProductType,1,LhsOrder,LhsAccess,RhsCo
else
{
_res = ei_aligned_stack_new(Scalar, res.size());
Map<Matrix<Scalar,DestDerived::SizeAtCompileTime,1,ColMajor> >(_res, res.size()) = res;
Map<Matrix<Scalar,1,DestDerived::SizeAtCompileTime,ColMajor> >(_res, res.size()) = res;
}
ei_cache_friendly_product_colmajor_times_vector(res.size(),
&product.rhs().const_cast_derived().coeffRef(0,0), product.rhs().stride(),
product.lhs().transpose(), _res);
&rhs.const_cast_derived().coeffRef(0,0), rhs.stride(),
lhs.transpose(), _res);
if (!EvalToRes)
{
res = Map<Matrix<Scalar,DestDerived::SizeAtCompileTime,1,ColMajor> >(_res, res.size());
res = Map<Matrix<Scalar,1,DestDerived::SizeAtCompileTime,ColMajor> >(_res, res.size());
ei_aligned_stack_delete(Scalar, _res, res.size());
}
}
@@ -635,25 +658,28 @@ struct ei_cache_friendly_product_selector<ProductType,LhsRows,RowMajor,HasDirect
typedef typename ProductType::Scalar Scalar;
typedef typename ei_traits<ProductType>::_RhsNested Rhs;
enum {
UseRhsDirectly = ((ei_packet_traits<Scalar>::size==1) || (Rhs::Flags&ActualPacketAccessBit))
&& (Rhs::Flags&DirectAccessBit)
&& (!(Rhs::Flags & RowMajorBit)) };
UseRhsDirectly = ((ei_packet_traits<Scalar>::size==1) || (ProductType::RhsNestedFlags&ActualPacketAccessBit))
&& (ProductType::RhsNestedFlags&DirectAccessBit)
&& (!(ProductType::RhsNestedFlags & RowMajorBit)) };
template<typename DestDerived>
inline static void run(DestDerived& res, const ProductType& product)
{
typename ProductType::LhsNestedX lhs(product.lhs());
typename ProductType::RhsNestedX rhs(product.rhs());
Scalar* EIGEN_RESTRICT _rhs;
if (UseRhsDirectly)
_rhs = &product.rhs().const_cast_derived().coeffRef(0);
_rhs = &rhs.const_cast_derived().coeffRef(0);
else
{
_rhs = ei_aligned_stack_new(Scalar, product.rhs().size());
Map<Matrix<Scalar,Rhs::SizeAtCompileTime,1,ColMajor> >(_rhs, product.rhs().size()) = product.rhs();
_rhs = ei_aligned_stack_new(Scalar, rhs.size());
Map<Matrix<Scalar,Rhs::SizeAtCompileTime,1,ColMajor> >(_rhs, rhs.size()) = rhs;
}
ei_cache_friendly_product_rowmajor_times_vector(&product.lhs().const_cast_derived().coeffRef(0,0), product.lhs().stride(),
_rhs, product.rhs().size(), res);
ei_cache_friendly_product_rowmajor_times_vector(&lhs.const_cast_derived().coeffRef(0,0), lhs.stride(),
_rhs, rhs.size(), res);
if (!UseRhsDirectly) ei_aligned_stack_delete(Scalar, _rhs, product.rhs().size());
if (!UseRhsDirectly) ei_aligned_stack_delete(Scalar, _rhs, rhs.size());
}
};
@@ -664,25 +690,28 @@ struct ei_cache_friendly_product_selector<ProductType,1,LhsOrder,LhsAccess,RhsCo
typedef typename ProductType::Scalar Scalar;
typedef typename ei_traits<ProductType>::_LhsNested Lhs;
enum {
UseLhsDirectly = ((ei_packet_traits<Scalar>::size==1) || (Lhs::Flags&ActualPacketAccessBit))
&& (Lhs::Flags&DirectAccessBit)
&& (Lhs::Flags & RowMajorBit) };
UseLhsDirectly = ((ei_packet_traits<Scalar>::size==1) || (ProductType::LhsNestedFlags&ActualPacketAccessBit))
&& (ProductType::LhsNestedFlags&DirectAccessBit)
&& (ProductType::LhsNestedFlags & RowMajorBit) };
template<typename DestDerived>
inline static void run(DestDerived& res, const ProductType& product)
{
typename ProductType::LhsNestedX lhs(product.lhs());
typename ProductType::RhsNestedX rhs(product.rhs());
Scalar* EIGEN_RESTRICT _lhs;
if (UseLhsDirectly)
_lhs = &product.lhs().const_cast_derived().coeffRef(0);
_lhs = &lhs.const_cast_derived().coeffRef(0);
else
{
_lhs = ei_aligned_stack_new(Scalar, product.lhs().size());
Map<Matrix<Scalar,Lhs::SizeAtCompileTime,1,ColMajor> >(_lhs, product.lhs().size()) = product.lhs();
_lhs = ei_aligned_stack_new(Scalar, lhs.size());
Map<Matrix<Scalar,1,Lhs::SizeAtCompileTime,ColMajor> >(_lhs, lhs.size()) = lhs;
}
ei_cache_friendly_product_rowmajor_times_vector(&product.rhs().const_cast_derived().coeffRef(0,0), product.rhs().stride(),
_lhs, product.lhs().size(), res);
ei_cache_friendly_product_rowmajor_times_vector(&rhs.const_cast_derived().coeffRef(0,0), rhs.stride(),
_lhs, lhs.size(), res);
if(!UseLhsDirectly) ei_aligned_stack_delete(Scalar, _lhs, product.lhs().size());
if(!UseLhsDirectly) ei_aligned_stack_delete(Scalar, _lhs, lhs.size());
}
};
@@ -735,7 +764,7 @@ inline Derived& MatrixBase<Derived>::lazyAssign(const Product<Lhs,Rhs,CacheFrien
{
typedef typename ei_cleantype<Lhs>::type _Lhs;
typedef typename ei_cleantype<Rhs>::type _Rhs;
typedef typename ei_nested<_Lhs,_Rhs::ColsAtCompileTime>::type LhsNested;
typedef typename ei_nested<_Rhs,_Lhs::RowsAtCompileTime>::type RhsNested;

View File

@@ -35,7 +35,7 @@ template<typename Lhs, typename Rhs,
? UpperTriangular
: -1,
int StorageOrder = ei_is_part<Lhs>::value ? -1 // this is to solve ambiguous specializations
: int(Lhs::Flags) & (RowMajorBit|SparseBit)
: int(Lhs::Flags) & int(RowMajorBit|SparseBit)
>
struct ei_solve_triangular_selector;

View File

@@ -114,13 +114,13 @@ template<> EIGEN_STRONG_INLINE void ei_pstoreu<float>(float* to, const __m128&
template<> EIGEN_STRONG_INLINE void ei_pstoreu<double>(double* to, const __m128d& from) { _mm_storeu_pd(to, from); }
template<> EIGEN_STRONG_INLINE void ei_pstoreu<int>(int* to, const __m128i& from) { _mm_storeu_si128(reinterpret_cast<__m128i*>(to), from); }
#if defined(_MSC_VER) && (_MSC_VER <= 1500) && defined(_WIN64)
#if defined(_MSC_VER) && (_MSC_VER <= 1500) && defined(_WIN64) && !defined(__INTEL_COMPILER)
// The temporary variable fixes an internal compilation error.
// Direct of the struct members fixed bug #62.
template<> EIGEN_STRONG_INLINE float ei_pfirst<__m128>(const __m128& a) { return a.m128_f32[0]; }
template<> EIGEN_STRONG_INLINE double ei_pfirst<__m128d>(const __m128d& a) { return a.m128d_f64[0]; }
template<> EIGEN_STRONG_INLINE int ei_pfirst<__m128i>(const __m128i& a) { int x = _mm_cvtsi128_si32(a); return x; }
#elif defined(_MSC_VER) && (_MSC_VER <= 1500)
#elif defined(_MSC_VER) && (_MSC_VER <= 1500) && !defined(__INTEL_COMPILER)
// The temporary variable fixes an internal compilation error.
template<> EIGEN_STRONG_INLINE float ei_pfirst<__m128>(const __m128& a) { float x = _mm_cvtss_f32(a); return x; }
template<> EIGEN_STRONG_INLINE double ei_pfirst<__m128d>(const __m128d& a) { double x = _mm_cvtsd_f64(a); return x; }

View File

@@ -30,7 +30,7 @@
#define EIGEN_WORLD_VERSION 2
#define EIGEN_MAJOR_VERSION 0
#define EIGEN_MINOR_VERSION 14
#define EIGEN_MINOR_VERSION 17
#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

@@ -188,7 +188,8 @@ template<> inline void ei_conditional_aligned_free<false>(void *ptr)
template<typename T> inline void ei_destruct_elements_of_array(T *ptr, std::size_t size)
{
// always destruct an array starting from the end.
while(size) ptr[--size].~T();
if(ptr)
while(size) ptr[--size].~T();
}
/** \internal delete objects constructed with ei_aligned_new
@@ -385,7 +386,7 @@ public:
return std::numeric_limits<size_type>::max();
}
pointer allocate( size_type num, const_pointer* hint = 0 )
pointer allocate( size_type num, const void* hint = 0 )
{
static_cast<void>( hint ); // suppress unused variable warning
return static_cast<pointer>( ei_aligned_malloc( num * sizeof(T) ) );

View File

@@ -120,7 +120,7 @@ template<int _Rows, int _Cols> struct ei_size_at_compile_time
* in order to avoid a useless copy
*/
template<typename T, int Sparseness = ei_traits<T>::Flags&SparseBit> class ei_eval;
template<typename T, int Sparseness = ei_traits<T>::Flags&SparseBit> struct ei_eval;
template<typename T> struct ei_eval<T,IsDense>
{

View File

@@ -34,7 +34,7 @@
*
* A parametrized line is defined by an origin point \f$ \mathbf{o} \f$ and a unit
* direction vector \f$ \mathbf{d} \f$ such that the line corresponds to
* the set \f$ l(t) = \mathbf{o} + t \mathbf{d} \f$, \f$ l \in \mathbf{R} \f$.
* the set \f$ l(t) = \mathbf{o} + t \mathbf{d} \f$, \f$ t \in \mathbf{R} \f$.
*
* \param _Scalar the scalar type, i.e., the type of the coefficients
* \param _AmbientDim the dimension of the ambient space, can be a compile time value or Dynamic.

View File

@@ -515,9 +515,10 @@ bool LU<MatrixType>::solve(
if(!ei_isMuchSmallerThan(c.coeff(row,col), biggest_in_c, m_precision))
return false;
}
m_lu.corner(TopLeft, m_rank, m_rank)
.template marked<UpperTriangular>()
.solveTriangularInPlace(c.corner(TopLeft, m_rank, c.cols()));
if(m_rank>0)
m_lu.corner(TopLeft, m_rank, m_rank)
.template marked<UpperTriangular>()
.solveTriangularInPlace(c.corner(TopLeft, m_rank, c.cols()));
// Step 4
result->resize(m_lu.cols(), b.cols());

View File

@@ -54,10 +54,13 @@
* constants \f$a,b,c\f$ so that the plane of equation \f$y=ax+bz+c\f$ fits
* best the five above points. To do that, call this function as follows:
* @code
// create a vector of pointers to the points
std::vector<Vector3d> points_ptrs(5);
for(int k=0; k<5; ++k) points_ptrs[k] = &points[k];
Vector3d coeffs; // will store the coefficients a, b, c
linearRegression(
5,
&points,
&(points_ptrs[0]),
&coeffs,
1 // the coord to express as a function of
// the other ones. 0 means x, 1 means y, 2 means z.

View File

@@ -270,12 +270,18 @@ bool QR<MatrixType>::solve(
ei_assert(m_isInitialized && "QR is not initialized.");
const int rows = m_qr.rows();
ei_assert(b.rows() == rows);
result->resize(rows, b.cols());
// enforce the computation of the rank
rank();
result->resize(m_qr.cols(), b.cols());
// TODO(keir): There is almost certainly a faster way to multiply by
// Q^T without explicitly forming matrixQ(). Investigate.
*result = matrixQ().transpose()*b;
if(m_rank==0)
return result->isZero();
if(!isSurjective())
{
// is result is in the image of R ?

View File

@@ -391,7 +391,7 @@ void Tridiagonalization<MatrixType>::_decomposeInPlace3x3(MatrixType& mat, Diago
{
diag[0] = ei_real(mat(0,0));
RealScalar v1norm2 = ei_abs2(mat(0,2));
if (ei_isMuchSmallerThan(v1norm2, RealScalar(1)))
if (v1norm2==RealScalar(0))
{
diag[1] = ei_real(mat(1,1));
diag[2] = ei_real(mat(2,2));

View File

@@ -96,8 +96,8 @@ class SparseLU
void setOrderingMethod(int m)
{
ei_assert(m&~OrderingMask == 0 && m!=0 && "invalid ordering method");
m_flags = m_flags&~OrderingMask | m&OrderingMask;
ei_assert((m&~OrderingMask) == 0 && m!=0 && "invalid ordering method");
m_flags = (m_flags&~OrderingMask) | (m&OrderingMask);
}
int orderingMethod() const

View File

@@ -124,4 +124,8 @@ void test_cholesky()
CALL_SUBTEST( cholesky(MatrixXf(17,17)) );
CALL_SUBTEST( cholesky(MatrixXd(33,33)) );
}
MatrixXf m = MatrixXf::Zero(10,10);
VectorXf b = VectorXf::Zero(10);
VERIFY(!m.llt().isPositiveDefinite());
}

View File

@@ -132,4 +132,10 @@ void test_lu()
CALL_SUBTEST( lu_invertible<MatrixXcf>() );
CALL_SUBTEST( lu_invertible<MatrixXcd>() );
}
MatrixXf m = MatrixXf::Zero(10,10);
VectorXf b = VectorXf::Zero(10);
VectorXf x = VectorXf::Random(10);
VERIFY(m.lu().solve(b,&x));
VERIFY(x.isZero());
}

View File

@@ -48,4 +48,11 @@ void test_product_large()
MatrixXf a = MatrixXf::Random(10,4), b = MatrixXf::Random(4,10), c = a;
VERIFY_IS_APPROX((a = a * b), (c * b).eval());
}
{
MatrixXf mat1(10,10); mat1.setRandom();
MatrixXf mat2(32,10); mat2.setRandom();
MatrixXf result = mat1.row(2)*mat2.transpose();
VERIFY_IS_APPROX(result, (mat1.row(2)*mat2.transpose()).eval());
}
}

View File

@@ -75,4 +75,11 @@ void test_qr()
mat << 1, 1, 1, 2, 2, 2, 1, 2, 3;
VERIFY(!mat.qr().isFullRank());
}
{
MatrixXf m = MatrixXf::Zero(10,10);
VectorXf b = VectorXf::Zero(10);
VectorXf x = VectorXf::Random(10);
VERIFY(m.qr().solve(b,&x));
VERIFY(x.isZero());
}
}

View File

@@ -121,11 +121,40 @@ template<typename MatrixType> void triangular(const MatrixType& m)
m3.setZero();
m3.template part<Eigen::UpperTriangular>().setOnes();
VERIFY_IS_APPROX(m2,m3);
}
void selfadjoint()
{
Matrix2i m;
m << 1, 2,
3, 4;
VERIFY(m.part<SelfAdjoint>() == m);
Matrix2i m1 = Matrix2i::Zero();
m1.part<SelfAdjoint>() = m;
Matrix2i ref1;
ref1 << 1, 2,
2, 4;
VERIFY(m1 == ref1);
Matrix2i m2 = Matrix2i::Zero();
m2.part<SelfAdjoint>() = m.part<UpperTriangular>();
Matrix2i ref2;
ref2 << 1, 2,
2, 4;
VERIFY(m2 == ref2);
Matrix2i m3 = Matrix2i::Zero();
m3.part<SelfAdjoint>() = m.part<LowerTriangular>();
Matrix2i ref3;
ref3 << 1, 0,
0, 4;
VERIFY(m3 == ref3);
}
void test_triangular()
{
CALL_SUBTEST( selfadjoint() );
for(int i = 0; i < g_repeat ; i++) {
CALL_SUBTEST( triangular(Matrix<float, 1, 1>()) );
CALL_SUBTEST( triangular(Matrix<float, 2, 2>()) );