Pulled latest updates from upstream

This commit is contained in:
Benoit Steiner 2017-02-10 13:11:40 -08:00
commit 769208a17f
17 changed files with 107 additions and 59 deletions

View File

@ -14,7 +14,7 @@
#include "Core" #include "Core"
#include <deque> #include <deque>
#if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 /* MSVC auto aligns in 64 bit builds */ #if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */
#define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...) #define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...)

View File

@ -13,7 +13,7 @@
#include "Core" #include "Core"
#include <list> #include <list>
#if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 /* MSVC auto aligns in 64 bit builds */ #if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */
#define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) #define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...)

View File

@ -14,7 +14,7 @@
#include "Core" #include "Core"
#include <vector> #include <vector>
#if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 /* MSVC auto aligns in 64 bit builds */ #if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */
#define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) #define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...)

View File

@ -515,7 +515,7 @@ struct dense_assignment_loop<Kernel, LinearTraversal, CompleteUnrolling>
template<typename Kernel> template<typename Kernel>
struct dense_assignment_loop<Kernel, SliceVectorizedTraversal, NoUnrolling> struct dense_assignment_loop<Kernel, SliceVectorizedTraversal, NoUnrolling>
{ {
EIGEN_DEVICE_FUNC static inline void run(Kernel &kernel) EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel)
{ {
typedef typename Kernel::Scalar Scalar; typedef typename Kernel::Scalar Scalar;
typedef typename Kernel::PacketType PacketType; typedef typename Kernel::PacketType PacketType;
@ -563,7 +563,7 @@ struct dense_assignment_loop<Kernel, SliceVectorizedTraversal, NoUnrolling>
template<typename Kernel> template<typename Kernel>
struct dense_assignment_loop<Kernel, SliceVectorizedTraversal, InnerUnrolling> struct dense_assignment_loop<Kernel, SliceVectorizedTraversal, InnerUnrolling>
{ {
EIGEN_DEVICE_FUNC static inline void run(Kernel &kernel) EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel)
{ {
typedef typename Kernel::DstEvaluatorType::XprType DstXprType; typedef typename Kernel::DstEvaluatorType::XprType DstXprType;
typedef typename Kernel::PacketType PacketType; typedef typename Kernel::PacketType PacketType;

View File

@ -104,13 +104,14 @@ void parallelize_gemm(const Functor& func, Index rows, Index cols, Index depth,
// - the sizes are large enough // - the sizes are large enough
// compute the maximal number of threads from the size of the product: // compute the maximal number of threads from the size of the product:
// FIXME this has to be fine tuned // This first heuristic takes into account that the product kernel is fully optimized when working with nr columns at once.
Index size = transpose ? rows : cols; Index size = transpose ? rows : cols;
Index pb_max_threads = std::max<Index>(1,size / 32); Index pb_max_threads = std::max<Index>(1,size / Functor::Traits::nr);
// compute the maximal number of threads from the total amount of work: // compute the maximal number of threads from the total amount of work:
double work = static_cast<double>(rows) * static_cast<double>(cols) * double work = static_cast<double>(rows) * static_cast<double>(cols) *
static_cast<double>(depth); static_cast<double>(depth);
double kMinTaskSize = 50000; // Heuristic. double kMinTaskSize = 50000; // FIXME improve this heuristic.
pb_max_threads = std::max<Index>(1, std::min<Index>(pb_max_threads, work / kMinTaskSize)); pb_max_threads = std::max<Index>(1, std::min<Index>(pb_max_threads, work / kMinTaskSize));
// compute the number of threads we are going to use // compute the number of threads we are going to use

View File

@ -23,7 +23,7 @@
/// \internal EIGEN_COMP_GNUC set to 1 for all compilers compatible with GCC /// \internal EIGEN_COMP_GNUC set to 1 for all compilers compatible with GCC
#ifdef __GNUC__ #ifdef __GNUC__
#define EIGEN_COMP_GNUC 1 #define EIGEN_COMP_GNUC (__GNUC__*10+__GNUC_MINOR__)
#else #else
#define EIGEN_COMP_GNUC 0 #define EIGEN_COMP_GNUC 0
#endif #endif
@ -80,8 +80,8 @@
// 2015 14 1900 // 2015 14 1900
// "15" 15 1900 // "15" 15 1900
/// \internal EIGEN_COMP_MSVC_STRICT set to 1 if the compiler is really Microsoft Visual C++ and not ,e.g., ICC /// \internal EIGEN_COMP_MSVC_STRICT set to 1 if the compiler is really Microsoft Visual C++ and not ,e.g., ICC or clang-cl
#if EIGEN_COMP_MSVC && !(EIGEN_COMP_ICC) #if EIGEN_COMP_MSVC && !(EIGEN_COMP_ICC || EIGEN_COMP_LLVM || EIGEN_COMP_CLANG)
#define EIGEN_COMP_MSVC_STRICT _MSC_VER #define EIGEN_COMP_MSVC_STRICT _MSC_VER
#else #else
#define EIGEN_COMP_MSVC_STRICT 0 #define EIGEN_COMP_MSVC_STRICT 0
@ -349,6 +349,12 @@
# define __has_feature(x) 0 # define __has_feature(x) 0
#endif #endif
#if !( EIGEN_COMP_CLANG && ((EIGEN_COMP_CLANG<309) || defined(__apple_build_version__)) || EIGEN_COMP_GNUC_STRICT && EIGEN_COMP_GNUC<49)
#define EIGEN_HAS_INDEXED_VIEW 1
#else
#define EIGEN_HAS_INDEXED_VIEW 0
#endif
// Upperbound on the C++ version to use. // Upperbound on the C++ version to use.
// Expected values are 03, 11, 14, 17, etc. // Expected values are 03, 11, 14, 17, etc.
// By default, let's use an arbitrarily large C++ version. // By default, let's use an arbitrarily large C++ version.

View File

@ -250,7 +250,7 @@ template<typename _MatrixType> class ComplexEigenSolver
EigenvectorType m_matX; EigenvectorType m_matX;
private: private:
void doComputeEigenvectors(const RealScalar& matrixnorm); void doComputeEigenvectors(RealScalar matrixnorm);
void sortEigenvalues(bool computeEigenvectors); void sortEigenvalues(bool computeEigenvectors);
}; };
@ -284,10 +284,12 @@ ComplexEigenSolver<MatrixType>::compute(const EigenBase<InputType>& matrix, bool
template<typename MatrixType> template<typename MatrixType>
void ComplexEigenSolver<MatrixType>::doComputeEigenvectors(const RealScalar& matrixnorm) void ComplexEigenSolver<MatrixType>::doComputeEigenvectors(RealScalar matrixnorm)
{ {
const Index n = m_eivalues.size(); const Index n = m_eivalues.size();
matrixnorm = numext::maxi(matrixnorm,(std::numeric_limits<RealScalar>::min)());
// Compute X such that T = X D X^(-1), where D is the diagonal of T. // Compute X such that T = X D X^(-1), where D is the diagonal of T.
// The matrix X is unit triangular. // The matrix X is unit triangular.
m_matX = EigenvectorType::Zero(n, n); m_matX = EigenvectorType::Zero(n, n);

View File

@ -248,12 +248,24 @@ template<typename MatrixType>
template<typename InputType> template<typename InputType>
RealSchur<MatrixType>& RealSchur<MatrixType>::compute(const EigenBase<InputType>& matrix, bool computeU) RealSchur<MatrixType>& RealSchur<MatrixType>::compute(const EigenBase<InputType>& matrix, bool computeU)
{ {
const Scalar considerAsZero = (std::numeric_limits<Scalar>::min)();
eigen_assert(matrix.cols() == matrix.rows()); eigen_assert(matrix.cols() == matrix.rows());
Index maxIters = m_maxIters; Index maxIters = m_maxIters;
if (maxIters == -1) if (maxIters == -1)
maxIters = m_maxIterationsPerRow * matrix.rows(); maxIters = m_maxIterationsPerRow * matrix.rows();
Scalar scale = matrix.derived().cwiseAbs().maxCoeff(); Scalar scale = matrix.derived().cwiseAbs().maxCoeff();
if(scale<considerAsZero)
{
m_matT.setZero(matrix.rows(),matrix.cols());
if(computeU)
m_matU.setIdentity(matrix.rows(),matrix.cols());
m_info = Success;
m_isInitialized = true;
m_matUisUptodate = computeU;
return *this;
}
// Step 1. Reduce to Hessenberg form // Step 1. Reduce to Hessenberg form
m_hess.compute(matrix.derived()/scale); m_hess.compute(matrix.derived()/scale);

View File

@ -200,10 +200,12 @@ public:
ColsAtCompileTime = MatrixType::ColsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime,
MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
Options = MatrixType::Options TrOptions = RowsAtCompileTime==1 ? (MatrixType::Options & ~(RowMajor))
: ColsAtCompileTime==1 ? (MatrixType::Options | RowMajor)
: MatrixType::Options
}; };
typedef Matrix<Scalar, ColsAtCompileTime, RowsAtCompileTime, Options, MaxColsAtCompileTime, MaxRowsAtCompileTime> typedef Matrix<Scalar, ColsAtCompileTime, RowsAtCompileTime, TrOptions, MaxColsAtCompileTime, MaxRowsAtCompileTime>
TransposeTypeWithSameStorageOrder; TransposeTypeWithSameStorageOrder;
void allocate(const JacobiSVD<MatrixType, ColPivHouseholderQRPreconditioner>& svd) void allocate(const JacobiSVD<MatrixType, ColPivHouseholderQRPreconditioner>& svd)

View File

@ -336,7 +336,7 @@ class AmbiVector<_Scalar,_StorageIndex>::Iterator
{ {
do { do {
++m_cachedIndex; ++m_cachedIndex;
} while (m_cachedIndex<m_vector.m_end && abs(m_vector.m_buffer[m_cachedIndex])<m_epsilon); } while (m_cachedIndex<m_vector.m_end && abs(m_vector.m_buffer[m_cachedIndex])<=m_epsilon);
if (m_cachedIndex<m_vector.m_end) if (m_cachedIndex<m_vector.m_end)
m_cachedValue = m_vector.m_buffer[m_cachedIndex]; m_cachedValue = m_vector.m_buffer[m_cachedIndex];
else else
@ -347,7 +347,7 @@ class AmbiVector<_Scalar,_StorageIndex>::Iterator
ListEl* EIGEN_RESTRICT llElements = reinterpret_cast<ListEl*>(m_vector.m_buffer); ListEl* EIGEN_RESTRICT llElements = reinterpret_cast<ListEl*>(m_vector.m_buffer);
do { do {
m_currentEl = llElements[m_currentEl].next; m_currentEl = llElements[m_currentEl].next;
} while (m_currentEl>=0 && abs(llElements[m_currentEl].value)<m_epsilon); } while (m_currentEl>=0 && abs(llElements[m_currentEl].value)<=m_epsilon);
if (m_currentEl<0) if (m_currentEl<0)
{ {
m_cachedIndex = -1; m_cachedIndex = -1;
@ -363,9 +363,9 @@ class AmbiVector<_Scalar,_StorageIndex>::Iterator
protected: protected:
const AmbiVector& m_vector; // the target vector const AmbiVector& m_vector; // the target vector
StorageIndex m_currentEl; // the current element in sparse/linked-list mode StorageIndex m_currentEl; // the current element in sparse/linked-list mode
RealScalar m_epsilon; // epsilon used to prune zero coefficients RealScalar m_epsilon; // epsilon used to prune zero coefficients
StorageIndex m_cachedIndex; // current coordinate StorageIndex m_cachedIndex; // current coordinate
Scalar m_cachedValue; // current value Scalar m_cachedValue; // current value
bool m_isDense; // mode of the vector bool m_isDense; // mode of the vector
}; };

View File

@ -78,8 +78,8 @@ EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
/// ///
/// \sa class Block, fix, fix<N>(int) /// \sa class Block, fix, fix<N>(int)
/// ///
EIGEN_DEVICE_FUNC
template<typename NRowsType, typename NColsType> template<typename NRowsType, typename NColsType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type inline typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type
#else #else
@ -92,8 +92,8 @@ block(Index startRow, Index startCol, NRowsType blockRows, NColsType blockCols)
} }
/// This is the const version of block(Index,Index,NRowsType,NColsType) /// This is the const version of block(Index,Index,NRowsType,NColsType)
EIGEN_DEVICE_FUNC
template<typename NRowsType, typename NColsType> template<typename NRowsType, typename NColsType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline const typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type inline const typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type
#else #else
@ -124,8 +124,8 @@ EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
/// ///
/// \sa block(Index,Index,NRowsType,NColsType), class Block /// \sa block(Index,Index,NRowsType,NColsType), class Block
/// ///
EIGEN_DEVICE_FUNC
template<typename NRowsType, typename NColsType> template<typename NRowsType, typename NColsType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type inline typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type
#else #else
@ -138,8 +138,8 @@ topRightCorner(NRowsType cRows, NColsType cCols)
} }
/// This is the const version of topRightCorner(NRowsType, NColsType). /// This is the const version of topRightCorner(NRowsType, NColsType).
EIGEN_DEVICE_FUNC
template<typename NRowsType, typename NColsType> template<typename NRowsType, typename NColsType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline const typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type inline const typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type
#else #else
@ -229,8 +229,8 @@ EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
/// ///
/// \sa block(Index,Index,NRowsType,NColsType), class Block /// \sa block(Index,Index,NRowsType,NColsType), class Block
/// ///
EIGEN_DEVICE_FUNC
template<typename NRowsType, typename NColsType> template<typename NRowsType, typename NColsType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type inline typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type
#else #else
@ -243,8 +243,8 @@ topLeftCorner(NRowsType cRows, NColsType cCols)
} }
/// This is the const version of topLeftCorner(Index, Index). /// This is the const version of topLeftCorner(Index, Index).
EIGEN_DEVICE_FUNC
template<typename NRowsType, typename NColsType> template<typename NRowsType, typename NColsType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline const typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type inline const typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type
#else #else
@ -333,8 +333,8 @@ EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
/// ///
/// \sa block(Index,Index,NRowsType,NColsType), class Block /// \sa block(Index,Index,NRowsType,NColsType), class Block
/// ///
EIGEN_DEVICE_FUNC
template<typename NRowsType, typename NColsType> template<typename NRowsType, typename NColsType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type inline typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type
#else #else
@ -348,8 +348,8 @@ bottomRightCorner(NRowsType cRows, NColsType cCols)
} }
/// This is the const version of bottomRightCorner(NRowsType, NColsType). /// This is the const version of bottomRightCorner(NRowsType, NColsType).
EIGEN_DEVICE_FUNC
template<typename NRowsType, typename NColsType> template<typename NRowsType, typename NColsType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline const typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type inline const typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type
#else #else
@ -439,8 +439,8 @@ EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
/// ///
/// \sa block(Index,Index,NRowsType,NColsType), class Block /// \sa block(Index,Index,NRowsType,NColsType), class Block
/// ///
EIGEN_DEVICE_FUNC
template<typename NRowsType, typename NColsType> template<typename NRowsType, typename NColsType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type inline typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type
#else #else
@ -454,8 +454,8 @@ bottomLeftCorner(NRowsType cRows, NColsType cCols)
} }
/// This is the const version of bottomLeftCorner(NRowsType, NColsType). /// This is the const version of bottomLeftCorner(NRowsType, NColsType).
EIGEN_DEVICE_FUNC
template<typename NRowsType, typename NColsType> template<typename NRowsType, typename NColsType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type inline typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type
#else #else
@ -544,8 +544,8 @@ EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row-major)
/// ///
/// \sa block(Index,Index,NRowsType,NColsType), class Block /// \sa block(Index,Index,NRowsType,NColsType), class Block
/// ///
EIGEN_DEVICE_FUNC
template<typename NRowsType> template<typename NRowsType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type inline typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type
#else #else
@ -558,8 +558,8 @@ topRows(NRowsType n)
} }
/// This is the const version of topRows(NRowsType). /// This is the const version of topRows(NRowsType).
EIGEN_DEVICE_FUNC
template<typename NRowsType> template<typename NRowsType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline const typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type inline const typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type
#else #else
@ -619,8 +619,8 @@ EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row-major)
/// ///
/// \sa block(Index,Index,NRowsType,NColsType), class Block /// \sa block(Index,Index,NRowsType,NColsType), class Block
/// ///
EIGEN_DEVICE_FUNC
template<typename NRowsType> template<typename NRowsType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type inline typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type
#else #else
@ -633,8 +633,8 @@ bottomRows(NRowsType n)
} }
/// This is the const version of bottomRows(NRowsType). /// This is the const version of bottomRows(NRowsType).
EIGEN_DEVICE_FUNC
template<typename NRowsType> template<typename NRowsType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline const typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type inline const typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type
#else #else
@ -695,8 +695,8 @@ EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row-major)
/// ///
/// \sa block(Index,Index,NRowsType,NColsType), class Block /// \sa block(Index,Index,NRowsType,NColsType), class Block
/// ///
EIGEN_DEVICE_FUNC
template<typename NRowsType> template<typename NRowsType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type inline typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type
#else #else
@ -709,8 +709,8 @@ middleRows(Index startRow, NRowsType n)
} }
/// This is the const version of middleRows(Index,NRowsType). /// This is the const version of middleRows(Index,NRowsType).
EIGEN_DEVICE_FUNC
template<typename NRowsType> template<typename NRowsType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline const typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type inline const typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type
#else #else
@ -771,8 +771,8 @@ EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column-major)
/// ///
/// \sa block(Index,Index,NRowsType,NColsType), class Block /// \sa block(Index,Index,NRowsType,NColsType), class Block
/// ///
EIGEN_DEVICE_FUNC
template<typename NColsType> template<typename NColsType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type inline typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type
#else #else
@ -785,8 +785,8 @@ leftCols(NColsType n)
} }
/// This is the const version of leftCols(NColsType). /// This is the const version of leftCols(NColsType).
EIGEN_DEVICE_FUNC
template<typename NColsType> template<typename NColsType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline const typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type inline const typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type
#else #else
@ -846,8 +846,8 @@ EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column-major)
/// ///
/// \sa block(Index,Index,NRowsType,NColsType), class Block /// \sa block(Index,Index,NRowsType,NColsType), class Block
/// ///
EIGEN_DEVICE_FUNC
template<typename NColsType> template<typename NColsType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type inline typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type
#else #else
@ -860,8 +860,8 @@ rightCols(NColsType n)
} }
/// This is the const version of rightCols(NColsType). /// This is the const version of rightCols(NColsType).
EIGEN_DEVICE_FUNC
template<typename NColsType> template<typename NColsType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline const typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type inline const typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type
#else #else
@ -922,8 +922,8 @@ EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column-major)
/// ///
/// \sa block(Index,Index,NRowsType,NColsType), class Block /// \sa block(Index,Index,NRowsType,NColsType), class Block
/// ///
EIGEN_DEVICE_FUNC
template<typename NColsType> template<typename NColsType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type inline typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type
#else #else
@ -936,8 +936,8 @@ middleCols(Index startCol, NColsType numCols)
} }
/// This is the const version of middleCols(Index,NColsType). /// This is the const version of middleCols(Index,NColsType).
EIGEN_DEVICE_FUNC
template<typename NColsType> template<typename NColsType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline const typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type inline const typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type
#else #else
@ -1130,8 +1130,8 @@ inline ConstRowXpr row(Index i) const
/// ///
/// \sa block(Index,Index,NRowsType,NColsType), fix<N>, fix<N>(int), class Block /// \sa block(Index,Index,NRowsType,NColsType), fix<N>, fix<N>(int), class Block
/// ///
EIGEN_DEVICE_FUNC
template<typename NType> template<typename NType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type inline typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type
#else #else
@ -1146,8 +1146,8 @@ segment(Index start, NType n)
/// This is the const version of segment(Index,NType). /// This is the const version of segment(Index,NType).
EIGEN_DEVICE_FUNC
template<typename NType> template<typename NType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline const typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type inline const typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type
#else #else
@ -1180,8 +1180,8 @@ segment(Index start, NType n) const
/// ///
/// \sa class Block, block(Index,Index) /// \sa class Block, block(Index,Index)
/// ///
EIGEN_DEVICE_FUNC
template<typename NType> template<typename NType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type inline typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type
#else #else
@ -1195,8 +1195,8 @@ head(NType n)
} }
/// This is the const version of head(NType). /// This is the const version of head(NType).
EIGEN_DEVICE_FUNC
template<typename NType> template<typename NType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline const typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type inline const typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type
#else #else
@ -1229,8 +1229,8 @@ head(NType n) const
/// ///
/// \sa class Block, block(Index,Index) /// \sa class Block, block(Index,Index)
/// ///
EIGEN_DEVICE_FUNC
template<typename NType> template<typename NType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type inline typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type
#else #else
@ -1244,8 +1244,8 @@ tail(NType n)
} }
/// This is the const version of tail(Index). /// This is the const version of tail(Index).
EIGEN_DEVICE_FUNC
template<typename NType> template<typename NType>
EIGEN_DEVICE_FUNC
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
inline const typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type inline const typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type
#else #else

