summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-01-16 11:45:13 +0100
committerStanislaw Halik <sthalik@misaki.pl>2019-01-16 11:45:13 +0100
commitbbdfe42628cc324904a49d472230c8cbbfd9e1d5 (patch)
tree0ae6a380649af4a854c88245abb1c9fa3a571cc4
parent3e07e568a1ae478b89812d91438d75179c94ab35 (diff)
update eigen
-rw-r--r--eigen/.hgtags2
-rw-r--r--eigen/CMakeLists.txt38
-rw-r--r--eigen/CTestCustom.cmake.in1
-rw-r--r--eigen/Eigen/Core4
-rw-r--r--eigen/Eigen/src/Cholesky/LDLT.h3
-rw-r--r--eigen/Eigen/src/Core/Array.h2
-rw-r--r--eigen/Eigen/src/Core/ConditionEstimator.h2
-rw-r--r--eigen/Eigen/src/Core/MapBase.h6
-rw-r--r--eigen/Eigen/src/Core/MathFunctions.h36
-rw-r--r--eigen/Eigen/src/Core/Matrix.h2
-rw-r--r--eigen/Eigen/src/Core/MatrixBase.h26
-rw-r--r--eigen/Eigen/src/Core/SolveTriangular.h3
-rw-r--r--eigen/Eigen/src/Core/arch/AVX/PacketMath.h13
-rw-r--r--eigen/Eigen/src/Core/arch/AVX512/PacketMath.h6
-rw-r--r--eigen/Eigen/src/Core/arch/CUDA/Half.h193
-rw-r--r--eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h3
-rw-r--r--eigen/Eigen/src/Core/arch/SSE/PacketMath.h2
-rw-r--r--eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h15
-rw-r--r--eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h2
-rw-r--r--eigen/Eigen/src/Core/util/DisableStupidWarnings.h14
-rw-r--r--eigen/Eigen/src/Core/util/Macros.h2
-rw-r--r--eigen/Eigen/src/Core/util/Memory.h10
-rw-r--r--eigen/Eigen/src/Core/util/Meta.h22
-rw-r--r--eigen/Eigen/src/Core/util/ReenableStupidWarnings.h2
-rw-r--r--eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h2
-rw-r--r--eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h5
-rw-r--r--eigen/Eigen/src/Jacobi/Jacobi.h13
-rw-r--r--eigen/Eigen/src/SVD/SVDBase.h4
-rw-r--r--eigen/Eigen/src/SparseCore/SparseMatrix.h6
-rw-r--r--eigen/Eigen/src/SparseLU/SparseLU.h2
-rw-r--r--eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h4
-rw-r--r--eigen/cmake/EigenConfigureTesting.cmake13
-rw-r--r--eigen/doc/CMakeLists.txt4
-rw-r--r--eigen/doc/CoeffwiseMathFunctionsTable.dox7
-rw-r--r--eigen/doc/Doxyfile.in6
-rw-r--r--eigen/doc/eigen_navtree_hacks.js46
-rw-r--r--eigen/doc/eigendoxy.css2
-rw-r--r--eigen/doc/snippets/MatrixBase_cwiseEqual.cpp2
-rw-r--r--eigen/doc/snippets/MatrixBase_cwiseNotEqual.cpp2
-rw-r--r--eigen/doc/special_examples/CMakeLists.txt1
-rw-r--r--eigen/test/adjoint.cpp1
-rw-r--r--eigen/test/array.cpp5
-rw-r--r--eigen/test/array_for_matrix.cpp4
-rw-r--r--eigen/test/array_replicate.cpp1
-rw-r--r--eigen/test/array_reverse.cpp1
-rw-r--r--eigen/test/basicstuff.cpp2
-rw-r--r--eigen/test/block.cpp3
-rw-r--r--eigen/test/cholesky.cpp19
-rw-r--r--eigen/test/conservative_resize.cpp1
-rw-r--r--eigen/test/corners.cpp1
-rw-r--r--eigen/test/determinant.cpp1
-rw-r--r--eigen/test/diagonal.cpp1
-rw-r--r--eigen/test/diagonalmatrices.cpp1
-rw-r--r--eigen/test/dontalign.cpp1
-rw-r--r--eigen/test/eigen2support.cpp1
-rw-r--r--eigen/test/eigensolver_complex.cpp1
-rw-r--r--eigen/test/eigensolver_generalized_real.cpp1
-rw-r--r--eigen/test/eigensolver_generic.cpp1
-rw-r--r--eigen/test/eigensolver_selfadjoint.cpp1
-rw-r--r--eigen/test/geo_alignedbox.cpp2
-rw-r--r--eigen/test/geo_hyperplane.cpp1
-rw-r--r--eigen/test/geo_parametrizedline.cpp1
-rw-r--r--eigen/test/half_float.cpp42
-rw-r--r--eigen/test/householder.cpp1
-rw-r--r--eigen/test/integer_types.cpp2
-rw-r--r--eigen/test/inverse.cpp1
-rw-r--r--eigen/test/jacobi.cpp1
-rw-r--r--eigen/test/jacobisvd.cpp18
-rw-r--r--eigen/test/linearstructure.cpp1
-rw-r--r--eigen/test/lu.cpp8
-rw-r--r--eigen/test/mapped_matrix.cpp4
-rw-r--r--eigen/test/mapstaticmethods.cpp2
-rw-r--r--eigen/test/mapstride.cpp2
-rw-r--r--eigen/test/miscmatrices.cpp1
-rw-r--r--eigen/test/mixingtypes.cpp60
-rw-r--r--eigen/test/nomalloc.cpp1
-rw-r--r--eigen/test/permutationmatrices.cpp1
-rw-r--r--eigen/test/product_extra.cpp1
-rw-r--r--eigen/test/product_notemporary.cpp1
-rw-r--r--eigen/test/product_selfadjoint.cpp1
-rw-r--r--eigen/test/product_symm.cpp1
-rw-r--r--eigen/test/product_syrk.cpp1
-rw-r--r--eigen/test/product_trmv.cpp1
-rw-r--r--eigen/test/qr.cpp2
-rw-r--r--eigen/test/qr_colpivoting.cpp4
-rw-r--r--eigen/test/qr_fullpivoting.cpp2
-rw-r--r--eigen/test/qtvector.cpp2
-rw-r--r--eigen/test/real_qz.cpp1
-rw-r--r--eigen/test/redux.cpp2
-rw-r--r--eigen/test/ref.cpp2
-rw-r--r--eigen/test/schur_real.cpp2
-rw-r--r--eigen/test/selfadjoint.cpp1
-rw-r--r--eigen/test/sparse_basic.cpp3
-rw-r--r--eigen/test/stable_norm.cpp1
-rw-r--r--eigen/test/stddeque.cpp2
-rw-r--r--eigen/test/stdlist.cpp2
-rw-r--r--eigen/test/stdvector.cpp10
-rw-r--r--eigen/test/svd_common.h5
-rw-r--r--eigen/test/svd_fill.h1
-rw-r--r--eigen/test/triangular.cpp1
-rw-r--r--eigen/test/vectorwiseop.cpp2
-rw-r--r--eigen/test/visitor.cpp2
-rw-r--r--eigen/unsupported/Eigen/CXX11/Tensor2
-rw-r--r--eigen/unsupported/Eigen/CXX11/src/Tensor/README.md349
-rw-r--r--eigen/unsupported/Eigen/CXX11/src/Tensor/Tensor.h8
-rw-r--r--eigen/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h6
-rw-r--r--eigen/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h9
-rw-r--r--eigen/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h4
-rw-r--r--eigen/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h28
-rw-r--r--eigen/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h2
-rw-r--r--eigen/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h12
-rw-r--r--eigen/unsupported/Eigen/CXX11/src/Tensor/TensorSyclExprConstructor.h2
-rw-r--r--eigen/unsupported/Eigen/CXX11/src/Tensor/TensorSyclExtractAccessor.h2
-rw-r--r--eigen/unsupported/Eigen/CXX11/src/Tensor/TensorSyclExtractFunctors.h2
-rw-r--r--eigen/unsupported/Eigen/CXX11/src/Tensor/TensorSyclTuple.h5
-rw-r--r--eigen/unsupported/Eigen/CXX11/src/TensorSymmetry/util/TemplateGroupTheory.h7
-rw-r--r--eigen/unsupported/Eigen/CXX11/src/util/EmulateCXX11Meta.h2
-rw-r--r--eigen/unsupported/Eigen/FFT5
-rw-r--r--eigen/unsupported/Eigen/MatrixFunctions15
-rw-r--r--eigen/unsupported/Eigen/OpenGLSupport2
-rw-r--r--eigen/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h3
-rw-r--r--eigen/unsupported/Eigen/src/BVH/KdBVH.h1
-rw-r--r--eigen/unsupported/Eigen/src/IterativeSolvers/DGMRES.h3
-rw-r--r--eigen/unsupported/Eigen/src/IterativeSolvers/GMRES.h2
-rw-r--r--eigen/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h7
-rw-r--r--eigen/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h6
-rw-r--r--eigen/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h2
-rw-r--r--eigen/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h12
-rw-r--r--eigen/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h4
-rw-r--r--eigen/unsupported/Eigen/src/Polynomials/PolynomialUtils.h8
-rw-r--r--eigen/unsupported/Eigen/src/SparseExtra/BlockSparseMatrix.h2
-rw-r--r--eigen/unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h14
-rw-r--r--eigen/unsupported/Eigen/src/SparseExtra/MarketIO.h18
-rw-r--r--eigen/unsupported/Eigen/src/Splines/Spline.h5
-rw-r--r--eigen/unsupported/doc/examples/FFT.cpp6
-rw-r--r--eigen/unsupported/test/CMakeLists.txt5
-rw-r--r--eigen/unsupported/test/NonLinearOptimization.cpp2
-rw-r--r--eigen/unsupported/test/matrix_function.cpp4
-rw-r--r--eigen/unsupported/test/openglsupport.cpp4
-rw-r--r--eigen/unsupported/test/polynomialsolver.cpp2
-rw-r--r--eigen/unsupported/test/sparse_extra.cpp4
141 files changed, 722 insertions, 631 deletions
diff --git a/eigen/.hgtags b/eigen/.hgtags
index 2a2a704..2ab1533 100644
--- a/eigen/.hgtags
+++ b/eigen/.hgtags
@@ -32,3 +32,5 @@ f562a193118d4f40514e2f4a0ace6e974926ef06 3.3.1
da9b4e14c2550e0d11078a3c39e6d56eba9905df 3.3.2
67e894c6cd8f5f1f604b27d37ed47fdf012674ff 3.3.3
5a0156e40feb7c4136680b493c6e433d91a6f355 3.3.4
+b3f3d4950030e3fa2e8fde6b68405106ae5685e1 3.3.5
+b70bf4fad46787bce88d17d6f80d22f70ac882a1 3.3.6
diff --git a/eigen/CMakeLists.txt b/eigen/CMakeLists.txt
index 48a574f..2bfb6d5 100644
--- a/eigen/CMakeLists.txt
+++ b/eigen/CMakeLists.txt
@@ -67,6 +67,33 @@ include(GNUInstallDirs)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
+
+option(EIGEN_TEST_CXX11 "Enable testing with C++11 and C++11 features (e.g. Tensor module)." OFF)
+
+
+macro(ei_add_cxx_compiler_flag FLAG)
+ string(REGEX REPLACE "-" "" SFLAG1 ${FLAG})
+ string(REGEX REPLACE "\\+" "p" SFLAG ${SFLAG1})
+ check_cxx_compiler_flag(${FLAG} COMPILER_SUPPORT_${SFLAG})
+ if(COMPILER_SUPPORT_${SFLAG})
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}")
+ endif()
+endmacro(ei_add_cxx_compiler_flag)
+
+check_cxx_compiler_flag("-std=c++11" EIGEN_COMPILER_SUPPORT_CPP11)
+
+if(EIGEN_TEST_CXX11)
+ set(CMAKE_CXX_STANDARD 11)
+ set(CMAKE_CXX_EXTENSIONS OFF)
+ if(EIGEN_COMPILER_SUPPORT_CPP11)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+ endif()
+else()
+ #set(CMAKE_CXX_STANDARD 03)
+ #set(CMAKE_CXX_EXTENSIONS OFF)
+ ei_add_cxx_compiler_flag("-std=c++03")
+endif()
+
#############################################################################
# find how to link to the standard libraries #
#############################################################################
@@ -118,15 +145,6 @@ endif()
set(EIGEN_TEST_MAX_SIZE "320" CACHE STRING "Maximal matrix/vector size, default is 320")
-macro(ei_add_cxx_compiler_flag FLAG)
- string(REGEX REPLACE "-" "" SFLAG1 ${FLAG})
- string(REGEX REPLACE "\\+" "p" SFLAG ${SFLAG1})
- check_cxx_compiler_flag(${FLAG} COMPILER_SUPPORT_${SFLAG})
- if(COMPILER_SUPPORT_${SFLAG})
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}")
- endif()
-endmacro(ei_add_cxx_compiler_flag)
-
if(NOT MSVC)
# We assume that other compilers are partly compatible with GNUCC
@@ -362,8 +380,6 @@ if(EIGEN_TEST_NO_EXCEPTIONS)
message(STATUS "Disabling exceptions in tests/examples")
endif()
-option(EIGEN_TEST_CXX11 "Enable testing with C++11 and C++11 features (e.g. Tensor module)." OFF)
-
set(EIGEN_CUDA_COMPUTE_ARCH 30 CACHE STRING "The CUDA compute architecture level to target when compiling CUDA code")
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
diff --git a/eigen/CTestCustom.cmake.in b/eigen/CTestCustom.cmake.in
index 9fed9d3..89e487f 100644
--- a/eigen/CTestCustom.cmake.in
+++ b/eigen/CTestCustom.cmake.in
@@ -1,3 +1,4 @@
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS "2000")
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS "2000")
+list(APPEND CTEST_CUSTOM_ERROR_EXCEPTION @EIGEN_CTEST_ERROR_EXCEPTION@)
diff --git a/eigen/Eigen/Core b/eigen/Eigen/Core
index 4d4901e..b923b8c 100644
--- a/eigen/Eigen/Core
+++ b/eigen/Eigen/Core
@@ -53,9 +53,9 @@
#endif
#define EIGEN_DEVICE_FUNC __host__ __device__
- // We need math_functions.hpp to ensure that that EIGEN_USING_STD_MATH macro
+ // We need cuda_runtime.h to ensure that that EIGEN_USING_STD_MATH macro
// works properly on the device side
- #include <math_functions.hpp>
+ #include <cuda_runtime.h>
#else
#define EIGEN_DEVICE_FUNC
#endif
diff --git a/eigen/Eigen/src/Cholesky/LDLT.h b/eigen/Eigen/src/Cholesky/LDLT.h
index 0313a54..15ccf24 100644
--- a/eigen/Eigen/src/Cholesky/LDLT.h
+++ b/eigen/Eigen/src/Cholesky/LDLT.h
@@ -305,7 +305,8 @@ template<> struct ldlt_inplace<Lower>
if (size <= 1)
{
transpositions.setIdentity();
- if (numext::real(mat.coeff(0,0)) > static_cast<RealScalar>(0) ) sign = PositiveSemiDef;
+ if(size==0) sign = ZeroSign;
+ else if (numext::real(mat.coeff(0,0)) > static_cast<RealScalar>(0) ) sign = PositiveSemiDef;
else if (numext::real(mat.coeff(0,0)) < static_cast<RealScalar>(0)) sign = NegativeSemiDef;
else sign = ZeroSign;
return true;
diff --git a/eigen/Eigen/src/Core/Array.h b/eigen/Eigen/src/Core/Array.h
index e10020d..16770fc 100644
--- a/eigen/Eigen/src/Core/Array.h
+++ b/eigen/Eigen/src/Core/Array.h
@@ -153,8 +153,6 @@ class Array
: Base(std::move(other))
{
Base::_check_template_params();
- if (RowsAtCompileTime!=Dynamic && ColsAtCompileTime!=Dynamic)
- Base::_set_noalias(other);
}
EIGEN_DEVICE_FUNC
Array& operator=(Array&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable<Scalar>::value)
diff --git a/eigen/Eigen/src/Core/ConditionEstimator.h b/eigen/Eigen/src/Core/ConditionEstimator.h
index aa7efdc..51a2e5f 100644
--- a/eigen/Eigen/src/Core/ConditionEstimator.h
+++ b/eigen/Eigen/src/Core/ConditionEstimator.h
@@ -160,7 +160,7 @@ rcond_estimate_helper(typename Decomposition::RealScalar matrix_norm, const Deco
{
typedef typename Decomposition::RealScalar RealScalar;
eigen_assert(dec.rows() == dec.cols());
- if (dec.rows() == 0) return RealScalar(1);
+ if (dec.rows() == 0) return NumTraits<RealScalar>::infinity();
if (matrix_norm == RealScalar(0)) return RealScalar(0);
if (dec.rows() == 1) return RealScalar(1);
const RealScalar inverse_matrix_norm = rcond_invmatrix_L1_norm_estimate(dec);
diff --git a/eigen/Eigen/src/Core/MapBase.h b/eigen/Eigen/src/Core/MapBase.h
index 020f939..668922f 100644
--- a/eigen/Eigen/src/Core/MapBase.h
+++ b/eigen/Eigen/src/Core/MapBase.h
@@ -43,6 +43,7 @@ template<typename Derived> class MapBase<Derived, ReadOnlyAccessors>
enum {
RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,
ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
+ InnerStrideAtCompileTime = internal::traits<Derived>::InnerStrideAtCompileTime,
SizeAtCompileTime = Base::SizeAtCompileTime
};
@@ -187,8 +188,11 @@ template<typename Derived> class MapBase<Derived, ReadOnlyAccessors>
void checkSanity(typename internal::enable_if<(internal::traits<T>::Alignment>0),void*>::type = 0) const
{
#if EIGEN_MAX_ALIGN_BYTES>0
+ // innerStride() is not set yet when this function is called, so we optimistically assume the lowest plausible value:
+ const Index minInnerStride = InnerStrideAtCompileTime == Dynamic ? 1 : Index(InnerStrideAtCompileTime);
+ EIGEN_ONLY_USED_FOR_DEBUG(minInnerStride);
eigen_assert(( ((internal::UIntPtr(m_data) % internal::traits<Derived>::Alignment) == 0)
- || (cols() * rows() * innerStride() * sizeof(Scalar)) < internal::traits<Derived>::Alignment ) && "data is not aligned");
+ || (cols() * rows() * minInnerStride * sizeof(Scalar)) < internal::traits<Derived>::Alignment ) && "data is not aligned");
#endif
}
diff --git a/eigen/Eigen/src/Core/MathFunctions.h b/eigen/Eigen/src/Core/MathFunctions.h
index 6eb974d..b249ce0 100644
--- a/eigen/Eigen/src/Core/MathFunctions.h
+++ b/eigen/Eigen/src/Core/MathFunctions.h
@@ -616,21 +616,28 @@ template<typename Scalar>
struct random_default_impl<Scalar, false, true>
{
static inline Scalar run(const Scalar& x, const Scalar& y)
- {
- typedef typename conditional<NumTraits<Scalar>::IsSigned,std::ptrdiff_t,std::size_t>::type ScalarX;
- if(y<x)
+ {
+ if (y <= x)
return x;
- // the following difference might overflow on a 32 bits system,
- // but since y>=x the result converted to an unsigned long is still correct.
- std::size_t range = ScalarX(y)-ScalarX(x);
- std::size_t offset = 0;
- // rejection sampling
- std::size_t divisor = 1;
- std::size_t multiplier = 1;
- if(range<RAND_MAX) divisor = (std::size_t(RAND_MAX)+1)/(range+1);
- else multiplier = 1 + range/(std::size_t(RAND_MAX)+1);
+ // ScalarU is the unsigned counterpart of Scalar, possibly Scalar itself.
+ typedef typename make_unsigned<Scalar>::type ScalarU;
+ // ScalarX is the widest of ScalarU and unsigned int.
+ // We'll deal only with ScalarX and unsigned int below thus avoiding signed
+ // types and arithmetic and signed overflows (which are undefined behavior).
+ typedef typename conditional<(ScalarU(-1) > unsigned(-1)), ScalarU, unsigned>::type ScalarX;
+ // The following difference doesn't overflow, provided our integer types are two's
+ // complement and have the same number of padding bits in signed and unsigned variants.
+ // This is the case in most modern implementations of C++.
+ ScalarX range = ScalarX(y) - ScalarX(x);
+ ScalarX offset = 0;
+ ScalarX divisor = 1;
+ ScalarX multiplier = 1;
+ const unsigned rand_max = RAND_MAX;
+ if (range <= rand_max) divisor = (rand_max + 1) / (range + 1);
+ else multiplier = 1 + range / (rand_max + 1);
+ // Rejection sampling.
do {
- offset = (std::size_t(std::rand()) * multiplier) / divisor;
+ offset = (unsigned(std::rand()) * multiplier) / divisor;
} while (offset > range);
return Scalar(ScalarX(x) + offset);
}
@@ -1006,7 +1013,8 @@ inline int log2(int x)
/** \returns the square root of \a x.
*
- * It is essentially equivalent to \code using std::sqrt; return sqrt(x); \endcode,
+ * It is essentially equivalent to
+ * \code using std::sqrt; return sqrt(x); \endcode
* but slightly faster for float/double and some compilers (e.g., gcc), thanks to
* specializations when SSE is enabled.
*
diff --git a/eigen/Eigen/src/Core/Matrix.h b/eigen/Eigen/src/Core/Matrix.h
index 90c336d..7f4a7af 100644
--- a/eigen/Eigen/src/Core/Matrix.h
+++ b/eigen/Eigen/src/Core/Matrix.h
@@ -274,8 +274,6 @@ class Matrix
: Base(std::move(other))
{
Base::_check_template_params();
- if (RowsAtCompileTime!=Dynamic && ColsAtCompileTime!=Dynamic)
- Base::_set_noalias(other);
}
EIGEN_DEVICE_FUNC
Matrix& operator=(Matrix&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable<Scalar>::value)
diff --git a/eigen/Eigen/src/Core/MatrixBase.h b/eigen/Eigen/src/Core/MatrixBase.h
index 05db488..e6c3590 100644
--- a/eigen/Eigen/src/Core/MatrixBase.h
+++ b/eigen/Eigen/src/Core/MatrixBase.h
@@ -444,16 +444,24 @@ template<typename Derived> class MatrixBase
///////// MatrixFunctions module /////////
typedef typename internal::stem_function<Scalar>::type StemFunction;
- const MatrixExponentialReturnValue<Derived> exp() const;
+#define EIGEN_MATRIX_FUNCTION(ReturnType, Name, Description) \
+ /** \returns an expression of the matrix Description of \c *this. \brief This function requires the <a href="unsupported/group__MatrixFunctions__Module.html"> unsupported MatrixFunctions module</a>. To compute the coefficient-wise Description use ArrayBase::##Name . */ \
+ const ReturnType<Derived> Name() const;
+#define EIGEN_MATRIX_FUNCTION_1(ReturnType, Name, Description, Argument) \
+ /** \returns an expression of the matrix Description of \c *this. \brief This function requires the <a href="unsupported/group__MatrixFunctions__Module.html"> unsupported MatrixFunctions module</a>. To compute the coefficient-wise Description use ArrayBase::##Name . */ \
+ const ReturnType<Derived> Name(Argument) const;
+
+ EIGEN_MATRIX_FUNCTION(MatrixExponentialReturnValue, exp, exponential)
+ /** \brief Helper function for the <a href="unsupported/group__MatrixFunctions__Module.html"> unsupported MatrixFunctions module</a>.*/
const MatrixFunctionReturnValue<Derived> matrixFunction(StemFunction f) const;
- const MatrixFunctionReturnValue<Derived> cosh() const;
- const MatrixFunctionReturnValue<Derived> sinh() const;
- const MatrixFunctionReturnValue<Derived> cos() const;
- const MatrixFunctionReturnValue<Derived> sin() const;
- const MatrixSquareRootReturnValue<Derived> sqrt() const;
- const MatrixLogarithmReturnValue<Derived> log() const;
- const MatrixPowerReturnValue<Derived> pow(const RealScalar& p) const;
- const MatrixComplexPowerReturnValue<Derived> pow(const std::complex<RealScalar>& p) const;
+ EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, cosh, hyperbolic cosine)
+ EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, sinh, hyperbolic sine)
+ EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, cos, cosine)
+ EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, sin, sine)
+ EIGEN_MATRIX_FUNCTION(MatrixSquareRootReturnValue, sqrt, square root)
+ EIGEN_MATRIX_FUNCTION(MatrixLogarithmReturnValue, log, logarithm)
+ EIGEN_MATRIX_FUNCTION_1(MatrixPowerReturnValue, pow, power to \c p, const RealScalar& p)
+ EIGEN_MATRIX_FUNCTION_1(MatrixComplexPowerReturnValue, pow, power to \c p, const std::complex<RealScalar>& p)
protected:
EIGEN_DEVICE_FUNC MatrixBase() : Base() {}
diff --git a/eigen/Eigen/src/Core/SolveTriangular.h b/eigen/Eigen/src/Core/SolveTriangular.h
index 049890b..4652e2e 100644
--- a/eigen/Eigen/src/Core/SolveTriangular.h
+++ b/eigen/Eigen/src/Core/SolveTriangular.h
@@ -169,6 +169,9 @@ void TriangularViewImpl<MatrixType,Mode,Dense>::solveInPlace(const MatrixBase<Ot
OtherDerived& other = _other.const_cast_derived();
eigen_assert( derived().cols() == derived().rows() && ((Side==OnTheLeft && derived().cols() == other.rows()) || (Side==OnTheRight && derived().cols() == other.cols())) );
eigen_assert((!(Mode & ZeroDiag)) && bool(Mode & (Upper|Lower)));
+ // If solving for a 0x0 matrix, nothing to do, simply return.
+ if (derived().cols() == 0)
+ return;
enum { copy = (internal::traits<OtherDerived>::Flags & RowMajorBit) && OtherDerived::IsVectorAtCompileTime && OtherDerived::SizeAtCompileTime!=1};
typedef typename internal::conditional<copy,
diff --git a/eigen/Eigen/src/Core/arch/AVX/PacketMath.h b/eigen/Eigen/src/Core/arch/AVX/PacketMath.h
index 61c3dfc..923a124 100644
--- a/eigen/Eigen/src/Core/arch/AVX/PacketMath.h
+++ b/eigen/Eigen/src/Core/arch/AVX/PacketMath.h
@@ -159,11 +159,12 @@ template<> EIGEN_STRONG_INLINE Packet8i pdiv<Packet8i>(const Packet8i& /*a*/, co
#ifdef __FMA__
template<> EIGEN_STRONG_INLINE Packet8f pmadd(const Packet8f& a, const Packet8f& b, const Packet8f& c) {
-#if ( EIGEN_COMP_GNUC_STRICT || (EIGEN_COMP_CLANG && (EIGEN_COMP_CLANG<308)) )
- // clang stupidly generates a vfmadd213ps instruction plus some vmovaps on registers,
- // and gcc stupidly generates a vfmadd132ps instruction,
- // so let's enforce it to generate a vfmadd231ps instruction since the most common use case is to accumulate
- // the result of the product.
+#if ( (EIGEN_COMP_GNUC_STRICT && EIGEN_COMP_GNUC<80) || (EIGEN_COMP_CLANG) )
+ // Clang stupidly generates a vfmadd213ps instruction plus some vmovaps on registers,
+ // and even register spilling with clang>=6.0 (bug 1637).
+ // Gcc stupidly generates a vfmadd132ps instruction.
+ // So let's enforce it to generate a vfmadd231ps instruction since the most common use
+ // case is to accumulate the result of the product.
Packet8f res = c;
__asm__("vfmadd231ps %[a], %[b], %[c]" : [c] "+x" (res) : [a] "x" (a), [b] "x" (b));
return res;
@@ -172,7 +173,7 @@ template<> EIGEN_STRONG_INLINE Packet8f pmadd(const Packet8f& a, const Packet8f&
#endif
}
template<> EIGEN_STRONG_INLINE Packet4d pmadd(const Packet4d& a, const Packet4d& b, const Packet4d& c) {
-#if ( EIGEN_COMP_GNUC_STRICT || (EIGEN_COMP_CLANG && (EIGEN_COMP_CLANG<308)) )
+#if ( (EIGEN_COMP_GNUC_STRICT && EIGEN_COMP_GNUC<80) || (EIGEN_COMP_CLANG) )
// see above
Packet4d res = c;
__asm__("vfmadd231pd %[a], %[b], %[c]" : [c] "+x" (res) : [a] "x" (a), [b] "x" (b));
diff --git a/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h b/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h
index 8970524..5adddc7 100644
--- a/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h
+++ b/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h
@@ -648,13 +648,13 @@ template<> EIGEN_STRONG_INLINE Packet8d preverse(const Packet8d& a)
template<> EIGEN_STRONG_INLINE Packet16f pabs(const Packet16f& a)
{
// _mm512_abs_ps intrinsic not found, so hack around it
- return (__m512)_mm512_and_si512((__m512i)a, _mm512_set1_epi32(0x7fffffff));
+ return _mm512_castsi512_ps(_mm512_and_si512(_mm512_castps_si512(a), _mm512_set1_epi32(0x7fffffff)));
}
template <>
EIGEN_STRONG_INLINE Packet8d pabs(const Packet8d& a) {
// _mm512_abs_ps intrinsic not found, so hack around it
- return (__m512d)_mm512_and_si512((__m512i)a,
- _mm512_set1_epi64(0x7fffffffffffffff));
+ return _mm512_castsi512_pd(_mm512_and_si512(_mm512_castpd_si512(a),
+ _mm512_set1_epi64(0x7fffffffffffffff)));
}
#ifdef EIGEN_VECTORIZE_AVX512DQ
diff --git a/eigen/Eigen/src/Core/arch/CUDA/Half.h b/eigen/Eigen/src/Core/arch/CUDA/Half.h
index 02ac0c2..755e620 100644
--- a/eigen/Eigen/src/Core/arch/CUDA/Half.h
+++ b/eigen/Eigen/src/Core/arch/CUDA/Half.h
@@ -29,7 +29,7 @@
// type Eigen::half (inheriting from CUDA's __half struct) with
// operator overloads such that it behaves basically as an arithmetic
// type. It will be quite slow on CPUs (so it is recommended to stay
-// in fp32 for CPUs, except for simple parameter conversions, I/O
+// in float32_bits for CPUs, except for simple parameter conversions, I/O
// to disk and the likes), but fast on GPUs.
@@ -50,38 +50,45 @@ struct half;
namespace half_impl {
#if !defined(EIGEN_HAS_CUDA_FP16)
-
-// Make our own __half definition that is similar to CUDA's.
-struct __half {
- EIGEN_DEVICE_FUNC __half() {}
- explicit EIGEN_DEVICE_FUNC __half(unsigned short raw) : x(raw) {}
+// Make our own __half_raw definition that is similar to CUDA's.
+struct __half_raw {
+ EIGEN_DEVICE_FUNC __half_raw() : x(0) {}
+ explicit EIGEN_DEVICE_FUNC __half_raw(unsigned short raw) : x(raw) {}
unsigned short x;
};
-
+#elif defined(EIGEN_CUDACC_VER) && EIGEN_CUDACC_VER < 90000
+// In CUDA < 9.0, __half is the equivalent of CUDA 9's __half_raw
+typedef __half __half_raw;
#endif
-EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC __half raw_uint16_to_half(unsigned short x);
-EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC __half float_to_half_rtne(float ff);
-EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC float half_to_float(__half h);
+EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC __half_raw raw_uint16_to_half(unsigned short x);
+EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC __half_raw float_to_half_rtne(float ff);
+EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC float half_to_float(__half_raw h);
-struct half_base : public __half {
+struct half_base : public __half_raw {
EIGEN_DEVICE_FUNC half_base() {}
- EIGEN_DEVICE_FUNC half_base(const half_base& h) : __half(h) {}
- EIGEN_DEVICE_FUNC half_base(const __half& h) : __half(h) {}
+ EIGEN_DEVICE_FUNC half_base(const half_base& h) : __half_raw(h) {}
+ EIGEN_DEVICE_FUNC half_base(const __half_raw& h) : __half_raw(h) {}
+#if defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDACC_VER) && EIGEN_CUDACC_VER >= 90000
+ EIGEN_DEVICE_FUNC half_base(const __half& h) : __half_raw(*(__half_raw*)&h) {}
+#endif
};
} // namespace half_impl
// Class definition.
struct half : public half_impl::half_base {
- #if !defined(EIGEN_HAS_CUDA_FP16)
- typedef half_impl::__half __half;
+ #if !defined(EIGEN_HAS_CUDA_FP16) || (defined(EIGEN_CUDACC_VER) && EIGEN_CUDACC_VER < 90000)
+ typedef half_impl::__half_raw __half_raw;
#endif
EIGEN_DEVICE_FUNC half() {}
- EIGEN_DEVICE_FUNC half(const __half& h) : half_impl::half_base(h) {}
+ EIGEN_DEVICE_FUNC half(const __half_raw& h) : half_impl::half_base(h) {}
EIGEN_DEVICE_FUNC half(const half& h) : half_impl::half_base(h) {}
+#if defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDACC_VER) && EIGEN_CUDACC_VER >= 90000
+ EIGEN_DEVICE_FUNC half(const __half& h) : half_impl::half_base(h) {}
+#endif
explicit EIGEN_DEVICE_FUNC half(bool b)
: half_impl::half_base(half_impl::raw_uint16_to_half(b ? 0x3c00 : 0)) {}
@@ -138,12 +145,66 @@ struct half : public half_impl::half_base {
}
};
+} // end namespace Eigen
+
+namespace std {
+template<>
+struct numeric_limits<Eigen::half> {
+ static const bool is_specialized = true;
+ static const bool is_signed = true;
+ static const bool is_integer = false;
+ static const bool is_exact = false;
+ static const bool has_infinity = true;
+ static const bool has_quiet_NaN = true;
+ static const bool has_signaling_NaN = true;
+ static const float_denorm_style has_denorm = denorm_present;
+ static const bool has_denorm_loss = false;
+ static const std::float_round_style round_style = std::round_to_nearest;
+ static const bool is_iec559 = false;
+ static const bool is_bounded = false;
+ static const bool is_modulo = false;
+ static const int digits = 11;
+ static const int digits10 = 3; // according to http://half.sourceforge.net/structstd_1_1numeric__limits_3_01half__float_1_1half_01_4.html
+ static const int max_digits10 = 5; // according to http://half.sourceforge.net/structstd_1_1numeric__limits_3_01half__float_1_1half_01_4.html
+ static const int radix = 2;
+ static const int min_exponent = -13;
+ static const int min_exponent10 = -4;
+ static const int max_exponent = 16;
+ static const int max_exponent10 = 4;
+ static const bool traps = true;
+ static const bool tinyness_before = false;
+
+ static Eigen::half (min)() { return Eigen::half_impl::raw_uint16_to_half(0x400); }
+ static Eigen::half lowest() { return Eigen::half_impl::raw_uint16_to_half(0xfbff); }
+ static Eigen::half (max)() { return Eigen::half_impl::raw_uint16_to_half(0x7bff); }
+ static Eigen::half epsilon() { return Eigen::half_impl::raw_uint16_to_half(0x0800); }
+ static Eigen::half round_error() { return Eigen::half(0.5); }
+ static Eigen::half infinity() { return Eigen::half_impl::raw_uint16_to_half(0x7c00); }
+ static Eigen::half quiet_NaN() { return Eigen::half_impl::raw_uint16_to_half(0x7e00); }
+ static Eigen::half signaling_NaN() { return Eigen::half_impl::raw_uint16_to_half(0x7e00); }
+ static Eigen::half denorm_min() { return Eigen::half_impl::raw_uint16_to_half(0x1); }
+};
+
+// If std::numeric_limits<T> is specialized, should also specialize
+// std::numeric_limits<const T>, std::numeric_limits<volatile T>, and
+// std::numeric_limits<const volatile T>
+// https://stackoverflow.com/a/16519653/
+template<>
+struct numeric_limits<const Eigen::half> : numeric_limits<Eigen::half> {};
+template<>
+struct numeric_limits<volatile Eigen::half> : numeric_limits<Eigen::half> {};
+template<>
+struct numeric_limits<const volatile Eigen::half> : numeric_limits<Eigen::half> {};
+} // end namespace std
+
+namespace Eigen {
+
namespace half_impl {
-#if defined(EIGEN_HAS_CUDA_FP16) && defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 530
+#if defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 530
// Intrinsics for native fp16 support. Note that on current hardware,
-// these are no faster than fp32 arithmetic (you need to use the half2
+// these are no faster than float32_bits arithmetic (you need to use the half2
// versions to get the ALU speed increased), but you do save the
// conversion steps back and forth.
@@ -202,7 +263,7 @@ EIGEN_STRONG_INLINE __device__ bool operator >= (const half& a, const half& b) {
#else // Emulate support for half floats
// Definitions for CPUs and older CUDA, mostly working through conversion
-// to/from fp32.
+// to/from float32_bits.
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half operator + (const half& a, const half& b) {
return half(float(a) + float(b));
@@ -269,34 +330,35 @@ EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half operator / (const half& a, Index b) {
// these in hardware. If we need more performance on older/other CPUs, they are
// also possible to vectorize directly.
-EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC __half raw_uint16_to_half(unsigned short x) {
- __half h;
+EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC __half_raw raw_uint16_to_half(unsigned short x) {
+ __half_raw h;
h.x = x;
return h;
}
-union FP32 {
+union float32_bits {
unsigned int u;
float f;
};
-EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC __half float_to_half_rtne(float ff) {
-#if defined(EIGEN_HAS_CUDA_FP16) && defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 300
- return __float2half(ff);
+EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC __half_raw float_to_half_rtne(float ff) {
+#if defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 300
+ __half tmp_ff = __float2half(ff);
+ return *(__half_raw*)&tmp_ff;
#elif defined(EIGEN_HAS_FP16_C)
- __half h;
+ __half_raw h;
h.x = _cvtss_sh(ff, 0);
return h;
#else
- FP32 f; f.f = ff;
+ float32_bits f; f.f = ff;
- const FP32 f32infty = { 255 << 23 };
- const FP32 f16max = { (127 + 16) << 23 };
- const FP32 denorm_magic = { ((127 - 15) + (23 - 10) + 1) << 23 };
+ const float32_bits f32infty = { 255 << 23 };
+ const float32_bits f16max = { (127 + 16) << 23 };
+ const float32_bits denorm_magic = { ((127 - 15) + (23 - 10) + 1) << 23 };
unsigned int sign_mask = 0x80000000u;
- __half o;
+ __half_raw o;
o.x = static_cast<unsigned short>(0x0u);
unsigned int sign = f.u & sign_mask;
@@ -335,17 +397,17 @@ EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC __half float_to_half_rtne(float ff) {
#endif
}
-EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC float half_to_float(__half h) {
-#if defined(EIGEN_HAS_CUDA_FP16) && defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 300
+EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC float half_to_float(__half_raw h) {
+#if defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 300
return __half2float(h);
#elif defined(EIGEN_HAS_FP16_C)
return _cvtsh_ss(h.x);
#else
- const FP32 magic = { 113 << 23 };
+ const float32_bits magic = { 113 << 23 };
const unsigned int shifted_exp = 0x7c00 << 13; // exponent mask after shift
- FP32 o;
+ float32_bits o;
o.u = (h.x & 0x7fff) << 13; // exponent/mantissa bits
unsigned int exp = shifted_exp & o.u; // just the exponent
@@ -370,7 +432,7 @@ EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool (isinf)(const half& a) {
return (a.x & 0x7fff) == 0x7c00;
}
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool (isnan)(const half& a) {
-#if defined(EIGEN_HAS_CUDA_FP16) && defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 530
+#if defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 530
return __hisnan(a);
#else
return (a.x & 0x7fff) > 0x7c00;
@@ -443,7 +505,7 @@ EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half ceil(const half& a) {
}
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half (min)(const half& a, const half& b) {
-#if defined(EIGEN_HAS_CUDA_FP16) && defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 530
+#if defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 530
return __hlt(b, a) ? b : a;
#else
const float f1 = static_cast<float>(a);
@@ -452,7 +514,7 @@ EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half (min)(const half& a, const half& b) {
#endif
}
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half (max)(const half& a, const half& b) {
-#if defined(EIGEN_HAS_CUDA_FP16) && defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 530
+#if defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 530
return __hlt(a, b) ? b : a;
#else
const float f1 = static_cast<float>(a);
@@ -490,49 +552,6 @@ template<> struct is_arithmetic<half> { enum { value = true }; };
} // end namespace internal
-} // end namespace Eigen
-
-namespace std {
-template<>
-struct numeric_limits<Eigen::half> {
- static const bool is_specialized = true;
- static const bool is_signed = true;
- static const bool is_integer = false;
- static const bool is_exact = false;
- static const bool has_infinity = true;
- static const bool has_quiet_NaN = true;
- static const bool has_signaling_NaN = true;
- static const float_denorm_style has_denorm = denorm_present;
- static const bool has_denorm_loss = false;
- static const std::float_round_style round_style = std::round_to_nearest;
- static const bool is_iec559 = false;
- static const bool is_bounded = false;
- static const bool is_modulo = false;
- static const int digits = 11;
- static const int digits10 = 3; // according to http://half.sourceforge.net/structstd_1_1numeric__limits_3_01half__float_1_1half_01_4.html
- static const int max_digits10 = 5; // according to http://half.sourceforge.net/structstd_1_1numeric__limits_3_01half__float_1_1half_01_4.html
- static const int radix = 2;
- static const int min_exponent = -13;
- static const int min_exponent10 = -4;
- static const int max_exponent = 16;
- static const int max_exponent10 = 4;
- static const bool traps = true;
- static const bool tinyness_before = false;
-
- static Eigen::half (min)() { return Eigen::half_impl::raw_uint16_to_half(0x400); }
- static Eigen::half lowest() { return Eigen::half_impl::raw_uint16_to_half(0xfbff); }
- static Eigen::half (max)() { return Eigen::half_impl::raw_uint16_to_half(0x7bff); }
- static Eigen::half epsilon() { return Eigen::half_impl::raw_uint16_to_half(0x0800); }
- static Eigen::half round_error() { return Eigen::half(0.5); }
- static Eigen::half infinity() { return Eigen::half_impl::raw_uint16_to_half(0x7c00); }
- static Eigen::half quiet_NaN() { return Eigen::half_impl::raw_uint16_to_half(0x7e00); }
- static Eigen::half signaling_NaN() { return Eigen::half_impl::raw_uint16_to_half(0x7e00); }
- static Eigen::half denorm_min() { return Eigen::half_impl::raw_uint16_to_half(0x1); }
-};
-}
-
-namespace Eigen {
-
template<> struct NumTraits<Eigen::half>
: GenericNumTraits<Eigen::half>
{
@@ -607,14 +626,18 @@ struct hash<Eigen::half> {
// Add the missing shfl_xor intrinsic
-#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 300
+#if defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 300
__device__ EIGEN_STRONG_INLINE Eigen::half __shfl_xor(Eigen::half var, int laneMask, int width=warpSize) {
+ #if EIGEN_CUDACC_VER < 90000
return static_cast<Eigen::half>(__shfl_xor(static_cast<float>(var), laneMask, width));
+ #else
+ return static_cast<Eigen::half>(__shfl_xor_sync(0xFFFFFFFF, static_cast<float>(var), laneMask, width));
+ #endif
}
#endif
-// ldg() has an overload for __half, but we also need one for Eigen::half.
-#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 350
+// ldg() has an overload for __half_raw, but we also need one for Eigen::half.
+#if defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 350
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half __ldg(const Eigen::half* ptr) {
return Eigen::half_impl::raw_uint16_to_half(
__ldg(reinterpret_cast<const unsigned short*>(ptr)));
@@ -622,7 +645,7 @@ EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half __ldg(const Eigen::half* ptr)
#endif
-#if defined(__CUDA_ARCH__)
+#if defined(EIGEN_CUDA_ARCH)
namespace Eigen {
namespace numext {
diff --git a/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h b/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h
index 943e0b0..c66d384 100644
--- a/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h
+++ b/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h
@@ -99,7 +99,8 @@ template<> __device__ EIGEN_STRONG_INLINE Eigen::half pfirst<half2>(const half2&
template<> __device__ EIGEN_STRONG_INLINE half2 pabs<half2>(const half2& a) {
half2 result;
- result.x = a.x & 0x7FFF7FFF;
+ unsigned temp = *(reinterpret_cast<const unsigned*>(&(a)));
+ *(reinterpret_cast<unsigned*>(&(result))) = temp & 0x7FFF7FFF;
return result;
}
diff --git a/eigen/Eigen/src/Core/arch/SSE/PacketMath.h b/eigen/Eigen/src/Core/arch/SSE/PacketMath.h
index 5e652cc..60e2517 100644
--- a/eigen/Eigen/src/Core/arch/SSE/PacketMath.h
+++ b/eigen/Eigen/src/Core/arch/SSE/PacketMath.h
@@ -28,7 +28,7 @@ namespace internal {
#endif
#endif
-#if (defined EIGEN_VECTORIZE_AVX) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_MINGW) && (__GXX_ABI_VERSION < 1004)
+#if ((defined EIGEN_VECTORIZE_AVX) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_MINGW) && (__GXX_ABI_VERSION < 1004)) || EIGEN_OS_QNX
// With GCC's default ABI version, a __m128 or __m256 are the same types and therefore we cannot
// have overloads for both types without linking error.
// One solution is to increase ABI version using -fabi-version=4 (or greater).
diff --git a/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h
index 45230bc..e3980f6 100644
--- a/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h
+++ b/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h
@@ -1197,10 +1197,16 @@ void gebp_kernel<LhsScalar,RhsScalar,Index,DataMapper,mr,nr,ConjugateLhs,Conjuga
EIGEN_ASM_COMMENT("begin gebp micro kernel 2pX4");
RhsPacket B_0, B1, B2, B3, T0;
- #define EIGEN_GEBGP_ONESTEP(K) \
+ // NOTE: the begin/end asm comments below work around bug 935!
+ // but they are not enough for gcc>=6 without FMA (bug 1637)
+ #if EIGEN_GNUC_AT_LEAST(6,0) && defined(EIGEN_VECTORIZE_SSE)
+ #define EIGEN_GEBP_2PX4_SPILLING_WORKAROUND __asm__ ("" : [a0] "+x,m" (A0),[a1] "+x,m" (A1));
+ #else
+ #define EIGEN_GEBP_2PX4_SPILLING_WORKAROUND
+ #endif
+ #define EIGEN_GEBGP_ONESTEP(K) \
do { \
EIGEN_ASM_COMMENT("begin step of gebp micro kernel 2pX4"); \
- EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \
traits.loadLhs(&blA[(0+2*K)*LhsProgress], A0); \
traits.loadLhs(&blA[(1+2*K)*LhsProgress], A1); \
traits.broadcastRhs(&blB[(0+4*K)*RhsProgress], B_0, B1, B2, B3); \
@@ -1212,6 +1218,7 @@ void gebp_kernel<LhsScalar,RhsScalar,Index,DataMapper,mr,nr,ConjugateLhs,Conjuga
traits.madd(A1, B2, C6, B2); \
traits.madd(A0, B3, C3, T0); \
traits.madd(A1, B3, C7, B3); \
+ EIGEN_GEBP_2PX4_SPILLING_WORKAROUND \
EIGEN_ASM_COMMENT("end step of gebp micro kernel 2pX4"); \
} while(false)
@@ -1526,10 +1533,10 @@ void gebp_kernel<LhsScalar,RhsScalar,Index,DataMapper,mr,nr,ConjugateLhs,Conjuga
// The following piece of code wont work for 512 bit registers
// Moreover, if LhsProgress==8 it assumes that there is a half packet of the same size
// as nr (which is currently 4) for the return type.
- typedef typename unpacket_traits<SResPacket>::half SResPacketHalf;
+ const int SResPacketHalfSize = unpacket_traits<typename unpacket_traits<SResPacket>::half>::size;
if ((SwappedTraits::LhsProgress % 4) == 0 &&
(SwappedTraits::LhsProgress <= 8) &&
- (SwappedTraits::LhsProgress!=8 || unpacket_traits<SResPacketHalf>::size==nr))
+ (SwappedTraits::LhsProgress!=8 || SResPacketHalfSize==nr))
{
SAccPacket C0, C1, C2, C3;
straits.initAcc(C0);
diff --git a/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h b/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h
index 9176a13..f6f9ebe 100644
--- a/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h
+++ b/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h
@@ -52,7 +52,7 @@ struct general_matrix_matrix_triangular_product<Index,Scalar,LhsStorageOrder,Con
static EIGEN_STRONG_INLINE void run(Index size, Index depth,const Scalar* lhs, Index lhsStride, \
const Scalar* rhs, Index rhsStride, Scalar* res, Index resStride, Scalar alpha, level3_blocking<Scalar, Scalar>& blocking) \
{ \
- if ( lhs==rhs && ((UpLo&(Lower|Upper)==UpLo)) ) { \
+ if ( lhs==rhs && ((UpLo&(Lower|Upper))==UpLo) ) { \
general_matrix_matrix_rankupdate<Index,Scalar,LhsStorageOrder,ConjugateLhs,ColMajor,UpLo> \
::run(size,depth,lhs,lhsStride,rhs,rhsStride,res,resStride,alpha,blocking); \
} else { \
diff --git a/eigen/Eigen/src/Core/util/DisableStupidWarnings.h b/eigen/Eigen/src/Core/util/DisableStupidWarnings.h
index 7559e12..351bd6c 100644
--- a/eigen/Eigen/src/Core/util/DisableStupidWarnings.h
+++ b/eigen/Eigen/src/Core/util/DisableStupidWarnings.h
@@ -43,12 +43,20 @@
#endif
#pragma clang diagnostic ignored "-Wconstant-logical-operand"
-#elif defined __GNUC__ && __GNUC__>=6
+#elif defined __GNUC__
- #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
+ #if (!defined(EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS)) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#pragma GCC diagnostic push
#endif
- #pragma GCC diagnostic ignored "-Wignored-attributes"
+ // g++ warns about local variables shadowing member functions, which is too strict
+ #pragma GCC diagnostic ignored "-Wshadow"
+ #if __GNUC__ == 4 && __GNUC_MINOR__ < 8
+ // Until g++-4.7 there are warnings when comparing unsigned int vs 0, even in templated functions:
+ #pragma GCC diagnostic ignored "-Wtype-limits"
+ #endif
+ #if __GNUC__>=6
+ #pragma GCC diagnostic ignored "-Wignored-attributes"
+ #endif
#endif
diff --git a/eigen/Eigen/src/Core/util/Macros.h b/eigen/Eigen/src/Core/util/Macros.h
index 02d21d2..aa054a0 100644
--- a/eigen/Eigen/src/Core/util/Macros.h
+++ b/eigen/Eigen/src/Core/util/Macros.h
@@ -13,7 +13,7 @@
#define EIGEN_WORLD_VERSION 3
#define EIGEN_MAJOR_VERSION 3
-#define EIGEN_MINOR_VERSION 5
+#define EIGEN_MINOR_VERSION 7
#define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \
(EIGEN_MAJOR_VERSION>y || (EIGEN_MAJOR_VERSION>=y && \
diff --git a/eigen/Eigen/src/Core/util/Memory.h b/eigen/Eigen/src/Core/util/Memory.h
index 66cdbd8..291383c 100644
--- a/eigen/Eigen/src/Core/util/Memory.h
+++ b/eigen/Eigen/src/Core/util/Memory.h
@@ -747,7 +747,15 @@ public:
pointer allocate(size_type num, const void* /*hint*/ = 0)
{
internal::check_size_for_overflow<T>(num);
- return static_cast<pointer>( internal::aligned_malloc(num * sizeof(T)) );
+ size_type size = num * sizeof(T);
+#if EIGEN_COMP_GNUC_STRICT && EIGEN_GNUC_AT_LEAST(7,0)
+ // workaround gcc bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87544
+ // It triggered eigen/Eigen/src/Core/util/Memory.h:189:12: warning: argument 1 value '18446744073709551612' exceeds maximum object size 9223372036854775807
+ if(size>=std::size_t((std::numeric_limits<std::ptrdiff_t>::max)()))
+ return 0;
+ else
+#endif
+ return static_cast<pointer>( internal::aligned_malloc(size) );
}
void deallocate(pointer p, size_type /*num*/)
diff --git a/eigen/Eigen/src/Core/util/Meta.h b/eigen/Eigen/src/Core/util/Meta.h
index 1d73f05..d31e954 100644
--- a/eigen/Eigen/src/Core/util/Meta.h
+++ b/eigen/Eigen/src/Core/util/Meta.h
@@ -109,6 +109,28 @@ template<> struct is_integral<unsigned int> { enum { value = true }; };
template<> struct is_integral<signed long> { enum { value = true }; };
template<> struct is_integral<unsigned long> { enum { value = true }; };
+#if EIGEN_HAS_CXX11
+using std::make_unsigned;
+#else
+// TODO: Possibly improve this implementation of make_unsigned.
+// It is currently used only by
+// template<typename Scalar> struct random_default_impl<Scalar, false, true>.
+template<typename> struct make_unsigned;
+template<> struct make_unsigned<char> { typedef unsigned char type; };
+template<> struct make_unsigned<signed char> { typedef unsigned char type; };
+template<> struct make_unsigned<unsigned char> { typedef unsigned char type; };
+template<> struct make_unsigned<signed short> { typedef unsigned short type; };
+template<> struct make_unsigned<unsigned short> { typedef unsigned short type; };
+template<> struct make_unsigned<signed int> { typedef unsigned int type; };
+template<> struct make_unsigned<unsigned int> { typedef unsigned int type; };
+template<> struct make_unsigned<signed long> { typedef unsigned long type; };
+template<> struct make_unsigned<unsigned long> { typedef unsigned long type; };
+#if EIGEN_COMP_MSVC
+template<> struct make_unsigned<signed __int64> { typedef unsigned __int64 type; };
+template<> struct make_unsigned<unsigned __int64> { typedef unsigned __int64 type; };
+#endif
+#endif
+
template <typename T> struct add_const { typedef const T type; };
template <typename T> struct add_const<T&> { typedef T& type; };
diff --git a/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h b/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h
index 86b60f5..ecc82b7 100644
--- a/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h
+++ b/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h
@@ -8,7 +8,7 @@
#pragma warning pop
#elif defined __clang__
#pragma clang diagnostic pop
- #elif defined __GNUC__ && __GNUC__>=6
+ #elif defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#pragma GCC diagnostic pop
#endif
diff --git a/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h b/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h
index 4fec8af..e4e4260 100644
--- a/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h
+++ b/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h
@@ -66,7 +66,6 @@ template<typename Derived>
inline typename MatrixBase<Derived>::EigenvaluesReturnType
MatrixBase<Derived>::eigenvalues() const
{
- typedef typename internal::traits<Derived>::Scalar Scalar;
return internal::eigenvalues_selector<Derived, NumTraits<Scalar>::IsComplex>::run(derived());
}
@@ -88,7 +87,6 @@ template<typename MatrixType, unsigned int UpLo>
inline typename SelfAdjointView<MatrixType, UpLo>::EigenvaluesReturnType
SelfAdjointView<MatrixType, UpLo>::eigenvalues() const
{
- typedef typename SelfAdjointView<MatrixType, UpLo>::PlainObject PlainObject;
PlainObject thisAsMatrix(*this);
return SelfAdjointEigenSolver<PlainObject>(thisAsMatrix, false).eigenvalues();
}
diff --git a/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h b/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h
index 395daa8..f7ce471 100644
--- a/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h
+++ b/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h
@@ -50,7 +50,8 @@ void conjugate_gradient(const MatrixType& mat, const Rhs& rhs, Dest& x,
tol_error = 0;
return;
}
- RealScalar threshold = tol*tol*rhsNorm2;
+ const RealScalar considerAsZero = (std::numeric_limits<RealScalar>::min)();
+ RealScalar threshold = numext::maxi(tol*tol*rhsNorm2,considerAsZero);
RealScalar residualNorm2 = residual.squaredNorm();
if (residualNorm2 < threshold)
{
@@ -58,7 +59,7 @@ void conjugate_gradient(const MatrixType& mat, const Rhs& rhs, Dest& x,
tol_error = sqrt(residualNorm2 / rhsNorm2);
return;
}
-
+
VectorType p(n);
p = precond.solve(residual); // initial search direction
diff --git a/eigen/Eigen/src/Jacobi/Jacobi.h b/eigen/Eigen/src/Jacobi/Jacobi.h
index 437e666..1998c63 100644
--- a/eigen/Eigen/src/Jacobi/Jacobi.h
+++ b/eigen/Eigen/src/Jacobi/Jacobi.h
@@ -65,11 +65,11 @@ template<typename Scalar> class JacobiRotation
bool makeJacobi(const MatrixBase<Derived>&, Index p, Index q);
bool makeJacobi(const RealScalar& x, const Scalar& y, const RealScalar& z);
- void makeGivens(const Scalar& p, const Scalar& q, Scalar* z=0);
+ void makeGivens(const Scalar& p, const Scalar& q, Scalar* r=0);
protected:
- void makeGivens(const Scalar& p, const Scalar& q, Scalar* z, internal::true_type);
- void makeGivens(const Scalar& p, const Scalar& q, Scalar* z, internal::false_type);
+ void makeGivens(const Scalar& p, const Scalar& q, Scalar* r, internal::true_type);
+ void makeGivens(const Scalar& p, const Scalar& q, Scalar* r, internal::false_type);
Scalar m_c, m_s;
};
@@ -84,7 +84,6 @@ bool JacobiRotation<Scalar>::makeJacobi(const RealScalar& x, const Scalar& y, co
{
using std::sqrt;
using std::abs;
- typedef typename NumTraits<Scalar>::Real RealScalar;
RealScalar deno = RealScalar(2)*abs(y);
if(deno < (std::numeric_limits<RealScalar>::min)())
{
@@ -133,7 +132,7 @@ inline bool JacobiRotation<Scalar>::makeJacobi(const MatrixBase<Derived>& m, Ind
* \f$ V = \left ( \begin{array}{c} p \\ q \end{array} \right )\f$ yields:
* \f$ G^* V = \left ( \begin{array}{c} r \\ 0 \end{array} \right )\f$.
*
- * The value of \a z is returned if \a z is not null (the default is null).
+ * The value of \a r is returned if \a r is not null (the default is null).
* Also note that G is built such that the cosine is always real.
*
* Example: \include Jacobi_makeGivens.cpp
@@ -146,9 +145,9 @@ inline bool JacobiRotation<Scalar>::makeJacobi(const MatrixBase<Derived>& m, Ind
* \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()
*/
template<typename Scalar>
-void JacobiRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* z)
+void JacobiRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* r)
{
- makeGivens(p, q, z, typename internal::conditional<NumTraits<Scalar>::IsComplex, internal::true_type, internal::false_type>::type());
+ makeGivens(p, q, r, typename internal::conditional<NumTraits<Scalar>::IsComplex, internal::true_type, internal::false_type>::type());
}
diff --git a/eigen/Eigen/src/SVD/SVDBase.h b/eigen/Eigen/src/SVD/SVDBase.h
index cc90a3b..3d1ef37 100644
--- a/eigen/Eigen/src/SVD/SVDBase.h
+++ b/eigen/Eigen/src/SVD/SVDBase.h
@@ -180,8 +180,10 @@ public:
RealScalar threshold() const
{
eigen_assert(m_isInitialized || m_usePrescribedThreshold);
+ // this temporary is needed to workaround a MSVC issue
+ Index diagSize = (std::max<Index>)(1,m_diagSize);
return m_usePrescribedThreshold ? m_prescribedThreshold
- : (std::max<Index>)(1,m_diagSize)*NumTraits<Scalar>::epsilon();
+ : diagSize*NumTraits<Scalar>::epsilon();
}
/** \returns true if \a U (full or thin) is asked for in this SVD decomposition */
diff --git a/eigen/Eigen/src/SparseCore/SparseMatrix.h b/eigen/Eigen/src/SparseCore/SparseMatrix.h
index 323c232..0a2490b 100644
--- a/eigen/Eigen/src/SparseCore/SparseMatrix.h
+++ b/eigen/Eigen/src/SparseCore/SparseMatrix.h
@@ -893,7 +893,7 @@ public:
Index p = m_outerIndex[outer] + m_innerNonZeros[outer]++;
m_data.index(p) = convert_index(inner);
- return (m_data.value(p) = 0);
+ return (m_data.value(p) = Scalar(0));
}
private:
@@ -1274,7 +1274,7 @@ EIGEN_DONT_INLINE typename SparseMatrix<_Scalar,_Options,_StorageIndex>::Scalar&
m_innerNonZeros[outer]++;
m_data.index(p) = inner;
- return (m_data.value(p) = 0);
+ return (m_data.value(p) = Scalar(0));
}
template<typename _Scalar, int _Options, typename _StorageIndex>
@@ -1381,7 +1381,7 @@ EIGEN_DONT_INLINE typename SparseMatrix<_Scalar,_Options,_StorageIndex>::Scalar&
}
m_data.index(p) = inner;
- return (m_data.value(p) = 0);
+ return (m_data.value(p) = Scalar(0));
}
namespace internal {
diff --git a/eigen/Eigen/src/SparseLU/SparseLU.h b/eigen/Eigen/src/SparseLU/SparseLU.h
index f883ab3..7104831 100644
--- a/eigen/Eigen/src/SparseLU/SparseLU.h
+++ b/eigen/Eigen/src/SparseLU/SparseLU.h
@@ -499,8 +499,6 @@ void SparseLU<MatrixType, OrderingType>::factorize(const MatrixType& matrix)
eigen_assert(m_analysisIsOk && "analyzePattern() should be called first");
eigen_assert((matrix.rows() == matrix.cols()) && "Only for squared matrices");
- typedef typename IndexVector::Scalar StorageIndex;
-
m_isInitialized = true;
diff --git a/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h b/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h
index 50a69f3..7261c7d 100644
--- a/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h
+++ b/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h
@@ -297,8 +297,8 @@ SluMatrix asSluMatrix(MatrixType& mat)
template<typename Scalar, int Flags, typename Index>
MappedSparseMatrix<Scalar,Flags,Index> map_superlu(SluMatrix& sluMat)
{
- eigen_assert((Flags&RowMajor)==RowMajor && sluMat.Stype == SLU_NR
- || (Flags&ColMajor)==ColMajor && sluMat.Stype == SLU_NC);
+ eigen_assert(((Flags&RowMajor)==RowMajor && sluMat.Stype == SLU_NR)
+ || ((Flags&ColMajor)==ColMajor && sluMat.Stype == SLU_NC));
Index outerSize = (Flags&RowMajor)==RowMajor ? sluMat.ncol : sluMat.nrow;
diff --git a/eigen/cmake/EigenConfigureTesting.cmake b/eigen/cmake/EigenConfigureTesting.cmake
index afc24b5..3a82439 100644
--- a/eigen/cmake/EigenConfigureTesting.cmake
+++ b/eigen/cmake/EigenConfigureTesting.cmake
@@ -11,13 +11,15 @@ add_custom_target(buildtests)
add_custom_target(check COMMAND "ctest")
add_dependencies(check buildtests)
-# check whether /bin/bash exists
-find_file(EIGEN_BIN_BASH_EXISTS "/bin/bash" PATHS "/" NO_DEFAULT_PATH)
+# check whether /bin/bash exists (disabled as not used anymore)
+# find_file(EIGEN_BIN_BASH_EXISTS "/bin/bash" PATHS "/" NO_DEFAULT_PATH)
# This call activates testing and generates the DartConfiguration.tcl
include(CTest)
set(EIGEN_TEST_BUILD_FLAGS "" CACHE STRING "Options passed to the build command of unit tests")
+set(EIGEN_DASHBOARD_BUILD_TARGET "buildtests" CACHE STRING "Target to be built in dashboard mode, default is buildtests")
+set(EIGEN_CTEST_ERROR_EXCEPTION "" CACHE STRING "Regular expression for build error messages to be filtered out")
# Overwrite default DartConfiguration.tcl such that ctest can build our unit tests.
# Recall that our unit tests are not in the "all" target, so we have to explicitely ask ctest to build our custom 'buildtests' target.
@@ -28,7 +30,7 @@ string(REGEX MATCH "MakeCommand:.*-- (.*)\nDefaultCTestConfigurationType" EIGEN_
if(NOT CMAKE_MATCH_1)
string(REGEX MATCH "MakeCommand:.*[^c]make (.*)\nDefaultCTestConfigurationType" EIGEN_DUMMY ${EIGEN_DART_CONFIG_FILE})
endif()
-string(REGEX REPLACE "MakeCommand:.*DefaultCTestConfigurationType" "MakeCommand: ${CMAKE_COMMAND} --build . --target buildtests --config \"\${CTEST_CONFIGURATION_TYPE}\" -- ${CMAKE_MATCH_1} ${EIGEN_TEST_BUILD_FLAGS}\nDefaultCTestConfigurationType"
+string(REGEX REPLACE "MakeCommand:.*DefaultCTestConfigurationType" "MakeCommand: ${CMAKE_COMMAND} --build . --target ${EIGEN_DASHBOARD_BUILD_TARGET} --config \"\${CTEST_CONFIGURATION_TYPE}\" -- ${CMAKE_MATCH_1} ${EIGEN_TEST_BUILD_FLAGS}\nDefaultCTestConfigurationType"
EIGEN_DART_CONFIG_FILE2 ${EIGEN_DART_CONFIG_FILE})
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/DartConfiguration.tcl" ${EIGEN_DART_CONFIG_FILE2})
@@ -54,8 +56,3 @@ elseif(MSVC)
endif(CMAKE_COMPILER_IS_GNUCXX)
-check_cxx_compiler_flag("-std=c++11" EIGEN_COMPILER_SUPPORT_CXX11)
-
-if(EIGEN_TEST_CXX11 AND EIGEN_COMPILER_SUPPORT_CXX11)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-endif()
diff --git a/eigen/doc/CMakeLists.txt b/eigen/doc/CMakeLists.txt
index db413bc..8ff7559 100644
--- a/eigen/doc/CMakeLists.txt
+++ b/eigen/doc/CMakeLists.txt
@@ -34,8 +34,8 @@ set(EIGEN_DOXY_PROJECT_NAME "Eigen-unsupported")
set(EIGEN_DOXY_OUTPUT_DIRECTORY_SUFFIX "/unsupported")
set(EIGEN_DOXY_INPUT "\"${Eigen_SOURCE_DIR}/unsupported/Eigen\" \"${Eigen_SOURCE_DIR}/unsupported/doc\"")
set(EIGEN_DOXY_HTML_COLORSTYLE_HUE "0")
-# set(EIGEN_DOXY_TAGFILES "\"${Eigen_BINARY_DIR}/doc/eigen.doxytags =../\"")
-set(EIGEN_DOXY_TAGFILES "")
+set(EIGEN_DOXY_TAGFILES "\"${Eigen_BINARY_DIR}/doc/Eigen.doxytags=..\"")
+#set(EIGEN_DOXY_TAGFILES "")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
diff --git a/eigen/doc/CoeffwiseMathFunctionsTable.dox b/eigen/doc/CoeffwiseMathFunctionsTable.dox
index 3ae9420..12a565b 100644
--- a/eigen/doc/CoeffwiseMathFunctionsTable.dox
+++ b/eigen/doc/CoeffwiseMathFunctionsTable.dox
@@ -63,7 +63,7 @@ This also means that, unless specified, if the function \c std::foo is available
\anchor cwisetable_conj
a.\link ArrayBase::conjugate conjugate\endlink(); \n
\link Eigen::conj conj\endlink(a); \n
- m.\link MatrixBase::conjugate conjugate();
+ m.\link MatrixBase::conjugate conjugate\endlink();
</td>
<td><a href="https://en.wikipedia.org/wiki/Complex_conjugate">complex conjugate</a> (\f$ \bar{a_i} \f$),\n
no-op for real </td>
@@ -133,8 +133,9 @@ This also means that, unless specified, if the function \c std::foo is available
<td class="code">
\anchor cwisetable_pow
a.\link ArrayBase::pow pow\endlink(b); \n
- \link Eigen::pow pow\endlink(a,b);
+ \link ArrayBase::pow(const Eigen::ArrayBase< Derived > &x, const Eigen::ArrayBase< ExponentDerived > &exponents) pow\endlink(a,b);
</td>
+ <!-- For some reason Doxygen thinks that pow is in ArrayBase namespace -->
<td>raises a number to the given power (\f$ a_i ^ {b_i} \f$) \n \c a and \c b can be either an array or scalar.</td>
<td class="code">
using <a href="http://en.cppreference.com/w/cpp/numeric/math/pow">std::pow</a>; \n
@@ -271,7 +272,7 @@ This also means that, unless specified, if the function \c std::foo is available
<tr>
<td class="code">
\anchor cwisetable_atan
- a.\link ArrayBase::atan tan\endlink(); \n
+ a.\link ArrayBase::atan atan\endlink(); \n
\link Eigen::atan atan\endlink(a);
</td>
<td>computes arc tangent (\f$ \tan^{-1} a_i \f$)</td>
diff --git a/eigen/doc/Doxyfile.in b/eigen/doc/Doxyfile.in
index 48bb0a8..37948a6 100644
--- a/eigen/doc/Doxyfile.in
+++ b/eigen/doc/Doxyfile.in
@@ -1596,6 +1596,7 @@ PREDEFINED = EIGEN_EMPTY_STRUCT \
"EIGEN_CAT2(a,b)= a ## b"\
"EIGEN_CAT(a,b)=EIGEN_CAT2(a,b)"\
"EIGEN_CWISE_BINARY_RETURN_TYPE(LHS,RHS,OPNAME)=CwiseBinaryOp<EIGEN_CAT(EIGEN_CAT(internal::scalar_,OPNAME),_op)<LHS::Scalar, RHS::Scalar>, const LHS, const RHS>"\
+ "EIGEN_ALIGN_TO_BOUNDARY(x)="\
DOXCOMMA=,
@@ -1618,6 +1619,9 @@ EXPAND_AS_DEFINED = EIGEN_MAKE_TYPEDEFS \
EIGEN_EULER_ANGLES_TYPEDEFS \
EIGEN_EULER_ANGLES_SINGLE_TYPEDEF \
EIGEN_EULER_SYSTEM_TYPEDEF \
+ EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY \
+ EIGEN_MATRIX_FUNCTION \
+ EIGEN_MATRIX_FUNCTION_1 \
EIGEN_DOC_UNARY_ADDONS \
EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL \
EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF
@@ -1665,7 +1669,7 @@ ALLEXTERNALS = NO
# in the modules index. If set to NO, only the current project's groups will
# be listed.
-EXTERNAL_GROUPS = YES
+EXTERNAL_GROUPS = NO
# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of `which perl').
diff --git a/eigen/doc/eigen_navtree_hacks.js b/eigen/doc/eigen_navtree_hacks.js
index 39c59f7..a6f8c34 100644
--- a/eigen/doc/eigen_navtree_hacks.js
+++ b/eigen/doc/eigen_navtree_hacks.js
@@ -64,18 +64,20 @@ function getNode(o, po)
// Overloaded to adjust the size of the navtree wrt the toc
function resizeHeight()
{
- var toc = $("#nav-toc");
- var header = $("#header");
- var content = $("#doc-content");
- var navtree = $("#nav-path");
+ var header = $("#top");
var sidenav = $("#side-nav");
- var tocHeight = toc.height(); // <- we added this line
- var headerHeight = header.height();
- var footerHeight = footer.height();
+ var content = $("#doc-content");
+ var navtree = $("#nav-tree");
+ var footer = $("#nav-path");
+ var toc = $("#nav-toc");
+
+ var headerHeight = header.outerHeight();
+ var footerHeight = footer.outerHeight();
+ var tocHeight = toc.height();
var windowHeight = $(window).height() - headerHeight - footerHeight;
content.css({height:windowHeight + "px"});
- navtree.css({height:(windowHeight-tocHeight) + "px"}); // <- we modified this line
- sidenav.css({height:(windowHeight) + "px",top: headerHeight+"px"});
+ navtree.css({height:(windowHeight-tocHeight) + "px"});
+ sidenav.css({height:windowHeight + "px"});
}
// Overloaded to save the root node into global_navtree_object
@@ -159,19 +161,18 @@ function createIndent(o,domNode,node,level)
var level=-2; // <- we replaced level=-1 by level=-2
var n = node;
while (n.parentNode) { level++; n=n.parentNode; }
- var imgNode = document.createElement("img");
- imgNode.style.paddingLeft=(16*(level)).toString()+'px';
- imgNode.width = 16;
- imgNode.height = 22;
- imgNode.border = 0;
if (checkChildrenData(node)) { // <- we modified this line to use checkChildrenData(node) instead of node.childrenData
+ var imgNode = document.createElement("span");
+ imgNode.className = 'arrow';
+ imgNode.style.paddingLeft=(16*level).toString()+'px';
+ imgNode.innerHTML=arrowRight;
node.plus_img = imgNode;
node.expandToggle = document.createElement("a");
node.expandToggle.href = "javascript:void(0)";
node.expandToggle.onclick = function() {
if (node.expanded) {
$(node.getChildrenUL()).slideUp("fast");
- node.plus_img.src = node.relpath+"ftv2pnode.png";
+ node.plus_img.innerHTML=arrowRight;
node.expanded = false;
} else {
expandNode(o, node, false, false);
@@ -179,11 +180,13 @@ function createIndent(o,domNode,node,level)
}
node.expandToggle.appendChild(imgNode);
domNode.appendChild(node.expandToggle);
- imgNode.src = node.relpath+"ftv2pnode.png";
} else {
- imgNode.src = node.relpath+"ftv2node.png";
- domNode.appendChild(imgNode);
- }
+ var span = document.createElement("span");
+ span.className = 'arrow';
+ span.style.width = 16*(level+1)+'px';
+ span.innerHTML = '&#160;';
+ domNode.appendChild(span);
+ }
}
// Overloaded to automatically expand the selected node
@@ -237,8 +240,7 @@ $(document).ready(function() {
setTimeout(arguments.callee, 10);
}
})();
-});
-$(window).load(function() {
- resizeHeight();
+ $(window).load(resizeHeight);
});
+
diff --git a/eigen/doc/eigendoxy.css b/eigen/doc/eigendoxy.css
index 9a036d2..225f5d3 100644
--- a/eigen/doc/eigendoxy.css
+++ b/eigen/doc/eigendoxy.css
@@ -165,6 +165,8 @@ div.toc {
bottom:0;
border-radius:0px;
border-style: solid none none none;
+ max-height:50%;
+ overflow-y: scroll;
}
div.toc h3 {
diff --git a/eigen/doc/snippets/MatrixBase_cwiseEqual.cpp b/eigen/doc/snippets/MatrixBase_cwiseEqual.cpp
index eb3656f..469af64 100644
--- a/eigen/doc/snippets/MatrixBase_cwiseEqual.cpp
+++ b/eigen/doc/snippets/MatrixBase_cwiseEqual.cpp
@@ -3,5 +3,5 @@ m << 1, 0,
1, 1;
cout << "Comparing m with identity matrix:" << endl;
cout << m.cwiseEqual(MatrixXi::Identity(2,2)) << endl;
-int count = m.cwiseEqual(MatrixXi::Identity(2,2)).count();
+Index count = m.cwiseEqual(MatrixXi::Identity(2,2)).count();
cout << "Number of coefficients that are equal: " << count << endl;
diff --git a/eigen/doc/snippets/MatrixBase_cwiseNotEqual.cpp b/eigen/doc/snippets/MatrixBase_cwiseNotEqual.cpp
index 6a2e4fb..7f0a105 100644
--- a/eigen/doc/snippets/MatrixBase_cwiseNotEqual.cpp
+++ b/eigen/doc/snippets/MatrixBase_cwiseNotEqual.cpp
@@ -3,5 +3,5 @@ m << 1, 0,
1, 1;
cout << "Comparing m with identity matrix:" << endl;
cout << m.cwiseNotEqual(MatrixXi::Identity(2,2)) << endl;
-int count = m.cwiseNotEqual(MatrixXi::Identity(2,2)).count();
+Index count = m.cwiseNotEqual(MatrixXi::Identity(2,2)).count();
cout << "Number of coefficients that are not equal: " << count << endl;
diff --git a/eigen/doc/special_examples/CMakeLists.txt b/eigen/doc/special_examples/CMakeLists.txt
index 101fbc5..66ba4de 100644
--- a/eigen/doc/special_examples/CMakeLists.txt
+++ b/eigen/doc/special_examples/CMakeLists.txt
@@ -19,7 +19,6 @@ if(QT4_FOUND)
add_dependencies(all_examples Tutorial_sparse_example)
endif(QT4_FOUND)
-check_cxx_compiler_flag("-std=c++11" EIGEN_COMPILER_SUPPORT_CPP11)
if(EIGEN_COMPILER_SUPPORT_CPP11)
add_executable(random_cpp11 random_cpp11.cpp)
target_link_libraries(random_cpp11 ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
diff --git a/eigen/test/adjoint.cpp b/eigen/test/adjoint.cpp
index bdea51c..37032d2 100644
--- a/eigen/test/adjoint.cpp
+++ b/eigen/test/adjoint.cpp
@@ -70,7 +70,6 @@ template<typename MatrixType> void adjoint(const MatrixType& m)
Transpose.h Conjugate.h Dot.h
*/
using std::abs;
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
diff --git a/eigen/test/array.cpp b/eigen/test/array.cpp
index 15c3266..7afd3ed 100644
--- a/eigen/test/array.cpp
+++ b/eigen/test/array.cpp
@@ -11,7 +11,6 @@
template<typename ArrayType> void array(const ArrayType& m)
{
- typedef typename ArrayType::Index Index;
typedef typename ArrayType::Scalar Scalar;
typedef typename ArrayType::RealScalar RealScalar;
typedef Array<Scalar, ArrayType::RowsAtCompileTime, 1> ColVectorType;
@@ -130,7 +129,6 @@ template<typename ArrayType> void array(const ArrayType& m)
template<typename ArrayType> void comparisons(const ArrayType& m)
{
using std::abs;
- typedef typename ArrayType::Index Index;
typedef typename ArrayType::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
@@ -208,7 +206,6 @@ template<typename ArrayType> void array_real(const ArrayType& m)
{
using std::abs;
using std::sqrt;
- typedef typename ArrayType::Index Index;
typedef typename ArrayType::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
@@ -319,7 +316,6 @@ template<typename ArrayType> void array_real(const ArrayType& m)
template<typename ArrayType> void array_complex(const ArrayType& m)
{
- typedef typename ArrayType::Index Index;
typedef typename ArrayType::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
@@ -424,7 +420,6 @@ template<typename ArrayType> void array_complex(const ArrayType& m)
template<typename ArrayType> void min_max(const ArrayType& m)
{
- typedef typename ArrayType::Index Index;
typedef typename ArrayType::Scalar Scalar;
Index rows = m.rows();
diff --git a/eigen/test/array_for_matrix.cpp b/eigen/test/array_for_matrix.cpp
index b872139..a05bba1 100644
--- a/eigen/test/array_for_matrix.cpp
+++ b/eigen/test/array_for_matrix.cpp
@@ -11,7 +11,6 @@
template<typename MatrixType> void array_for_matrix(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> ColVectorType;
typedef Matrix<Scalar, 1, MatrixType::ColsAtCompileTime> RowVectorType;
@@ -83,7 +82,6 @@ template<typename MatrixType> void array_for_matrix(const MatrixType& m)
template<typename MatrixType> void comparisons(const MatrixType& m)
{
using std::abs;
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
@@ -172,7 +170,6 @@ template<typename VectorType> void lpNorm(const VectorType& v)
template<typename MatrixType> void cwise_min_max(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
Index rows = m.rows();
@@ -211,7 +208,6 @@ template<typename MatrixType> void cwise_min_max(const MatrixType& m)
template<typename MatrixTraits> void resize(const MatrixTraits& t)
{
- typedef typename MatrixTraits::Index Index;
typedef typename MatrixTraits::Scalar Scalar;
typedef Matrix<Scalar,Dynamic,Dynamic> MatrixType;
typedef Array<Scalar,Dynamic,Dynamic> Array2DType;
diff --git a/eigen/test/array_replicate.cpp b/eigen/test/array_replicate.cpp
index 779c8fc..0dad5ba 100644
--- a/eigen/test/array_replicate.cpp
+++ b/eigen/test/array_replicate.cpp
@@ -14,7 +14,6 @@ template<typename MatrixType> void replicate(const MatrixType& m)
/* this test covers the following files:
Replicate.cpp
*/
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
typedef Matrix<Scalar, Dynamic, Dynamic> MatrixX;
diff --git a/eigen/test/array_reverse.cpp b/eigen/test/array_reverse.cpp
index c9d9f90..9d5b9a6 100644
--- a/eigen/test/array_reverse.cpp
+++ b/eigen/test/array_reverse.cpp
@@ -15,7 +15,6 @@ using namespace std;
template<typename MatrixType> void reverse(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
diff --git a/eigen/test/basicstuff.cpp b/eigen/test/basicstuff.cpp
index 99d91f9..2e532f7 100644
--- a/eigen/test/basicstuff.cpp
+++ b/eigen/test/basicstuff.cpp
@@ -13,7 +13,6 @@
template<typename MatrixType> void basicStuff(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> SquareMatrixType;
@@ -144,7 +143,6 @@ template<typename MatrixType> void basicStuff(const MatrixType& m)
template<typename MatrixType> void basicStuffComplex(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
typedef Matrix<RealScalar, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime> RealMatrixType;
diff --git a/eigen/test/block.cpp b/eigen/test/block.cpp
index f64bdae..ca9c21f 100644
--- a/eigen/test/block.cpp
+++ b/eigen/test/block.cpp
@@ -32,7 +32,6 @@ block_real_only(const MatrixType &, Index, Index, Index, Index, const Scalar&) {
template<typename MatrixType> void block(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::RealScalar RealScalar;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
@@ -207,7 +206,6 @@ template<typename MatrixType> void block(const MatrixType& m)
template<typename MatrixType>
void compare_using_data_and_stride(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
Index rows = m.rows();
Index cols = m.cols();
Index size = m.size();
@@ -241,7 +239,6 @@ void compare_using_data_and_stride(const MatrixType& m)
template<typename MatrixType>
void data_and_stride(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
Index rows = m.rows();
Index cols = m.cols();
diff --git a/eigen/test/cholesky.cpp b/eigen/test/cholesky.cpp
index b4b6bda..5cf842d 100644
--- a/eigen/test/cholesky.cpp
+++ b/eigen/test/cholesky.cpp
@@ -19,6 +19,7 @@
template<typename MatrixType, int UpLo>
typename MatrixType::RealScalar matrix_l1_norm(const MatrixType& m) {
+ if(m.cols()==0) return typename MatrixType::RealScalar(0);
MatrixType symm = m.template selfadjointView<UpLo>();
return symm.cwiseAbs().colwise().sum().maxCoeff();
}
@@ -57,7 +58,6 @@ template<typename MatrixType,template <typename,int> class CholType> void test_c
template<typename MatrixType> void cholesky(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
/* this test covers the following files:
LLT.h LDLT.h
*/
@@ -97,7 +97,7 @@ template<typename MatrixType> void cholesky(const MatrixType& m)
RealScalar rcond_est = chollo.rcond();
// Verify that the estimated condition number is within a factor of 10 of the
// truth.
- VERIFY(rcond_est > rcond / 10 && rcond_est < rcond * 10);
+ VERIFY(rcond_est >= rcond / 10 && rcond_est <= rcond * 10);
// test the upper mode
LLT<SquareMatrixType,Upper> cholup(symmUp);
@@ -113,12 +113,12 @@ template<typename MatrixType> void cholesky(const MatrixType& m)
rcond = (RealScalar(1) / matrix_l1_norm<MatrixType, Upper>(symmUp)) /
matrix_l1_norm<MatrixType, Upper>(symmUp_inverse);
rcond_est = cholup.rcond();
- VERIFY(rcond_est > rcond / 10 && rcond_est < rcond * 10);
+ VERIFY(rcond_est >= rcond / 10 && rcond_est <= rcond * 10);
MatrixType neg = -symmLo;
chollo.compute(neg);
- VERIFY(chollo.info()==NumericalIssue);
+ VERIFY(neg.size()==0 || chollo.info()==NumericalIssue);
VERIFY_IS_APPROX(MatrixType(chollo.matrixL().transpose().conjugate()), MatrixType(chollo.matrixU()));
VERIFY_IS_APPROX(MatrixType(chollo.matrixU().transpose().conjugate()), MatrixType(chollo.matrixL()));
@@ -167,7 +167,7 @@ template<typename MatrixType> void cholesky(const MatrixType& m)
RealScalar rcond_est = ldltlo.rcond();
// Verify that the estimated condition number is within a factor of 10 of the
// truth.
- VERIFY(rcond_est > rcond / 10 && rcond_est < rcond * 10);
+ VERIFY(rcond_est >= rcond / 10 && rcond_est <= rcond * 10);
LDLT<SquareMatrixType,Upper> ldltup(symmUp);
@@ -184,7 +184,7 @@ template<typename MatrixType> void cholesky(const MatrixType& m)
rcond = (RealScalar(1) / matrix_l1_norm<MatrixType, Upper>(symmUp)) /
matrix_l1_norm<MatrixType, Upper>(symmUp_inverse);
rcond_est = ldltup.rcond();
- VERIFY(rcond_est > rcond / 10 && rcond_est < rcond * 10);
+ VERIFY(rcond_est >= rcond / 10 && rcond_est <= rcond * 10);
VERIFY_IS_APPROX(MatrixType(ldltlo.matrixL().transpose().conjugate()), MatrixType(ldltlo.matrixU()));
VERIFY_IS_APPROX(MatrixType(ldltlo.matrixU().transpose().conjugate()), MatrixType(ldltlo.matrixL()));
@@ -289,8 +289,6 @@ template<typename MatrixType> void cholesky_cplx(const MatrixType& m)
// test mixing real/scalar types
- typedef typename MatrixType::Index Index;
-
Index rows = m.rows();
Index cols = m.cols();
@@ -510,6 +508,11 @@ void test_cholesky()
CALL_SUBTEST_6( cholesky_cplx(MatrixXcd(s,s)) );
TEST_SET_BUT_UNUSED_VARIABLE(s)
}
+ // empty matrix, regression test for Bug 785:
+ CALL_SUBTEST_2( cholesky(MatrixXd(0,0)) );
+
+ // This does not work yet:
+ // CALL_SUBTEST_2( cholesky(Matrix<double,0,0>()) );
CALL_SUBTEST_4( cholesky_verify_assert<Matrix3f>() );
CALL_SUBTEST_7( cholesky_verify_assert<Matrix3d>() );
diff --git a/eigen/test/conservative_resize.cpp b/eigen/test/conservative_resize.cpp
index 498421b..21a1db4 100644
--- a/eigen/test/conservative_resize.cpp
+++ b/eigen/test/conservative_resize.cpp
@@ -17,7 +17,6 @@ template <typename Scalar, int Storage>
void run_matrix_tests()
{
typedef Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Storage> MatrixType;
- typedef typename MatrixType::Index Index;
MatrixType m, n;
diff --git a/eigen/test/corners.cpp b/eigen/test/corners.cpp
index 3c64c32..32edadb 100644
--- a/eigen/test/corners.cpp
+++ b/eigen/test/corners.cpp
@@ -15,7 +15,6 @@
template<typename MatrixType> void corners(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
Index rows = m.rows();
Index cols = m.cols();
diff --git a/eigen/test/determinant.cpp b/eigen/test/determinant.cpp
index 758f3af..b8c9bab 100644
--- a/eigen/test/determinant.cpp
+++ b/eigen/test/determinant.cpp
@@ -16,7 +16,6 @@ template<typename MatrixType> void determinant(const MatrixType& m)
/* this test covers the following files:
Determinant.h
*/
- typedef typename MatrixType::Index Index;
Index size = m.rows();
MatrixType m1(size, size), m2(size, size);
diff --git a/eigen/test/diagonal.cpp b/eigen/test/diagonal.cpp
index 0b5ae82..8ed9b46 100644
--- a/eigen/test/diagonal.cpp
+++ b/eigen/test/diagonal.cpp
@@ -11,7 +11,6 @@
template<typename MatrixType> void diagonal(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
Index rows = m.rows();
diff --git a/eigen/test/diagonalmatrices.cpp b/eigen/test/diagonalmatrices.cpp
index a4ff102..c55733d 100644
--- a/eigen/test/diagonalmatrices.cpp
+++ b/eigen/test/diagonalmatrices.cpp
@@ -11,7 +11,6 @@
using namespace std;
template<typename MatrixType> void diagonalmatrices(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime };
typedef Matrix<Scalar, Rows, 1> VectorType;
diff --git a/eigen/test/dontalign.cpp b/eigen/test/dontalign.cpp
index 4643cfe..ac00112 100644
--- a/eigen/test/dontalign.cpp
+++ b/eigen/test/dontalign.cpp
@@ -19,7 +19,6 @@
template<typename MatrixType>
void dontalign(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> SquareMatrixType;
diff --git a/eigen/test/eigen2support.cpp b/eigen/test/eigen2support.cpp
index ad1d980..ac6931a 100644
--- a/eigen/test/eigen2support.cpp
+++ b/eigen/test/eigen2support.cpp
@@ -13,7 +13,6 @@
template<typename MatrixType> void eigen2support(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
Index rows = m.rows();
diff --git a/eigen/test/eigensolver_complex.cpp b/eigen/test/eigensolver_complex.cpp
index 293b1b2..7269452 100644
--- a/eigen/test/eigensolver_complex.cpp
+++ b/eigen/test/eigensolver_complex.cpp
@@ -71,7 +71,6 @@ void verify_is_approx_upto_permutation(const VectorType& vec1, const VectorType&
template<typename MatrixType> void eigensolver(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
/* this test covers the following files:
ComplexEigenSolver.h, and indirectly ComplexSchur.h
*/
diff --git a/eigen/test/eigensolver_generalized_real.cpp b/eigen/test/eigensolver_generalized_real.cpp
index f7861d3..9dd44c8 100644
--- a/eigen/test/eigensolver_generalized_real.cpp
+++ b/eigen/test/eigensolver_generalized_real.cpp
@@ -15,7 +15,6 @@
template<typename MatrixType> void generalized_eigensolver_real(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
/* this test covers the following files:
GeneralizedEigenSolver.h
*/
diff --git a/eigen/test/eigensolver_generic.cpp b/eigen/test/eigensolver_generic.cpp
index d0e644d..07bf65e 100644
--- a/eigen/test/eigensolver_generic.cpp
+++ b/eigen/test/eigensolver_generic.cpp
@@ -14,7 +14,6 @@
template<typename MatrixType> void eigensolver(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
/* this test covers the following files:
EigenSolver.h
*/
diff --git a/eigen/test/eigensolver_selfadjoint.cpp b/eigen/test/eigensolver_selfadjoint.cpp
index 39ad413..0e39b53 100644
--- a/eigen/test/eigensolver_selfadjoint.cpp
+++ b/eigen/test/eigensolver_selfadjoint.cpp
@@ -68,7 +68,6 @@ template<typename MatrixType> void selfadjointeigensolver_essential_check(const
template<typename MatrixType> void selfadjointeigensolver(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
/* this test covers the following files:
EigenSolver.h, SelfAdjointEigenSolver.h (and indirectly: Tridiagonalization.h)
*/
diff --git a/eigen/test/geo_alignedbox.cpp b/eigen/test/geo_alignedbox.cpp
index d2339a6..b64ea3b 100644
--- a/eigen/test/geo_alignedbox.cpp
+++ b/eigen/test/geo_alignedbox.cpp
@@ -24,7 +24,6 @@ template<typename BoxType> void alignedbox(const BoxType& _box)
/* this test covers the following files:
AlignedBox.h
*/
- typedef typename BoxType::Index Index;
typedef typename BoxType::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
typedef Matrix<Scalar, BoxType::AmbientDimAtCompileTime, 1> VectorType;
@@ -86,7 +85,6 @@ template<typename BoxType>
void alignedboxCastTests(const BoxType& _box)
{
// casting
- typedef typename BoxType::Index Index;
typedef typename BoxType::Scalar Scalar;
typedef Matrix<Scalar, BoxType::AmbientDimAtCompileTime, 1> VectorType;
diff --git a/eigen/test/geo_hyperplane.cpp b/eigen/test/geo_hyperplane.cpp
index 2789285..b3a48c5 100644
--- a/eigen/test/geo_hyperplane.cpp
+++ b/eigen/test/geo_hyperplane.cpp
@@ -19,7 +19,6 @@ template<typename HyperplaneType> void hyperplane(const HyperplaneType& _plane)
Hyperplane.h
*/
using std::abs;
- typedef typename HyperplaneType::Index Index;
const Index dim = _plane.dim();
enum { Options = HyperplaneType::Options };
typedef typename HyperplaneType::Scalar Scalar;
diff --git a/eigen/test/geo_parametrizedline.cpp b/eigen/test/geo_parametrizedline.cpp
index 9bf5f3c..6a87947 100644
--- a/eigen/test/geo_parametrizedline.cpp
+++ b/eigen/test/geo_parametrizedline.cpp
@@ -19,7 +19,6 @@ template<typename LineType> void parametrizedline(const LineType& _line)
ParametrizedLine.h
*/
using std::abs;
- typedef typename LineType::Index Index;
const Index dim = _line.dim();
typedef typename LineType::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
diff --git a/eigen/test/half_float.cpp b/eigen/test/half_float.cpp
index 3d2410a..b37b819 100644
--- a/eigen/test/half_float.cpp
+++ b/eigen/test/half_float.cpp
@@ -11,6 +11,10 @@
#include <Eigen/src/Core/arch/CUDA/Half.h>
+#ifdef EIGEN_HAS_CUDA_FP16
+#error "EIGEN_HAS_CUDA_FP16 should not be defined in this CPU unit test"
+#endif
+
// Make sure it's possible to forward declare Eigen::half
namespace Eigen {
struct half;
@@ -20,7 +24,7 @@ using Eigen::half;
void test_conversion()
{
- using Eigen::half_impl::__half;
+ using Eigen::half_impl::__half_raw;
// Conversion from float.
VERIFY_IS_EQUAL(half(1.0f).x, 0x3c00);
@@ -37,9 +41,9 @@ void test_conversion()
VERIFY_IS_EQUAL(half(1.19209e-07f).x, 0x0002);
// Verify round-to-nearest-even behavior.
- float val1 = float(half(__half(0x3c00)));
- float val2 = float(half(__half(0x3c01)));
- float val3 = float(half(__half(0x3c02)));
+ float val1 = float(half(__half_raw(0x3c00)));
+ float val2 = float(half(__half_raw(0x3c01)));
+ float val3 = float(half(__half_raw(0x3c02)));
VERIFY_IS_EQUAL(half(0.5f * (val1 + val2)).x, 0x3c00);
VERIFY_IS_EQUAL(half(0.5f * (val2 + val3)).x, 0x3c02);
@@ -55,21 +59,21 @@ void test_conversion()
VERIFY_IS_EQUAL(half(true).x, 0x3c00);
// Conversion to float.
- VERIFY_IS_EQUAL(float(half(__half(0x0000))), 0.0f);
- VERIFY_IS_EQUAL(float(half(__half(0x3c00))), 1.0f);
+ VERIFY_IS_EQUAL(float(half(__half_raw(0x0000))), 0.0f);
+ VERIFY_IS_EQUAL(float(half(__half_raw(0x3c00))), 1.0f);
// Denormals.
- VERIFY_IS_APPROX(float(half(__half(0x8001))), -5.96046e-08f);
- VERIFY_IS_APPROX(float(half(__half(0x0001))), 5.96046e-08f);
- VERIFY_IS_APPROX(float(half(__half(0x0002))), 1.19209e-07f);
+ VERIFY_IS_APPROX(float(half(__half_raw(0x8001))), -5.96046e-08f);
+ VERIFY_IS_APPROX(float(half(__half_raw(0x0001))), 5.96046e-08f);
+ VERIFY_IS_APPROX(float(half(__half_raw(0x0002))), 1.19209e-07f);
// NaNs and infinities.
VERIFY(!(numext::isinf)(float(half(65504.0f)))); // Largest finite number.
VERIFY(!(numext::isnan)(float(half(0.0f))));
- VERIFY((numext::isinf)(float(half(__half(0xfc00)))));
- VERIFY((numext::isnan)(float(half(__half(0xfc01)))));
- VERIFY((numext::isinf)(float(half(__half(0x7c00)))));
- VERIFY((numext::isnan)(float(half(__half(0x7c01)))));
+ VERIFY((numext::isinf)(float(half(__half_raw(0xfc00)))));
+ VERIFY((numext::isnan)(float(half(__half_raw(0xfc01)))));
+ VERIFY((numext::isinf)(float(half(__half_raw(0x7c00)))));
+ VERIFY((numext::isnan)(float(half(__half_raw(0x7c01)))));
#if !EIGEN_COMP_MSVC
// Visual Studio errors out on divisions by 0
@@ -79,12 +83,12 @@ void test_conversion()
#endif
// Exactly same checks as above, just directly on the half representation.
- VERIFY(!(numext::isinf)(half(__half(0x7bff))));
- VERIFY(!(numext::isnan)(half(__half(0x0000))));
- VERIFY((numext::isinf)(half(__half(0xfc00))));
- VERIFY((numext::isnan)(half(__half(0xfc01))));
- VERIFY((numext::isinf)(half(__half(0x7c00))));
- VERIFY((numext::isnan)(half(__half(0x7c01))));
+ VERIFY(!(numext::isinf)(half(__half_raw(0x7bff))));
+ VERIFY(!(numext::isnan)(half(__half_raw(0x0000))));
+ VERIFY((numext::isinf)(half(__half_raw(0xfc00))));
+ VERIFY((numext::isnan)(half(__half_raw(0xfc01))));
+ VERIFY((numext::isinf)(half(__half_raw(0x7c00))));
+ VERIFY((numext::isnan)(half(__half_raw(0x7c01))));
#if !EIGEN_COMP_MSVC
// Visual Studio errors out on divisions by 0
diff --git a/eigen/test/householder.cpp b/eigen/test/householder.cpp
index c5f6b5e..e70b7ea 100644
--- a/eigen/test/householder.cpp
+++ b/eigen/test/householder.cpp
@@ -12,7 +12,6 @@
template<typename MatrixType> void householder(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
static bool even = true;
even = !even;
/* this test covers the following files:
diff --git a/eigen/test/integer_types.cpp b/eigen/test/integer_types.cpp
index 2512631..3629559 100644
--- a/eigen/test/integer_types.cpp
+++ b/eigen/test/integer_types.cpp
@@ -18,7 +18,6 @@
template<typename MatrixType> void signed_integer_type_tests(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
enum { is_signed = (Scalar(-1) > Scalar(0)) ? 0 : 1 };
@@ -49,7 +48,6 @@ template<typename MatrixType> void signed_integer_type_tests(const MatrixType& m
template<typename MatrixType> void integer_type_tests(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
VERIFY(NumTraits<Scalar>::IsInteger);
diff --git a/eigen/test/inverse.cpp b/eigen/test/inverse.cpp
index 97fe6ff..be607cc 100644
--- a/eigen/test/inverse.cpp
+++ b/eigen/test/inverse.cpp
@@ -14,7 +14,6 @@
template<typename MatrixType> void inverse(const MatrixType& m)
{
using std::abs;
- typedef typename MatrixType::Index Index;
/* this test covers the following files:
Inverse.h
*/
diff --git a/eigen/test/jacobi.cpp b/eigen/test/jacobi.cpp
index 7ccd412..319e476 100644
--- a/eigen/test/jacobi.cpp
+++ b/eigen/test/jacobi.cpp
@@ -14,7 +14,6 @@
template<typename MatrixType, typename JacobiScalar>
void jacobi(const MatrixType& m = MatrixType())
{
- typedef typename MatrixType::Index Index;
Index rows = m.rows();
Index cols = m.cols();
diff --git a/eigen/test/jacobisvd.cpp b/eigen/test/jacobisvd.cpp
index 7f5f715..64b8663 100644
--- a/eigen/test/jacobisvd.cpp
+++ b/eigen/test/jacobisvd.cpp
@@ -36,7 +36,6 @@ void jacobisvd(const MatrixType& a = MatrixType(), bool pickrandom = true)
template<typename MatrixType> void jacobisvd_verify_assert(const MatrixType& m)
{
svd_verify_assert<JacobiSVD<MatrixType> >(m);
- typedef typename MatrixType::Index Index;
Index rows = m.rows();
Index cols = m.cols();
@@ -70,6 +69,21 @@ void jacobisvd_method()
VERIFY_IS_APPROX(m.jacobiSvd(ComputeFullU|ComputeFullV).solve(m), m);
}
+namespace Foo {
+// older compiler require a default constructor for Bar
+// cf: https://stackoverflow.com/questions/7411515/
+class Bar {public: Bar() {}};
+bool operator<(const Bar&, const Bar&) { return true; }
+}
+// regression test for a very strange MSVC issue for which simply
+// including SVDBase.h messes up with std::max and custom scalar type
+void msvc_workaround()
+{
+ const Foo::Bar a;
+ const Foo::Bar b;
+ std::max EIGEN_NOT_A_MACRO (a,b);
+}
+
void test_jacobisvd()
{
CALL_SUBTEST_3(( jacobisvd_verify_assert(Matrix3f()) ));
@@ -123,4 +137,6 @@ void test_jacobisvd()
CALL_SUBTEST_9( svd_preallocate<void>() );
CALL_SUBTEST_2( svd_underoverflow<void>() );
+
+ msvc_workaround();
}
diff --git a/eigen/test/linearstructure.cpp b/eigen/test/linearstructure.cpp
index 17474af..b6559b2 100644
--- a/eigen/test/linearstructure.cpp
+++ b/eigen/test/linearstructure.cpp
@@ -19,7 +19,6 @@ template<typename MatrixType> void linearStructure(const MatrixType& m)
/* this test covers the following files:
CwiseUnaryOp.h, CwiseBinaryOp.h, SelfCwiseBinaryOp.h
*/
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::RealScalar RealScalar;
diff --git a/eigen/test/lu.cpp b/eigen/test/lu.cpp
index 9787f4d..176a2f0 100644
--- a/eigen/test/lu.cpp
+++ b/eigen/test/lu.cpp
@@ -18,7 +18,6 @@ typename MatrixType::RealScalar matrix_l1_norm(const MatrixType& m) {
template<typename MatrixType> void lu_non_invertible()
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::RealScalar RealScalar;
/* this test covers the following files:
LU.h
@@ -58,6 +57,10 @@ template<typename MatrixType> void lu_non_invertible()
// 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));
+ // The kernel of the zero matrix is the entire space, and thus is an invertible matrix of dimensions cols.
+ KernelMatrixType kernel = MatrixType::Zero(rows,cols).fullPivLu().kernel();
+ VERIFY((kernel.fullPivLu().isInvertible()));
+
MatrixType m1(rows, cols), m3(rows, cols2);
CMatrixType m2(cols, cols2);
createRandomPIMatrixOfRank(rank, rows, cols, m1);
@@ -87,7 +90,7 @@ template<typename MatrixType> void lu_non_invertible()
VERIFY(!lu.isInjective());
VERIFY(!lu.isInvertible());
VERIFY(!lu.isSurjective());
- VERIFY((m1 * m1kernel).isMuchSmallerThan(m1));
+ VERIFY_IS_MUCH_SMALLER_THAN((m1 * m1kernel), m1);
VERIFY(m1image.fullPivLu().rank() == rank);
VERIFY_IS_APPROX(m1 * m1.adjoint() * m1image, m1image);
@@ -181,7 +184,6 @@ template<typename MatrixType> void lu_partial_piv()
/* this test covers the following files:
PartialPivLU.h
*/
- typedef typename MatrixType::Index Index;
typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;
Index size = internal::random<Index>(1,4);
diff --git a/eigen/test/mapped_matrix.cpp b/eigen/test/mapped_matrix.cpp
index ef350b2..bc8a694 100644
--- a/eigen/test/mapped_matrix.cpp
+++ b/eigen/test/mapped_matrix.cpp
@@ -17,7 +17,6 @@
template<typename VectorType> void map_class_vector(const VectorType& m)
{
- typedef typename VectorType::Index Index;
typedef typename VectorType::Scalar Scalar;
Index size = m.size();
@@ -51,7 +50,6 @@ template<typename VectorType> void map_class_vector(const VectorType& m)
template<typename MatrixType> void map_class_matrix(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
Index rows = m.rows(), cols = m.cols(), size = rows*cols;
@@ -122,7 +120,6 @@ template<typename MatrixType> void map_class_matrix(const MatrixType& m)
template<typename VectorType> void map_static_methods(const VectorType& m)
{
- typedef typename VectorType::Index Index;
typedef typename VectorType::Scalar Scalar;
Index size = m.size();
@@ -164,7 +161,6 @@ template<typename Scalar>
void map_not_aligned_on_scalar()
{
typedef Matrix<Scalar,Dynamic,Dynamic> MatrixType;
- typedef typename MatrixType::Index Index;
Index size = 11;
Scalar* array1 = internal::aligned_new<Scalar>((size+1)*(size+1)+1);
Scalar* array2 = reinterpret_cast<Scalar*>(sizeof(Scalar)/2+std::size_t(array1));
diff --git a/eigen/test/mapstaticmethods.cpp b/eigen/test/mapstaticmethods.cpp
index 06272d1..8156ca9 100644
--- a/eigen/test/mapstaticmethods.cpp
+++ b/eigen/test/mapstaticmethods.cpp
@@ -69,7 +69,6 @@ struct mapstaticmethods_impl<PlainObjectType, true, false>
{
static void run(const PlainObjectType& m)
{
- typedef typename PlainObjectType::Index Index;
Index rows = m.rows(), cols = m.cols();
int i = internal::random<int>(2,5), j = internal::random<int>(2,5);
@@ -116,7 +115,6 @@ struct mapstaticmethods_impl<PlainObjectType, true, true>
{
static void run(const PlainObjectType& v)
{
- typedef typename PlainObjectType::Index Index;
Index size = v.size();
int i = internal::random<int>(2,5);
diff --git a/eigen/test/mapstride.cpp b/eigen/test/mapstride.cpp
index de77dc5..d785148 100644
--- a/eigen/test/mapstride.cpp
+++ b/eigen/test/mapstride.cpp
@@ -11,7 +11,6 @@
template<int Alignment,typename VectorType> void map_class_vector(const VectorType& m)
{
- typedef typename VectorType::Index Index;
typedef typename VectorType::Scalar Scalar;
Index size = m.size();
@@ -50,7 +49,6 @@ template<int Alignment,typename VectorType> void map_class_vector(const VectorTy
template<int Alignment,typename MatrixType> void map_class_matrix(const MatrixType& _m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
Index rows = _m.rows(), cols = _m.cols();
diff --git a/eigen/test/miscmatrices.cpp b/eigen/test/miscmatrices.cpp
index ef20dc7..f17291c 100644
--- a/eigen/test/miscmatrices.cpp
+++ b/eigen/test/miscmatrices.cpp
@@ -14,7 +14,6 @@ template<typename MatrixType> void miscMatrices(const MatrixType& m)
/* this test covers the following files:
DiagonalMatrix.h Ones.h
*/
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
Index rows = m.rows();
diff --git a/eigen/test/mixingtypes.cpp b/eigen/test/mixingtypes.cpp
index ad9c2c6..45d79aa 100644
--- a/eigen/test/mixingtypes.cpp
+++ b/eigen/test/mixingtypes.cpp
@@ -8,13 +8,27 @@
// 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/.
-// work around "uninitialized" warnings and give that option some testing
-#define EIGEN_INITIALIZE_MATRICES_BY_ZERO
+#if defined(EIGEN_TEST_PART_7)
#ifndef EIGEN_NO_STATIC_ASSERT
#define EIGEN_NO_STATIC_ASSERT // turn static asserts into runtime asserts in order to check them
#endif
+// ignore double-promotion diagnostic for clang and gcc, if we check for static assertion anyway:
+// TODO do the same for MSVC?
+#if defined(__clang__)
+# if (__clang_major__ * 100 + __clang_minor__) >= 308
+# pragma clang diagnostic ignored "-Wdouble-promotion"
+# endif
+#elif defined(__GNUC__)
+ // TODO is there a minimal GCC version for this? At least g++-4.7 seems to be fine with this.
+# pragma GCC diagnostic ignored "-Wdouble-promotion"
+#endif
+
+#endif
+
+
+
#if defined(EIGEN_TEST_PART_1) || defined(EIGEN_TEST_PART_2) || defined(EIGEN_TEST_PART_3)
#ifndef EIGEN_DONT_VECTORIZE
@@ -35,6 +49,28 @@ using namespace std;
VERIFY_IS_APPROX(XPR,REF); \
VERIFY( g_called && #XPR" not properly optimized");
+template<int SizeAtCompileType>
+void raise_assertion(Index size = SizeAtCompileType)
+{
+ // VERIFY_RAISES_ASSERT(mf+md); // does not even compile
+ Matrix<float, SizeAtCompileType, 1> vf; vf.setRandom(size);
+ Matrix<double, SizeAtCompileType, 1> vd; vd.setRandom(size);
+ VERIFY_RAISES_ASSERT(vf=vd);
+ VERIFY_RAISES_ASSERT(vf+=vd);
+ VERIFY_RAISES_ASSERT(vf-=vd);
+ VERIFY_RAISES_ASSERT(vd=vf);
+ VERIFY_RAISES_ASSERT(vd+=vf);
+ VERIFY_RAISES_ASSERT(vd-=vf);
+
+ // vd.asDiagonal() * mf; // does not even compile
+ // vcd.asDiagonal() * mf; // does not even compile
+
+#if 0 // we get other compilation errors here than just static asserts
+ VERIFY_RAISES_ASSERT(vd.dot(vf));
+#endif
+}
+
+
template<int SizeAtCompileType> void mixingtypes(int size = SizeAtCompileType)
{
typedef std::complex<float> CF;
@@ -69,17 +105,10 @@ template<int SizeAtCompileType> void mixingtypes(int size = SizeAtCompileType)
double epsd = std::sqrt(std::numeric_limits<double>::min EIGEN_EMPTY ());
while(std::abs(sf )<epsf) sf = internal::random<float>();
- while(std::abs(sd )<epsd) sf = internal::random<double>();
+ while(std::abs(sd )<epsd) sd = internal::random<double>();
while(std::abs(scf)<epsf) scf = internal::random<CF>();
while(std::abs(scd)<epsd) scd = internal::random<CD>();
-// VERIFY_RAISES_ASSERT(mf+md); // does not even compile
-
-#ifdef EIGEN_DONT_VECTORIZE
- VERIFY_RAISES_ASSERT(vf=vd);
- VERIFY_RAISES_ASSERT(vf+=vd);
-#endif
-
// check scalar products
VERIFY_MIX_SCALAR(vcf * sf , vcf * complex<float>(sf));
VERIFY_MIX_SCALAR(sd * vcd , complex<double>(sd) * vcd);
@@ -119,9 +148,6 @@ template<int SizeAtCompileType> void mixingtypes(int size = SizeAtCompileType)
// check dot product
vf.dot(vf);
-#if 0 // we get other compilation errors here than just static asserts
- VERIFY_RAISES_ASSERT(vd.dot(vf));
-#endif
VERIFY_IS_APPROX(vcf.dot(vf), vcf.dot(vf.template cast<complex<float> >()));
// check diagonal product
@@ -130,9 +156,6 @@ template<int SizeAtCompileType> void mixingtypes(int size = SizeAtCompileType)
VERIFY_IS_APPROX(mcf * vf.asDiagonal(), mcf * vf.template cast<complex<float> >().asDiagonal());
VERIFY_IS_APPROX(md * vcd.asDiagonal(), md.template cast<complex<double> >() * vcd.asDiagonal());
-// vd.asDiagonal() * mf; // does not even compile
-// vcd.asDiagonal() * mf; // does not even compile
-
// check inner product
VERIFY_IS_APPROX((vf.transpose() * vcf).value(), (vf.template cast<complex<float> >().transpose() * vcf).value());
@@ -296,5 +319,10 @@ void test_mixingtypes()
CALL_SUBTEST_4(mixingtypes<3>());
CALL_SUBTEST_5(mixingtypes<4>());
CALL_SUBTEST_6(mixingtypes<Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE)));
+ CALL_SUBTEST_7(raise_assertion<Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE)));
}
+ CALL_SUBTEST_7(raise_assertion<0>());
+ CALL_SUBTEST_7(raise_assertion<3>());
+ CALL_SUBTEST_7(raise_assertion<4>());
+ CALL_SUBTEST_7(raise_assertion<Dynamic>(0));
}
diff --git a/eigen/test/nomalloc.cpp b/eigen/test/nomalloc.cpp
index 50756c2..b7ea4d3 100644
--- a/eigen/test/nomalloc.cpp
+++ b/eigen/test/nomalloc.cpp
@@ -24,7 +24,6 @@ template<typename MatrixType> void nomalloc(const MatrixType& m)
{
/* this test check no dynamic memory allocation are issued with fixed-size matrices
*/
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
Index rows = m.rows();
diff --git a/eigen/test/permutationmatrices.cpp b/eigen/test/permutationmatrices.cpp
index b2229cf..e885f0e 100644
--- a/eigen/test/permutationmatrices.cpp
+++ b/eigen/test/permutationmatrices.cpp
@@ -14,7 +14,6 @@
using namespace std;
template<typename MatrixType> void permutationmatrices(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime,
Options = MatrixType::Options };
diff --git a/eigen/test/product_extra.cpp b/eigen/test/product_extra.cpp
index e2b855b..de2709d 100644
--- a/eigen/test/product_extra.cpp
+++ b/eigen/test/product_extra.cpp
@@ -11,7 +11,6 @@
template<typename MatrixType> void product_extra(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef Matrix<Scalar, 1, Dynamic> RowVectorType;
typedef Matrix<Scalar, Dynamic, 1> ColVectorType;
diff --git a/eigen/test/product_notemporary.cpp b/eigen/test/product_notemporary.cpp
index 30592b7..28865d3 100644
--- a/eigen/test/product_notemporary.cpp
+++ b/eigen/test/product_notemporary.cpp
@@ -15,7 +15,6 @@ template<typename MatrixType> void product_notemporary(const MatrixType& m)
{
/* This test checks the number of temporaries created
* during the evaluation of a complex expression */
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::RealScalar RealScalar;
typedef Matrix<Scalar, 1, Dynamic> RowVectorType;
diff --git a/eigen/test/product_selfadjoint.cpp b/eigen/test/product_selfadjoint.cpp
index 3d768aa..88d6839 100644
--- a/eigen/test/product_selfadjoint.cpp
+++ b/eigen/test/product_selfadjoint.cpp
@@ -11,7 +11,6 @@
template<typename MatrixType> void product_selfadjoint(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
typedef Matrix<Scalar, 1, MatrixType::RowsAtCompileTime> RowVectorType;
diff --git a/eigen/test/product_symm.cpp b/eigen/test/product_symm.cpp
index 8c44383..7d1042a 100644
--- a/eigen/test/product_symm.cpp
+++ b/eigen/test/product_symm.cpp
@@ -16,7 +16,6 @@ template<typename Scalar, int Size, int OtherSize> void symm(int size = Size, in
typedef Matrix<Scalar, OtherSize, Size> Rhs2;
enum { order = OtherSize==1 ? 0 : RowMajor };
typedef Matrix<Scalar, Size, OtherSize,order> Rhs3;
- typedef typename MatrixType::Index Index;
Index rows = size;
Index cols = size;
diff --git a/eigen/test/product_syrk.cpp b/eigen/test/product_syrk.cpp
index e10f0f2..3ebbe14 100644
--- a/eigen/test/product_syrk.cpp
+++ b/eigen/test/product_syrk.cpp
@@ -11,7 +11,6 @@
template<typename MatrixType> void syrk(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime, RowMajor> RMatrixType;
typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, Dynamic> Rhs1;
diff --git a/eigen/test/product_trmv.cpp b/eigen/test/product_trmv.cpp
index 57a202a..65d66e5 100644
--- a/eigen/test/product_trmv.cpp
+++ b/eigen/test/product_trmv.cpp
@@ -11,7 +11,6 @@
template<typename MatrixType> void trmv(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
diff --git a/eigen/test/qr.cpp b/eigen/test/qr.cpp
index dfcc1e8..5688460 100644
--- a/eigen/test/qr.cpp
+++ b/eigen/test/qr.cpp
@@ -12,8 +12,6 @@
template<typename MatrixType> void qr(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
-
Index rows = m.rows();
Index cols = m.cols();
diff --git a/eigen/test/qr_colpivoting.cpp b/eigen/test/qr_colpivoting.cpp
index 26ed27f..96c0bad 100644
--- a/eigen/test/qr_colpivoting.cpp
+++ b/eigen/test/qr_colpivoting.cpp
@@ -14,8 +14,6 @@
template <typename MatrixType>
void cod() {
- typedef typename MatrixType::Index Index;
-
Index rows = internal::random<Index>(2, EIGEN_TEST_MAX_SIZE);
Index cols = internal::random<Index>(2, EIGEN_TEST_MAX_SIZE);
Index cols2 = internal::random<Index>(2, EIGEN_TEST_MAX_SIZE);
@@ -94,7 +92,6 @@ void cod_fixedsize() {
template<typename MatrixType> void qr()
{
using std::sqrt;
- typedef typename MatrixType::Index Index;
Index rows = internal::random<Index>(2,EIGEN_TEST_MAX_SIZE), cols = internal::random<Index>(2,EIGEN_TEST_MAX_SIZE), cols2 = internal::random<Index>(2,EIGEN_TEST_MAX_SIZE);
Index rank = internal::random<Index>(1, (std::min)(rows, cols)-1);
@@ -211,7 +208,6 @@ template<typename MatrixType> void qr_kahan_matrix()
{
using std::sqrt;
using std::abs;
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::RealScalar RealScalar;
diff --git a/eigen/test/qr_fullpivoting.cpp b/eigen/test/qr_fullpivoting.cpp
index 70e89c1..4d8ef68 100644
--- a/eigen/test/qr_fullpivoting.cpp
+++ b/eigen/test/qr_fullpivoting.cpp
@@ -13,8 +13,6 @@
template<typename MatrixType> void qr()
{
- typedef typename MatrixType::Index Index;
-
Index max_size = EIGEN_TEST_MAX_SIZE;
Index min_size = numext::maxi(1,EIGEN_TEST_MAX_SIZE/10);
Index rows = internal::random<Index>(min_size,max_size),
diff --git a/eigen/test/qtvector.cpp b/eigen/test/qtvector.cpp
index 2be885e..22df0d5 100644
--- a/eigen/test/qtvector.cpp
+++ b/eigen/test/qtvector.cpp
@@ -18,8 +18,6 @@
template<typename MatrixType>
void check_qtvector_matrix(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
-
Index rows = m.rows();
Index cols = m.cols();
MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols);
diff --git a/eigen/test/real_qz.cpp b/eigen/test/real_qz.cpp
index 99ac312..3c1492e 100644
--- a/eigen/test/real_qz.cpp
+++ b/eigen/test/real_qz.cpp
@@ -18,7 +18,6 @@ template<typename MatrixType> void real_qz(const MatrixType& m)
RealQZ.h
*/
using std::abs;
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
Index dim = m.cols();
diff --git a/eigen/test/redux.cpp b/eigen/test/redux.cpp
index 2bade37..213f080 100644
--- a/eigen/test/redux.cpp
+++ b/eigen/test/redux.cpp
@@ -16,7 +16,6 @@
template<typename MatrixType> void matrixRedux(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::RealScalar RealScalar;
@@ -81,7 +80,6 @@ template<typename MatrixType> void matrixRedux(const MatrixType& m)
template<typename VectorType> void vectorRedux(const VectorType& w)
{
using std::abs;
- typedef typename VectorType::Index Index;
typedef typename VectorType::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
Index size = w.size();
diff --git a/eigen/test/ref.cpp b/eigen/test/ref.cpp
index 9dd2c04..704495a 100644
--- a/eigen/test/ref.cpp
+++ b/eigen/test/ref.cpp
@@ -32,7 +32,6 @@
template<typename MatrixType> void ref_matrix(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::RealScalar RealScalar;
typedef Matrix<Scalar,Dynamic,Dynamic,MatrixType::Options> DynMatrixType;
@@ -80,7 +79,6 @@ template<typename MatrixType> void ref_matrix(const MatrixType& m)
template<typename VectorType> void ref_vector(const VectorType& m)
{
- typedef typename VectorType::Index Index;
typedef typename VectorType::Scalar Scalar;
typedef typename VectorType::RealScalar RealScalar;
typedef Matrix<Scalar,Dynamic,1,VectorType::Options> DynMatrixType;
diff --git a/eigen/test/schur_real.cpp b/eigen/test/schur_real.cpp
index 4aede87..e5229e6 100644
--- a/eigen/test/schur_real.cpp
+++ b/eigen/test/schur_real.cpp
@@ -13,8 +13,6 @@
template<typename MatrixType> void verifyIsQuasiTriangular(const MatrixType& T)
{
- typedef typename MatrixType::Index Index;
-
const Index size = T.cols();
typedef typename MatrixType::Scalar Scalar;
diff --git a/eigen/test/selfadjoint.cpp b/eigen/test/selfadjoint.cpp
index aaa4888..bb11cc3 100644
--- a/eigen/test/selfadjoint.cpp
+++ b/eigen/test/selfadjoint.cpp
@@ -15,7 +15,6 @@
template<typename MatrixType> void selfadjoint(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
Index rows = m.rows();
diff --git a/eigen/test/sparse_basic.cpp b/eigen/test/sparse_basic.cpp
index f84b6e3..d0ef722 100644
--- a/eigen/test/sparse_basic.cpp
+++ b/eigen/test/sparse_basic.cpp
@@ -630,7 +630,8 @@ void big_sparse_triplet(Index rows, Index cols, double density) {
{
Index r = internal::random<Index>(0,rows-1);
Index c = internal::random<Index>(0,cols-1);
- Scalar v = internal::random<Scalar>();
+ // use positive values to prevent numerical cancellation errors in sum
+ Scalar v = numext::abs(internal::random<Scalar>());
triplets.push_back(TripletType(r,c,v));
sum += v;
}
diff --git a/eigen/test/stable_norm.cpp b/eigen/test/stable_norm.cpp
index 3c02474..ac8b129 100644
--- a/eigen/test/stable_norm.cpp
+++ b/eigen/test/stable_norm.cpp
@@ -21,7 +21,6 @@ template<typename MatrixType> void stable_norm(const MatrixType& m)
*/
using std::sqrt;
using std::abs;
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
diff --git a/eigen/test/stddeque.cpp b/eigen/test/stddeque.cpp
index bb4b476..b511c4e 100644
--- a/eigen/test/stddeque.cpp
+++ b/eigen/test/stddeque.cpp
@@ -15,8 +15,6 @@
template<typename MatrixType>
void check_stddeque_matrix(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
-
Index rows = m.rows();
Index cols = m.cols();
MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols);
diff --git a/eigen/test/stdlist.cpp b/eigen/test/stdlist.cpp
index 17cce77..23cbe90 100644
--- a/eigen/test/stdlist.cpp
+++ b/eigen/test/stdlist.cpp
@@ -15,8 +15,6 @@
template<typename MatrixType>
void check_stdlist_matrix(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
-
Index rows = m.rows();
Index cols = m.cols();
MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols);
diff --git a/eigen/test/stdvector.cpp b/eigen/test/stdvector.cpp
index 50cb334..fa928ea 100644
--- a/eigen/test/stdvector.cpp
+++ b/eigen/test/stdvector.cpp
@@ -117,6 +117,16 @@ void check_stdvector_quaternion(const QuaternionType&)
}
}
+// the code below triggered an invalid warning with gcc >= 7
+// eigen/Eigen/src/Core/util/Memory.h:189:12: warning: argument 1 value '18446744073709551612' exceeds maximum object size 9223372036854775807
+// This has been reported to gcc there: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87544
+void std_vector_gcc_warning()
+{
+ typedef Eigen::Vector3f T;
+ std::vector<T, Eigen::aligned_allocator<T> > v;
+ v.push_back(T());
+}
+
void test_stdvector()
{
// some non vectorizable fixed sizes
diff --git a/eigen/test/svd_common.h b/eigen/test/svd_common.h
index 605d5df..cba0665 100644
--- a/eigen/test/svd_common.h
+++ b/eigen/test/svd_common.h
@@ -23,7 +23,6 @@
template<typename SvdType, typename MatrixType>
void svd_check_full(const MatrixType& m, const SvdType& svd)
{
- typedef typename MatrixType::Index Index;
Index rows = m.rows();
Index cols = m.cols();
@@ -101,7 +100,6 @@ void svd_least_square(const MatrixType& m, unsigned int computationOptions)
{
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::RealScalar RealScalar;
- typedef typename MatrixType::Index Index;
Index rows = m.rows();
Index cols = m.cols();
@@ -168,7 +166,6 @@ template<typename MatrixType>
void svd_min_norm(const MatrixType& m, unsigned int computationOptions)
{
typedef typename MatrixType::Scalar Scalar;
- typedef typename MatrixType::Index Index;
Index cols = m.cols();
enum {
@@ -261,7 +258,6 @@ void svd_test_all_computation_options(const MatrixType& m, bool full_only)
CALL_SUBTEST(( svd_min_norm(m, ComputeThinU | ComputeThinV) ));
// test reconstruction
- typedef typename MatrixType::Index Index;
Index diagSize = (std::min)(m.rows(), m.cols());
SvdType svd(m, ComputeThinU | ComputeThinV);
VERIFY_IS_APPROX(m, svd.matrixU().leftCols(diagSize) * svd.singularValues().asDiagonal() * svd.matrixV().leftCols(diagSize).adjoint());
@@ -437,7 +433,6 @@ template<typename SvdType,typename MatrixType>
void svd_verify_assert(const MatrixType& m)
{
typedef typename MatrixType::Scalar Scalar;
- typedef typename MatrixType::Index Index;
Index rows = m.rows();
Index cols = m.cols();
diff --git a/eigen/test/svd_fill.h b/eigen/test/svd_fill.h
index 3877c0c..d68647e 100644
--- a/eigen/test/svd_fill.h
+++ b/eigen/test/svd_fill.h
@@ -23,7 +23,6 @@ void svd_fill_random(MatrixType &m, int Option = 0)
using std::pow;
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::RealScalar RealScalar;
- typedef typename MatrixType::Index Index;
Index diagSize = (std::min)(m.rows(), m.cols());
RealScalar s = std::numeric_limits<RealScalar>::max_exponent10/4;
s = internal::random<RealScalar>(1,s);
diff --git a/eigen/test/triangular.cpp b/eigen/test/triangular.cpp
index b968564..328eef4 100644
--- a/eigen/test/triangular.cpp
+++ b/eigen/test/triangular.cpp
@@ -134,7 +134,6 @@ template<typename MatrixType> void triangular_square(const MatrixType& m)
template<typename MatrixType> void triangular_rect(const MatrixType& m)
{
- typedef const typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime };
diff --git a/eigen/test/vectorwiseop.cpp b/eigen/test/vectorwiseop.cpp
index f3ab561..a099d17 100644
--- a/eigen/test/vectorwiseop.cpp
+++ b/eigen/test/vectorwiseop.cpp
@@ -15,7 +15,6 @@
template<typename ArrayType> void vectorwiseop_array(const ArrayType& m)
{
- typedef typename ArrayType::Index Index;
typedef typename ArrayType::Scalar Scalar;
typedef Array<Scalar, ArrayType::RowsAtCompileTime, 1> ColVectorType;
typedef Array<Scalar, 1, ArrayType::ColsAtCompileTime> RowVectorType;
@@ -129,7 +128,6 @@ template<typename ArrayType> void vectorwiseop_array(const ArrayType& m)
template<typename MatrixType> void vectorwiseop_matrix(const MatrixType& m)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> ColVectorType;
diff --git a/eigen/test/visitor.cpp b/eigen/test/visitor.cpp
index 844170e..7f4efab 100644
--- a/eigen/test/visitor.cpp
+++ b/eigen/test/visitor.cpp
@@ -12,7 +12,6 @@
template<typename MatrixType> void matrixVisitor(const MatrixType& p)
{
typedef typename MatrixType::Scalar Scalar;
- typedef typename MatrixType::Index Index;
Index rows = p.rows();
Index cols = p.cols();
@@ -65,7 +64,6 @@ template<typename MatrixType> void matrixVisitor(const MatrixType& p)
template<typename VectorType> void vectorVisitor(const VectorType& w)
{
typedef typename VectorType::Scalar Scalar;
- typedef typename VectorType::Index Index;
Index size = w.size();
diff --git a/eigen/unsupported/Eigen/CXX11/Tensor b/eigen/unsupported/Eigen/CXX11/Tensor
index 7ecb4c7..bb6523d 100644
--- a/eigen/unsupported/Eigen/CXX11/Tensor
+++ b/eigen/unsupported/Eigen/CXX11/Tensor
@@ -39,6 +39,8 @@
* \code
* #include <Eigen/CXX11/Tensor>
* \endcode
+ *
+ * Much of the documentation can be found \ref eigen_tensors "here".
*/
#include <cmath>
diff --git a/eigen/unsupported/Eigen/CXX11/src/Tensor/README.md b/eigen/unsupported/Eigen/CXX11/src/Tensor/README.md
index 98e8381..da70fa2 100644
--- a/eigen/unsupported/Eigen/CXX11/src/Tensor/README.md
+++ b/eigen/unsupported/Eigen/CXX11/src/Tensor/README.md
@@ -1,4 +1,4 @@
-# Eigen Tensors
+# Eigen Tensors {#eigen_tensors}
Tensors are multidimensional arrays of elements. Elements are typically scalars,
but more complex types such as strings are also supported.
@@ -8,7 +8,7 @@ but more complex types such as strings are also supported.
## Tensor Classes
You can manipulate a tensor with one of the following classes. They all are in
-the namespace ```::Eigen.```
+the namespace `::Eigen.`
### Class Tensor<data_type, rank>
@@ -21,10 +21,10 @@ matrix.
Tensors of this class are resizable. For example, if you assign a tensor of a
different size to a Tensor, that tensor is resized to match its new value.
-#### Constructor Tensor<data_type, rank>(size0, size1, ...)
+#### Constructor `Tensor<data_type, rank>(size0, size1, ...)`
-Constructor for a Tensor. The constructor must be passed ```rank``` integers
-indicating the sizes of the instance along each of the the ```rank```
+Constructor for a Tensor. The constructor must be passed `rank` integers
+indicating the sizes of the instance along each of the the `rank`
dimensions.
// Create a tensor of rank 3 of sizes 2, 3, 4. This tensor owns
@@ -34,18 +34,18 @@ dimensions.
// Resize t_3d by assigning a tensor of different sizes, but same rank.
t_3d = Tensor<float, 3>(3, 4, 3);
-#### Constructor Tensor<data_type, rank>(size_array)
+#### Constructor `Tensor<data_type, rank>(size_array)`
Constructor where the sizes for the constructor are specified as an array of
values instead of an explicitly list of parameters. The array type to use is
-```Eigen::array<Eigen::Index>```. The array can be constructed automatically
+`Eigen::array<Eigen::Index>`. The array can be constructed automatically
from an initializer list.
// Create a tensor of strings of rank 2 with sizes 5, 7.
Tensor<string, 2> t_2d({5, 7});
-### Class TensorFixedSize<data_type, Sizes<size0, size1, ...>>
+### Class `TensorFixedSize<data_type, Sizes<size0, size1, ...>>`
Class to use for tensors of fixed size, where the size is known at compile
time. Fixed sized tensors can provide very fast computations because all their
@@ -57,7 +57,7 @@ tensor data is held onto the stack and does not cause heap allocation and free.
// Create a 4 x 3 tensor of floats.
TensorFixedSize<float, Sizes<4, 3>> t_4x3;
-### Class TensorMap<Tensor<data_type, rank>>
+### Class `TensorMap<Tensor<data_type, rank>>`
This is the class to use to create a tensor on top of memory allocated and
owned by another part of your code. It allows to view any piece of allocated
@@ -67,7 +67,7 @@ data are stored.
A TensorMap is not resizable because it does not own the memory where its data
are stored.
-#### Constructor TensorMap<Tensor<data_type, rank>>(data, size0, size1, ...)
+#### Constructor `TensorMap<Tensor<data_type, rank>>(data, size0, size1, ...)`
Constructor for a Tensor. The constructor must be passed a pointer to the
storage for the data, and "rank" size attributes. The storage has to be
@@ -83,20 +83,20 @@ large enough to hold all the data.
// You can also map fixed-size tensors. Here we get a 1d view of
// the 2d fixed-size tensor.
- Tensor<float, Sizes<4, 5>> t_4x3;
- TensorMap<Tensor<float, 1>> t_12(t_4x3, 12);
+ TensorFixedSize<float, Sizes<4, 5>> t_4x3;
+ TensorMap<Tensor<float, 1>> t_12(t_4x3.data(), 12);
-#### Class TensorRef
+#### Class `TensorRef`
See Assigning to a TensorRef below.
## Accessing Tensor Elements
-#### <data_type> tensor(index0, index1...)
+#### `<data_type> tensor(index0, index1...)`
-Return the element at position ```(index0, index1...)``` in tensor
-```tensor```. You must pass as many parameters as the rank of ```tensor```.
+Return the element at position `(index0, index1...)` in tensor
+`tensor`. You must pass as many parameters as the rank of `tensor`.
The expression can be used as an l-value to set the value of the element at the
specified position. The value returned is of the datatype of the tensor.
@@ -121,8 +121,8 @@ specified position. The value returned is of the datatype of the tensor.
## TensorLayout
-The tensor library supports 2 layouts: ```ColMajor``` (the default) and
-```RowMajor```. Only the default column major layout is currently fully
+The tensor library supports 2 layouts: `ColMajor` (the default) and
+`RowMajor`. Only the default column major layout is currently fully
supported, and it is therefore not recommended to attempt to use the row major
layout at the moment.
@@ -136,7 +136,7 @@ All the arguments to an expression must use the same layout. Attempting to mix
different layouts will result in a compilation error.
It is possible to change the layout of a tensor or an expression using the
-```swap_layout()``` method. Note that this will also reverse the order of the
+`swap_layout()` method. Note that this will also reverse the order of the
dimensions.
Tensor<float, 2, ColMajor> col_major(2, 4);
@@ -173,35 +173,35 @@ the following code computes the elementwise addition of two tensors:
Tensor<float, 3> t3 = t1 + t2;
While the code above looks easy enough, it is important to understand that the
-expression ```t1 + t2``` is not actually adding the values of the tensors. The
+expression `t1 + t2` is not actually adding the values of the tensors. The
expression instead constructs a "tensor operator" object of the class
TensorCwiseBinaryOp<scalar_sum>, which has references to the tensors
-```t1``` and ```t2```. This is a small C++ object that knows how to add
-```t1``` and ```t2```. It is only when the value of the expression is assigned
-to the tensor ```t3``` that the addition is actually performed. Technically,
-this happens through the overloading of ```operator=()``` in the Tensor class.
+`t1` and `t2`. This is a small C++ object that knows how to add
+`t1` and `t2`. It is only when the value of the expression is assigned
+to the tensor `t3` that the addition is actually performed. Technically,
+this happens through the overloading of `operator=()` in the Tensor class.
This mechanism for computing tensor expressions allows for lazy evaluation and
optimizations which are what make the tensor library very fast.
-Of course, the tensor operators do nest, and the expression ```t1 + t2 *
-0.3f``` is actually represented with the (approximate) tree of operators:
+Of course, the tensor operators do nest, and the expression `t1 + t2 * 0.3f`
+is actually represented with the (approximate) tree of operators:
TensorCwiseBinaryOp<scalar_sum>(t1, TensorCwiseUnaryOp<scalar_mul>(t2, 0.3f))
### Tensor Operations and C++ "auto"
-Because Tensor operations create tensor operators, the C++ ```auto``` keyword
+Because Tensor operations create tensor operators, the C++ `auto` keyword
does not have its intuitive meaning. Consider these 2 lines of code:
Tensor<float, 3> t3 = t1 + t2;
auto t4 = t1 + t2;
-In the first line we allocate the tensor ```t3``` and it will contain the
-result of the addition of ```t1``` and ```t2```. In the second line, ```t4```
+In the first line we allocate the tensor `t3` and it will contain the
+result of the addition of `t1` and `t2`. In the second line, `t4`
is actually the tree of tensor operators that will compute the addition of
-```t1``` and ```t2```. In fact, ```t4``` is *not* a tensor and you cannot get
+`t1` and `t2`. In fact, `t4` is *not* a tensor and you cannot get
the values of its elements:
Tensor<float, 3> t3 = t1 + t2;
@@ -210,8 +210,8 @@ the values of its elements:
auto t4 = t1 + t2;
cout << t4(0, 0, 0); // Compilation error!
-When you use ```auto``` you do not get a Tensor as a result but instead a
-non-evaluated expression. So only use ```auto``` to delay evaluation.
+When you use `auto` you do not get a Tensor as a result but instead a
+non-evaluated expression. So only use `auto` to delay evaluation.
Unfortunately, there is no single underlying concrete type for holding
non-evaluated expressions, hence you have to use auto in the case when you do
@@ -257,9 +257,9 @@ There are several ways to control when expressions are evaluated:
#### Assigning to a Tensor, TensorFixedSize, or TensorMap.
The most common way to evaluate an expression is to assign it to a Tensor. In
-the example below, the ```auto``` declarations make the intermediate values
+the example below, the `auto` declarations make the intermediate values
"Operations", not Tensors, and do not cause the expressions to be evaluated.
-The assignment to the Tensor ```result``` causes the evaluation of all the
+The assignment to the Tensor `result` causes the evaluation of all the
operations.
auto t3 = t1 + t2; // t3 is an Operation.
@@ -272,17 +272,17 @@ Operation to a TensorFixedSize instead of a Tensor, which is a bit more
efficient.
// We know that the result is a 4x4x2 tensor!
- TensorFixedSize<float, 4, 4, 2> result = t5;
+ TensorFixedSize<float, Sizes<4, 4, 2>> result = t5;
Simiarly, assigning an expression to a TensorMap causes its evaluation. Like
tensors of type TensorFixedSize, TensorMaps cannot be resized so they have to
have the rank and sizes of the expression that are assigned to them.
-#### Calling eval().
+#### Calling `eval()`.
When you compute large composite expressions, you sometimes want to tell Eigen
that an intermediate value in the expression tree is worth evaluating ahead of
-time. This is done by inserting a call to the ```eval()``` method of the
+time. This is done by inserting a call to the `eval()` method of the
expression Operation.
// The previous example could have been written:
@@ -291,15 +291,15 @@ expression Operation.
// If you want to compute (t1 + t2) once ahead of time you can write:
Tensor<float, 3> result = ((t1 + t2).eval() * 0.2f).exp();
-Semantically, calling ```eval()``` is equivalent to materializing the value of
+Semantically, calling `eval()` is equivalent to materializing the value of
the expression in a temporary Tensor of the right size. The code above in
effect does:
// .eval() knows the size!
- TensorFixedSize<float, 4, 4, 2> tmp = t1 + t2;
+ TensorFixedSize<float, Sizes<4, 4, 2>> tmp = t1 + t2;
Tensor<float, 3> result = (tmp * 0.2f).exp();
-Note that the return value of ```eval()``` is itself an Operation, so the
+Note that the return value of `eval()` is itself an Operation, so the
following code does not do what you may think:
// Here t3 is an evaluation Operation. t3 has not been evaluated yet.
@@ -312,24 +312,24 @@ following code does not do what you may think:
// an intermediate tensor to represent t3.x
Tensor<float, 3> result = t4;
-While in the examples above calling ```eval()``` does not make a difference in
+While in the examples above calling `eval()` does not make a difference in
performance, in other cases it can make a huge difference. In the expression
-below the ```broadcast()``` expression causes the ```X.maximum()``` expression
+below the `broadcast()` expression causes the `X.maximum()` expression
to be evaluated many times:
Tensor<...> X ...;
Tensor<...> Y = ((X - X.maximum(depth_dim).reshape(dims2d).broadcast(bcast))
* beta).exp();
-Inserting a call to ```eval()``` between the ```maximum()``` and
-```reshape()``` calls guarantees that maximum() is only computed once and
+Inserting a call to `eval()` between the `maximum()` and
+`reshape()` calls guarantees that maximum() is only computed once and
greatly speeds-up execution:
Tensor<...> Y =
((X - X.maximum(depth_dim).eval().reshape(dims2d).broadcast(bcast))
* beta).exp();
-In the other example below, the tensor ```Y``` is both used in the expression
+In the other example below, the tensor `Y` is both used in the expression
and its assignment. This is an aliasing problem and if the evaluation is not
done in the right order Y will be updated incrementally during the evaluation
resulting in bogus results:
@@ -337,8 +337,8 @@ resulting in bogus results:
Tensor<...> Y ...;
Y = Y / (Y.sum(depth_dim).reshape(dims2d).broadcast(bcast));
-Inserting a call to ```eval()``` between the ```sum()``` and ```reshape()```
-expressions ensures that the sum is computed before any updates to ```Y``` are
+Inserting a call to `eval()` between the `sum()` and `reshape()`
+expressions ensures that the sum is computed before any updates to `Y` are
done.
Y = Y / (Y.sum(depth_dim).eval().reshape(dims2d).broadcast(bcast));
@@ -347,21 +347,21 @@ Note that an eval around the full right hand side expression is not needed
because the generated has to compute the i-th value of the right hand side
before assigning it to the left hand side.
-However, if you were assigning the expression value to a shuffle of ```Y```
-then you would need to force an eval for correctness by adding an ```eval()```
+However, if you were assigning the expression value to a shuffle of `Y`
+then you would need to force an eval for correctness by adding an `eval()`
call for the right hand side:
Y.shuffle(...) =
(Y / (Y.sum(depth_dim).eval().reshape(dims2d).broadcast(bcast))).eval();
-#### Assigning to a TensorRef.
+#### Assigning to a `TensorRef`.
If you need to access only a few elements from the value of an expression you
can avoid materializing the value in a full tensor by using a TensorRef.
A TensorRef is a small wrapper class for any Eigen Operation. It provides
-overloads for the ```()``` operator that let you access individual values in
+overloads for the `()` operator that let you access individual values in
the expression. TensorRef is convenient, because the Operation themselves do
not provide a way to access individual elements.
@@ -390,7 +390,7 @@ such as contractions and convolutions. The implementations are optimized for
different environments: single threaded on CPU, multi threaded on CPU, or on a
GPU using cuda. Additional implementations may be added later.
-You can choose which implementation to use with the ```device()``` call. If
+You can choose which implementation to use with the `device()` call. If
you do not choose an implementation explicitly the default implementation that
uses a single thread on the CPU is used.
@@ -406,7 +406,7 @@ single-threaded CPU implementation:
Tensor<float, 2> b(30, 40);
Tensor<float, 2> c = a + b;
-To choose a different implementation you have to insert a ```device()``` call
+To choose a different implementation you have to insert a `device()` call
before the assignment of the result. For technical C++ reasons this requires
that the Tensor for the result be declared on its own. This means that you
have to know the size of the result.
@@ -414,16 +414,16 @@ have to know the size of the result.
Eigen::Tensor<float, 2> c(30, 40);
c.device(...) = a + b;
-The call to ```device()``` must be the last call on the left of the operator=.
+The call to `device()` must be the last call on the left of the operator=.
-You must pass to the ```device()``` call an Eigen device object. There are
+You must pass to the `device()` call an Eigen device object. There are
presently three devices you can use: DefaultDevice, ThreadPoolDevice and
GpuDevice.
#### Evaluating With the DefaultDevice
-This is exactly the same as not inserting a ```device()``` call.
+This is exactly the same as not inserting a `device()` call.
DefaultDevice my_device;
c.device(my_device) = a + b;
@@ -452,24 +452,24 @@ memory for tensors with cuda.
In the documentation of the tensor methods and Operation we mention datatypes
that are tensor-type specific:
-#### <Tensor-Type>::Dimensions
+#### `<Tensor-Type>::``Dimensions`
-Acts like an array of ints. Has an ```int size``` attribute, and can be
+Acts like an array of ints. Has an `int size` attribute, and can be
indexed like an array to access individual values. Used to represent the
-dimensions of a tensor. See ```dimensions()```.
+dimensions of a tensor. See `dimensions()`.
-#### <Tensor-Type>::Index
+#### `<Tensor-Type>::``Index`
-Acts like an ```int```. Used for indexing tensors along their dimensions. See
-```operator()```, ```dimension()```, and ```size()```.
+Acts like an `int`. Used for indexing tensors along their dimensions. See
+`operator()`, `dimension()`, and `size()`.
-#### <Tensor-Type>::Scalar
+#### `<Tensor-Type>::``Scalar`
Represents the datatype of individual tensor elements. For example, for a
-```Tensor<float>```, ```Scalar``` is the type ```float```. See
-```setConstant()```.
+`Tensor<float>`, `Scalar` is the type `float`. See
+`setConstant()`.
-#### <Operation>
+#### `<Operation>`
We use this pseudo type to indicate that a tensor Operation is returned by a
method. We indicate in the text the type and dimensions of the tensor that the
@@ -489,7 +489,7 @@ Tensor, TensorFixedSize, and TensorMap.
## Metadata
-### int NumDimensions
+### `int NumDimensions`
Constant value indicating the number of dimensions of a Tensor. This is also
known as the tensor "rank".
@@ -498,10 +498,10 @@ known as the tensor "rank".
cout << "Dims " << a.NumDimensions;
=> Dims 2
-### Dimensions dimensions()
+### `Dimensions dimensions()`
Returns an array-like object representing the dimensions of the tensor.
-The actual type of the dimensions() result is <Tensor-Type>::Dimensions.
+The actual type of the `dimensions()` result is `<Tensor-Type>::``Dimensions`.
Eigen::Tensor<float, 2> a(3, 4);
const Eigen::Tensor<float, 2>::Dimensions& d = a.dimensions();
@@ -509,17 +509,17 @@ The actual type of the dimensions() result is <Tensor-Type>::Dimensions.
<< ", dim 1: " << d[1];
=> Dim size: 2, dim 0: 3, dim 1: 4
-If you use a C++11 compiler, you can use ```auto``` to simplify the code:
+If you use a C++11 compiler, you can use `auto` to simplify the code:
const auto& d = a.dimensions();
cout << "Dim size: " << d.size << ", dim 0: " << d[0]
<< ", dim 1: " << d[1];
=> Dim size: 2, dim 0: 3, dim 1: 4
-### Index dimension(Index n)
+### `Index dimension(Index n)`
Returns the n-th dimension of the tensor. The actual type of the
-```dimension()``` result is ```<Tensor-Type>::Index```, but you can
+`dimension()` result is `<Tensor-Type>::``Index`, but you can
always use it like an int.
Eigen::Tensor<float, 2> a(3, 4);
@@ -527,11 +527,11 @@ always use it like an int.
cout << "Dim 1: " << dim1;
=> Dim 1: 4
-### Index size()
+### `Index size()`
Returns the total number of elements in the tensor. This is the product of all
-the tensor dimensions. The actual type of the ```size()``` result is
-```<Tensor-Type>::Index```, but you can always use it like an int.
+the tensor dimensions. The actual type of the `size()` result is
+`<Tensor-Type>::``Index`, but you can always use it like an int.
Eigen::Tensor<float, 2> a(3, 4);
cout << "Size: " << a.size();
@@ -540,11 +540,11 @@ the tensor dimensions. The actual type of the ```size()``` result is
### Getting Dimensions From An Operation
-A few operations provide ```dimensions()``` directly,
-e.g. ```TensorReslicingOp```. Most operations defer calculating dimensions
+A few operations provide `dimensions()` directly,
+e.g. `TensorReslicingOp`. Most operations defer calculating dimensions
until the operation is being evaluated. If you need access to the dimensions
of a deferred operation, you can wrap it in a TensorRef (see Assigning to a
-TensorRef above), which provides ```dimensions()``` and ```dimension()``` as
+TensorRef above), which provides `dimensions()` and `dimension()` as
above.
TensorRef can also wrap the plain Tensor types, so this is a useful idiom in
@@ -567,11 +567,11 @@ to the rank of the tensor. The content of the tensor is not initialized.
### TensorFixedSize
-Creates a tensor of the specified size. The number of arguments in the Size<>
+Creates a tensor of the specified size. The number of arguments in the Sizes<>
template parameter determines the rank of the tensor. The content of the tensor
is not initialized.
- Eigen::TensorFixedSize<float, Size<3, 4>> a;
+ Eigen::TensorFixedSize<float, Sizes<3, 4>> a;
cout << "Rank: " << a.rank() << endl;
=> Rank: 2
cout << "NumRows: " << a.dimension(0) << " NumCols: " << a.dimension(1) << endl;
@@ -581,14 +581,14 @@ is not initialized.
Creates a tensor mapping an existing array of data. The data must not be freed
until the TensorMap is discarded, and the size of the data must be large enough
-to accomodate of the coefficients of the tensor.
+to accommodate the coefficients of the tensor.
float data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
- Eigen::TensorMap<float, 2> a(data, 3, 4);
+ Eigen::TensorMap<Tensor<float, 2>> a(data, 3, 4);
cout << "NumRows: " << a.dimension(0) << " NumCols: " << a.dimension(1) << endl;
=> NumRows: 3 NumCols: 4
cout << "a(1, 2): " << a(1, 2) << endl;
- => a(1, 2): 9
+ => a(1, 2): 7
## Contents Initialization
@@ -602,9 +602,9 @@ You can use one of the methods below to initialize the tensor memory. These
have an immediate effect on the tensor and return the tensor itself as a
result. These are not tensor Operations which delay evaluation.
-### <Tensor-Type> setConstant(const Scalar& val)
+### `<Tensor-Type> setConstant(const Scalar& val)`
-Sets all elements of the tensor to the constant value ```val```. ```Scalar```
+Sets all elements of the tensor to the constant value `val`. `Scalar`
is the type of data stored in the tensor. You can pass any value that is
convertible to that type.
@@ -618,8 +618,8 @@ Returns the tensor itself in case you want to chain another call.
12.3 12.3 12.3 12.3
12.3 12.3 12.3 12.3
-Note that ```setConstant()``` can be used on any tensor where the element type
-has a copy constructor and an ```operator=()```:
+Note that `setConstant()` can be used on any tensor where the element type
+has a copy constructor and an `operator=()`:
Eigen::Tensor<string, 2> a(2, 3);
a.setConstant("yolo");
@@ -630,9 +630,9 @@ has a copy constructor and an ```operator=()```:
yolo yolo yolo
-### <Tensor-Type> setZero()
+### `<Tensor-Type> setZero()`
-Fills the tensor with zeros. Equivalent to ```setConstant(Scalar(0))```.
+Fills the tensor with zeros. Equivalent to `setConstant(Scalar(0))`.
Returns the tensor itself in case you want to chain another call.
a.setZero();
@@ -644,7 +644,7 @@ Returns the tensor itself in case you want to chain another call.
0 0 0 0
-### <Tensor-Type> setValues({..initializer_list})
+### `<Tensor-Type> setValues({..initializer_list})`
Fills the tensor with explicit values specified in a std::initializer_list.
The type of the initializer list depends on the type and rank of the tensor.
@@ -653,10 +653,10 @@ If the tensor has rank N, the initializer list must be nested N times. The
most deeply nested lists must contains P scalars of the Tensor type where P is
the size of the last dimension of the Tensor.
-For example, for a ```TensorFixedSize<float, 2, 3>``` the initializer list must
+For example, for a `TensorFixedSize<float, 2, 3>` the initializer list must
contains 2 lists of 3 floats each.
-```setValues()``` returns the tensor itself in case you want to chain another
+`setValues()` returns the tensor itself in case you want to chain another
call.
Eigen::Tensor<float, 2> a(2, 3);
@@ -680,7 +680,7 @@ code only sets the values of the first row of the tensor.
10 20 30
1000 1000 1000
-### <Tensor-Type> setRandom()
+### `<Tensor-Type> setRandom()`
Fills the tensor with random values. Returns the tensor itself in case you
want to chain another call.
@@ -693,16 +693,16 @@ want to chain another call.
-0.211234 0.823295 0.536459 -0.0452059
0.566198 -0.604897 -0.444451 0.257742
-You can customize ```setRandom()``` by providing your own random number
+You can customize `setRandom()` by providing your own random number
generator as a template argument:
a.setRandom<MyRandomGenerator>();
-Here, ```MyRandomGenerator``` must be a struct with the following member
-functions, where Scalar and Index are the same as ```<Tensor-Type>::Scalar```
-and ```<Tensor-Type>::Index```.
+Here, `MyRandomGenerator` must be a struct with the following member
+functions, where Scalar and Index are the same as `<Tensor-Type>::``Scalar`
+and `<Tensor-Type>::``Index`.
-See ```struct UniformRandomGenerator``` in TensorFunctors.h for an example.
+See `struct UniformRandomGenerator` in TensorFunctors.h for an example.
// Custom number generator for use with setRandom().
struct MyRandomGenerator {
@@ -747,7 +747,7 @@ values of a tensor expression, the expression must either be evaluated or
wrapped in a TensorRef.
-### Scalar* data() and const Scalar* data() const
+### `Scalar* data()` and `const Scalar* data() const`
Returns a pointer to the storage for the tensor. The pointer is const if the
tensor was const. This allows direct access to the data. The layout of the
@@ -767,7 +767,7 @@ Scalar is the type of data stored in the tensor.
## Tensor Operations
-All the methods documented below return non evaluated tensor ```Operations```.
+All the methods documented below return non evaluated tensor `Operations`.
These can be chained: you can apply another Tensor Operation to the value
returned by the method.
@@ -775,10 +775,10 @@ The chain of Operation is evaluated lazily, typically when it is assigned to a
tensor. See "Controlling when Expression are Evaluated" for more details about
their evaluation.
-### <Operation> constant(const Scalar& val)
+### `<Operation> constant(const Scalar& val)`
Returns a tensor of the same type and dimensions as the original tensor but
-where all elements have the value ```val```.
+where all elements have the value `val`.
This is useful, for example, when you want to add or subtract a constant from a
tensor, or multiply every element of a tensor by a scalar.
@@ -803,14 +803,14 @@ tensor, or multiply every element of a tensor by a scalar.
0.6 0.6 0.6
0.6 0.6 0.6
-### <Operation> random()
+### `<Operation> random()`
Returns a tensor of the same type and dimensions as the current tensor
but where all elements have random values.
This is for example useful to add random values to an existing tensor.
The generation of random values can be customized in the same manner
-as for ```setRandom()```.
+as for `setRandom()`.
Eigen::Tensor<float, 2> a(2, 3);
a.setConstant(1.0f);
@@ -833,7 +833,7 @@ All these operations take a single input tensor as argument and return a tensor
of the same type and dimensions as the tensor to which they are applied. The
requested operations are applied to each element independently.
-### <Operation> operator-()
+### `<Operation> operator-()`
Returns a tensor of the same type and dimensions as the original tensor
containing the opposite values of the original tensor.
@@ -852,42 +852,42 @@ containing the opposite values of the original tensor.
-1 -1 -1
-1 -1 -1
-### <Operation> sqrt()
+### `<Operation> sqrt()`
Returns a tensor of the same type and dimensions as the original tensor
containing the square roots of the original tensor.
-### <Operation> rsqrt()
+### `<Operation> rsqrt()`
Returns a tensor of the same type and dimensions as the original tensor
containing the inverse square roots of the original tensor.
-### <Operation> square()
+### `<Operation> square()`
Returns a tensor of the same type and dimensions as the original tensor
containing the squares of the original tensor values.
-### <Operation> inverse()
+### `<Operation> inverse()`
Returns a tensor of the same type and dimensions as the original tensor
containing the inverse of the original tensor values.
-### <Operation> exp()
+### `<Operation> exp()`
Returns a tensor of the same type and dimensions as the original tensor
containing the exponential of the original tensor.
-### <Operation> log()
+### `<Operation> log()`
Returns a tensor of the same type and dimensions as the original tensor
containing the natural logarithms of the original tensor.
-### <Operation> abs()
+### `<Operation> abs()`
Returns a tensor of the same type and dimensions as the original tensor
containing the absolute values of the original tensor.
-### <Operation> pow(Scalar exponent)
+### `<Operation> pow(Scalar exponent)`
Returns a tensor of the same type and dimensions as the original tensor
containing the coefficients of the original tensor to the power of the
@@ -914,17 +914,17 @@ cubic roots of an int Tensor:
0 1 2
3 4 5
-### <Operation> operator * (Scalar scale)
+### `<Operation> operator * (Scalar scale)`
Multiplies all the coefficients of the input tensor by the provided scale.
-### <Operation> cwiseMax(Scalar threshold)
+### `<Operation> cwiseMax(Scalar threshold)`
TODO
-### <Operation> cwiseMin(Scalar threshold)
+### `<Operation> cwiseMin(Scalar threshold)`
TODO
-### <Operation> unaryExpr(const CustomUnaryOp& func)
+### `<Operation> unaryExpr(const CustomUnaryOp& func)`
TODO
@@ -936,39 +936,39 @@ dimensions as the tensors to which they are applied, and unless otherwise
specified it is also of the same type. The requested operations are applied to
each pair of elements independently.
-### <Operation> operator+(const OtherDerived& other)
+### `<Operation> operator+(const OtherDerived& other)`
Returns a tensor of the same type and dimensions as the input tensors
containing the coefficient wise sums of the inputs.
-### <Operation> operator-(const OtherDerived& other)
+### `<Operation> operator-(const OtherDerived& other)`
Returns a tensor of the same type and dimensions as the input tensors
containing the coefficient wise differences of the inputs.
-### <Operation> operator*(const OtherDerived& other)
+### `<Operation> operator*(const OtherDerived& other)`
Returns a tensor of the same type and dimensions as the input tensors
containing the coefficient wise products of the inputs.
-### <Operation> operator/(const OtherDerived& other)
+### `<Operation> operator/(const OtherDerived& other)`
Returns a tensor of the same type and dimensions as the input tensors
containing the coefficient wise quotients of the inputs.
This operator is not supported for integer types.
-### <Operation> cwiseMax(const OtherDerived& other)
+### `<Operation> cwiseMax(const OtherDerived& other)`
Returns a tensor of the same type and dimensions as the input tensors
containing the coefficient wise maximums of the inputs.
-### <Operation> cwiseMin(const OtherDerived& other)
+### `<Operation> cwiseMin(const OtherDerived& other)`
Returns a tensor of the same type and dimensions as the input tensors
containing the coefficient wise mimimums of the inputs.
-### <Operation> Logical operators
+### `<Operation> Logical operators`
The following logical operators are supported as well:
@@ -1013,16 +1013,23 @@ multidimensional case.
Eigen::Tensor<int, 2> a(2, 3);
a.setValues({{1, 2, 3}, {6, 5, 4}});
Eigen::Tensor<int, 2> b(3, 2);
- a.setValues({{1, 2}, {4, 5}, {5, 6}});
+ b.setValues({{1, 2}, {4, 5}, {5, 6}});
// Compute the traditional matrix product
- array<IndexPair<int>, 1> product_dims = { IndexPair(1, 0) };
+ Eigen::array<Eigen::IndexPair<int>, 1> product_dims = { Eigen::IndexPair<int>(1, 0) };
Eigen::Tensor<int, 2> AB = a.contract(b, product_dims);
// Compute the product of the transpose of the matrices
- array<IndexPair<int>, 1> transpose_product_dims = { IndexPair(0, 1) };
+ Eigen::array<Eigen::IndexPair<int>, 1> transposed_product_dims = { Eigen::IndexPair<int>(0, 1) };
Eigen::Tensor<int, 2> AtBt = a.contract(b, transposed_product_dims);
+ // Contraction to scalar value using a double contraction.
+ // First coordinate of both tensors are contracted as well as both second coordinates, i.e., this computes the sum of the squares of the elements.
+ Eigen::array<Eigen::IndexPair<int>, 2> double_contraction_product_dims = { Eigen::IndexPair<int>(0, 0), Eigen::IndexPair<int>(1, 1) };
+ Eigen::Tensor<int, 0> AdoubleContractedA = a.contract(a, double_contraction_product_dims);
+
+ // Extracting the scalar value of the tensor contraction for further usage
+ int value = AdoubleContractedA(0);
## Reduction Operations
@@ -1032,13 +1039,13 @@ original tensor. The values in the returned tensor are computed by applying a
the dimensions along which the slices are made.
The Eigen Tensor library provides a set of predefined reduction operators such
-as ```maximum()``` and ```sum()``` and lets you define additional operators by
+as `maximum()` and `sum()` and lets you define additional operators by
implementing a few methods from a reductor template.
### Reduction Dimensions
All reduction operations take a single parameter of type
-```<TensorType>::Dimensions``` which can always be specified as an array of
+`<TensorType>::``Dimensions` which can always be specified as an array of
ints. These are called the "reduction dimensions." The values are the indices
of the dimensions of the input tensor over which the reduction is done. The
parameter can have at most as many element as the rank of the input tensor;
@@ -1119,52 +1126,52 @@ scalar, represented as a zero-dimension tensor.
276
-### <Operation> sum(const Dimensions& new_dims)
-### <Operation> sum()
+### `<Operation> sum(const Dimensions& new_dims)`
+### `<Operation> sum()`
Reduce a tensor using the sum() operator. The resulting values
are the sum of the reduced values.
-### <Operation> mean(const Dimensions& new_dims)
-### <Operation> mean()
+### `<Operation> mean(const Dimensions& new_dims)`
+### `<Operation> mean()`
Reduce a tensor using the mean() operator. The resulting values
are the mean of the reduced values.
-### <Operation> maximum(const Dimensions& new_dims)
-### <Operation> maximum()
+### `<Operation> maximum(const Dimensions& new_dims)`
+### `<Operation> maximum()`
Reduce a tensor using the maximum() operator. The resulting values are the
largest of the reduced values.
-### <Operation> minimum(const Dimensions& new_dims)
-### <Operation> minimum()
+### `<Operation> minimum(const Dimensions& new_dims)`
+### `<Operation> minimum()`
Reduce a tensor using the minimum() operator. The resulting values
are the smallest of the reduced values.
-### <Operation> prod(const Dimensions& new_dims)
-### <Operation> prod()
+### `<Operation> prod(const Dimensions& new_dims)`
+### `<Operation> prod()`
Reduce a tensor using the prod() operator. The resulting values
are the product of the reduced values.
-### <Operation> all(const Dimensions& new_dims)
-### <Operation> all()
+### `<Operation> all(const Dimensions& new_dims)`
+### `<Operation> all()`
Reduce a tensor using the all() operator. Casts tensor to bool and then checks
whether all elements are true. Runs through all elements rather than
short-circuiting, so may be significantly inefficient.
-### <Operation> any(const Dimensions& new_dims)
-### <Operation> any()
+### `<Operation> any(const Dimensions& new_dims)`
+### `<Operation> any()`
Reduce a tensor using the any() operator. Casts tensor to bool and then checks
whether any element is true. Runs through all elements rather than
short-circuiting, so may be significantly inefficient.
-### <Operation> reduce(const Dimensions& new_dims, const Reducer& reducer)
+### `<Operation> reduce(const Dimensions& new_dims, const Reducer& reducer)`
-Reduce a tensor using a user-defined reduction operator. See ```SumReducer```
+Reduce a tensor using a user-defined reduction operator. See `SumReducer`
in TensorFunctors.h for information on how to implement a reduction operator.
@@ -1191,24 +1198,24 @@ dd a comment to this line
=>
a
1 2 3
- 6 5 4
+ 4 5 6
b
1 3 6
4 9 15
-### <Operation> cumsum(const Index& axis)
+### `<Operation> cumsum(const Index& axis)`
Perform a scan by summing consecutive entries.
-### <Operation> cumprod(const Index& axis)
+### `<Operation> cumprod(const Index& axis)`
Perform a scan by multiplying consecutive entries.
## Convolutions
-### <Operation> convolve(const Kernel& kernel, const Dimensions& dims)
+### `<Operation> convolve(const Kernel& kernel, const Dimensions& dims)`
Returns a tensor that is the output of the convolution of the input tensor with the kernel,
along the specified dimensions of the input tensor. The dimension size for dimensions of the output tensor
@@ -1251,7 +1258,7 @@ These operations return a Tensor with different dimensions than the original
Tensor. They can be used to access slices of tensors, see them with different
dimensions, or pad tensors with additional data.
-### <Operation> reshape(const Dimensions& new_dims)
+### `<Operation> reshape(const Dimensions& new_dims)`
Returns a view of the input tensor that has been reshaped to the specified
new dimensions. The argument new_dims is an array of Index values. The
@@ -1273,7 +1280,7 @@ the number of elements in the input tensor.
This operation does not move any data in the input tensor, so the resulting
contents of a reshaped Tensor depend on the data layout of the original Tensor.
-For example this is what happens when you ```reshape()``` a 2D ColMajor tensor
+For example this is what happens when you `reshape()` a 2D ColMajor tensor
to one dimension:
Eigen::Tensor<float, 2, Eigen::ColMajor> a(2, 3);
@@ -1314,7 +1321,7 @@ The previous example can be rewritten as follow:
Eigen::Tensor<float, 2, Eigen::ColMajor> a(2, 3);
a.setValues({{0.0f, 100.0f, 200.0f}, {300.0f, 400.0f, 500.0f}});
Eigen::array<Eigen::DenseIndex, 2> two_dim({2, 3});
- Eigen::Tensor<float, 1, Eigen::ColMajor> b;
+ Eigen::Tensor<float, 1, Eigen::ColMajor> b(6);
b.reshape(two_dim) = a;
cout << "b" << endl << b << endl;
=>
@@ -1330,7 +1337,7 @@ Note that "b" itself was not reshaped but that instead the assignment is done to
the reshape view of b.
-### <Operation> shuffle(const Shuffle& shuffle)
+### `<Operation> shuffle(const Shuffle& shuffle)`
Returns a copy of the input tensor whose dimensions have been
reordered according to the specified permutation. The argument shuffle
@@ -1371,14 +1378,14 @@ Let's rewrite the previous example to take advantage of this feature:
output.shuffle({2, 0, 1}) = input;
-### <Operation> stride(const Strides& strides)
+### `<Operation> stride(const Strides& strides)`
Returns a view of the input tensor that strides (skips stride-1
elements) along each of the dimensions. The argument strides is an
array of Index values. The dimensions of the resulting tensor are
ceil(input_dimensions[i] / strides[i]).
-For example this is what happens when you ```stride()``` a 2D tensor:
+For example this is what happens when you `stride()` a 2D tensor:
Eigen::Tensor<int, 2> a(4, 3);
a.setValues({{0, 100, 200}, {300, 400, 500}, {600, 700, 800}, {900, 1000, 1100}});
@@ -1397,7 +1404,7 @@ It is possible to assign a tensor to a stride:
output.stride({2, 3, 4}) = input;
-### <Operation> slice(const StartIndices& offsets, const Sizes& extents)
+### `<Operation> slice(const StartIndices& offsets, const Sizes& extents)`
Returns a sub-tensor of the given tensor. For each dimension i, the slice is
made of the coefficients stored between offset[i] and offset[i] + extents[i] in
@@ -1423,7 +1430,7 @@ the input tensor.
600 700
-### <Operation> chip(const Index offset, const Index dim)
+### `<Operation> chip(const Index offset, const Index dim)`
A chip is a special kind of slice. It is the subtensor at the given offset in
the dimension dim. The returned tensor has one fewer dimension than the input
@@ -1474,7 +1481,7 @@ lvalue. For example:
0 0 0
-### <Operation> reverse(const ReverseDimensions& reverse)
+### `<Operation> reverse(const ReverseDimensions& reverse)`
Returns a view of the input tensor that reverses the order of the coefficients
along a subset of the dimensions. The argument reverse is an array of boolean
@@ -1482,7 +1489,7 @@ values that indicates whether or not the order of the coefficients should be
reversed along each of the dimensions. This operation preserves the dimensions
of the input tensor.
-For example this is what happens when you ```reverse()``` the first dimension
+For example this is what happens when you `reverse()` the first dimension
of a 2D tensor:
Eigen::Tensor<int, 2> a(4, 3);
@@ -1504,7 +1511,7 @@ of a 2D tensor:
0 100 200
-### <Operation> broadcast(const Broadcast& broadcast)
+### `<Operation> broadcast(const Broadcast& broadcast)`
Returns a view of the input tensor in which the input is replicated one to many
times.
@@ -1528,11 +1535,11 @@ made in each of the dimensions.
0 100 200 0 100 200
300 400 500 300 400 500
-### <Operation> concatenate(const OtherDerived& other, Axis axis)
+### `<Operation> concatenate(const OtherDerived& other, Axis axis)`
TODO
-### <Operation> pad(const PaddingDimensions& padding)
+### `<Operation> pad(const PaddingDimensions& padding)`
Returns a view of the input tensor in which the input is padded with zeros.
@@ -1557,7 +1564,7 @@ Returns a view of the input tensor in which the input is padded with zeros.
0 0 0 0
-### <Operation> extract_patches(const PatchDims& patch_dims)
+### `<Operation> extract_patches(const PatchDims& patch_dims)`
Returns a tensor of coefficient patches extracted from the input tensor, where
each patch is of dimension specified by 'patch_dims'. The returned tensor has
@@ -1644,9 +1651,7 @@ patch index: 5
6 7
10 11
-### <Operation> extract_image_patches(const Index patch_rows, const Index patch_cols,
- const Index row_stride, const Index col_stride,
- const PaddingType padding_type)
+### `<Operation> extract_image_patches(const Index patch_rows, const Index patch_cols, const Index row_stride, const Index col_stride, const PaddingType padding_type)`
Returns a tensor of coefficient image patches extracted from the input tensor,
which is expected to have dimensions ordered as follows (depending on the data
@@ -1701,7 +1706,7 @@ sizes:
## Special Operations
-### <Operation> cast<T>()
+### `<Operation> cast<T>()`
Returns a tensor of type T with the same dimensions as the original tensor.
The returned tensor contains the values of the original tensor converted to
@@ -1730,18 +1735,16 @@ but you can easily cast the tensors to floats to do the division:
1 2 2
-### <Operation> eval()
+### `<Operation> eval()`
TODO
## Representation of scalar values
-Scalar values are often represented by tensors of size 1 and rank 1. It would be
-more logical and user friendly to use tensors of rank 0 instead. For example
-Tensor<T, N>::maximum() currently returns a Tensor<T, 1>. Similarly, the inner
-product of 2 1d tensors (through contractions) returns a 1d tensor. In the
-future these operations might be updated to return 0d tensors instead.
+Scalar values are often represented by tensors of size 1 and rank 0.For example
+Tensor<T, N>::maximum() currently returns a Tensor<T, 0>. Similarly, the inner
+product of 2 1d tensors (through contractions) returns a 0d tensor.
## Limitations
diff --git a/eigen/unsupported/Eigen/CXX11/src/Tensor/Tensor.h b/eigen/unsupported/Eigen/CXX11/src/Tensor/Tensor.h
index 1940a96..00295a2 100644
--- a/eigen/unsupported/Eigen/CXX11/src/Tensor/Tensor.h
+++ b/eigen/unsupported/Eigen/CXX11/src/Tensor/Tensor.h
@@ -23,12 +23,12 @@ namespace Eigen {
* The %Tensor class encompasses only dynamic-size objects so far.
*
* The first two template parameters are required:
- * \tparam Scalar_ \anchor tensor_tparam_scalar Numeric type, e.g. float, double, int or std::complex<float>.
+ * \tparam Scalar_ Numeric type, e.g. float, double, int or `std::complex<float>`.
* User defined scalar types are supported as well (see \ref user_defined_scalars "here").
* \tparam NumIndices_ Number of indices (i.e. rank of the tensor)
*
* The remaining template parameters are optional -- in most cases you don't have to worry about them.
- * \tparam Options_ \anchor tensor_tparam_options A combination of either \b #RowMajor or \b #ColMajor, and of either
+ * \tparam Options_ A combination of either \b #RowMajor or \b #ColMajor, and of either
* \b #AutoAlign or \b #DontAlign.
* The former controls \ref TopicStorageOrders "storage order", and defaults to column-major. The latter controls alignment, which is required
* for vectorization. It defaults to aligning tensors. Note that tensors currently do not support any operations that profit from vectorization.
@@ -42,13 +42,13 @@ namespace Eigen {
* \endcode
*
* This class can be extended with the help of the plugin mechanism described on the page
- * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_TENSOR_PLUGIN.
+ * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_TENSOR_PLUGIN.
*
* <i><b>Some notes:</b></i>
*
* <dl>
* <dt><b>Relation to other parts of Eigen:</b></dt>
- * <dd>The midterm developement goal for this class is to have a similar hierarchy as Eigen uses for matrices, so that
+ * <dd>The midterm development goal for this class is to have a similar hierarchy as Eigen uses for matrices, so that
* taking blocks or using tensors in expressions is easily possible, including an interface with the vector/matrix code
* by providing .asMatrix() and .asVector() (or similar) methods for rank 2 and 1 tensors. However, currently, the %Tensor
* class does not provide any of these features and is only available as a stand-alone class that just allows for
diff --git a/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h b/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h
index 7a45a5c..f573608 100644
--- a/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h
+++ b/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h
@@ -22,7 +22,9 @@ namespace Eigen {
* This class is the common parent of the Tensor and TensorMap class, thus
* making it possible to use either class interchangably in expressions.
*/
-
+#ifndef EIGEN_PARSED_BY_DOXYGEN
+// FIXME Doxygen does not like the inheritance with different template parameters
+// Since there is no doxygen documentation inside, we disable it for now
template<typename Derived>
class TensorBase<Derived, ReadOnlyAccessors>
{
@@ -1004,7 +1006,7 @@ class TensorBase : public TensorBase<Derived, ReadOnlyAccessors> {
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE const Derived& derived() const { return *static_cast<const Derived*>(this); }
};
-
+#endif // EIGEN_PARSED_BY_DOXYGEN
} // end namespace Eigen
#endif // EIGEN_CXX11_TENSOR_TENSOR_BASE_H
diff --git a/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h b/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h
index ee16cde..c70dea0 100644
--- a/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h
+++ b/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h
@@ -116,15 +116,6 @@ struct TensorEvaluator<const TensorContractionOp<Indices, LeftArgType, RightArgT
template <bool lhs_inner_dim_contiguous, bool rhs_inner_dim_contiguous,
bool rhs_inner_dim_reordered, int Alignment>
void evalProduct(Scalar* buffer) const {
- typedef
- typename internal::remove_const<typename EvalLeftArgType::Scalar>::type
- LhsScalar;
- typedef
- typename internal::remove_const<typename EvalRightArgType::Scalar>::type
- RhsScalar;
- typedef typename internal::gebp_traits<LhsScalar, RhsScalar> Traits;
- typedef TensorEvaluator<EvalLeftArgType, Device> LeftEvaluator;
- typedef TensorEvaluator<EvalRightArgType, Device> RightEvaluator;
typedef internal::TensorContractionInputMapper<
LhsScalar, Index, internal::Lhs, LeftEvaluator, left_nocontract_t,
contract_t, internal::packet_traits<LhsScalar>::size,
diff --git a/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h b/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h
index b24cdeb..451940d 100644
--- a/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h
+++ b/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h
@@ -192,7 +192,7 @@ template <std::size_t V1=0, std::size_t V2=0, std::size_t V3=0, std::size_t V4=0
}
#endif
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DenseIndex operator[] (const int index) const {
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index operator[] (const Index index) const {
switch (index) {
case 0:
return internal::get<0, Base>::value;
@@ -206,7 +206,7 @@ template <std::size_t V1=0, std::size_t V2=0, std::size_t V3=0, std::size_t V4=0
return internal::get<4, Base>::value;
default:
eigen_assert(false && "index overflow");
- return static_cast<DenseIndex>(-1);
+ return static_cast<Index>(-1);
}
}
diff --git a/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h b/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h
index bbd5eb3..8bece4e 100644
--- a/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h
+++ b/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h
@@ -12,19 +12,6 @@
namespace Eigen {
-/** \class TensorForcedEval
- * \ingroup CXX11_Tensor_Module
- *
- * \brief Tensor reshaping class.
- *
- *
- */
-/// template <class> class MakePointer_ is added to convert the host pointer to the device pointer.
-/// It is added due to the fact that for our device compiler T* is not allowed.
-/// If we wanted to use the same Evaluator functions we have to convert that type to our pointer T.
-/// This is done through our MakePointer_ class. By default the Type in the MakePointer_<T> is T* .
-/// Therefore, by adding the default value, we managed to convert the type and it does not break any
-/// existing code as its default value is T*.
namespace internal {
template<typename XprType, template <class> class MakePointer_>
struct traits<TensorForcedEvalOp<XprType, MakePointer_> >
@@ -65,6 +52,21 @@ struct nested<TensorForcedEvalOp<XprType, MakePointer_>, 1, typename eval<Tensor
+// FIXME use proper doxygen documentation (e.g. \tparam MakePointer_)
+
+/** \class TensorForcedEvalOp
+ * \ingroup CXX11_Tensor_Module
+ *
+ * \brief Tensor reshaping class.
+ *
+ *
+ */
+/// `template <class> class MakePointer_` is added to convert the host pointer to the device pointer.
+/// It is added due to the fact that for our device compiler `T*` is not allowed.
+/// If we wanted to use the same Evaluator functions we have to convert that type to our pointer `T`.
+/// This is done through our `MakePointer_` class. By default the Type in the `MakePointer_<T>` is `T*` .
+/// Therefore, by adding the default value, we managed to convert the type and it does not break any
+/// existing code as its default value is `T*`.
template<typename XprType, template <class> class MakePointer_>
class TensorForcedEvalOp : public TensorBase<TensorForcedEvalOp<XprType, MakePointer_>, ReadOnlyAccessors>
{
diff --git a/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h b/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h
index eb1d493..e27753b 100644
--- a/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h
+++ b/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h
@@ -12,7 +12,7 @@
namespace Eigen {
-/** \class TensorGenerator
+/** \class TensorGeneratorOp
* \ingroup CXX11_Tensor_Module
*
* \brief Tensor generator class.
diff --git a/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h b/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h
index a8e5575..e4fc86a 100644
--- a/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h
+++ b/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h
@@ -12,18 +12,20 @@
namespace Eigen {
+// FIXME use proper doxygen documentation (e.g. \tparam MakePointer_)
+
/** \class TensorMap
* \ingroup CXX11_Tensor_Module
*
* \brief A tensor expression mapping an existing array of data.
*
*/
-/// template <class> class MakePointer_ is added to convert the host pointer to the device pointer.
-/// It is added due to the fact that for our device compiler T* is not allowed.
-/// If we wanted to use the same Evaluator functions we have to convert that type to our pointer T.
-/// This is done through our MakePointer_ class. By default the Type in the MakePointer_<T> is T* .
+/// `template <class> class MakePointer_` is added to convert the host pointer to the device pointer.
+/// It is added due to the fact that for our device compiler `T*` is not allowed.
+/// If we wanted to use the same Evaluator functions we have to convert that type to our pointer `T`.
+/// This is done through our `MakePointer_` class. By default the Type in the `MakePointer_<T>` is `T*` .
/// Therefore, by adding the default value, we managed to convert the type and it does not break any
-/// existing code as its default value is T*.
+/// existing code as its default value is `T*`.
template<typename PlainObjectType, int Options_, template <class> class MakePointer_> class TensorMap : public TensorBase<TensorMap<PlainObjectType, Options_, MakePointer_> >
{
public:
diff --git a/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorSyclExprConstructor.h b/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorSyclExprConstructor.h
index 7ed3a3a..983f631 100644
--- a/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorSyclExprConstructor.h
+++ b/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorSyclExprConstructor.h
@@ -33,7 +33,7 @@ struct EvalToLHSConstructor {
EvalToLHSConstructor(const utility::tuple::Tuple<Params...> &t): expr((&(*(utility::tuple::get<N>(t).get_pointer())))) {}
};
-/// \struct ExprConstructor is used to reconstruct the expression on the device and
+/// struct ExprConstructor is used to reconstruct the expression on the device and
/// recreate the expression with MakeGlobalPointer containing the device address
/// space for the TensorMap pointers used in eval function.
/// It receives the original expression type, the functor of the node, the tuple
diff --git a/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorSyclExtractAccessor.h b/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorSyclExtractAccessor.h
index b1da685..cc18fcd 100644
--- a/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorSyclExtractAccessor.h
+++ b/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorSyclExtractAccessor.h
@@ -35,7 +35,7 @@
namespace Eigen {
namespace TensorSycl {
namespace internal {
-/// \struct ExtractAccessor: Extract Accessor Class is used to extract the
+/// struct ExtractAccessor: Extract Accessor Class is used to extract the
/// accessor from a buffer.
/// Depending on the type of the leaf node we can get a read accessor or a
/// read_write accessor
diff --git a/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorSyclExtractFunctors.h b/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorSyclExtractFunctors.h
index 4271253..9edd38e 100644
--- a/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorSyclExtractFunctors.h
+++ b/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorSyclExtractFunctors.h
@@ -25,7 +25,7 @@
namespace Eigen {
namespace TensorSycl {
namespace internal {
-/// \struct FunctorExtractor: This struct is used to extract the functors
+/// struct FunctorExtractor: This struct is used to extract the functors
/// constructed on
/// the host-side, to pack them and reuse them in reconstruction of the
/// expression on the device.
diff --git a/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorSyclTuple.h b/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorSyclTuple.h
index 063b027..83915f3 100644
--- a/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorSyclTuple.h
+++ b/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorSyclTuple.h
@@ -34,7 +34,7 @@ struct StaticIf<true, T> {
/// \struct Tuple
/// \brief is a fixed-size collection of heterogeneous values
-/// \ztparam Ts... - the types of the elements that the tuple stores.
+/// \tparam Ts... - the types of the elements that the tuple stores.
/// Empty list is supported.
template <class... Ts>
struct Tuple {};
@@ -147,6 +147,8 @@ struct IndexList {};
template <size_t MIN, size_t N, size_t... Is>
struct RangeBuilder;
+// FIXME Doxygen has problems with recursive inheritance
+#ifndef EIGEN_PARSED_BY_DOXYGEN
/// \brief base Step: Specialisation of the \ref RangeBuilder when the
/// MIN==MAX. In this case the Is... is [0 to sizeof...(tuple elements))
/// \tparam MIN is the starting index of the tuple
@@ -164,6 +166,7 @@ struct RangeBuilder<MIN, MIN, Is...> {
/// \tparam Is... are the list of generated index so far
template <size_t MIN, size_t N, size_t... Is>
struct RangeBuilder : public RangeBuilder<MIN, N - 1, N - 1, Is...> {};
+#endif // EIGEN_PARSED_BY_DOXYGEN
/// \brief IndexRange that returns a [MIN, MAX) index range
/// \tparam MIN is the starting index in the tuple
diff --git a/eigen/unsupported/Eigen/CXX11/src/TensorSymmetry/util/TemplateGroupTheory.h b/eigen/unsupported/Eigen/CXX11/src/TensorSymmetry/util/TemplateGroupTheory.h
index 0fe0b7c..5e97d07 100644
--- a/eigen/unsupported/Eigen/CXX11/src/TensorSymmetry/util/TemplateGroupTheory.h
+++ b/eigen/unsupported/Eigen/CXX11/src/TensorSymmetry/util/TemplateGroupTheory.h
@@ -17,7 +17,7 @@ namespace internal {
namespace group_theory {
/** \internal
- * \file CXX11/Tensor/util/TemplateGroupTheory.h
+ * \file CXX11/src/TensorSymmetry/util/TemplateGroupTheory.h
* This file contains C++ templates that implement group theory algorithms.
*
* The algorithms allow for a compile-time analysis of finite groups.
@@ -167,7 +167,9 @@ template<
typename elements,
bool dont_add_current_element // = false
>
-struct dimino_first_step_elements_helper :
+struct dimino_first_step_elements_helper
+#ifndef EIGEN_PARSED_BY_DOXYGEN
+ : // recursive inheritance is too difficult for Doxygen
public dimino_first_step_elements_helper<
Multiply,
Equality,
@@ -187,6 +189,7 @@ template<
typename elements
>
struct dimino_first_step_elements_helper<Multiply, Equality, id, g, current_element, elements, true>
+#endif // EIGEN_PARSED_BY_DOXYGEN
{
typedef elements type;
constexpr static int global_flags = Equality<current_element, id>::global_flags;
diff --git a/eigen/unsupported/Eigen/CXX11/src/util/EmulateCXX11Meta.h b/eigen/unsupported/Eigen/CXX11/src/util/EmulateCXX11Meta.h
index f3aa1b1..8a536fa 100644
--- a/eigen/unsupported/Eigen/CXX11/src/util/EmulateCXX11Meta.h
+++ b/eigen/unsupported/Eigen/CXX11/src/util/EmulateCXX11Meta.h
@@ -188,7 +188,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE t array_prod(const array<t, n>& a) {
}
template<typename t>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE t array_prod(const array<t, 0>& /*a*/) {
- return 0;
+ return 1;
}
template<typename t>
diff --git a/eigen/unsupported/Eigen/FFT b/eigen/unsupported/Eigen/FFT
index 2c45b39..d8cf3e6 100644
--- a/eigen/unsupported/Eigen/FFT
+++ b/eigen/unsupported/Eigen/FFT
@@ -289,6 +289,7 @@ class FFT
void inv( MatrixBase<OutputDerived> & dst, const MatrixBase<ComplexDerived> & src, Index nfft=-1)
{
typedef typename ComplexDerived::Scalar src_type;
+ typedef typename ComplexDerived::RealScalar real_type;
typedef typename OutputDerived::Scalar dst_type;
const bool realfft= (NumTraits<dst_type>::IsComplex == 0);
EIGEN_STATIC_ASSERT_VECTOR_ONLY(OutputDerived)
@@ -329,9 +330,9 @@ class FFT
tmp.head(nhead) = src.head(nhead);
tmp.tail(ntail) = src.tail(ntail);
if (resize_input<0) { //shrinking -- create the Nyquist bin as the average of the two bins that fold into it
- tmp(nhead) = ( src(nfft/2) + src( src.size() - nfft/2 ) )*src_type(.5);
+ tmp(nhead) = ( src(nfft/2) + src( src.size() - nfft/2 ) )*real_type(.5);
}else{ // expanding -- split the old Nyquist bin into two halves
- tmp(nhead) = src(nhead) * src_type(.5);
+ tmp(nhead) = src(nhead) * real_type(.5);
tmp(tmp.size()-nhead) = tmp(nhead);
}
}
diff --git a/eigen/unsupported/Eigen/MatrixFunctions b/eigen/unsupported/Eigen/MatrixFunctions
index 0320606..60dc0a6 100644
--- a/eigen/unsupported/Eigen/MatrixFunctions
+++ b/eigen/unsupported/Eigen/MatrixFunctions
@@ -161,8 +161,8 @@ the z-axis.
\include MatrixExponential.cpp
Output: \verbinclude MatrixExponential.out
-\note \p M has to be a matrix of \c float, \c double, \c long double
-\c complex<float>, \c complex<double>, or \c complex<long double> .
+\note \p M has to be a matrix of \c float, \c double, `long double`
+\c complex<float>, \c complex<double>, or `complex<long double>` .
\subsection matrixbase_log MatrixBase::log()
@@ -219,9 +219,8 @@ documentation of \ref matrixbase_exp "exp()".
\include MatrixLogarithm.cpp
Output: \verbinclude MatrixLogarithm.out
-\note \p M has to be a matrix of \c float, \c double, <tt>long
-double</tt>, \c complex<float>, \c complex<double>, or \c complex<long
-double> .
+\note \p M has to be a matrix of \c float, \c double, `long
+double`, \c complex<float>, \c complex<double>, or `complex<long double>`.
\sa MatrixBase::exp(), MatrixBase::matrixFunction(),
class MatrixLogarithmAtomic, MatrixBase::sqrt().
@@ -326,9 +325,9 @@ Example:
\include MatrixPower_optimal.cpp
Output: \verbinclude MatrixPower_optimal.out
-\note \p M has to be a matrix of \c float, \c double, <tt>long
-double</tt>, \c complex<float>, \c complex<double>, or \c complex<long
-double> .
+\note \p M has to be a matrix of \c float, \c double, `long
+double`, \c complex<float>, \c complex<double>, or
+\c complex<long double> .
\sa MatrixBase::exp(), MatrixBase::log(), class MatrixPower.
diff --git a/eigen/unsupported/Eigen/OpenGLSupport b/eigen/unsupported/Eigen/OpenGLSupport
index 87f5094..085325c 100644
--- a/eigen/unsupported/Eigen/OpenGLSupport
+++ b/eigen/unsupported/Eigen/OpenGLSupport
@@ -184,7 +184,7 @@ inline void glRotate(const Rotation2D<float>& rot)
}
inline void glRotate(const Rotation2D<double>& rot)
{
- glRotated(rot.angle()*180.0/EIGEN_PI, 0.0, 0.0, 1.0);
+ glRotated(rot.angle()*180.0/double(EIGEN_PI), 0.0, 0.0, 1.0);
}
template<typename Derived> void glRotate(const RotationBase<Derived,3>& rot)
diff --git a/eigen/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h b/eigen/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
index 279fe5c..2f50e99 100644
--- a/eigen/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
+++ b/eigen/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
@@ -534,7 +534,8 @@ struct ScalarBinaryOpTraits<typename DerType::Scalar,AutoDiffScalar<DerType>, Bi
EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(typename Eigen::internal::remove_all<DerType>::type, typename Eigen::internal::traits<typename Eigen::internal::remove_all<DerType>::type>::Scalar, product) > \
FUNC(const Eigen::AutoDiffScalar<DerType>& x) { \
using namespace Eigen; \
- EIGEN_UNUSED typedef typename Eigen::internal::traits<typename Eigen::internal::remove_all<DerType>::type>::Scalar Scalar; \
+ typedef typename Eigen::internal::traits<typename Eigen::internal::remove_all<DerType>::type>::Scalar Scalar; \
+ EIGEN_UNUSED_VARIABLE(sizeof(Scalar)); \
CODE; \
}
diff --git a/eigen/unsupported/Eigen/src/BVH/KdBVH.h b/eigen/unsupported/Eigen/src/BVH/KdBVH.h
index 1b8d758..5e39af2 100644
--- a/eigen/unsupported/Eigen/src/BVH/KdBVH.h
+++ b/eigen/unsupported/Eigen/src/BVH/KdBVH.h
@@ -35,6 +35,7 @@ struct get_boxes_helper {
{
outBoxes.insert(outBoxes.end(), boxBegin, boxEnd);
eigen_assert(outBoxes.size() == objects.size());
+ EIGEN_ONLY_USED_FOR_DEBUG(objects);
}
};
diff --git a/eigen/unsupported/Eigen/src/IterativeSolvers/DGMRES.h b/eigen/unsupported/Eigen/src/IterativeSolvers/DGMRES.h
index eff2dc8..4079e23 100644
--- a/eigen/unsupported/Eigen/src/IterativeSolvers/DGMRES.h
+++ b/eigen/unsupported/Eigen/src/IterativeSolvers/DGMRES.h
@@ -173,7 +173,7 @@ class DGMRES : public IterativeSolverBase<DGMRES<_MatrixType,_Preconditioner> >
/**
* Set the restart value (default is 30)
*/
- Index set_restart(const Index restart) { m_restart=restart; }
+ void set_restart(const Index restart) { m_restart=restart; }
/**
* Set the number of eigenvalues to deflate at each restart
@@ -392,7 +392,6 @@ inline typename DGMRES<_MatrixType, _Preconditioner>::ComplexVector DGMRES<_Matr
template< typename _MatrixType, typename _Preconditioner>
inline typename DGMRES<_MatrixType, _Preconditioner>::ComplexVector DGMRES<_MatrixType, _Preconditioner>::schurValues(const RealSchur<DenseMatrix>& schurofH) const
{
- typedef typename MatrixType::Index Index;
const DenseMatrix& T = schurofH.matrixT();
Index it = T.rows();
ComplexVector eig(it);
diff --git a/eigen/unsupported/Eigen/src/IterativeSolvers/GMRES.h b/eigen/unsupported/Eigen/src/IterativeSolvers/GMRES.h
index 5a82b0d..92618b1 100644
--- a/eigen/unsupported/Eigen/src/IterativeSolvers/GMRES.h
+++ b/eigen/unsupported/Eigen/src/IterativeSolvers/GMRES.h
@@ -21,7 +21,7 @@ namespace internal {
*
* Parameters:
* \param mat matrix of linear system of equations
-* \param Rhs right hand side vector of linear system of equations
+* \param rhs right hand side vector of linear system of equations
* \param x on input: initial guess, on output: solution
* \param precond preconditioner used
* \param iters on input: maximum number of iterations to perform
diff --git a/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h b/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
index 85ab3d9..e5ebbcf 100644
--- a/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
+++ b/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
@@ -234,12 +234,13 @@ struct matrix_exp_computeUV<MatrixType, float>
template <typename MatrixType>
struct matrix_exp_computeUV<MatrixType, double>
{
+ typedef typename NumTraits<typename traits<MatrixType>::Scalar>::Real RealScalar;
template <typename ArgType>
static void run(const ArgType& arg, MatrixType& U, MatrixType& V, int& squarings)
{
using std::frexp;
using std::pow;
- const double l1norm = arg.cwiseAbs().colwise().sum().maxCoeff();
+ const RealScalar l1norm = arg.cwiseAbs().colwise().sum().maxCoeff();
squarings = 0;
if (l1norm < 1.495585217958292e-002) {
matrix_exp_pade3(arg, U, V);
@@ -250,10 +251,10 @@ struct matrix_exp_computeUV<MatrixType, double>
} else if (l1norm < 2.097847961257068e+000) {
matrix_exp_pade9(arg, U, V);
} else {
- const double maxnorm = 5.371920351148152;
+ const RealScalar maxnorm = 5.371920351148152;
frexp(l1norm / maxnorm, &squarings);
if (squarings < 0) squarings = 0;
- MatrixType A = arg.unaryExpr(MatrixExponentialScalingOp<double>(squarings));
+ MatrixType A = arg.unaryExpr(MatrixExponentialScalingOp<RealScalar>(squarings));
matrix_exp_pade13(A, U, V);
}
}
diff --git a/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h b/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h
index 3f7d777..3df8239 100644
--- a/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h
+++ b/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h
@@ -7,8 +7,8 @@
// 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/.
-#ifndef EIGEN_MATRIX_FUNCTION
-#define EIGEN_MATRIX_FUNCTION
+#ifndef EIGEN_MATRIX_FUNCTION_H
+#define EIGEN_MATRIX_FUNCTION_H
#include "StemFunction.h"
@@ -577,4 +577,4 @@ const MatrixFunctionReturnValue<Derived> MatrixBase<Derived>::cosh() const
} // end namespace Eigen
-#endif // EIGEN_MATRIX_FUNCTION
+#endif // EIGEN_MATRIX_FUNCTION_H
diff --git a/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h b/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h
index ff8f6e7..cf5fffa 100644
--- a/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h
+++ b/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h
@@ -324,7 +324,7 @@ public:
/** \brief Compute the matrix logarithm.
*
- * \param[out] result Logarithm of \p A, where \A is as specified in the constructor.
+ * \param[out] result Logarithm of \c A, where \c A is as specified in the constructor.
*/
template <typename ResultType>
inline void evalTo(ResultType& result) const
diff --git a/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h b/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h
index ebc433d..a3273da 100644
--- a/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h
+++ b/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h
@@ -57,8 +57,8 @@ class MatrixPowerParenthesesReturnValue : public ReturnByValue< MatrixPowerParen
* \param[out] result
*/
template<typename ResultType>
- inline void evalTo(ResultType& res) const
- { m_pow.compute(res, m_p); }
+ inline void evalTo(ResultType& result) const
+ { m_pow.compute(result, m_p); }
Index rows() const { return m_pow.rows(); }
Index cols() const { return m_pow.cols(); }
@@ -618,8 +618,8 @@ class MatrixPowerReturnValue : public ReturnByValue< MatrixPowerReturnValue<Deri
* constructor.
*/
template<typename ResultType>
- inline void evalTo(ResultType& res) const
- { MatrixPower<PlainObject>(m_A.eval()).compute(res, m_p); }
+ inline void evalTo(ResultType& result) const
+ { MatrixPower<PlainObject>(m_A.eval()).compute(result, m_p); }
Index rows() const { return m_A.rows(); }
Index cols() const { return m_A.cols(); }
@@ -669,8 +669,8 @@ class MatrixComplexPowerReturnValue : public ReturnByValue< MatrixComplexPowerRe
* constructor.
*/
template<typename ResultType>
- inline void evalTo(ResultType& res) const
- { res = (m_p * m_A.log()).exp(); }
+ inline void evalTo(ResultType& result) const
+ { result = (m_p * m_A.log()).exp(); }
Index rows() const { return m_A.rows(); }
Index cols() const { return m_A.cols(); }
diff --git a/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h b/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h
index afd88ec..2e5abda 100644
--- a/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h
+++ b/eigen/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h
@@ -120,7 +120,6 @@ template <typename MatrixType, typename ResultType>
void matrix_sqrt_quasi_triangular_diagonal(const MatrixType& T, ResultType& sqrtT)
{
using std::sqrt;
- typedef typename MatrixType::Index Index;
const Index size = T.rows();
for (Index i = 0; i < size; i++) {
if (i == size - 1 || T.coeff(i+1, i) == 0) {
@@ -139,7 +138,6 @@ void matrix_sqrt_quasi_triangular_diagonal(const MatrixType& T, ResultType& sqrt
template <typename MatrixType, typename ResultType>
void matrix_sqrt_quasi_triangular_off_diagonal(const MatrixType& T, ResultType& sqrtT)
{
- typedef typename MatrixType::Index Index;
const Index size = T.rows();
for (Index j = 1; j < size; j++) {
if (T.coeff(j, j-1) != 0) // if T(j-1:j, j-1:j) is a 2-by-2 block
@@ -206,7 +204,6 @@ template <typename MatrixType, typename ResultType>
void matrix_sqrt_triangular(const MatrixType &arg, ResultType &result)
{
using std::sqrt;
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
eigen_assert(arg.rows() == arg.cols());
@@ -318,7 +315,6 @@ template<typename Derived> class MatrixSquareRootReturnValue
: public ReturnByValue<MatrixSquareRootReturnValue<Derived> >
{
protected:
- typedef typename Derived::Index Index;
typedef typename internal::ref_selector<Derived>::type DerivedNested;
public:
diff --git a/eigen/unsupported/Eigen/src/Polynomials/PolynomialUtils.h b/eigen/unsupported/Eigen/src/Polynomials/PolynomialUtils.h
index 40ba65b..394e857 100644
--- a/eigen/unsupported/Eigen/src/Polynomials/PolynomialUtils.h
+++ b/eigen/unsupported/Eigen/src/Polynomials/PolynomialUtils.h
@@ -20,8 +20,8 @@ namespace Eigen {
* e.g. \f$ 1 + 3x^2 \f$ is stored as a vector \f$ [ 1, 0, 3 ] \f$.
* \param[in] x : the value to evaluate the polynomial at.
*
- * <i><b>Note for stability:</b></i>
- * <dd> \f$ |x| \le 1 \f$ </dd>
+ * \note for stability:
+ * \f$ |x| \le 1 \f$
*/
template <typename Polynomials, typename T>
inline
@@ -67,8 +67,8 @@ T poly_eval( const Polynomials& poly, const T& x )
* by degrees i.e. poly[i] is the coefficient of degree i of the polynomial
* e.g. \f$ 1 + 3x^2 \f$ is stored as a vector \f$ [ 1, 0, 3 ] \f$.
*
- * <i><b>Precondition:</b></i>
- * <dd> the leading coefficient of the input polynomial poly must be non zero </dd>
+ * \pre
+ * the leading coefficient of the input polynomial poly must be non zero
*/
template <typename Polynomial>
inline
diff --git a/eigen/unsupported/Eigen/src/SparseExtra/BlockSparseMatrix.h b/eigen/unsupported/Eigen/src/SparseExtra/BlockSparseMatrix.h
index 0e8350a..536a0c3 100644
--- a/eigen/unsupported/Eigen/src/SparseExtra/BlockSparseMatrix.h
+++ b/eigen/unsupported/Eigen/src/SparseExtra/BlockSparseMatrix.h
@@ -931,7 +931,7 @@ class BlockSparseMatrix : public SparseMatrixBase<BlockSparseMatrix<_Scalar,_Blo
}
/**
- * \returns the starting position of the block <id> in the array of values
+ * \returns the starting position of the block \p id in the array of values
*/
Index blockPtr(Index id) const
{
diff --git a/eigen/unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h b/eigen/unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h
index 037a13f..0ffbc43 100644
--- a/eigen/unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h
+++ b/eigen/unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h
@@ -228,6 +228,9 @@ template<typename _Scalar, int _Options, typename _StorageIndex>
EIGEN_DEPRECATED inline DynamicSparseMatrix()
: m_innerSize(0), m_data(0)
{
+ #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
+ EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
+ #endif
eigen_assert(innerSize()==0 && outerSize()==0);
}
@@ -235,6 +238,9 @@ template<typename _Scalar, int _Options, typename _StorageIndex>
EIGEN_DEPRECATED inline DynamicSparseMatrix(Index rows, Index cols)
: m_innerSize(0)
{
+ #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
+ EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
+ #endif
resize(rows, cols);
}
@@ -243,12 +249,18 @@ template<typename _Scalar, int _Options, typename _StorageIndex>
EIGEN_DEPRECATED explicit inline DynamicSparseMatrix(const SparseMatrixBase<OtherDerived>& other)
: m_innerSize(0)
{
- Base::operator=(other.derived());
+ #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
+ EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
+ #endif
+ Base::operator=(other.derived());
}
inline DynamicSparseMatrix(const DynamicSparseMatrix& other)
: Base(), m_innerSize(0)
{
+ #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
+ EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
+ #endif
*this = other.derived();
}
diff --git a/eigen/unsupported/Eigen/src/SparseExtra/MarketIO.h b/eigen/unsupported/Eigen/src/SparseExtra/MarketIO.h
index 41e4af4..04b7d69 100644
--- a/eigen/unsupported/Eigen/src/SparseExtra/MarketIO.h
+++ b/eigen/unsupported/Eigen/src/SparseExtra/MarketIO.h
@@ -17,8 +17,8 @@ namespace Eigen {
namespace internal
{
- template <typename Scalar>
- inline bool GetMarketLine (std::stringstream& line, Index& M, Index& N, Index& i, Index& j, Scalar& value)
+ template <typename Scalar,typename IndexType>
+ inline bool GetMarketLine (std::stringstream& line, IndexType& M, IndexType& N, IndexType& i, IndexType& j, Scalar& value)
{
line >> i >> j >> value;
i--;
@@ -30,8 +30,8 @@ namespace internal
else
return false;
}
- template <typename Scalar>
- inline bool GetMarketLine (std::stringstream& line, Index& M, Index& N, Index& i, Index& j, std::complex<Scalar>& value)
+ template <typename Scalar,typename IndexType>
+ inline bool GetMarketLine (std::stringstream& line, IndexType& M, IndexType& N, IndexType& i, IndexType& j, std::complex<Scalar>& value)
{
Scalar valR, valI;
line >> i >> j >> valR >> valI;
@@ -134,7 +134,7 @@ template<typename SparseMatrixType>
bool loadMarket(SparseMatrixType& mat, const std::string& filename)
{
typedef typename SparseMatrixType::Scalar Scalar;
- typedef typename SparseMatrixType::Index Index;
+ typedef typename SparseMatrixType::StorageIndex StorageIndex;
std::ifstream input(filename.c_str(),std::ios::in);
if(!input)
return false;
@@ -144,11 +144,11 @@ bool loadMarket(SparseMatrixType& mat, const std::string& filename)
bool readsizes = false;
- typedef Triplet<Scalar,Index> T;
+ typedef Triplet<Scalar,StorageIndex> T;
std::vector<T> elements;
- Index M(-1), N(-1), NNZ(-1);
- Index count = 0;
+ StorageIndex M(-1), N(-1), NNZ(-1);
+ StorageIndex count = 0;
while(input.getline(buffer, maxBuffersize))
{
// skip comments
@@ -171,7 +171,7 @@ bool loadMarket(SparseMatrixType& mat, const std::string& filename)
}
else
{
- Index i(-1), j(-1);
+ StorageIndex i(-1), j(-1);
Scalar value;
if( internal::GetMarketLine(line, M, N, i, j, value) )
{
diff --git a/eigen/unsupported/Eigen/src/Splines/Spline.h b/eigen/unsupported/Eigen/src/Splines/Spline.h
index 627f6e4..57788c8 100644
--- a/eigen/unsupported/Eigen/src/Splines/Spline.h
+++ b/eigen/unsupported/Eigen/src/Splines/Spline.h
@@ -249,8 +249,6 @@ namespace Eigen
DenseIndex degree,
const typename Spline<_Scalar, _Dim, _Degree>::KnotVectorType& knots)
{
- typedef typename Spline<_Scalar, _Dim, _Degree>::BasisVectorType BasisVectorType;
-
const DenseIndex p = degree;
const DenseIndex i = Spline::Span(u, degree, knots);
@@ -380,9 +378,6 @@ namespace Eigen
typedef Spline<_Scalar, _Dim, _Degree> SplineType;
enum { Order = SplineTraits<SplineType>::OrderAtCompileTime };
- typedef typename SplineTraits<SplineType>::Scalar Scalar;
- typedef typename SplineTraits<SplineType>::BasisVectorType BasisVectorType;
-
const DenseIndex span = SplineType::Span(u, p, U);
const DenseIndex n = (std::min)(p, order);
diff --git a/eigen/unsupported/doc/examples/FFT.cpp b/eigen/unsupported/doc/examples/FFT.cpp
index fcbf812..85e8a02 100644
--- a/eigen/unsupported/doc/examples/FFT.cpp
+++ b/eigen/unsupported/doc/examples/FFT.cpp
@@ -61,14 +61,14 @@ template <typename T>
void RandomFill(std::vector<T> & vec)
{
for (size_t k=0;k<vec.size();++k)
- vec[k] = T( rand() )/T(RAND_MAX) - .5;
+ vec[k] = T( rand() )/T(RAND_MAX) - T(.5);
}
template <typename T>
void RandomFill(std::vector<std::complex<T> > & vec)
{
for (size_t k=0;k<vec.size();++k)
- vec[k] = std::complex<T> ( T( rand() )/T(RAND_MAX) - .5, T( rand() )/T(RAND_MAX) - .5);
+ vec[k] = std::complex<T> ( T( rand() )/T(RAND_MAX) - T(.5), T( rand() )/T(RAND_MAX) - T(.5));
}
template <typename T_time,typename T_freq>
@@ -85,7 +85,7 @@ void fwd_inv(size_t nfft)
vector<T_time> timebuf2;
fft.inv(timebuf2,freqbuf);
- long double rmse = mag2(timebuf - timebuf2) / mag2(timebuf);
+ T_time rmse = mag2(timebuf - timebuf2) / mag2(timebuf);
cout << "roundtrip rmse: " << rmse << endl;
}
diff --git a/eigen/unsupported/test/CMakeLists.txt b/eigen/unsupported/test/CMakeLists.txt
index 80cccd8..3a8775a 100644
--- a/eigen/unsupported/test/CMakeLists.txt
+++ b/eigen/unsupported/test/CMakeLists.txt
@@ -68,7 +68,7 @@ ei_add_test(EulerAngles)
find_package(MPFR 2.3.0)
find_package(GMP)
-if(MPFR_FOUND AND EIGEN_COMPILER_SUPPORT_CXX11)
+if(MPFR_FOUND AND EIGEN_COMPILER_SUPPORT_CPP11)
include_directories(${MPFR_INCLUDES} ./mpreal)
ei_add_property(EIGEN_TESTED_BACKENDS "MPFR C++, ")
set(EIGEN_MPFR_TEST_LIBRARIES ${MPFR_LIBRARIES} ${GMP_LIBRARIES})
@@ -154,7 +154,8 @@ if(EIGEN_TEST_CXX11)
endif(EIGEN_TEST_SYCL)
# It should be safe to always run these tests as there is some fallback code for
# older compiler that don't support cxx11.
- set(CMAKE_CXX_STANDARD 11)
+ # This is already set if EIGEN_TEST_CXX11 is enabled:
+ # set(CMAKE_CXX_STANDARD 11)
ei_add_test(cxx11_eventcount "-pthread" "${CMAKE_THREAD_LIBS_INIT}")
ei_add_test(cxx11_runqueue "-pthread" "${CMAKE_THREAD_LIBS_INIT}")
diff --git a/eigen/unsupported/test/NonLinearOptimization.cpp b/eigen/unsupported/test/NonLinearOptimization.cpp
index 1d682dd..f0c336c 100644
--- a/eigen/unsupported/test/NonLinearOptimization.cpp
+++ b/eigen/unsupported/test/NonLinearOptimization.cpp
@@ -565,7 +565,7 @@ void testLmdif1()
// do the computation
lmdif_functor functor;
- DenseIndex nfev;
+ DenseIndex nfev = -1; // initialize to avoid maybe-uninitialized warning
info = LevenbergMarquardt<lmdif_functor>::lmdif1(functor, x, &nfev);
// check return value
diff --git a/eigen/unsupported/test/matrix_function.cpp b/eigen/unsupported/test/matrix_function.cpp
index 7c9b68a..6a2b219 100644
--- a/eigen/unsupported/test/matrix_function.cpp
+++ b/eigen/unsupported/test/matrix_function.cpp
@@ -25,7 +25,6 @@ inline bool test_isApprox_abs(const Type1& a, const Type2& b)
template<typename MatrixType>
MatrixType randomMatrixWithRealEivals(const typename MatrixType::Index size)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::RealScalar RealScalar;
MatrixType diag = MatrixType::Zero(size, size);
@@ -51,7 +50,6 @@ struct randomMatrixWithImagEivals<MatrixType, 0>
{
static MatrixType run(const typename MatrixType::Index size)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
MatrixType diag = MatrixType::Zero(size, size);
Index i = 0;
@@ -79,7 +77,6 @@ struct randomMatrixWithImagEivals<MatrixType, 1>
{
static MatrixType run(const typename MatrixType::Index size)
{
- typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::RealScalar RealScalar;
const Scalar imagUnit(0, 1);
@@ -171,7 +168,6 @@ void testMatrixType(const MatrixType& m)
{
// Matrices with clustered eigenvalue lead to different code paths
// in MatrixFunction.h and are thus useful for testing.
- typedef typename MatrixType::Index Index;
const Index size = m.rows();
for (int i = 0; i < g_repeat; i++) {
diff --git a/eigen/unsupported/test/openglsupport.cpp b/eigen/unsupported/test/openglsupport.cpp
index 706a816..5f63434 100644
--- a/eigen/unsupported/test/openglsupport.cpp
+++ b/eigen/unsupported/test/openglsupport.cpp
@@ -318,10 +318,6 @@ void test_openglsupport()
GLint prg_id = createShader(vtx,frg);
- typedef Vector2d Vector2d;
- typedef Vector3d Vector3d;
- typedef Vector4d Vector4d;
-
VERIFY_UNIFORM(dv,v2d, Vector2d);
VERIFY_UNIFORM(dv,v3d, Vector3d);
VERIFY_UNIFORM(dv,v4d, Vector4d);
diff --git a/eigen/unsupported/test/polynomialsolver.cpp b/eigen/unsupported/test/polynomialsolver.cpp
index 0c87478..4cfc46b 100644
--- a/eigen/unsupported/test/polynomialsolver.cpp
+++ b/eigen/unsupported/test/polynomialsolver.cpp
@@ -30,7 +30,6 @@ struct increment_if_fixed_size
template<int Deg, typename POLYNOMIAL, typename SOLVER>
bool aux_evalSolver( const POLYNOMIAL& pols, SOLVER& psolve )
{
- typedef typename POLYNOMIAL::Index Index;
typedef typename POLYNOMIAL::Scalar Scalar;
typedef typename SOLVER::RootsType RootsType;
@@ -107,7 +106,6 @@ void evalSolverSugarFunction( const POLYNOMIAL& pols, const ROOTS& roots, const
// 1) the roots found are correct
// 2) the roots have distinct moduli
- typedef typename POLYNOMIAL::Scalar Scalar;
typedef typename REAL_ROOTS::Scalar Real;
//Test realRoots
diff --git a/eigen/unsupported/test/sparse_extra.cpp b/eigen/unsupported/test/sparse_extra.cpp
index a010ceb..7a049c8 100644
--- a/eigen/unsupported/test/sparse_extra.cpp
+++ b/eigen/unsupported/test/sparse_extra.cpp
@@ -8,10 +8,10 @@
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
-// import basic and product tests for deprectaed DynamicSparseMatrix
+// import basic and product tests for deprecated DynamicSparseMatrix
#define EIGEN_NO_DEPRECATED_WARNING
-#include "sparse_basic.cpp"
#include "sparse_product.cpp"
+#include "sparse_basic.cpp"
#include <Eigen/SparseExtra>
template<typename SetterType,typename DenseType, typename Scalar, int Options>