mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Compare commits
133 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72ffb63165 | ||
|
|
67e24b85a4 | ||
|
|
2359486129 | ||
|
|
dd2e4be741 | ||
|
|
c5ef8f9027 | ||
|
|
4931a719f4 | ||
|
|
27f34269d5 | ||
|
|
e7d2376688 | ||
|
|
dc36efbb8f | ||
|
|
9a47fb289b | ||
|
|
151e3294cf | ||
|
|
5d1263e7c5 | ||
|
|
c6c6c34909 | ||
|
|
931edea57d | ||
|
|
bfcad536e8 | ||
|
|
b464fc19bc | ||
|
|
c541d0a62e | ||
|
|
b43d92a5a2 | ||
|
|
56818d907e | ||
|
|
e9868f438b | ||
|
|
4f0909b5f0 | ||
|
|
6cac61ca3e | ||
|
|
1180ede36d | ||
|
|
99fa279ed1 | ||
|
|
dbab12d6b0 | ||
|
|
dc727d86f1 | ||
|
|
5cec29162b | ||
|
|
703c8a0cc6 | ||
|
|
d30f0c0953 | ||
|
|
adacacb285 | ||
|
|
c8e1b679fa | ||
|
|
951e238430 | ||
|
|
9c5c8d8916 | ||
|
|
77fc6a9914 | ||
|
|
eef03525b8 | ||
|
|
31621ff0ef | ||
|
|
0b44893b4e | ||
|
|
8cad73072e | ||
|
|
9be2712bf7 | ||
|
|
0612768c1c | ||
|
|
32025a2510 | ||
|
|
771e64200f | ||
|
|
4846c76d9d | ||
|
|
afc9efca15 | ||
|
|
ea7d872181 | ||
|
|
b6299c974f | ||
|
|
b3544ce2ae | ||
|
|
a8f5ef9388 | ||
|
|
58abf0eb98 | ||
|
|
ef73265987 | ||
|
|
4fbd78d993 | ||
|
|
5dfae4524b | ||
|
|
2064c59878 | ||
|
|
bb9a465c5a | ||
|
|
28d17c5390 | ||
|
|
4bfe38eda2 | ||
|
|
23aae0d63e | ||
|
|
0dfea7fce4 | ||
|
|
c121e6f390 | ||
|
|
955c099eb5 | ||
|
|
a00aaf7f7e | ||
|
|
6e01780541 | ||
|
|
939f0327b6 | ||
|
|
78e1a62c54 | ||
|
|
59eeb67187 | ||
|
|
b8374aec00 | ||
|
|
7dc18b20bb | ||
|
|
32e7dae776 | ||
|
|
9ab503903e | ||
|
|
14b164b00e | ||
|
|
c78b5fd9aa | ||
|
|
2fb5567e08 | ||
|
|
3df134dec2 | ||
|
|
c58a2ff03a | ||
|
|
9e1127619c | ||
|
|
720767ae40 | ||
|
|
d8e97aee89 | ||
|
|
625814464e | ||
|
|
39b27fb656 | ||
|
|
25579df2d4 | ||
|
|
3884308da7 | ||
|
|
68631e28d4 | ||
|
|
39d3bc2394 | ||
|
|
659c97ee49 | ||
|
|
769eeac35e | ||
|
|
51da67f211 | ||
|
|
05545d0197 | ||
|
|
8bee573a78 | ||
|
|
fb1a29fed5 | ||
|
|
e129e985c3 | ||
|
|
2d5ea82807 | ||
|
|
3c00e3da03 | ||
|
|
434817164e | ||
|
|
2c1ac23c62 | ||
|
|
a0e5b00280 | ||
|
|
6456b74a89 | ||
|
|
86ca05b324 | ||
|
|
8f8c67b8bd | ||
|
|
aa966ca319 | ||
|
|
f7cd63b964 | ||
|
|
69cecc45e5 | ||
|
|
abce49ea21 | ||
|
|
d271ad38ce | ||
|
|
3e2314dd67 | ||
|
|
444c1bc55b | ||
|
|
390724b4b6 | ||
|
|
d8ca948148 | ||
|
|
3345ea0ddd | ||
|
|
9195a224f3 | ||
|
|
b8ef48c46d | ||
|
|
a53a7d6e6a | ||
|
|
eda59ffc1b | ||
|
|
6f86c12339 | ||
|
|
aea630a98a | ||
|
|
2ba55e90db | ||
|
|
d0b8ce8f2a | ||
|
|
1c4e85ac7e | ||
|
|
78fa34e8ff | ||
|
|
8fb27fad36 | ||
|
|
be224d93f4 | ||
|
|
11402edfd3 | ||
|
|
fe8a710a21 | ||
|
|
03d86ea736 | ||
|
|
13a5582835 | ||
|
|
59596efdf7 | ||
|
|
6db8fa7d04 | ||
|
|
2f15f74218 | ||
|
|
578d6f7ced | ||
|
|
a1d7e9051e | ||
|
|
8e0a42350d | ||
|
|
ac465a0891 | ||
|
|
211e1f8044 | ||
|
|
d09b94e2ad |
@@ -101,6 +101,8 @@ if(EIGEN_DEFAULT_TO_ROW_MAJOR)
|
||||
add_definitions("-DEIGEN_DEFAULT_TO_ROW_MAJOR")
|
||||
endif()
|
||||
|
||||
add_definitions("-DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fexceptions -fno-check-new -fno-common -fstrict-aliasing")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g3")
|
||||
@@ -205,6 +207,7 @@ endif(MSVC)
|
||||
|
||||
option(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION "Disable explicit vectorization in tests/examples" OFF)
|
||||
option(EIGEN_TEST_X87 "Force using X87 instructions. Implies no vectorization." OFF)
|
||||
option(EIGEN_TEST_32BIT "Force generating 32bit code." OFF)
|
||||
|
||||
if(EIGEN_TEST_X87)
|
||||
set(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION ON)
|
||||
@@ -216,6 +219,15 @@ if(EIGEN_TEST_X87)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(EIGEN_TEST_32BIT)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
|
||||
message(STATUS "Forcing generation of 32-bit code in tests/examples")
|
||||
else()
|
||||
message(STATUS "EIGEN_TEST_32BIT ignored on your compiler")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION)
|
||||
add_definitions(-DEIGEN_DONT_VECTORIZE=1)
|
||||
message(STATUS "Disabling vectorization in tests/examples")
|
||||
@@ -277,21 +289,52 @@ add_subdirectory(Eigen)
|
||||
|
||||
add_subdirectory(doc EXCLUDE_FROM_ALL)
|
||||
|
||||
add_custom_target(buildtests)
|
||||
add_custom_target(check COMMAND "ctest")
|
||||
add_dependencies(check buildtests)
|
||||
|
||||
# CMake/Ctest does not allow us to change the build command,
|
||||
# so we have to workaround by directly editing the generated DartConfiguration.tcl file
|
||||
# save CMAKE_MAKE_PROGRAM
|
||||
set(CMAKE_MAKE_PROGRAM_SAVE ${CMAKE_MAKE_PROGRAM})
|
||||
# and set a fake one
|
||||
set(CMAKE_MAKE_PROGRAM "@EIGEN_MAKECOMMAND_PLACEHOLDER@")
|
||||
|
||||
include(CTest)
|
||||
enable_testing() # must be called from the root CMakeLists, see man page
|
||||
include(EigenTesting)
|
||||
ei_init_testing()
|
||||
|
||||
# overwrite default DartConfiguration.tcl
|
||||
# The worarounds are different for each version of the MSVC IDE
|
||||
if(MSVC_IDE)
|
||||
if(MSVC_VERSION EQUAL 1600) # MSVC 2010
|
||||
set(EIGEN_MAKECOMMAND_PLACEHOLDER "${CMAKE_MAKE_PROGRAM_SAVE} buildtests.vcxproj /p:Configuration=\${CTEST_CONFIGURATION_TYPE} \n # ")
|
||||
else() # MSVC 2008 (TODO check MSVC 2005)
|
||||
set(EIGEN_MAKECOMMAND_PLACEHOLDER "${CMAKE_MAKE_PROGRAM_SAVE} /project buildtests")
|
||||
endif()
|
||||
else()
|
||||
# for make and nmake
|
||||
set(EIGEN_MAKECOMMAND_PLACEHOLDER "${CMAKE_MAKE_PROGRAM_SAVE} buildtests")
|
||||
endif()
|
||||
|
||||
configure_file(${CMAKE_BINARY_DIR}/DartConfiguration.tcl ${CMAKE_BINARY_DIR}/DartConfiguration.tcl)
|
||||
# restore default CMAKE_MAKE_PROGRAM
|
||||
set(CMAKE_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM_SAVE})
|
||||
# un-set temporary variables so that it is like they never existed.
|
||||
# CMake 2.6.3 introduces the more logical unset() syntax for this.
|
||||
set(CMAKE_MAKE_PROGRAM_SAVE)
|
||||
set(EIGEN_MAKECOMMAND_PLACEHOLDER)
|
||||
|
||||
configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake.in ${CMAKE_BINARY_DIR}/CTestCustom.cmake)
|
||||
|
||||
|
||||
if(EIGEN_LEAVE_TEST_IN_ALL_TARGET)
|
||||
add_subdirectory(test) # can't do EXCLUDE_FROM_ALL here, breaks CTest
|
||||
else()
|
||||
add_subdirectory(test EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
add_subdirectory(unsupported)
|
||||
|
||||
add_subdirectory(demos EXCLUDE_FROM_ALL)
|
||||
|
||||
if(NOT MSVC)
|
||||
if(EIGEN_LEAVE_TEST_IN_ALL_TARGET)
|
||||
add_subdirectory(blas)
|
||||
@@ -302,6 +345,10 @@ if(NOT MSVC)
|
||||
endif()
|
||||
endif(NOT MSVC)
|
||||
|
||||
add_subdirectory(unsupported)
|
||||
|
||||
add_subdirectory(demos EXCLUDE_FROM_ALL)
|
||||
|
||||
# must be after test and unsupported, for configuring buildtests.in
|
||||
add_subdirectory(scripts EXCLUDE_FROM_ALL)
|
||||
|
||||
|
||||
@@ -11,7 +11,3 @@ set(CTEST_DROP_METHOD "http")
|
||||
set(CTEST_DROP_SITE "eigen.tuxfamily.org")
|
||||
set(CTEST_DROP_LOCATION "/CDash/submit.php?project=Eigen")
|
||||
set(CTEST_DROP_SITE_CDASH TRUE)
|
||||
|
||||
## A tribute to Dynamic!
|
||||
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS "33331")
|
||||
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS "33331")
|
||||
4
CTestCustom.cmake.in
Normal file
4
CTestCustom.cmake.in
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
## A tribute to Dynamic!
|
||||
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS "33331")
|
||||
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS "33331")
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "Core"
|
||||
|
||||
#include "src/Core/util/DisableMSVCWarnings.h"
|
||||
#include "src/Core/util/DisableStupidWarnings.h"
|
||||
|
||||
namespace Eigen {
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Eigen {
|
||||
|
||||
} // namespace Eigen
|
||||
|
||||
#include "src/Core/util/EnableMSVCWarnings.h"
|
||||
#include "src/Core/util/ReenableStupidWarnings.h"
|
||||
|
||||
#endif // EIGEN_CHOLESKY_MODULE_H
|
||||
/* vim: set filetype=cpp et sw=2 ts=2 ai: */
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
#ifndef EIGEN_CORE_H
|
||||
#define EIGEN_CORE_H
|
||||
|
||||
// first thing Eigen does: prevent MSVC from committing suicide
|
||||
#include "src/Core/util/DisableMSVCWarnings.h"
|
||||
// first thing Eigen does: stop the compiler from committing suicide
|
||||
#include "src/Core/util/DisableStupidWarnings.h"
|
||||
|
||||
// then include this file where all our macros are defined. It's really important to do it first because
|
||||
// it's where we do all the alignment settings (platform detection and honoring the user's will if he
|
||||
@@ -158,7 +158,7 @@
|
||||
|
||||
// for outputting debug info
|
||||
#ifdef EIGEN_DEBUG_ASSIGN
|
||||
#include<iostream>
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
// required for __cpuid, needs to be included after cmath
|
||||
@@ -354,7 +354,7 @@ using std::size_t;
|
||||
|
||||
#include "src/Core/GlobalFunctions.h"
|
||||
|
||||
#include "src/Core/util/EnableMSVCWarnings.h"
|
||||
#include "src/Core/util/ReenableStupidWarnings.h"
|
||||
|
||||
#ifdef EIGEN2_SUPPORT
|
||||
#include "Eigen2Support"
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#error Eigen2 support must be enabled by defining EIGEN2_SUPPORT before including any Eigen header
|
||||
#endif
|
||||
|
||||
#include "src/Core/util/DisableMSVCWarnings.h"
|
||||
#include "src/Core/util/DisableStupidWarnings.h"
|
||||
|
||||
namespace Eigen {
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Eigen {
|
||||
|
||||
} // namespace Eigen
|
||||
|
||||
#include "src/Core/util/EnableMSVCWarnings.h"
|
||||
#include "src/Core/util/ReenableStupidWarnings.h"
|
||||
|
||||
// Eigen2 used to include iostream
|
||||
#include<iostream>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "Core"
|
||||
|
||||
#include "src/Core/util/DisableMSVCWarnings.h"
|
||||
#include "src/Core/util/DisableStupidWarnings.h"
|
||||
|
||||
#include "Cholesky"
|
||||
#include "Jacobi"
|
||||
@@ -38,7 +38,7 @@ namespace Eigen {
|
||||
|
||||
} // namespace Eigen
|
||||
|
||||
#include "src/Core/util/EnableMSVCWarnings.h"
|
||||
#include "src/Core/util/ReenableStupidWarnings.h"
|
||||
|
||||
#endif // EIGEN_EIGENVALUES_MODULE_H
|
||||
/* vim: set filetype=cpp et sw=2 ts=2 ai: */
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "Core"
|
||||
|
||||
#include "src/Core/util/DisableMSVCWarnings.h"
|
||||
#include "src/Core/util/DisableStupidWarnings.h"
|
||||
|
||||
#include "SVD"
|
||||
#include "LU"
|
||||
@@ -60,7 +60,7 @@ namespace Eigen {
|
||||
|
||||
} // namespace Eigen
|
||||
|
||||
#include "src/Core/util/EnableMSVCWarnings.h"
|
||||
#include "src/Core/util/ReenableStupidWarnings.h"
|
||||
|
||||
#endif // EIGEN_GEOMETRY_MODULE_H
|
||||
/* vim: set filetype=cpp et sw=2 ts=2 ai: */
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "Core"
|
||||
|
||||
#include "src/Core/util/DisableMSVCWarnings.h"
|
||||
#include "src/Core/util/DisableStupidWarnings.h"
|
||||
|
||||
namespace Eigen {
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Eigen {
|
||||
|
||||
} // namespace Eigen
|
||||
|
||||
#include "src/Core/util/EnableMSVCWarnings.h"
|
||||
#include "src/Core/util/ReenableStupidWarnings.h"
|
||||
|
||||
#endif // EIGEN_HOUSEHOLDER_MODULE_H
|
||||
/* vim: set filetype=cpp et sw=2 ts=2 ai: */
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "Core"
|
||||
|
||||
#include "src/Core/util/DisableMSVCWarnings.h"
|
||||
#include "src/Core/util/DisableStupidWarnings.h"
|
||||
|
||||
namespace Eigen {
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Eigen {
|
||||
|
||||
} // namespace Eigen
|
||||
|
||||
#include "src/Core/util/EnableMSVCWarnings.h"
|
||||
#include "src/Core/util/ReenableStupidWarnings.h"
|
||||
|
||||
#endif // EIGEN_JACOBI_MODULE_H
|
||||
/* vim: set filetype=cpp et sw=2 ts=2 ai: */
|
||||
|
||||
4
Eigen/LU
4
Eigen/LU
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "Core"
|
||||
|
||||
#include "src/Core/util/DisableMSVCWarnings.h"
|
||||
#include "src/Core/util/DisableStupidWarnings.h"
|
||||
|
||||
namespace Eigen {
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Eigen {
|
||||
|
||||
} // namespace Eigen
|
||||
|
||||
#include "src/Core/util/EnableMSVCWarnings.h"
|
||||
#include "src/Core/util/ReenableStupidWarnings.h"
|
||||
|
||||
#endif // EIGEN_LU_MODULE_H
|
||||
/* vim: set filetype=cpp et sw=2 ts=2 ai: */
|
||||
|
||||
@@ -5,9 +5,12 @@
|
||||
#error LeastSquares is only available in Eigen2 support mode (define EIGEN2_SUPPORT)
|
||||
#endif
|
||||
|
||||
// exclude from normal eigen3-only documentation
|
||||
#ifdef EIGEN2_SUPPORT
|
||||
|
||||
#include "Core"
|
||||
|
||||
#include "src/Core/util/DisableMSVCWarnings.h"
|
||||
#include "src/Core/util/DisableStupidWarnings.h"
|
||||
|
||||
#include "Eigenvalues"
|
||||
#include "Geometry"
|
||||
@@ -26,6 +29,8 @@ namespace Eigen {
|
||||
|
||||
} // namespace Eigen
|
||||
|
||||
#include "src/Core/util/EnableMSVCWarnings.h"
|
||||
#include "src/Core/util/ReenableStupidWarnings.h"
|
||||
|
||||
#endif // EIGEN2_SUPPORT
|
||||
|
||||
#endif // EIGEN_REGRESSION_MODULE_H
|
||||
|
||||
4
Eigen/QR
4
Eigen/QR
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "Core"
|
||||
|
||||
#include "src/Core/util/DisableMSVCWarnings.h"
|
||||
#include "src/Core/util/DisableStupidWarnings.h"
|
||||
|
||||
#include "Cholesky"
|
||||
#include "Jacobi"
|
||||
@@ -35,7 +35,7 @@ namespace Eigen {
|
||||
|
||||
} // namespace Eigen
|
||||
|
||||
#include "src/Core/util/EnableMSVCWarnings.h"
|
||||
#include "src/Core/util/ReenableStupidWarnings.h"
|
||||
|
||||
#ifdef EIGEN2_SUPPORT
|
||||
#include "Eigenvalues"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#if (!EIGEN_MALLOC_ALREADY_ALIGNED)
|
||||
|
||||
#include "src/Core/util/DisableMSVCWarnings.h"
|
||||
#include "src/Core/util/DisableStupidWarnings.h"
|
||||
|
||||
void *qMalloc(size_t size)
|
||||
{
|
||||
@@ -26,7 +26,7 @@ void *qRealloc(void *ptr, size_t size)
|
||||
return newPtr;
|
||||
}
|
||||
|
||||
#include "src/Core/util/EnableMSVCWarnings.h"
|
||||
#include "src/Core/util/ReenableStupidWarnings.h"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "Householder"
|
||||
#include "Jacobi"
|
||||
|
||||
#include "src/Core/util/DisableMSVCWarnings.h"
|
||||
#include "src/Core/util/DisableStupidWarnings.h"
|
||||
|
||||
namespace Eigen {
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Eigen {
|
||||
|
||||
} // namespace Eigen
|
||||
|
||||
#include "src/Core/util/EnableMSVCWarnings.h"
|
||||
#include "src/Core/util/ReenableStupidWarnings.h"
|
||||
|
||||
#endif // EIGEN_SVD_MODULE_H
|
||||
/* vim: set filetype=cpp et sw=2 ts=2 ai: */
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "Core"
|
||||
|
||||
#include "src/Core/util/DisableMSVCWarnings.h"
|
||||
#include "src/Core/util/DisableStupidWarnings.h"
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
@@ -63,7 +63,7 @@ struct Sparse {};
|
||||
|
||||
} // namespace Eigen
|
||||
|
||||
#include "src/Core/util/EnableMSVCWarnings.h"
|
||||
#include "src/Core/util/ReenableStupidWarnings.h"
|
||||
|
||||
#endif // EIGEN_SPARSE_MODULE_H
|
||||
|
||||
|
||||
@@ -37,6 +37,9 @@
|
||||
* API for the %Matrix class provides easy access to linear-algebra
|
||||
* operations.
|
||||
*
|
||||
* 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_ARRAY_PLUGIN.
|
||||
*
|
||||
* \sa \ref TutorialArrayClass, \ref TopicClassHierarchy
|
||||
*/
|
||||
namespace internal {
|
||||
|
||||
@@ -42,7 +42,10 @@ template<typename ExpressionType> class MatrixWrapper;
|
||||
*
|
||||
* This class is the base that is inherited by all array expression types.
|
||||
*
|
||||
* \param Derived is the derived type, e.g., an array or an expression type.
|
||||
* \tparam Derived is the derived type, e.g., an array or an expression type.
|
||||
*
|
||||
* 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_ARRAYBASE_PLUGIN.
|
||||
*
|
||||
* \sa class MatrixBase, \ref TopicClassHierarchy
|
||||
*/
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
DstIsAligned = Derived::Flags & AlignedBit,
|
||||
DstHasDirectAccess = Derived::Flags & DirectAccessBit,
|
||||
SrcIsAligned = OtherDerived::Flags & AlignedBit,
|
||||
JointAlignment = DstIsAligned && SrcIsAligned ? Aligned : Unaligned
|
||||
JointAlignment = bool(DstIsAligned) && bool(SrcIsAligned) ? Aligned : Unaligned
|
||||
};
|
||||
|
||||
private:
|
||||
@@ -106,9 +106,9 @@ public:
|
||||
: int(NoUnrolling)
|
||||
)
|
||||
: int(Traversal) == int(LinearVectorizedTraversal)
|
||||
? ( int(MayUnrollCompletely) && int(DstIsAligned) ? int(CompleteUnrolling) : int(NoUnrolling) )
|
||||
? ( bool(MayUnrollCompletely) && bool(DstIsAligned) ? int(CompleteUnrolling) : int(NoUnrolling) )
|
||||
: int(Traversal) == int(LinearTraversal)
|
||||
? ( int(MayUnrollCompletely) ? int(CompleteUnrolling) : int(NoUnrolling) )
|
||||
? ( bool(MayUnrollCompletely) ? int(CompleteUnrolling) : int(NoUnrolling) )
|
||||
: int(NoUnrolling)
|
||||
};
|
||||
|
||||
@@ -474,7 +474,7 @@ struct assign_impl<Derived1, Derived2, SliceVectorizedTraversal, NoUnrolling>
|
||||
|
||||
// do the vectorizable part of the assignment
|
||||
for(Index inner = alignedStart; inner<alignedEnd; inner+=packetSize)
|
||||
dst.template copyPacketByOuterInner<Derived2, Aligned, Unaligned>(outer, inner, src);
|
||||
dst.template copyPacketByOuterInner<Derived2, dstAlignment, Unaligned>(outer, inner, src);
|
||||
|
||||
// do the non-vectorizable part of the assignment
|
||||
for(Index inner = alignedEnd; inner<innerSize ; ++inner)
|
||||
|
||||
@@ -34,7 +34,10 @@
|
||||
* This class is the base that is inherited by all dense objects (matrix, vector, arrays,
|
||||
* and related expression types). The common Eigen API for dense objects is contained in this class.
|
||||
*
|
||||
* \param Derived is the derived type, e.g., a matrix type or an expression.
|
||||
* \tparam Derived is the derived type, e.g., a matrix type or an expression.
|
||||
*
|
||||
* 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_DENSEBASE_PLUGIN.
|
||||
*
|
||||
* \sa \ref TopicClassHierarchy
|
||||
*/
|
||||
@@ -53,7 +56,13 @@ template<typename Derived> class DenseBase
|
||||
class InnerIterator;
|
||||
|
||||
typedef typename internal::traits<Derived>::StorageKind StorageKind;
|
||||
typedef typename internal::traits<Derived>::Index Index; /**< The type of indices */
|
||||
|
||||
/** \brief The type of indices
|
||||
* \details To change this, \c \#define the preprocessor symbol \c EIGEN_DEFAULT_DENSE_INDEX_TYPE.
|
||||
* \sa \ref TopicPreprocessorDirectives.
|
||||
*/
|
||||
typedef typename internal::traits<Derived>::Index Index;
|
||||
|
||||
typedef typename internal::traits<Derived>::Scalar Scalar;
|
||||
typedef typename internal::packet_traits<Scalar>::type PacketScalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
|
||||
@@ -65,7 +65,7 @@ struct plain_array
|
||||
template <typename T, int Size, int MatrixOrArrayOptions>
|
||||
struct plain_array<T, Size, MatrixOrArrayOptions, 16>
|
||||
{
|
||||
EIGEN_ALIGN16 T array[Size];
|
||||
EIGEN_USER_ALIGN16 T array[Size];
|
||||
plain_array() { EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(0xf) }
|
||||
plain_array(constructor_without_unaligned_array_assert) {}
|
||||
};
|
||||
@@ -73,7 +73,7 @@ struct plain_array<T, Size, MatrixOrArrayOptions, 16>
|
||||
template <typename T, int MatrixOrArrayOptions, int Alignment>
|
||||
struct plain_array<T, 0, MatrixOrArrayOptions, Alignment>
|
||||
{
|
||||
EIGEN_ALIGN16 T array[1];
|
||||
EIGEN_USER_ALIGN16 T array[1];
|
||||
plain_array() {}
|
||||
plain_array(constructor_without_unaligned_array_assert) {}
|
||||
};
|
||||
|
||||
@@ -669,7 +669,7 @@ struct functor_traits<scalar_sqrt_op<Scalar> >
|
||||
|
||||
/** \internal
|
||||
* \brief Template functor to compute the cosine of a scalar
|
||||
* \sa class CwiseUnaryOp, Cwise::cos()
|
||||
* \sa class CwiseUnaryOp, ArrayBase::cos()
|
||||
*/
|
||||
template<typename Scalar> struct scalar_cos_op {
|
||||
EIGEN_EMPTY_STRUCT_CTOR(scalar_cos_op)
|
||||
@@ -688,7 +688,7 @@ struct functor_traits<scalar_cos_op<Scalar> >
|
||||
|
||||
/** \internal
|
||||
* \brief Template functor to compute the sine of a scalar
|
||||
* \sa class CwiseUnaryOp, Cwise::sin()
|
||||
* \sa class CwiseUnaryOp, ArrayBase::sin()
|
||||
*/
|
||||
template<typename Scalar> struct scalar_sin_op {
|
||||
EIGEN_EMPTY_STRUCT_CTOR(scalar_sin_op)
|
||||
@@ -708,7 +708,7 @@ struct functor_traits<scalar_sin_op<Scalar> >
|
||||
|
||||
/** \internal
|
||||
* \brief Template functor to compute the tan of a scalar
|
||||
* \sa class CwiseUnaryOp, Cwise::tan()
|
||||
* \sa class CwiseUnaryOp, ArrayBase::tan()
|
||||
*/
|
||||
template<typename Scalar> struct scalar_tan_op {
|
||||
EIGEN_EMPTY_STRUCT_CTOR(scalar_tan_op)
|
||||
@@ -725,6 +725,44 @@ struct functor_traits<scalar_tan_op<Scalar> >
|
||||
};
|
||||
};
|
||||
|
||||
/** \internal
|
||||
* \brief Template functor to compute the arc cosine of a scalar
|
||||
* \sa class CwiseUnaryOp, ArrayBase::acos()
|
||||
*/
|
||||
template<typename Scalar> struct scalar_acos_op {
|
||||
EIGEN_EMPTY_STRUCT_CTOR(scalar_acos_op)
|
||||
inline const Scalar operator() (const Scalar& a) const { return acos(a); }
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
inline Packet packetOp(const Packet& a) const { return internal::pacos(a); }
|
||||
};
|
||||
template<typename Scalar>
|
||||
struct functor_traits<scalar_acos_op<Scalar> >
|
||||
{
|
||||
enum {
|
||||
Cost = 5 * NumTraits<Scalar>::MulCost,
|
||||
PacketAccess = packet_traits<Scalar>::HasACos
|
||||
};
|
||||
};
|
||||
|
||||
/** \internal
|
||||
* \brief Template functor to compute the arc sine of a scalar
|
||||
* \sa class CwiseUnaryOp, ArrayBase::asin()
|
||||
*/
|
||||
template<typename Scalar> struct scalar_asin_op {
|
||||
EIGEN_EMPTY_STRUCT_CTOR(scalar_asin_op)
|
||||
inline const Scalar operator() (const Scalar& a) const { return acos(a); }
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
inline Packet packetOp(const Packet& a) const { return internal::pacos(a); }
|
||||
};
|
||||
template<typename Scalar>
|
||||
struct functor_traits<scalar_asin_op<Scalar> >
|
||||
{
|
||||
enum {
|
||||
Cost = 5 * NumTraits<Scalar>::MulCost,
|
||||
PacketAccess = packet_traits<Scalar>::HasASin
|
||||
};
|
||||
};
|
||||
|
||||
/** \internal
|
||||
* \brief Template functor to raise a scalar to a power
|
||||
* \sa class CwiseUnaryOp, Cwise::pow
|
||||
|
||||
@@ -225,15 +225,20 @@ template<typename Packet> inline typename unpacket_traits<Packet>::type predux_m
|
||||
template<typename Packet> inline Packet preverse(const Packet& a)
|
||||
{ return a; }
|
||||
|
||||
|
||||
/** \internal \returns \a a with real and imaginary part flipped (for complex type only) */
|
||||
template<typename Packet> inline Packet pcplxflip(const Packet& a)
|
||||
{ return Packet(imag(a),real(a)); }
|
||||
|
||||
/**************************
|
||||
* Special math functions
|
||||
***************************/
|
||||
|
||||
/** \internal \returns the sin of \a a (coeff-wise) */
|
||||
/** \internal \returns the sine of \a a (coeff-wise) */
|
||||
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet psin(const Packet& a) { return sin(a); }
|
||||
|
||||
/** \internal \returns the cos of \a a (coeff-wise) */
|
||||
/** \internal \returns the cosine of \a a (coeff-wise) */
|
||||
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet pcos(const Packet& a) { return cos(a); }
|
||||
|
||||
@@ -241,6 +246,14 @@ Packet pcos(const Packet& a) { return cos(a); }
|
||||
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet ptan(const Packet& a) { return tan(a); }
|
||||
|
||||
/** \internal \returns the arc sine of \a a (coeff-wise) */
|
||||
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet pasin(const Packet& a) { return asin(a); }
|
||||
|
||||
/** \internal \returns the arc cosine of \a a (coeff-wise) */
|
||||
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet pacos(const Packet& a) { return acos(a); }
|
||||
|
||||
/** \internal \returns the exp of \a a (coeff-wise) */
|
||||
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet pexp(const Packet& a) { return exp(a); }
|
||||
@@ -257,6 +270,14 @@ Packet psqrt(const Packet& a) { return sqrt(a); }
|
||||
* The following functions might not have to be overwritten for vectorized types
|
||||
***************************************************************************/
|
||||
|
||||
/** \internal copy a packet with constant coeficient \a a (e.g., [a,a,a,a]) to \a *to. \a to must be 16 bytes aligned */
|
||||
// NOTE: this function must really be templated on the packet type (think about different packet types for the same scalar type)
|
||||
template<typename Packet>
|
||||
inline void pstore1(typename unpacket_traits<Packet>::type* to, const typename unpacket_traits<Packet>::type& a)
|
||||
{
|
||||
pstore(to, pset1<Packet>(a));
|
||||
}
|
||||
|
||||
/** \internal \returns a * b + c (coeff-wise) */
|
||||
template<typename Packet> inline Packet
|
||||
pmadd(const Packet& a,
|
||||
|
||||
@@ -56,6 +56,8 @@ namespace std
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(imag,scalar_imag_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(sin,scalar_sin_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(cos,scalar_cos_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(asin,scalar_asin_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(acos,scalar_acos_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(tan,scalar_tan_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(exp,scalar_exp_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(log,scalar_log_op)
|
||||
@@ -77,6 +79,8 @@ namespace Eigen
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(imag,scalar_imag_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(sin,scalar_sin_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(cos,scalar_cos_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(asin,scalar_asin_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(acos,scalar_acos_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(tan,scalar_tan_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(exp,scalar_exp_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(log,scalar_log_op)
|
||||
|
||||
@@ -95,7 +95,7 @@ struct traits<Map<PlainObjectType, MapOptions, StrideType> >
|
||||
HasNoInnerStride = InnerStrideAtCompileTime == 1,
|
||||
HasNoOuterStride = StrideType::OuterStrideAtCompileTime == 0,
|
||||
HasNoStride = HasNoInnerStride && HasNoOuterStride,
|
||||
IsAligned = int(int(MapOptions)&Aligned)==Aligned,
|
||||
IsAligned = bool(EIGEN_ALIGN) && ((int(MapOptions)&Aligned)==Aligned),
|
||||
IsDynamicSize = PlainObjectType::SizeAtCompileTime==Dynamic,
|
||||
KeepsPacketAccess = bool(HasNoInnerStride)
|
||||
&& ( bool(IsDynamicSize)
|
||||
@@ -192,14 +192,14 @@ template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int
|
||||
inline Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>
|
||||
::Array(const Scalar *data)
|
||||
{
|
||||
_set_noalias(Eigen::Map<const Array>(data));
|
||||
this->_set_noalias(Eigen::Map<const Array>(data));
|
||||
}
|
||||
|
||||
template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
|
||||
inline Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>
|
||||
::Matrix(const Scalar *data)
|
||||
{
|
||||
_set_noalias(Eigen::Map<const Matrix>(data));
|
||||
this->_set_noalias(Eigen::Map<const Matrix>(data));
|
||||
}
|
||||
|
||||
#endif // EIGEN_MAP_H
|
||||
|
||||
@@ -85,6 +85,8 @@ template<typename Derived> class MapBase<Derived, ReadOnlyAccessors>
|
||||
using Base::rowStride;
|
||||
using Base::colStride;
|
||||
|
||||
// bug 217 - compile error on ICC 11.1
|
||||
using Base::operator=;
|
||||
|
||||
typedef typename Base::CoeffReturnType CoeffReturnType;
|
||||
|
||||
|
||||
@@ -454,194 +454,36 @@ inline EIGEN_MATHFUNC_RETVAL(sqrt, Scalar) sqrt(const Scalar& x)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Implementation of exp *
|
||||
* Implementation of standard unary real functions (exp, log, sin, cos, ... *
|
||||
****************************************************************************/
|
||||
|
||||
template<typename Scalar, bool IsInteger>
|
||||
struct exp_default_impl
|
||||
{
|
||||
static inline Scalar run(const Scalar& x)
|
||||
{
|
||||
return std::exp(x);
|
||||
// This macro instanciate all the necessary template mechanism which is common to all unary real functions.
|
||||
#define EIGEN_MATHFUNC_STANDARD_REAL_UNARY(NAME) \
|
||||
template<typename Scalar, bool IsInteger> struct NAME##_default_impl { \
|
||||
static inline Scalar run(const Scalar& x) { return std::NAME(x); } \
|
||||
}; \
|
||||
template<typename Scalar> struct NAME##_default_impl<Scalar, true> { \
|
||||
static inline Scalar run(const Scalar&) { \
|
||||
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) \
|
||||
return Scalar(0); \
|
||||
} \
|
||||
}; \
|
||||
template<typename Scalar> struct NAME##_impl \
|
||||
: NAME##_default_impl<Scalar, NumTraits<Scalar>::IsInteger> \
|
||||
{}; \
|
||||
template<typename Scalar> struct NAME##_retval { typedef Scalar type; }; \
|
||||
template<typename Scalar> \
|
||||
inline EIGEN_MATHFUNC_RETVAL(NAME, Scalar) NAME(const Scalar& x) { \
|
||||
return EIGEN_MATHFUNC_IMPL(NAME, Scalar)::run(x); \
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Scalar>
|
||||
struct exp_default_impl<Scalar, true>
|
||||
{
|
||||
static inline Scalar run(const Scalar&)
|
||||
{
|
||||
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar)
|
||||
return Scalar(0);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Scalar>
|
||||
struct exp_impl : exp_default_impl<Scalar, NumTraits<Scalar>::IsInteger> {};
|
||||
|
||||
template<typename Scalar>
|
||||
struct exp_retval
|
||||
{
|
||||
typedef Scalar type;
|
||||
};
|
||||
|
||||
template<typename Scalar>
|
||||
inline EIGEN_MATHFUNC_RETVAL(exp, Scalar) exp(const Scalar& x)
|
||||
{
|
||||
return EIGEN_MATHFUNC_IMPL(exp, Scalar)::run(x);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Implementation of cos *
|
||||
****************************************************************************/
|
||||
|
||||
template<typename Scalar, bool IsInteger>
|
||||
struct cos_default_impl
|
||||
{
|
||||
static inline Scalar run(const Scalar& x)
|
||||
{
|
||||
return std::cos(x);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Scalar>
|
||||
struct cos_default_impl<Scalar, true>
|
||||
{
|
||||
static inline Scalar run(const Scalar&)
|
||||
{
|
||||
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar)
|
||||
return Scalar(0);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Scalar>
|
||||
struct cos_impl : cos_default_impl<Scalar, NumTraits<Scalar>::IsInteger> {};
|
||||
|
||||
template<typename Scalar>
|
||||
struct cos_retval
|
||||
{
|
||||
typedef Scalar type;
|
||||
};
|
||||
|
||||
template<typename Scalar>
|
||||
inline EIGEN_MATHFUNC_RETVAL(cos, Scalar) cos(const Scalar& x)
|
||||
{
|
||||
return EIGEN_MATHFUNC_IMPL(cos, Scalar)::run(x);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Implementation of sin *
|
||||
****************************************************************************/
|
||||
|
||||
template<typename Scalar, bool IsInteger>
|
||||
struct sin_default_impl
|
||||
{
|
||||
static inline Scalar run(const Scalar& x)
|
||||
{
|
||||
return std::sin(x);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Scalar>
|
||||
struct sin_default_impl<Scalar, true>
|
||||
{
|
||||
static inline Scalar run(const Scalar&)
|
||||
{
|
||||
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar)
|
||||
return Scalar(0);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Scalar>
|
||||
struct sin_impl : sin_default_impl<Scalar, NumTraits<Scalar>::IsInteger> {};
|
||||
|
||||
template<typename Scalar>
|
||||
struct sin_retval
|
||||
{
|
||||
typedef Scalar type;
|
||||
};
|
||||
|
||||
template<typename Scalar>
|
||||
inline EIGEN_MATHFUNC_RETVAL(sin, Scalar) sin(const Scalar& x)
|
||||
{
|
||||
return EIGEN_MATHFUNC_IMPL(sin, Scalar)::run(x);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Implementation of tan *
|
||||
****************************************************************************/
|
||||
|
||||
template<typename Scalar, bool IsInteger>
|
||||
struct tan_default_impl
|
||||
{
|
||||
static inline Scalar run(const Scalar& x)
|
||||
{
|
||||
return std::tan(x);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Scalar>
|
||||
struct tan_default_impl<Scalar, true>
|
||||
{
|
||||
static inline Scalar run(const Scalar&)
|
||||
{
|
||||
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar)
|
||||
return Scalar(0);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Scalar>
|
||||
struct tan_impl : tan_default_impl<Scalar, NumTraits<Scalar>::IsInteger> {};
|
||||
|
||||
template<typename Scalar>
|
||||
struct tan_retval
|
||||
{
|
||||
typedef Scalar type;
|
||||
};
|
||||
|
||||
template<typename Scalar>
|
||||
inline EIGEN_MATHFUNC_RETVAL(tan, Scalar) tan(const Scalar& x)
|
||||
{
|
||||
return EIGEN_MATHFUNC_IMPL(tan, Scalar)::run(x);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Implementation of log *
|
||||
****************************************************************************/
|
||||
|
||||
template<typename Scalar, bool IsInteger>
|
||||
struct log_default_impl
|
||||
{
|
||||
static inline Scalar run(const Scalar& x)
|
||||
{
|
||||
return std::log(x);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Scalar>
|
||||
struct log_default_impl<Scalar, true>
|
||||
{
|
||||
static inline Scalar run(const Scalar&)
|
||||
{
|
||||
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar)
|
||||
return Scalar(0);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Scalar>
|
||||
struct log_impl : log_default_impl<Scalar, NumTraits<Scalar>::IsInteger> {};
|
||||
|
||||
template<typename Scalar>
|
||||
struct log_retval
|
||||
{
|
||||
typedef Scalar type;
|
||||
};
|
||||
|
||||
template<typename Scalar>
|
||||
inline EIGEN_MATHFUNC_RETVAL(log, Scalar) log(const Scalar& x)
|
||||
{
|
||||
return EIGEN_MATHFUNC_IMPL(log, Scalar)::run(x);
|
||||
}
|
||||
EIGEN_MATHFUNC_STANDARD_REAL_UNARY(exp)
|
||||
EIGEN_MATHFUNC_STANDARD_REAL_UNARY(log)
|
||||
EIGEN_MATHFUNC_STANDARD_REAL_UNARY(sin)
|
||||
EIGEN_MATHFUNC_STANDARD_REAL_UNARY(cos)
|
||||
EIGEN_MATHFUNC_STANDARD_REAL_UNARY(tan)
|
||||
EIGEN_MATHFUNC_STANDARD_REAL_UNARY(asin)
|
||||
EIGEN_MATHFUNC_STANDARD_REAL_UNARY(acos)
|
||||
|
||||
/****************************************************************************
|
||||
* Implementation of atan2 *
|
||||
|
||||
@@ -79,6 +79,9 @@
|
||||
* m(0, 3) = 3;
|
||||
* \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_MATRIX_PLUGIN.
|
||||
*
|
||||
* <i><b>Some notes:</b></i>
|
||||
*
|
||||
* <dl>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
* Note that some methods are defined in other modules such as the \ref LU_Module LU module
|
||||
* for all functions related to matrix inversions.
|
||||
*
|
||||
* \param Derived is the derived type, e.g. a matrix type, or an expression, etc.
|
||||
* \tparam Derived is the derived type, e.g. a matrix type, or an expression, etc.
|
||||
*
|
||||
* When writing a function taking Eigen objects as argument, if you want your function
|
||||
* to take as argument any matrix, vector, or expression, just let it take a
|
||||
@@ -53,6 +53,9 @@
|
||||
}
|
||||
* \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_MATRIXBASE_PLUGIN.
|
||||
*
|
||||
* \sa \ref TopicClassHierarchy
|
||||
*/
|
||||
template<typename Derived> class MatrixBase
|
||||
|
||||
@@ -42,6 +42,10 @@ template<typename MatrixTypeA, typename MatrixTypeB, bool SwapPointers> struct m
|
||||
|
||||
/**
|
||||
* \brief %Dense storage base class for matrices and arrays.
|
||||
*
|
||||
* 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_PLAINOBJECTBASE_PLUGIN.
|
||||
*
|
||||
* \sa \ref TopicClassHierarchy
|
||||
*/
|
||||
template<typename Derived>
|
||||
@@ -283,33 +287,47 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
|
||||
else resize(other.rows(), other.cols());
|
||||
}
|
||||
|
||||
/** Resizes \c *this to a \a rows x \a cols matrix while leaving old values of \c *this untouched.
|
||||
/** Resizes the matrix to \a rows x \a cols while leaving old values untouched.
|
||||
*
|
||||
* This method is intended for dynamic-size matrices. If you only want to change the number
|
||||
* of rows and/or of columns, you can use conservativeResize(NoChange_t, Index),
|
||||
* The method is intended for matrices of dynamic size. If you only want to change the number
|
||||
* of rows and/or of columns, you can use conservativeResize(NoChange_t, Index) or
|
||||
* conservativeResize(Index, NoChange_t).
|
||||
*
|
||||
* The top-left part of the resized matrix will be the same as the overlapping top-left corner
|
||||
* of \c *this. In case values need to be appended to the matrix they will be uninitialized.
|
||||
* Matrices are resized relative to the top-left element. In case values need to be
|
||||
* appended to the matrix they will be uninitialized.
|
||||
*/
|
||||
EIGEN_STRONG_INLINE void conservativeResize(Index rows, Index cols)
|
||||
{
|
||||
internal::conservative_resize_like_impl<Derived>::run(*this, rows, cols);
|
||||
}
|
||||
|
||||
/** Resizes the matrix to \a rows x \a cols while leaving old values untouched.
|
||||
*
|
||||
* As opposed to conservativeResize(Index rows, Index cols), this version leaves
|
||||
* the number of columns unchanged.
|
||||
*
|
||||
* In case the matrix is growing, new rows will be uninitialized.
|
||||
*/
|
||||
EIGEN_STRONG_INLINE void conservativeResize(Index rows, NoChange_t)
|
||||
{
|
||||
// Note: see the comment in conservativeResize(Index,Index)
|
||||
conservativeResize(rows, cols());
|
||||
}
|
||||
|
||||
/** Resizes the matrix to \a rows x \a cols while leaving old values untouched.
|
||||
*
|
||||
* As opposed to conservativeResize(Index rows, Index cols), this version leaves
|
||||
* the number of rows unchanged.
|
||||
*
|
||||
* In case the matrix is growing, new columns will be uninitialized.
|
||||
*/
|
||||
EIGEN_STRONG_INLINE void conservativeResize(NoChange_t, Index cols)
|
||||
{
|
||||
// Note: see the comment in conservativeResize(Index,Index)
|
||||
conservativeResize(rows(), cols);
|
||||
}
|
||||
|
||||
/** Resizes \c *this to a vector of length \a size while retaining old values of *this.
|
||||
/** Resizes the vector to \a size while retaining old values.
|
||||
*
|
||||
* \only_for_vectors. This method does not work for
|
||||
* partially dynamic matrices when the static dimension is anything other
|
||||
@@ -322,6 +340,15 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
|
||||
internal::conservative_resize_like_impl<Derived>::run(*this, size);
|
||||
}
|
||||
|
||||
/** Resizes the matrix to \a rows x \a cols of \c other, while leaving old values untouched.
|
||||
*
|
||||
* The method is intended for matrices of dynamic size. If you only want to change the number
|
||||
* of rows and/or of columns, you can use conservativeResize(NoChange_t, Index) or
|
||||
* conservativeResize(Index, NoChange_t).
|
||||
*
|
||||
* Matrices are resized relative to the top-left element. In case values need to be
|
||||
* appended to the matrix they will copied from \c other.
|
||||
*/
|
||||
template<typename OtherDerived>
|
||||
EIGEN_STRONG_INLINE void conservativeResizeLike(const DenseBase<OtherDerived>& other)
|
||||
{
|
||||
|
||||
@@ -216,7 +216,7 @@ struct redux_impl<Func, Derived, LinearVectorizedTraversal, NoUnrolling>
|
||||
const Index packetSize = packet_traits<Scalar>::size;
|
||||
const Index alignedStart = first_aligned(mat);
|
||||
enum {
|
||||
alignment = (Derived::Flags & DirectAccessBit) || (Derived::Flags & AlignedBit)
|
||||
alignment = bool(Derived::Flags & DirectAccessBit) || bool(Derived::Flags & AlignedBit)
|
||||
? Aligned : Unaligned
|
||||
};
|
||||
const Index alignedSize = ((size-alignedStart)/packetSize)*packetSize;
|
||||
|
||||
@@ -71,9 +71,9 @@ template<typename Derived> class ReturnByValue
|
||||
|
||||
template<typename Dest>
|
||||
inline void evalTo(Dest& dst) const
|
||||
{ static_cast<const Derived* const>(this)->evalTo(dst); }
|
||||
inline Index rows() const { return static_cast<const Derived* const>(this)->rows(); }
|
||||
inline Index cols() const { return static_cast<const Derived* const>(this)->cols(); }
|
||||
{ static_cast<const Derived*>(this)->evalTo(dst); }
|
||||
inline Index rows() const { return static_cast<const Derived*>(this)->rows(); }
|
||||
inline Index cols() const { return static_cast<const Derived*>(this)->cols(); }
|
||||
|
||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||
#define Unusable YOU_ARE_TRYING_TO_ACCESS_A_SINGLE_COEFFICIENT_IN_A_SPECIAL_EXPRESSION_WHERE_THAT_IS_NOT_ALLOWED_BECAUSE_THAT_WOULD_BE_INEFFICIENT
|
||||
|
||||
@@ -48,6 +48,7 @@ template<> struct packet_traits<std::complex<float> > : default_packet_traits
|
||||
typedef Packet2cf type;
|
||||
enum {
|
||||
Vectorizable = 1,
|
||||
AlignedOnScalar = 1,
|
||||
size = 2,
|
||||
|
||||
HasAdd = 1,
|
||||
@@ -69,19 +70,17 @@ template<> EIGEN_STRONG_INLINE Packet2cf pset1<Packet2cf>(const std::complex<flo
|
||||
{
|
||||
Packet2cf res;
|
||||
/* On AltiVec we cannot load 64-bit registers, so wa have to take care of alignment */
|
||||
if ((ptrdiff_t)&from % 16 == 0) {
|
||||
res.v = pload((const float *)&from);
|
||||
res.v = vec_perm(res.v, res.v, p16uc_PSET_HI);
|
||||
} else {
|
||||
res.v = ploadu((const float *)&from);
|
||||
res.v = vec_perm(res.v, res.v, p16uc_PSET_LO);
|
||||
}
|
||||
if((ptrdiff_t(&from) % 16) == 0)
|
||||
res.v = pload<Packet4f>((const float *)&from);
|
||||
else
|
||||
res.v = ploadu<Packet4f>((const float *)&from);
|
||||
res.v = vec_perm(res.v, res.v, p16uc_PSET_HI);
|
||||
return res;
|
||||
}
|
||||
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf padd<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(vec_add(a.v,b.v)); }
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf psub<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(vec_sub(a.v,b.v)); }
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf pnegate(const Packet2cf& a) { return Packet2cf(psub<Packet4f>(p4f_ZERO, a.v)); }
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf pnegate(const Packet2cf& a) { return Packet2cf(pnegate(a.v)); }
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf pconj(const Packet2cf& a) { return Packet2cf((Packet4f)vec_xor((Packet4ui)a.v, p4ui_CONJ_XOR)); }
|
||||
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf pmul<Packet2cf>(const Packet2cf& a, const Packet2cf& b)
|
||||
@@ -108,8 +107,13 @@ template<> EIGEN_STRONG_INLINE Packet2cf por <Packet2cf>(const Packet2cf& a,
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf pxor <Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(vec_xor(a.v,b.v)); }
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf pandnot<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(vec_and(a.v, vec_nor(b.v,b.v))); }
|
||||
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf pload <std::complex<float> >(const std::complex<float>* from) { EIGEN_DEBUG_ALIGNED_LOAD return Packet2cf(pload((const float*)from)); }
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf ploadu<std::complex<float> >(const std::complex<float>* from) { EIGEN_DEBUG_UNALIGNED_LOAD return Packet2cf(ploadu((const float*)from)); }
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf pload <Packet2cf>(const std::complex<float>* from) { EIGEN_DEBUG_ALIGNED_LOAD return Packet2cf(pload<Packet4f>((const float*)from)); }
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf ploadu<Packet2cf>(const std::complex<float>* from) { EIGEN_DEBUG_UNALIGNED_LOAD return Packet2cf(ploadu<Packet4f>((const float*)from)); }
|
||||
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf ploaddup<Packet2cf>(const std::complex<float>* from)
|
||||
{
|
||||
return pset1<Packet2cf>(*from);
|
||||
}
|
||||
|
||||
template<> EIGEN_STRONG_INLINE void pstore <std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_ALIGNED_STORE pstore((float*)to, from.v); }
|
||||
template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((float*)to, from.v); }
|
||||
@@ -136,7 +140,7 @@ template<> EIGEN_STRONG_INLINE std::complex<float> predux<Packet2cf>(const Packe
|
||||
Packet4f b;
|
||||
b = (Packet4f) vec_sld(a.v, a.v, 8);
|
||||
b = padd(a.v, b);
|
||||
return pfirst(Packet2cf(sum));
|
||||
return pfirst(Packet2cf(b));
|
||||
}
|
||||
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf preduxp<Packet2cf>(const Packet2cf* vecs)
|
||||
@@ -180,7 +184,7 @@ template<> struct conj_helper<Packet2cf, Packet2cf, false,true>
|
||||
|
||||
EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const
|
||||
{
|
||||
return pmul(a, pconj(b));
|
||||
return internal::pmul(a, pconj(b));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -191,7 +195,7 @@ template<> struct conj_helper<Packet2cf, Packet2cf, true,false>
|
||||
|
||||
EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const
|
||||
{
|
||||
return pmul(pconj(a), b);
|
||||
return internal::pmul(pconj(a), b);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -202,7 +206,7 @@ template<> struct conj_helper<Packet2cf, Packet2cf, true,true>
|
||||
|
||||
EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const
|
||||
{
|
||||
return pconj(pmul(a, b));
|
||||
return pconj(internal::pmul(a, b));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -214,6 +218,11 @@ template<> EIGEN_STRONG_INLINE Packet2cf pdiv<Packet2cf>(const Packet2cf& a, con
|
||||
return Packet2cf(pdiv(res.v, vec_add(s,vec_perm(s, s, p16uc_COMPLEX_REV))));
|
||||
}
|
||||
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf pcplxflip<Packet2cf>(const Packet2cf& x)
|
||||
{
|
||||
return Packet2cf(vec_perm(x.v, x.v, p16uc_COMPLEX_REV));
|
||||
}
|
||||
|
||||
} // end namespace internal
|
||||
|
||||
#endif // EIGEN_COMPLEX_ALTIVEC_H
|
||||
|
||||
@@ -73,6 +73,7 @@ static Packet4f p4f_COUNTDOWN = { 3.0, 2.0, 1.0, 0.0 };
|
||||
static Packet4i p4i_COUNTDOWN = { 3, 2, 1, 0 };
|
||||
static Packet16uc p16uc_REVERSE = {12,13,14,15, 8,9,10,11, 4,5,6,7, 0,1,2,3};
|
||||
static Packet16uc p16uc_FORWARD = vec_lvsl(0, (float*)0);
|
||||
static Packet16uc p16uc_DUPLICATE = {0,1,2,3, 0,1,2,3, 4,5,6,7, 4,5,6,7};
|
||||
|
||||
static _EIGEN_DECLARE_CONST_FAST_Packet4f(ZERO, 0);
|
||||
static _EIGEN_DECLARE_CONST_FAST_Packet4i(ZERO, 0);
|
||||
@@ -292,6 +293,21 @@ template<> EIGEN_STRONG_INLINE Packet4i ploadu<Packet4i>(const int* from)
|
||||
return (Packet4i) vec_perm(MSQ, LSQ, mask); // align the data
|
||||
}
|
||||
|
||||
template<> EIGEN_STRONG_INLINE Packet4f ploaddup<Packet4f>(const float* from)
|
||||
{
|
||||
Packet4f p;
|
||||
if((ptrdiff_t(&from) % 16) == 0) p = pload<Packet4f>(from);
|
||||
else p = ploadu<Packet4f>(from);
|
||||
return vec_perm(p, p, p16uc_DUPLICATE);
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE Packet4i ploaddup<Packet4i>(const int* from)
|
||||
{
|
||||
Packet4i p;
|
||||
if((ptrdiff_t(&from) % 16) == 0) p = pload<Packet4i>(from);
|
||||
else p = ploadu<Packet4i>(from);
|
||||
return vec_perm(p, p, p16uc_DUPLICATE);
|
||||
}
|
||||
|
||||
template<> EIGEN_STRONG_INLINE void pstore<float>(float* to, const Packet4f& from) { EIGEN_DEBUG_ALIGNED_STORE vec_st(from, 0, to); }
|
||||
template<> EIGEN_STRONG_INLINE void pstore<int>(int* to, const Packet4i& from) { EIGEN_DEBUG_ALIGNED_STORE vec_st(from, 0, to); }
|
||||
|
||||
|
||||
@@ -120,6 +120,8 @@ template<> EIGEN_STRONG_INLINE Packet2cf pandnot<Packet2cf>(const Packet2cf& a,
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf pload<Packet2cf>(const std::complex<float>* from) { EIGEN_DEBUG_ALIGNED_LOAD return Packet2cf(pload<Packet4f>((const float*)from)); }
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf ploadu<Packet2cf>(const std::complex<float>* from) { EIGEN_DEBUG_UNALIGNED_LOAD return Packet2cf(ploadu<Packet4f>((const float*)from)); }
|
||||
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf ploaddup<Packet2cf>(const std::complex<float>* from) { return pset1<Packet2cf>(*from); }
|
||||
|
||||
template<> EIGEN_STRONG_INLINE void pstore <std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_ALIGNED_STORE pstore((float*)to, from.v); }
|
||||
template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((float*)to, from.v); }
|
||||
|
||||
@@ -144,7 +146,7 @@ template<> EIGEN_STRONG_INLINE Packet2cf preverse(const Packet2cf& a)
|
||||
return Packet2cf(a_r128);
|
||||
}
|
||||
|
||||
EIGEN_STRONG_INLINE Packet2cf pcplxflip(const Packet2cf& a)
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf pcplxflip<Packet2cf>(const Packet2cf& a)
|
||||
{
|
||||
return Packet2cf(vrev64q_f32(a.v));
|
||||
}
|
||||
@@ -220,7 +222,7 @@ template<> struct conj_helper<Packet2cf, Packet2cf, false,true>
|
||||
|
||||
EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const
|
||||
{
|
||||
return pmul(a, pconj(b));
|
||||
return internal::pmul(a, pconj(b));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -231,7 +233,7 @@ template<> struct conj_helper<Packet2cf, Packet2cf, true,false>
|
||||
|
||||
EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const
|
||||
{
|
||||
return pmul(pconj(a), b);
|
||||
return internal::pmul(pconj(a), b);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -242,7 +244,7 @@ template<> struct conj_helper<Packet2cf, Packet2cf, true,true>
|
||||
|
||||
EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const
|
||||
{
|
||||
return pconj(pmul(a, b));
|
||||
return pconj(internal::pmul(a, b));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace internal {
|
||||
|
||||
typedef float32x4_t Packet4f;
|
||||
typedef int32x4_t Packet4i;
|
||||
typedef uint32x4_t Packet4ui;
|
||||
typedef uint32x4_t Packet4ui;
|
||||
|
||||
#define _EIGEN_DECLARE_CONST_Packet4f(NAME,X) \
|
||||
const Packet4f p4f_##NAME = pset1<Packet4f>(X)
|
||||
@@ -84,8 +84,8 @@ template<> struct packet_traits<int> : default_packet_traits
|
||||
};
|
||||
};
|
||||
|
||||
#if (defined __GNUC__) && (!(EIGEN_GNUC_AT_LEAST(4,4)))
|
||||
// workaround gcc 4.2 and 4.3 compilatin issue
|
||||
#if EIGEN_GNUC_AT_MOST(4,4)
|
||||
// workaround gcc 4.2, 4.3 and 4.4 compilatin issue
|
||||
EIGEN_STRONG_INLINE float32x4_t vld1q_f32(const float* x) { return ::vld1q_f32((const float32_t*)x); }
|
||||
EIGEN_STRONG_INLINE float32x2_t vld1_f32 (const float* x) { return ::vld1_f32 ((const float32_t*)x); }
|
||||
EIGEN_STRONG_INLINE void vst1q_f32(float* to, float32x4_t from) { ::vst1q_f32((float32_t*)to,from); }
|
||||
|
||||
@@ -97,23 +97,30 @@ template<> EIGEN_STRONG_INLINE Packet2cf pandnot<Packet2cf>(const Packet2cf& a,
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf pload <Packet2cf>(const std::complex<float>* from) { EIGEN_DEBUG_ALIGNED_LOAD return Packet2cf(pload<Packet4f>(&real_ref(*from))); }
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf ploadu<Packet2cf>(const std::complex<float>* from) { EIGEN_DEBUG_UNALIGNED_LOAD return Packet2cf(ploadu<Packet4f>(&real_ref(*from))); }
|
||||
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf pset1<Packet2cf>(const std::complex<float>& from)
|
||||
{
|
||||
Packet2cf res;
|
||||
#if EIGEN_GNUC_AT_MOST(4,2)
|
||||
// workaround annoying "may be used uninitialized in this function" warning with gcc 4.2
|
||||
res.v = _mm_loadl_pi(_mm_set1_ps(0.0f), (const __m64*)&from);
|
||||
#else
|
||||
res.v = _mm_loadl_pi(res.v, (const __m64*)&from);
|
||||
#endif
|
||||
return Packet2cf(_mm_movelh_ps(res.v,res.v));
|
||||
}
|
||||
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf ploaddup<Packet2cf>(const std::complex<float>* from) { return pset1<Packet2cf>(*from); }
|
||||
|
||||
template<> EIGEN_STRONG_INLINE void pstore <std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_ALIGNED_STORE pstore(&real_ref(*to), from.v); }
|
||||
template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu(&real_ref(*to), from.v); }
|
||||
|
||||
template<> EIGEN_STRONG_INLINE void prefetch<std::complex<float> >(const std::complex<float> * addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
|
||||
|
||||
template<> EIGEN_STRONG_INLINE Packet2cf pset1<Packet2cf>(const std::complex<float>& from)
|
||||
{
|
||||
Packet2cf res;
|
||||
res.v = _mm_loadl_pi(res.v, (const __m64*)&from);
|
||||
return Packet2cf(_mm_movelh_ps(res.v,res.v));
|
||||
}
|
||||
|
||||
template<> EIGEN_STRONG_INLINE std::complex<float> pfirst<Packet2cf>(const Packet2cf& a)
|
||||
{
|
||||
#if (defined __GNUC__) && (__GNUC__==4) && (__GNUC_MINOR__==2) && (__GNUC_PATCHLEVEL__<=3)
|
||||
// workaround gcc 4.2.1 ICE (mac's gcc version) - I'm not sure how the 4.2.2 and 4.2.3 deal with it, but 4.2.4 works well.
|
||||
// this is not performance wise ideal, but who cares...
|
||||
#if EIGEN_GNUC_AT_MOST(4,3)
|
||||
// Workaround gcc 4.2 ICE - this is not performance wise ideal, but who cares...
|
||||
// This workaround also fix invalid code generation with gcc 4.3
|
||||
EIGEN_ALIGN16 std::complex<float> res[2];
|
||||
_mm_store_ps((float*)res, a.v);
|
||||
return res[0];
|
||||
@@ -308,6 +315,8 @@ template<> EIGEN_STRONG_INLINE Packet1cd ploadu<Packet1cd>(const std::complex<do
|
||||
template<> EIGEN_STRONG_INLINE Packet1cd pset1<Packet1cd>(const std::complex<double>& from)
|
||||
{ /* here we really have to use unaligned loads :( */ return ploadu<Packet1cd>(&from); }
|
||||
|
||||
template<> EIGEN_STRONG_INLINE Packet1cd ploaddup<Packet1cd>(const std::complex<double>* from) { return pset1<Packet1cd>(*from); }
|
||||
|
||||
// FIXME force unaligned store, this is a temporary fix
|
||||
template<> EIGEN_STRONG_INLINE void pstore <std::complex<double> >(std::complex<double> * to, const Packet1cd& from) { EIGEN_DEBUG_ALIGNED_STORE pstore((double*)to, from.v); }
|
||||
template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<double> >(std::complex<double> * to, const Packet1cd& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((double*)to, from.v); }
|
||||
|
||||
@@ -110,22 +110,8 @@ template<> struct unpacket_traits<Packet4f> { typedef float type; enum {size=4}
|
||||
template<> struct unpacket_traits<Packet2d> { typedef double type; enum {size=2}; };
|
||||
template<> struct unpacket_traits<Packet4i> { typedef int type; enum {size=4}; };
|
||||
|
||||
#ifdef __GNUC__
|
||||
// Sometimes GCC implements _mm_set1_p* using multiple moves,
|
||||
// that is inefficient :( (e.g., see gemm_pack_rhs)
|
||||
template<> EIGEN_STRONG_INLINE Packet4f pset1<Packet4f>(const float& from) {
|
||||
Packet4f res = _mm_set_ss(from);
|
||||
return vec4f_swizzle1(res,0,0,0,0);
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE Packet2d pset1<Packet2d>(const double& from) {
|
||||
// NOTE the SSE3 intrinsic _mm_loaddup_pd is never faster but sometimes much slower
|
||||
Packet2d res = _mm_set_sd(from);
|
||||
return vec2d_swizzle1(res, 0, 0);
|
||||
}
|
||||
#else
|
||||
template<> EIGEN_STRONG_INLINE Packet4f pset1<Packet4f>(const float& from) { return _mm_set1_ps(from); }
|
||||
template<> EIGEN_STRONG_INLINE Packet2d pset1<Packet2d>(const double& from) { return _mm_set1_pd(from); }
|
||||
#endif
|
||||
template<> EIGEN_STRONG_INLINE Packet4i pset1<Packet4i>(const int& from) { return _mm_set1_epi32(from); }
|
||||
|
||||
template<> EIGEN_STRONG_INLINE Packet4f plset<float>(const float& a) { return _mm_add_ps(pset1<Packet4f>(a), _mm_set_ps(3,2,1,0)); }
|
||||
@@ -245,29 +231,52 @@ template<> EIGEN_STRONG_INLINE Packet4i pload<Packet4i>(const int* from) { E
|
||||
// a correct instruction dependency.
|
||||
// TODO: do the same for MSVC (ICC is compatible)
|
||||
// NOTE: with the code below, MSVC's compiler crashes!
|
||||
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
// bug 195: gcc/i386 emits weird x87 fldl/fstpl instructions for _mm_load_sd
|
||||
#define EIGEN_AVOID_CUSTOM_UNALIGNED_LOADS 1
|
||||
#elif defined(__clang__)
|
||||
// bug 201: Segfaults in __mm_loadh_pd with clang 2.8
|
||||
#define EIGEN_AVOID_CUSTOM_UNALIGNED_LOADS 1
|
||||
#else
|
||||
#define EIGEN_AVOID_CUSTOM_UNALIGNED_LOADS 0
|
||||
#endif
|
||||
|
||||
template<> EIGEN_STRONG_INLINE Packet4f ploadu<Packet4f>(const float* from)
|
||||
{
|
||||
EIGEN_DEBUG_UNALIGNED_LOAD
|
||||
#if EIGEN_AVOID_CUSTOM_UNALIGNED_LOADS
|
||||
return _mm_loadu_ps(from);
|
||||
#else
|
||||
__m128d res;
|
||||
res = _mm_load_sd((const double*)(from)) ;
|
||||
res = _mm_loadh_pd(res, (const double*)(from+2)) ;
|
||||
return _mm_castpd_ps(res);
|
||||
#endif
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE Packet2d ploadu<Packet2d>(const double* from)
|
||||
{
|
||||
EIGEN_DEBUG_UNALIGNED_LOAD
|
||||
#if EIGEN_AVOID_CUSTOM_UNALIGNED_LOADS
|
||||
return _mm_loadu_pd(from);
|
||||
#else
|
||||
__m128d res;
|
||||
res = _mm_load_sd(from) ;
|
||||
res = _mm_loadh_pd(res,from+1);
|
||||
return res;
|
||||
#endif
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE Packet4i ploadu<Packet4i>(const int* from)
|
||||
{
|
||||
EIGEN_DEBUG_UNALIGNED_LOAD
|
||||
#if EIGEN_AVOID_CUSTOM_UNALIGNED_LOADS
|
||||
return _mm_loadu_si128(reinterpret_cast<const Packet4i*>(from));
|
||||
#else
|
||||
__m128d res;
|
||||
res = _mm_load_sd((const double*)(from)) ;
|
||||
res = _mm_loadh_pd(res, (const double*)(from+2)) ;
|
||||
return _mm_castpd_si128(res);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -296,6 +305,19 @@ template<> EIGEN_STRONG_INLINE void pstoreu<double>(double* to, const Packet2d&
|
||||
template<> EIGEN_STRONG_INLINE void pstoreu<float>(float* to, const Packet4f& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((double*)to, _mm_castps_pd(from)); }
|
||||
template<> EIGEN_STRONG_INLINE void pstoreu<int>(int* to, const Packet4i& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((double*)to, _mm_castsi128_pd(from)); }
|
||||
|
||||
// some compilers might be tempted to perform multiple moves instead of using a vector path.
|
||||
template<> EIGEN_STRONG_INLINE void pstore1<Packet4f>(float* to, const float& a)
|
||||
{
|
||||
Packet4f pa = _mm_set_ss(a);
|
||||
pstore(to, vec4f_swizzle1(pa,0,0,0,0));
|
||||
}
|
||||
// some compilers might be tempted to perform multiple moves instead of using a vector path.
|
||||
template<> EIGEN_STRONG_INLINE void pstore1<Packet2d>(double* to, const double& a)
|
||||
{
|
||||
Packet2d pa = _mm_set_sd(a);
|
||||
pstore(to, vec2d_swizzle1(pa,0,0));
|
||||
}
|
||||
|
||||
template<> EIGEN_STRONG_INLINE void prefetch<float>(const float* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
|
||||
template<> EIGEN_STRONG_INLINE void prefetch<double>(const double* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
|
||||
template<> EIGEN_STRONG_INLINE void prefetch<int>(const int* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
|
||||
|
||||
@@ -199,7 +199,7 @@ public:
|
||||
EIGEN_STRONG_INLINE void unpackRhs(DenseIndex n, const RhsScalar* rhs, RhsScalar* b)
|
||||
{
|
||||
for(DenseIndex k=0; k<n; k++)
|
||||
pstore(&b[k*RhsPacketSize], pset1<RhsPacket>(rhs[k]));
|
||||
pstore1<RhsPacket>(&b[k*RhsPacketSize], rhs[k]);
|
||||
}
|
||||
|
||||
EIGEN_STRONG_INLINE void loadRhs(const RhsScalar* b, RhsPacket& dest) const
|
||||
@@ -270,7 +270,7 @@ public:
|
||||
EIGEN_STRONG_INLINE void unpackRhs(DenseIndex n, const RhsScalar* rhs, RhsScalar* b)
|
||||
{
|
||||
for(DenseIndex k=0; k<n; k++)
|
||||
pstore(&b[k*RhsPacketSize], pset1<RhsPacket>(rhs[k]));
|
||||
pstore1<RhsPacket>(&b[k*RhsPacketSize], rhs[k]);
|
||||
}
|
||||
|
||||
EIGEN_STRONG_INLINE void loadRhs(const RhsScalar* b, RhsPacket& dest) const
|
||||
@@ -363,8 +363,8 @@ public:
|
||||
{
|
||||
if(Vectorizable)
|
||||
{
|
||||
pstore((RealScalar*)&b[k*ResPacketSize*2+0], pset1<RealPacket>(real(rhs[k])));
|
||||
pstore((RealScalar*)&b[k*ResPacketSize*2+ResPacketSize], pset1<RealPacket>(imag(rhs[k])));
|
||||
pstore1<RealPacket>((RealScalar*)&b[k*ResPacketSize*2+0], real(rhs[k]));
|
||||
pstore1<RealPacket>((RealScalar*)&b[k*ResPacketSize*2+ResPacketSize], imag(rhs[k]));
|
||||
}
|
||||
else
|
||||
b[k] = rhs[k];
|
||||
@@ -475,7 +475,7 @@ public:
|
||||
EIGEN_STRONG_INLINE void unpackRhs(DenseIndex n, const RhsScalar* rhs, RhsScalar* b)
|
||||
{
|
||||
for(DenseIndex k=0; k<n; k++)
|
||||
pstore(&b[k*RhsPacketSize], pset1<RhsPacket>(rhs[k]));
|
||||
pstore1<RhsPacket>(&b[k*RhsPacketSize], rhs[k]);
|
||||
}
|
||||
|
||||
EIGEN_STRONG_INLINE void loadRhs(const RhsScalar* b, RhsPacket& dest) const
|
||||
@@ -1009,12 +1009,7 @@ EIGEN_ASM_COMMENT("mybegin4");
|
||||
for(Index j2=packet_cols; j2<cols; j2++)
|
||||
{
|
||||
// unpack B
|
||||
{
|
||||
traits.unpackRhs(depth, &blockB[j2*strideB+offsetB], unpackedB);
|
||||
// const RhsScalar* blB = &blockB[j2*strideB+offsetB];
|
||||
// for(Index k=0; k<depth; k++)
|
||||
// pstore(&unpackedB[k*RhsPacketSize], pset1<RhsPacket>(blB[k]));
|
||||
}
|
||||
traits.unpackRhs(depth, &blockB[j2*strideB+offsetB], unpackedB);
|
||||
|
||||
for(Index i=0; i<peeled_mc; i+=mr)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace internal {
|
||||
/** \internal */
|
||||
inline void manage_multi_threading(Action action, int* v)
|
||||
{
|
||||
static int m_maxThreads = -1;
|
||||
static EIGEN_UNUSED int m_maxThreads = -1;
|
||||
|
||||
if(action==SetAction)
|
||||
{
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// 4100 - unreferenced formal parameter (occurred e.g. in aligned_allocator::destroy(pointer p))
|
||||
// 4101 - unreferenced local variable
|
||||
// 4127 - conditional expression is constant
|
||||
// 4181 - qualifier applied to reference type ignored
|
||||
// 4211 - nonstandard extension used : redefined extern to static
|
||||
// 4244 - 'argument' : conversion from 'type1' to 'type2', possible loss of data
|
||||
// 4273 - QtAlignedMalloc, inconsistent DLL linkage
|
||||
// 4324 - structure was padded due to declspec(align())
|
||||
// 4512 - assignment operator could not be generated
|
||||
// 4522 - 'class' : multiple assignment operators specified
|
||||
// 4700 - uninitialized local variable 'xyz' used
|
||||
// 4717 - 'function' : recursive on all control paths, function will cause runtime stack overflow
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable : 4100 4101 4127 4181 4211 4244 4273 4324 4512 4522 4700 4717 )
|
||||
#endif
|
||||
42
Eigen/src/Core/util/DisableStupidWarnings.h
Normal file
42
Eigen/src/Core/util/DisableStupidWarnings.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef EIGEN_WARNINGS_DISABLED
|
||||
#define EIGEN_WARNINGS_DISABLED
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// 4100 - unreferenced formal parameter (occurred e.g. in aligned_allocator::destroy(pointer p))
|
||||
// 4101 - unreferenced local variable
|
||||
// 4127 - conditional expression is constant
|
||||
// 4181 - qualifier applied to reference type ignored
|
||||
// 4211 - nonstandard extension used : redefined extern to static
|
||||
// 4244 - 'argument' : conversion from 'type1' to 'type2', possible loss of data
|
||||
// 4273 - QtAlignedMalloc, inconsistent DLL linkage
|
||||
// 4324 - structure was padded due to declspec(align())
|
||||
// 4512 - assignment operator could not be generated
|
||||
// 4522 - 'class' : multiple assignment operators specified
|
||||
// 4700 - uninitialized local variable 'xyz' used
|
||||
// 4717 - 'function' : recursive on all control paths, function will cause runtime stack overflow
|
||||
#ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
|
||||
#pragma warning( push )
|
||||
#endif
|
||||
#pragma warning( disable : 4100 4101 4127 4181 4211 4244 4273 4324 4512 4522 4700 4717 )
|
||||
#elif defined __INTEL_COMPILER
|
||||
// 2196 - routine is both "inline" and "noinline" ("noinline" assumed)
|
||||
// ICC 12 generates this warning even without any inline keyword, when defining class methods 'inline' i.e. inside of class body
|
||||
// 2536 - type qualifiers are meaningless here
|
||||
// ICC 12 generates this warning when a function return type is const qualified, even if that type is a template-parameter-dependent
|
||||
// typedef that may be a reference type.
|
||||
// 279 - controlling expression is constant
|
||||
// ICC 12 generates this warning on assert(constant_expression_depending_on_template_params) and frankly this is a legitimate use case.
|
||||
#ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
|
||||
#pragma warning push
|
||||
#endif
|
||||
#pragma warning disable 2196 2536 279
|
||||
#elif defined __clang__
|
||||
// -Wconstant-logical-operand - warning: use of logical && with constant operand; switch to bitwise & or remove constant
|
||||
// this is really a stupid warning as it warns on compile-time expressions involving enums
|
||||
#ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
|
||||
#pragma clang diagnostic push
|
||||
#endif
|
||||
#pragma clang diagnostic ignored "-Wconstant-logical-operand"
|
||||
#endif
|
||||
|
||||
#endif // not EIGEN_WARNINGS_DISABLED
|
||||
@@ -1,4 +0,0 @@
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
@@ -179,6 +179,9 @@ template<typename Scalar> struct scalar_exp_op;
|
||||
template<typename Scalar> struct scalar_log_op;
|
||||
template<typename Scalar> struct scalar_cos_op;
|
||||
template<typename Scalar> struct scalar_sin_op;
|
||||
template<typename Scalar> struct scalar_acos_op;
|
||||
template<typename Scalar> struct scalar_asin_op;
|
||||
template<typename Scalar> struct scalar_tan_op;
|
||||
template<typename Scalar> struct scalar_pow_op;
|
||||
template<typename Scalar> struct scalar_inverse_op;
|
||||
template<typename Scalar> struct scalar_square_op;
|
||||
|
||||
@@ -26,18 +26,31 @@
|
||||
#ifndef EIGEN_MACROS_H
|
||||
#define EIGEN_MACROS_H
|
||||
|
||||
#define EIGEN_WORLD_VERSION 2
|
||||
#define EIGEN_MAJOR_VERSION 93
|
||||
#define EIGEN_WORLD_VERSION 3
|
||||
#define EIGEN_MAJOR_VERSION 0
|
||||
#define EIGEN_MINOR_VERSION 0
|
||||
|
||||
#define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \
|
||||
(EIGEN_MAJOR_VERSION>y || (EIGEN_MAJOR_VERSION>=y && \
|
||||
EIGEN_MINOR_VERSION>=z))))
|
||||
#ifdef __GNUC__
|
||||
#define EIGEN_GNUC_AT_LEAST(x,y) ((__GNUC__>=x && __GNUC_MINOR__>=y) || __GNUC__>x)
|
||||
#define EIGEN_GNUC_AT_LEAST(x,y) ((__GNUC__==x && __GNUC_MINOR__>=y) || __GNUC__>x)
|
||||
#else
|
||||
#define EIGEN_GNUC_AT_LEAST(x,y) 0
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define EIGEN_GNUC_AT_MOST(x,y) ((__GNUC__==x && __GNUC_MINOR__<=y) || __GNUC__<x)
|
||||
#else
|
||||
#define EIGEN_GNUC_AT_MOST(x,y) 0
|
||||
#endif
|
||||
|
||||
#if EIGEN_GNUC_AT_MOST(4,3)
|
||||
// see bug 89
|
||||
#define EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO 0
|
||||
#else
|
||||
#define EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO 1
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ <= 3)
|
||||
#define EIGEN_GCC3_OR_OLDER 1
|
||||
@@ -109,31 +122,13 @@
|
||||
|
||||
#define EIGEN_DEBUG_VAR(x) std::cerr << #x << " = " << x << std::endl;
|
||||
|
||||
#ifdef NDEBUG
|
||||
# ifndef EIGEN_NO_DEBUG
|
||||
# define EIGEN_NO_DEBUG
|
||||
# endif
|
||||
#endif
|
||||
// concatenate two tokens
|
||||
#define EIGEN_CAT2(a,b) a ## b
|
||||
#define EIGEN_CAT(a,b) EIGEN_CAT2(a,b)
|
||||
|
||||
#ifndef eigen_assert
|
||||
#ifdef EIGEN_NO_DEBUG
|
||||
#define eigen_assert(x)
|
||||
#else
|
||||
#define eigen_assert(x) assert(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_INTERNAL_DEBUGGING
|
||||
#define eigen_internal_assert(x) eigen_assert(x)
|
||||
#else
|
||||
#define eigen_internal_assert(x)
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_NO_DEBUG
|
||||
#define EIGEN_ONLY_USED_FOR_DEBUG(x) (void)x
|
||||
#else
|
||||
#define EIGEN_ONLY_USED_FOR_DEBUG(x)
|
||||
#endif
|
||||
// convert a token to a string
|
||||
#define EIGEN_MAKESTRING2(a) #a
|
||||
#define EIGEN_MAKESTRING(a) EIGEN_MAKESTRING2(a)
|
||||
|
||||
// EIGEN_ALWAYS_INLINE_ATTRIB should be use in the declaration of function
|
||||
// which should be inlined even in debug mode.
|
||||
@@ -147,14 +142,14 @@
|
||||
#define EIGEN_ALWAYS_INLINE_ATTRIB
|
||||
#endif
|
||||
|
||||
#if EIGEN_GNUC_AT_LEAST(4,1)
|
||||
#if EIGEN_GNUC_AT_LEAST(4,1) && !defined(__clang__) && !defined(__INTEL_COMPILER)
|
||||
#define EIGEN_FLATTEN_ATTRIB __attribute__((flatten))
|
||||
#else
|
||||
#define EIGEN_FLATTEN_ATTRIB
|
||||
#endif
|
||||
|
||||
// EIGEN_FORCE_INLINE means "inline as much as possible"
|
||||
#if (defined _MSC_VER) || (defined __intel_compiler)
|
||||
#if (defined _MSC_VER) || (defined __INTEL_COMPILER)
|
||||
#define EIGEN_STRONG_INLINE __forceinline
|
||||
#else
|
||||
#define EIGEN_STRONG_INLINE inline
|
||||
@@ -175,6 +170,67 @@
|
||||
#define EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
#define EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS inline
|
||||
|
||||
#ifdef NDEBUG
|
||||
# ifndef EIGEN_NO_DEBUG
|
||||
# define EIGEN_NO_DEBUG
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// eigen_plain_assert is where we implement the workaround for the assert() bug in GCC <= 4.3, see bug 89
|
||||
#ifdef EIGEN_NO_DEBUG
|
||||
#define eigen_plain_assert(x)
|
||||
#else
|
||||
#if EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO
|
||||
namespace Eigen {
|
||||
namespace internal {
|
||||
inline bool copy_bool(bool b) { return b; }
|
||||
}
|
||||
}
|
||||
#define eigen_plain_assert(x) assert(x)
|
||||
#else
|
||||
// work around bug 89
|
||||
#include <cstdlib> // for abort
|
||||
#include <iostream> // for std::cerr
|
||||
|
||||
namespace Eigen {
|
||||
namespace internal {
|
||||
// trivial function copying a bool. Must be EIGEN_DONT_INLINE, so we implement it after including Eigen headers.
|
||||
// see bug 89.
|
||||
namespace {
|
||||
EIGEN_DONT_INLINE bool copy_bool(bool b) { return b; }
|
||||
}
|
||||
inline void assert_fail(const char *condition, const char *function, const char *file, int line)
|
||||
{
|
||||
std::cerr << "assertion failed: " << condition << " in function " << function << " at " << file << ":" << line << std::endl;
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
#define eigen_plain_assert(x) \
|
||||
do { \
|
||||
if(!Eigen::internal::copy_bool(x)) \
|
||||
Eigen::internal::assert_fail(EIGEN_MAKESTRING(x), __PRETTY_FUNCTION__, __FILE__, __LINE__); \
|
||||
} while(false)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// eigen_assert can be overridden
|
||||
#ifndef eigen_assert
|
||||
#define eigen_assert(x) eigen_plain_assert(x)
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_INTERNAL_DEBUGGING
|
||||
#define eigen_internal_assert(x) eigen_assert(x)
|
||||
#else
|
||||
#define eigen_internal_assert(x)
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_NO_DEBUG
|
||||
#define EIGEN_ONLY_USED_FOR_DEBUG(x) (void)x
|
||||
#else
|
||||
#define EIGEN_ONLY_USED_FOR_DEBUG(x)
|
||||
#endif
|
||||
|
||||
#if (defined __GNUC__)
|
||||
#define EIGEN_DEPRECATED __attribute__((deprecated))
|
||||
#elif (defined _MSC_VER)
|
||||
@@ -205,9 +261,7 @@
|
||||
* If we made alignment depend on whether or not EIGEN_VECTORIZE is defined, it would be impossible to link
|
||||
* vectorized and non-vectorized code.
|
||||
*/
|
||||
#if !EIGEN_ALIGN_STATICALLY
|
||||
#define EIGEN_ALIGN_TO_BOUNDARY(n)
|
||||
#elif (defined __GNUC__) || (defined __PGI) || (defined __IBMCPP__)
|
||||
#if (defined __GNUC__) || (defined __PGI) || (defined __IBMCPP__)
|
||||
#define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n)))
|
||||
#elif (defined _MSC_VER)
|
||||
#define EIGEN_ALIGN_TO_BOUNDARY(n) __declspec(align(n))
|
||||
@@ -220,6 +274,14 @@
|
||||
|
||||
#define EIGEN_ALIGN16 EIGEN_ALIGN_TO_BOUNDARY(16)
|
||||
|
||||
#if EIGEN_ALIGN_STATICALLY
|
||||
#define EIGEN_USER_ALIGN_TO_BOUNDARY(n) EIGEN_ALIGN_TO_BOUNDARY(n)
|
||||
#define EIGEN_USER_ALIGN16 EIGEN_ALIGN16
|
||||
#else
|
||||
#define EIGEN_USER_ALIGN_TO_BOUNDARY(n)
|
||||
#define EIGEN_USER_ALIGN16
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_DONT_USE_RESTRICT_KEYWORD
|
||||
#define EIGEN_RESTRICT
|
||||
#endif
|
||||
@@ -244,14 +306,6 @@
|
||||
// just an empty macro !
|
||||
#define EIGEN_EMPTY
|
||||
|
||||
// concatenate two tokens
|
||||
#define EIGEN_CAT2(a,b) a ## b
|
||||
#define EIGEN_CAT(a,b) EIGEN_CAT2(a,b)
|
||||
|
||||
// convert a token to a string
|
||||
#define EIGEN_MAKESTRING2(a) #a
|
||||
#define EIGEN_MAKESTRING(a) EIGEN_MAKESTRING2(a)
|
||||
|
||||
#if defined(_MSC_VER) && (!defined(__INTEL_COMPILER))
|
||||
#define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
|
||||
using Base::operator =;
|
||||
|
||||
@@ -167,14 +167,36 @@ inline void* generic_aligned_realloc(void* ptr, size_t size, size_t old_size)
|
||||
*** Implementation of portable aligned versions of malloc/free/realloc ***
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef EIGEN_NO_MALLOC
|
||||
inline void check_that_malloc_is_allowed()
|
||||
{
|
||||
eigen_assert(false && "heap allocation is forbidden (EIGEN_NO_MALLOC is defined)");
|
||||
}
|
||||
#elif defined EIGEN_RUNTIME_NO_MALLOC
|
||||
inline bool is_malloc_allowed_impl(bool update, bool new_value = false)
|
||||
{
|
||||
static bool value = true;
|
||||
if (update == 1)
|
||||
value = new_value;
|
||||
return value;
|
||||
}
|
||||
inline bool is_malloc_allowed() { return is_malloc_allowed_impl(false); }
|
||||
inline bool set_is_malloc_allowed(bool new_value) { return is_malloc_allowed_impl(true, new_value); }
|
||||
inline void check_that_malloc_is_allowed()
|
||||
{
|
||||
eigen_assert(is_malloc_allowed() && "heap allocation is forbidden (EIGEN_RUNTIME_NO_MALLOC is defined and g_is_malloc_allowed is false)");
|
||||
}
|
||||
#else
|
||||
inline void check_that_malloc_is_allowed()
|
||||
{}
|
||||
#endif
|
||||
|
||||
/** \internal Allocates \a size bytes. The returned pointer is guaranteed to have 16 bytes alignment.
|
||||
* On allocation error, the returned pointer is null, and if exceptions are enabled then a std::bad_alloc is thrown.
|
||||
*/
|
||||
inline void* aligned_malloc(size_t size)
|
||||
{
|
||||
#ifdef EIGEN_NO_MALLOC
|
||||
eigen_assert(false && "heap allocation is forbidden (EIGEN_NO_MALLOC is defined)");
|
||||
#endif
|
||||
check_that_malloc_is_allowed();
|
||||
|
||||
void *result;
|
||||
#if !EIGEN_ALIGN
|
||||
@@ -268,9 +290,7 @@ template<bool Align> inline void* conditional_aligned_malloc(size_t size)
|
||||
|
||||
template<> inline void* conditional_aligned_malloc<false>(size_t size)
|
||||
{
|
||||
#ifdef EIGEN_NO_MALLOC
|
||||
eigen_assert(false && "heap allocation is forbidden (EIGEN_NO_MALLOC is defined)");
|
||||
#endif
|
||||
check_that_malloc_is_allowed();
|
||||
|
||||
void *result = std::malloc(size);
|
||||
#ifdef EIGEN_EXCEPTIONS
|
||||
|
||||
14
Eigen/src/Core/util/ReenableStupidWarnings.h
Normal file
14
Eigen/src/Core/util/ReenableStupidWarnings.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifdef EIGEN_WARNINGS_DISABLED
|
||||
#undef EIGEN_WARNINGS_DISABLED
|
||||
|
||||
#ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( pop )
|
||||
#elif defined __INTEL_COMPILER
|
||||
#pragma warning pop
|
||||
#elif defined __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // EIGEN_WARNINGS_DISABLED
|
||||
@@ -4,3 +4,5 @@ INSTALL(FILES
|
||||
${Eigen_Eigen2Support_SRCS}
|
||||
DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigen2Support COMPONENT Devel
|
||||
)
|
||||
|
||||
ADD_SUBDIRECTORY(Geometry)
|
||||
@@ -55,6 +55,9 @@
|
||||
* Example: \include MatrixBase_cwise_const.cpp
|
||||
* Output: \verbinclude MatrixBase_cwise_const.out
|
||||
*
|
||||
* 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_CWISE_PLUGIN.
|
||||
*
|
||||
* \sa MatrixBase::cwise() const, MatrixBase::cwise()
|
||||
*/
|
||||
template<typename ExpressionType> class Cwise
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
FILE(GLOB Eigen_Geometry_SRCS "*.h")
|
||||
FILE(GLOB Eigen_Eigen2Support_Geometry_SRCS "*.h")
|
||||
|
||||
INSTALL(FILES
|
||||
${Eigen_Geometry_SRCS}
|
||||
${Eigen_Eigen2Support_Geometry_SRCS}
|
||||
DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigen2Support/Geometry
|
||||
)
|
||||
|
||||
@@ -186,7 +186,8 @@ template<typename _MatrixType> class ComplexEigenSolver
|
||||
* This function returns a column vector containing the
|
||||
* eigenvalues. Eigenvalues are repeated according to their
|
||||
* algebraic multiplicity, so there are as many eigenvalues as
|
||||
* rows in the matrix.
|
||||
* rows in the matrix. The eigenvalues are not sorted in any particular
|
||||
* order.
|
||||
*
|
||||
* Example: \include ComplexEigenSolver_eigenvalues.cpp
|
||||
* Output: \verbinclude ComplexEigenSolver_eigenvalues.out
|
||||
|
||||
@@ -228,6 +228,7 @@ template<typename _MatrixType> class EigenSolver
|
||||
* block-diagonal. The blocks on the diagonal are either 1-by-1 or 2-by-2
|
||||
* blocks of the form
|
||||
* \f$ \begin{bmatrix} u & v \\ -v & u \end{bmatrix} \f$.
|
||||
* These blocks are not sorted in any particular order.
|
||||
* The matrix \f$ D \f$ and the matrix \f$ V \f$ returned by
|
||||
* pseudoEigenvectors() satisfy \f$ AV = VD \f$.
|
||||
*
|
||||
@@ -244,7 +245,8 @@ template<typename _MatrixType> class EigenSolver
|
||||
* compute(const MatrixType&, bool) has been called before.
|
||||
*
|
||||
* The eigenvalues are repeated according to their algebraic multiplicity,
|
||||
* so there are as many eigenvalues as rows in the matrix.
|
||||
* so there are as many eigenvalues as rows in the matrix. The eigenvalues
|
||||
* are not sorted in any particular order.
|
||||
*
|
||||
* Example: \include EigenSolver_eigenvalues.cpp
|
||||
* Output: \verbinclude EigenSolver_eigenvalues.out
|
||||
|
||||
@@ -70,13 +70,9 @@ class GeneralizedSelfAdjointEigenSolver : public SelfAdjointEigenSolver<_MatrixT
|
||||
/** \brief Default constructor for fixed-size matrices.
|
||||
*
|
||||
* The default constructor is useful in cases in which the user intends to
|
||||
* perform decompositions via compute(const MatrixType&, bool) or
|
||||
* compute(const MatrixType&, const MatrixType&, bool). This constructor
|
||||
* perform decompositions via compute(). This constructor
|
||||
* can only be used if \p _MatrixType is a fixed-size matrix; use
|
||||
* SelfAdjointEigenSolver(Index) for dynamic-size matrices.
|
||||
*
|
||||
* Example: \include SelfAdjointEigenSolver_SelfAdjointEigenSolver.cpp
|
||||
* Output: \verbinclude SelfAdjointEigenSolver_SelfAdjointEigenSolver.out
|
||||
* GeneralizedSelfAdjointEigenSolver(Index) for dynamic-size matrices.
|
||||
*/
|
||||
GeneralizedSelfAdjointEigenSolver() : Base() {}
|
||||
|
||||
@@ -86,12 +82,11 @@ class GeneralizedSelfAdjointEigenSolver : public SelfAdjointEigenSolver<_MatrixT
|
||||
* eigenvalues and eigenvectors will be computed.
|
||||
*
|
||||
* This constructor is useful for dynamic-size matrices, when the user
|
||||
* intends to perform decompositions via compute(const MatrixType&, bool)
|
||||
* or compute(const MatrixType&, const MatrixType&, bool). The \p size
|
||||
* intends to perform decompositions via compute(). The \p size
|
||||
* parameter is only used as a hint. It is not an error to give a wrong
|
||||
* \p size, but it may impair performance.
|
||||
*
|
||||
* \sa compute(const MatrixType&, bool) for an example
|
||||
* \sa compute() for an example
|
||||
*/
|
||||
GeneralizedSelfAdjointEigenSolver(Index size)
|
||||
: Base(size)
|
||||
|
||||
@@ -62,12 +62,12 @@ class GeneralizedSelfAdjointEigenSolver;
|
||||
*
|
||||
* Call the function compute() to compute the eigenvalues and eigenvectors of
|
||||
* a given matrix. Alternatively, you can use the
|
||||
* SelfAdjointEigenSolver(const MatrixType&, bool) constructor which computes
|
||||
* SelfAdjointEigenSolver(const MatrixType&, int) constructor which computes
|
||||
* the eigenvalues and eigenvectors at construction time. Once the eigenvalue
|
||||
* and eigenvectors are computed, they can be retrieved with the eigenvalues()
|
||||
* and eigenvectors() functions.
|
||||
*
|
||||
* The documentation for SelfAdjointEigenSolver(const MatrixType&, bool)
|
||||
* The documentation for SelfAdjointEigenSolver(const MatrixType&, int)
|
||||
* contains an example of the typical use of this class.
|
||||
*
|
||||
* To solve the \em generalized eigenvalue problem \f$ Av = \lambda Bv \f$ and
|
||||
@@ -110,8 +110,7 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
|
||||
/** \brief Default constructor for fixed-size matrices.
|
||||
*
|
||||
* The default constructor is useful in cases in which the user intends to
|
||||
* perform decompositions via compute(const MatrixType&, bool) or
|
||||
* compute(const MatrixType&, const MatrixType&, bool). This constructor
|
||||
* perform decompositions via compute(). This constructor
|
||||
* can only be used if \p _MatrixType is a fixed-size matrix; use
|
||||
* SelfAdjointEigenSolver(Index) for dynamic-size matrices.
|
||||
*
|
||||
@@ -131,12 +130,11 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
|
||||
* eigenvalues and eigenvectors will be computed.
|
||||
*
|
||||
* This constructor is useful for dynamic-size matrices, when the user
|
||||
* intends to perform decompositions via compute(const MatrixType&, bool)
|
||||
* or compute(const MatrixType&, const MatrixType&, bool). The \p size
|
||||
* intends to perform decompositions via compute(). The \p size
|
||||
* parameter is only used as a hint. It is not an error to give a wrong
|
||||
* \p size, but it may impair performance.
|
||||
*
|
||||
* \sa compute(const MatrixType&, bool) for an example
|
||||
* \sa compute() for an example
|
||||
*/
|
||||
SelfAdjointEigenSolver(Index size)
|
||||
: m_eivec(size, size),
|
||||
@@ -151,15 +149,14 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
|
||||
* be computed. Only the lower triangular part of the matrix is referenced.
|
||||
* \param[in] options Can be ComputeEigenvectors (default) or EigenvaluesOnly.
|
||||
*
|
||||
* This constructor calls compute(const MatrixType&, bool) to compute the
|
||||
* This constructor calls compute(const MatrixType&, int) to compute the
|
||||
* eigenvalues of the matrix \p matrix. The eigenvectors are computed if
|
||||
* \p options equals ComputeEigenvectors.
|
||||
*
|
||||
* Example: \include SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp
|
||||
* Output: \verbinclude SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.out
|
||||
*
|
||||
* \sa compute(const MatrixType&, bool),
|
||||
* SelfAdjointEigenSolver(const MatrixType&, const MatrixType&, bool)
|
||||
* \sa compute(const MatrixType&, int)
|
||||
*/
|
||||
SelfAdjointEigenSolver(const MatrixType& matrix, int options = ComputeEigenvectors)
|
||||
: m_eivec(matrix.rows(), matrix.cols()),
|
||||
@@ -198,11 +195,11 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
|
||||
* Example: \include SelfAdjointEigenSolver_compute_MatrixType.cpp
|
||||
* Output: \verbinclude SelfAdjointEigenSolver_compute_MatrixType.out
|
||||
*
|
||||
* \sa SelfAdjointEigenSolver(const MatrixType&, bool)
|
||||
* \sa SelfAdjointEigenSolver(const MatrixType&, int)
|
||||
*/
|
||||
SelfAdjointEigenSolver& compute(const MatrixType& matrix, int options = ComputeEigenvectors);
|
||||
|
||||
/** \brief Returns the eigenvectors of given matrix (pencil).
|
||||
/** \brief Returns the eigenvectors of given matrix.
|
||||
*
|
||||
* \returns A const reference to the matrix whose columns are the eigenvectors.
|
||||
*
|
||||
@@ -227,14 +224,15 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
|
||||
return m_eivec;
|
||||
}
|
||||
|
||||
/** \brief Returns the eigenvalues of given matrix (pencil).
|
||||
/** \brief Returns the eigenvalues of given matrix.
|
||||
*
|
||||
* \returns A const reference to the column vector containing the eigenvalues.
|
||||
*
|
||||
* \pre The eigenvalues have been computed before.
|
||||
*
|
||||
* The eigenvalues are repeated according to their algebraic multiplicity,
|
||||
* so there are as many eigenvalues as rows in the matrix.
|
||||
* so there are as many eigenvalues as rows in the matrix. The eigenvalues
|
||||
* are sorted in increasing order.
|
||||
*
|
||||
* Example: \include SelfAdjointEigenSolver_eigenvalues.cpp
|
||||
* Output: \verbinclude SelfAdjointEigenSolver_eigenvalues.out
|
||||
@@ -402,10 +400,11 @@ SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
|
||||
|
||||
// map the matrix coefficients to [-1:1] to avoid over- and underflow.
|
||||
RealScalar scale = matrix.cwiseAbs().maxCoeff();
|
||||
if(scale==Scalar(0)) scale = 1;
|
||||
mat = matrix / scale;
|
||||
m_subdiag.resize(n-1);
|
||||
internal::tridiagonalization_inplace(mat, diag, m_subdiag, computeEigenvectors);
|
||||
|
||||
|
||||
Index end = n-1;
|
||||
Index start = 0;
|
||||
Index iter = 0; // number of iterations we are working on one element
|
||||
@@ -458,7 +457,7 @@ SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// scale back the eigen values
|
||||
m_eivalues *= scale;
|
||||
|
||||
@@ -471,12 +470,17 @@ namespace internal {
|
||||
template<int StorageOrder,typename RealScalar, typename Scalar, typename Index>
|
||||
static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index start, Index end, Scalar* matrixQ, Index n)
|
||||
{
|
||||
// NOTE this version avoids over & underflow, however since the matrix is prescaled, overflow cannot occur,
|
||||
// and underflows should be meaningless anyway. So I don't any reason to enable this version, but I keep
|
||||
// it here for reference:
|
||||
// RealScalar td = (diag[end-1] - diag[end])*RealScalar(0.5);
|
||||
// RealScalar e = subdiag[end-1];
|
||||
// RealScalar mu = diag[end] - (e / (td + (td>0 ? 1 : -1))) * (e / hypot(td,e));
|
||||
RealScalar td = (diag[end-1] - diag[end])*RealScalar(0.5);
|
||||
RealScalar e2 = abs2(subdiag[end-1]);
|
||||
RealScalar mu = diag[end] - e2 / (td + (td>0 ? 1 : -1) * sqrt(td*td + e2));
|
||||
RealScalar x = diag[start] - mu;
|
||||
RealScalar z = subdiag[start];
|
||||
|
||||
for (Index k = start; k < end; ++k)
|
||||
{
|
||||
JacobiRotation<RealScalar> rot;
|
||||
@@ -489,6 +493,7 @@ static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index sta
|
||||
diag[k] = rot.c() * (rot.c() * diag[k] - rot.s() * subdiag[k]) - rot.s() * (rot.c() * subdiag[k] - rot.s() * diag[k+1]);
|
||||
diag[k+1] = rot.s() * sdk + rot.c() * dkp1;
|
||||
subdiag[k] = rot.c() * sdk - rot.s() * dkp1;
|
||||
|
||||
|
||||
if (k > start)
|
||||
subdiag[k - 1] = rot.c() * subdiag[k-1] - rot.s() * z;
|
||||
@@ -500,7 +505,7 @@ static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index sta
|
||||
z = -rot.s() * subdiag[k+1];
|
||||
subdiag[k + 1] = rot.c() * subdiag[k+1];
|
||||
}
|
||||
|
||||
|
||||
// apply the givens rotation to the unit matrix Q = Q * G
|
||||
if (matrixQ)
|
||||
{
|
||||
|
||||
@@ -232,13 +232,15 @@ template<typename MatrixType,typename Lhs>
|
||||
struct traits<homogeneous_left_product_impl<Homogeneous<MatrixType,Vertical>,Lhs> >
|
||||
{
|
||||
typedef typename take_matrix_for_product<Lhs>::type LhsMatrixType;
|
||||
typedef typename remove_all<MatrixType>::type MatrixTypeCleaned;
|
||||
typedef typename remove_all<LhsMatrixType>::type LhsMatrixTypeCleaned;
|
||||
typedef typename make_proper_matrix_type<
|
||||
typename traits<MatrixType>::Scalar,
|
||||
LhsMatrixType::RowsAtCompileTime,
|
||||
MatrixType::ColsAtCompileTime,
|
||||
MatrixType::PlainObject::Options,
|
||||
LhsMatrixType::MaxRowsAtCompileTime,
|
||||
MatrixType::MaxColsAtCompileTime>::type ReturnType;
|
||||
typename traits<MatrixTypeCleaned>::Scalar,
|
||||
LhsMatrixTypeCleaned::RowsAtCompileTime,
|
||||
MatrixTypeCleaned::ColsAtCompileTime,
|
||||
MatrixTypeCleaned::PlainObject::Options,
|
||||
LhsMatrixTypeCleaned::MaxRowsAtCompileTime,
|
||||
MatrixTypeCleaned::MaxColsAtCompileTime>::type ReturnType;
|
||||
};
|
||||
|
||||
template<typename MatrixType,typename Lhs>
|
||||
@@ -246,7 +248,8 @@ struct homogeneous_left_product_impl<Homogeneous<MatrixType,Vertical>,Lhs>
|
||||
: public ReturnByValue<homogeneous_left_product_impl<Homogeneous<MatrixType,Vertical>,Lhs> >
|
||||
{
|
||||
typedef typename traits<homogeneous_left_product_impl>::LhsMatrixType LhsMatrixType;
|
||||
typedef typename remove_all<typename LhsMatrixType::Nested>::type LhsMatrixTypeNested;
|
||||
typedef typename remove_all<LhsMatrixType>::type LhsMatrixTypeCleaned;
|
||||
typedef typename remove_all<typename LhsMatrixTypeCleaned::Nested>::type LhsMatrixTypeNested;
|
||||
typedef typename MatrixType::Index Index;
|
||||
homogeneous_left_product_impl(const Lhs& lhs, const MatrixType& rhs)
|
||||
: m_lhs(take_matrix_for_product<Lhs>::run(lhs)),
|
||||
@@ -267,7 +270,7 @@ struct homogeneous_left_product_impl<Homogeneous<MatrixType,Vertical>,Lhs>
|
||||
.template replicate<MatrixType::ColsAtCompileTime>(m_rhs.cols());
|
||||
}
|
||||
|
||||
const typename LhsMatrixType::Nested m_lhs;
|
||||
const typename LhsMatrixTypeCleaned::Nested m_lhs;
|
||||
const typename MatrixType::Nested m_rhs;
|
||||
};
|
||||
|
||||
|
||||
@@ -43,7 +43,9 @@ struct transform_traits
|
||||
|
||||
template< typename TransformType,
|
||||
typename MatrixType,
|
||||
bool IsProjective = transform_traits<TransformType>::IsProjective>
|
||||
int Case = transform_traits<TransformType>::IsProjective ? 0
|
||||
: int(MatrixType::RowsAtCompileTime) == int(transform_traits<TransformType>::HDim) ? 1
|
||||
: 2>
|
||||
struct transform_right_product_impl;
|
||||
|
||||
template< typename Other,
|
||||
@@ -81,15 +83,16 @@ template<typename TransformType> struct transform_take_affine_part;
|
||||
*
|
||||
* \brief Represents an homogeneous transformation in a N dimensional space
|
||||
*
|
||||
* \param _Scalar the scalar type, i.e., the type of the coefficients
|
||||
* \param _Dim the dimension of the space
|
||||
* \param _Mode the type of the transformation. Can be:
|
||||
* \tparam _Scalar the scalar type, i.e., the type of the coefficients
|
||||
* \tparam _Dim the dimension of the space
|
||||
* \tparam _Mode the type of the transformation. Can be:
|
||||
* - Affine: the transformation is stored as a (Dim+1)^2 matrix,
|
||||
* where the last row is assumed to be [0 ... 0 1].
|
||||
* - AffineCompact: the transformation is stored as a (Dim)x(Dim+1) matrix.
|
||||
* - Projective: the transformation is stored as a (Dim+1)^2 matrix
|
||||
* without any assumption.
|
||||
* \param _Options can be \b AutoAlign or \b DontAlign. Default is \b AutoAlign
|
||||
* \tparam _Options has the same meaning as in class Matrix. It allows to specify DontAlign and/or RowMajor.
|
||||
* These Options are passed directly to the underlying matrix type.
|
||||
*
|
||||
* The homography is internally represented and stored by a matrix which
|
||||
* is available through the matrix() method. To understand the behavior of
|
||||
@@ -177,6 +180,9 @@ template<typename TransformType> struct transform_take_affine_part;
|
||||
* Conversion methods from/to Qt's QMatrix and QTransform are available if the
|
||||
* preprocessor token EIGEN_QT_SUPPORT is defined.
|
||||
*
|
||||
* 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_TRANSFORM_PLUGIN.
|
||||
*
|
||||
* \sa class Matrix, class Quaternion
|
||||
*/
|
||||
template<typename _Scalar, int _Dim, int _Mode, int _Options>
|
||||
@@ -195,11 +201,11 @@ public:
|
||||
typedef _Scalar Scalar;
|
||||
typedef DenseIndex Index;
|
||||
/** type of the matrix used to represent the transformation */
|
||||
typedef Matrix<Scalar,Rows,HDim,Options&DontAlign> MatrixType;
|
||||
typedef typename internal::make_proper_matrix_type<Scalar,Rows,HDim,Options>::type MatrixType;
|
||||
/** constified MatrixType */
|
||||
typedef const MatrixType ConstMatrixType;
|
||||
/** type of the matrix used to represent the linear part of the transformation */
|
||||
typedef Matrix<Scalar,Dim,Dim> LinearMatrixType;
|
||||
typedef Matrix<Scalar,Dim,Dim,Options> LinearMatrixType;
|
||||
/** type of read/write reference to the linear part of the transformation */
|
||||
typedef Block<MatrixType,Dim,Dim> LinearPart;
|
||||
/** type of read reference to the linear part of the transformation */
|
||||
@@ -517,7 +523,7 @@ public:
|
||||
template<typename Derived>
|
||||
inline Transform operator*(const RotationBase<Derived,Dim>& r) const;
|
||||
|
||||
LinearMatrixType rotation() const;
|
||||
const LinearMatrixType rotation() const;
|
||||
template<typename RotationMatrixType, typename ScalingMatrixType>
|
||||
void computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const;
|
||||
template<typename ScalingMatrixType, typename RotationMatrixType>
|
||||
@@ -604,7 +610,7 @@ protected:
|
||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||
EIGEN_STRONG_INLINE static void check_template_params()
|
||||
{
|
||||
EIGEN_STATIC_ASSERT((Options & (DontAlign)) == Options, INVALID_MATRIX_TEMPLATE_PARAMETERS)
|
||||
EIGEN_STATIC_ASSERT((Options & (DontAlign|RowMajor)) == Options, INVALID_MATRIX_TEMPLATE_PARAMETERS)
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -964,7 +970,7 @@ inline Transform<Scalar,Dim,Mode,Options> Transform<Scalar,Dim,Mode,Options>::op
|
||||
* \sa computeRotationScaling(), computeScalingRotation(), class SVD
|
||||
*/
|
||||
template<typename Scalar, int Dim, int Mode, int Options>
|
||||
typename Transform<Scalar,Dim,Mode,Options>::LinearMatrixType
|
||||
const typename Transform<Scalar,Dim,Mode,Options>::LinearMatrixType
|
||||
Transform<Scalar,Dim,Mode,Options>::rotation() const
|
||||
{
|
||||
LinearMatrixType result;
|
||||
@@ -1136,9 +1142,9 @@ template<typename TransformType> struct transform_take_affine_part {
|
||||
{ return m.template block<TransformType::Dim,TransformType::HDim>(0,0); }
|
||||
};
|
||||
|
||||
template<typename Scalar, int Dim>
|
||||
struct transform_take_affine_part<Transform<Scalar,Dim,AffineCompact> > {
|
||||
typedef typename Transform<Scalar,Dim,AffineCompact>::MatrixType MatrixType;
|
||||
template<typename Scalar, int Dim, int Options>
|
||||
struct transform_take_affine_part<Transform<Scalar,Dim,AffineCompact, Options> > {
|
||||
typedef typename Transform<Scalar,Dim,AffineCompact,Options>::MatrixType MatrixType;
|
||||
static inline MatrixType& run(MatrixType& m) { return m; }
|
||||
static inline const MatrixType& run(const MatrixType& m) { return m; }
|
||||
};
|
||||
@@ -1178,7 +1184,7 @@ struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, HDim,HDim>
|
||||
template<typename Other, int Options, int Dim, int HDim>
|
||||
struct transform_construct_from_matrix<Other, AffineCompact,Options,Dim,HDim, HDim,HDim>
|
||||
{
|
||||
static inline void run(Transform<typename Other::Scalar,Dim,AffineCompact> *transform, const Other& other)
|
||||
static inline void run(Transform<typename Other::Scalar,Dim,AffineCompact,Options> *transform, const Other& other)
|
||||
{ transform->matrix() = other.template block<Dim,HDim>(0,0); }
|
||||
};
|
||||
|
||||
@@ -1200,7 +1206,7 @@ struct transform_product_result
|
||||
};
|
||||
|
||||
template< typename TransformType, typename MatrixType >
|
||||
struct transform_right_product_impl< TransformType, MatrixType, true >
|
||||
struct transform_right_product_impl< TransformType, MatrixType, 0 >
|
||||
{
|
||||
typedef typename MatrixType::PlainObject ResultType;
|
||||
|
||||
@@ -1211,7 +1217,7 @@ struct transform_right_product_impl< TransformType, MatrixType, true >
|
||||
};
|
||||
|
||||
template< typename TransformType, typename MatrixType >
|
||||
struct transform_right_product_impl< TransformType, MatrixType, false >
|
||||
struct transform_right_product_impl< TransformType, MatrixType, 1 >
|
||||
{
|
||||
enum {
|
||||
Dim = TransformType::Dim,
|
||||
@@ -1224,20 +1230,39 @@ struct transform_right_product_impl< TransformType, MatrixType, false >
|
||||
|
||||
EIGEN_STRONG_INLINE static ResultType run(const TransformType& T, const MatrixType& other)
|
||||
{
|
||||
EIGEN_STATIC_ASSERT(OtherRows==Dim || OtherRows==HDim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
|
||||
EIGEN_STATIC_ASSERT(OtherRows==HDim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
|
||||
|
||||
typedef Block<ResultType, Dim, OtherCols> TopLeftLhs;
|
||||
typedef Block<const MatrixType, Dim, OtherCols> TopLeftRhs;
|
||||
|
||||
ResultType res(other.rows(),other.cols());
|
||||
TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() = T.affine() * other;
|
||||
res.row(OtherRows-1) = other.row(OtherRows-1);
|
||||
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
TopLeftLhs(res, 0, 0, Dim, other.cols()) =
|
||||
( T.linear() * TopLeftRhs(other, 0, 0, Dim, other.cols()) ).colwise() +
|
||||
T.translation();
|
||||
template< typename TransformType, typename MatrixType >
|
||||
struct transform_right_product_impl< TransformType, MatrixType, 2 >
|
||||
{
|
||||
enum {
|
||||
Dim = TransformType::Dim,
|
||||
HDim = TransformType::HDim,
|
||||
OtherRows = MatrixType::RowsAtCompileTime,
|
||||
OtherCols = MatrixType::ColsAtCompileTime
|
||||
};
|
||||
|
||||
// we need to take .rows() because OtherRows might be Dim or HDim
|
||||
if (OtherRows==HDim)
|
||||
res.row(other.rows()) = other.row(other.rows());
|
||||
typedef typename MatrixType::PlainObject ResultType;
|
||||
|
||||
EIGEN_STRONG_INLINE static ResultType run(const TransformType& T, const MatrixType& other)
|
||||
{
|
||||
EIGEN_STATIC_ASSERT(OtherRows==Dim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
|
||||
|
||||
typedef Block<ResultType, Dim, OtherCols> TopLeftLhs;
|
||||
|
||||
ResultType res(other.rows(),other.cols());
|
||||
TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() = T.linear() * other;
|
||||
TopLeftLhs(res, 0, 0, Dim, other.cols()).colwise() += T.translation();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -376,7 +376,12 @@ template<typename _MatrixType, int QRPreconditioner> class JacobiSVD
|
||||
* The default constructor is useful in cases in which the user intends to
|
||||
* perform decompositions via JacobiSVD::compute(const MatrixType&).
|
||||
*/
|
||||
JacobiSVD() : m_isInitialized(false) {}
|
||||
JacobiSVD()
|
||||
: m_isInitialized(false),
|
||||
m_isAllocated(false),
|
||||
m_computationOptions(0),
|
||||
m_rows(-1), m_cols(-1)
|
||||
{}
|
||||
|
||||
|
||||
/** \brief Default Constructor with memory preallocation
|
||||
@@ -386,6 +391,10 @@ template<typename _MatrixType, int QRPreconditioner> class JacobiSVD
|
||||
* \sa JacobiSVD()
|
||||
*/
|
||||
JacobiSVD(Index rows, Index cols, unsigned int computationOptions = 0)
|
||||
: m_isInitialized(false),
|
||||
m_isAllocated(false),
|
||||
m_computationOptions(0),
|
||||
m_rows(-1), m_cols(-1)
|
||||
{
|
||||
allocate(rows, cols, computationOptions);
|
||||
}
|
||||
@@ -401,11 +410,15 @@ template<typename _MatrixType, int QRPreconditioner> class JacobiSVD
|
||||
* available with the (non-default) FullPivHouseholderQR preconditioner.
|
||||
*/
|
||||
JacobiSVD(const MatrixType& matrix, unsigned int computationOptions = 0)
|
||||
: m_isInitialized(false),
|
||||
m_isAllocated(false),
|
||||
m_computationOptions(0),
|
||||
m_rows(-1), m_cols(-1)
|
||||
{
|
||||
compute(matrix, computationOptions);
|
||||
}
|
||||
|
||||
/** \brief Method performing the decomposition of given matrix.
|
||||
/** \brief Method performing the decomposition of given matrix using custom options.
|
||||
*
|
||||
* \param matrix the matrix to decompose
|
||||
* \param computationOptions optional parameter allowing to specify if you want full or thin U or V unitaries to be computed.
|
||||
@@ -415,7 +428,18 @@ template<typename _MatrixType, int QRPreconditioner> class JacobiSVD
|
||||
* Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not
|
||||
* available with the (non-default) FullPivHouseholderQR preconditioner.
|
||||
*/
|
||||
JacobiSVD& compute(const MatrixType& matrix, unsigned int computationOptions = 0);
|
||||
JacobiSVD& compute(const MatrixType& matrix, unsigned int computationOptions);
|
||||
|
||||
/** \brief Method performing the decomposition of given matrix using current options.
|
||||
*
|
||||
* \param matrix the matrix to decompose
|
||||
*
|
||||
* This method uses the current \a computationOptions, as already passed to the constructor or to compute(const MatrixType&, unsigned int).
|
||||
*/
|
||||
JacobiSVD& compute(const MatrixType& matrix)
|
||||
{
|
||||
return compute(matrix, m_computationOptions);
|
||||
}
|
||||
|
||||
/** \returns the \a U matrix.
|
||||
*
|
||||
@@ -452,7 +476,7 @@ template<typename _MatrixType, int QRPreconditioner> class JacobiSVD
|
||||
/** \returns the vector of singular values.
|
||||
*
|
||||
* For the SVD decomposition of a n-by-p matrix, letting \a m be the minimum of \a n and \a p, the
|
||||
* returned vector has size \a m.
|
||||
* returned vector has size \a m. Singular values are always sorted in decreasing order.
|
||||
*/
|
||||
const SingularValuesType& singularValues() const
|
||||
{
|
||||
@@ -494,16 +518,17 @@ template<typename _MatrixType, int QRPreconditioner> class JacobiSVD
|
||||
inline Index cols() const { return m_cols; }
|
||||
|
||||
private:
|
||||
void allocate(Index rows, Index cols, unsigned int computationOptions = 0);
|
||||
void allocate(Index rows, Index cols, unsigned int computationOptions);
|
||||
|
||||
protected:
|
||||
MatrixUType m_matrixU;
|
||||
MatrixVType m_matrixV;
|
||||
SingularValuesType m_singularValues;
|
||||
WorkMatrixType m_workMatrix;
|
||||
bool m_isInitialized;
|
||||
bool m_isInitialized, m_isAllocated;
|
||||
bool m_computeFullU, m_computeThinU;
|
||||
bool m_computeFullV, m_computeThinV;
|
||||
unsigned int m_computationOptions;
|
||||
Index m_nonzeroSingularValues, m_rows, m_cols, m_diagSize;
|
||||
|
||||
template<typename __MatrixType, int _QRPreconditioner, bool _IsComplex>
|
||||
@@ -515,9 +540,21 @@ template<typename _MatrixType, int QRPreconditioner> class JacobiSVD
|
||||
template<typename MatrixType, int QRPreconditioner>
|
||||
void JacobiSVD<MatrixType, QRPreconditioner>::allocate(Index rows, Index cols, unsigned int computationOptions)
|
||||
{
|
||||
eigen_assert(rows >= 0 && cols >= 0);
|
||||
|
||||
if (m_isAllocated &&
|
||||
rows == m_rows &&
|
||||
cols == m_cols &&
|
||||
computationOptions == m_computationOptions)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_rows = rows;
|
||||
m_cols = cols;
|
||||
m_isInitialized = false;
|
||||
m_isAllocated = true;
|
||||
m_computationOptions = computationOptions;
|
||||
m_computeFullU = (computationOptions & ComputeFullU) != 0;
|
||||
m_computeThinU = (computationOptions & ComputeThinU) != 0;
|
||||
m_computeFullV = (computationOptions & ComputeFullV) != 0;
|
||||
|
||||
@@ -34,13 +34,15 @@
|
||||
* This class implements a sparse matrix using the very common compressed row/column storage
|
||||
* scheme.
|
||||
*
|
||||
* \param _Scalar the scalar type, i.e. the type of the coefficients
|
||||
* \param _Options Union of bit flags controlling the storage scheme. Currently the only possibility
|
||||
* \tparam _Scalar the scalar type, i.e. the type of the coefficients
|
||||
* \tparam _Options Union of bit flags controlling the storage scheme. Currently the only possibility
|
||||
* is RowMajor. The default is 0 which means column-major.
|
||||
* \param _Index the type of the indices. Default is \c int.
|
||||
* \tparam _Index the type of the indices. Default is \c int.
|
||||
*
|
||||
* See http://www.netlib.org/linalg/html_templates/node91.html for details on the storage scheme.
|
||||
*
|
||||
* 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_SPARSEMATRIX_PLUGIN.
|
||||
*/
|
||||
|
||||
namespace internal {
|
||||
|
||||
@@ -31,10 +31,10 @@
|
||||
*
|
||||
* \brief Base class of any sparse matrices or sparse expressions
|
||||
*
|
||||
* \param Derived
|
||||
*
|
||||
*
|
||||
* \tparam Derived
|
||||
*
|
||||
* 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_SPARSEMATRIXBASE_PLUGIN.
|
||||
*/
|
||||
template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
|
||||
{
|
||||
|
||||
@@ -133,7 +133,12 @@ static void sparse_product_impl(const Lhs& lhs, const Rhs& rhs, ResultType& res)
|
||||
float avgNnzPerRhsColumn = float(rhs.nonZeros())/float(cols);
|
||||
float ratioRes = std::min(ratioLhs * avgNnzPerRhsColumn, 1.f);
|
||||
|
||||
res.resize(rows, cols);
|
||||
// mimics a resizeByInnerOuter:
|
||||
if(ResultType::IsRowMajor)
|
||||
res.resize(cols, rows);
|
||||
else
|
||||
res.resize(rows, cols);
|
||||
|
||||
res.reserve(Index(ratioRes*rows*cols));
|
||||
for (Index j=0; j<cols; ++j)
|
||||
{
|
||||
|
||||
@@ -29,10 +29,12 @@
|
||||
*
|
||||
* \brief a sparse vector class
|
||||
*
|
||||
* \param _Scalar the scalar type, i.e. the type of the coefficients
|
||||
* \tparam _Scalar the scalar type, i.e. the type of the coefficients
|
||||
*
|
||||
* See http://www.netlib.org/linalg/html_templates/node91.html for details on the storage scheme.
|
||||
*
|
||||
* 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_SPARSEVECTOR_PLUGIN.
|
||||
*/
|
||||
|
||||
namespace internal {
|
||||
|
||||
@@ -70,7 +70,7 @@ sqrt() const
|
||||
* Example: \include Cwise_cos.cpp
|
||||
* Output: \verbinclude Cwise_cos.out
|
||||
*
|
||||
* \sa sin(), exp()
|
||||
* \sa sin(), acos()
|
||||
*/
|
||||
inline const CwiseUnaryOp<internal::scalar_cos_op<Scalar>, const Derived>
|
||||
cos() const
|
||||
@@ -84,7 +84,7 @@ cos() const
|
||||
* Example: \include Cwise_sin.cpp
|
||||
* Output: \verbinclude Cwise_sin.out
|
||||
*
|
||||
* \sa cos(), exp()
|
||||
* \sa cos(), asin()
|
||||
*/
|
||||
inline const CwiseUnaryOp<internal::scalar_sin_op<Scalar>, const Derived>
|
||||
sin() const
|
||||
@@ -92,6 +92,31 @@ sin() const
|
||||
return derived();
|
||||
}
|
||||
|
||||
/** \returns an expression of the coefficient-wise arc cosine of *this.
|
||||
*
|
||||
* Example: \include Cwise_acos.cpp
|
||||
* Output: \verbinclude Cwise_acos.out
|
||||
*
|
||||
* \sa cos(), asin()
|
||||
*/
|
||||
inline const CwiseUnaryOp<internal::scalar_acos_op<Scalar>, const Derived>
|
||||
acos() const
|
||||
{
|
||||
return derived();
|
||||
}
|
||||
|
||||
/** \returns an expression of the coefficient-wise arc sine of *this.
|
||||
*
|
||||
* Example: \include Cwise_asin.cpp
|
||||
* Output: \verbinclude Cwise_asin.out
|
||||
*
|
||||
* \sa sin(), acos()
|
||||
*/
|
||||
inline const CwiseUnaryOp<internal::scalar_asin_op<Scalar>, const Derived>
|
||||
asin() const
|
||||
{
|
||||
return derived();
|
||||
}
|
||||
|
||||
/** \returns an expression of the coefficient-wise tan of *this.
|
||||
*
|
||||
|
||||
@@ -46,6 +46,11 @@ double BLASFUNC(xdotu) (int *, double *, int *, double *, int *);
|
||||
double BLASFUNC(xdotc) (int *, double *, int *, double *, int *);
|
||||
#endif
|
||||
|
||||
int BLASFUNC(cdotuw) (int *, float *, int *, float *, int *, float*);
|
||||
int BLASFUNC(cdotcw) (int *, float *, int *, float *, int *, float*);
|
||||
int BLASFUNC(zdotuw) (int *, double *, int *, double *, int *, double*);
|
||||
int BLASFUNC(zdotcw) (int *, double *, int *, double *, int *, double*);
|
||||
|
||||
int BLASFUNC(saxpy) (int *, float *, float *, int *, float *, int *);
|
||||
int BLASFUNC(daxpy) (int *, double *, double *, int *, double *, int *);
|
||||
int BLASFUNC(qaxpy) (int *, double *, double *, int *, double *, int *);
|
||||
|
||||
@@ -18,6 +18,7 @@ if(CMAKE_Fortran_COMPILER_WORKS)
|
||||
add_custom_target(blas)
|
||||
|
||||
set(EigenBlas_SRCS single.cpp double.cpp complex_single.cpp complex_double.cpp xerbla.cpp
|
||||
complexdots.f
|
||||
srotm.f srotmg.f drotm.f drotmg.f
|
||||
lsame.f chpr2.f ctbsv.f dspmv.f dtbmv.f dtpsv.f ssbmv.f sspr.f stpmv.f zhpr2.f ztbsv.f chbmv.f chpr.f ctpmv.f dspr2.f dtbsv.f sspmv.f stbmv.f stpsv.f zhbmv.f zhpr.f ztpmv.f chpmv.f ctbmv.f ctpsv.f dsbmv.f dspr.f dtpmv.f sspr2.f stbsv.f zhpmv.f ztbmv.f ztpsv.f
|
||||
)
|
||||
@@ -41,7 +42,7 @@ install(TARGETS eigen_blas
|
||||
if(EIGEN_LEAVE_TEST_IN_ALL_TARGET)
|
||||
add_subdirectory(testing) # can't do EXCLUDE_FROM_ALL here, breaks CTest
|
||||
else()
|
||||
add_subdirectory(testing)
|
||||
add_subdirectory(testing EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
endif(CMAKE_Fortran_COMPILER_WORKS)
|
||||
|
||||
@@ -105,6 +105,7 @@ enum
|
||||
Conj = IsComplex
|
||||
};
|
||||
|
||||
typedef Matrix<Scalar,Dynamic,Dynamic,ColMajor> PlainMatrixType;
|
||||
typedef Map<Matrix<Scalar,Dynamic,Dynamic,ColMajor>, 0, OuterStride<> > MatrixType;
|
||||
typedef Map<Matrix<Scalar,Dynamic,1>, 0, InnerStride<Dynamic> > StridedVectorType;
|
||||
typedef Map<Matrix<Scalar,Dynamic,1> > CompactVectorType;
|
||||
|
||||
43
blas/complexdots.f
Normal file
43
blas/complexdots.f
Normal file
@@ -0,0 +1,43 @@
|
||||
COMPLEX FUNCTION CDOTC(N,CX,INCX,CY,INCY)
|
||||
INTEGER INCX,INCY,N
|
||||
COMPLEX CX(*),CY(*)
|
||||
COMPLEX RES
|
||||
EXTERNAL CDOTCW
|
||||
|
||||
CALL CDOTCW(N,CX,INCX,CY,INCY,RES)
|
||||
CDOTC = RES
|
||||
RETURN
|
||||
END
|
||||
|
||||
COMPLEX FUNCTION CDOTU(N,CX,INCX,CY,INCY)
|
||||
INTEGER INCX,INCY,N
|
||||
COMPLEX CX(*),CY(*)
|
||||
COMPLEX RES
|
||||
EXTERNAL CDOTUW
|
||||
|
||||
CALL CDOTUW(N,CX,INCX,CY,INCY,RES)
|
||||
CDOTU = RES
|
||||
RETURN
|
||||
END
|
||||
|
||||
DOUBLE COMPLEX FUNCTION ZDOTC(N,CX,INCX,CY,INCY)
|
||||
INTEGER INCX,INCY,N
|
||||
DOUBLE COMPLEX CX(*),CY(*)
|
||||
DOUBLE COMPLEX RES
|
||||
EXTERNAL ZDOTCW
|
||||
|
||||
CALL ZDOTCW(N,CX,INCX,CY,INCY,RES)
|
||||
ZDOTC = RES
|
||||
RETURN
|
||||
END
|
||||
|
||||
DOUBLE COMPLEX FUNCTION ZDOTU(N,CX,INCX,CY,INCY)
|
||||
INTEGER INCX,INCY,N
|
||||
DOUBLE COMPLEX CX(*),CY(*)
|
||||
DOUBLE COMPLEX RES
|
||||
EXTERNAL ZDOTUW
|
||||
|
||||
CALL ZDOTUW(N,CX,INCX,CY,INCY,RES)
|
||||
ZDOTU = RES
|
||||
RETURN
|
||||
END
|
||||
@@ -52,7 +52,7 @@ RealScalar EIGEN_CAT(EIGEN_CAT(REAL_SCALAR_SUFFIX,SCALAR_SUFFIX),asum_)(int *n,
|
||||
}
|
||||
|
||||
// computes a dot product of a conjugated vector with another vector.
|
||||
Scalar EIGEN_BLAS_FUNC(dotc)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
|
||||
int EIGEN_BLAS_FUNC(dotcw)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar* pres)
|
||||
{
|
||||
// std::cerr << "_dotc " << *n << " " << *incx << " " << *incy << "\n";
|
||||
|
||||
@@ -60,18 +60,18 @@ Scalar EIGEN_BLAS_FUNC(dotc)(int *n, RealScalar *px, int *incx, RealScalar *py,
|
||||
|
||||
Scalar* x = reinterpret_cast<Scalar*>(px);
|
||||
Scalar* y = reinterpret_cast<Scalar*>(py);
|
||||
Scalar* res = reinterpret_cast<Scalar*>(pres);
|
||||
|
||||
Scalar res;
|
||||
if(*incx==1 && *incy==1) res = (vector(x,*n).dot(vector(y,*n)));
|
||||
else if(*incx>0 && *incy>0) res = (vector(x,*n,*incx).dot(vector(y,*n,*incy)));
|
||||
else if(*incx<0 && *incy>0) res = (vector(x,*n,-*incx).reverse().dot(vector(y,*n,*incy)));
|
||||
else if(*incx>0 && *incy<0) res = (vector(x,*n,*incx).dot(vector(y,*n,-*incy).reverse()));
|
||||
else if(*incx<0 && *incy<0) res = (vector(x,*n,-*incx).reverse().dot(vector(y,*n,-*incy).reverse()));
|
||||
return res;
|
||||
if(*incx==1 && *incy==1) *res = (vector(x,*n).dot(vector(y,*n)));
|
||||
else if(*incx>0 && *incy>0) *res = (vector(x,*n,*incx).dot(vector(y,*n,*incy)));
|
||||
else if(*incx<0 && *incy>0) *res = (vector(x,*n,-*incx).reverse().dot(vector(y,*n,*incy)));
|
||||
else if(*incx>0 && *incy<0) *res = (vector(x,*n,*incx).dot(vector(y,*n,-*incy).reverse()));
|
||||
else if(*incx<0 && *incy<0) *res = (vector(x,*n,-*incx).reverse().dot(vector(y,*n,-*incy).reverse()));
|
||||
return 0;
|
||||
}
|
||||
|
||||
// computes a vector-vector dot product without complex conjugation.
|
||||
Scalar EIGEN_BLAS_FUNC(dotu)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
|
||||
int EIGEN_BLAS_FUNC(dotuw)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar* pres)
|
||||
{
|
||||
// std::cerr << "_dotu " << *n << " " << *incx << " " << *incy << "\n";
|
||||
|
||||
@@ -79,13 +79,14 @@ Scalar EIGEN_BLAS_FUNC(dotu)(int *n, RealScalar *px, int *incx, RealScalar *py,
|
||||
|
||||
Scalar* x = reinterpret_cast<Scalar*>(px);
|
||||
Scalar* y = reinterpret_cast<Scalar*>(py);
|
||||
Scalar res;
|
||||
if(*incx==1 && *incy==1) res = (vector(x,*n).cwiseProduct(vector(y,*n))).sum();
|
||||
else if(*incx>0 && *incy>0) res = (vector(x,*n,*incx).cwiseProduct(vector(y,*n,*incy))).sum();
|
||||
else if(*incx<0 && *incy>0) res = (vector(x,*n,-*incx).reverse().cwiseProduct(vector(y,*n,*incy))).sum();
|
||||
else if(*incx>0 && *incy<0) res = (vector(x,*n,*incx).cwiseProduct(vector(y,*n,-*incy).reverse())).sum();
|
||||
else if(*incx<0 && *incy<0) res = (vector(x,*n,-*incx).reverse().cwiseProduct(vector(y,*n,-*incy).reverse())).sum();
|
||||
return res;
|
||||
Scalar* res = reinterpret_cast<Scalar*>(pres);
|
||||
|
||||
if(*incx==1 && *incy==1) *res = (vector(x,*n).cwiseProduct(vector(y,*n))).sum();
|
||||
else if(*incx>0 && *incy>0) *res = (vector(x,*n,*incx).cwiseProduct(vector(y,*n,*incy))).sum();
|
||||
else if(*incx<0 && *incy>0) *res = (vector(x,*n,-*incx).reverse().cwiseProduct(vector(y,*n,*incy))).sum();
|
||||
else if(*incx>0 && *incy<0) *res = (vector(x,*n,*incx).cwiseProduct(vector(y,*n,-*incy).reverse())).sum();
|
||||
else if(*incx<0 && *incy<0) *res = (vector(x,*n,-*incx).reverse().cwiseProduct(vector(y,*n,-*incy).reverse())).sum();
|
||||
return 0;
|
||||
}
|
||||
|
||||
RealScalar EIGEN_CAT(EIGEN_CAT(REAL_SCALAR_SUFFIX,SCALAR_SUFFIX),nrm2_)(int *n, RealScalar *px, int *incx)
|
||||
|
||||
@@ -343,8 +343,6 @@ int EIGEN_BLAS_FUNC(syrk)(char *uplo, char *op, int *n, int *k, RealScalar *palp
|
||||
if(info)
|
||||
return xerbla_(SCALAR_SUFFIX_UP"SYRK ",&info,6);
|
||||
|
||||
int code = OP(*op) | (UPLO(*uplo) << 2);
|
||||
|
||||
if(beta!=Scalar(1))
|
||||
{
|
||||
if(UPLO(*uplo)==UP)
|
||||
@@ -372,6 +370,7 @@ int EIGEN_BLAS_FUNC(syrk)(char *uplo, char *op, int *n, int *k, RealScalar *palp
|
||||
matrix(c, *n, *n, *ldc).triangularView<Lower>() += alpha * matrix(a,*k,*n,*lda).transpose() * matrix(a,*k,*n,*lda);
|
||||
}
|
||||
#else
|
||||
int code = OP(*op) | (UPLO(*uplo) << 2);
|
||||
func[code](*n, *k, a, *lda, a, *lda, c, *ldc, alpha);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ macro(ei_add_blas_test testname)
|
||||
target_link_libraries(${targetname} ${EXTERNAL_LIBS})
|
||||
|
||||
add_test(${testname} "${Eigen_SOURCE_DIR}/blas/testing/runblastest.sh" "${testname}" "${Eigen_SOURCE_DIR}/blas/testing/${testname}.dat")
|
||||
add_dependencies(buildtests ${targetname})
|
||||
|
||||
endmacro(ei_add_blas_test)
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# Cholmod lib usually requires linking to a blas and lapack library.
|
||||
# It is up to the user of this module to find a BLAS and link to it.
|
||||
|
||||
if (CHOLMOD_INCLUDES AND CHOLMOD_LIBRARIES)
|
||||
set(CHOLMOD_FIND_QUIETLY TRUE)
|
||||
|
||||
@@ -1,30 +1,23 @@
|
||||
|
||||
# Umfpack lib usually requires linking to a blas library.
|
||||
# It is up to the user of this module to find a BLAS and link to it.
|
||||
|
||||
if (SUPERLU_INCLUDES AND SUPERLU_LIBRARIES)
|
||||
set(SUPERLU_FIND_QUIETLY TRUE)
|
||||
endif (SUPERLU_INCLUDES AND SUPERLU_LIBRARIES)
|
||||
|
||||
find_package(BLAS)
|
||||
find_path(SUPERLU_INCLUDES
|
||||
NAMES
|
||||
supermatrix.h
|
||||
PATHS
|
||||
$ENV{SUPERLUDIR}
|
||||
${INCLUDE_INSTALL_DIR}
|
||||
PATH_SUFFIXES
|
||||
superlu
|
||||
)
|
||||
|
||||
if(BLAS_FOUND)
|
||||
find_library(SUPERLU_LIBRARIES superlu PATHS $ENV{SUPERLUDIR} ${LIB_INSTALL_DIR})
|
||||
|
||||
find_path(SUPERLU_INCLUDES
|
||||
NAMES
|
||||
supermatrix.h
|
||||
PATHS
|
||||
$ENV{SUPERLUDIR}
|
||||
${INCLUDE_INSTALL_DIR}
|
||||
PATH_SUFFIXES
|
||||
superlu
|
||||
)
|
||||
|
||||
find_library(SUPERLU_LIBRARIES superlu PATHS $ENV{SUPERLUDIR} ${LIB_INSTALL_DIR})
|
||||
|
||||
if(SUPERLU_LIBRARIES)
|
||||
set(SUPERLU_LIBRARIES ${SUPERLU_LIBRARIES} ${BLAS_LIBRARIES})
|
||||
endif(SUPERLU_LIBRARIES)
|
||||
|
||||
endif(BLAS_FOUND)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(SUPERLU DEFAULT_MSG
|
||||
SUPERLU_INCLUDES SUPERLU_LIBRARIES)
|
||||
|
||||
@@ -1,53 +1,45 @@
|
||||
# Umfpack lib usually requires linking to a blas library.
|
||||
# It is up to the user of this module to find a BLAS and link to it.
|
||||
|
||||
if (UMFPACK_INCLUDES AND UMFPACK_LIBRARIES)
|
||||
set(UMFPACK_FIND_QUIETLY TRUE)
|
||||
endif (UMFPACK_INCLUDES AND UMFPACK_LIBRARIES)
|
||||
|
||||
find_package(BLAS)
|
||||
find_path(UMFPACK_INCLUDES
|
||||
NAMES
|
||||
umfpack.h
|
||||
PATHS
|
||||
$ENV{UMFPACKDIR}
|
||||
${INCLUDE_INSTALL_DIR}
|
||||
PATH_SUFFIXES
|
||||
suitesparse
|
||||
)
|
||||
|
||||
if(BLAS_FOUND)
|
||||
find_library(UMFPACK_LIBRARIES umfpack PATHS $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
|
||||
|
||||
find_path(UMFPACK_INCLUDES
|
||||
NAMES
|
||||
umfpack.h
|
||||
PATHS
|
||||
$ENV{UMFPACKDIR}
|
||||
${INCLUDE_INSTALL_DIR}
|
||||
PATH_SUFFIXES
|
||||
suitesparse
|
||||
)
|
||||
if(UMFPACK_LIBRARIES)
|
||||
|
||||
find_library(UMFPACK_LIBRARIES umfpack PATHS $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
|
||||
get_filename_component(UMFPACK_LIBDIR ${UMFPACK_LIBRARIES} PATH)
|
||||
|
||||
if(UMFPACK_LIBRARIES)
|
||||
find_library(AMD_LIBRARY amd PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
|
||||
if (AMD_LIBRARY)
|
||||
set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${AMD_LIBRARY})
|
||||
#else (AMD_LIBRARY)
|
||||
# set(UMFPACK_LIBRARIES FALSE)
|
||||
endif (AMD_LIBRARY)
|
||||
|
||||
get_filename_component(UMFPACK_LIBDIR ${UMFPACK_LIBRARIES} PATH)
|
||||
endif(UMFPACK_LIBRARIES)
|
||||
|
||||
find_library(AMD_LIBRARY amd PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
|
||||
if (AMD_LIBRARY)
|
||||
set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${AMD_LIBRARY})
|
||||
#else (AMD_LIBRARY)
|
||||
# set(UMFPACK_LIBRARIES FALSE)
|
||||
endif (AMD_LIBRARY)
|
||||
if(UMFPACK_LIBRARIES)
|
||||
|
||||
endif(UMFPACK_LIBRARIES)
|
||||
find_library(COLAMD_LIBRARY colamd PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
|
||||
if (COLAMD_LIBRARY)
|
||||
set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${COLAMD_LIBRARY})
|
||||
#else (COLAMD_LIBRARY)
|
||||
# set(UMFPACK_LIBRARIES FALSE)
|
||||
endif (COLAMD_LIBRARY)
|
||||
|
||||
if(UMFPACK_LIBRARIES)
|
||||
|
||||
find_library(COLAMD_LIBRARY colamd PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
|
||||
if (COLAMD_LIBRARY)
|
||||
set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${COLAMD_LIBRARY})
|
||||
#else (COLAMD_LIBRARY)
|
||||
# set(UMFPACK_LIBRARIES FALSE)
|
||||
endif (COLAMD_LIBRARY)
|
||||
|
||||
endif(UMFPACK_LIBRARIES)
|
||||
|
||||
if(UMFPACK_LIBRARIES)
|
||||
set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${BLAS_LIBRARIES})
|
||||
endif(UMFPACK_LIBRARIES)
|
||||
|
||||
endif(BLAS_FOUND)
|
||||
endif(UMFPACK_LIBRARIES)
|
||||
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
@@ -56,20 +56,22 @@ class EigenMatrixPrinter:
|
||||
template_params = m.split(',')
|
||||
template_params = map(lambda x:x.replace(" ", ""), template_params)
|
||||
|
||||
self.rows = int(template_params[1])
|
||||
self.cols = int(template_params[2])
|
||||
if template_params[1] == '-0x00000000000000001':
|
||||
self.rows = val['m_storage']['m_rows']
|
||||
else:
|
||||
self.rows = int(template_params[1])
|
||||
|
||||
if template_params[2] == '-0x00000000000000001':
|
||||
self.cols = val['m_storage']['m_cols']
|
||||
else:
|
||||
self.cols = int(template_params[2])
|
||||
|
||||
self.options = 0 # default value
|
||||
if len(template_params) > 3:
|
||||
self.options = template_params[3];
|
||||
|
||||
self.rowMajor = (int(self.options) & 0x1)
|
||||
|
||||
if self.rows == 10000:
|
||||
self.rows = val['m_storage']['m_rows']
|
||||
|
||||
if self.cols == 10000:
|
||||
self.cols = val['m_storage']['m_cols']
|
||||
|
||||
self.innerType = self.type.template_argument(0)
|
||||
|
||||
self.val = val
|
||||
|
||||
@@ -21,6 +21,7 @@ and gives tips to help porting your application from Eigen2 to Eigen3.
|
||||
- \ref LazyVsNoalias
|
||||
- \ref AlignMacros
|
||||
- \ref AlignedMap
|
||||
- \ref StdContainers
|
||||
- \ref eiPrefix
|
||||
|
||||
\section CompatibilitySupport Eigen2 compatibility support
|
||||
@@ -295,6 +296,18 @@ There also are related convenience static methods, which actually are the prefer
|
||||
result = Vector4f::MapAligned(some_aligned_array);
|
||||
\endcode
|
||||
|
||||
\section StdContainers STL Containers
|
||||
|
||||
In Eigen2, #include<Eigen/StdVector> tweaked std::vector to automatically align elements. The problem was that that was quite invasive. In Eigen3, we only override standard behavior if you use Eigen::aligned_allocator<T> as your allocator type. So for example, if you use std::vector<Matrix4f>, you need to do the following change (note that aligned_allocator is under namespace Eigen):
|
||||
|
||||
<table class="manual">
|
||||
<tr><th>Eigen 2</th><th>Eigen 3</th></tr>
|
||||
<tr>
|
||||
<td> \code std::vector<Matrix4f> \endcode </td>
|
||||
<td> \code std::vector<Matrix4f, aligned_allocator<Matrix4f> > \endcode </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
\section eiPrefix Internal ei_ prefix
|
||||
|
||||
In Eigen2, global internal functions and structures were prefixed by \c ei_. In Eigen3, they all have been moved into the more explicit \c internal namespace. So, e.g., \c ei_sqrt(x) now becomes \c internal::sqrt(x). Of course it is not recommended to rely on Eigen's internal features.
|
||||
|
||||
@@ -47,6 +47,7 @@ The parts of the API that are still not 100% Eigen 2 compatible in this mode are
|
||||
\li Dot products over complex numbers. Eigen 2's dot product was linear in the first variable. Eigen 3's dot product is linear in the second variable. In other words, the Eigen 2 code \code x.dot(y) \endcode is equivalent to the Eigen 3 code \code y.dot(x) \endcode In yet other words, dot products are complex-conjugated in Eigen 3 compared to Eigen 2. The switch to the new convention was commanded by common usage, especially with the notation \f$ x^Ty \f$ for dot products of column-vectors.
|
||||
\li The Sparse module.
|
||||
\li Certain fine details of linear algebraic decompositions. For example, LDLT decomposition is now pivoting in Eigen 3 whereas it wasn't in Eigen 2, so code that was relying on its underlying matrix structure will break.
|
||||
\li Usage of Eigen types in STL containers, \ref Eigen2ToEigen3 "as explained on this page".
|
||||
|
||||
\section Stage20 Stage 20: define EIGEN2_SUPPORT_STAGE20_RESOLVE_API_CONFLICTS
|
||||
|
||||
|
||||
@@ -1213,7 +1213,8 @@ PREDEFINED = EIGEN_EMPTY_STRUCT \
|
||||
EIGEN_PARSED_BY_DOXYGEN \
|
||||
EIGEN_VECTORIZE \
|
||||
EIGEN_QT_SUPPORT \
|
||||
EIGEN_STRONG_INLINE=inline
|
||||
EIGEN_STRONG_INLINE=inline \
|
||||
EIGEN2_SUPPORT_STAGE=99
|
||||
|
||||
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
|
||||
# this tag can be used to specify a list of macro names that should be expanded.
|
||||
|
||||
@@ -9,7 +9,7 @@ Eigen can be extended in several ways, for instance, by defining global methods,
|
||||
- \ref InheritingFromMatrix
|
||||
- \ref CustomScalarType
|
||||
|
||||
\section ExtendingMatrixBase Extending MatrixBase
|
||||
\section ExtendingMatrixBase Extending MatrixBase (and other classes)
|
||||
|
||||
In this section we will see how to add custom methods to MatrixBase. Since all expressions and matrix types inherit MatrixBase, adding a method to MatrixBase make it immediately available to all expressions ! A typical use case is, for instance, to make Eigen compatible with another API.
|
||||
|
||||
@@ -22,9 +22,11 @@ class MatrixBase {
|
||||
#endif
|
||||
};
|
||||
\endcode
|
||||
Therefore to extend MatrixBase with you own methods you just have to create a file with your method declaration and define EIGEN_MATRIXBASE_PLUGIN before you include any Eigen's header file.
|
||||
Therefore to extend MatrixBase with your own methods you just have to create a file with your method declaration and define EIGEN_MATRIXBASE_PLUGIN before you include any Eigen's header file.
|
||||
|
||||
Here is an example of such an extension file: \n
|
||||
You can extend many of the other classes used in Eigen by defining similarly named preprocessor symbols. For instance, define \c EIGEN_ARRAYBASE_PLUGIN if you want to extend the ArrayBase class. A full list of classes that can be extended in this way and the corresponding preprocessor symbols can be found on our page \ref TopicPreprocessorDirectives.
|
||||
|
||||
Here is an example of an extension file for adding methods to MatrixBase: \n
|
||||
\b MatrixBaseAddons.h
|
||||
\code
|
||||
inline Scalar at(uint i, uint j) const { return this->operator()(i,j); }
|
||||
|
||||
@@ -2,7 +2,7 @@ namespace Eigen {
|
||||
|
||||
/** \page TopicPreprocessorDirectives Preprocessor directives
|
||||
|
||||
You can control some aspects of Eigen by defining the preprocessor tokens using \c #define. These macros
|
||||
You can control some aspects of Eigen by defining the preprocessor tokens using \c \#define. These macros
|
||||
should be defined before any Eigen headers are included. Often they are best set in the project options.
|
||||
|
||||
This page lists the preprocesor tokens recognised by Eigen.
|
||||
@@ -18,8 +18,12 @@ This page lists the preprocesor tokens recognised by Eigen.
|
||||
|
||||
- \b EIGEN2_SUPPORT - if defined, enables the Eigen2 compatibility mode. This is meant to ease the transition
|
||||
of Eigen2 to Eigen3 (see \ref Eigen2ToEigen3). Not defined by default.
|
||||
- \b EIGEN2_SUPPORT_STAGEnn_xxx (for various values of nn and xxx) - staged migration path from Eigen2 to
|
||||
Eigen3; see \ref Eigen2SupportModes.
|
||||
- \b EIGEN_DEFAULT_TO_ROW_MAJOR - when defined, the default storage order for matrices becomes row-major
|
||||
instead of column-major. Not defined by default.
|
||||
- \b EIGEN_DEFAULT_DENSE_INDEX_TYPE - the type for column and row indices in matrices, vectors and array
|
||||
(DenseBase::Index). Set to \c std::ptrdiff_t by default.
|
||||
- \b EIGEN_DEFAULT_IO_FORMAT - the IOFormat to use when printing a matrix if no #IOFormat is specified.
|
||||
Defaults to the #IOFormat constructed by the default constructor IOFormat().
|
||||
- \b EIGEN_INITIALIZE_MATRICES_BY_ZERO - if defined, all entries of newly constructed matrices and arrays are
|
||||
@@ -41,7 +45,8 @@ run time. However, these assertions do cost time and can thus be turned off.
|
||||
|
||||
\section TopicPreprocessorDirectivesPerformance Alignment, vectorization and performance tweaking
|
||||
|
||||
- \b EIGEN_DONT_ALIGN - disables alignment.
|
||||
- \b EIGEN_DONT_ALIGN - disables alignment completely. Eigen will not try to align its objects and does not
|
||||
expect that any objects passed to it are aligned. This will turn off vectorization. Not defined by default.
|
||||
- \b EIGEN_DONT_ALIGN_STATICALLY - disables alignment of arrays on the stack. Not defined by default, unless
|
||||
\c EIGEN_DONT_ALIGN is defined.
|
||||
- \b EIGEN_DONT_VECTORIZE - disables explicit vectorization when defined. Not defined by default, unless
|
||||
@@ -60,17 +65,22 @@ It is possible to add new methods to many fundamental classes in Eigen by writin
|
||||
the section \ref ExtendingMatrixBase, the plugin is specified by defining a \c EIGEN_xxx_PLUGIN macro. The
|
||||
following macros are supported; none of them are defined by default.
|
||||
|
||||
- \b EIGEN_ARRAYBASE_PLUGIN - filename of plugin for extending the ArrayBase class.
|
||||
- \b EIGEN_ARRAY_PLUGIN - filename of plugin for extending the Array class.
|
||||
- \b EIGEN_ARRAYBASE_PLUGIN - filename of plugin for extending the ArrayBase class.
|
||||
- \b EIGEN_CWISE_PLUGIN - filename of plugin for extending the Cwise class.
|
||||
- \b EIGEN_DENSEBASE_PLUGIN - filename of plugin for extending the DenseBase class.
|
||||
- \b EIGEN_MATRIXBASE_PLUGIN - filename of plugin for extending the MatrixBase class.
|
||||
- \b EIGEN_DYNAMICSPARSEMATRIX_PLUGIN - filename of plugin for extending the DynamicSparseMatrix class.
|
||||
- \b EIGEN_MATRIX_PLUGIN - filename of plugin for extending the Matrix class.
|
||||
- \b EIGEN_MATRIXBASE_PLUGIN - filename of plugin for extending the MatrixBase class.
|
||||
- \b EIGEN_PLAINOBJECTBASE_PLUGIN - filename of plugin for extending the PlainObjectBase class.
|
||||
- \b EIGEN_QUATERNIONBASE_PLUGIN - filename of plugin for extending the QuaternionBase class.
|
||||
- \b EIGEN_SPARSEMATRIX_PLUGIN - filename of plugin for extending the SparseMatrix class.
|
||||
- \b EIGEN_SPARSEMATRIXBASE_PLUGIN - filename of plugin for extending the SparseMatrixBase class.
|
||||
- \b EIGEN_SPARSEVECTOR_PLUGIN - filename of plugin for extending the SparseVector class.
|
||||
- \b EIGEN_TRANSFORM_PLUGIN - filename of plugin for extending the Transform class.
|
||||
- \b EIGEN_FUNCTORS_PLUGIN - filename of plugin for adding new functors and specializations of functor_traits.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace Eigen {
|
||||
- \ref QuickRef_Coeffwise
|
||||
- \ref QuickRef_Reductions
|
||||
- \ref QuickRef_Blocks
|
||||
- \ref QuickRef_Misc
|
||||
- \ref QuickRef_DiagTriSymm
|
||||
\n
|
||||
|
||||
@@ -395,6 +396,9 @@ mat1.array() / mat2.array()
|
||||
\endcode</td></tr>
|
||||
</table>
|
||||
|
||||
It is also very simple to apply any user defined function \c foo using DenseBase::unaryExpr together with std::ptr_fun:
|
||||
\code mat1.unaryExpr(std::ptr_fun(foo))\endcode
|
||||
|
||||
Array operators:\arrayworld
|
||||
|
||||
<table class="manual">
|
||||
@@ -422,6 +426,8 @@ array1.inverse()
|
||||
array1.sin() std::sin(array1)
|
||||
array1.cos() std::cos(array1)
|
||||
array1.tan() std::tan(array1)
|
||||
array1.asin() std::asin(array1)
|
||||
array1.acos() std::acos(array1)
|
||||
\endcode
|
||||
</td></tr>
|
||||
</table>
|
||||
@@ -520,6 +526,24 @@ Read-write access to sub-matrices:</td></tr>
|
||||
|
||||
|
||||
|
||||
<a href="#" class="top">top</a>\section QuickRef_Misc Miscellaneous operations
|
||||
|
||||
\subsection QuickRef_Reverse Reverse
|
||||
Vectors, rows, and/or columns of a matrix can be reversed (see DenseBase::reverse(), DenseBase::reverseInPlace(), VectorwiseOp::reverse()).
|
||||
\code
|
||||
vec.reverse() mat.colwise().reverse() mat.rowwise().reverse()
|
||||
vec.reverseInPlace()
|
||||
\endcode
|
||||
|
||||
\subsection QuickRef_Reverse Replicate
|
||||
Vectors, matrices, rows, and/or columns can be replicated in any direction (see DenseBase::replicate(), VectorwiseOp::replicate())
|
||||
\code
|
||||
vec.replicate(times) vec.replicate<Times>
|
||||
mat.replicate(vertical_times, horizontal_times) mat.replicate<VerticalTimes, HorizontalTimes>()
|
||||
mat.colwise().replicate(vertical_times, horizontal_times) mat.colwise().replicate<VerticalTimes, HorizontalTimes>()
|
||||
mat.rowwise().replicate(vertical_times, horizontal_times) mat.rowwise().replicate<VerticalTimes, HorizontalTimes>()
|
||||
\endcode
|
||||
|
||||
|
||||
<a href="#" class="top">top</a>\section QuickRef_DiagTriSymm Diagonal, Triangular, and Self-adjoint matrices
|
||||
(matrix world \matrixworld)
|
||||
|
||||
2
doc/snippets/Cwise_acos.cpp
Normal file
2
doc/snippets/Cwise_acos.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(0, sqrt(2.)/2, 1);
|
||||
cout << v.acos() << endl;
|
||||
@@ -29,6 +29,7 @@ set(EigenLapack_SRCS ${EigenLapack_SRCS}
|
||||
# reference/dpotrs.f reference/spotrs.f reference/zpotrs.f reference/cpotrs.f
|
||||
# reference/dgetrf.f reference/cgetrf.f reference/sgetrf.f reference/zgetrf.f
|
||||
# reference/cgetrs.f reference/dgetrs.f reference/sgetrs.f reference/zgetrs.f
|
||||
# reference/dsyev.f reference/ssyev.f
|
||||
|
||||
reference/dlamch.f reference/ilaver.f reference/lsame.f reference/slamch.f reference/second_NONE.f reference/dsecnd_NONE.f
|
||||
reference/cbdsqr.f reference/ctbrfs.f reference/dorml2.f reference/sla_porfsx_extended.f reference/zggglm.f
|
||||
@@ -124,7 +125,7 @@ reference/cheevr.f reference/dgehd2.f reference/dste
|
||||
reference/cheevx.f reference/dgehrd.f reference/dsycon.f reference/sopgtr.f reference/zlagtm.f
|
||||
reference/chegs2.f reference/dgejsv.f reference/dsyequb.f reference/sopmtr.f reference/zla_heamv.f
|
||||
reference/chegst.f reference/dgelq2.f reference/dsyevd.f reference/sorg2l.f reference/zlahef.f
|
||||
reference/chegvd.f reference/dgelqf.f reference/dsyev.f reference/sorg2r.f reference/zla_hercond_c.f
|
||||
reference/chegvd.f reference/dgelqf.f reference/sorg2r.f reference/zla_hercond_c.f
|
||||
reference/chegv.f reference/dgelsd.f reference/dsyevr.f reference/sorgbr.f reference/zla_hercond_x.f
|
||||
reference/chegvx.f reference/dgels.f reference/dsyevx.f reference/sorghr.f reference/zla_herfsx_extended.f
|
||||
reference/cherfs.f reference/dgelss.f reference/dsygs2.f reference/sorgl2.f reference/zla_herpvgrw.f
|
||||
@@ -230,7 +231,7 @@ reference/claqhp.f reference/dlamrg.f reference/sgee
|
||||
reference/claqp2.f reference/dlaneg.f reference/sgegs.f reference/ssycon.f reference/zpftri.f
|
||||
reference/claqps.f reference/dlangb.f reference/sgegv.f reference/ssyequb.f reference/zpftrs.f
|
||||
reference/claqr0.f reference/dlange.f reference/sgehd2.f reference/ssyevd.f reference/zpocon.f
|
||||
reference/claqr1.f reference/dlangt.f reference/sgehrd.f reference/ssyev.f reference/zpoequb.f
|
||||
reference/claqr1.f reference/dlangt.f reference/sgehrd.f reference/zpoequb.f
|
||||
reference/claqr2.f reference/dlanhs.f reference/sgejsv.f reference/ssyevr.f reference/zpoequ.f
|
||||
reference/claqr3.f reference/dlansb.f reference/sgelq2.f reference/ssyevx.f reference/zporfs.f
|
||||
reference/claqr4.f reference/dlansf.f reference/sgelqf.f reference/ssygs2.f reference/zporfsx.f
|
||||
@@ -357,11 +358,11 @@ reference/ctbcon.f reference/dormhr.f reference/sla_
|
||||
endif()
|
||||
|
||||
add_library(eigen_lapack_static ${EigenLapack_SRCS})
|
||||
# add_library(eigen_lapack SHARED ${EigenLapack_SRCS})
|
||||
add_library(eigen_lapack SHARED ${EigenLapack_SRCS})
|
||||
|
||||
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
|
||||
target_link_libraries(eigen_lapack_static ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
|
||||
# target_link_libraries(eigen_lapack ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
|
||||
target_link_libraries(eigen_lapack ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
|
||||
endif()
|
||||
|
||||
# add_dependencies(lapack eigen_lapack eigen_lapack_static)
|
||||
|
||||
@@ -29,3 +29,4 @@
|
||||
|
||||
#include "cholesky.cpp"
|
||||
#include "lu.cpp"
|
||||
#include "eigenvalues.cpp"
|
||||
|
||||
94
lapack/eigenvalues.cpp
Normal file
94
lapack/eigenvalues.cpp
Normal file
@@ -0,0 +1,94 @@
|
||||
// This file is part of Eigen, a lightweight C++ template library
|
||||
// for linear algebra.
|
||||
//
|
||||
// Copyright (C) 2011 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||
//
|
||||
// Eigen is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Alternatively, you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License and a copy of the GNU General Public License along with
|
||||
// Eigen. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "common.h"
|
||||
#include <Eigen/Eigenvalues>
|
||||
|
||||
// computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges
|
||||
EIGEN_LAPACK_FUNC(syev,(char *jobz, char *uplo, int* n, Scalar* a, int *lda, Scalar* w, Scalar* /*work*/, int* lwork, int *info))
|
||||
{
|
||||
// TODO exploit the work buffer
|
||||
bool query_size = *lwork==-1;
|
||||
|
||||
*info = 0;
|
||||
if(*jobz!='N' && *jobz!='V') *info = -1;
|
||||
else if(UPLO(*uplo)==INVALID) *info = -2;
|
||||
else if(*n<0) *info = -3;
|
||||
else if(*lda<std::max(1,*n)) *info = -5;
|
||||
else if((!query_size) && *lwork<std::max(1,3**n-1)) *info = -8;
|
||||
|
||||
// if(*info==0)
|
||||
// {
|
||||
// int nb = ILAENV( 1, 'SSYTRD', UPLO, N, -1, -1, -1 )
|
||||
// LWKOPT = MAX( 1, ( NB+2 )*N )
|
||||
// WORK( 1 ) = LWKOPT
|
||||
// *
|
||||
// IF( LWORK.LT.MAX( 1, 3*N-1 ) .AND. .NOT.LQUERY )
|
||||
// $ INFO = -8
|
||||
// END IF
|
||||
// *
|
||||
// IF( INFO.NE.0 ) THEN
|
||||
// CALL XERBLA( 'SSYEV ', -INFO )
|
||||
// RETURN
|
||||
// ELSE IF( LQUERY ) THEN
|
||||
// RETURN
|
||||
// END IF
|
||||
|
||||
if(*info!=0)
|
||||
{
|
||||
int e = -*info;
|
||||
return xerbla_(SCALAR_SUFFIX_UP"SYEV ", &e, 6);
|
||||
}
|
||||
|
||||
if(query_size)
|
||||
{
|
||||
*lwork = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(*n==0)
|
||||
return 0;
|
||||
|
||||
PlainMatrixType mat(*n,*n);
|
||||
if(UPLO(*uplo)==UP) mat = matrix(a,*n,*n,*lda).adjoint();
|
||||
else mat = matrix(a,*n,*n,*lda);
|
||||
|
||||
bool computeVectors = *jobz=='V' || *jobz=='v';
|
||||
SelfAdjointEigenSolver<PlainMatrixType> eig(mat,computeVectors?ComputeEigenvectors:EigenvaluesOnly);
|
||||
|
||||
if(eig.info()==NoConvergence)
|
||||
{
|
||||
vector(w,*n).setZero();
|
||||
if(computeVectors)
|
||||
matrix(a,*n,*n,*lda).setIdentity();
|
||||
//*info = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
vector(w,*n) = eig.eigenvalues();
|
||||
if(computeVectors)
|
||||
matrix(a,*n,*n,*lda) = eig.eigenvectors();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -29,3 +29,4 @@
|
||||
|
||||
#include "cholesky.cpp"
|
||||
#include "lu.cpp"
|
||||
#include "eigenvalues.cpp"
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
project(EigenTesting)
|
||||
add_custom_target(buildtests)
|
||||
add_custom_target(check COMMAND "ctest")
|
||||
add_dependencies(check buildtests)
|
||||
|
||||
find_package(GSL)
|
||||
if(GSL_FOUND AND GSL_VERSION_MINOR LESS 9)
|
||||
@@ -123,6 +119,7 @@ ei_add_test(eigen2support)
|
||||
ei_add_test(nullary)
|
||||
ei_add_test(nesting_ops "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
ei_add_test(zerosized)
|
||||
ei_add_test(dontalign)
|
||||
|
||||
ei_add_test(prec_inverse_4x4)
|
||||
|
||||
|
||||
@@ -40,10 +40,6 @@ template<typename MatrixType> void adjoint(const MatrixType& m)
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
RealScalar largerEps = test_precision<RealScalar>();
|
||||
if (internal::is_same<RealScalar,float>::value)
|
||||
largerEps = RealScalar(1e-3f);
|
||||
|
||||
MatrixType m1 = MatrixType::Random(rows, cols),
|
||||
m2 = MatrixType::Random(rows, cols),
|
||||
m3(rows, cols),
|
||||
@@ -68,8 +64,10 @@ template<typename MatrixType> void adjoint(const MatrixType& m)
|
||||
|
||||
// check basic properties of dot, norm, norm2
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
VERIFY(internal::isApprox((s1 * v1 + s2 * v2).dot(v3), internal::conj(s1) * v1.dot(v3) + internal::conj(s2) * v2.dot(v3), largerEps));
|
||||
VERIFY(internal::isApprox(v3.dot(s1 * v1 + s2 * v2), s1*v3.dot(v1)+s2*v3.dot(v2), largerEps));
|
||||
|
||||
RealScalar ref = NumTraits<Scalar>::IsInteger ? 0 : std::max((s1 * v1 + s2 * v2).norm(),v3.norm());
|
||||
VERIFY(test_isApproxWithRef((s1 * v1 + s2 * v2).dot(v3), internal::conj(s1) * v1.dot(v3) + internal::conj(s2) * v2.dot(v3), ref));
|
||||
VERIFY(test_isApproxWithRef(v3.dot(s1 * v1 + s2 * v2), s1*v3.dot(v1)+s2*v3.dot(v2), ref));
|
||||
VERIFY_IS_APPROX(internal::conj(v1.dot(v2)), v2.dot(v1));
|
||||
VERIFY_IS_APPROX(internal::real(v1.dot(v1)), v1.squaredNorm());
|
||||
if(!NumTraits<Scalar>::IsInteger)
|
||||
@@ -77,7 +75,9 @@ template<typename MatrixType> void adjoint(const MatrixType& m)
|
||||
VERIFY_IS_MUCH_SMALLER_THAN(internal::abs(vzero.dot(v1)), static_cast<RealScalar>(1));
|
||||
|
||||
// check compatibility of dot and adjoint
|
||||
VERIFY(internal::isApprox(v1.dot(square * v2), (square.adjoint() * v1).dot(v2), largerEps));
|
||||
|
||||
ref = NumTraits<Scalar>::IsInteger ? 0 : std::max(std::max(v1.norm(),v2.norm()),std::max((square * v2).norm(),(square.adjoint() * v1).norm()));
|
||||
VERIFY(test_isApproxWithRef(v1.dot(square * v2), (square.adjoint() * v1).dot(v2), ref));
|
||||
|
||||
// like in testBasicStuff, test operator() to check const-qualification
|
||||
Index r = internal::random<Index>(0, rows-1),
|
||||
@@ -119,9 +119,9 @@ void test_adjoint()
|
||||
CALL_SUBTEST_1( adjoint(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( adjoint(Matrix3d()) );
|
||||
CALL_SUBTEST_3( adjoint(Matrix4f()) );
|
||||
CALL_SUBTEST_4( adjoint(MatrixXcf(4, 4)) );
|
||||
CALL_SUBTEST_5( adjoint(MatrixXi(8, 12)) );
|
||||
CALL_SUBTEST_6( adjoint(MatrixXf(21, 21)) );
|
||||
CALL_SUBTEST_4( adjoint(MatrixXcf(internal::random<int>(1,50), internal::random<int>(1,50))) );
|
||||
CALL_SUBTEST_5( adjoint(MatrixXi(internal::random<int>(1,50), internal::random<int>(1,50))) );
|
||||
CALL_SUBTEST_6( adjoint(MatrixXf(internal::random<int>(1,50), internal::random<int>(1,50))) );
|
||||
}
|
||||
// test a large matrix only once
|
||||
CALL_SUBTEST_7( adjoint(Matrix<float, 100, 100>()) );
|
||||
|
||||
@@ -169,10 +169,15 @@ template<typename ArrayType> void array_real(const ArrayType& m)
|
||||
m2 = ArrayType::Random(rows, cols),
|
||||
m3(rows, cols);
|
||||
|
||||
// these these are mostly to check possible compilation issues.
|
||||
VERIFY_IS_APPROX(m1.sin(), std::sin(m1));
|
||||
VERIFY_IS_APPROX(m1.sin(), internal::sin(m1));
|
||||
VERIFY_IS_APPROX(m1.cos(), std::cos(m1));
|
||||
VERIFY_IS_APPROX(m1.cos(), internal::cos(m1));
|
||||
VERIFY_IS_APPROX(m1.asin(), std::asin(m1));
|
||||
VERIFY_IS_APPROX(m1.asin(), internal::asin(m1));
|
||||
VERIFY_IS_APPROX(m1.acos(), std::acos(m1));
|
||||
VERIFY_IS_APPROX(m1.acos(), internal::acos(m1));
|
||||
VERIFY_IS_APPROX(m1.tan(), std::tan(m1));
|
||||
VERIFY_IS_APPROX(m1.tan(), internal::tan(m1));
|
||||
|
||||
|
||||
@@ -57,10 +57,10 @@ template<typename MatrixType> void array_for_matrix(const MatrixType& m)
|
||||
VERIFY_IS_APPROX(m3, (m1.array() - s1).matrix());
|
||||
|
||||
// reductions
|
||||
VERIFY_IS_APPROX(m1.colwise().sum().sum(), m1.sum());
|
||||
VERIFY_IS_APPROX(m1.rowwise().sum().sum(), m1.sum());
|
||||
if (!internal::isApprox(m1.sum(), (m1+m2).sum()))
|
||||
VERIFY_IS_NOT_APPROX(((m1+m2).rowwise().sum()).sum(), m1.sum());
|
||||
VERIFY_IS_MUCH_SMALLER_THAN(m1.colwise().sum().sum() - m1.sum(), m1.cwiseAbs().maxCoeff());
|
||||
VERIFY_IS_MUCH_SMALLER_THAN(m1.rowwise().sum().sum() - m1.sum(), m1.cwiseAbs().maxCoeff());
|
||||
VERIFY_IS_MUCH_SMALLER_THAN(m1.colwise().sum() + m2.colwise().sum() - (m1+m2).colwise().sum(), (m1+m2).cwiseAbs().maxCoeff());
|
||||
VERIFY_IS_MUCH_SMALLER_THAN(m1.rowwise().sum() - m2.rowwise().sum() - (m1-m2).rowwise().sum(), (m1-m2).cwiseAbs().maxCoeff());
|
||||
VERIFY_IS_APPROX(m1.colwise().sum(), m1.colwise().redux(internal::scalar_sum_op<Scalar>()));
|
||||
|
||||
// vector-wise ops
|
||||
@@ -158,27 +158,28 @@ template<typename VectorType> void lpNorm(const VectorType& v)
|
||||
|
||||
void test_array_for_matrix()
|
||||
{
|
||||
int maxsize = 40;
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST_1( array_for_matrix(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( array_for_matrix(Matrix2f()) );
|
||||
CALL_SUBTEST_3( array_for_matrix(Matrix4d()) );
|
||||
CALL_SUBTEST_4( array_for_matrix(MatrixXcf(3, 3)) );
|
||||
CALL_SUBTEST_5( array_for_matrix(MatrixXf(8, 12)) );
|
||||
CALL_SUBTEST_6( array_for_matrix(MatrixXi(8, 12)) );
|
||||
CALL_SUBTEST_4( array_for_matrix(MatrixXcf(internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );
|
||||
CALL_SUBTEST_5( array_for_matrix(MatrixXf(internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );
|
||||
CALL_SUBTEST_6( array_for_matrix(MatrixXi(internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );
|
||||
}
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST_1( comparisons(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( comparisons(Matrix2f()) );
|
||||
CALL_SUBTEST_3( comparisons(Matrix4d()) );
|
||||
CALL_SUBTEST_5( comparisons(MatrixXf(8, 12)) );
|
||||
CALL_SUBTEST_6( comparisons(MatrixXi(8, 12)) );
|
||||
CALL_SUBTEST_5( comparisons(MatrixXf(internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );
|
||||
CALL_SUBTEST_6( comparisons(MatrixXi(internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );
|
||||
}
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST_1( lpNorm(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( lpNorm(Vector2f()) );
|
||||
CALL_SUBTEST_7( lpNorm(Vector3d()) );
|
||||
CALL_SUBTEST_8( lpNorm(Vector4f()) );
|
||||
CALL_SUBTEST_5( lpNorm(VectorXf(16)) );
|
||||
CALL_SUBTEST_4( lpNorm(VectorXcf(10)) );
|
||||
CALL_SUBTEST_5( lpNorm(VectorXf(internal::random<int>(1,maxsize))) );
|
||||
CALL_SUBTEST_4( lpNorm(VectorXcf(internal::random<int>(1,maxsize))) );
|
||||
}
|
||||
}
|
||||
|
||||
78
test/dontalign.cpp
Normal file
78
test/dontalign.cpp
Normal file
@@ -0,0 +1,78 @@
|
||||
// This file is part of Eigen, a lightweight C++ template library
|
||||
// for linear algebra.
|
||||
//
|
||||
// Copyright (C) 2011 Benoit Jacob <jacob.benoit.1@gmail.com>
|
||||
//
|
||||
// Eigen is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Alternatively, you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License and a copy of the GNU General Public License along with
|
||||
// Eigen. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#if defined EIGEN_TEST_PART_1 || defined EIGEN_TEST_PART_2 || defined EIGEN_TEST_PART_3 || defined EIGEN_TEST_PART_4
|
||||
#define EIGEN_DONT_ALIGN
|
||||
#elif defined EIGEN_TEST_PART_5 || defined EIGEN_TEST_PART_6 || defined EIGEN_TEST_PART_7 || defined EIGEN_TEST_PART_8
|
||||
#define EIGEN_DONT_ALIGN_STATICALLY
|
||||
#endif
|
||||
|
||||
#include "main.h"
|
||||
#include <Eigen/Dense>
|
||||
|
||||
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;
|
||||
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
MatrixType a = MatrixType::Random(rows,cols);
|
||||
SquareMatrixType square = SquareMatrixType::Random(rows,rows);
|
||||
VectorType v = VectorType::Random(rows);
|
||||
|
||||
VERIFY_IS_APPROX(v, square * square.colPivHouseholderQr().solve(v));
|
||||
square = square.inverse().eval();
|
||||
a = square * a;
|
||||
square = square*square;
|
||||
v = square * v;
|
||||
v = a.adjoint() * v;
|
||||
VERIFY(square.determinant() != Scalar(0));
|
||||
|
||||
// bug 219: MapAligned() was giving an assert with EIGEN_DONT_ALIGN, because Map Flags were miscomputed
|
||||
Scalar* array = internal::aligned_new<Scalar>(rows);
|
||||
v = VectorType::MapAligned(array, rows);
|
||||
internal::aligned_delete(array, rows);
|
||||
}
|
||||
|
||||
void test_dontalign()
|
||||
{
|
||||
#if defined EIGEN_TEST_PART_1 || defined EIGEN_TEST_PART_5
|
||||
dontalign(Matrix3d());
|
||||
dontalign(Matrix4f());
|
||||
#elif defined EIGEN_TEST_PART_2 || defined EIGEN_TEST_PART_6
|
||||
dontalign(Matrix3cd());
|
||||
dontalign(Matrix4cf());
|
||||
#elif defined EIGEN_TEST_PART_3 || defined EIGEN_TEST_PART_7
|
||||
dontalign(Matrix<float, 32, 32>());
|
||||
dontalign(Matrix<std::complex<float>, 32, 32>());
|
||||
#elif defined EIGEN_TEST_PART_4 || defined EIGEN_TEST_PART_8
|
||||
dontalign(MatrixXd(32, 32));
|
||||
dontalign(MatrixXcf(32, 32));
|
||||
#endif
|
||||
}
|
||||
@@ -120,11 +120,12 @@ void test_dynalloc()
|
||||
}
|
||||
|
||||
// check static allocation, who knows ?
|
||||
#if EIGEN_ALIGN_STATICALLY
|
||||
{
|
||||
MyStruct foo0; VERIFY(size_t(foo0.avec.data())%ALIGNMENT==0);
|
||||
MyClassA fooA; VERIFY(size_t(fooA.avec.data())%ALIGNMENT==0);
|
||||
}
|
||||
|
||||
|
||||
// dynamic allocation, single object
|
||||
for (int i=0; i<g_repeat*100; ++i)
|
||||
{
|
||||
@@ -143,5 +144,6 @@ void test_dynalloc()
|
||||
delete[] foo0;
|
||||
delete[] fooA;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ template<typename MatrixType> void adjoint(const MatrixType& m)
|
||||
VERIFY(ei_isApprox((s1 * v1 + s2 * v2).eigen2_dot(v3), s1 * v1.eigen2_dot(v3) + s2 * v2.eigen2_dot(v3), largerEps));
|
||||
VERIFY(ei_isApprox(v3.eigen2_dot(s1 * v1 + s2 * v2), ei_conj(s1)*v3.eigen2_dot(v1)+ei_conj(s2)*v3.eigen2_dot(v2), largerEps));
|
||||
VERIFY_IS_APPROX(ei_conj(v1.eigen2_dot(v2)), v2.eigen2_dot(v1));
|
||||
VERIFY_IS_APPROX(ei_abs(v1.eigen2_dot(v1)), v1.squaredNorm());
|
||||
VERIFY_IS_APPROX(ei_real(v1.eigen2_dot(v1)), v1.squaredNorm());
|
||||
if(NumTraits<Scalar>::HasFloatingPoint)
|
||||
VERIFY_IS_APPROX(v1.squaredNorm(), v1.norm() * v1.norm());
|
||||
VERIFY_IS_MUCH_SMALLER_THAN(ei_abs(vzero.eigen2_dot(v1)), static_cast<RealScalar>(1));
|
||||
|
||||
@@ -89,10 +89,9 @@ template<typename MatrixType> void selfadjointeigensolver(const MatrixType& m)
|
||||
VERIFY((symmA * _evec).isApprox(symmB * (_evec * _eval.asDiagonal()), largerEps));
|
||||
|
||||
// compare with eigen
|
||||
// std::cerr << _eval.transpose() << "\n" << eiSymmGen.eigenvalues().transpose() << "\n\n";
|
||||
// std::cerr << _evec.format(6) << "\n\n" << eiSymmGen.eigenvectors().format(6) << "\n\n\n";
|
||||
MatrixType normalized_eivec = eiSymmGen.eigenvectors()*eiSymmGen.eigenvectors().colwise().norm().asDiagonal().inverse();
|
||||
VERIFY_IS_APPROX(_eval, eiSymmGen.eigenvalues());
|
||||
VERIFY_IS_APPROX(_evec.cwise().abs(), eiSymmGen.eigenvectors().cwise().abs());
|
||||
VERIFY_IS_APPROX(_evec.cwiseAbs(), normalized_eivec.cwiseAbs());
|
||||
|
||||
Gsl::free(gSymmA);
|
||||
Gsl::free(gSymmB);
|
||||
|
||||
@@ -32,7 +32,7 @@ void check_stdvector_matrix(const MatrixType& m)
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols);
|
||||
std::vector<MatrixType> v(10, MatrixType(rows,cols)), w(20, y);
|
||||
std::vector<MatrixType, aligned_allocator<MatrixType> > v(10, MatrixType(rows,cols)), w(20, y);
|
||||
v[5] = x;
|
||||
w[6] = v[5];
|
||||
VERIFY_IS_APPROX(w[6], v[5]);
|
||||
@@ -67,7 +67,7 @@ void check_stdvector_transform(const TransformType&)
|
||||
{
|
||||
typedef typename TransformType::MatrixType MatrixType;
|
||||
TransformType x(MatrixType::Random()), y(MatrixType::Random());
|
||||
std::vector<TransformType> v(10), w(20, y);
|
||||
std::vector<TransformType, aligned_allocator<TransformType> > v(10), w(20, y);
|
||||
v[5] = x;
|
||||
w[6] = v[5];
|
||||
VERIFY_IS_APPROX(w[6], v[5]);
|
||||
@@ -102,7 +102,7 @@ void check_stdvector_quaternion(const QuaternionType&)
|
||||
{
|
||||
typedef typename QuaternionType::Coefficients Coefficients;
|
||||
QuaternionType x(Coefficients::Random()), y(Coefficients::Random());
|
||||
std::vector<QuaternionType> v(10), w(20, y);
|
||||
std::vector<QuaternionType, aligned_allocator<QuaternionType> > v(10), w(20, y);
|
||||
v[5] = x;
|
||||
w[6] = v[5];
|
||||
VERIFY_IS_APPROX(w[6], v[5]);
|
||||
|
||||
@@ -111,8 +111,10 @@ namespace Eigen
|
||||
#else // EIGEN_DEBUG_ASSERTS
|
||||
|
||||
#undef eigen_assert
|
||||
|
||||
// see bug 89. The copy_bool here is working around a bug in gcc <= 4.3
|
||||
#define eigen_assert(a) \
|
||||
if( (!(a)) && (!no_more_assert) ) \
|
||||
if( (!Eigen::internal::copy_bool(a)) && (!no_more_assert) ) \
|
||||
{ \
|
||||
Eigen::no_more_assert = true; \
|
||||
throw Eigen::eigen_assert_exception(); \
|
||||
|
||||
@@ -41,10 +41,6 @@ template<typename Scalar,int Size> void homogeneous(void)
|
||||
typedef Matrix<Scalar,Size+1,Size+1> T2MatrixType;
|
||||
typedef Matrix<Scalar,Size+1,Size> T3MatrixType;
|
||||
|
||||
Scalar largeEps = test_precision<Scalar>();
|
||||
if (internal::is_same<Scalar,float>::value)
|
||||
largeEps = 1e-3f;
|
||||
|
||||
VectorType v0 = VectorType::Random(),
|
||||
v1 = VectorType::Random(),
|
||||
ones = VectorType::Ones();
|
||||
@@ -91,15 +87,29 @@ template<typename Scalar,int Size> void homogeneous(void)
|
||||
m0.transpose().rowwise().homogeneous() * t3);
|
||||
|
||||
// test product with a Transform object
|
||||
Transform<Scalar, Size, Affine> Rt;
|
||||
Matrix<Scalar, Size, Dynamic> pts, Rt_pts1;
|
||||
Transform<Scalar, Size, Affine> aff;
|
||||
Transform<Scalar, Size, AffineCompact> caff;
|
||||
Transform<Scalar, Size, Projective> proj;
|
||||
Matrix<Scalar, Size, Dynamic> pts;
|
||||
Matrix<Scalar, Size+1, Dynamic> pts1, pts2;
|
||||
|
||||
Rt.setIdentity();
|
||||
pts.setRandom(Size,5);
|
||||
|
||||
Rt_pts1 = Rt * pts.colwise().homogeneous();
|
||||
// std::cerr << (Rt_pts1 - pts).sum() << "\n";
|
||||
VERIFY_IS_MUCH_SMALLER_THAN( (Rt_pts1 - pts).sum(), Scalar(1));
|
||||
aff.affine().setRandom();
|
||||
proj = caff = aff;
|
||||
pts.setRandom(Size,internal::random<int>(1,20));
|
||||
|
||||
pts1 = pts.colwise().homogeneous();
|
||||
VERIFY_IS_APPROX(aff * pts.colwise().homogeneous(), (aff * pts1).colwise().hnormalized());
|
||||
VERIFY_IS_APPROX(caff * pts.colwise().homogeneous(), (caff * pts1).colwise().hnormalized());
|
||||
VERIFY_IS_APPROX(proj * pts.colwise().homogeneous(), (proj * pts1));
|
||||
|
||||
VERIFY_IS_APPROX((aff * pts1).colwise().hnormalized(), aff * pts);
|
||||
VERIFY_IS_APPROX((caff * pts1).colwise().hnormalized(), caff * pts);
|
||||
|
||||
pts2 = pts1;
|
||||
pts2.row(Size).setRandom();
|
||||
VERIFY_IS_APPROX((aff * pts2).colwise().hnormalized(), aff * pts2.colwise().hnormalized());
|
||||
VERIFY_IS_APPROX((caff * pts2).colwise().hnormalized(), caff * pts2.colwise().hnormalized());
|
||||
VERIFY_IS_APPROX((proj * pts2).colwise().hnormalized(), (proj * pts2.colwise().hnormalized().colwise().homogeneous()).colwise().hnormalized());
|
||||
}
|
||||
|
||||
void test_geo_homogeneous()
|
||||
|
||||
@@ -72,7 +72,7 @@ template<typename Scalar, int Options> void quaternion(void)
|
||||
|
||||
if((q1.coeffs()-q2.coeffs()).norm() > 10*largeEps)
|
||||
{
|
||||
VERIFY(internal::isApprox(q1.angularDistance(q2), refangle, largeEps));
|
||||
VERIFY_IS_MUCH_SMALLER_THAN(internal::abs(q1.angularDistance(q2) - refangle), Scalar(1));
|
||||
}
|
||||
|
||||
// rotation matrix conversion
|
||||
@@ -90,7 +90,15 @@ template<typename Scalar, int Options> void quaternion(void)
|
||||
// angle-axis conversion
|
||||
AngleAxisx aa = AngleAxisx(q1);
|
||||
VERIFY_IS_APPROX(q1 * v1, Quaternionx(aa) * v1);
|
||||
VERIFY_IS_NOT_APPROX(q1 * v1, Quaternionx(AngleAxisx(aa.angle()*2,aa.axis())) * v1);
|
||||
|
||||
// Do not execute the test if the rotation angle is almost zero, or
|
||||
// the rotation axis and v1 are almost parallel.
|
||||
if (internal::abs(aa.angle()) > 5*test_precision<Scalar>()
|
||||
&& (aa.axis() - v1.normalized()).norm() < 1.99
|
||||
&& (aa.axis() + v1.normalized()).norm() < 1.99)
|
||||
{
|
||||
VERIFY_IS_NOT_APPROX(q1 * v1, Quaternionx(AngleAxisx(aa.angle()*2,aa.axis())) * v1);
|
||||
}
|
||||
|
||||
// from two vector creation
|
||||
VERIFY_IS_APPROX( v2.normalized(),(q2.setFromTwoVectors(v1, v2)*v1).normalized());
|
||||
|
||||
@@ -50,10 +50,6 @@ template<typename Scalar, int Mode, int Options> void non_projective_only()
|
||||
typedef Translation<Scalar,2> Translation2;
|
||||
typedef Translation<Scalar,3> Translation3;
|
||||
|
||||
Scalar largeEps = test_precision<Scalar>();
|
||||
if (internal::is_same<Scalar,float>::value)
|
||||
largeEps = 1e-2f;
|
||||
|
||||
Vector3 v0 = Vector3::Random(),
|
||||
v1 = Vector3::Random();
|
||||
|
||||
@@ -125,10 +121,6 @@ template<typename Scalar, int Mode, int Options> void transformations()
|
||||
typedef Translation<Scalar,2> Translation2;
|
||||
typedef Translation<Scalar,3> Translation3;
|
||||
|
||||
Scalar largeEps = test_precision<Scalar>();
|
||||
if (internal::is_same<Scalar,float>::value)
|
||||
largeEps = 1e-2f;
|
||||
|
||||
Vector3 v0 = Vector3::Random(),
|
||||
v1 = Vector3::Random(),
|
||||
v2 = Vector3::Random();
|
||||
@@ -467,5 +459,14 @@ void test_geo_transformations()
|
||||
CALL_SUBTEST_3(( transformations<double,Projective,AutoAlign>() ));
|
||||
CALL_SUBTEST_3(( transformations<double,Projective,DontAlign>() ));
|
||||
CALL_SUBTEST_3(( transform_alignment<double>() ));
|
||||
|
||||
CALL_SUBTEST_4(( transformations<float,Affine,RowMajor|AutoAlign>() ));
|
||||
CALL_SUBTEST_4(( non_projective_only<float,Affine,RowMajor>() ));
|
||||
|
||||
CALL_SUBTEST_5(( transformations<double,AffineCompact,RowMajor|AutoAlign>() ));
|
||||
CALL_SUBTEST_5(( non_projective_only<double,AffineCompact,RowMajor>() ));
|
||||
|
||||
CALL_SUBTEST_6(( transformations<double,Projective,RowMajor|AutoAlign>() ));
|
||||
CALL_SUBTEST_6(( transformations<double,Projective,RowMajor|DontAlign>() ));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
// License and a copy of the GNU General Public License along with
|
||||
// Eigen. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// discard stack allocation as that too bypasses malloc
|
||||
#define EIGEN_STACK_ALLOCATION_LIMIT 0
|
||||
#define EIGEN_RUNTIME_NO_MALLOC
|
||||
#include "main.h"
|
||||
#include <Eigen/SVD>
|
||||
|
||||
@@ -214,6 +217,9 @@ void jacobisvd_method()
|
||||
template<typename Scalar>
|
||||
EIGEN_DONT_INLINE Scalar zero() { return Scalar(0); }
|
||||
|
||||
// workaround aggressive optimization in ICC
|
||||
template<typename T> EIGEN_DONT_INLINE T sub(T a, T b) { return a - b; }
|
||||
|
||||
template<typename MatrixType>
|
||||
void jacobisvd_inf_nan()
|
||||
{
|
||||
@@ -222,7 +228,7 @@ void jacobisvd_inf_nan()
|
||||
JacobiSVD<MatrixType> svd;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
Scalar some_inf = Scalar(1) / zero<Scalar>();
|
||||
VERIFY((some_inf - some_inf) != (some_inf - some_inf));
|
||||
VERIFY(sub(some_inf, some_inf) != sub(some_inf, some_inf));
|
||||
svd.compute(MatrixType::Constant(10,10,some_inf), ComputeFullU | ComputeFullV);
|
||||
|
||||
Scalar some_nan = zero<Scalar>() / zero<Scalar>();
|
||||
@@ -238,6 +244,46 @@ void jacobisvd_inf_nan()
|
||||
svd.compute(m, ComputeFullU | ComputeFullV);
|
||||
}
|
||||
|
||||
void jacobisvd_preallocate()
|
||||
{
|
||||
Vector3f v(3.f, 2.f, 1.f);
|
||||
MatrixXf m = v.asDiagonal();
|
||||
|
||||
internal::set_is_malloc_allowed(false);
|
||||
VERIFY_RAISES_ASSERT(VectorXf v(10);)
|
||||
JacobiSVD<MatrixXf> svd;
|
||||
internal::set_is_malloc_allowed(true);
|
||||
svd.compute(m);
|
||||
VERIFY_IS_APPROX(svd.singularValues(), v);
|
||||
|
||||
JacobiSVD<MatrixXf> svd2(3,3);
|
||||
internal::set_is_malloc_allowed(false);
|
||||
svd2.compute(m);
|
||||
internal::set_is_malloc_allowed(true);
|
||||
VERIFY_IS_APPROX(svd2.singularValues(), v);
|
||||
VERIFY_RAISES_ASSERT(svd2.matrixU());
|
||||
VERIFY_RAISES_ASSERT(svd2.matrixV());
|
||||
svd2.compute(m, ComputeFullU | ComputeFullV);
|
||||
VERIFY_IS_APPROX(svd2.matrixU(), Matrix3f::Identity());
|
||||
VERIFY_IS_APPROX(svd2.matrixV(), Matrix3f::Identity());
|
||||
internal::set_is_malloc_allowed(false);
|
||||
svd2.compute(m);
|
||||
internal::set_is_malloc_allowed(true);
|
||||
|
||||
JacobiSVD<MatrixXf> svd3(3,3,ComputeFullU|ComputeFullV);
|
||||
internal::set_is_malloc_allowed(false);
|
||||
svd2.compute(m);
|
||||
internal::set_is_malloc_allowed(true);
|
||||
VERIFY_IS_APPROX(svd2.singularValues(), v);
|
||||
VERIFY_IS_APPROX(svd2.matrixU(), Matrix3f::Identity());
|
||||
VERIFY_IS_APPROX(svd2.matrixV(), Matrix3f::Identity());
|
||||
internal::set_is_malloc_allowed(false);
|
||||
svd2.compute(m, ComputeFullU|ComputeFullV);
|
||||
internal::set_is_malloc_allowed(true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void test_jacobisvd()
|
||||
{
|
||||
CALL_SUBTEST_3(( jacobisvd_verify_assert(Matrix3f()) ));
|
||||
@@ -287,4 +333,7 @@ void test_jacobisvd()
|
||||
|
||||
// Test problem size constructors
|
||||
CALL_SUBTEST_7( JacobiSVD<MatrixXf>(10,10) );
|
||||
|
||||
// Check that preallocation avoids subsequent mallocs
|
||||
CALL_SUBTEST_9( jacobisvd_preallocate() );
|
||||
}
|
||||
|
||||
30
test/main.h
30
test/main.h
@@ -35,6 +35,11 @@
|
||||
#undef NDEBUG
|
||||
#endif
|
||||
|
||||
// bounds integer values for AltiVec
|
||||
#ifdef __ALTIVEC__
|
||||
#define EIGEN_MAKING_DOCS
|
||||
#endif
|
||||
|
||||
#ifndef EIGEN_TEST_FUNC
|
||||
#error EIGEN_TEST_FUNC must be defined
|
||||
#endif
|
||||
@@ -77,7 +82,6 @@ namespace Eigen
|
||||
~eigen_assert_exception() { Eigen::no_more_assert = false; }
|
||||
};
|
||||
}
|
||||
|
||||
// If EIGEN_DEBUG_ASSERTS is defined and if no assertion is triggered while
|
||||
// one should have been, then the list of excecuted assertions is printed out.
|
||||
//
|
||||
@@ -91,11 +95,10 @@ namespace Eigen
|
||||
{
|
||||
namespace internal
|
||||
{
|
||||
static bool push_assert = false;
|
||||
static bool push_assert = false;
|
||||
}
|
||||
static std::vector<std::string> eigen_assert_list;
|
||||
}
|
||||
|
||||
#define eigen_assert(a) \
|
||||
if( (!(a)) && (!no_more_assert) ) \
|
||||
{ \
|
||||
@@ -129,17 +132,16 @@ namespace Eigen
|
||||
}
|
||||
|
||||
#else // EIGEN_DEBUG_ASSERTS
|
||||
|
||||
// see bug 89. The copy_bool here is working around a bug in gcc <= 4.3
|
||||
#define eigen_assert(a) \
|
||||
if( (!(a)) && (!no_more_assert) ) \
|
||||
if( (!Eigen::internal::copy_bool(a)) && (!no_more_assert) )\
|
||||
{ \
|
||||
Eigen::no_more_assert = true; \
|
||||
if(report_on_cerr_on_assert_failure) \
|
||||
assert(a); \
|
||||
eigen_plain_assert(a); \
|
||||
else \
|
||||
throw Eigen::eigen_assert_exception(); \
|
||||
}
|
||||
|
||||
#define VERIFY_RAISES_ASSERT(a) { \
|
||||
Eigen::no_more_assert = false; \
|
||||
Eigen::report_on_cerr_on_assert_failure = false; \
|
||||
@@ -165,7 +167,6 @@ namespace Eigen
|
||||
#define EIGEN_INTERNAL_DEBUGGING
|
||||
#include <Eigen/QR> // required for createRandomPIMatrixOfRank
|
||||
|
||||
|
||||
static void verify_impl(bool condition, const char *testname, const char *file, int line, const char *condition_as_string)
|
||||
{
|
||||
if (!condition)
|
||||
@@ -350,6 +351,18 @@ inline bool test_isApprox(const Type1& a, const Type2& b)
|
||||
return a.isApprox(b, test_precision<typename Type1::Scalar>());
|
||||
}
|
||||
|
||||
// The idea behind this function is to compare the two scalars a and b where
|
||||
// the scalar ref is a hint about the expected order of magnitude of a and b.
|
||||
// Therefore, if for some reason a and b are very small compared to ref,
|
||||
// we won't issue a false negative.
|
||||
// This test could be: abs(a-b) <= eps * ref
|
||||
// However, it seems that simply comparing a+ref and b+ref is more sensitive to true error.
|
||||
template<typename Scalar,typename ScalarRef>
|
||||
inline bool test_isApproxWithRef(const Scalar& a, const Scalar& b, const ScalarRef& ref)
|
||||
{
|
||||
return test_isApprox(a+ref, b+ref);
|
||||
}
|
||||
|
||||
template<typename Derived1, typename Derived2>
|
||||
inline bool test_isMuchSmallerThan(const MatrixBase<Derived1>& m1,
|
||||
const MatrixBase<Derived2>& m2)
|
||||
@@ -533,4 +546,3 @@ int main(int argc, char *argv[])
|
||||
EIGEN_CAT(test_,EIGEN_TEST_FUNC)();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include "main.h"
|
||||
|
||||
template<typename VectorType> void map_class_vector(const VectorType& m)
|
||||
template<int Alignment,typename VectorType> void map_class_vector(const VectorType& m)
|
||||
{
|
||||
typedef typename VectorType::Index Index;
|
||||
typedef typename VectorType::Scalar Scalar;
|
||||
@@ -35,10 +35,13 @@ template<typename VectorType> void map_class_vector(const VectorType& m)
|
||||
|
||||
Index arraysize = 3*size;
|
||||
|
||||
Scalar* array = internal::aligned_new<Scalar>(arraysize);
|
||||
Scalar* a_array = internal::aligned_new<Scalar>(arraysize+1);
|
||||
Scalar* array = a_array;
|
||||
if(Alignment!=Aligned)
|
||||
array = (Scalar*)(ptrdiff_t(a_array) + (internal::packet_traits<Scalar>::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits<Scalar>::Real)));
|
||||
|
||||
{
|
||||
Map<VectorType, Aligned, InnerStride<3> > map(array, size);
|
||||
Map<VectorType, Alignment, InnerStride<3> > map(array, size);
|
||||
map = v;
|
||||
for(int i = 0; i < size; ++i)
|
||||
{
|
||||
@@ -57,10 +60,10 @@ template<typename VectorType> void map_class_vector(const VectorType& m)
|
||||
}
|
||||
}
|
||||
|
||||
internal::aligned_delete(array, arraysize);
|
||||
internal::aligned_delete(a_array, arraysize+1);
|
||||
}
|
||||
|
||||
template<typename MatrixType> void map_class_matrix(const MatrixType& _m)
|
||||
template<int Alignment,typename MatrixType> void map_class_matrix(const MatrixType& _m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
@@ -71,11 +74,14 @@ template<typename MatrixType> void map_class_matrix(const MatrixType& _m)
|
||||
|
||||
Index arraysize = 2*(rows+4)*(cols+4);
|
||||
|
||||
Scalar* array = internal::aligned_new<Scalar>(arraysize);
|
||||
Scalar* a_array = internal::aligned_new<Scalar>(arraysize+1);
|
||||
Scalar* array = a_array;
|
||||
if(Alignment!=Aligned)
|
||||
array = (Scalar*)(ptrdiff_t(a_array) + (internal::packet_traits<Scalar>::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits<Scalar>::Real)));
|
||||
|
||||
// test no inner stride and some dynamic outer stride
|
||||
{
|
||||
Map<MatrixType, Aligned, OuterStride<Dynamic> > map(array, rows, cols, OuterStride<Dynamic>(m.innerSize()+1));
|
||||
Map<MatrixType, Alignment, OuterStride<Dynamic> > map(array, rows, cols, OuterStride<Dynamic>(m.innerSize()+1));
|
||||
map = m;
|
||||
VERIFY(map.outerStride() == map.innerSize()+1);
|
||||
for(int i = 0; i < m.outerSize(); ++i)
|
||||
@@ -93,7 +99,7 @@ template<typename MatrixType> void map_class_matrix(const MatrixType& _m)
|
||||
InnerSize = MatrixType::InnerSizeAtCompileTime,
|
||||
OuterStrideAtCompileTime = InnerSize==Dynamic ? Dynamic : InnerSize+4
|
||||
};
|
||||
Map<MatrixType, Aligned, OuterStride<OuterStrideAtCompileTime> >
|
||||
Map<MatrixType, Alignment, OuterStride<OuterStrideAtCompileTime> >
|
||||
map(array, rows, cols, OuterStride<OuterStrideAtCompileTime>(m.innerSize()+4));
|
||||
map = m;
|
||||
VERIFY(map.outerStride() == map.innerSize()+4);
|
||||
@@ -107,7 +113,7 @@ template<typename MatrixType> void map_class_matrix(const MatrixType& _m)
|
||||
|
||||
// test both inner stride and outer stride
|
||||
{
|
||||
Map<MatrixType, Aligned, Stride<Dynamic,Dynamic> > map(array, rows, cols, Stride<Dynamic,Dynamic>(2*m.innerSize()+1, 2));
|
||||
Map<MatrixType, Alignment, Stride<Dynamic,Dynamic> > map(array, rows, cols, Stride<Dynamic,Dynamic>(2*m.innerSize()+1, 2));
|
||||
map = m;
|
||||
VERIFY(map.outerStride() == 2*map.innerSize()+1);
|
||||
VERIFY(map.innerStride() == 2);
|
||||
@@ -119,23 +125,37 @@ template<typename MatrixType> void map_class_matrix(const MatrixType& _m)
|
||||
}
|
||||
}
|
||||
|
||||
internal::aligned_delete(array, arraysize);
|
||||
internal::aligned_delete(a_array, arraysize+1);
|
||||
}
|
||||
|
||||
void test_mapstride()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST_1( map_class_vector(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( map_class_vector(Vector4d()) );
|
||||
CALL_SUBTEST_3( map_class_vector(RowVector4f()) );
|
||||
CALL_SUBTEST_4( map_class_vector(VectorXcf(8)) );
|
||||
CALL_SUBTEST_5( map_class_vector(VectorXi(12)) );
|
||||
EIGEN_UNUSED int maxn = 30;
|
||||
CALL_SUBTEST_1( map_class_vector<Aligned>(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_1( map_class_vector<Unaligned>(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( map_class_vector<Aligned>(Vector4d()) );
|
||||
CALL_SUBTEST_2( map_class_vector<Unaligned>(Vector4d()) );
|
||||
CALL_SUBTEST_3( map_class_vector<Aligned>(RowVector4f()) );
|
||||
CALL_SUBTEST_3( map_class_vector<Unaligned>(RowVector4f()) );
|
||||
CALL_SUBTEST_4( map_class_vector<Aligned>(VectorXcf(internal::random<int>(1,maxn))) );
|
||||
CALL_SUBTEST_4( map_class_vector<Unaligned>(VectorXcf(internal::random<int>(1,maxn))) );
|
||||
CALL_SUBTEST_5( map_class_vector<Aligned>(VectorXi(internal::random<int>(1,maxn))) );
|
||||
CALL_SUBTEST_5( map_class_vector<Unaligned>(VectorXi(internal::random<int>(1,maxn))) );
|
||||
|
||||
CALL_SUBTEST_1( map_class_matrix(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( map_class_matrix(Matrix4d()) );
|
||||
CALL_SUBTEST_3( map_class_matrix(Matrix<float,3,5>()) );
|
||||
CALL_SUBTEST_3( map_class_matrix(Matrix<float,4,8>()) );
|
||||
CALL_SUBTEST_4( map_class_matrix(MatrixXcf(internal::random<int>(1,10),internal::random<int>(1,10))) );
|
||||
CALL_SUBTEST_5( map_class_matrix(MatrixXi(5,5)));//internal::random<int>(1,10),internal::random<int>(1,10))) );
|
||||
CALL_SUBTEST_1( map_class_matrix<Aligned>(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_1( map_class_matrix<Unaligned>(Matrix<float, 1, 1>()) );
|
||||
CALL_SUBTEST_2( map_class_matrix<Aligned>(Matrix4d()) );
|
||||
CALL_SUBTEST_2( map_class_matrix<Unaligned>(Matrix4d()) );
|
||||
CALL_SUBTEST_3( map_class_matrix<Aligned>(Matrix<float,3,5>()) );
|
||||
CALL_SUBTEST_3( map_class_matrix<Unaligned>(Matrix<float,3,5>()) );
|
||||
CALL_SUBTEST_3( map_class_matrix<Aligned>(Matrix<float,4,8>()) );
|
||||
CALL_SUBTEST_3( map_class_matrix<Unaligned>(Matrix<float,4,8>()) );
|
||||
CALL_SUBTEST_4( map_class_matrix<Aligned>(MatrixXcf(internal::random<int>(1,maxn),internal::random<int>(1,maxn))) );
|
||||
CALL_SUBTEST_4( map_class_matrix<Unaligned>(MatrixXcf(internal::random<int>(1,maxn),internal::random<int>(1,maxn))) );
|
||||
CALL_SUBTEST_5( map_class_matrix<Aligned>(MatrixXi(internal::random<int>(1,maxn),internal::random<int>(1,maxn))) );
|
||||
CALL_SUBTEST_5( map_class_matrix<Unaligned>(MatrixXi(internal::random<int>(1,maxn),internal::random<int>(1,maxn))) );
|
||||
CALL_SUBTEST_6( map_class_matrix<Aligned>(MatrixXcd(internal::random<int>(1,maxn),internal::random<int>(1,maxn))) );
|
||||
CALL_SUBTEST_6( map_class_matrix<Unaligned>(MatrixXcd(internal::random<int>(1,maxn),internal::random<int>(1,maxn))) );
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user