View File

@ -7,7 +7,7 @@
// Public License v. 2.0. If a copy of the MPL was not distributed // Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef EIGEN_PARSED_BY_DOXYGEN #if !defined(EIGEN_PARSED_BY_DOXYGEN) && EIGEN_HAS_INDEXED_VIEW
// This file is automatically included twice to generate const and non-const versions // This file is automatically included twice to generate const and non-const versions
@ -256,5 +256,4 @@ template<typename Indices>
IndexedView_or_VectorBlock IndexedView_or_VectorBlock
operator()(const Indices& indices); operator()(const Indices& indices);
#endif // EIGEN_PARSED_BY_DOXYGEN #endif // EIGEN_PARSED_BY_DOXYGEN && EIGEN_HAS_INDEXED_VIEW

View File

@ -131,6 +131,15 @@ template<typename MatrixType> void eigensolver(const MatrixType& m)
ComplexEigenSolver<MatrixType> eig(a.adjoint() * a); ComplexEigenSolver<MatrixType> eig(a.adjoint() * a);
eig.compute(a.adjoint() * a); eig.compute(a.adjoint() * a);
} }
// regression test for bug 478
{
a.setZero();
ComplexEigenSolver<MatrixType> ei3(a);
VERIFY_IS_EQUAL(ei3.info(), Success);
VERIFY_IS_MUCH_SMALLER_THAN(ei3.eigenvalues().norm(),RealScalar(1));
VERIFY((ei3.eigenvectors().transpose()*ei3.eigenvectors().transpose()).eval().isIdentity());
}
} }
template<typename MatrixType> void eigensolver_verify_assert(const MatrixType& m) template<typename MatrixType> void eigensolver_verify_assert(const MatrixType& m)

