...but don't add the stuff we don't need
Will Brown
9 years ago
0 | repo: 8a21fd850624c931e448cbcfb38168cb2717c790 | |
1 | node: c76e08cca8ebb060d875f2c189c5f3c4c46929f1 | |
2 | branch: 3.0 | |
3 | tag: 3.0.6 |
0 | syntax: glob | |
1 | qrc_*cxx | |
2 | *.orig | |
3 | *.pyc | |
4 | *.diff | |
5 | diff | |
6 | *.save | |
7 | save | |
8 | *.old | |
9 | *.gmo | |
10 | *.qm | |
11 | core | |
12 | core.* | |
13 | *.bak | |
14 | *~ | |
15 | build* | |
16 | *.moc.* | |
17 | *.moc | |
18 | ui_* | |
19 | CMakeCache.txt | |
20 | tags | |
21 | .*.swp | |
22 | activity.png | |
23 | *.out | |
24 | *.php* | |
25 | *.log | |
26 | *.orig | |
27 | *.rej | |
28 | log | |
29 | patch | |
30 | a | |
31 | a.* |
0 | 2db9468678c6480c9633b6272ff0e3599d1e11a3 2.0-beta3 | |
1 | 375224817dce669b6fa31d920d4c895a63fabf32 2.0-beta1 | |
2 | 3b8120f077865e2a072e10f5be33e1d942b83a06 2.0-rc1 | |
3 | 19dfc0e7666bcee26f7a49eb42f39a0280a3485e 2.0-beta5 | |
4 | 7a7d8a9526f003ffa2430dfb0c2c535b5add3023 2.0-beta4 | |
5 | 7d14ad088ac23769c349518762704f0257f6a39b 2.0.1 | |
6 | b9d48561579fd7d4c05b2aa42235dc9de6484bf2 2.0-beta6 | |
7 | e17630a40408243cb1a51ad0fe3a99beb75b7450 before-hg-migration | |
8 | eda654d4cda2210ce80719addcf854773e6dec5a 2.0.0 | |
9 | ee9a7c468a9e73fab12f38f02bac24b07f29ed71 2.0-beta2 | |
10 | d49097c25d8049e730c254a2fed725a240ce4858 after-hg-migration | |
11 | 655348878731bcb5d9bbe0854077b052e75e5237 actual-start-from-scratch | |
12 | 12a658962d4e6dfdc9a1c350fe7b69e36e70675c 3.0-beta1 | |
13 | 5c4180ad827b3f869b13b1d82f5a6ce617d6fcee 3.0-beta2 | |
14 | 7ae24ca6f3891d5ac58ddc7db60ad413c8d6ec35 3.0-beta3 | |
15 | c40708b9088d622567fecc9208ad4a426621d364 3.0-beta4 | |
16 | b6456624eae74f49ae8683d8e7b2882a2ca0342a 3.0-rc1 | |
17 | 65ee2328342f9d8796f4e395319318b8b69cfdc0 3.0.0 | |
18 | 599fc4f7c736859f0fe97263cfa8686bbc2f4ad4 3.0.1 | |
19 | 786d67eaed28d11ba6841e5664f6fe918964c25a 3.0.2 | |
20 | 063c73f683ed4b91bb99c22463a12988e3db33c4 3.0.3 | |
21 | 13a11181fc5a93ea5df7c59d1a8b4a6d41b8a39c 3.0.4 | |
22 | 6e7488e20373d4435ef0c16dbccd53977d6735a5 3.0.5 |
0 | project(Eigen) | |
1 | ||
2 | cmake_minimum_required(VERSION 2.6.2) | |
3 | ||
4 | # guard against in-source builds | |
5 | ||
6 | if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) | |
7 | message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt. ") | |
8 | endif() | |
9 | ||
10 | # guard against bad build-type strings | |
11 | ||
12 | if (NOT CMAKE_BUILD_TYPE) | |
13 | set(CMAKE_BUILD_TYPE "Release") | |
14 | endif() | |
15 | ||
16 | string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_tolower) | |
17 | if( NOT cmake_build_type_tolower STREQUAL "debug" | |
18 | AND NOT cmake_build_type_tolower STREQUAL "release" | |
19 | AND NOT cmake_build_type_tolower STREQUAL "relwithdebinfo") | |
20 | message(FATAL_ERROR "Unknown build type \"${CMAKE_BUILD_TYPE}\". Allowed values are Debug, Release, RelWithDebInfo (case-insensitive).") | |
21 | endif() | |
22 | ||
23 | ||
24 | ############################################################################# | |
25 | # retrieve version infomation # | |
26 | ############################################################################# | |
27 | ||
28 | # automatically parse the version number | |
29 | file(READ "${PROJECT_SOURCE_DIR}/Eigen/src/Core/util/Macros.h" _eigen_version_header) | |
30 | string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen_world_version_match "${_eigen_version_header}") | |
31 | set(EIGEN_WORLD_VERSION "${CMAKE_MATCH_1}") | |
32 | string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen_major_version_match "${_eigen_version_header}") | |
33 | set(EIGEN_MAJOR_VERSION "${CMAKE_MATCH_1}") | |
34 | string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen_minor_version_match "${_eigen_version_header}") | |
35 | set(EIGEN_MINOR_VERSION "${CMAKE_MATCH_1}") | |
36 | set(EIGEN_VERSION_NUMBER ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION}) | |
37 | ||
38 | # if the mercurial program is absent, this will leave the EIGEN_HG_CHANGESET string empty, | |
39 | # but won't stop CMake. | |
40 | execute_process(COMMAND hg tip -R ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE EIGEN_HGTIP_OUTPUT) | |
41 | execute_process(COMMAND hg branch -R ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE EIGEN_BRANCH_OUTPUT) | |
42 | ||
43 | # if this is the default (aka development) branch, extract the mercurial changeset number from the hg tip output... | |
44 | if(EIGEN_BRANCH_OUTPUT MATCHES "default") | |
45 | string(REGEX MATCH "^changeset: *[0-9]*:([0-9;a-f]+).*" EIGEN_HG_CHANGESET_MATCH "${EIGEN_HGTIP_OUTPUT}") | |
46 | set(EIGEN_HG_CHANGESET "${CMAKE_MATCH_1}") | |
47 | endif(EIGEN_BRANCH_OUTPUT MATCHES "default") | |
48 | #...and show it next to the version number | |
49 | if(EIGEN_HG_CHANGESET) | |
50 | set(EIGEN_VERSION "${EIGEN_VERSION_NUMBER} (mercurial changeset ${EIGEN_HG_CHANGESET})") | |
51 | else(EIGEN_HG_CHANGESET) | |
52 | set(EIGEN_VERSION "${EIGEN_VERSION_NUMBER}") | |
53 | endif(EIGEN_HG_CHANGESET) | |
54 | ||
55 | ||
56 | include(CheckCXXCompilerFlag) | |
57 | ||
58 | set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) | |
59 | ||
60 | ############################################################################# | |
61 | # find how to link to the standard libraries # | |
62 | ############################################################################# | |
63 | ||
64 | find_package(StandardMathLibrary) | |
65 | ||
66 | set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "") | |
67 | ||
68 | if(NOT STANDARD_MATH_LIBRARY_FOUND) | |
69 | ||
70 | message(FATAL_ERROR | |
71 | "Can't link to the standard math library. Please report to the Eigen developers, telling them about your platform.") | |
72 | ||
73 | else() | |
74 | ||
75 | if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) | |
76 | set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO} ${STANDARD_MATH_LIBRARY}") | |
77 | else() | |
78 | set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "${STANDARD_MATH_LIBRARY}") | |
79 | endif() | |
80 | ||
81 | endif() | |
82 | ||
83 | if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) | |
84 | message(STATUS "Standard libraries to link to explicitly: ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}") | |
85 | else() | |
86 | message(STATUS "Standard libraries to link to explicitly: none") | |
87 | endif() | |
88 | ||
89 | option(EIGEN_BUILD_BTL "Build benchmark suite" OFF) | |
90 | if(NOT WIN32) | |
91 | option(EIGEN_BUILD_PKGCONFIG "Build pkg-config .pc file for Eigen" ON) | |
92 | endif(NOT WIN32) | |
93 | ||
94 | set(CMAKE_INCLUDE_CURRENT_DIR ON) | |
95 | ||
96 | option(EIGEN_SPLIT_LARGE_TESTS "Split large tests into smaller executables" ON) | |
97 | ||
98 | option(EIGEN_DEFAULT_TO_ROW_MAJOR "Use row-major as default matrix storage order" OFF) | |
99 | if(EIGEN_DEFAULT_TO_ROW_MAJOR) | |
100 | add_definitions("-DEIGEN_DEFAULT_TO_ROW_MAJOR") | |
101 | endif() | |
102 | ||
103 | add_definitions("-DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS") | |
104 | ||
105 | if(CMAKE_COMPILER_IS_GNUCXX) | |
106 | 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") | |
107 | set(CMAKE_CXX_FLAGS_DEBUG "-g3") | |
108 | set(CMAKE_CXX_FLAGS_RELEASE "-g0 -O2") | |
109 | ||
110 | check_cxx_compiler_flag("-Wno-variadic-macros" COMPILER_SUPPORT_WNOVARIADICMACRO) | |
111 | if(COMPILER_SUPPORT_WNOVARIADICMACRO) | |
112 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-variadic-macros") | |
113 | endif() | |
114 | ||
115 | check_cxx_compiler_flag("-Wextra" COMPILER_SUPPORT_WEXTRA) | |
116 | if(COMPILER_SUPPORT_WEXTRA) | |
117 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") | |
118 | endif() | |
119 | ||
120 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic") | |
121 | ||
122 | option(EIGEN_TEST_SSE2 "Enable/Disable SSE2 in tests/examples" OFF) | |
123 | if(EIGEN_TEST_SSE2) | |
124 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2") | |
125 | message(STATUS "Enabling SSE2 in tests/examples") | |
126 | endif() | |
127 | ||
128 | option(EIGEN_TEST_SSE3 "Enable/Disable SSE3 in tests/examples" OFF) | |
129 | if(EIGEN_TEST_SSE3) | |
130 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse3") | |
131 | message(STATUS "Enabling SSE3 in tests/examples") | |
132 | endif() | |
133 | ||
134 | option(EIGEN_TEST_SSSE3 "Enable/Disable SSSE3 in tests/examples" OFF) | |
135 | if(EIGEN_TEST_SSSE3) | |
136 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3") | |
137 | message(STATUS "Enabling SSSE3 in tests/examples") | |
138 | endif() | |
139 | ||
140 | option(EIGEN_TEST_SSE4_1 "Enable/Disable SSE4.1 in tests/examples" OFF) | |
141 | if(EIGEN_TEST_SSE4_1) | |
142 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1") | |
143 | message(STATUS "Enabling SSE4.1 in tests/examples") | |
144 | endif() | |
145 | ||
146 | option(EIGEN_TEST_SSE4_2 "Enable/Disable SSE4.2 in tests/examples" OFF) | |
147 | if(EIGEN_TEST_SSE4_2) | |
148 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2") | |
149 | message(STATUS "Enabling SSE4.2 in tests/examples") | |
150 | endif() | |
151 | ||
152 | option(EIGEN_TEST_ALTIVEC "Enable/Disable AltiVec in tests/examples" OFF) | |
153 | if(EIGEN_TEST_ALTIVEC) | |
154 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maltivec -mabi=altivec") | |
155 | message(STATUS "Enabling AltiVec in tests/examples") | |
156 | endif() | |
157 | ||
158 | option(EIGEN_TEST_NEON "Enable/Disable Neon in tests/examples" OFF) | |
159 | if(EIGEN_TEST_NEON) | |
160 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfloat-abi=softfp -mfpu=neon -mcpu=cortex-a8") | |
161 | message(STATUS "Enabling NEON in tests/examples") | |
162 | endif() | |
163 | ||
164 | check_cxx_compiler_flag("-fopenmp" COMPILER_SUPPORT_OPENMP) | |
165 | if(COMPILER_SUPPORT_OPENMP) | |
166 | option(EIGEN_TEST_OPENMP "Enable/Disable OpenMP in tests/examples" OFF) | |
167 | if(EIGEN_TEST_OPENMP) | |
168 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp") | |
169 | message(STATUS "Enabling OpenMP in tests/examples") | |
170 | endif() | |
171 | endif() | |
172 | ||
173 | endif(CMAKE_COMPILER_IS_GNUCXX) | |
174 | ||
175 | if(MSVC) | |
176 | # C4127 - conditional expression is constant | |
177 | # C4714 - marked as __forceinline not inlined (I failed to deactivate it selectively) | |
178 | # We can disable this warning in the unit tests since it is clear that it occurs | |
179 | # because we are oftentimes returning objects that have a destructor or may | |
180 | # throw exceptions - in particular in the unit tests we are throwing extra many | |
181 | # exceptions to cover indexing errors. | |
182 | # C4505 - unreferenced local function has been removed (impossible to deactive selectively) | |
183 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /wd4127 /wd4505 /wd4714") | |
184 | ||
185 | # replace all /Wx by /W4 | |
186 | string(REGEX REPLACE "/W[0-9]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | |
187 | ||
188 | check_cxx_compiler_flag("/openmp" COMPILER_SUPPORT_OPENMP) | |
189 | if(COMPILER_SUPPORT_OPENMP) | |
190 | option(EIGEN_TEST_OPENMP "Enable/Disable OpenMP in tests/examples" OFF) | |
191 | if(EIGEN_TEST_OPENMP) | |
192 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp") | |
193 | message(STATUS "Enabling OpenMP in tests/examples") | |
194 | endif() | |
195 | endif() | |
196 | ||
197 | option(EIGEN_TEST_SSE2 "Enable/Disable SSE2 in tests/examples" OFF) | |
198 | if(EIGEN_TEST_SSE2) | |
199 | if(NOT CMAKE_CL_64) | |
200 | # arch is not supported on 64 bit systems, SSE is enabled automatically. | |
201 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2") | |
202 | endif(NOT CMAKE_CL_64) | |
203 | message(STATUS "Enabling SSE2 in tests/examples") | |
204 | endif(EIGEN_TEST_SSE2) | |
205 | endif(MSVC) | |
206 | ||
207 | option(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION "Disable explicit vectorization in tests/examples" OFF) | |
208 | option(EIGEN_TEST_X87 "Force using X87 instructions. Implies no vectorization." OFF) | |
209 | option(EIGEN_TEST_32BIT "Force generating 32bit code." OFF) | |
210 | ||
211 | if(EIGEN_TEST_X87) | |
212 | set(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION ON) | |
213 | if(CMAKE_COMPILER_IS_GNUCXX) | |
214 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=387") | |
215 | message(STATUS "Forcing use of x87 instructions in tests/examples") | |
216 | else() | |
217 | message(STATUS "EIGEN_TEST_X87 ignored on your compiler") | |
218 | endif() | |
219 | endif() | |
220 | ||
221 | if(EIGEN_TEST_32BIT) | |
222 | if(CMAKE_COMPILER_IS_GNUCXX) | |
223 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") | |
224 | message(STATUS "Forcing generation of 32-bit code in tests/examples") | |
225 | else() | |
226 | message(STATUS "EIGEN_TEST_32BIT ignored on your compiler") | |
227 | endif() | |
228 | endif() | |
229 | ||
230 | if(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION) | |
231 | add_definitions(-DEIGEN_DONT_VECTORIZE=1) | |
232 | message(STATUS "Disabling vectorization in tests/examples") | |
233 | endif() | |
234 | ||
235 | option(EIGEN_TEST_NO_EXPLICIT_ALIGNMENT "Disable explicit alignment (hence vectorization) in tests/examples" OFF) | |
236 | if(EIGEN_TEST_NO_EXPLICIT_ALIGNMENT) | |
237 | add_definitions(-DEIGEN_DONT_ALIGN=1) | |
238 | message(STATUS "Disabling alignment in tests/examples") | |
239 | endif() | |
240 | ||
241 | option(EIGEN_TEST_C++0x "Enables all C++0x features." OFF) | |
242 | ||
243 | include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) | |
244 | ||
245 | # the user modifiable install path for header files | |
246 | set(EIGEN_INCLUDE_INSTALL_DIR ${EIGEN_INCLUDE_INSTALL_DIR} CACHE PATH "The directory where we install the header files (optional)") | |
247 | ||
248 | # set the internal install path for header files which depends on wether the user modifiable | |
249 | # EIGEN_INCLUDE_INSTALL_DIR has been set by the user or not. | |
250 | if(EIGEN_INCLUDE_INSTALL_DIR) | |
251 | set(INCLUDE_INSTALL_DIR | |
252 | ${EIGEN_INCLUDE_INSTALL_DIR} | |
253 | CACHE INTERNAL | |
254 | "The directory where we install the header files (internal)" | |
255 | ) | |
256 | else() | |
257 | set(INCLUDE_INSTALL_DIR | |
258 | "${CMAKE_INSTALL_PREFIX}/include/eigen3" | |
259 | CACHE INTERNAL | |
260 | "The directory where we install the header files (internal)" | |
261 | ) | |
262 | endif() | |
263 | ||
264 | # similar to set_target_properties but append the property instead of overwriting it | |
265 | macro(ei_add_target_property target prop value) | |
266 | ||
267 | get_target_property(previous ${target} ${prop}) | |
268 | # if the property wasn't previously set, ${previous} is now "previous-NOTFOUND" which cmake allows catching with plain if() | |
269 | if(NOT previous) | |
270 | set(previous "") | |
271 | endif(NOT previous) | |
272 | set_target_properties(${target} PROPERTIES ${prop} "${previous} ${value}") | |
273 | endmacro(ei_add_target_property) | |
274 | ||
275 | install(FILES | |
276 | signature_of_eigen3_matrix_library | |
277 | DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel | |
278 | ) | |
279 | ||
280 | if(EIGEN_BUILD_PKGCONFIG) | |
281 | SET(path_separator ":") | |
282 | STRING(REPLACE ${path_separator} ";" pkg_config_libdir_search "$ENV{PKG_CONFIG_LIBDIR}") | |
283 | message(STATUS "searching for 'pkgconfig' directory in PKG_CONFIG_LIBDIR ( $ENV{PKG_CONFIG_LIBDIR} ), ${CMAKE_INSTALL_PREFIX}/share, and ${CMAKE_INSTALL_PREFIX}/lib") | |
284 | FIND_PATH(pkg_config_libdir pkgconfig ${pkg_config_libdir_search} ${CMAKE_INSTALL_PREFIX}/share ${CMAKE_INSTALL_PREFIX}/lib ${pkg_config_libdir_search}) | |
285 | if(pkg_config_libdir) | |
286 | SET(pkg_config_install_dir ${pkg_config_libdir}) | |
287 | message(STATUS "found ${pkg_config_libdir}/pkgconfig" ) | |
288 | else(pkg_config_libdir) | |
289 | SET(pkg_config_install_dir ${CMAKE_INSTALL_PREFIX}/share) | |
290 | message(STATUS "pkgconfig not found; installing in ${pkg_config_install_dir}" ) | |
291 | endif(pkg_config_libdir) | |
292 | ||
293 | configure_file(eigen3.pc.in eigen3.pc) | |
294 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eigen3.pc | |
295 | DESTINATION ${pkg_config_install_dir}/pkgconfig | |
296 | ) | |
297 | endif(EIGEN_BUILD_PKGCONFIG) | |
298 | ||
299 | add_subdirectory(Eigen) | |
300 | ||
301 | add_subdirectory(doc EXCLUDE_FROM_ALL) | |
302 | ||
303 | add_custom_target(buildtests) | |
304 | add_custom_target(check COMMAND "ctest") | |
305 | add_dependencies(check buildtests) | |
306 | ||
307 | # CMake/Ctest does not allow us to change the build command, | |
308 | # so we have to workaround by directly editing the generated DartConfiguration.tcl file | |
309 | # save CMAKE_MAKE_PROGRAM | |
310 | set(CMAKE_MAKE_PROGRAM_SAVE ${CMAKE_MAKE_PROGRAM}) | |
311 | # and set a fake one | |
312 | set(CMAKE_MAKE_PROGRAM "@EIGEN_MAKECOMMAND_PLACEHOLDER@") | |
313 | ||
314 | include(CTest) | |
315 | enable_testing() # must be called from the root CMakeLists, see man page | |
316 | include(EigenTesting) | |
317 | ei_init_testing() | |
318 | ||
319 | # overwrite default DartConfiguration.tcl | |
320 | # The worarounds are different for each version of the MSVC IDE | |
321 | if(MSVC_IDE) | |
322 | if(MSVC_VERSION EQUAL 1600) # MSVC 2010 | |
323 | set(EIGEN_MAKECOMMAND_PLACEHOLDER "${CMAKE_MAKE_PROGRAM_SAVE} buildtests.vcxproj /p:Configuration=\${CTEST_CONFIGURATION_TYPE} \n # ") | |
324 | else() # MSVC 2008 (TODO check MSVC 2005) | |
325 | set(EIGEN_MAKECOMMAND_PLACEHOLDER "${CMAKE_MAKE_PROGRAM_SAVE} /project buildtests") | |
326 | endif() | |
327 | else() | |
328 | # for make and nmake | |
329 | set(EIGEN_MAKECOMMAND_PLACEHOLDER "${CMAKE_MAKE_PROGRAM_SAVE} buildtests") | |
330 | endif() | |
331 | ||
332 | configure_file(${CMAKE_BINARY_DIR}/DartConfiguration.tcl ${CMAKE_BINARY_DIR}/DartConfiguration.tcl) | |
333 | # restore default CMAKE_MAKE_PROGRAM | |
334 | set(CMAKE_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM_SAVE}) | |
335 | # un-set temporary variables so that it is like they never existed. | |
336 | # CMake 2.6.3 introduces the more logical unset() syntax for this. | |
337 | set(CMAKE_MAKE_PROGRAM_SAVE) | |
338 | set(EIGEN_MAKECOMMAND_PLACEHOLDER) | |
339 | ||
340 | configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake.in ${CMAKE_BINARY_DIR}/CTestCustom.cmake) | |
341 | ||
342 | ||
343 | if(EIGEN_LEAVE_TEST_IN_ALL_TARGET) | |
344 | add_subdirectory(test) # can't do EXCLUDE_FROM_ALL here, breaks CTest | |
345 | else() | |
346 | add_subdirectory(test EXCLUDE_FROM_ALL) | |
347 | endif() | |
348 | ||
349 | if(NOT MSVC) | |
350 | if(EIGEN_LEAVE_TEST_IN_ALL_TARGET) | |
351 | add_subdirectory(blas) | |
352 | add_subdirectory(lapack) | |
353 | else() | |
354 | add_subdirectory(blas EXCLUDE_FROM_ALL) | |
355 | add_subdirectory(lapack EXCLUDE_FROM_ALL) | |
356 | endif() | |
357 | endif(NOT MSVC) | |
358 | ||
359 | add_subdirectory(unsupported) | |
360 | ||
361 | add_subdirectory(demos EXCLUDE_FROM_ALL) | |
362 | ||
363 | # must be after test and unsupported, for configuring buildtests.in | |
364 | add_subdirectory(scripts EXCLUDE_FROM_ALL) | |
365 | ||
366 | # TODO: consider also replacing EIGEN_BUILD_BTL by a custom target "make btl"? | |
367 | if(EIGEN_BUILD_BTL) | |
368 | add_subdirectory(bench/btl EXCLUDE_FROM_ALL) | |
369 | endif(EIGEN_BUILD_BTL) | |
370 | ||
371 | ei_testing_print_summary() | |
372 | ||
373 | message(STATUS "") | |
374 | message(STATUS "Configured Eigen ${EIGEN_VERSION_NUMBER}") | |
375 | message(STATUS "") | |
376 | ||
377 | option(EIGEN_FAILTEST "Enable failtests." OFF) | |
378 | if(EIGEN_FAILTEST) | |
379 | add_subdirectory(failtest) | |
380 | endif() | |
381 | ||
382 | string(TOLOWER "${CMAKE_GENERATOR}" cmake_generator_tolower) | |
383 | if(cmake_generator_tolower MATCHES "makefile") | |
384 | message(STATUS "Some things you can do now:") | |
385 | message(STATUS "--------------+--------------------------------------------------------------") | |
386 | message(STATUS "Command | Description") | |
387 | message(STATUS "--------------+--------------------------------------------------------------") | |
388 | message(STATUS "make install | Install to ${CMAKE_INSTALL_PREFIX}. To change that:") | |
389 | message(STATUS " | cmake . -DCMAKE_INSTALL_PREFIX=yourpath") | |
390 | message(STATUS " | Eigen headers will then be installed to:") | |
391 | message(STATUS " | ${INCLUDE_INSTALL_DIR}") | |
392 | message(STATUS " | To install Eigen headers to a separate location, do:") | |
393 | message(STATUS " | cmake . -DEIGEN_INCLUDE_INSTALL_DIR=yourpath") | |
394 | message(STATUS "make doc | Generate the API documentation, requires Doxygen & LaTeX") | |
395 | message(STATUS "make check | Build and run the unit-tests. Read this page:") | |
396 | message(STATUS " | http://eigen.tuxfamily.org/index.php?title=Tests") | |
397 | message(STATUS "make blas | Build BLAS library (not the same thing as Eigen)") | |
398 | message(STATUS "--------------+--------------------------------------------------------------") | |
399 | else() | |
400 | message(STATUS "To build/run the unit tests, read this page:") | |
401 | message(STATUS " http://eigen.tuxfamily.org/index.php?title=Tests") | |
402 | endif() | |
403 | ||
404 | message(STATUS "") |
0 | GNU GENERAL PUBLIC LICENSE | |
1 | Version 3, 29 June 2007 | |
2 | ||
3 | Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> | |
4 | Everyone is permitted to copy and distribute verbatim copies | |
5 | of this license document, but changing it is not allowed. | |
6 | ||
7 | Preamble | |
8 | ||
9 | The GNU General Public License is a free, copyleft license for | |
10 | software and other kinds of works. | |
11 | ||
12 | The licenses for most software and other practical works are designed | |
13 | to take away your freedom to share and change the works. By contrast, | |
14 | the GNU General Public License is intended to guarantee your freedom to | |
15 | share and change all versions of a program--to make sure it remains free | |
16 | software for all its users. We, the Free Software Foundation, use the | |
17 | GNU General Public License for most of our software; it applies also to | |
18 | any other work released this way by its authors. You can apply it to | |
19 | your programs, too. | |
20 | ||
21 | When we speak of free software, we are referring to freedom, not | |
22 | price. Our General Public Licenses are designed to make sure that you | |
23 | have the freedom to distribute copies of free software (and charge for | |
24 | them if you wish), that you receive source code or can get it if you | |
25 | want it, that you can change the software or use pieces of it in new | |
26 | free programs, and that you know you can do these things. | |
27 | ||
28 | To protect your rights, we need to prevent others from denying you | |
29 | these rights or asking you to surrender the rights. Therefore, you have | |
30 | certain responsibilities if you distribute copies of the software, or if | |
31 | you modify it: responsibilities to respect the freedom of others. | |
32 | ||
33 | For example, if you distribute copies of such a program, whether | |
34 | gratis or for a fee, you must pass on to the recipients the same | |
35 | freedoms that you received. You must make sure that they, too, receive | |
36 | or can get the source code. And you must show them these terms so they | |
37 | know their rights. | |
38 | ||
39 | Developers that use the GNU GPL protect your rights with two steps: | |
40 | (1) assert copyright on the software, and (2) offer you this License | |
41 | giving you legal permission to copy, distribute and/or modify it. | |
42 | ||
43 | For the developers' and authors' protection, the GPL clearly explains | |
44 | that there is no warranty for this free software. For both users' and | |
45 | authors' sake, the GPL requires that modified versions be marked as | |
46 | changed, so that their problems will not be attributed erroneously to | |
47 | authors of previous versions. | |
48 | ||
49 | Some devices are designed to deny users access to install or run | |
50 | modified versions of the software inside them, although the manufacturer | |
51 | can do so. This is fundamentally incompatible with the aim of | |
52 | protecting users' freedom to change the software. The systematic | |
53 | pattern of such abuse occurs in the area of products for individuals to | |
54 | use, which is precisely where it is most unacceptable. Therefore, we | |
55 | have designed this version of the GPL to prohibit the practice for those | |
56 | products. If such problems arise substantially in other domains, we | |
57 | stand ready to extend this provision to those domains in future versions | |
58 | of the GPL, as needed to protect the freedom of users. | |
59 | ||
60 | Finally, every program is threatened constantly by software patents. | |
61 | States should not allow patents to restrict development and use of | |
62 | software on general-purpose computers, but in those that do, we wish to | |
63 | avoid the special danger that patents applied to a free program could | |
64 | make it effectively proprietary. To prevent this, the GPL assures that | |
65 | patents cannot be used to render the program non-free. | |
66 | ||
67 | The precise terms and conditions for copying, distribution and | |
68 | modification follow. | |
69 | ||
70 | TERMS AND CONDITIONS | |
71 | ||
72 | 0. Definitions. | |
73 | ||
74 | "This License" refers to version 3 of the GNU General Public License. | |
75 | ||
76 | "Copyright" also means copyright-like laws that apply to other kinds of | |
77 | works, such as semiconductor masks. | |
78 | ||
79 | "The Program" refers to any copyrightable work licensed under this | |
80 | License. Each licensee is addressed as "you". "Licensees" and | |
81 | "recipients" may be individuals or organizations. | |
82 | ||
83 | To "modify" a work means to copy from or adapt all or part of the work | |
84 | in a fashion requiring copyright permission, other than the making of an | |
85 | exact copy. The resulting work is called a "modified version" of the | |
86 | earlier work or a work "based on" the earlier work. | |
87 | ||
88 | A "covered work" means either the unmodified Program or a work based | |
89 | on the Program. | |
90 | ||
91 | To "propagate" a work means to do anything with it that, without | |
92 | permission, would make you directly or secondarily liable for | |
93 | infringement under applicable copyright law, except executing it on a | |
94 | computer or modifying a private copy. Propagation includes copying, | |
95 | distribution (with or without modification), making available to the | |
96 | public, and in some countries other activities as well. | |
97 | ||
98 | To "convey" a work means any kind of propagation that enables other | |
99 | parties to make or receive copies. Mere interaction with a user through | |
100 | a computer network, with no transfer of a copy, is not conveying. | |
101 | ||
102 | An interactive user interface displays "Appropriate Legal Notices" | |
103 | to the extent that it includes a convenient and prominently visible | |
104 | feature that (1) displays an appropriate copyright notice, and (2) | |
105 | tells the user that there is no warranty for the work (except to the | |
106 | extent that warranties are provided), that licensees may convey the | |
107 | work under this License, and how to view a copy of this License. If | |
108 | the interface presents a list of user commands or options, such as a | |
109 | menu, a prominent item in the list meets this criterion. | |
110 | ||
111 | 1. Source Code. | |
112 | ||
113 | The "source code" for a work means the preferred form of the work | |
114 | for making modifications to it. "Object code" means any non-source | |
115 | form of a work. | |
116 | ||
117 | A "Standard Interface" means an interface that either is an official | |
118 | standard defined by a recognized standards body, or, in the case of | |
119 | interfaces specified for a particular programming language, one that | |
120 | is widely used among developers working in that language. | |
121 | ||
122 | The "System Libraries" of an executable work include anything, other | |
123 | than the work as a whole, that (a) is included in the normal form of | |
124 | packaging a Major Component, but which is not part of that Major | |
125 | Component, and (b) serves only to enable use of the work with that | |
126 | Major Component, or to implement a Standard Interface for which an | |
127 | implementation is available to the public in source code form. A | |
128 | "Major Component", in this context, means a major essential component | |
129 | (kernel, window system, and so on) of the specific operating system | |
130 | (if any) on which the executable work runs, or a compiler used to | |
131 | produce the work, or an object code interpreter used to run it. | |
132 | ||
133 | The "Corresponding Source" for a work in object code form means all | |
134 | the source code needed to generate, install, and (for an executable | |
135 | work) run the object code and to modify the work, including scripts to | |
136 | control those activities. However, it does not include the work's | |
137 | System Libraries, or general-purpose tools or generally available free | |
138 | programs which are used unmodified in performing those activities but | |
139 | which are not part of the work. For example, Corresponding Source | |
140 | includes interface definition files associated with source files for | |
141 | the work, and the source code for shared libraries and dynamically | |
142 | linked subprograms that the work is specifically designed to require, | |
143 | such as by intimate data communication or control flow between those | |
144 | subprograms and other parts of the work. | |
145 | ||
146 | The Corresponding Source need not include anything that users | |
147 | can regenerate automatically from other parts of the Corresponding | |
148 | Source. | |
149 | ||
150 | The Corresponding Source for a work in source code form is that | |
151 | same work. | |
152 | ||
153 | 2. Basic Permissions. | |
154 | ||
155 | All rights granted under this License are granted for the term of | |
156 | copyright on the Program, and are irrevocable provided the stated | |
157 | conditions are met. This License explicitly affirms your unlimited | |
158 | permission to run the unmodified Program. The output from running a | |
159 | covered work is covered by this License only if the output, given its | |
160 | content, constitutes a covered work. This License acknowledges your | |
161 | rights of fair use or other equivalent, as provided by copyright law. | |
162 | ||
163 | You may make, run and propagate covered works that you do not | |
164 | convey, without conditions so long as your license otherwise remains | |
165 | in force. You may convey covered works to others for the sole purpose | |
166 | of having them make modifications exclusively for you, or provide you | |
167 | with facilities for running those works, provided that you comply with | |
168 | the terms of this License in conveying all material for which you do | |
169 | not control copyright. Those thus making or running the covered works | |
170 | for you must do so exclusively on your behalf, under your direction | |
171 | and control, on terms that prohibit them from making any copies of | |
172 | your copyrighted material outside their relationship with you. | |
173 | ||
174 | Conveying under any other circumstances is permitted solely under | |
175 | the conditions stated below. Sublicensing is not allowed; section 10 | |
176 | makes it unnecessary. | |
177 | ||
178 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. | |
179 | ||
180 | No covered work shall be deemed part of an effective technological | |
181 | measure under any applicable law fulfilling obligations under article | |
182 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or | |
183 | similar laws prohibiting or restricting circumvention of such | |
184 | measures. | |
185 | ||
186 | When you convey a covered work, you waive any legal power to forbid | |
187 | circumvention of technological measures to the extent such circumvention | |
188 | is effected by exercising rights under this License with respect to | |
189 | the covered work, and you disclaim any intention to limit operation or | |
190 | modification of the work as a means of enforcing, against the work's | |
191 | users, your or third parties' legal rights to forbid circumvention of | |
192 | technological measures. | |
193 | ||
194 | 4. Conveying Verbatim Copies. | |
195 | ||
196 | You may convey verbatim copies of the Program's source code as you | |
197 | receive it, in any medium, provided that you conspicuously and | |
198 | appropriately publish on each copy an appropriate copyright notice; | |
199 | keep intact all notices stating that this License and any | |
200 | non-permissive terms added in accord with section 7 apply to the code; | |
201 | keep intact all notices of the absence of any warranty; and give all | |
202 | recipients a copy of this License along with the Program. | |
203 | ||
204 | You may charge any price or no price for each copy that you convey, | |
205 | and you may offer support or warranty protection for a fee. | |
206 | ||
207 | 5. Conveying Modified Source Versions. | |
208 | ||
209 | You may convey a work based on the Program, or the modifications to | |
210 | produce it from the Program, in the form of source code under the | |
211 | terms of section 4, provided that you also meet all of these conditions: | |
212 | ||
213 | a) The work must carry prominent notices stating that you modified | |
214 | it, and giving a relevant date. | |
215 | ||
216 | b) The work must carry prominent notices stating that it is | |
217 | released under this License and any conditions added under section | |
218 | 7. This requirement modifies the requirement in section 4 to | |
219 | "keep intact all notices". | |
220 | ||
221 | c) You must license the entire work, as a whole, under this | |
222 | License to anyone who comes into possession of a copy. This | |
223 | License will therefore apply, along with any applicable section 7 | |
224 | additional terms, to the whole of the work, and all its parts, | |
225 | regardless of how they are packaged. This License gives no | |
226 | permission to license the work in any other way, but it does not | |
227 | invalidate such permission if you have separately received it. | |
228 | ||
229 | d) If the work has interactive user interfaces, each must display | |
230 | Appropriate Legal Notices; however, if the Program has interactive | |
231 | interfaces that do not display Appropriate Legal Notices, your | |
232 | work need not make them do so. | |
233 | ||
234 | A compilation of a covered work with other separate and independent | |
235 | works, which are not by their nature extensions of the covered work, | |
236 | and which are not combined with it such as to form a larger program, | |
237 | in or on a volume of a storage or distribution medium, is called an | |
238 | "aggregate" if the compilation and its resulting copyright are not | |
239 | used to limit the access or legal rights of the compilation's users | |
240 | beyond what the individual works permit. Inclusion of a covered work | |
241 | in an aggregate does not cause this License to apply to the other | |
242 | parts of the aggregate. | |
243 | ||
244 | 6. Conveying Non-Source Forms. | |
245 | ||
246 | You may convey a covered work in object code form under the terms | |
247 | of sections 4 and 5, provided that you also convey the | |
248 | machine-readable Corresponding Source under the terms of this License, | |
249 | in one of these ways: | |
250 | ||
251 | a) Convey the object code in, or embodied in, a physical product | |
252 | (including a physical distribution medium), accompanied by the | |
253 | Corresponding Source fixed on a durable physical medium | |
254 | customarily used for software interchange. | |
255 | ||
256 | b) Convey the object code in, or embodied in, a physical product | |
257 | (including a physical distribution medium), accompanied by a | |
258 | written offer, valid for at least three years and valid for as | |
259 | long as you offer spare parts or customer support for that product | |
260 | model, to give anyone who possesses the object code either (1) a | |
261 | copy of the Corresponding Source for all the software in the | |
262 | product that is covered by this License, on a durable physical | |
263 | medium customarily used for software interchange, for a price no | |
264 | more than your reasonable cost of physically performing this | |
265 | conveying of source, or (2) access to copy the | |
266 | Corresponding Source from a network server at no charge. | |
267 | ||
268 | c) Convey individual copies of the object code with a copy of the | |
269 | written offer to provide the Corresponding Source. This | |
270 | alternative is allowed only occasionally and noncommercially, and | |
271 | only if you received the object code with such an offer, in accord | |
272 | with subsection 6b. | |
273 | ||
274 | d) Convey the object code by offering access from a designated | |
275 | place (gratis or for a charge), and offer equivalent access to the | |
276 | Corresponding Source in the same way through the same place at no | |
277 | further charge. You need not require recipients to copy the | |
278 | Corresponding Source along with the object code. If the place to | |
279 | copy the object code is a network server, the Corresponding Source | |
280 | may be on a different server (operated by you or a third party) | |
281 | that supports equivalent copying facilities, provided you maintain | |
282 | clear directions next to the object code saying where to find the | |
283 | Corresponding Source. Regardless of what server hosts the | |
284 | Corresponding Source, you remain obligated to ensure that it is | |
285 | available for as long as needed to satisfy these requirements. | |
286 | ||
287 | e) Convey the object code using peer-to-peer transmission, provided | |
288 | you inform other peers where the object code and Corresponding | |
289 | Source of the work are being offered to the general public at no | |
290 | charge under subsection 6d. | |
291 | ||
292 | A separable portion of the object code, whose source code is excluded | |
293 | from the Corresponding Source as a System Library, need not be | |
294 | included in conveying the object code work. | |
295 | ||
296 | A "User Product" is either (1) a "consumer product", which means any | |
297 | tangible personal property which is normally used for personal, family, | |
298 | or household purposes, or (2) anything designed or sold for incorporation | |
299 | into a dwelling. In determining whether a product is a consumer product, | |
300 | doubtful cases shall be resolved in favor of coverage. For a particular | |
301 | product received by a particular user, "normally used" refers to a | |
302 | typical or common use of that class of product, regardless of the status | |
303 | of the particular user or of the way in which the particular user | |
304 | actually uses, or expects or is expected to use, the product. A product | |
305 | is a consumer product regardless of whether the product has substantial | |
306 | commercial, industrial or non-consumer uses, unless such uses represent | |
307 | the only significant mode of use of the product. | |
308 | ||
309 | "Installation Information" for a User Product means any methods, | |
310 | procedures, authorization keys, or other information required to install | |
311 | and execute modified versions of a covered work in that User Product from | |
312 | a modified version of its Corresponding Source. The information must | |
313 | suffice to ensure that the continued functioning of the modified object | |
314 | code is in no case prevented or interfered with solely because | |
315 | modification has been made. | |
316 | ||
317 | If you convey an object code work under this section in, or with, or | |
318 | specifically for use in, a User Product, and the conveying occurs as | |
319 | part of a transaction in which the right of possession and use of the | |
320 | User Product is transferred to the recipient in perpetuity or for a | |
321 | fixed term (regardless of how the transaction is characterized), the | |
322 | Corresponding Source conveyed under this section must be accompanied | |
323 | by the Installation Information. But this requirement does not apply | |
324 | if neither you nor any third party retains the ability to install | |
325 | modified object code on the User Product (for example, the work has | |
326 | been installed in ROM). | |
327 | ||
328 | The requirement to provide Installation Information does not include a | |
329 | requirement to continue to provide support service, warranty, or updates | |
330 | for a work that has been modified or installed by the recipient, or for | |
331 | the User Product in which it has been modified or installed. Access to a | |
332 | network may be denied when the modification itself materially and | |
333 | adversely affects the operation of the network or violates the rules and | |
334 | protocols for communication across the network. | |
335 | ||
336 | Corresponding Source conveyed, and Installation Information provided, | |
337 | in accord with this section must be in a format that is publicly | |
338 | documented (and with an implementation available to the public in | |
339 | source code form), and must require no special password or key for | |
340 | unpacking, reading or copying. | |
341 | ||
342 | 7. Additional Terms. | |
343 | ||
344 | "Additional permissions" are terms that supplement the terms of this | |
345 | License by making exceptions from one or more of its conditions. | |
346 | Additional permissions that are applicable to the entire Program shall | |
347 | be treated as though they were included in this License, to the extent | |
348 | that they are valid under applicable law. If additional permissions | |
349 | apply only to part of the Program, that part may be used separately | |
350 | under those permissions, but the entire Program remains governed by | |
351 | this License without regard to the additional permissions. | |
352 | ||
353 | When you convey a copy of a covered work, you may at your option | |
354 | remove any additional permissions from that copy, or from any part of | |
355 | it. (Additional permissions may be written to require their own | |
356 | removal in certain cases when you modify the work.) You may place | |
357 | additional permissions on material, added by you to a covered work, | |
358 | for which you have or can give appropriate copyright permission. | |
359 | ||
360 | Notwithstanding any other provision of this License, for material you | |
361 | add to a covered work, you may (if authorized by the copyright holders of | |
362 | that material) supplement the terms of this License with terms: | |
363 | ||
364 | a) Disclaiming warranty or limiting liability differently from the | |
365 | terms of sections 15 and 16 of this License; or | |
366 | ||
367 | b) Requiring preservation of specified reasonable legal notices or | |
368 | author attributions in that material or in the Appropriate Legal | |
369 | Notices displayed by works containing it; or | |
370 | ||
371 | c) Prohibiting misrepresentation of the origin of that material, or | |
372 | requiring that modified versions of such material be marked in | |
373 | reasonable ways as different from the original version; or | |
374 | ||
375 | d) Limiting the use for publicity purposes of names of licensors or | |
376 | authors of the material; or | |
377 | ||
378 | e) Declining to grant rights under trademark law for use of some | |
379 | trade names, trademarks, or service marks; or | |
380 | ||
381 | f) Requiring indemnification of licensors and authors of that | |
382 | material by anyone who conveys the material (or modified versions of | |
383 | it) with contractual assumptions of liability to the recipient, for | |
384 | any liability that these contractual assumptions directly impose on | |
385 | those licensors and authors. | |
386 | ||
387 | All other non-permissive additional terms are considered "further | |
388 | restrictions" within the meaning of section 10. If the Program as you | |
389 | received it, or any part of it, contains a notice stating that it is | |
390 | governed by this License along with a term that is a further | |
391 | restriction, you may remove that term. If a license document contains | |
392 | a further restriction but permits relicensing or conveying under this | |
393 | License, you may add to a covered work material governed by the terms | |
394 | of that license document, provided that the further restriction does | |
395 | not survive such relicensing or conveying. | |
396 | ||
397 | If you add terms to a covered work in accord with this section, you | |
398 | must place, in the relevant source files, a statement of the | |
399 | additional terms that apply to those files, or a notice indicating | |
400 | where to find the applicable terms. | |
401 | ||
402 | Additional terms, permissive or non-permissive, may be stated in the | |
403 | form of a separately written license, or stated as exceptions; | |
404 | the above requirements apply either way. | |
405 | ||
406 | 8. Termination. | |
407 | ||
408 | You may not propagate or modify a covered work except as expressly | |
409 | provided under this License. Any attempt otherwise to propagate or | |
410 | modify it is void, and will automatically terminate your rights under | |
411 | this License (including any patent licenses granted under the third | |
412 | paragraph of section 11). | |
413 | ||
414 | However, if you cease all violation of this License, then your | |
415 | license from a particular copyright holder is reinstated (a) | |
416 | provisionally, unless and until the copyright holder explicitly and | |
417 | finally terminates your license, and (b) permanently, if the copyright | |
418 | holder fails to notify you of the violation by some reasonable means | |
419 | prior to 60 days after the cessation. | |
420 | ||
421 | Moreover, your license from a particular copyright holder is | |
422 | reinstated permanently if the copyright holder notifies you of the | |
423 | violation by some reasonable means, this is the first time you have | |
424 | received notice of violation of this License (for any work) from that | |
425 | copyright holder, and you cure the violation prior to 30 days after | |
426 | your receipt of the notice. | |
427 | ||
428 | Termination of your rights under this section does not terminate the | |
429 | licenses of parties who have received copies or rights from you under | |
430 | this License. If your rights have been terminated and not permanently | |
431 | reinstated, you do not qualify to receive new licenses for the same | |
432 | material under section 10. | |
433 | ||
434 | 9. Acceptance Not Required for Having Copies. | |
435 | ||
436 | You are not required to accept this License in order to receive or | |
437 | run a copy of the Program. Ancillary propagation of a covered work | |
438 | occurring solely as a consequence of using peer-to-peer transmission | |
439 | to receive a copy likewise does not require acceptance. However, | |
440 | nothing other than this License grants you permission to propagate or | |
441 | modify any covered work. These actions infringe copyright if you do | |
442 | not accept this License. Therefore, by modifying or propagating a | |
443 | covered work, you indicate your acceptance of this License to do so. | |
444 | ||
445 | 10. Automatic Licensing of Downstream Recipients. | |
446 | ||
447 | Each time you convey a covered work, the recipient automatically | |
448 | receives a license from the original licensors, to run, modify and | |
449 | propagate that work, subject to this License. You are not responsible | |
450 | for enforcing compliance by third parties with this License. | |
451 | ||
452 | An "entity transaction" is a transaction transferring control of an | |
453 | organization, or substantially all assets of one, or subdividing an | |
454 | organization, or merging organizations. If propagation of a covered | |
455 | work results from an entity transaction, each party to that | |
456 | transaction who receives a copy of the work also receives whatever | |
457 | licenses to the work the party's predecessor in interest had or could | |
458 | give under the previous paragraph, plus a right to possession of the | |
459 | Corresponding Source of the work from the predecessor in interest, if | |
460 | the predecessor has it or can get it with reasonable efforts. | |
461 | ||
462 | You may not impose any further restrictions on the exercise of the | |
463 | rights granted or affirmed under this License. For example, you may | |
464 | not impose a license fee, royalty, or other charge for exercise of | |
465 | rights granted under this License, and you may not initiate litigation | |
466 | (including a cross-claim or counterclaim in a lawsuit) alleging that | |
467 | any patent claim is infringed by making, using, selling, offering for | |
468 | sale, or importing the Program or any portion of it. | |
469 | ||
470 | 11. Patents. | |
471 | ||
472 | A "contributor" is a copyright holder who authorizes use under this | |
473 | License of the Program or a work on which the Program is based. The | |
474 | work thus licensed is called the contributor's "contributor version". | |
475 | ||
476 | A contributor's "essential patent claims" are all patent claims | |
477 | owned or controlled by the contributor, whether already acquired or | |
478 | hereafter acquired, that would be infringed by some manner, permitted | |
479 | by this License, of making, using, or selling its contributor version, | |
480 | but do not include claims that would be infringed only as a | |
481 | consequence of further modification of the contributor version. For | |
482 | purposes of this definition, "control" includes the right to grant | |
483 | patent sublicenses in a manner consistent with the requirements of | |
484 | this License. | |
485 | ||
486 | Each contributor grants you a non-exclusive, worldwide, royalty-free | |
487 | patent license under the contributor's essential patent claims, to | |
488 | make, use, sell, offer for sale, import and otherwise run, modify and | |
489 | propagate the contents of its contributor version. | |
490 | ||
491 | In the following three paragraphs, a "patent license" is any express | |
492 | agreement or commitment, however denominated, not to enforce a patent | |
493 | (such as an express permission to practice a patent or covenant not to | |
494 | sue for patent infringement). To "grant" such a patent license to a | |
495 | party means to make such an agreement or commitment not to enforce a | |
496 | patent against the party. | |
497 | ||
498 | If you convey a covered work, knowingly relying on a patent license, | |
499 | and the Corresponding Source of the work is not available for anyone | |
500 | to copy, free of charge and under the terms of this License, through a | |
501 | publicly available network server or other readily accessible means, | |
502 | then you must either (1) cause the Corresponding Source to be so | |
503 | available, or (2) arrange to deprive yourself of the benefit of the | |
504 | patent license for this particular work, or (3) arrange, in a manner | |
505 | consistent with the requirements of this License, to extend the patent | |
506 | license to downstream recipients. "Knowingly relying" means you have | |
507 | actual knowledge that, but for the patent license, your conveying the | |
508 | covered work in a country, or your recipient's use of the covered work | |
509 | in a country, would infringe one or more identifiable patents in that | |
510 | country that you have reason to believe are valid. | |
511 | ||
512 | If, pursuant to or in connection with a single transaction or | |
513 | arrangement, you convey, or propagate by procuring conveyance of, a | |
514 | covered work, and grant a patent license to some of the parties | |
515 | receiving the covered work authorizing them to use, propagate, modify | |
516 | or convey a specific copy of the covered work, then the patent license | |
517 | you grant is automatically extended to all recipients of the covered | |
518 | work and works based on it. | |
519 | ||
520 | A patent license is "discriminatory" if it does not include within | |
521 | the scope of its coverage, prohibits the exercise of, or is | |
522 | conditioned on the non-exercise of one or more of the rights that are | |
523 | specifically granted under this License. You may not convey a covered | |
524 | work if you are a party to an arrangement with a third party that is | |
525 | in the business of distributing software, under which you make payment | |
526 | to the third party based on the extent of your activity of conveying | |
527 | the work, and under which the third party grants, to any of the | |
528 | parties who would receive the covered work from you, a discriminatory | |
529 | patent license (a) in connection with copies of the covered work | |
530 | conveyed by you (or copies made from those copies), or (b) primarily | |
531 | for and in connection with specific products or compilations that | |
532 | contain the covered work, unless you entered into that arrangement, | |
533 | or that patent license was granted, prior to 28 March 2007. | |
534 | ||
535 | Nothing in this License shall be construed as excluding or limiting | |
536 | any implied license or other defenses to infringement that may | |
537 | otherwise be available to you under applicable patent law. | |
538 | ||
539 | 12. No Surrender of Others' Freedom. | |
540 | ||
541 | If conditions are imposed on you (whether by court order, agreement or | |
542 | otherwise) that contradict the conditions of this License, they do not | |
543 | excuse you from the conditions of this License. If you cannot convey a | |
544 | covered work so as to satisfy simultaneously your obligations under this | |
545 | License and any other pertinent obligations, then as a consequence you may | |
546 | not convey it at all. For example, if you agree to terms that obligate you | |
547 | to collect a royalty for further conveying from those to whom you convey | |
548 | the Program, the only way you could satisfy both those terms and this | |
549 | License would be to refrain entirely from conveying the Program. | |
550 | ||
551 | 13. Use with the GNU Affero General Public License. | |
552 | ||
553 | Notwithstanding any other provision of this License, you have | |
554 | permission to link or combine any covered work with a work licensed | |
555 | under version 3 of the GNU Affero General Public License into a single | |
556 | combined work, and to convey the resulting work. The terms of this | |
557 | License will continue to apply to the part which is the covered work, | |
558 | but the special requirements of the GNU Affero General Public License, | |
559 | section 13, concerning interaction through a network will apply to the | |
560 | combination as such. | |
561 | ||
562 | 14. Revised Versions of this License. | |
563 | ||
564 | The Free Software Foundation may publish revised and/or new versions of | |
565 | the GNU General Public License from time to time. Such new versions will | |
566 | be similar in spirit to the present version, but may differ in detail to | |
567 | address new problems or concerns. | |
568 | ||
569 | Each version is given a distinguishing version number. If the | |
570 | Program specifies that a certain numbered version of the GNU General | |
571 | Public License "or any later version" applies to it, you have the | |
572 | option of following the terms and conditions either of that numbered | |
573 | version or of any later version published by the Free Software | |
574 | Foundation. If the Program does not specify a version number of the | |
575 | GNU General Public License, you may choose any version ever published | |
576 | by the Free Software Foundation. | |
577 | ||
578 | If the Program specifies that a proxy can decide which future | |
579 | versions of the GNU General Public License can be used, that proxy's | |
580 | public statement of acceptance of a version permanently authorizes you | |
581 | to choose that version for the Program. | |
582 | ||
583 | Later license versions may give you additional or different | |
584 | permissions. However, no additional obligations are imposed on any | |
585 | author or copyright holder as a result of your choosing to follow a | |
586 | later version. | |
587 | ||
588 | 15. Disclaimer of Warranty. | |
589 | ||
590 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY | |
591 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT | |
592 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY | |
593 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, | |
594 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
595 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM | |
596 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF | |
597 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. | |
598 | ||
599 | 16. Limitation of Liability. | |
600 | ||
601 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | |
602 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS | |
603 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY | |
604 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE | |
605 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF | |
606 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD | |
607 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), | |
608 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF | |
609 | SUCH DAMAGES. | |
610 | ||
611 | 17. Interpretation of Sections 15 and 16. | |
612 | ||
613 | If the disclaimer of warranty and limitation of liability provided | |
614 | above cannot be given local legal effect according to their terms, | |
615 | reviewing courts shall apply local law that most closely approximates | |
616 | an absolute waiver of all civil liability in connection with the | |
617 | Program, unless a warranty or assumption of liability accompanies a | |
618 | copy of the Program in return for a fee. | |
619 | ||
620 | END OF TERMS AND CONDITIONS | |
621 | ||
622 | How to Apply These Terms to Your New Programs | |
623 | ||
624 | If you develop a new program, and you want it to be of the greatest | |
625 | possible use to the public, the best way to achieve this is to make it | |
626 | free software which everyone can redistribute and change under these terms. | |
627 | ||
628 | To do so, attach the following notices to the program. It is safest | |
629 | to attach them to the start of each source file to most effectively | |
630 | state the exclusion of warranty; and each file should have at least | |
631 | the "copyright" line and a pointer to where the full notice is found. | |
632 | ||
633 | <one line to give the program's name and a brief idea of what it does.> | |
634 | Copyright (C) <year> <name of author> | |
635 | ||
636 | This program is free software: you can redistribute it and/or modify | |
637 | it under the terms of the GNU General Public License as published by | |
638 | the Free Software Foundation, either version 3 of the License, or | |
639 | (at your option) any later version. | |
640 | ||
641 | This program is distributed in the hope that it will be useful, | |
642 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
643 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
644 | GNU General Public License for more details. | |
645 | ||
646 | You should have received a copy of the GNU General Public License | |
647 | along with this program. If not, see <http://www.gnu.org/licenses/>. | |
648 | ||
649 | Also add information on how to contact you by electronic and paper mail. | |
650 | ||
651 | If the program does terminal interaction, make it output a short | |
652 | notice like this when it starts in an interactive mode: | |
653 | ||
654 | <program> Copyright (C) <year> <name of author> | |
655 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. | |
656 | This is free software, and you are welcome to redistribute it | |
657 | under certain conditions; type `show c' for details. | |
658 | ||
659 | The hypothetical commands `show w' and `show c' should show the appropriate | |
660 | parts of the General Public License. Of course, your program's commands | |
661 | might be different; for a GUI interface, you would use an "about box". | |
662 | ||
663 | You should also get your employer (if you work as a programmer) or school, | |
664 | if any, to sign a "copyright disclaimer" for the program, if necessary. | |
665 | For more information on this, and how to apply and follow the GNU GPL, see | |
666 | <http://www.gnu.org/licenses/>. | |
667 | ||
668 | The GNU General Public License does not permit incorporating your program | |
669 | into proprietary programs. If your program is a subroutine library, you | |
670 | may consider it more useful to permit linking proprietary applications with | |
671 | the library. If this is what you want to do, use the GNU Lesser General | |
672 | Public License instead of this License. But first, please read | |
673 | <http://www.gnu.org/philosophy/why-not-lgpl.html>. |
0 | GNU LESSER GENERAL PUBLIC LICENSE | |
1 | Version 3, 29 June 2007 | |
2 | ||
3 | Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> | |
4 | Everyone is permitted to copy and distribute verbatim copies | |
5 | of this license document, but changing it is not allowed. | |
6 | ||
7 | ||
8 | This version of the GNU Lesser General Public License incorporates | |
9 | the terms and conditions of version 3 of the GNU General Public | |
10 | License, supplemented by the additional permissions listed below. | |
11 | ||
12 | 0. Additional Definitions. | |
13 | ||
14 | As used herein, "this License" refers to version 3 of the GNU Lesser | |
15 | General Public License, and the "GNU GPL" refers to version 3 of the GNU | |
16 | General Public License. | |
17 | ||
18 | "The Library" refers to a covered work governed by this License, | |
19 | other than an Application or a Combined Work as defined below. | |
20 | ||
21 | An "Application" is any work that makes use of an interface provided | |
22 | by the Library, but which is not otherwise based on the Library. | |
23 | Defining a subclass of a class defined by the Library is deemed a mode | |
24 | of using an interface provided by the Library. | |
25 | ||
26 | A "Combined Work" is a work produced by combining or linking an | |
27 | Application with the Library. The particular version of the Library | |
28 | with which the Combined Work was made is also called the "Linked | |
29 | Version". | |
30 | ||
31 | The "Minimal Corresponding Source" for a Combined Work means the | |
32 | Corresponding Source for the Combined Work, excluding any source code | |
33 | for portions of the Combined Work that, considered in isolation, are | |
34 | based on the Application, and not on the Linked Version. | |
35 | ||
36 | The "Corresponding Application Code" for a Combined Work means the | |
37 | object code and/or source code for the Application, including any data | |
38 | and utility programs needed for reproducing the Combined Work from the | |
39 | Application, but excluding the System Libraries of the Combined Work. | |
40 | ||
41 | 1. Exception to Section 3 of the GNU GPL. | |
42 | ||
43 | You may convey a covered work under sections 3 and 4 of this License | |
44 | without being bound by section 3 of the GNU GPL. | |
45 | ||
46 | 2. Conveying Modified Versions. | |
47 | ||
48 | If you modify a copy of the Library, and, in your modifications, a | |
49 | facility refers to a function or data to be supplied by an Application | |
50 | that uses the facility (other than as an argument passed when the | |
51 | facility is invoked), then you may convey a copy of the modified | |
52 | version: | |
53 | ||
54 | a) under this License, provided that you make a good faith effort to | |
55 | ensure that, in the event an Application does not supply the | |
56 | function or data, the facility still operates, and performs | |
57 | whatever part of its purpose remains meaningful, or | |
58 | ||
59 | b) under the GNU GPL, with none of the additional permissions of | |
60 | this License applicable to that copy. | |
61 | ||
62 | 3. Object Code Incorporating Material from Library Header Files. | |
63 | ||
64 | The object code form of an Application may incorporate material from | |
65 | a header file that is part of the Library. You may convey such object | |
66 | code under terms of your choice, provided that, if the incorporated | |
67 | material is not limited to numerical parameters, data structure | |
68 | layouts and accessors, or small macros, inline functions and templates | |
69 | (ten or fewer lines in length), you do both of the following: | |
70 | ||
71 | a) Give prominent notice with each copy of the object code that the | |
72 | Library is used in it and that the Library and its use are | |
73 | covered by this License. | |
74 | ||
75 | b) Accompany the object code with a copy of the GNU GPL and this license | |
76 | document. | |
77 | ||
78 | 4. Combined Works. | |
79 | ||
80 | You may convey a Combined Work under terms of your choice that, | |
81 | taken together, effectively do not restrict modification of the | |
82 | portions of the Library contained in the Combined Work and reverse | |
83 | engineering for debugging such modifications, if you also do each of | |
84 | the following: | |
85 | ||
86 | a) Give prominent notice with each copy of the Combined Work that | |
87 | the Library is used in it and that the Library and its use are | |
88 | covered by this License. | |
89 | ||
90 | b) Accompany the Combined Work with a copy of the GNU GPL and this license | |
91 | document. | |
92 | ||
93 | c) For a Combined Work that displays copyright notices during | |
94 | execution, include the copyright notice for the Library among | |
95 | these notices, as well as a reference directing the user to the | |
96 | copies of the GNU GPL and this license document. | |
97 | ||
98 | d) Do one of the following: | |
99 | ||
100 | 0) Convey the Minimal Corresponding Source under the terms of this | |
101 | License, and the Corresponding Application Code in a form | |
102 | suitable for, and under terms that permit, the user to | |
103 | recombine or relink the Application with a modified version of | |
104 | the Linked Version to produce a modified Combined Work, in the | |
105 | manner specified by section 6 of the GNU GPL for conveying | |
106 | Corresponding Source. | |
107 | ||
108 | 1) Use a suitable shared library mechanism for linking with the | |
109 | Library. A suitable mechanism is one that (a) uses at run time | |
110 | a copy of the Library already present on the user's computer | |
111 | system, and (b) will operate properly with a modified version | |
112 | of the Library that is interface-compatible with the Linked | |
113 | Version. | |
114 | ||
115 | e) Provide Installation Information, but only if you would otherwise | |
116 | be required to provide such information under section 6 of the | |
117 | GNU GPL, and only to the extent that such information is | |
118 | necessary to install and execute a modified version of the | |
119 | Combined Work produced by recombining or relinking the | |
120 | Application with a modified version of the Linked Version. (If | |
121 | you use option 4d0, the Installation Information must accompany | |
122 | the Minimal Corresponding Source and Corresponding Application | |
123 | Code. If you use option 4d1, you must provide the Installation | |
124 | Information in the manner specified by section 6 of the GNU GPL | |
125 | for conveying Corresponding Source.) | |
126 | ||
127 | 5. Combined Libraries. | |
128 | ||
129 | You may place library facilities that are a work based on the | |
130 | Library side by side in a single library together with other library | |
131 | facilities that are not Applications and are not covered by this | |
132 | License, and convey such a combined library under terms of your | |
133 | choice, if you do both of the following: | |
134 | ||
135 | a) Accompany the combined library with a copy of the same work based | |
136 | on the Library, uncombined with any other library facilities, | |
137 | conveyed under the terms of this License. | |
138 | ||
139 | b) Give prominent notice with the combined library that part of it | |
140 | is a work based on the Library, and explaining where to find the | |
141 | accompanying uncombined form of the same work. | |
142 | ||
143 | 6. Revised Versions of the GNU Lesser General Public License. | |
144 | ||
145 | The Free Software Foundation may publish revised and/or new versions | |
146 | of the GNU Lesser General Public License from time to time. Such new | |
147 | versions will be similar in spirit to the present version, but may | |
148 | differ in detail to address new problems or concerns. | |
149 | ||
150 | Each version is given a distinguishing version number. If the | |
151 | Library as you received it specifies that a certain numbered version | |
152 | of the GNU Lesser General Public License "or any later version" | |
153 | applies to it, you have the option of following the terms and | |
154 | conditions either of that published version or of any later version | |
155 | published by the Free Software Foundation. If the Library as you | |
156 | received it does not specify a version number of the GNU Lesser | |
157 | General Public License, you may choose any version of the GNU Lesser | |
158 | General Public License ever published by the Free Software Foundation. | |
159 | ||
160 | If the Library as you received it specifies that a proxy can decide | |
161 | whether future versions of the GNU Lesser General Public License shall | |
162 | apply, that proxy's public statement of acceptance of any version is | |
163 | permanent authorization for you to choose that version for the | |
164 | Library. |
0 | ## This file should be placed in the root directory of your project. | |
1 | ## Then modify the CMakeLists.txt file in the root directory of your | |
2 | ## project to incorporate the testing dashboard. | |
3 | ## # The following are required to uses Dart and the Cdash dashboard | |
4 | ## ENABLE_TESTING() | |
5 | ## INCLUDE(CTest) | |
6 | set(CTEST_PROJECT_NAME "Eigen") | |
7 | set(CTEST_NIGHTLY_START_TIME "00:00:00 UTC") | |
8 | ||
9 | set(CTEST_DROP_METHOD "http") | |
10 | set(CTEST_DROP_SITE "manao.inria.fr") | |
11 | set(CTEST_DROP_LOCATION "/CDash/submit.php?project=Eigen") | |
12 | set(CTEST_DROP_SITE_CDASH TRUE) |
0 | ||
1 | ## A tribute to Dynamic! | |
2 | set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS "33331") | |
3 | set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS "33331") |
0 | #ifndef EIGEN_ARRAY_MODULE_H | |
1 | #define EIGEN_ARRAY_MODULE_H | |
2 | ||
3 | // include Core first to handle Eigen2 support macros | |
4 | #include "Core" | |
5 | ||
6 | #ifndef EIGEN2_SUPPORT | |
7 | #error The Eigen/Array header does no longer exist in Eigen3. All that functionality has moved to Eigen/Core. | |
8 | #endif | |
9 | ||
10 | #endif // EIGEN_ARRAY_MODULE_H |
0 | include(RegexUtils) | |
1 | test_escape_string_as_regex() | |
2 | ||
3 | file(GLOB Eigen_directory_files "*") | |
4 | ||
5 | escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") | |
6 | ||
7 | foreach(f ${Eigen_directory_files}) | |
8 | if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/src") | |
9 | list(APPEND Eigen_directory_files_to_install ${f}) | |
10 | endif() | |
11 | endforeach(f ${Eigen_directory_files}) | |
12 | ||
13 | install(FILES | |
14 | ${Eigen_directory_files_to_install} | |
15 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel | |
16 | ) | |
17 | ||
18 | add_subdirectory(src) |
0 | #ifndef EIGEN_CHOLESKY_MODULE_H | |
1 | #define EIGEN_CHOLESKY_MODULE_H | |
2 | ||
3 | #include "Core" | |
4 | ||
5 | #include "src/Core/util/DisableStupidWarnings.h" | |
6 | ||
7 | namespace Eigen { | |
8 | ||
9 | /** \defgroup Cholesky_Module Cholesky module | |
10 | * | |
11 | * | |
12 | * | |
13 | * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices. | |
14 | * Those decompositions are accessible via the following MatrixBase methods: | |
15 | * - MatrixBase::llt(), | |
16 | * - MatrixBase::ldlt() | |
17 | * | |
18 | * \code | |
19 | * #include <Eigen/Cholesky> | |
20 | * \endcode | |
21 | */ | |
22 | ||
23 | #include "src/misc/Solve.h" | |
24 | #include "src/Cholesky/LLT.h" | |
25 | #include "src/Cholesky/LDLT.h" | |
26 | ||
27 | } // namespace Eigen | |
28 | ||
29 | #include "src/Core/util/ReenableStupidWarnings.h" | |
30 | ||
31 | #endif // EIGEN_CHOLESKY_MODULE_H | |
32 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ |
0 | // This file is part of Eigen, a lightweight C++ template library | |
1 | // for linear algebra. | |
2 | // | |
3 | // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr> | |
4 | // Copyright (C) 2007-2011 Benoit Jacob <jacob.benoit.1@gmail.com> | |
5 | // | |
6 | // Eigen is free software; you can redistribute it and/or | |
7 | // modify it under the terms of the GNU Lesser General Public | |
8 | // License as published by the Free Software Foundation; either | |
9 | // version 3 of the License, or (at your option) any later version. | |
10 | // | |
11 | // Alternatively, you can redistribute it and/or | |
12 | // modify it under the terms of the GNU General Public License as | |
13 | // published by the Free Software Foundation; either version 2 of | |
14 | // the License, or (at your option) any later version. | |
15 | // | |
16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY | |
17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the | |
19 | // GNU General Public License for more details. | |
20 | // | |
21 | // You should have received a copy of the GNU Lesser General Public | |
22 | // License and a copy of the GNU General Public License along with | |
23 | // Eigen. If not, see <http://www.gnu.org/licenses/>. | |
24 | ||
25 | #ifndef EIGEN_CORE_H | |
26 | #define EIGEN_CORE_H | |
27 | ||
28 | // first thing Eigen does: stop the compiler from committing suicide | |
29 | #include "src/Core/util/DisableStupidWarnings.h" | |
30 | ||
31 | // then include this file where all our macros are defined. It's really important to do it first because | |
32 | // it's where we do all the alignment settings (platform detection and honoring the user's will if he | |
33 | // defined e.g. EIGEN_DONT_ALIGN) so it needs to be done before we do anything with vectorization. | |
34 | #include "src/Core/util/Macros.h" | |
35 | ||
36 | // if alignment is disabled, then disable vectorization. Note: EIGEN_ALIGN is the proper check, it takes into | |
37 | // account both the user's will (EIGEN_DONT_ALIGN) and our own platform checks | |
38 | #if !EIGEN_ALIGN | |
39 | #ifndef EIGEN_DONT_VECTORIZE | |
40 | #define EIGEN_DONT_VECTORIZE | |
41 | #endif | |
42 | #endif | |
43 | ||
44 | #ifdef _MSC_VER | |
45 | #include <malloc.h> // for _aligned_malloc -- need it regardless of whether vectorization is enabled | |
46 | #if (_MSC_VER >= 1500) // 2008 or later | |
47 | // Remember that usage of defined() in a #define is undefined by the standard. | |
48 | // a user reported that in 64-bit mode, MSVC doesn't care to define _M_IX86_FP. | |
49 | #if (defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) || defined(_M_X64) | |
50 | #define EIGEN_SSE2_ON_MSVC_2008_OR_LATER | |
51 | #endif | |
52 | #endif | |
53 | #else | |
54 | // Remember that usage of defined() in a #define is undefined by the standard | |
55 | #if (defined __SSE2__) && ( (!defined __GNUC__) || EIGEN_GNUC_AT_LEAST(4,2) ) | |
56 | #define EIGEN_SSE2_ON_NON_MSVC_BUT_NOT_OLD_GCC | |
57 | #endif | |
58 | #endif | |
59 | ||
60 | #ifndef EIGEN_DONT_VECTORIZE | |
61 | ||
62 | #if defined (EIGEN_SSE2_ON_NON_MSVC_BUT_NOT_OLD_GCC) || defined(EIGEN_SSE2_ON_MSVC_2008_OR_LATER) | |
63 | ||
64 | // Defines symbols for compile-time detection of which instructions are | |
65 | // used. | |
66 | // EIGEN_VECTORIZE_YY is defined if and only if the instruction set YY is used | |
67 | #define EIGEN_VECTORIZE | |
68 | #define EIGEN_VECTORIZE_SSE | |
69 | #define EIGEN_VECTORIZE_SSE2 | |
70 | ||
71 | // Detect sse3/ssse3/sse4: | |
72 | // gcc and icc defines __SSE3__, ... | |
73 | // there is no way to know about this on msvc. You can define EIGEN_VECTORIZE_SSE* if you | |
74 | // want to force the use of those instructions with msvc. | |
75 | #ifdef __SSE3__ | |
76 | #define EIGEN_VECTORIZE_SSE3 | |
77 | #endif | |
78 | #ifdef __SSSE3__ | |
79 | #define EIGEN_VECTORIZE_SSSE3 | |
80 | #endif | |
81 | #ifdef __SSE4_1__ | |
82 | #define EIGEN_VECTORIZE_SSE4_1 | |
83 | #endif | |
84 | #ifdef __SSE4_2__ | |
85 | #define EIGEN_VECTORIZE_SSE4_2 | |
86 | #endif | |
87 | ||
88 | // include files | |
89 | ||
90 | // This extern "C" works around a MINGW-w64 compilation issue | |
91 | // https://sourceforge.net/tracker/index.php?func=detail&aid=3018394&group_id=202880&atid=983354 | |
92 | // In essence, intrin.h is included by windows.h and also declares intrinsics (just as emmintrin.h etc. below do). | |
93 | // However, intrin.h uses an extern "C" declaration, and g++ thus complains of duplicate declarations | |
94 | // with conflicting linkage. The linkage for intrinsics doesn't matter, but at that stage the compiler doesn't know; | |
95 | // so, to avoid compile errors when windows.h is included after Eigen/Core, ensure intrinsics are extern "C" here too. | |
96 | // notice that since these are C headers, the extern "C" is theoretically needed anyways. | |
97 | extern "C" { | |
98 | #include <emmintrin.h> | |
99 | #include <xmmintrin.h> | |
100 | #ifdef EIGEN_VECTORIZE_SSE3 | |
101 | #include <pmmintrin.h> | |
102 | #endif | |
103 | #ifdef EIGEN_VECTORIZE_SSSE3 | |
104 | #include <tmmintrin.h> | |
105 | #endif | |
106 | #ifdef EIGEN_VECTORIZE_SSE4_1 | |
107 | #include <smmintrin.h> | |
108 | #endif | |
109 | #ifdef EIGEN_VECTORIZE_SSE4_2 | |
110 | #include <nmmintrin.h> | |
111 | #endif | |
112 | } // end extern "C" | |
113 | #elif defined __ALTIVEC__ | |
114 | #define EIGEN_VECTORIZE | |
115 | #define EIGEN_VECTORIZE_ALTIVEC | |
116 | #include <altivec.h> | |
117 | // We need to #undef all these ugly tokens defined in <altivec.h> | |
118 | // => use __vector instead of vector | |
119 | #undef bool | |
120 | #undef vector | |
121 | #undef pixel | |
122 | #elif defined __ARM_NEON__ | |
123 | #define EIGEN_VECTORIZE | |
124 | #define EIGEN_VECTORIZE_NEON | |
125 | #include <arm_neon.h> | |
126 | #endif | |
127 | #endif | |
128 | ||
129 | #if (defined _OPENMP) && (!defined EIGEN_DONT_PARALLELIZE) | |
130 | #define EIGEN_HAS_OPENMP | |
131 | #endif | |
132 | ||
133 | #ifdef EIGEN_HAS_OPENMP | |
134 | #include <omp.h> | |
135 | #endif | |
136 | ||
137 | // MSVC for windows mobile does not have the errno.h file | |
138 | #if !(defined(_MSC_VER) && defined(_WIN32_WCE)) && !defined(__ARMCC_VERSION) | |
139 | #define EIGEN_HAS_ERRNO | |
140 | #endif | |
141 | ||
142 | #ifdef EIGEN_HAS_ERRNO | |
143 | #include <cerrno> | |
144 | #endif | |
145 | #include <cstddef> | |
146 | #include <cstdlib> | |
147 | #include <cmath> | |
148 | #include <complex> | |
149 | #include <cassert> | |
150 | #include <functional> | |
151 | #include <iosfwd> | |
152 | #include <cstring> | |
153 | #include <string> | |
154 | #include <limits> | |
155 | #include <climits> // for CHAR_BIT | |
156 | // for min/max: | |
157 | #include <algorithm> | |
158 | ||
159 | // for outputting debug info | |
160 | #ifdef EIGEN_DEBUG_ASSIGN | |
161 | #include <iostream> | |
162 | #endif | |
163 | ||
164 | // required for __cpuid, needs to be included after cmath | |
165 | #if defined(_MSC_VER) && (defined(_M_IX86)||defined(_M_X64)) | |
166 | #include <intrin.h> | |
167 | #endif | |
168 | ||
169 | #if defined(_CPPUNWIND) || defined(__EXCEPTIONS) | |
170 | #define EIGEN_EXCEPTIONS | |
171 | #endif | |
172 | ||
173 | #ifdef EIGEN_EXCEPTIONS | |
174 | #include <new> | |
175 | #endif | |
176 | ||
177 | // defined in bits/termios.h | |
178 | #undef B0 | |
179 | ||
180 | /** \brief Namespace containing all symbols from the %Eigen library. */ | |
181 | namespace Eigen { | |
182 | ||
183 | inline static const char *SimdInstructionSetsInUse(void) { | |
184 | #if defined(EIGEN_VECTORIZE_SSE4_2) | |
185 | return "SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2"; | |
186 | #elif defined(EIGEN_VECTORIZE_SSE4_1) | |
187 | return "SSE, SSE2, SSE3, SSSE3, SSE4.1"; | |
188 | #elif defined(EIGEN_VECTORIZE_SSSE3) | |
189 | return "SSE, SSE2, SSE3, SSSE3"; | |
190 | #elif defined(EIGEN_VECTORIZE_SSE3) | |
191 | return "SSE, SSE2, SSE3"; | |
192 | #elif defined(EIGEN_VECTORIZE_SSE2) | |
193 | return "SSE, SSE2"; | |
194 | #elif defined(EIGEN_VECTORIZE_ALTIVEC) | |
195 | return "AltiVec"; | |
196 | #elif defined(EIGEN_VECTORIZE_NEON) | |
197 | return "ARM NEON"; | |
198 | #else | |
199 | return "None"; | |
200 | #endif | |
201 | } | |
202 | ||
203 | #define STAGE10_FULL_EIGEN2_API 10 | |
204 | #define STAGE20_RESOLVE_API_CONFLICTS 20 | |
205 | #define STAGE30_FULL_EIGEN3_API 30 | |
206 | #define STAGE40_FULL_EIGEN3_STRICTNESS 40 | |
207 | #define STAGE99_NO_EIGEN2_SUPPORT 99 | |
208 | ||
209 | #if defined EIGEN2_SUPPORT_STAGE40_FULL_EIGEN3_STRICTNESS | |
210 | #define EIGEN2_SUPPORT | |
211 | #define EIGEN2_SUPPORT_STAGE STAGE40_FULL_EIGEN3_STRICTNESS | |
212 | #elif defined EIGEN2_SUPPORT_STAGE30_FULL_EIGEN3_API | |
213 | #define EIGEN2_SUPPORT | |
214 | #define EIGEN2_SUPPORT_STAGE STAGE30_FULL_EIGEN3_API | |
215 | #elif defined EIGEN2_SUPPORT_STAGE20_RESOLVE_API_CONFLICTS | |
216 | #define EIGEN2_SUPPORT | |
217 | #define EIGEN2_SUPPORT_STAGE STAGE20_RESOLVE_API_CONFLICTS | |
218 | #elif defined EIGEN2_SUPPORT_STAGE10_FULL_EIGEN2_API | |
219 | #define EIGEN2_SUPPORT | |
220 | #define EIGEN2_SUPPORT_STAGE STAGE10_FULL_EIGEN2_API | |
221 | #elif defined EIGEN2_SUPPORT | |
222 | // default to stage 3, that's what it's always meant | |
223 | #define EIGEN2_SUPPORT_STAGE30_FULL_EIGEN3_API | |
224 | #define EIGEN2_SUPPORT_STAGE STAGE30_FULL_EIGEN3_API | |
225 | #else | |
226 | #define EIGEN2_SUPPORT_STAGE STAGE99_NO_EIGEN2_SUPPORT | |
227 | #endif | |
228 | ||
229 | #ifdef EIGEN2_SUPPORT | |
230 | #undef minor | |
231 | #endif | |
232 | ||
233 | // we use size_t frequently and we'll never remember to prepend it with std:: everytime just to | |
234 | // ensure QNX/QCC support | |
235 | using std::size_t; | |
236 | // gcc 4.6.0 wants std:: for ptrdiff_t | |
237 | using std::ptrdiff_t; | |
238 | ||
239 | /** \defgroup Core_Module Core module | |
240 | * This is the main module of Eigen providing dense matrix and vector support | |
241 | * (both fixed and dynamic size) with all the features corresponding to a BLAS library | |
242 | * and much more... | |
243 | * | |
244 | * \code | |
245 | * #include <Eigen/Core> | |
246 | * \endcode | |
247 | */ | |
248 | ||
249 | #include "src/Core/util/Constants.h" | |
250 | #include "src/Core/util/ForwardDeclarations.h" | |
251 | #include "src/Core/util/Meta.h" | |
252 | #include "src/Core/util/XprHelper.h" | |
253 | #include "src/Core/util/StaticAssert.h" | |
254 | #include "src/Core/util/Memory.h" | |
255 | ||
256 | #include "src/Core/NumTraits.h" | |
257 | #include "src/Core/MathFunctions.h" | |
258 | #include "src/Core/GenericPacketMath.h" | |
259 | ||
260 | #if defined EIGEN_VECTORIZE_SSE | |
261 | #include "src/Core/arch/SSE/PacketMath.h" | |
262 | #include "src/Core/arch/SSE/MathFunctions.h" | |
263 | #include "src/Core/arch/SSE/Complex.h" | |
264 | #elif defined EIGEN_VECTORIZE_ALTIVEC | |
265 | #include "src/Core/arch/AltiVec/PacketMath.h" | |
266 | #include "src/Core/arch/AltiVec/Complex.h" | |
267 | #elif defined EIGEN_VECTORIZE_NEON | |
268 | #include "src/Core/arch/NEON/PacketMath.h" | |
269 | #include "src/Core/arch/NEON/Complex.h" | |
270 | #endif | |
271 | ||
272 | #include "src/Core/arch/Default/Settings.h" | |
273 | ||
274 | #include "src/Core/Functors.h" | |
275 | #include "src/Core/DenseCoeffsBase.h" | |
276 | #include "src/Core/DenseBase.h" | |
277 | #include "src/Core/MatrixBase.h" | |
278 | #include "src/Core/EigenBase.h" | |
279 | ||
280 | #ifndef EIGEN_PARSED_BY_DOXYGEN // work around Doxygen bug triggered by Assign.h r814874 | |
281 | // at least confirmed with Doxygen 1.5.5 and 1.5.6 | |
282 | #include "src/Core/Assign.h" | |
283 | #endif | |
284 | ||
285 | #include "src/Core/util/BlasUtil.h" | |
286 | #include "src/Core/DenseStorage.h" | |
287 | #include "src/Core/NestByValue.h" | |
288 | #include "src/Core/ForceAlignedAccess.h" | |
289 | #include "src/Core/ReturnByValue.h" | |
290 | #include "src/Core/NoAlias.h" | |
291 | #include "src/Core/PlainObjectBase.h" | |
292 | #include "src/Core/Matrix.h" | |
293 | #include "src/Core/Array.h" | |
294 | #include "src/Core/CwiseBinaryOp.h" | |
295 | #include "src/Core/CwiseUnaryOp.h" | |
296 | #include "src/Core/CwiseNullaryOp.h" | |
297 | #include "src/Core/CwiseUnaryView.h" | |
298 | #include "src/Core/SelfCwiseBinaryOp.h" | |
299 | #include "src/Core/Dot.h" | |
300 | #include "src/Core/StableNorm.h" | |
301 | #include "src/Core/MapBase.h" | |
302 | #include "src/Core/Stride.h" | |
303 | #include "src/Core/Map.h" | |
304 | #include "src/Core/Block.h" | |
305 | #include "src/Core/VectorBlock.h" | |
306 | #include "src/Core/Transpose.h" | |
307 | #include "src/Core/DiagonalMatrix.h" | |
308 | #include "src/Core/Diagonal.h" | |
309 | #include "src/Core/DiagonalProduct.h" | |
310 | #include "src/Core/PermutationMatrix.h" | |
311 | #include "src/Core/Transpositions.h" | |
312 | #include "src/Core/Redux.h" | |
313 | #include "src/Core/Visitor.h" | |
314 | #include "src/Core/Fuzzy.h" | |
315 | #include "src/Core/IO.h" | |
316 | #include "src/Core/Swap.h" | |
317 | #include "src/Core/CommaInitializer.h" | |
318 | #include "src/Core/Flagged.h" | |
319 | #include "src/Core/ProductBase.h" | |
320 | #include "src/Core/Product.h" | |
321 | #include "src/Core/TriangularMatrix.h" | |
322 | #include "src/Core/SelfAdjointView.h" | |
323 | #include "src/Core/SolveTriangular.h" | |
324 | #include "src/Core/products/Parallelizer.h" | |
325 | #include "src/Core/products/CoeffBasedProduct.h" | |
326 | #include "src/Core/products/GeneralBlockPanelKernel.h" | |
327 | #include "src/Core/products/GeneralMatrixVector.h" | |
328 | #include "src/Core/products/GeneralMatrixMatrix.h" | |
329 | #include "src/Core/products/GeneralMatrixMatrixTriangular.h" | |
330 | #include "src/Core/products/SelfadjointMatrixVector.h" | |
331 | #include "src/Core/products/SelfadjointMatrixMatrix.h" | |
332 | #include "src/Core/products/SelfadjointProduct.h" | |
333 | #include "src/Core/products/SelfadjointRank2Update.h" | |
334 | #include "src/Core/products/TriangularMatrixVector.h" | |
335 | #include "src/Core/products/TriangularMatrixMatrix.h" | |
336 | #include "src/Core/products/TriangularSolverMatrix.h" | |
337 | #include "src/Core/products/TriangularSolverVector.h" | |
338 | #include "src/Core/BandMatrix.h" | |
339 | ||
340 | #include "src/Core/BooleanRedux.h" | |
341 | #include "src/Core/Select.h" | |
342 | #include "src/Core/VectorwiseOp.h" | |
343 | #include "src/Core/Random.h" | |
344 | #include "src/Core/Replicate.h" | |
345 | #include "src/Core/Reverse.h" | |
346 | #include "src/Core/ArrayBase.h" | |
347 | #include "src/Core/ArrayWrapper.h" | |
348 | ||
349 | } // namespace Eigen | |
350 | ||
351 | #include "src/Core/GlobalFunctions.h" | |
352 | ||
353 | #include "src/Core/util/ReenableStupidWarnings.h" | |
354 | ||
355 | #ifdef EIGEN2_SUPPORT | |
356 | #include "Eigen2Support" | |
357 | #endif | |
358 | ||
359 | #endif // EIGEN_CORE_H |
0 | #include "Core" | |
1 | #include "LU" | |
2 | #include "Cholesky" | |
3 | #include "QR" | |
4 | #include "SVD" | |
5 | #include "Geometry" | |
6 | #include "Eigenvalues" |
0 | // This file is part of Eigen, a lightweight C++ template library | |
1 | // for linear algebra. | |
2 | // | |
3 | // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr> | |
4 | // | |
5 | // Eigen is free software; you can redistribute it and/or | |
6 | // modify it under the terms of the GNU Lesser General Public | |
7 | // License as published by the Free Software Foundation; either | |
8 | // version 3 of the License, or (at your option) any later version. | |
9 | // | |
10 | // Alternatively, you can redistribute it and/or | |
11 | // modify it under the terms of the GNU General Public License as | |
12 | // published by the Free Software Foundation; either version 2 of | |
13 | // the License, or (at your option) any later version. | |
14 | // | |
15 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY | |
16 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
17 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the | |
18 | // GNU General Public License for more details. | |
19 | // | |
20 | // You should have received a copy of the GNU Lesser General Public | |
21 | // License and a copy of the GNU General Public License along with | |
22 | // Eigen. If not, see <http://www.gnu.org/licenses/>. | |
23 | ||
24 | #ifndef EIGEN2SUPPORT_H | |
25 | #define EIGEN2SUPPORT_H | |
26 | ||
27 | #if (!defined(EIGEN2_SUPPORT)) || (!defined(EIGEN_CORE_H)) | |
28 | #error Eigen2 support must be enabled by defining EIGEN2_SUPPORT before including any Eigen header | |
29 | #endif | |
30 | ||
31 | #include "src/Core/util/DisableStupidWarnings.h" | |
32 | ||
33 | namespace Eigen { | |
34 | ||
35 | /** \defgroup Eigen2Support_Module Eigen2 support module | |
36 | * This module provides a couple of deprecated functions improving the compatibility with Eigen2. | |
37 | * | |
38 | * To use it, define EIGEN2_SUPPORT before including any Eigen header | |
39 | * \code | |
40 | * #define EIGEN2_SUPPORT | |
41 | * \endcode | |
42 | * | |
43 | */ | |
44 | ||
45 | #include "src/Eigen2Support/Macros.h" | |
46 | #include "src/Eigen2Support/Memory.h" | |
47 | #include "src/Eigen2Support/Meta.h" | |
48 | #include "src/Eigen2Support/Lazy.h" | |
49 | #include "src/Eigen2Support/Cwise.h" | |
50 | #include "src/Eigen2Support/CwiseOperators.h" | |
51 | #include "src/Eigen2Support/TriangularSolver.h" | |
52 | #include "src/Eigen2Support/Block.h" | |
53 | #include "src/Eigen2Support/VectorBlock.h" | |
54 | #include "src/Eigen2Support/Minor.h" | |
55 | #include "src/Eigen2Support/MathFunctions.h" | |
56 | ||
57 | ||
58 | } // namespace Eigen | |
59 | ||
60 | #include "src/Core/util/ReenableStupidWarnings.h" | |
61 | ||
62 | // Eigen2 used to include iostream | |
63 | #include<iostream> | |
64 | ||
65 | #define USING_PART_OF_NAMESPACE_EIGEN \ | |
66 | EIGEN_USING_MATRIX_TYPEDEFS \ | |
67 | using Eigen::Matrix; \ | |
68 | using Eigen::MatrixBase; \ | |
69 | using Eigen::ei_random; \ | |
70 | using Eigen::ei_real; \ | |
71 | using Eigen::ei_imag; \ | |
72 | using Eigen::ei_conj; \ | |
73 | using Eigen::ei_abs; \ | |
74 | using Eigen::ei_abs2; \ | |
75 | using Eigen::ei_sqrt; \ | |
76 | using Eigen::ei_exp; \ | |
77 | using Eigen::ei_log; \ | |
78 | using Eigen::ei_sin; \ | |
79 | using Eigen::ei_cos; | |
80 | ||
81 | #endif // EIGEN2SUPPORT_H |
0 | #ifndef EIGEN_EIGENVALUES_MODULE_H | |
1 | #define EIGEN_EIGENVALUES_MODULE_H | |
2 | ||
3 | #include "Core" | |
4 | ||
5 | #include "src/Core/util/DisableStupidWarnings.h" | |
6 | ||
7 | #include "Cholesky" | |
8 | #include "Jacobi" | |
9 | #include "Householder" | |
10 | #include "LU" | |
11 | ||
12 | namespace Eigen { | |
13 | ||
14 | /** \defgroup Eigenvalues_Module Eigenvalues module | |
15 | * | |
16 | * | |
17 | * | |
18 | * This module mainly provides various eigenvalue solvers. | |
19 | * This module also provides some MatrixBase methods, including: | |
20 | * - MatrixBase::eigenvalues(), | |
21 | * - MatrixBase::operatorNorm() | |
22 | * | |
23 | * \code | |
24 | * #include <Eigen/Eigenvalues> | |
25 | * \endcode | |
26 | */ | |
27 | ||
28 | #include "src/Eigenvalues/Tridiagonalization.h" | |
29 | #include "src/Eigenvalues/RealSchur.h" | |
30 | #include "src/Eigenvalues/EigenSolver.h" | |
31 | #include "src/Eigenvalues/SelfAdjointEigenSolver.h" | |
32 | #include "src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h" | |
33 | #include "src/Eigenvalues/HessenbergDecomposition.h" | |
34 | #include "src/Eigenvalues/ComplexSchur.h" | |
35 | #include "src/Eigenvalues/ComplexEigenSolver.h" | |
36 | #include "src/Eigenvalues/MatrixBaseEigenvalues.h" | |
37 | ||
38 | } // namespace Eigen | |
39 | ||
40 | #include "src/Core/util/ReenableStupidWarnings.h" | |
41 | ||
42 | #endif // EIGEN_EIGENVALUES_MODULE_H | |
43 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ |
0 | #ifndef EIGEN_GEOMETRY_MODULE_H | |
1 | #define EIGEN_GEOMETRY_MODULE_H | |
2 | ||
3 | #include "Core" | |
4 | ||
5 | #include "src/Core/util/DisableStupidWarnings.h" | |
6 | ||
7 | #include "SVD" | |
8 | #include "LU" | |
9 | #include <limits> | |
10 | ||
11 | #ifndef M_PI | |
12 | #define M_PI 3.14159265358979323846 | |
13 | #endif | |
14 | ||
15 | namespace Eigen { | |
16 | ||
17 | /** \defgroup Geometry_Module Geometry module | |
18 | * | |
19 | * | |
20 | * | |
21 | * This module provides support for: | |
22 | * - fixed-size homogeneous transformations | |
23 | * - translation, scaling, 2D and 3D rotations | |
24 | * - quaternions | |
25 | * - \ref MatrixBase::cross() "cross product" | |
26 | * - \ref MatrixBase::unitOrthogonal() "orthognal vector generation" | |
27 | * - some linear components: parametrized-lines and hyperplanes | |
28 | * | |
29 | * \code | |
30 | * #include <Eigen/Geometry> | |
31 | * \endcode | |
32 | */ | |
33 | ||
34 | #include "src/Geometry/OrthoMethods.h" | |
35 | #include "src/Geometry/EulerAngles.h" | |
36 | ||
37 | #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS | |
38 | #include "src/Geometry/Homogeneous.h" | |
39 | #include "src/Geometry/RotationBase.h" | |
40 | #include "src/Geometry/Rotation2D.h" | |
41 | #include "src/Geometry/Quaternion.h" | |
42 | #include "src/Geometry/AngleAxis.h" | |
43 | #include "src/Geometry/Transform.h" | |
44 | #include "src/Geometry/Translation.h" | |
45 | #include "src/Geometry/Scaling.h" | |
46 | #include "src/Geometry/Hyperplane.h" | |
47 | #include "src/Geometry/ParametrizedLine.h" | |
48 | #include "src/Geometry/AlignedBox.h" | |
49 | #include "src/Geometry/Umeyama.h" | |
50 | ||
51 | #if defined EIGEN_VECTORIZE_SSE | |
52 | #include "src/Geometry/arch/Geometry_SSE.h" | |
53 | #endif | |
54 | #endif | |
55 | ||
56 | #ifdef EIGEN2_SUPPORT | |
57 | #include "src/Eigen2Support/Geometry/All.h" | |
58 | #endif | |
59 | ||
60 | } // namespace Eigen | |
61 | ||
62 | #include "src/Core/util/ReenableStupidWarnings.h" | |
63 | ||
64 | #endif // EIGEN_GEOMETRY_MODULE_H | |
65 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ | |
66 |
0 | #ifndef EIGEN_HOUSEHOLDER_MODULE_H | |
1 | #define EIGEN_HOUSEHOLDER_MODULE_H | |
2 | ||
3 | #include "Core" | |
4 | ||
5 | #include "src/Core/util/DisableStupidWarnings.h" | |
6 | ||
7 | namespace Eigen { | |
8 | ||
9 | /** \defgroup Householder_Module Householder module | |
10 | * This module provides Householder transformations. | |
11 | * | |
12 | * \code | |
13 | * #include <Eigen/Householder> | |
14 | * \endcode | |
15 | */ | |
16 | ||
17 | #include "src/Householder/Householder.h" | |
18 | #include "src/Householder/HouseholderSequence.h" | |
19 | #include "src/Householder/BlockHouseholder.h" | |
20 | ||
21 | } // namespace Eigen | |
22 | ||
23 | #include "src/Core/util/ReenableStupidWarnings.h" | |
24 | ||
25 | #endif // EIGEN_HOUSEHOLDER_MODULE_H | |
26 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ |
0 | #ifndef EIGEN_JACOBI_MODULE_H | |
1 | #define EIGEN_JACOBI_MODULE_H | |
2 | ||
3 | #include "Core" | |
4 | ||
5 | #include "src/Core/util/DisableStupidWarnings.h" | |
6 | ||
7 | namespace Eigen { | |
8 | ||
9 | /** \defgroup Jacobi_Module Jacobi module | |
10 | * This module provides Jacobi and Givens rotations. | |
11 | * | |
12 | * \code | |
13 | * #include <Eigen/Jacobi> | |
14 | * \endcode | |
15 | * | |
16 | * In addition to listed classes, it defines the two following MatrixBase methods to apply a Jacobi or Givens rotation: | |
17 | * - MatrixBase::applyOnTheLeft() | |
18 | * - MatrixBase::applyOnTheRight(). | |
19 | */ | |
20 | ||
21 | #include "src/Jacobi/Jacobi.h" | |
22 | ||
23 | } // namespace Eigen | |
24 | ||
25 | #include "src/Core/util/ReenableStupidWarnings.h" | |
26 | ||
27 | #endif // EIGEN_JACOBI_MODULE_H | |
28 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ | |
29 |
0 | #ifndef EIGEN_LU_MODULE_H | |
1 | #define EIGEN_LU_MODULE_H | |
2 | ||
3 | #include "Core" | |
4 | ||
5 | #include "src/Core/util/DisableStupidWarnings.h" | |
6 | ||
7 | namespace Eigen { | |
8 | ||
9 | /** \defgroup LU_Module LU module | |
10 | * This module includes %LU decomposition and related notions such as matrix inversion and determinant. | |
11 | * This module defines the following MatrixBase methods: | |
12 | * - MatrixBase::inverse() | |
13 | * - MatrixBase::determinant() | |
14 | * | |
15 | * \code | |
16 | * #include <Eigen/LU> | |
17 | * \endcode | |
18 | */ | |
19 | ||
20 | #include "src/misc/Solve.h" | |
21 | #include "src/misc/Kernel.h" | |
22 | #include "src/misc/Image.h" | |
23 | #include "src/LU/FullPivLU.h" | |
24 | #include "src/LU/PartialPivLU.h" | |
25 | #include "src/LU/Determinant.h" | |
26 | #include "src/LU/Inverse.h" | |
27 | ||
28 | #if defined EIGEN_VECTORIZE_SSE | |
29 | #include "src/LU/arch/Inverse_SSE.h" | |
30 | #endif | |
31 | ||
32 | #ifdef EIGEN2_SUPPORT | |
33 | #include "src/Eigen2Support/LU.h" | |
34 | #endif | |
35 | ||
36 | } // namespace Eigen | |
37 | ||
38 | #include "src/Core/util/ReenableStupidWarnings.h" | |
39 | ||
40 | #endif // EIGEN_LU_MODULE_H | |
41 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ |
0 | #ifndef EIGEN_REGRESSION_MODULE_H | |
1 | #define EIGEN_REGRESSION_MODULE_H | |
2 | ||
3 | #ifndef EIGEN2_SUPPORT | |
4 | #error LeastSquares is only available in Eigen2 support mode (define EIGEN2_SUPPORT) | |
5 | #endif | |
6 | ||
7 | // exclude from normal eigen3-only documentation | |
8 | #ifdef EIGEN2_SUPPORT | |
9 | ||
10 | #include "Core" | |
11 | ||
12 | #include "src/Core/util/DisableStupidWarnings.h" | |
13 | ||
14 | #include "Eigenvalues" | |
15 | #include "Geometry" | |
16 | ||
17 | namespace Eigen { | |
18 | ||
19 | /** \defgroup LeastSquares_Module LeastSquares module | |
20 | * This module provides linear regression and related features. | |
21 | * | |
22 | * \code | |
23 | * #include <Eigen/LeastSquares> | |
24 | * \endcode | |
25 | */ | |
26 | ||
27 | #include "src/Eigen2Support/LeastSquares.h" | |
28 | ||
29 | } // namespace Eigen | |
30 | ||
31 | #include "src/Core/util/ReenableStupidWarnings.h" | |
32 | ||
33 | #endif // EIGEN2_SUPPORT | |
34 | ||
35 | #endif // EIGEN_REGRESSION_MODULE_H |
0 | #ifndef EIGEN_QR_MODULE_H | |
1 | #define EIGEN_QR_MODULE_H | |
2 | ||
3 | #include "Core" | |
4 | ||
5 | #include "src/Core/util/DisableStupidWarnings.h" | |
6 | ||
7 | #include "Cholesky" | |
8 | #include "Jacobi" | |
9 | #include "Householder" | |
10 | ||
11 | namespace Eigen { | |
12 | ||
13 | /** \defgroup QR_Module QR module | |
14 | * | |
15 | * | |
16 | * | |
17 | * This module provides various QR decompositions | |
18 | * This module also provides some MatrixBase methods, including: | |
19 | * - MatrixBase::qr(), | |
20 | * | |
21 | * \code | |
22 | * #include <Eigen/QR> | |
23 | * \endcode | |
24 | */ | |
25 | ||
26 | #include "src/misc/Solve.h" | |
27 | #include "src/QR/HouseholderQR.h" | |
28 | #include "src/QR/FullPivHouseholderQR.h" | |
29 | #include "src/QR/ColPivHouseholderQR.h" | |
30 | ||
31 | #ifdef EIGEN2_SUPPORT | |
32 | #include "src/Eigen2Support/QR.h" | |
33 | #endif | |
34 | ||
35 | } // namespace Eigen | |
36 | ||
37 | #include "src/Core/util/ReenableStupidWarnings.h" | |
38 | ||
39 | #ifdef EIGEN2_SUPPORT | |
40 | #include "Eigenvalues" | |
41 | #endif | |
42 | ||
43 | #endif // EIGEN_QR_MODULE_H | |
44 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ |
0 | ||
1 | #ifndef EIGEN_QTMALLOC_MODULE_H | |
2 | #define EIGEN_QTMALLOC_MODULE_H | |
3 | ||
4 | #include "Core" | |
5 | ||
6 | #if (!EIGEN_MALLOC_ALREADY_ALIGNED) | |
7 | ||
8 | #include "src/Core/util/DisableStupidWarnings.h" | |
9 | ||
10 | void *qMalloc(size_t size) | |
11 | { | |
12 | return Eigen::internal::aligned_malloc(size); | |
13 | } | |
14 | ||
15 | void qFree(void *ptr) | |
16 | { | |
17 | Eigen::internal::aligned_free(ptr); | |
18 | } | |
19 | ||
20 | void *qRealloc(void *ptr, size_t size) | |
21 | { | |
22 | void* newPtr = Eigen::internal::aligned_malloc(size); | |
23 | memcpy(newPtr, ptr, size); | |
24 | Eigen::internal::aligned_free(ptr); | |
25 | return newPtr; | |
26 | } | |
27 | ||
28 | #include "src/Core/util/ReenableStupidWarnings.h" | |
29 | ||
30 | #endif | |
31 | ||
32 | #endif // EIGEN_QTMALLOC_MODULE_H | |
33 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ |
0 | #ifndef EIGEN_SVD_MODULE_H | |
1 | #define EIGEN_SVD_MODULE_H | |
2 | ||
3 | #include "QR" | |
4 | #include "Householder" | |
5 | #include "Jacobi" | |
6 | ||
7 | #include "src/Core/util/DisableStupidWarnings.h" | |
8 | ||
9 | namespace Eigen { | |
10 | ||
11 | /** \defgroup SVD_Module SVD module | |
12 | * | |
13 | * | |
14 | * | |
15 | * This module provides SVD decomposition for matrices (both real and complex). | |
16 | * This decomposition is accessible via the following MatrixBase method: | |
17 | * - MatrixBase::jacobiSvd() | |
18 | * | |
19 | * \code | |
20 | * #include <Eigen/SVD> | |
21 | * \endcode | |
22 | */ | |
23 | ||
24 | #include "src/misc/Solve.h" | |
25 | #include "src/SVD/JacobiSVD.h" | |
26 | #include "src/SVD/UpperBidiagonalization.h" | |
27 | ||
28 | #ifdef EIGEN2_SUPPORT | |
29 | #include "src/Eigen2Support/SVD.h" | |
30 | #endif | |
31 | ||
32 | } // namespace Eigen | |
33 | ||
34 | #include "src/Core/util/ReenableStupidWarnings.h" | |
35 | ||
36 | #endif // EIGEN_SVD_MODULE_H | |
37 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ |
0 | #ifndef EIGEN_SPARSE_MODULE_H | |
1 | #define EIGEN_SPARSE_MODULE_H | |
2 | ||
3 | #include "Core" | |
4 | ||
5 | #include "src/Core/util/DisableStupidWarnings.h" | |
6 | ||
7 | #include <vector> | |
8 | #include <map> | |
9 | #include <cstdlib> | |
10 | #include <cstring> | |
11 | #include <algorithm> | |
12 | ||
13 | #ifdef EIGEN2_SUPPORT | |
14 | #define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET | |
15 | #endif | |
16 | ||
17 | #ifndef EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET | |
18 | #error The sparse module API is not stable yet. To use it anyway, please define the EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET preprocessor token. | |
19 | #endif | |
20 | ||
21 | namespace Eigen { | |
22 | ||
23 | /** \defgroup Sparse_Module Sparse module | |
24 | * | |
25 | * | |
26 | * | |
27 | * See the \ref TutorialSparse "Sparse tutorial" | |
28 | * | |
29 | * \code | |
30 | * #include <Eigen/Sparse> | |
31 | * \endcode | |
32 | */ | |
33 | ||
34 | /** The type used to identify a general sparse storage. */ | |
35 | struct Sparse {}; | |
36 | ||
37 | #include "src/Sparse/SparseUtil.h" | |
38 | #include "src/Sparse/SparseMatrixBase.h" | |
39 | #include "src/Sparse/CompressedStorage.h" | |
40 | #include "src/Sparse/AmbiVector.h" | |
41 | #include "src/Sparse/SparseMatrix.h" | |
42 | #include "src/Sparse/DynamicSparseMatrix.h" | |
43 | #include "src/Sparse/MappedSparseMatrix.h" | |
44 | #include "src/Sparse/SparseVector.h" | |
45 | #include "src/Sparse/CoreIterators.h" | |
46 | #include "src/Sparse/SparseBlock.h" | |
47 | #include "src/Sparse/SparseTranspose.h" | |
48 | #include "src/Sparse/SparseCwiseUnaryOp.h" | |
49 | #include "src/Sparse/SparseCwiseBinaryOp.h" | |
50 | #include "src/Sparse/SparseDot.h" | |
51 | #include "src/Sparse/SparseAssign.h" | |
52 | #include "src/Sparse/SparseRedux.h" | |
53 | #include "src/Sparse/SparseFuzzy.h" | |
54 | #include "src/Sparse/SparseProduct.h" | |
55 | #include "src/Sparse/SparseSparseProduct.h" | |
56 | #include "src/Sparse/SparseDenseProduct.h" | |
57 | #include "src/Sparse/SparseDiagonalProduct.h" | |
58 | #include "src/Sparse/SparseTriangularView.h" | |
59 | #include "src/Sparse/SparseSelfAdjointView.h" | |
60 | #include "src/Sparse/TriangularSolver.h" | |
61 | #include "src/Sparse/SparseView.h" | |
62 | ||
63 | } // namespace Eigen | |
64 | ||
65 | #include "src/Core/util/ReenableStupidWarnings.h" | |
66 | ||
67 | #endif // EIGEN_SPARSE_MODULE_H | |
68 |
0 | // This file is part of Eigen, a lightweight C++ template library | |
1 | // for linear algebra. | |
2 | // | |
3 | // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr> | |
4 | // Copyright (C) 2009 Hauke Heibel <hauke.heibel@googlemail.com> | |
5 | // | |
6 | // Eigen is free software; you can redistribute it and/or | |
7 | // modify it under the terms of the GNU Lesser General Public | |
8 | // License as published by the Free Software Foundation; either | |
9 | // version 3 of the License, or (at your option) any later version. | |
10 | // | |
11 | // Alternatively, you can redistribute it and/or | |
12 | // modify it under the terms of the GNU General Public License as | |
13 | // published by the Free Software Foundation; either version 2 of | |
14 | // the License, or (at your option) any later version. | |
15 | // | |
16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY | |
17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the | |
19 | // GNU General Public License for more details. | |
20 | // | |
21 | // You should have received a copy of the GNU Lesser General Public | |
22 | // License and a copy of the GNU General Public License along with | |
23 | // Eigen. If not, see <http://www.gnu.org/licenses/>. | |
24 | ||
25 | #ifndef EIGEN_STDDEQUE_MODULE_H | |
26 | #define EIGEN_STDDEQUE_MODULE_H | |
27 | ||
28 | #include "Core" | |
29 | #include <deque> | |
30 | ||
31 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ | |
32 | ||
33 | #define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...) | |
34 | ||
35 | #else | |
36 | ||
37 | #include "src/StlSupport/StdDeque.h" | |
38 | ||
39 | #endif | |
40 | ||
41 | #endif // EIGEN_STDDEQUE_MODULE_H |
0 | // This file is part of Eigen, a lightweight C++ template library | |
1 | // for linear algebra. | |
2 | // | |
3 | // Copyright (C) 2009 Hauke Heibel <hauke.heibel@googlemail.com> | |
4 | // | |
5 | // Eigen is free software; you can redistribute it and/or | |
6 | // modify it under the terms of the GNU Lesser General Public | |
7 | // License as published by the Free Software Foundation; either | |
8 | // version 3 of the License, or (at your option) any later version. | |
9 | // | |
10 | // Alternatively, you can redistribute it and/or | |
11 | // modify it under the terms of the GNU General Public License as | |
12 | // published by the Free Software Foundation; either version 2 of | |
13 | // the License, or (at your option) any later version. | |
14 | // | |
15 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY | |
16 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
17 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the | |
18 | // GNU General Public License for more details. | |
19 | // | |
20 | // You should have received a copy of the GNU Lesser General Public | |
21 | // License and a copy of the GNU General Public License along with | |
22 | // Eigen. If not, see <http://www.gnu.org/licenses/>. | |
23 | ||
24 | #ifndef EIGEN_STDLIST_MODULE_H | |
25 | #define EIGEN_STDLIST_MODULE_H | |
26 | ||
27 | #include "Core" | |
28 | #include <list> | |
29 | ||
30 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ | |
31 | ||
32 | #define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) | |
33 | ||
34 | #else | |
35 | ||
36 | #include "src/StlSupport/StdList.h" | |
37 | ||
38 | #endif | |
39 | ||
40 | #endif // EIGEN_STDLIST_MODULE_H |
0 | // This file is part of Eigen, a lightweight C++ template library | |
1 | // for linear algebra. | |
2 | // | |
3 | // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr> | |
4 | // Copyright (C) 2009 Hauke Heibel <hauke.heibel@googlemail.com> | |
5 | // | |
6 | // Eigen is free software; you can redistribute it and/or | |
7 | // modify it under the terms of the GNU Lesser General Public | |
8 | // License as published by the Free Software Foundation; either | |
9 | // version 3 of the License, or (at your option) any later version. | |
10 | // | |
11 | // Alternatively, you can redistribute it and/or | |
12 | // modify it under the terms of the GNU General Public License as | |
13 | // published by the Free Software Foundation; either version 2 of | |
14 | // the License, or (at your option) any later version. | |
15 | // | |
16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY | |
17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the | |
19 | // GNU General Public License for more details. | |
20 | // | |
21 | // You should have received a copy of the GNU Lesser General Public | |
22 | // License and a copy of the GNU General Public License along with | |
23 | // Eigen. If not, see <http://www.gnu.org/licenses/>. | |
24 | ||
25 | #ifndef EIGEN_STDVECTOR_MODULE_H | |
26 | #define EIGEN_STDVECTOR_MODULE_H | |
27 | ||
28 | #include "Core" | |
29 | #include <vector> | |
30 | ||
31 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ | |
32 | ||
33 | #define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) | |
34 | ||
35 | #else | |
36 | ||
37 | #include "src/StlSupport/StdVector.h" | |
38 | ||
39 | #endif | |
40 | ||
41 | #endif // EIGEN_STDVECTOR_MODULE_H |
0 | file(GLOB Eigen_src_subdirectories "*") | |
1 | escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") | |
2 | foreach(f ${Eigen_src_subdirectories}) | |
3 | if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" ) | |
4 | add_subdirectory(${f}) | |
5 | endif() | |
6 | endforeach() |
0 | FILE(GLOB Eigen_Cholesky_SRCS "*.h") | |
1 | ||
2 | INSTALL(FILES | |
3 | ${Eigen_Cholesky_SRCS} | |
4 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Cholesky COMPONENT Devel | |
5 | ) |
0 | // This file is part of Eigen, a lightweight C++ template library | |
1 | // for linear algebra. | |
2 | // | |
3 | // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud@inria.fr> | |
4 | // Copyright (C) 2009 Keir Mierle <mierle@gmail.com> | |
5 | // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com> | |
6 | // | |
7 | // Eigen is free software; you can redistribute it and/or | |
8 | // modify it under the terms of the GNU Lesser General Public | |
9 | // License as published by the Free Software Foundation; either | |
10 | // version 3 of the License, or (at your option) any later version. | |
11 | // | |
12 | // Alternatively, you can redistribute it and/or | |
13 | // modify it under the terms of the GNU General Public License as | |
14 | // published by the Free Software Foundation; either version 2 of | |
15 | // the License, or (at your option) any later version. | |
16 | // | |
17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY | |
18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the | |
20 | // GNU General Public License for more details. | |
21 | // | |
22 | // You should have received a copy of the GNU Lesser General Public | |
23 | // License and a copy of the GNU General Public License along with | |
24 | // Eigen. If not, see <http://www.gnu.org/licenses/>. | |
25 | ||
26 | #ifndef EIGEN_LDLT_H | |
27 | #define EIGEN_LDLT_H | |
28 | ||
29 | namespace internal { | |
30 | template<typename MatrixType, int UpLo> struct LDLT_Traits; | |
31 | } | |
32 | ||
33 | /** \ingroup cholesky_Module | |
34 | * | |
35 | * \class LDLT | |
36 | * | |
37 | * \brief Robust Cholesky decomposition of a matrix with pivoting | |
38 | * | |
39 | * \param MatrixType the type of the matrix of which to compute the LDL^T Cholesky decomposition | |
40 | * | |
41 | * Perform a robust Cholesky decomposition of a positive semidefinite or negative semidefinite | |
42 | * matrix \f$ A \f$ such that \f$ A = P^TLDL^*P \f$, where P is a permutation matrix, L | |
43 | * is lower triangular with a unit diagonal and D is a diagonal matrix. | |
44 | * | |
45 | * The decomposition uses pivoting to ensure stability, so that L will have | |
46 | * zeros in the bottom right rank(A) - n submatrix. Avoiding the square root | |
47 | * on D also stabilizes the computation. | |
48 | * | |
49 | * Remember that Cholesky decompositions are not rank-revealing. Also, do not use a Cholesky | |
50 | * decomposition to determine whether a system of equations has a solution. | |
51 | * | |
52 | * \sa MatrixBase::ldlt(), class LLT | |
53 | */ | |
54 | /* THIS PART OF THE DOX IS CURRENTLY DISABLED BECAUSE INACCURATE BECAUSE OF BUG IN THE DECOMPOSITION CODE | |
55 | * Note that during the decomposition, only the upper triangular part of A is considered. Therefore, | |
56 | * the strict lower part does not have to store correct values. | |
57 | */ | |
58 | template<typename _MatrixType, int _UpLo> class LDLT | |
59 | { | |
60 | public: | |
61 | typedef _MatrixType MatrixType; | |
62 | enum { | |
63 | RowsAtCompileTime = MatrixType::RowsAtCompileTime, | |
64 | ColsAtCompileTime = MatrixType::ColsAtCompileTime, | |
65 | Options = MatrixType::Options & ~RowMajorBit, // these are the options for the TmpMatrixType, we need a ColMajor matrix here! | |
66 | MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, | |
67 | MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, | |
68 | UpLo = _UpLo | |
69 | }; | |
70 | typedef typename MatrixType::Scalar Scalar; | |
71 | typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar; | |
72 | typedef typename MatrixType::Index Index; | |
73 | typedef Matrix<Scalar, RowsAtCompileTime, 1, Options, MaxRowsAtCompileTime, 1> TmpMatrixType; | |
74 | ||
75 | typedef Transpositions<RowsAtCompileTime, MaxRowsAtCompileTime> TranspositionType; | |
76 | typedef PermutationMatrix<RowsAtCompileTime, MaxRowsAtCompileTime> PermutationType; | |
77 | ||
78 | typedef internal::LDLT_Traits<MatrixType,UpLo> Traits; | |
79 | ||
80 | /** \brief Default Constructor. | |
81 | * | |
82 | * The default constructor is useful in cases in which the user intends to | |
83 | * perform decompositions via LDLT::compute(const MatrixType&). | |
84 | */ | |
85 | LDLT() : m_matrix(), m_transpositions(), m_isInitialized(false) {} | |
86 | ||
87 | /** \brief Default Constructor with memory preallocation | |
88 | * | |
89 | * Like the default constructor but with preallocation of the internal data | |
90 | * according to the specified problem \a size. | |
91 | * \sa LDLT() | |
92 | */ | |
93 | LDLT(Index size) | |
94 | : m_matrix(size, size), | |
95 | m_transpositions(size), | |
96 | m_temporary(size), | |
97 | m_isInitialized(false) | |
98 | {} | |
99 | ||
100 | LDLT(const MatrixType& matrix) | |
101 | : m_matrix(matrix.rows(), matrix.cols()), | |
102 | m_transpositions(matrix.rows()), | |
103 | m_temporary(matrix.rows()), | |
104 | m_isInitialized(false) | |
105 | { | |
106 | compute(matrix); | |
107 | } | |
108 | ||
109 | /** \returns a view of the upper triangular matrix U */ | |
110 | inline typename Traits::MatrixU matrixU() const | |
111 | { | |
112 | eigen_assert(m_isInitialized && "LDLT is not initialized."); | |
113 | return Traits::getU(m_matrix); | |
114 | } | |
115 | ||
116 | /** \returns a view of the lower triangular matrix L */ | |
117 | inline typename Traits::MatrixL matrixL() const | |
118 | { | |
119 | eigen_assert(m_isInitialized && "LDLT is not initialized."); | |
120 | return Traits::getL(m_matrix); | |
121 | } | |
122 | ||
123 | /** \returns the permutation matrix P as a transposition sequence. | |
124 | */ | |
125 | inline const TranspositionType& transpositionsP() const | |
126 | { | |
127 | eigen_assert(m_isInitialized && "LDLT is not initialized."); | |
128 | return m_transpositions; | |
129 | } | |
130 | ||
131 | /** \returns the coefficients of the diagonal matrix D */ | |
132 | inline Diagonal<const MatrixType> vectorD(void) const | |
133 | { | |
134 | eigen_assert(m_isInitialized && "LDLT is not initialized."); | |
135 | return m_matrix.diagonal(); | |
136 | } | |
137 | ||
138 | /** \returns true if the matrix is positive (semidefinite) */ | |
139 | inline bool isPositive(void) const | |
140 | { | |
141 | eigen_assert(m_isInitialized && "LDLT is not initialized."); | |
142 | return m_sign == 1; | |
143 | } | |
144 | ||
145 | #ifdef EIGEN2_SUPPORT | |
146 | inline bool isPositiveDefinite() const | |
147 | { | |
148 | return isPositive(); | |
149 | } | |
150 | #endif | |
151 | ||
152 | /** \returns true if the matrix is negative (semidefinite) */ | |
153 | inline bool isNegative(void) const | |
154 | { | |
155 | eigen_assert(m_isInitialized && "LDLT is not initialized."); | |
156 | return m_sign == -1; | |
157 | } | |
158 | ||
159 | /** \returns a solution x of \f$ A x = b \f$ using the current decomposition of A. | |
160 | * | |
161 | * This function also supports in-place solves using the syntax <tt>x = decompositionObject.solve(x)</tt> . | |
162 | * | |
163 | * \note_about_checking_solutions | |
164 | * | |
165 | * More precisely, this method solves \f$ A x = b \f$ using the decomposition \f$ A = P^T L D L^* P \f$ | |
166 | * by solving the systems \f$ P^T y_1 = b \f$, \f$ L y_2 = y_1 \f$, \f$ D y_3 = y_2 \f$, | |
167 | * \f$ L^* y_4 = y_3 \f$ and \f$ P x = y_4 \f$ in succession. If the matrix \f$ A \f$ is singular, then | |
168 | * \f$ D \f$ will also be singular (all the other matrices are invertible). In that case, the | |
169 | * least-square solution of \f$ D y_3 = y_2 \f$ is computed. This does not mean that this function | |
170 | * computes the least-square solution of \f$ A x = b \f$ is \f$ A \f$ is singular. | |
171 | * | |
172 | * \sa MatrixBase::ldlt() | |
173 | */ | |
174 | template<typename Rhs> | |
175 | inline const internal::solve_retval<LDLT, Rhs> | |
176 | solve(const MatrixBase<Rhs>& b) const | |
177 | { | |
178 | eigen_assert(m_isInitialized && "LDLT is not initialized."); | |
179 | eigen_assert(m_matrix.rows()==b.rows() | |
180 | && "LDLT::solve(): invalid number of rows of the right hand side matrix b"); | |
181 | return internal::solve_retval<LDLT, Rhs>(*this, b.derived()); | |
182 | } | |
183 | ||
184 | #ifdef EIGEN2_SUPPORT | |
185 | template<typename OtherDerived, typename ResultType> | |
186 | bool solve(const MatrixBase<OtherDerived>& b, ResultType *result) const | |
187 | { | |
188 | *result = this->solve(b); | |
189 | return true; | |
190 | } | |
191 | #endif | |
192 | ||
193 | template<typename Derived> | |
194 | bool solveInPlace(MatrixBase<Derived> &bAndX) const; | |
195 | ||
196 | LDLT& compute(const MatrixType& matrix); | |
197 | ||
198 | /** \returns the internal LDLT decomposition matrix | |
199 | * | |
200 | * TODO: document the storage layout | |
201 | */ | |
202 | inline const MatrixType& matrixLDLT() const | |
203 | { | |
204 | eigen_assert(m_isInitialized && "LDLT is not initialized."); | |
205 | return m_matrix; | |
206 | } | |
207 | ||
208 | MatrixType reconstructedMatrix() const; | |
209 | ||
210 | inline Index rows() const { return m_matrix.rows(); } | |
211 | inline Index cols() const { return m_matrix.cols(); } | |
212 | ||
213 | protected: | |
214 | ||
215 | /** \internal | |
216 | * Used to compute and store the Cholesky decomposition A = L D L^* = U^* D U. | |
217 | * The strict upper part is used during the decomposition, the strict lower | |
218 | * part correspond to the coefficients of L (its diagonal is equal to 1 and | |
219 | * is not stored), and the diagonal entries correspond to D. | |
220 | */ | |
221 | MatrixType m_matrix; | |
222 | TranspositionType m_transpositions; | |
223 | TmpMatrixType m_temporary; | |
224 | int m_sign; | |
225 | bool m_isInitialized; | |
226 | }; | |
227 | ||
228 | namespace internal { | |
229 | ||
230 | template<int UpLo> struct ldlt_inplace; | |
231 | ||
232 | template<> struct ldlt_inplace<Lower> | |
233 | { | |
234 | template<typename MatrixType, typename TranspositionType, typename Workspace> | |
235 | static bool unblocked(MatrixType& mat, TranspositionType& transpositions, Workspace& temp, int* sign=0) | |
236 | { | |
237 | typedef typename MatrixType::Scalar Scalar; | |
238 | typedef typename MatrixType::RealScalar RealScalar; | |
239 | typedef typename MatrixType::Index Index; | |
240 | eigen_assert(mat.rows()==mat.cols()); | |
241 | const Index size = mat.rows(); | |
242 | ||
243 | if (size <= 1) | |
244 | { | |
245 | transpositions.setIdentity(); | |
246 | if(sign) | |
247 | *sign = real(mat.coeff(0,0))>0 ? 1:-1; | |
248 | return true; | |
249 | } | |
250 | ||
251 | RealScalar cutoff = 0, biggest_in_corner; | |
252 | ||
253 | for (Index k = 0; k < size; ++k) | |
254 | { | |
255 | // Find largest diagonal element | |
256 | Index index_of_biggest_in_corner; | |
257 | biggest_in_corner = mat.diagonal().tail(size-k).cwiseAbs().maxCoeff(&index_of_biggest_in_corner); | |
258 | index_of_biggest_in_corner += k; | |
259 | ||
260 | if(k == 0) | |
261 | { | |
262 | // The biggest overall is the point of reference to which further diagonals | |
263 | // are compared; if any diagonal is negligible compared | |
264 | // to the largest overall, the algorithm bails. | |
265 | cutoff = abs(NumTraits<Scalar>::epsilon() * biggest_in_corner); | |
266 | ||
267 | if(sign) | |
268 | *sign = real(mat.diagonal().coeff(index_of_biggest_in_corner)) > 0 ? 1 : -1; | |
269 | } | |
270 | ||
271 | // Finish early if the matrix is not full rank. | |
272 | if(biggest_in_corner < cutoff) | |
273 | { | |
274 | for(Index i = k; i < size; i++) transpositions.coeffRef(i) = i; | |
275 | break; | |
276 | } | |
277 | ||
278 | transpositions.coeffRef(k) = index_of_biggest_in_corner; | |
279 | if(k != index_of_biggest_in_corner) | |
280 | { | |
281 | // apply the transposition while taking care to consider only | |
282 | // the lower triangular part | |
283 | Index s = size-index_of_biggest_in_corner-1; // trailing size after the biggest element | |
284 | mat.row(k).head(k).swap(mat.row(index_of_biggest_in_corner).head(k)); | |
285 | mat.col(k).tail(s).swap(mat.col(index_of_biggest_in_corner).tail(s)); | |
286 | std::swap(mat.coeffRef(k,k),mat.coeffRef(index_of_biggest_in_corner,index_of_biggest_in_corner)); | |
287 | for(int i=k+1;i<index_of_biggest_in_corner;++i) | |
288 | { | |
289 | Scalar tmp = mat.coeffRef(i,k); | |
290 | mat.coeffRef(i,k) = conj(mat.coeffRef(index_of_biggest_in_corner,i)); | |
291 | mat.coeffRef(index_of_biggest_in_corner,i) = conj(tmp); | |
292 | } | |
293 | if(NumTraits<Scalar>::IsComplex) | |
294 | mat.coeffRef(index_of_biggest_in_corner,k) = conj(mat.coeff(index_of_biggest_in_corner,k)); | |
295 | } | |
296 | ||
297 | // partition the matrix: | |
298 | // A00 | - | - | |
299 | // lu = A10 | A11 | - | |
300 | // A20 | A21 | A22 | |
301 | Index rs = size - k - 1; | |
302 | Block<MatrixType,Dynamic,1> A21(mat,k+1,k,rs,1); | |
303 | Block<MatrixType,1,Dynamic> A10(mat,k,0,1,k); | |
304 | Block<MatrixType,Dynamic,Dynamic> A20(mat,k+1,0,rs,k); | |
305 | ||
306 | if(k>0) | |
307 | { | |
308 | temp.head(k) = mat.diagonal().head(k).asDiagonal() * A10.adjoint(); | |
309 | mat.coeffRef(k,k) -= (A10 * temp.head(k)).value(); | |
310 | if(rs>0) | |
311 | A21.noalias() -= A20 * temp.head(k); | |
312 | } | |
313 | if((rs>0) && (abs(mat.coeffRef(k,k)) > cutoff)) | |
314 | A21 /= mat.coeffRef(k,k); | |
315 | } | |
316 | ||
317 | return true; | |
318 | } | |
319 | }; | |
320 | ||
321 | template<> struct ldlt_inplace<Upper> | |
322 | { | |
323 | template<typename MatrixType, typename TranspositionType, typename Workspace> | |
324 | static EIGEN_STRONG_INLINE bool unblocked(MatrixType& mat, TranspositionType& transpositions, Workspace& temp, int* sign=0) | |
325 | { | |
326 | Transpose<MatrixType> matt(mat); | |
327 | return ldlt_inplace<Lower>::unblocked(matt, transpositions, temp, sign); | |
328 | } | |
329 | }; | |
330 | ||
331 | template<typename MatrixType> struct LDLT_Traits<MatrixType,Lower> | |
332 | { | |
333 | typedef const TriangularView<const MatrixType, UnitLower> MatrixL; | |
334 | typedef const TriangularView<const typename MatrixType::AdjointReturnType, UnitUpper> MatrixU; | |
335 | inline static MatrixL getL(const MatrixType& m) { return m; } | |
336 | inline static MatrixU getU(const MatrixType& m) { return m.adjoint(); } | |
337 | }; | |
338 | ||
339 | template<typename MatrixType> struct LDLT_Traits<MatrixType,Upper> | |
340 | { | |
341 | typedef const TriangularView<const typename MatrixType::AdjointReturnType, UnitLower> MatrixL; | |
342 | typedef const TriangularView<const MatrixType, UnitUpper> MatrixU; | |
343 | inline static MatrixL getL(const MatrixType& m) { return m.adjoint(); } | |
344 | inline static MatrixU getU(const MatrixType& m) { return m; } | |
345 | }; | |
346 | ||
347 | } // end namespace internal | |
348 | ||
349 | /** Compute / recompute the LDLT decomposition A = L D L^* = U^* D U of \a matrix | |
350 | */ | |
351 | template<typename MatrixType, int _UpLo> | |
352 | LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::compute(const MatrixType& a) | |
353 | { | |
354 | eigen_assert(a.rows()==a.cols()); | |
355 | const Index size = a.rows(); | |
356 | ||
357 | m_matrix = a; | |
358 | ||
359 | m_transpositions.resize(size); | |
360 | m_isInitialized = false; | |
361 | m_temporary.resize(size); | |
362 | ||
363 | internal::ldlt_inplace<UpLo>::unblocked(m_matrix, m_transpositions, m_temporary, &m_sign); | |
364 | ||
365 | m_isInitialized = true; | |
366 | return *this; | |
367 | } | |
368 | ||
369 | namespace internal { | |
370 | template<typename _MatrixType, int _UpLo, typename Rhs> | |
371 | struct solve_retval<LDLT<_MatrixType,_UpLo>, Rhs> | |
372 | : solve_retval_base<LDLT<_MatrixType,_UpLo>, Rhs> | |
373 | { | |
374 | typedef LDLT<_MatrixType,_UpLo> LDLTType; | |
375 | EIGEN_MAKE_SOLVE_HELPERS(LDLTType,Rhs) | |
376 | ||
377 | template<typename Dest> void evalTo(Dest& dst) const | |
378 | { | |
379 | eigen_assert(rhs().rows() == dec().matrixLDLT().rows()); | |
380 | // dst = P b | |
381 | dst = dec().transpositionsP() * rhs(); | |
382 | ||
383 | // dst = L^-1 (P b) | |
384 | dec().matrixL().solveInPlace(dst); | |
385 | ||
386 | // dst = D^-1 (L^-1 P b) | |
387 | // more precisely, use pseudo-inverse of D (see bug 241) | |
388 | using std::abs; | |
389 | using std::max; | |
390 | typedef typename LDLTType::MatrixType MatrixType; | |
391 | typedef typename LDLTType::Scalar Scalar; | |
392 | typedef typename LDLTType::RealScalar RealScalar; | |
393 | const Diagonal<const MatrixType> vectorD = dec().vectorD(); | |
394 | RealScalar tolerance = (max)(vectorD.array().abs().maxCoeff() * NumTraits<Scalar>::epsilon(), | |
395 | RealScalar(1) / NumTraits<RealScalar>::highest()); // motivated by LAPACK's xGELSS | |
396 | for (Index i = 0; i < vectorD.size(); ++i) { | |
397 | if(abs(vectorD(i)) > tolerance) | |
398 | dst.row(i) /= vectorD(i); | |
399 | else | |
400 | dst.row(i).setZero(); | |
401 | } | |
402 | ||
403 | // dst = L^-T (D^-1 L^-1 P b) | |
404 | dec().matrixU().solveInPlace(dst); | |
405 | ||
406 | // dst = P^-1 (L^-T D^-1 L^-1 P b) = A^-1 b | |
407 | dst = dec().transpositionsP().transpose() * dst; | |
408 | } | |
409 | }; | |
410 | } | |
411 | ||
412 | /** \internal use x = ldlt_object.solve(x); | |
413 | * | |
414 | * This is the \em in-place version of solve(). | |
415 | * | |
416 | * \param bAndX represents both the right-hand side matrix b and result x. | |
417 | * | |
418 | * \returns true always! If you need to check for existence of solutions, use another decomposition like LU, QR, or SVD. | |
419 | * | |
420 | * This version avoids a copy when the right hand side matrix b is not | |
421 | * needed anymore. | |
422 | * | |
423 | * \sa LDLT::solve(), MatrixBase::ldlt() | |
424 | */ | |
425 | template<typename MatrixType,int _UpLo> | |
426 | template<typename Derived> | |
427 | bool LDLT<MatrixType,_UpLo>::solveInPlace(MatrixBase<Derived> &bAndX) const | |
428 | { | |
429 | eigen_assert(m_isInitialized && "LDLT is not initialized."); | |
430 | const Index size = m_matrix.rows(); | |
431 | eigen_assert(size == bAndX.rows()); | |
432 | ||
433 | bAndX = this->solve(bAndX); | |
434 | ||
435 | return true; | |
436 | } | |
437 | ||
438 | /** \returns the matrix represented by the decomposition, | |
439 | * i.e., it returns the product: P^T L D L^* P. | |
440 | * This function is provided for debug purpose. */ | |
441 | template<typename MatrixType, int _UpLo> | |
442 | MatrixType LDLT<MatrixType,_UpLo>::reconstructedMatrix() const | |
443 | { | |
444 | eigen_assert(m_isInitialized && "LDLT is not initialized."); | |
445 | const Index size = m_matrix.rows(); | |
446 | MatrixType res(size,size); | |
447 | ||
448 | // P | |
449 | res.setIdentity(); | |
450 | res = transpositionsP() * res; | |
451 | // L^* P | |
452 | res = matrixU() * res; | |
453 | // D(L^*P) | |
454 | res = vectorD().asDiagonal() * res; | |
455 | // L(DL^*P) | |
456 | res = matrixL() * res; | |
457 | // P^T (LDL^*P) | |
458 | res = transpositionsP().transpose() * res; | |
459 | ||
460 | return res; | |
461 | } | |
462 | ||
463 | /** \cholesky_module | |
464 | * \returns the Cholesky decomposition with full pivoting without square root of \c *this | |
465 | */ | |
466 | template<typename MatrixType, unsigned int UpLo> | |
467 | inline const LDLT<typename SelfAdjointView<MatrixType, UpLo>::PlainObject, UpLo> | |
468 | SelfAdjointView<MatrixType, UpLo>::ldlt() const | |
469 | { | |
470 | return LDLT<PlainObject,UpLo>(m_matrix); | |
471 | } | |
472 | ||
473 | /** \cholesky_module | |
474 | * \returns the Cholesky decomposition with full pivoting without square root of \c *this | |
475 | */ | |
476 | template<typename Derived> | |
477 | inline const LDLT<typename MatrixBase<Derived>::PlainObject> | |
478 | MatrixBase<Derived>::ldlt() const | |
479 | { | |
480 | return LDLT<PlainObject>(derived()); | |
481 | } | |
482 | ||
483 | #endif // EIGEN_LDLT_H |
0 | // This file is part of Eigen, a lightweight C++ template library | |
1 | // for linear algebra. | |
2 | // | |
3 | // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr> | |
4 | // | |
5 | // Eigen is free software; you can redistribute it and/or | |
6 | // modify it under the terms of the GNU Lesser General Public | |
7 | // License as published by the Free Software Foundation; either | |
8 | // version 3 of the License, or (at your option) any later version. | |
9 | // | |
10 | // Alternatively, you can redistribute it and/or | |
11 | // modify it under the terms of the GNU General Public License as | |
12 | // published by the Free Software Foundation; either version 2 of | |
13 | // the License, or (at your option) any later version. | |
14 | // | |
15 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY | |
16 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
17 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the | |
18 | // GNU General Public License for more details. | |
19 | // | |
20 | // You should have received a copy of the GNU Lesser General Public | |
21 | // License and a copy of the GNU General Public License along with | |
22 | // Eigen. If not, see <http://www.gnu.org/licenses/>. | |
23 | ||
24 | #ifndef EIGEN_LLT_H | |
25 | #define EIGEN_LLT_H | |
26 | ||
27 | namespace internal{ | |
28 | template<typename MatrixType, int UpLo> struct LLT_Traits; | |
29 | } | |
30 | ||
31 | /** \ingroup cholesky_Module | |
32 | * | |
33 | * \class LLT | |
34 | * | |
35 | * \brief Standard Cholesky decomposition (LL^T) of a matrix and associated features | |
36 | * | |
37 | * \param MatrixType the type of the matrix of which we are computing the LL^T Cholesky decomposition | |
38 | * | |
39 | * This class performs a LL^T Cholesky decomposition of a symmetric, positive definite | |
40 | * matrix A such that A = LL^* = U^*U, where L is lower triangular. | |
41 | * | |
42 | * While the Cholesky decomposition is particularly useful to solve selfadjoint problems like D^*D x = b, | |
43 | * for that purpose, we recommend the Cholesky decomposition without square root which is more stable | |
44 | * and even faster. Nevertheless, this standard Cholesky decomposition remains useful in many other | |
45 | * situations like generalised eigen problems with hermitian matrices. | |
46 | * | |
47 | * Remember that Cholesky decompositions are not rank-revealing. This LLT decomposition is only stable on positive definite matrices, | |
48 | * use LDLT instead for the semidefinite case. Also, do not use a Cholesky decomposition to determine whether a system of equations | |
49 | * has a solution. | |
50 | * | |
51 | * \sa MatrixBase::llt(), class LDLT | |
52 | */ | |
53 | /* HEY THIS DOX IS DISABLED BECAUSE THERE's A BUG EITHER HERE OR IN LDLT ABOUT THAT (OR BOTH) | |
54 | * Note that during the decomposition, only the upper triangular part of A is considered. Therefore, | |
55 | * the strict lower part does not have to store correct values. | |
56 | */ | |
57 | template<typename _MatrixType, int _UpLo> class LLT | |
58 | { | |
59 | public: | |
60 | typedef _MatrixType MatrixType; | |
61 | enum { | |
62 | RowsAtCompileTime = MatrixType::RowsAtCompileTime, | |
63 | ColsAtCompileTime = MatrixType::ColsAtCompileTime, | |
64 | Options = MatrixType::Options, | |
65 | MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime | |
66 | }; | |
67 | typedef typename MatrixType::Scalar Scalar; | |
68 | typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar; | |
69 | typedef typename MatrixType::Index Index; | |
70 | ||
71 | enum { | |
72 | PacketSize = internal::packet_traits<Scalar>::size, | |
73 | AlignmentMask = int(PacketSize)-1, | |
74 | UpLo = _UpLo | |
75 | }; | |
76 | ||
77 | typedef internal::LLT_Traits<MatrixType,UpLo> Traits; | |
78 | ||
79 | /** | |
80 | * \brief Default Constructor. | |
81 | * | |
82 | * The default constructor is useful in cases in which the user intends to | |
83 | * perform decompositions via LLT::compute(const MatrixType&). | |
84 | */ | |
85 | LLT() : m_matrix(), m_isInitialized(false) {} | |
86 | ||
87 | /** \brief Default Constructor with memory preallocation | |
88 | * | |
89 | * Like the default constructor but with preallocation of the internal data | |
90 | * according to the specified problem \a size. | |
91 | * \sa LLT() | |
92 | */ | |
93 | LLT(Index size) : m_matrix(size, size), | |
94 | m_isInitialized(false) {} | |
95 | ||
96 | LLT(const MatrixType& matrix) | |
97 | : m_matrix(matrix.rows(), matrix.cols()), | |
98 | m_isInitialized(false) | |
99 | { | |
100 | compute(matrix); | |
101 | } | |
102 | ||
103 | /** \returns a view of the upper triangular matrix U */ | |
104 | inline typename Traits::MatrixU matrixU() const | |
105 | { | |
106 | eigen_assert(m_isInitialized && "LLT is not initialized."); | |
107 | return Traits::getU(m_matrix); | |
108 | } | |
109 | ||
110 | /** \returns a view of the lower triangular matrix L */ | |
111 | inline typename Traits::MatrixL matrixL() const | |
112 | { | |
113 | eigen_assert(m_isInitialized && "LLT is not initialized."); | |
114 | return Traits::getL(m_matrix); | |
115 | } | |
116 | ||
117 | /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A. | |
118 | * | |
119 | * Since this LLT class assumes anyway that the matrix A is invertible, the solution | |
120 | * theoretically exists and is unique regardless of b. | |
121 | * | |
122 | * Example: \include LLT_solve.cpp | |
123 | * Output: \verbinclude LLT_solve.out | |
124 | * | |
125 | * \sa solveInPlace(), MatrixBase::llt() | |
126 | */ | |
127 | template<typename Rhs> | |
128 | inline const internal::solve_retval<LLT, Rhs> | |
129 | solve(const MatrixBase<Rhs>& b) const | |
130 | { | |
131 | eigen_assert(m_isInitialized && "LLT is not initialized."); | |
132 | eigen_assert(m_matrix.rows()==b.rows() | |
133 | && "LLT::solve(): invalid number of rows of the right hand side matrix b"); | |
134 | return internal::solve_retval<LLT, Rhs>(*this, b.derived()); | |
135 | } | |
136 | ||
137 | #ifdef EIGEN2_SUPPORT | |
138 | template<typename OtherDerived, typename ResultType> | |
139 | bool solve(const MatrixBase<OtherDerived>& b, ResultType *result) const | |
140 | { | |
141 | *result = this->solve(b); | |
142 | return true; | |
143 | } | |
144 | ||
145 | bool isPositiveDefinite() const { return true; } | |
146 | #endif | |
147 | ||
148 | template<typename Derived> | |
149 | void solveInPlace(MatrixBase<Derived> &bAndX) const; | |
150 | ||
151 | LLT& compute(const MatrixType& matrix); | |
152 | ||
153 | /** \returns the LLT decomposition matrix | |
154 | * | |
155 | * TODO: document the storage layout | |
156 | */ | |
157 | inline const MatrixType& matrixLLT() const | |
158 | { | |
159 | eigen_assert(m_isInitialized && "LLT is not initialized."); | |
160 | return m_matrix; | |
161 | } | |
162 | ||
163 | MatrixType reconstructedMatrix() const; | |
164 | ||
165 | ||
166 | /** \brief Reports whether previous computation was successful. | |
167 | * | |
168 | * \returns \c Success if computation was succesful, | |
169 | * \c NumericalIssue if the matrix.appears to be negative. | |
170 | */ | |
171 | ComputationInfo info() const | |
172 | { | |
173 | eigen_assert(m_isInitialized && "LLT is not initialized."); | |
174 | return m_info; | |
175 | } | |
176 | ||
177 | inline Index rows() const { return m_matrix.rows(); } | |
178 | inline Index cols() const { return m_matrix.cols(); } | |
179 | ||
180 | protected: | |
181 | /** \internal | |
182 | * Used to compute and store L | |
183 | * The strict upper part is not used and even not initialized. | |
184 | */ | |
185 | MatrixType m_matrix; | |
186 | bool m_isInitialized; | |
187 | ComputationInfo m_info; | |
188 | }; | |
189 | ||
190 | namespace internal { | |
191 | ||
192 | template<int UpLo> struct llt_inplace; | |
193 | ||
194 | template<> struct llt_inplace<Lower> | |
195 | { | |
196 | template<typename MatrixType> | |
197 | static typename MatrixType::Index unblocked(MatrixType& mat) | |
198 | { | |
199 | typedef typename MatrixType::Index Index; | |
200 | typedef typename MatrixType::Scalar Scalar; | |
201 | typedef typename MatrixType::RealScalar RealScalar; | |
202 | ||
203 | eigen_assert(mat.rows()==mat.cols()); | |
204 | const Index size = mat.rows(); | |
205 | for(Index k = 0; k < size; ++k) | |
206 | { | |
207 | Index rs = size-k-1; // remaining size | |
208 | ||
209 | Block<MatrixType,Dynamic,1> A21(mat,k+1,k,rs,1); | |
210 | Block<MatrixType,1,Dynamic> A10(mat,k,0,1,k); | |
211 | Block<MatrixType,Dynamic,Dynamic> A20(mat,k+1,0,rs,k); | |
212 | ||
213 | RealScalar x = real(mat.coeff(k,k)); | |
214 | if (k>0) x -= A10.squaredNorm(); | |
215 | if (x<=RealScalar(0)) | |
216 | return k; | |
217 | mat.coeffRef(k,k) = x = sqrt(x); | |
218 | if (k>0 && rs>0) A21.noalias() -= A20 * A10.adjoint(); | |
219 | if (rs>0) A21 *= RealScalar(1)/x; | |
220 | } | |
221 | return -1; | |
222 | } | |
223 | ||
224 | template<typename MatrixType> | |
225 | static typename MatrixType::Index blocked(MatrixType& m) | |
226 | { | |
227 | typedef typename MatrixType::Index Index; | |
228 | eigen_assert(m.rows()==m.cols()); | |
229 | Index size = m.rows(); | |
230 | if(size<32) | |
231 | return unblocked(m); | |
232 | ||
233 | Index blockSize = size/8; | |
234 | blockSize = (blockSize/16)*16; | |
235 | blockSize = (std::min)((std::max)(blockSize,Index(8)), Index(128)); | |
236 | ||
237 | for (Index k=0; k<size; k+=blockSize) | |
238 | { | |
239 | // partition the matrix: | |
240 | // A00 | - | - | |
241 | // lu = A10 | A11 | - | |
242 | // A20 | A21 | A22 | |
243 | Index bs = (std::min)(blockSize, size-k); | |
244 | Index rs = size - k - bs; | |
245 | Block<MatrixType,Dynamic,Dynamic> A11(m,k, k, bs,bs); | |
246 | Block<MatrixType,Dynamic,Dynamic> A21(m,k+bs,k, rs,bs); | |
247 | Block<MatrixType,Dynamic,Dynamic> A22(m,k+bs,k+bs,rs,rs); | |
248 | ||
249 | Index ret; | |
250 | if((ret=unblocked(A11))>=0) return k+ret; | |
251 | if(rs>0) A11.adjoint().template triangularView<Upper>().template solveInPlace<OnTheRight>(A21); | |
252 | if(rs>0) A22.template selfadjointView<Lower>().rankUpdate(A21,-1); // bottleneck | |
253 | } | |
254 | return -1; | |
255 | } | |
256 | }; | |
257 | ||
258 | template<> struct llt_inplace<Upper> | |
259 | { | |
260 | template<typename MatrixType> | |
261 | static EIGEN_STRONG_INLINE typename MatrixType::Index unblocked(MatrixType& mat) | |
262 | { | |
263 | Transpose<MatrixType> matt(mat); | |
264 | return llt_inplace<Lower>::unblocked(matt); | |
265 | } | |
266 | template<typename MatrixType> | |
267 | static EIGEN_STRONG_INLINE typename MatrixType::Index blocked(MatrixType& mat) | |
268 | { | |
269 | Transpose<MatrixType> matt(mat); | |
270 | return llt_inplace<Lower>::blocked(matt); | |
271 | } | |
272 | }; | |
273 | ||
274 | template<typename MatrixType> struct LLT_Traits<MatrixType,Lower> | |
275 | { | |
276 | typedef const TriangularView<const MatrixType, Lower> MatrixL; | |
277 | typedef const TriangularView<const typename MatrixType::AdjointReturnType, Upper> MatrixU; | |
278 | inline static MatrixL getL(const MatrixType& m) { return m; } | |
279 | inline static MatrixU getU(const MatrixType& m) { return m.adjoint(); } | |
280 | static bool inplace_decomposition(MatrixType& m) | |
281 | { return llt_inplace<Lower>::blocked(m)==-1; } | |
282 | }; | |
283 | ||
284 | template<typename MatrixType> struct LLT_Traits<MatrixType,Upper> | |
285 | { | |
286 | typedef const TriangularView<const typename MatrixType::AdjointReturnType, Lower> MatrixL; | |
287 | typedef const TriangularView<const MatrixType, Upper> MatrixU; | |
288 | inline static MatrixL getL(const MatrixType& m) { return m.adjoint(); } | |
289 | inline static MatrixU getU(const MatrixType& m) { return m; } | |
290 | static bool inplace_decomposition(MatrixType& m) | |
291 | { return llt_inplace<Upper>::blocked(m)==-1; } | |
292 | }; | |
293 | ||
294 | } // end namespace internal | |
295 | ||
296 | /** Computes / recomputes the Cholesky decomposition A = LL^* = U^*U of \a matrix | |
297 | * | |
298 | * | |
299 | * \returns a reference to *this | |
300 | */ | |
301 | template<typename MatrixType, int _UpLo> | |
302 | LLT<MatrixType,_UpLo>& LLT<MatrixType,_UpLo>::compute(const MatrixType& a) | |
303 | { | |
304 | assert(a.rows()==a.cols()); | |
305 | const Index size = a.rows(); | |
306 | m_matrix.resize(size, size); | |
307 | m_matrix = a; | |
308 | ||
309 | m_isInitialized = true; | |
310 | bool ok = Traits::inplace_decomposition(m_matrix); | |
311 | m_info = ok ? Success : NumericalIssue; | |
312 | ||
313 | return *this; | |
314 | } | |
315 | ||
316 | namespace internal { | |
317 | template<typename _MatrixType, int UpLo, typename Rhs> | |
318 | struct solve_retval<LLT<_MatrixType, UpLo>, Rhs> | |
319 | : solve_retval_base<LLT<_MatrixType, UpLo>, Rhs> | |
320 | { | |
321 | typedef LLT<_MatrixType,UpLo> LLTType; | |
322 | EIGEN_MAKE_SOLVE_HELPERS(LLTType,Rhs) | |
323 | ||
324 | template<typename Dest> void evalTo(Dest& dst) const | |
325 | { | |
326 | dst = rhs(); | |
327 | dec().solveInPlace(dst); | |
328 | } | |
329 | }; | |
330 | } | |
331 | ||
332 | /** \internal use x = llt_object.solve(x); | |
333 | * | |
334 | * This is the \em in-place version of solve(). | |
335 | * | |
336 | * \param bAndX represents both the right-hand side matrix b and result x. | |
337 | * | |
338 | * \returns true always! If you need to check for existence of solutions, use another decomposition like LU, QR, or SVD. | |
339 | * | |
340 | * This version avoids a copy when the right hand side matrix b is not | |
341 | * needed anymore. | |
342 | * | |
343 | * \sa LLT::solve(), MatrixBase::llt() | |
344 | */ | |
345 | template<typename MatrixType, int _UpLo> | |
346 | template<typename Derived> | |
347 | void LLT<MatrixType,_UpLo>::solveInPlace(MatrixBase<Derived> &bAndX) const | |
348 | { | |
349 | eigen_assert(m_isInitialized && "LLT is not initialized."); | |
350 | eigen_assert(m_matrix.rows()==bAndX.rows()); | |
351 | matrixL().solveInPlace(bAndX); | |
352 | matrixU().solveInPlace(bAndX); | |
353 | } | |
354 | ||
355 | /** \returns the matrix represented by the decomposition, | |
356 | * i.e., it returns the product: L L^*. | |
357 | * This function is provided for debug purpose. */ | |
358 | template<typename MatrixType, int _UpLo> | |
359 | MatrixType LLT<MatrixType,_UpLo>::reconstructedMatrix() const | |
360 | { | |
361 | eigen_assert(m_isInitialized && "LLT is not initialized."); | |
362 | return matrixL() * matrixL().adjoint().toDenseMatrix(); | |
363 | } | |
364 | ||
365 | /** \cholesky_module | |
366 | * \returns the LLT decomposition of \c *this | |
367 | */ | |
368 | template<typename Derived> | |
369 | inline const LLT<typename MatrixBase<Derived>::PlainObject> | |
370 | MatrixBase<Derived>::llt() const | |
371 | { | |
372 | return LLT<PlainObject>(derived()); | |
373 | } | |
374 | ||
375 | /** \cholesky_module | |
376 | * \returns the LLT decomposition of \c *this | |
377 | */ | |
378 | template<typename MatrixType, unsigned int UpLo> | |
379 | inline const LLT<typename SelfAdjointView<MatrixType, UpLo>::PlainObject, UpLo> | |
380 | SelfAdjointView<MatrixType, UpLo>::llt() const | |
381 | { | |
382 | return LLT<PlainObject,UpLo>(m_matrix); | |
383 | } | |
384 | ||
385 | #endif // EIGEN_LLT_H |
0 | // This file is part of Eigen, a lightweight C++ template library | |
1 | // for linear algebra. | |
2 | // | |
3 | // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr> | |
4 | // | |
5 | // Eigen is free software; you can redistribute it and/or | |
6 | // modify it under the terms of the GNU Lesser General Public | |
7 | // License as published by the Free Software Foundation; either | |
8 | // version 3 of the License, or (at your option) any later version. | |
9 | // | |
10 | // Alternatively, you can redistribute it and/or | |
11 | // modify it under the terms of the GNU General Public License as | |
12 | // published by the Free Software Foundation; either version 2 of | |
13 | // the License, or (at your option) any later version. | |
14 | // | |
15 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY | |
16 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
17 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the | |
18 | // GNU General Public License for more details. | |
19 | // | |
20 | // You should have received a copy of the GNU Lesser General Public | |
21 | // License and a copy of the GNU General Public License along with | |
22 | // Eigen. If not, see <http://www.gnu.org/licenses/>. | |
23 | ||
24 | #ifndef EIGEN_ARRAY_H | |
25 | #define EIGEN_ARRAY_H | |
26 | ||
27 | /** \class Array | |
28 | * \ingroup Core_Module | |
29 | * | |
30 | * \brief General-purpose arrays with easy API for coefficient-wise operations | |
31 | * | |
32 | * The %Array class is very similar to the Matrix class. It provides | |
33 | * general-purpose one- and two-dimensional arrays. The difference between the | |
34 | * %Array and the %Matrix class is primarily in the API: the API for the | |
35 | * %Array class provides easy access to coefficient-wise operations, while the | |
36 | * API for the %Matrix class provides easy access to linear-algebra | |
37 | * operations. | |
38 | * | |
39 | * This class can be extended with the help of the plugin mechanism described on the page | |
40 | * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_ARRAY_PLUGIN. | |
41 | * | |
42 | * \sa \ref TutorialArrayClass, \ref TopicClassHierarchy | |
43 | */ | |
44 | namespace internal { | |
45 | template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols> | |
46 | struct traits<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > : traits<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > | |
47 | { | |
48 | typedef ArrayXpr XprKind; | |
49 | typedef ArrayBase<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > XprBase; | |
50 | }; | |
51 | } | |
52 | ||
53 | template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols> | |
54 | class Array | |
55 | : public PlainObjectBase<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > | |
56 | { | |
57 | public: | |
58 | ||
59 | typedef PlainObjectBase<Array> Base; | |
60 | EIGEN_DENSE_PUBLIC_INTERFACE(Array) | |
61 | ||
62 | enum { Options = _Options }; | |
63 | typedef typename Base::PlainObject PlainObject; | |
64 | ||
65 | protected: | |
66 | template <typename Derived, typename OtherDerived, bool IsVector> | |
67 | friend struct internal::conservative_resize_like_impl; | |
68 | ||
69 | using Base::m_storage; | |
70 | ||
71 | public: | |
72 | ||
73 | using Base::base; | |
74 | using Base::coeff; | |
75 | using Base::coeffRef; | |
76 | ||
77 | /** | |
78 | * The usage of | |
79 | * using Base::operator=; | |
80 | * fails on MSVC. Since the code below is working with GCC and MSVC, we skipped | |
81 | * the usage of 'using'. This should be done only for operator=. | |
82 | */ | |
83 | template<typename OtherDerived> | |
84 | EIGEN_STRONG_INLINE Array& operator=(const EigenBase<OtherDerived> &other) | |
85 | { | |
86 | return Base::operator=(other); | |
87 | } | |
88 | ||
89 | /** Copies the value of the expression \a other into \c *this with automatic resizing. | |
90 | * | |
91 | * *this might be resized to match the dimensions of \a other. If *this was a null matrix (not already initialized), | |
92 | * it will be initialized. | |
93 | * | |
94 | * Note that copying a row-vector into a vector (and conversely) is allowed. | |
95 | * The resizing, if any, is then done in the appropriate way so that row-vectors | |
96 | * remain row-vectors and vectors remain vectors. | |
97 | */ | |
98 | template<typename OtherDerived> | |
99 | EIGEN_STRONG_INLINE Array& operator=(const ArrayBase<OtherDerived>& other) | |
100 | { | |
101 | return Base::_set(other); | |
102 | } | |
103 | ||
104 | /** This is a special case of the templated operator=. Its purpose is to | |
105 | * prevent a default operator= from hiding the templated operator=. | |
106 | */ | |
107 | EIGEN_STRONG_INLINE Array& operator=(const Array& other) | |
108 | { | |
109 | return Base::_set(other); | |
110 | } | |
111 | ||
112 | /** Default constructor. | |
113 | * | |
114 | * For fixed-size matrices, does nothing. | |
115 | * | |
116 | * For dynamic-size matrices, creates an empty matrix of size 0. Does not allocate any array. Such a matrix | |
117 | * is called a null matrix. This constructor is the unique way to create null matrices: resizing | |
118 | * a matrix to 0 is not supported. | |
119 | * | |
120 | * \sa resize(Index,Index) | |
121 | */ | |
122 | EIGEN_STRONG_INLINE explicit Array() : Base() | |
123 | { | |
124 | Base::_check_template_params(); | |
125 | EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED | |
126 | } | |
127 | ||
128 | #ifndef EIGEN_PARSED_BY_DOXYGEN | |
129 | // FIXME is it still needed ?? | |
130 | /** \internal */ | |
131 | Array(internal::constructor_without_unaligned_array_assert) | |
132 | : Base(internal::constructor_without_unaligned_array_assert()) | |
133 | { | |
134 | Base::_check_template_params(); | |
135 | EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED | |
136 | } | |
137 | #endif | |
138 | ||
139 | /** Constructs a vector or row-vector with given dimension. \only_for_vectors | |
140 | * | |
141 | * Note that this is only useful for dynamic-size vectors. For fixed-size vectors, | |
142 | * it is redundant to pass the dimension here, so it makes more sense to use the default | |
143 | * constructor Matrix() instead. | |
144 | */ | |
145 | EIGEN_STRONG_INLINE explicit Array(Index dim) | |
146 | : Base(dim, RowsAtCompileTime == 1 ? 1 : dim, ColsAtCompileTime == 1 ? 1 : dim) | |
147 | { | |
148 | Base::_check_template_params(); | |
149 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Array) | |
150 | eigen_assert(dim >= 0); | |
151 | eigen_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == dim); | |
152 | EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED | |
153 | } | |
154 | ||
155 | #ifndef EIGEN_PARSED_BY_DOXYGEN | |
156 | template<typename T0, typename T1> | |
157 | EIGEN_STRONG_INLINE Array(const T0& x, const T1& y) | |
158 | { | |
159 | Base::_check_template_params(); | |
160 | this->template _init2<T0,T1>(x, y); | |
161 | } | |
162 | #else | |
163 | /** constructs an uninitialized matrix with \a rows rows and \a cols columns. | |
164 | * | |
165 | * This is useful for dynamic-size matrices. For fixed-size matrices, | |
166 | * it is redundant to pass these parameters, so one should use the default constructor | |
167 | * Matrix() instead. */ | |
168 | Array(Index rows, Index cols); | |
169 | /** constructs an initialized 2D vector with given coefficients */ | |
170 | Array(const Scalar& x, const Scalar& y); | |
171 | #endif | |
172 | ||
173 | /** constructs an initialized 3D vector with given coefficients */ | |
174 | EIGEN_STRONG_INLINE Array(const Scalar& x, const Scalar& y, const Scalar& z) | |
175 | { | |
176 | Base::_check_template_params(); | |
177 | EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Array, 3) | |
178 | m_storage.data()[0] = x; | |
179 | m_storage.data()[1] = y; | |
180 | m_storage.data()[2] = z; | |
181 | } | |
182 | /** constructs an initialized 4D vector with given coefficients */ | |
183 | EIGEN_STRONG_INLINE Array(const Scalar& x, const Scalar& y, const Scalar& z, const Scalar& w) | |
184 | { | |
185 | Base::_check_template_params(); | |
186 | EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Array, 4) | |
187 | m_storage.data()[0] = x; | |
188 | m_storage.data()[1] = y; | |
189 | m_storage.data()[2] = z; | |
190 | m_storage.data()[3] = w; | |
191 | } | |
192 | ||
193 | explicit Array(const Scalar *data); | |
194 | ||
195 | /** Constructor copying the value of the expression \a other */ | |
196 | template<typename OtherDerived> | |
197 | EIGEN_STRONG_INLINE Array(const ArrayBase<OtherDerived>& other) | |
198 | : Base(other.rows() * other.cols(), other.rows(), other.cols()) | |
199 | { | |
200 | Base::_check_template_params(); | |
201 | Base::_set_noalias(other); | |
202 | } | |
203 | /** Copy constructor */ | |
204 | EIGEN_STRONG_INLINE Array(const Array& other) | |
205 | : Base(other.rows() * other.cols(), other.rows(), other.cols()) | |
206 | { | |
207 | Base::_check_template_params(); | |
208 | Base::_set_noalias(other); | |
209 | } | |
210 | /** Copy constructor with in-place evaluation */ | |
211 | template<typename OtherDerived> | |
212 | EIGEN_STRONG_INLINE Array(const ReturnByValue<OtherDerived>& other) | |
213 | { | |
214 | Base::_check_template_params(); | |
215 | Base::resize(other.rows(), other.cols()); | |
216 | other.evalTo(*this); | |
217 | } | |
218 | ||
219 | /** \sa MatrixBase::operator=(const EigenBase<OtherDerived>&) */ | |
220 | template<typename OtherDerived> | |
221 | EIGEN_STRONG_INLINE Array(const EigenBase<OtherDerived> &other) | |
222 | : Base(other.derived().rows() * other.derived().cols(), other.derived().rows(), other.derived().cols()) | |
223 | { | |
224 | Base::_check_template_params(); | |
225 | Base::resize(other.rows(), other.cols()); | |
226 | *this = other; | |
227 | } | |
228 | ||
229 | /** Override MatrixBase::swap() since for dynamic-sized matrices of same type it is enough to swap the | |
230 | * data pointers. | |
231 | */ | |
232 | template<typename OtherDerived> | |
233 | void swap(ArrayBase<OtherDerived> const & other) | |
234 | { this->_swap(other.derived()); } | |
235 | ||
236 | inline Index innerStride() const { return 1; } | |
237 | inline Index outerStride() const { return this->innerSize(); } | |
238 | ||
239 | #ifdef EIGEN_ARRAY_PLUGIN | |
240 | #include EIGEN_ARRAY_PLUGIN | |
241 | #endif | |
242 | ||
243 | private: | |
244 | ||
245 | template<typename MatrixType, typename OtherDerived, bool SwapPointers> | |
246 | friend struct internal::matrix_swap_impl; | |
247 | }; | |
248 | ||
249 | /** \defgroup arraytypedefs Global array typedefs | |
250 | * \ingroup Core_Module | |
251 | * | |
252 | * Eigen defines several typedef shortcuts for most common 1D and 2D array types. | |
253 | * | |
254 | * The general patterns are the following: | |
255 | * | |
256 | * \c ArrayRowsColsType where \c Rows and \c Cols can be \c 2,\c 3,\c 4 for fixed size square matrices or \c X for dynamic size, | |
257 | * and where \c Type can be \c i for integer, \c f for float, \c d for double, \c cf for complex float, \c cd | |
258 | * for complex double. | |
259 | * | |
260 | * For example, \c Array33d is a fixed-size 3x3 array type of doubles, and \c ArrayXXf is a dynamic-size matrix of floats. | |
261 | * | |
262 | * There are also \c ArraySizeType which are self-explanatory. For example, \c Array4cf is | |
263 | * a fixed-size 1D array of 4 complex floats. | |
264 | * | |
265 | * \sa class Array | |
266 | */ | |
267 | ||
268 | #define EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \ | |
269 | /** \ingroup arraytypedefs */ \ | |
270 | typedef Array<Type, Size, Size> Array##SizeSuffix##SizeSuffix##TypeSuffix; \ | |
271 | /** \ingroup arraytypedefs */ \ | |
272 | typedef Array<Type, Size, 1> Array##SizeSuffix##TypeSuffix; | |
273 | ||
274 | #define EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, Size) \ | |
275 | /** \ingroup arraytypedefs */ \ | |
276 | typedef Array<Type, Size, Dynamic> Array##Size##X##TypeSuffix; \ | |
277 | /** \ingroup arraytypedefs */ \ | |
278 | typedef Array<Type, Dynamic, Size> Array##X##Size##TypeSuffix; | |
279 | ||
280 | #define EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \ | |
281 | EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, 2, 2) \ | |
282 | EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, 3, 3) \ | |
283 | EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, 4, 4) \ | |
284 | EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, Dynamic, X) \ | |
285 | EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, 2) \ | |
286 | EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, 3) \ | |
287 | EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, 4) | |
288 | ||
289 | EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(int, i) | |
290 | EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(float, f) | |
291 | EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(double, d) | |
292 | EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(std::complex<float>, cf) | |
293 | EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(std::complex<double>, cd) | |
294 | ||
295 | #undef EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES | |
296 | #undef EIGEN_MAKE_ARRAY_TYPEDEFS | |
297 | ||
298 | #undef EIGEN_MAKE_ARRAY_TYPEDEFS_LARGE | |
299 | ||
300 | #define EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, SizeSuffix) \ | |
301 | using Eigen::Matrix##SizeSuffix##TypeSuffix; \ |