View File

@ -76,6 +76,15 @@ template<typename MatrixType> void eigensolver(const MatrixType& m)
EigenSolver<MatrixType> eig(a.adjoint() * a); EigenSolver<MatrixType> eig(a.adjoint() * a);
eig.compute(a.adjoint() * a); eig.compute(a.adjoint() * a);
} }
// regression test for bug 478
{
a.setZero();
EigenSolver<MatrixType> ei3(a);
VERIFY_IS_EQUAL(ei3.info(), Success);
VERIFY_IS_MUCH_SMALLER_THAN(ei3.eigenvalues().norm(),RealScalar(1));
VERIFY((ei3.eigenvectors().transpose()*ei3.eigenvectors().transpose()).eval().isIdentity());
}
} }
template<typename MatrixType> void eigensolver_verify_assert(const MatrixType& m) template<typename MatrixType> void eigensolver_verify_assert(const MatrixType& m)

View File

@ -180,6 +180,15 @@ template<typename MatrixType> void selfadjointeigensolver(const MatrixType& m)
SelfAdjointEigenSolver<MatrixType> eig(a.adjoint() * a); SelfAdjointEigenSolver<MatrixType> eig(a.adjoint() * a);
eig.compute(a.adjoint() * a); eig.compute(a.adjoint() * a);
} }
// regression test for bug 478
{
a.setZero();
SelfAdjointEigenSolver<MatrixType> ei3(a);
VERIFY_IS_EQUAL(ei3.info(), Success);
VERIFY_IS_MUCH_SMALLER_THAN(ei3.eigenvalues().norm(),RealScalar(1));
VERIFY((ei3.eigenvectors().transpose()*ei3.eigenvectors().transpose()).eval().isIdentity());
}
} }
template<int> template<int>

View File

@ -79,6 +79,7 @@ is_same_seq_type(const T1& a, const T2& b)
void check_indexed_view() void check_indexed_view()
{ {
#if EIGEN_HAS_INDEXED_VIEW
using Eigen::placeholders::all; using Eigen::placeholders::all;
using Eigen::placeholders::last; using Eigen::placeholders::last;
using Eigen::placeholders::end; using Eigen::placeholders::end;
@ -297,7 +298,6 @@ void check_indexed_view()
VERIFY_IS_APPROX( (A(std::array<int,3>{{1,3,5}}, std::array<int,4>{{9,6,3,0}})), A(seqN(1,3,2), seqN(9,4,-3)) ); VERIFY_IS_APPROX( (A(std::array<int,3>{{1,3,5}}, std::array<int,4>{{9,6,3,0}})), A(seqN(1,3,2), seqN(9,4,-3)) );
#if (!EIGEN_COMP_CLANG) || (EIGEN_COMP_CLANG>=308 && !defined(__apple_build_version__))
VERIFY_IS_APPROX( A({3, 1, 6, 5}, all), A(std::array<int,4>{{3, 1, 6, 5}}, all) ); VERIFY_IS_APPROX( A({3, 1, 6, 5}, all), A(std::array<int,4>{{3, 1, 6, 5}}, all) );
VERIFY_IS_APPROX( A(all,{3, 1, 6, 5}), A(all,std::array<int,4>{{3, 1, 6, 5}}) ); VERIFY_IS_APPROX( A(all,{3, 1, 6, 5}), A(all,std::array<int,4>{{3, 1, 6, 5}}) );
VERIFY_IS_APPROX( A({1,3,5},{3, 1, 6, 5}), A(std::array<int,3>{{1,3,5}},std::array<int,4>{{3, 1, 6, 5}}) ); VERIFY_IS_APPROX( A({1,3,5},{3, 1, 6, 5}), A(std::array<int,3>{{1,3,5}},std::array<int,4>{{3, 1, 6, 5}}) );
@ -310,7 +310,6 @@ void check_indexed_view()
VERIFY_IS_APPROX( b({3, 1, 6, 5}), b(std::array<int,4>{{3, 1, 6, 5}}) ); VERIFY_IS_APPROX( b({3, 1, 6, 5}), b(std::array<int,4>{{3, 1, 6, 5}}) );
VERIFY_IS_EQUAL( b({1,3,5}).SizeAtCompileTime, 3 ); VERIFY_IS_EQUAL( b({1,3,5}).SizeAtCompileTime, 3 );
#endif
#endif #endif
@ -366,6 +365,7 @@ void check_indexed_view()
VERIFY( is_same_eq( cA.middleRows<3>(1), cA.middleRows(1,fix<3>)) ); VERIFY( is_same_eq( cA.middleRows<3>(1), cA.middleRows(1,fix<3>)) );
} }
#endif // EIGEN_HAS_INDEXED_VIEW
} }
void test_indexed_view() void test_indexed_view()

View File

@ -64,9 +64,9 @@ void pack_simple(Scalar * dst, const Scalar * src, Index cols, Index rows, Index
template<typename LhsScalar, typename RhsScalar, typename Scalar> template<typename LhsScalar, typename RhsScalar, typename Scalar>
struct libxsmm_wrapper { struct libxsmm_wrapper {
libxsmm_wrapper() {} libxsmm_wrapper() {}
libxsmm_wrapper(int flags, int m, int n, int k, int lda, int ldb, int ldc, float alpha, float beta, int prefetch) {} libxsmm_wrapper(int, int, int, int, int, int, int, float, float, int) {}
void operator()(const LhsScalar* a, const RhsScalar* b, Scalar* c) {} void operator()(const LhsScalar*, const RhsScalar*, Scalar*) {}
void operator()(const LhsScalar* a, const RhsScalar* b, Scalar* c, const LhsScalar* ap, const RhsScalar* bp, const Scalar* cp) {} void operator()(const LhsScalar*, const RhsScalar*, Scalar*, const LhsScalar*, const RhsScalar*, const Scalar*) {}
}; };
template<> template<>
@ -682,10 +682,9 @@ protected:
} }
m_can_use_xsmm = true; m_can_use_xsmm = true;
#else #else
// silence the compiler warning EIGEN_UNUSED_VARIABLE(eval_op_indices);
(void) eval_op_indices; #endif
#endif
} }
#if defined(EIGEN_VECTORIZE_AVX) && defined(EIGEN_USE_LIBXSMM) #if defined(EIGEN_VECTORIZE_AVX) && defined(EIGEN_USE_LIBXSMM)