From 3bbb49d71672e9099175ef31ef821672529361a1 Mon Sep 17 00:00:00 2001 From: Alex Cunningham Date: Fri, 17 Jun 2011 15:15:39 +0000 Subject: [PATCH] Adding untouched copies of the Eigen and CCOLAMD --- gtsam/3rdparty/CCOLAMD/Demo/ccolamd_example | Bin 0 -> 34002 bytes gtsam/3rdparty/CCOLAMD/Demo/ccolamd_example.c | 185 + .../3rdparty/CCOLAMD/Demo/ccolamd_example.out | 50 + gtsam/3rdparty/CCOLAMD/Demo/ccolamd_l_example | Bin 0 -> 34027 bytes .../3rdparty/CCOLAMD/Demo/ccolamd_l_example.c | 188 + .../CCOLAMD/Demo/ccolamd_l_example.out | 50 + .../CCOLAMD/Demo/my_ccolamd_example.out | 50 + .../CCOLAMD/Demo/my_ccolamd_l_example.out | 50 + gtsam/3rdparty/CCOLAMD/Doc/ChangeLog | 44 + gtsam/3rdparty/CCOLAMD/Doc/lesser.txt | 504 ++ gtsam/3rdparty/CCOLAMD/Include/ccolamd.h | 365 ++ gtsam/3rdparty/CCOLAMD/Lib/ccolamd.o | Bin 0 -> 29848 bytes gtsam/3rdparty/CCOLAMD/Lib/ccolamd_global.o | Bin 0 -> 1112 bytes gtsam/3rdparty/CCOLAMD/Lib/ccolamd_l.o | Bin 0 -> 29328 bytes gtsam/3rdparty/CCOLAMD/Lib/libccolamd.a | Bin 0 -> 61080 bytes gtsam/3rdparty/CCOLAMD/MATLAB/Contents.m | 20 + gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd.m | 48 + gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_demo.m | 209 + .../3rdparty/CCOLAMD/MATLAB/ccolamd_install.m | 18 + gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_make.m | 29 + gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_test.m | 485 ++ gtsam/3rdparty/CCOLAMD/MATLAB/ccolamdmex.c | 228 + .../3rdparty/CCOLAMD/MATLAB/ccolamdtestmex.c | 533 ++ .../3rdparty/CCOLAMD/MATLAB/ccolamdtestmex.m | 10 + gtsam/3rdparty/CCOLAMD/MATLAB/csymamd.m | 48 + gtsam/3rdparty/CCOLAMD/MATLAB/csymamdmex.c | 208 + .../3rdparty/CCOLAMD/MATLAB/csymamdtestmex.c | 502 ++ .../3rdparty/CCOLAMD/MATLAB/csymamdtestmex.m | 10 + gtsam/3rdparty/CCOLAMD/MATLAB/luflops.m | 33 + gtsam/3rdparty/CCOLAMD/README.txt | 150 + gtsam/3rdparty/CCOLAMD/Source/ccolamd.c | 4620 +++++++++++++++++ .../3rdparty/CCOLAMD/Source/ccolamd_global.c | 25 + gtsam/3rdparty/Eigen/CMakeLists.txt | 393 ++ gtsam/3rdparty/Eigen/COPYING.GPL | 674 +++ gtsam/3rdparty/Eigen/COPYING.LGPL | 165 + gtsam/3rdparty/Eigen/CTestConfig.cmake | 13 + gtsam/3rdparty/Eigen/CTestCustom.cmake.in | 4 + gtsam/3rdparty/Eigen/Eigen/Array | 11 + gtsam/3rdparty/Eigen/Eigen/CMakeLists.txt | 19 + gtsam/3rdparty/Eigen/Eigen/Cholesky | 33 + gtsam/3rdparty/Eigen/Eigen/Core | 367 ++ gtsam/3rdparty/Eigen/Eigen/Dense | 7 + gtsam/3rdparty/Eigen/Eigen/Eigen | 2 + gtsam/3rdparty/Eigen/Eigen/Eigen2Support | 82 + gtsam/3rdparty/Eigen/Eigen/Eigenvalues | 44 + gtsam/3rdparty/Eigen/Eigen/Geometry | 67 + gtsam/3rdparty/Eigen/Eigen/Householder | 27 + gtsam/3rdparty/Eigen/Eigen/Jacobi | 30 + gtsam/3rdparty/Eigen/Eigen/LU | 42 + gtsam/3rdparty/Eigen/Eigen/LeastSquares | 36 + gtsam/3rdparty/Eigen/Eigen/QR | 45 + gtsam/3rdparty/Eigen/Eigen/QtAlignedMalloc | 34 + gtsam/3rdparty/Eigen/Eigen/SVD | 38 + gtsam/3rdparty/Eigen/Eigen/Sparse | 69 + gtsam/3rdparty/Eigen/Eigen/StdDeque | 42 + gtsam/3rdparty/Eigen/Eigen/StdList | 41 + gtsam/3rdparty/Eigen/Eigen/StdVector | 42 + gtsam/3rdparty/Eigen/Eigen/src/CMakeLists.txt | 7 + .../Eigen/Eigen/src/Cholesky/CMakeLists.txt | 6 + .../3rdparty/Eigen/Eigen/src/Cholesky/LDLT.h | 461 ++ gtsam/3rdparty/Eigen/Eigen/src/Cholesky/LLT.h | 386 ++ gtsam/3rdparty/Eigen/Eigen/src/Core/Array.h | 322 ++ .../3rdparty/Eigen/Eigen/src/Core/ArrayBase.h | 239 + .../Eigen/Eigen/src/Core/ArrayWrapper.h | 239 + gtsam/3rdparty/Eigen/Eigen/src/Core/Assign.h | 593 +++ .../Eigen/Eigen/src/Core/BandMatrix.h | 345 ++ gtsam/3rdparty/Eigen/Eigen/src/Core/Block.h | 349 ++ .../Eigen/Eigen/src/Core/BooleanRedux.h | 149 + .../Eigen/Eigen/src/Core/CMakeLists.txt | 10 + .../Eigen/Eigen/src/Core/CommaInitializer.h | 150 + .../Eigen/Eigen/src/Core/CwiseBinaryOp.h | 240 + .../Eigen/Eigen/src/Core/CwiseNullaryOp.h | 851 +++ .../Eigen/Eigen/src/Core/CwiseUnaryOp.h | 137 + .../Eigen/Eigen/src/Core/CwiseUnaryView.h | 148 + .../3rdparty/Eigen/Eigen/src/Core/DenseBase.h | 543 ++ .../Eigen/Eigen/src/Core/DenseCoeffsBase.h | 765 +++ .../Eigen/Eigen/src/Core/DenseStorage.h | 304 ++ .../3rdparty/Eigen/Eigen/src/Core/Diagonal.h | 227 + .../Eigen/Eigen/src/Core/DiagonalMatrix.h | 306 ++ .../Eigen/Eigen/src/Core/DiagonalProduct.h | 135 + gtsam/3rdparty/Eigen/Eigen/src/Core/Dot.h | 268 + .../3rdparty/Eigen/Eigen/src/Core/EigenBase.h | 172 + gtsam/3rdparty/Eigen/Eigen/src/Core/Flagged.h | 151 + .../Eigen/Eigen/src/Core/ForceAlignedAccess.h | 157 + .../3rdparty/Eigen/Eigen/src/Core/Functors.h | 942 ++++ gtsam/3rdparty/Eigen/Eigen/src/Core/Fuzzy.h | 161 + .../Eigen/Eigen/src/Core/GenericPacketMath.h | 339 ++ .../Eigen/Eigen/src/Core/GlobalFunctions.h | 95 + gtsam/3rdparty/Eigen/Eigen/src/Core/IO.h | 260 + gtsam/3rdparty/Eigen/Eigen/src/Core/Map.h | 205 + gtsam/3rdparty/Eigen/Eigen/src/Core/MapBase.h | 255 + .../Eigen/Eigen/src/Core/MathFunctions.h | 843 +++ gtsam/3rdparty/Eigen/Eigen/src/Core/Matrix.h | 439 ++ .../Eigen/Eigen/src/Core/MatrixBase.h | 520 ++ .../Eigen/Eigen/src/Core/NestByValue.h | 122 + gtsam/3rdparty/Eigen/Eigen/src/Core/NoAlias.h | 136 + .../3rdparty/Eigen/Eigen/src/Core/NumTraits.h | 160 + .../Eigen/Eigen/src/Core/PermutationMatrix.h | 696 +++ .../Eigen/Eigen/src/Core/PlainObjectBase.h | 740 +++ gtsam/3rdparty/Eigen/Eigen/src/Core/Product.h | 625 +++ .../Eigen/Eigen/src/Core/ProductBase.h | 288 + gtsam/3rdparty/Eigen/Eigen/src/Core/Random.h | 163 + gtsam/3rdparty/Eigen/Eigen/src/Core/Redux.h | 404 ++ .../3rdparty/Eigen/Eigen/src/Core/Replicate.h | 179 + .../Eigen/Eigen/src/Core/ReturnByValue.h | 99 + gtsam/3rdparty/Eigen/Eigen/src/Core/Reverse.h | 230 + gtsam/3rdparty/Eigen/Eigen/src/Core/Select.h | 158 + .../Eigen/Eigen/src/Core/SelfAdjointView.h | 325 ++ .../Eigen/Eigen/src/Core/SelfCwiseBinaryOp.h | 195 + .../Eigen/Eigen/src/Core/SolveTriangular.h | 263 + .../Eigen/Eigen/src/Core/StableNorm.h | 190 + gtsam/3rdparty/Eigen/Eigen/src/Core/Stride.h | 119 + gtsam/3rdparty/Eigen/Eigen/src/Core/Swap.h | 126 + .../3rdparty/Eigen/Eigen/src/Core/Transpose.h | 426 ++ .../Eigen/Eigen/src/Core/Transpositions.h | 447 ++ .../Eigen/Eigen/src/Core/TriangularMatrix.h | 837 +++ .../Eigen/Eigen/src/Core/VectorBlock.h | 296 ++ .../Eigen/Eigen/src/Core/VectorwiseOp.h | 557 ++ gtsam/3rdparty/Eigen/Eigen/src/Core/Visitor.h | 248 + .../src/Core/arch/AltiVec/CMakeLists.txt | 6 + .../Eigen/src/Core/arch/AltiVec/Complex.h | 228 + .../Eigen/src/Core/arch/AltiVec/PacketMath.h | 509 ++ .../Eigen/Eigen/src/Core/arch/CMakeLists.txt | 4 + .../src/Core/arch/Default/CMakeLists.txt | 6 + .../Eigen/src/Core/arch/Default/Settings.h | 64 + .../Eigen/src/Core/arch/NEON/CMakeLists.txt | 6 + .../Eigen/Eigen/src/Core/arch/NEON/Complex.h | 270 + .../Eigen/src/Core/arch/NEON/PacketMath.h | 420 ++ .../Eigen/src/Core/arch/SSE/CMakeLists.txt | 6 + .../Eigen/Eigen/src/Core/arch/SSE/Complex.h | 447 ++ .../Eigen/src/Core/arch/SSE/MathFunctions.h | 395 ++ .../Eigen/src/Core/arch/SSE/PacketMath.h | 634 +++ .../Eigen/src/Core/products/CMakeLists.txt | 6 + .../src/Core/products/CoeffBasedProduct.h | 452 ++ .../Core/products/GeneralBlockPanelKernel.h | 1285 +++++ .../src/Core/products/GeneralMatrixMatrix.h | 439 ++ .../products/GeneralMatrixMatrixTriangular.h | 225 + .../src/Core/products/GeneralMatrixVector.h | 559 ++ .../Eigen/src/Core/products/Parallelizer.h | 154 + .../Core/products/SelfadjointMatrixMatrix.h | 427 ++ .../Core/products/SelfadjointMatrixVector.h | 278 + .../src/Core/products/SelfadjointProduct.h | 136 + .../Core/products/SelfadjointRank2Update.h | 104 + .../Core/products/TriangularMatrixMatrix.h | 403 ++ .../Core/products/TriangularMatrixVector.h | 325 ++ .../Core/products/TriangularSolverMatrix.h | 319 ++ .../Core/products/TriangularSolverVector.h | 150 + .../Eigen/Eigen/src/Core/util/BlasUtil.h | 271 + .../Eigen/Eigen/src/Core/util/CMakeLists.txt | 6 + .../Eigen/Eigen/src/Core/util/Constants.h | 439 ++ .../src/Core/util/DisableStupidWarnings.h | 42 + .../Eigen/src/Core/util/ForwardDeclarations.h | 307 ++ .../Eigen/Eigen/src/Core/util/Macros.h | 418 ++ .../Eigen/Eigen/src/Core/util/Memory.h | 911 ++++ .../3rdparty/Eigen/Eigen/src/Core/util/Meta.h | 229 + .../src/Core/util/ReenableStupidWarnings.h | 14 + .../Eigen/Eigen/src/Core/util/StaticAssert.h | 198 + .../Eigen/Eigen/src/Core/util/XprHelper.h | 460 ++ .../Eigen/Eigen/src/Eigen2Support/Block.h | 137 + .../Eigen/src/Eigen2Support/CMakeLists.txt | 8 + .../Eigen/Eigen/src/Eigen2Support/Cwise.h | 199 + .../Eigen/src/Eigen2Support/CwiseOperators.h | 327 ++ .../src/Eigen2Support/Geometry/AlignedBox.h | 170 + .../Eigen/src/Eigen2Support/Geometry/All.h | 115 + .../src/Eigen2Support/Geometry/AngleAxis.h | 226 + .../src/Eigen2Support/Geometry/CMakeLists.txt | 6 + .../src/Eigen2Support/Geometry/Hyperplane.h | 265 + .../Eigen2Support/Geometry/ParametrizedLine.h | 153 + .../src/Eigen2Support/Geometry/Quaternion.h | 506 ++ .../src/Eigen2Support/Geometry/Rotation2D.h | 157 + .../src/Eigen2Support/Geometry/RotationBase.h | 134 + .../src/Eigen2Support/Geometry/Scaling.h | 179 + .../src/Eigen2Support/Geometry/Transform.h | 798 +++ .../src/Eigen2Support/Geometry/Translation.h | 196 + .../Eigen/Eigen/src/Eigen2Support/LU.h | 133 + .../Eigen/Eigen/src/Eigen2Support/Lazy.h | 82 + .../Eigen/src/Eigen2Support/LeastSquares.h | 182 + .../Eigen/Eigen/src/Eigen2Support/Macros.h | 35 + .../Eigen/src/Eigen2Support/MathFunctions.h | 68 + .../Eigen/Eigen/src/Eigen2Support/Memory.h | 58 + .../Eigen/Eigen/src/Eigen2Support/Meta.h | 86 + .../Eigen/Eigen/src/Eigen2Support/Minor.h | 128 + .../Eigen/Eigen/src/Eigen2Support/QR.h | 79 + .../Eigen/Eigen/src/Eigen2Support/SVD.h | 649 +++ .../src/Eigen2Support/TriangularSolver.h | 53 + .../Eigen/src/Eigen2Support/VectorBlock.h | 105 + .../Eigen/src/Eigenvalues/CMakeLists.txt | 6 + .../src/Eigenvalues/ComplexEigenSolver.h | 332 ++ .../Eigen/src/Eigenvalues/ComplexSchur.h | 448 ++ .../Eigen/Eigen/src/Eigenvalues/EigenSolver.h | 588 +++ .../Eigen/src/Eigenvalues/EigenvaluesCommon.h | 31 + .../GeneralizedSelfAdjointEigenSolver.h | 239 + .../src/Eigenvalues/HessenbergDecomposition.h | 384 ++ .../src/Eigenvalues/MatrixBaseEigenvalues.h | 170 + .../Eigen/Eigen/src/Eigenvalues/RealSchur.h | 474 ++ .../src/Eigenvalues/SelfAdjointEigenSolver.h | 520 ++ .../src/Eigenvalues/Tridiagonalization.h | 568 ++ .../Eigen/Eigen/src/Geometry/AlignedBox.h | 352 ++ .../Eigen/Eigen/src/Geometry/AngleAxis.h | 241 + .../Eigen/Eigen/src/Geometry/CMakeLists.txt | 8 + .../Eigen/Eigen/src/Geometry/EulerAngles.h | 96 + .../Eigen/Eigen/src/Geometry/Homogeneous.h | 318 ++ .../Eigen/Eigen/src/Geometry/Hyperplane.h | 280 + .../Eigen/Eigen/src/Geometry/OrthoMethods.h | 229 + .../Eigen/src/Geometry/ParametrizedLine.h | 168 + .../Eigen/Eigen/src/Geometry/Quaternion.h | 751 +++ .../Eigen/Eigen/src/Geometry/Rotation2D.h | 165 + .../Eigen/Eigen/src/Geometry/RotationBase.h | 217 + .../Eigen/Eigen/src/Geometry/Scaling.h | 182 + .../Eigen/Eigen/src/Geometry/Transform.h | 1396 +++++ .../Eigen/Eigen/src/Geometry/Translation.h | 215 + .../Eigen/Eigen/src/Geometry/Umeyama.h | 183 + .../Eigen/src/Geometry/arch/CMakeLists.txt | 6 + .../Eigen/src/Geometry/arch/Geometry_SSE.h | 126 + .../Eigen/src/Householder/BlockHouseholder.h | 79 + .../Eigen/src/Householder/CMakeLists.txt | 6 + .../Eigen/Eigen/src/Householder/Householder.h | 133 + .../src/Householder/HouseholderSequence.h | 429 ++ .../Eigen/Eigen/src/Jacobi/CMakeLists.txt | 6 + .../3rdparty/Eigen/Eigen/src/Jacobi/Jacobi.h | 430 ++ .../Eigen/Eigen/src/LU/CMakeLists.txt | 8 + .../3rdparty/Eigen/Eigen/src/LU/Determinant.h | 112 + gtsam/3rdparty/Eigen/Eigen/src/LU/FullPivLU.h | 754 +++ gtsam/3rdparty/Eigen/Eigen/src/LU/Inverse.h | 407 ++ .../Eigen/Eigen/src/LU/PartialPivLU.h | 509 ++ .../Eigen/Eigen/src/LU/arch/CMakeLists.txt | 6 + .../Eigen/Eigen/src/LU/arch/Inverse_SSE.h | 340 ++ .../Eigen/Eigen/src/QR/CMakeLists.txt | 6 + .../Eigen/Eigen/src/QR/ColPivHouseholderQR.h | 532 ++ .../Eigen/Eigen/src/QR/FullPivHouseholderQR.h | 546 ++ .../Eigen/Eigen/src/QR/HouseholderQR.h | 355 ++ .../Eigen/Eigen/src/SVD/CMakeLists.txt | 6 + .../3rdparty/Eigen/Eigen/src/SVD/JacobiSVD.h | 716 +++ .../Eigen/src/SVD/UpperBidiagonalization.h | 159 + .../Eigen/Eigen/src/Sparse/AmbiVector.h | 379 ++ .../Eigen/Eigen/src/Sparse/CMakeLists.txt | 6 + .../Eigen/src/Sparse/CompressedStorage.h | 239 + .../Eigen/Eigen/src/Sparse/CoreIterators.h | 71 + .../Eigen/src/Sparse/DynamicSparseMatrix.h | 346 ++ .../Eigen/src/Sparse/MappedSparseMatrix.h | 165 + .../Eigen/Eigen/src/Sparse/SparseAssign.h | 0 .../Eigen/Eigen/src/Sparse/SparseBlock.h | 465 ++ .../Eigen/src/Sparse/SparseCwiseBinaryOp.h | 375 ++ .../Eigen/src/Sparse/SparseCwiseUnaryOp.h | 146 + .../Eigen/src/Sparse/SparseDenseProduct.h | 231 + .../Eigen/src/Sparse/SparseDiagonalProduct.h | 195 + .../Eigen/Eigen/src/Sparse/SparseDot.h | 97 + .../Eigen/Eigen/src/Sparse/SparseFuzzy.h | 41 + .../Eigen/Eigen/src/Sparse/SparseMatrix.h | 651 +++ .../Eigen/Eigen/src/Sparse/SparseMatrixBase.h | 706 +++ .../Eigen/Eigen/src/Sparse/SparseProduct.h | 141 + .../Eigen/Eigen/src/Sparse/SparseRedux.h | 56 + .../Eigen/src/Sparse/SparseSelfAdjointView.h | 454 ++ .../Eigen/src/Sparse/SparseSparseProduct.h | 401 ++ .../Eigen/Eigen/src/Sparse/SparseTranspose.h | 68 + .../Eigen/src/Sparse/SparseTriangularView.h | 100 + .../Eigen/Eigen/src/Sparse/SparseUtil.h | 130 + .../Eigen/Eigen/src/Sparse/SparseVector.h | 431 ++ .../Eigen/Eigen/src/Sparse/SparseView.h | 109 + .../Eigen/Eigen/src/Sparse/TriangularSolver.h | 339 ++ .../Eigen/Eigen/src/StlSupport/CMakeLists.txt | 6 + .../Eigen/Eigen/src/StlSupport/StdDeque.h | 149 + .../Eigen/Eigen/src/StlSupport/StdList.h | 129 + .../Eigen/Eigen/src/StlSupport/StdVector.h | 149 + .../Eigen/Eigen/src/StlSupport/details.h | 99 + .../Eigen/Eigen/src/misc/CMakeLists.txt | 6 + gtsam/3rdparty/Eigen/Eigen/src/misc/Image.h | 95 + gtsam/3rdparty/Eigen/Eigen/src/misc/Kernel.h | 92 + gtsam/3rdparty/Eigen/Eigen/src/misc/Solve.h | 87 + .../Eigen/src/plugins/ArrayCwiseBinaryOps.h | 143 + .../Eigen/src/plugins/ArrayCwiseUnaryOps.h | 202 + .../Eigen/Eigen/src/plugins/BlockMethods.h | 595 +++ .../Eigen/Eigen/src/plugins/CMakeLists.txt | 6 + .../Eigen/src/plugins/CommonCwiseBinaryOps.h | 61 + .../Eigen/src/plugins/CommonCwiseUnaryOps.h | 187 + .../Eigen/src/plugins/MatrixCwiseBinaryOps.h | 120 + .../Eigen/src/plugins/MatrixCwiseUnaryOps.h | 82 + gtsam/3rdparty/Eigen/INSTALL | 35 + gtsam/3rdparty/Eigen/bench/BenchSparseUtil.h | 147 + gtsam/3rdparty/Eigen/bench/BenchTimer.h | 181 + gtsam/3rdparty/Eigen/bench/BenchUtil.h | 72 + gtsam/3rdparty/Eigen/bench/README.txt | 55 + gtsam/3rdparty/Eigen/bench/basicbench.cxxlist | 28 + gtsam/3rdparty/Eigen/bench/basicbenchmark.cpp | 35 + gtsam/3rdparty/Eigen/bench/basicbenchmark.h | 63 + gtsam/3rdparty/Eigen/bench/benchBlasGemm.cpp | 219 + gtsam/3rdparty/Eigen/bench/benchCholesky.cpp | 142 + .../3rdparty/Eigen/bench/benchEigenSolver.cpp | 212 + gtsam/3rdparty/Eigen/bench/benchFFT.cpp | 130 + gtsam/3rdparty/Eigen/bench/benchVecAdd.cpp | 135 + gtsam/3rdparty/Eigen/bench/bench_gemm.cpp | 270 + .../Eigen/bench/bench_multi_compilers.sh | 28 + gtsam/3rdparty/Eigen/bench/bench_norm.cpp | 345 ++ gtsam/3rdparty/Eigen/bench/bench_reverse.cpp | 84 + gtsam/3rdparty/Eigen/bench/bench_sum.cpp | 18 + gtsam/3rdparty/Eigen/bench/bench_unrolling | 12 + gtsam/3rdparty/Eigen/bench/benchmark.cpp | 39 + gtsam/3rdparty/Eigen/bench/benchmarkSlice.cpp | 38 + gtsam/3rdparty/Eigen/bench/benchmarkX.cpp | 36 + .../3rdparty/Eigen/bench/benchmarkXcwise.cpp | 35 + gtsam/3rdparty/Eigen/bench/benchmark_suite | 18 + gtsam/3rdparty/Eigen/bench/btl/CMakeLists.txt | 107 + gtsam/3rdparty/Eigen/bench/btl/COPYING | 340 ++ gtsam/3rdparty/Eigen/bench/btl/README | 154 + .../bench/btl/actions/action_aat_product.hh | 145 + .../bench/btl/actions/action_ata_product.hh | 145 + .../bench/btl/actions/action_atv_product.hh | 134 + .../Eigen/bench/btl/actions/action_axpby.hh | 127 + .../Eigen/bench/btl/actions/action_axpy.hh | 139 + .../bench/btl/actions/action_cholesky.hh | 128 + .../Eigen/bench/btl/actions/action_ger.hh | 128 + .../bench/btl/actions/action_hessenberg.hh | 230 + .../bench/btl/actions/action_lu_decomp.hh | 124 + .../bench/btl/actions/action_lu_solve.hh | 136 + .../actions/action_matrix_matrix_product.hh | 150 + .../action_matrix_matrix_product_bis.hh | 152 + .../actions/action_matrix_vector_product.hh | 153 + .../bench/btl/actions/action_partial_lu.hh | 125 + .../Eigen/bench/btl/actions/action_rot.hh | 116 + .../Eigen/bench/btl/actions/action_symv.hh | 139 + .../Eigen/bench/btl/actions/action_syr2.hh | 133 + .../bench/btl/actions/action_trisolve.hh | 137 + .../btl/actions/action_trisolve_matrix.hh | 165 + .../Eigen/bench/btl/actions/action_trmm.hh | 165 + .../Eigen/bench/btl/actions/basic_actions.hh | 21 + .../Eigen/bench/btl/cmake/FindACML.cmake | 49 + .../Eigen/bench/btl/cmake/FindATLAS.cmake | 39 + .../Eigen/bench/btl/cmake/FindBlitz.cmake | 40 + .../Eigen/bench/btl/cmake/FindCBLAS.cmake | 34 + .../Eigen/bench/btl/cmake/FindEigen3.cmake | 81 + .../Eigen/bench/btl/cmake/FindGMM.cmake | 17 + .../Eigen/bench/btl/cmake/FindGOTO.cmake | 15 + .../Eigen/bench/btl/cmake/FindGOTO2.cmake | 25 + .../Eigen/bench/btl/cmake/FindMKL.cmake | 65 + .../Eigen/bench/btl/cmake/FindMTL4.cmake | 31 + .../cmake/FindPackageHandleStandardArgs.cmake | 60 + .../Eigen/bench/btl/cmake/FindTvmet.cmake | 32 + .../cmake/MacroOptionalAddSubdirectory.cmake | 31 + .../Eigen/bench/btl/data/CMakeLists.txt | 32 + .../Eigen/bench/btl/data/action_settings.txt | 18 + .../bench/btl/data/gnuplot_common_settings.hh | 87 + gtsam/3rdparty/Eigen/bench/btl/data/go_mean | 57 + gtsam/3rdparty/Eigen/bench/btl/data/mean.cxx | 182 + .../Eigen/bench/btl/data/mk_gnuplot_script.sh | 68 + .../Eigen/bench/btl/data/mk_mean_script.sh | 52 + .../Eigen/bench/btl/data/mk_new_gnuplot.sh | 54 + .../bench/btl/data/perlib_plot_settings.txt | 14 + .../Eigen/bench/btl/data/regularize.cxx | 131 + .../3rdparty/Eigen/bench/btl/data/smooth.cxx | 198 + .../Eigen/bench/btl/data/smooth_all.sh | 68 + .../Eigen/bench/btl/generic_bench/bench.hh | 168 + .../btl/generic_bench/bench_parameter.hh | 53 + .../Eigen/bench/btl/generic_bench/btl.hh | 247 + .../btl/generic_bench/init/init_function.hh | 54 + .../btl/generic_bench/init/init_matrix.hh | 64 + .../btl/generic_bench/init/init_vector.hh | 37 + .../btl/generic_bench/static/bench_static.hh | 80 + .../static/intel_bench_fixed_size.hh | 66 + .../static/static_size_generator.hh | 57 + .../generic_bench/timers/STL_perf_analyzer.hh | 82 + .../btl/generic_bench/timers/STL_timer.hh | 78 + .../timers/mixed_perf_analyzer.hh | 73 + .../timers/portable_perf_analyzer.hh | 103 + .../timers/portable_perf_analyzer_old.hh | 134 + .../generic_bench/timers/portable_timer.hh | 145 + .../generic_bench/timers/x86_perf_analyzer.hh | 108 + .../btl/generic_bench/timers/x86_timer.hh | 246 + .../btl/generic_bench/utils/size_lin_log.hh | 70 + .../bench/btl/generic_bench/utils/size_log.hh | 54 + .../bench/btl/generic_bench/utils/utilities.h | 90 + .../bench/btl/generic_bench/utils/xy_file.hh | 75 + .../Eigen/bench/btl/libs/C/CMakeLists.txt | 3 + .../Eigen/bench/btl/libs/C/C_interface.hh | 117 + .../3rdparty/Eigen/bench/btl/libs/C/main.cpp | 48 + .../bench/btl/libs/C_BLAS/CMakeLists.txt | 51 + .../bench/btl/libs/C_BLAS/C_BLAS_interface.hh | 358 ++ .../Eigen/bench/btl/libs/C_BLAS/blas.h | 675 +++ .../Eigen/bench/btl/libs/C_BLAS/cblas.h | 596 +++ .../Eigen/bench/btl/libs/C_BLAS/main.cpp | 73 + .../Eigen/bench/btl/libs/STL/CMakeLists.txt | 2 + .../Eigen/bench/btl/libs/STL/STL_interface.hh | 241 + .../Eigen/bench/btl/libs/STL/main.cpp | 42 + .../bench/btl/libs/STL_algo/CMakeLists.txt | 2 + .../btl/libs/STL_algo/STL_algo_interface.hh | 138 + .../Eigen/bench/btl/libs/STL_algo/main.cpp | 39 + .../Eigen/bench/btl/libs/blitz/CMakeLists.txt | 17 + .../libs/blitz/blitz_LU_solve_interface.hh | 192 + .../bench/btl/libs/blitz/blitz_interface.hh | 147 + .../Eigen/bench/btl/libs/blitz/btl_blitz.cpp | 51 + .../bench/btl/libs/blitz/btl_tiny_blitz.cpp | 38 + .../btl/libs/blitz/tiny_blitz_interface.hh | 106 + .../bench/btl/libs/eigen3/CMakeLists.txt | 57 + .../bench/btl/libs/eigen3/btl_tiny_eigen3.cpp | 46 + .../bench/btl/libs/eigen3/eigen3_interface.hh | 239 + .../Eigen/bench/btl/libs/eigen3/main_adv.cpp | 44 + .../bench/btl/libs/eigen3/main_linear.cpp | 35 + .../bench/btl/libs/eigen3/main_matmat.cpp | 35 + .../bench/btl/libs/eigen3/main_vecmat.cpp | 36 + .../Eigen/bench/btl/libs/f77/CMakeLists.txt | 6 + .../3rdparty/Eigen/bench/btl/libs/f77/daat.f | 14 + .../3rdparty/Eigen/bench/btl/libs/f77/data.f | 14 + .../3rdparty/Eigen/bench/btl/libs/f77/daxpy.f | 18 + .../3rdparty/Eigen/bench/btl/libs/f77/dmxm.f | 32 + .../Eigen/bench/btl/libs/f77/dmxm.f.mfr | 36 + .../3rdparty/Eigen/bench/btl/libs/f77/dmxv.f | 39 + .../Eigen/bench/btl/libs/f77/f77_interface.hh | 129 + .../bench/btl/libs/f77/f77_interface_base.hh | 91 + .../Eigen/bench/btl/libs/f77/main.cpp | 47 + .../3rdparty/Eigen/bench/btl/libs/f77/saat.f | 14 + .../3rdparty/Eigen/bench/btl/libs/f77/sata.f | 14 + .../3rdparty/Eigen/bench/btl/libs/f77/saxpy.f | 16 + .../3rdparty/Eigen/bench/btl/libs/f77/smxm.f | 32 + .../3rdparty/Eigen/bench/btl/libs/f77/smxv.f | 38 + .../bench/btl/libs/f77/test_interface.hh | 36 + .../Eigen/bench/btl/libs/gmm/CMakeLists.txt | 6 + .../btl/libs/gmm/gmm_LU_solve_interface.hh | 192 + .../Eigen/bench/btl/libs/gmm/gmm_interface.hh | 144 + .../Eigen/bench/btl/libs/gmm/main.cpp | 51 + .../bench/btl/libs/hand_vec/CMakeLists.txt | 12 + .../btl/libs/hand_vec/hand_vec_interface.hh | 886 ++++ .../Eigen/bench/btl/libs/hand_vec/main.cpp | 50 + .../Eigen/bench/btl/libs/mtl4/.kdbgrc.main | 12 + .../Eigen/bench/btl/libs/mtl4/CMakeLists.txt | 6 + .../Eigen/bench/btl/libs/mtl4/main.cpp | 46 + .../btl/libs/mtl4/mtl4_LU_solve_interface.hh | 192 + .../bench/btl/libs/mtl4/mtl4_interface.hh | 144 + .../Eigen/bench/btl/libs/tvmet/CMakeLists.txt | 6 + .../Eigen/bench/btl/libs/tvmet/main.cpp | 40 + .../bench/btl/libs/tvmet/tvmet_interface.hh | 104 + .../Eigen/bench/btl/libs/ublas/CMakeLists.txt | 7 + .../Eigen/bench/btl/libs/ublas/main.cpp | 44 + .../bench/btl/libs/ublas/ublas_interface.hh | 141 + .../Eigen/bench/check_cache_queries.cpp | 101 + gtsam/3rdparty/Eigen/bench/eig33.cpp | 211 + gtsam/3rdparty/Eigen/bench/geometry.cpp | 126 + .../Eigen/bench/product_threshold.cpp | 143 + gtsam/3rdparty/Eigen/bench/quat_slerp.cpp | 247 + gtsam/3rdparty/Eigen/bench/quatmul.cpp | 47 + .../3rdparty/Eigen/bench/sparse_cholesky.cpp | 216 + .../Eigen/bench/sparse_dense_product.cpp | 164 + gtsam/3rdparty/Eigen/bench/sparse_lu.cpp | 132 + gtsam/3rdparty/Eigen/bench/sparse_product.cpp | 363 ++ .../Eigen/bench/sparse_randomsetter.cpp | 125 + gtsam/3rdparty/Eigen/bench/sparse_setter.cpp | 485 ++ .../3rdparty/Eigen/bench/sparse_transpose.cpp | 104 + .../3rdparty/Eigen/bench/sparse_trisolver.cpp | 220 + gtsam/3rdparty/Eigen/bench/spmv.cpp | 233 + gtsam/3rdparty/Eigen/bench/vdw_new.cpp | 56 + gtsam/3rdparty/Eigen/blas/CMakeLists.txt | 48 + gtsam/3rdparty/Eigen/blas/README.txt | 9 + gtsam/3rdparty/Eigen/blas/chbmv.f | 310 ++ gtsam/3rdparty/Eigen/blas/chpmv.f | 272 + gtsam/3rdparty/Eigen/blas/chpr.f | 220 + gtsam/3rdparty/Eigen/blas/chpr2.f | 255 + gtsam/3rdparty/Eigen/blas/common.h | 157 + gtsam/3rdparty/Eigen/blas/complex_double.cpp | 35 + gtsam/3rdparty/Eigen/blas/complex_single.cpp | 35 + gtsam/3rdparty/Eigen/blas/complexdots.f | 43 + gtsam/3rdparty/Eigen/blas/ctbmv.f | 366 ++ gtsam/3rdparty/Eigen/blas/ctbsv.f | 370 ++ gtsam/3rdparty/Eigen/blas/ctpmv.f | 329 ++ gtsam/3rdparty/Eigen/blas/ctpsv.f | 332 ++ gtsam/3rdparty/Eigen/blas/double.cpp | 34 + gtsam/3rdparty/Eigen/blas/drotm.f | 147 + gtsam/3rdparty/Eigen/blas/drotmg.f | 206 + gtsam/3rdparty/Eigen/blas/dsbmv.f | 304 ++ gtsam/3rdparty/Eigen/blas/dspmv.f | 265 + gtsam/3rdparty/Eigen/blas/dspr.f | 202 + gtsam/3rdparty/Eigen/blas/dspr2.f | 233 + gtsam/3rdparty/Eigen/blas/dtbmv.f | 335 ++ gtsam/3rdparty/Eigen/blas/dtbsv.f | 339 ++ gtsam/3rdparty/Eigen/blas/dtpmv.f | 293 ++ gtsam/3rdparty/Eigen/blas/dtpsv.f | 296 ++ gtsam/3rdparty/Eigen/blas/level1_cplx_impl.h | 142 + gtsam/3rdparty/Eigen/blas/level1_impl.h | 179 + gtsam/3rdparty/Eigen/blas/level1_real_impl.h | 115 + gtsam/3rdparty/Eigen/blas/level2_cplx_impl.h | 285 + gtsam/3rdparty/Eigen/blas/level2_impl.h | 367 ++ gtsam/3rdparty/Eigen/blas/level2_real_impl.h | 225 + gtsam/3rdparty/Eigen/blas/level3_impl.h | 635 +++ gtsam/3rdparty/Eigen/blas/lsame.f | 85 + gtsam/3rdparty/Eigen/blas/single.cpp | 34 + gtsam/3rdparty/Eigen/blas/srotm.f | 148 + gtsam/3rdparty/Eigen/blas/srotmg.f | 208 + gtsam/3rdparty/Eigen/blas/ssbmv.f | 306 ++ gtsam/3rdparty/Eigen/blas/sspmv.f | 265 + gtsam/3rdparty/Eigen/blas/sspr.f | 202 + gtsam/3rdparty/Eigen/blas/sspr2.f | 233 + gtsam/3rdparty/Eigen/blas/stbmv.f | 335 ++ gtsam/3rdparty/Eigen/blas/stbsv.f | 339 ++ gtsam/3rdparty/Eigen/blas/stpmv.f | 293 ++ gtsam/3rdparty/Eigen/blas/stpsv.f | 296 ++ .../Eigen/blas/testing/CMakeLists.txt | 40 + gtsam/3rdparty/Eigen/blas/testing/cblat1.f | 681 +++ gtsam/3rdparty/Eigen/blas/testing/cblat2.dat | 35 + gtsam/3rdparty/Eigen/blas/testing/cblat2.f | 3241 ++++++++++++ gtsam/3rdparty/Eigen/blas/testing/cblat3.dat | 23 + gtsam/3rdparty/Eigen/blas/testing/cblat3.f | 3439 ++++++++++++ gtsam/3rdparty/Eigen/blas/testing/dblat1.f | 769 +++ gtsam/3rdparty/Eigen/blas/testing/dblat2.dat | 34 + gtsam/3rdparty/Eigen/blas/testing/dblat2.f | 3138 +++++++++++ gtsam/3rdparty/Eigen/blas/testing/dblat3.dat | 20 + gtsam/3rdparty/Eigen/blas/testing/dblat3.f | 2823 ++++++++++ .../Eigen/blas/testing/runblastest.sh | 39 + gtsam/3rdparty/Eigen/blas/testing/sblat1.f | 769 +++ gtsam/3rdparty/Eigen/blas/testing/sblat2.dat | 34 + gtsam/3rdparty/Eigen/blas/testing/sblat2.f | 3138 +++++++++++ gtsam/3rdparty/Eigen/blas/testing/sblat3.dat | 20 + gtsam/3rdparty/Eigen/blas/testing/sblat3.f | 2823 ++++++++++ gtsam/3rdparty/Eigen/blas/testing/zblat1.f | 681 +++ gtsam/3rdparty/Eigen/blas/testing/zblat2.dat | 35 + gtsam/3rdparty/Eigen/blas/testing/zblat2.f | 3249 ++++++++++++ gtsam/3rdparty/Eigen/blas/testing/zblat3.dat | 23 + gtsam/3rdparty/Eigen/blas/testing/zblat3.f | 3445 ++++++++++++ gtsam/3rdparty/Eigen/blas/xerbla.cpp | 17 + gtsam/3rdparty/Eigen/blas/zhbmv.f | 310 ++ gtsam/3rdparty/Eigen/blas/zhpmv.f | 272 + gtsam/3rdparty/Eigen/blas/zhpr.f | 220 + gtsam/3rdparty/Eigen/blas/zhpr2.f | 255 + gtsam/3rdparty/Eigen/blas/ztbmv.f | 366 ++ gtsam/3rdparty/Eigen/blas/ztbsv.f | 370 ++ gtsam/3rdparty/Eigen/blas/ztpmv.f | 329 ++ gtsam/3rdparty/Eigen/blas/ztpsv.f | 332 ++ gtsam/3rdparty/Eigen/cmake/EigenTesting.cmake | 295 ++ gtsam/3rdparty/Eigen/cmake/FindAdolc.cmake | 20 + gtsam/3rdparty/Eigen/cmake/FindBLAS.cmake | 419 ++ gtsam/3rdparty/Eigen/cmake/FindCholmod.cmake | 79 + gtsam/3rdparty/Eigen/cmake/FindEigen2.cmake | 80 + gtsam/3rdparty/Eigen/cmake/FindEigen3.cmake | 81 + gtsam/3rdparty/Eigen/cmake/FindFFTW.cmake | 31 + gtsam/3rdparty/Eigen/cmake/FindGLEW.cmake | 105 + gtsam/3rdparty/Eigen/cmake/FindGMP.cmake | 21 + gtsam/3rdparty/Eigen/cmake/FindGSL.cmake | 170 + .../3rdparty/Eigen/cmake/FindGoogleHash.cmake | 23 + gtsam/3rdparty/Eigen/cmake/FindLAPACK.cmake | 273 + gtsam/3rdparty/Eigen/cmake/FindMPFR.cmake | 83 + .../Eigen/cmake/FindStandardMathLibrary.cmake | 64 + gtsam/3rdparty/Eigen/cmake/FindSuperLU.cmake | 25 + gtsam/3rdparty/Eigen/cmake/FindUmfpack.cmake | 49 + gtsam/3rdparty/Eigen/cmake/RegexUtils.cmake | 19 + gtsam/3rdparty/Eigen/debug/gdb/__init__.py | 1 + gtsam/3rdparty/Eigen/debug/gdb/printers.py | 212 + .../Eigen/debug/msvc/eigen_autoexp_part.dat | 295 ++ gtsam/3rdparty/Eigen/demos/CMakeLists.txt | 13 + .../Eigen/demos/mandelbrot/CMakeLists.txt | 21 + gtsam/3rdparty/Eigen/demos/mandelbrot/README | 10 + .../Eigen/demos/mandelbrot/mandelbrot.cpp | 228 + .../Eigen/demos/mandelbrot/mandelbrot.h | 86 + .../Eigen/demos/mix_eigen_and_c/README | 9 + .../demos/mix_eigen_and_c/binary_library.cpp | 200 + .../demos/mix_eigen_and_c/binary_library.h | 86 + .../Eigen/demos/mix_eigen_and_c/example.c | 80 + .../Eigen/demos/opengl/CMakeLists.txt | 20 + gtsam/3rdparty/Eigen/demos/opengl/README | 13 + gtsam/3rdparty/Eigen/demos/opengl/camera.cpp | 279 + gtsam/3rdparty/Eigen/demos/opengl/camera.h | 133 + .../3rdparty/Eigen/demos/opengl/gpuhelper.cpp | 141 + gtsam/3rdparty/Eigen/demos/opengl/gpuhelper.h | 222 + .../3rdparty/Eigen/demos/opengl/icosphere.cpp | 135 + gtsam/3rdparty/Eigen/demos/opengl/icosphere.h | 45 + .../Eigen/demos/opengl/quaternion_demo.cpp | 671 +++ .../Eigen/demos/opengl/quaternion_demo.h | 129 + .../3rdparty/Eigen/demos/opengl/trackball.cpp | 74 + gtsam/3rdparty/Eigen/demos/opengl/trackball.h | 57 + .../Eigen/doc/A05_PortingFrom2To3.dox | 319 ++ .../Eigen/doc/A10_Eigen2SupportModes.dox | 101 + .../Eigen/doc/AsciiQuickReference.txt | 170 + gtsam/3rdparty/Eigen/doc/B01_Experimental.dox | 55 + .../Eigen/doc/C00_QuickStartGuide.dox | 95 + .../Eigen/doc/C01_TutorialMatrixClass.dox | 284 + .../doc/C02_TutorialMatrixArithmetic.dox | 229 + .../Eigen/doc/C03_TutorialArrayClass.dox | 205 + .../Eigen/doc/C04_TutorialBlockOperations.dox | 239 + .../C05_TutorialAdvancedInitialization.dox | 172 + .../Eigen/doc/C06_TutorialLinearAlgebra.dox | 266 + ...TutorialReductionsVisitorsBroadcasting.dox | 258 + .../Eigen/doc/C08_TutorialGeometry.dox | 250 + .../3rdparty/Eigen/doc/C09_TutorialSparse.dox | 261 + gtsam/3rdparty/Eigen/doc/CMakeLists.txt | 72 + .../3rdparty/Eigen/doc/D01_StlContainers.dox | 65 + .../Eigen/doc/D03_WrongStackAlignment.dox | 56 + .../3rdparty/Eigen/doc/D07_PassingByValue.dox | 40 + .../doc/D09_StructHavingEigenMembers.dox | 137 + .../Eigen/doc/D11_UnalignedArrayAssert.dox | 121 + gtsam/3rdparty/Eigen/doc/Doxyfile.in | 1481 ++++++ .../Eigen/doc/Eigen_Silly_Professor_64x64.png | Bin 0 -> 8355 bytes .../Eigen/doc/I00_CustomizingEigen.dox | 188 + .../Eigen/doc/I01_TopicLazyEvaluation.dox | 65 + .../3rdparty/Eigen/doc/I02_HiPerformance.dox | 128 + .../Eigen/doc/I03_InsideEigenExample.dox | 500 ++ .../Eigen/doc/I05_FixedSizeVectorizable.dox | 38 + .../doc/I06_TopicEigenExpressionTemplates.dox | 12 + .../Eigen/doc/I07_TopicScalarTypes.dox | 12 + gtsam/3rdparty/Eigen/doc/I08_Resizing.dox | 11 + .../3rdparty/Eigen/doc/I09_Vectorization.dox | 9 + gtsam/3rdparty/Eigen/doc/I10_Assertions.dox | 13 + gtsam/3rdparty/Eigen/doc/I11_Aliasing.dox | 214 + .../3rdparty/Eigen/doc/I12_ClassHierarchy.dox | 133 + .../doc/I13_FunctionsTakingEigenTypes.dox | 171 + .../Eigen/doc/I14_PreprocessorDirectives.dox | 86 + .../3rdparty/Eigen/doc/I15_StorageOrders.dox | 91 + gtsam/3rdparty/Eigen/doc/Overview.dox | 56 + gtsam/3rdparty/Eigen/doc/QuickReference.dox | 731 +++ .../doc/TopicLinearAlgebraDecompositions.dox | 256 + gtsam/3rdparty/Eigen/doc/eigendoxy.css | 906 ++++ .../Eigen/doc/eigendoxy_footer.html.in | 5 + .../Eigen/doc/eigendoxy_header.html.in | 14 + gtsam/3rdparty/Eigen/doc/eigendoxy_tabs.css | 59 + gtsam/3rdparty/Eigen/doc/examples/.krazy | 2 + .../Eigen/doc/examples/CMakeLists.txt | 20 + .../doc/examples/DenseBase_middleCols_int.cpp | 15 + .../doc/examples/DenseBase_middleRows_int.cpp | 15 + .../DenseBase_template_int_middleCols.cpp | 15 + .../DenseBase_template_int_middleRows.cpp | 15 + .../doc/examples/MatrixBase_cwise_const.cpp | 18 + .../Eigen/doc/examples/QuickStart_example.cpp | 14 + .../examples/QuickStart_example2_dynamic.cpp | 15 + .../examples/QuickStart_example2_fixed.cpp | 15 + .../examples/TutorialLinAlgComputeTwice.cpp | 23 + .../TutorialLinAlgExComputeSolveError.cpp | 14 + ...torialLinAlgExSolveColPivHouseholderQR.cpp | 17 + .../examples/TutorialLinAlgExSolveLDLT.cpp | 16 + .../TutorialLinAlgInverseDeterminant.cpp | 16 + .../examples/TutorialLinAlgRankRevealing.cpp | 20 + .../doc/examples/TutorialLinAlgSVDSolve.cpp | 15 + .../TutorialLinAlgSelfAdjointEigenSolver.cpp | 17 + .../examples/TutorialLinAlgSetThreshold.cpp | 16 + .../Tutorial_ArrayClass_accessors.cpp | 24 + .../examples/Tutorial_ArrayClass_addition.cpp | 23 + .../Tutorial_ArrayClass_cwise_other.cpp | 19 + .../examples/Tutorial_ArrayClass_interop.cpp | 22 + .../Tutorial_ArrayClass_interop_matrix.cpp | 26 + .../doc/examples/Tutorial_ArrayClass_mult.cpp | 16 + ...orial_BlockOperations_block_assignment.cpp | 18 + .../Tutorial_BlockOperations_colrow.cpp | 17 + .../Tutorial_BlockOperations_corner.cpp | 17 + .../Tutorial_BlockOperations_print_block.cpp | 20 + .../Tutorial_BlockOperations_vector.cpp | 14 + .../doc/examples/Tutorial_PartialLU_solve.cpp | 18 + ...ionsVisitorsBroadcasting_broadcast_1nn.cpp | 24 + ...sVisitorsBroadcasting_broadcast_simple.cpp | 21 + ...sBroadcasting_broadcast_simple_rowwise.cpp | 20 + ...ReductionsVisitorsBroadcasting_colwise.cpp | 13 + ...ReductionsVisitorsBroadcasting_maxnorm.cpp | 20 + ...nsVisitorsBroadcasting_reductions_bool.cpp | 21 + ...nsVisitorsBroadcasting_reductions_norm.cpp | 28 + ...ReductionsVisitorsBroadcasting_rowwise.cpp | 13 + ...eductionsVisitorsBroadcasting_visitors.cpp | 26 + .../Tutorial_simple_example_dynamic_size.cpp | 22 + .../Tutorial_simple_example_fixed_size.cpp | 15 + .../Eigen/doc/examples/class_Block.cpp | 27 + .../doc/examples/class_CwiseBinaryOp.cpp | 18 + .../Eigen/doc/examples/class_CwiseUnaryOp.cpp | 19 + .../examples/class_CwiseUnaryOp_ptrfun.cpp | 20 + .../Eigen/doc/examples/class_FixedBlock.cpp | 27 + .../doc/examples/class_FixedVectorBlock.cpp | 27 + .../Eigen/doc/examples/class_VectorBlock.cpp | 27 + .../examples/function_taking_eigenbase.cpp | 18 + .../doc/examples/tut_arithmetic_add_sub.cpp | 22 + .../doc/examples/tut_arithmetic_dot_cross.cpp | 15 + .../examples/tut_arithmetic_matrix_mul.cpp | 19 + .../examples/tut_arithmetic_redux_basic.cpp | 16 + .../tut_arithmetic_scalar_mul_div.cpp | 17 + .../tut_matrix_coefficient_accessors.cpp | 18 + .../Eigen/doc/examples/tut_matrix_resize.cpp | 18 + .../examples/tut_matrix_resize_fixed_size.cpp | 12 + gtsam/3rdparty/Eigen/doc/snippets/.krazy | 2 + .../doc/snippets/AngleAxis_mimic_euler.cpp | 5 + .../Eigen/doc/snippets/CMakeLists.txt | 30 + .../snippets/ColPivHouseholderQR_solve.cpp | 8 + .../snippets/ComplexEigenSolver_compute.cpp | 16 + .../ComplexEigenSolver_eigenvalues.cpp | 4 + .../ComplexEigenSolver_eigenvectors.cpp | 4 + .../doc/snippets/ComplexSchur_compute.cpp | 6 + .../doc/snippets/ComplexSchur_matrixT.cpp | 4 + .../doc/snippets/ComplexSchur_matrixU.cpp | 4 + .../3rdparty/Eigen/doc/snippets/Cwise_abs.cpp | 2 + .../Eigen/doc/snippets/Cwise_abs2.cpp | 2 + .../Eigen/doc/snippets/Cwise_acos.cpp | 2 + .../3rdparty/Eigen/doc/snippets/Cwise_cos.cpp | 2 + .../Eigen/doc/snippets/Cwise_cube.cpp | 2 + .../Eigen/doc/snippets/Cwise_equal_equal.cpp | 2 + .../3rdparty/Eigen/doc/snippets/Cwise_exp.cpp | 2 + .../Eigen/doc/snippets/Cwise_greater.cpp | 2 + .../doc/snippets/Cwise_greater_equal.cpp | 2 + .../Eigen/doc/snippets/Cwise_inverse.cpp | 2 + .../Eigen/doc/snippets/Cwise_less.cpp | 2 + .../Eigen/doc/snippets/Cwise_less_equal.cpp | 2 + .../3rdparty/Eigen/doc/snippets/Cwise_log.cpp | 2 + .../3rdparty/Eigen/doc/snippets/Cwise_max.cpp | 2 + .../3rdparty/Eigen/doc/snippets/Cwise_min.cpp | 2 + .../Eigen/doc/snippets/Cwise_minus.cpp | 2 + .../Eigen/doc/snippets/Cwise_minus_equal.cpp | 3 + .../Eigen/doc/snippets/Cwise_not_equal.cpp | 2 + .../Eigen/doc/snippets/Cwise_plus.cpp | 2 + .../Eigen/doc/snippets/Cwise_plus_equal.cpp | 3 + .../3rdparty/Eigen/doc/snippets/Cwise_pow.cpp | 2 + .../Eigen/doc/snippets/Cwise_product.cpp | 4 + .../Eigen/doc/snippets/Cwise_quotient.cpp | 2 + .../3rdparty/Eigen/doc/snippets/Cwise_sin.cpp | 2 + .../Eigen/doc/snippets/Cwise_slash_equal.cpp | 3 + .../Eigen/doc/snippets/Cwise_sqrt.cpp | 2 + .../Eigen/doc/snippets/Cwise_square.cpp | 2 + .../3rdparty/Eigen/doc/snippets/Cwise_tan.cpp | 2 + .../Eigen/doc/snippets/Cwise_times_equal.cpp | 3 + .../doc/snippets/DenseBase_LinSpaced.cpp | 2 + .../doc/snippets/DenseBase_LinSpaced_seq.cpp | 2 + .../doc/snippets/DenseBase_setLinSpaced.cpp | 3 + .../doc/snippets/DirectionWise_replicate.cpp | 4 + .../snippets/DirectionWise_replicate_int.cpp | 4 + .../EigenSolver_EigenSolver_MatrixType.cpp | 16 + .../doc/snippets/EigenSolver_compute.cpp | 6 + .../doc/snippets/EigenSolver_eigenvalues.cpp | 4 + .../doc/snippets/EigenSolver_eigenvectors.cpp | 4 + .../EigenSolver_pseudoEigenvectors.cpp | 9 + .../snippets/FullPivHouseholderQR_solve.cpp | 8 + .../Eigen/doc/snippets/FullPivLU_image.cpp | 9 + .../Eigen/doc/snippets/FullPivLU_kernel.cpp | 7 + .../Eigen/doc/snippets/FullPivLU_solve.cpp | 11 + .../HessenbergDecomposition_compute.cpp | 6 + .../HessenbergDecomposition_matrixH.cpp | 8 + .../HessenbergDecomposition_packedMatrix.cpp | 9 + .../doc/snippets/HouseholderQR_solve.cpp | 9 + ...ouseholderSequence_HouseholderSequence.cpp | 31 + .../3rdparty/Eigen/doc/snippets/IOFormat.cpp | 14 + .../Eigen/doc/snippets/JacobiSVD_basic.cpp | 9 + .../Eigen/doc/snippets/Jacobi_makeGivens.cpp | 6 + .../Eigen/doc/snippets/Jacobi_makeJacobi.cpp | 8 + .../3rdparty/Eigen/doc/snippets/LLT_solve.cpp | 8 + .../Eigen/doc/snippets/Map_general_stride.cpp | 5 + .../Eigen/doc/snippets/Map_inner_stride.cpp | 5 + .../Eigen/doc/snippets/Map_outer_stride.cpp | 3 + .../Eigen/doc/snippets/Map_placement_new.cpp | 5 + .../Eigen/doc/snippets/Map_simple.cpp | 3 + .../Eigen/doc/snippets/MatrixBase_adjoint.cpp | 3 + .../Eigen/doc/snippets/MatrixBase_all.cpp | 7 + .../Eigen/doc/snippets/MatrixBase_array.cpp | 4 + .../doc/snippets/MatrixBase_array_const.cpp | 4 + .../doc/snippets/MatrixBase_asDiagonal.cpp | 1 + .../doc/snippets/MatrixBase_block_int_int.cpp | 5 + .../MatrixBase_block_int_int_int_int.cpp | 5 + .../MatrixBase_bottomLeftCorner_int_int.cpp | 6 + .../MatrixBase_bottomRightCorner_int_int.cpp | 6 + .../snippets/MatrixBase_bottomRows_int.cpp | 6 + .../Eigen/doc/snippets/MatrixBase_cast.cpp | 3 + .../Eigen/doc/snippets/MatrixBase_col.cpp | 3 + .../Eigen/doc/snippets/MatrixBase_colwise.cpp | 5 + ...trixBase_computeInverseAndDetWithCheck.cpp | 13 + .../MatrixBase_computeInverseWithCheck.cpp | 11 + .../doc/snippets/MatrixBase_cwiseAbs.cpp | 4 + .../doc/snippets/MatrixBase_cwiseAbs2.cpp | 4 + .../doc/snippets/MatrixBase_cwiseEqual.cpp | 7 + .../doc/snippets/MatrixBase_cwiseInverse.cpp | 4 + .../doc/snippets/MatrixBase_cwiseMax.cpp | 2 + .../doc/snippets/MatrixBase_cwiseMin.cpp | 2 + .../doc/snippets/MatrixBase_cwiseNotEqual.cpp | 7 + .../doc/snippets/MatrixBase_cwiseProduct.cpp | 4 + .../doc/snippets/MatrixBase_cwiseQuotient.cpp | 2 + .../doc/snippets/MatrixBase_cwiseSqrt.cpp | 2 + .../doc/snippets/MatrixBase_diagonal.cpp | 4 + .../doc/snippets/MatrixBase_diagonal_int.cpp | 5 + .../MatrixBase_diagonal_template_int.cpp | 5 + .../doc/snippets/MatrixBase_eigenvalues.cpp | 3 + .../Eigen/doc/snippets/MatrixBase_end_int.cpp | 5 + .../Eigen/doc/snippets/MatrixBase_eval.cpp | 12 + .../Eigen/doc/snippets/MatrixBase_extract.cpp | 13 + .../MatrixBase_fixedBlock_int_int.cpp | 5 + .../doc/snippets/MatrixBase_identity.cpp | 1 + .../snippets/MatrixBase_identity_int_int.cpp | 1 + .../Eigen/doc/snippets/MatrixBase_inverse.cpp | 3 + .../doc/snippets/MatrixBase_isDiagonal.cpp | 6 + .../doc/snippets/MatrixBase_isIdentity.cpp | 5 + .../Eigen/doc/snippets/MatrixBase_isOnes.cpp | 5 + .../doc/snippets/MatrixBase_isOrthogonal.cpp | 6 + .../doc/snippets/MatrixBase_isUnitary.cpp | 5 + .../Eigen/doc/snippets/MatrixBase_isZero.cpp | 5 + .../doc/snippets/MatrixBase_leftCols_int.cpp | 6 + .../Eigen/doc/snippets/MatrixBase_marked.cpp | 14 + .../Eigen/doc/snippets/MatrixBase_noalias.cpp | 3 + .../Eigen/doc/snippets/MatrixBase_ones.cpp | 2 + .../doc/snippets/MatrixBase_ones_int.cpp | 2 + .../doc/snippets/MatrixBase_ones_int_int.cpp | 1 + .../doc/snippets/MatrixBase_operatorNorm.cpp | 3 + .../Eigen/doc/snippets/MatrixBase_part.cpp | 13 + .../Eigen/doc/snippets/MatrixBase_prod.cpp | 3 + .../Eigen/doc/snippets/MatrixBase_random.cpp | 1 + .../doc/snippets/MatrixBase_random_int.cpp | 1 + .../snippets/MatrixBase_random_int_int.cpp | 1 + .../doc/snippets/MatrixBase_replicate.cpp | 4 + .../snippets/MatrixBase_replicate_int_int.cpp | 4 + .../Eigen/doc/snippets/MatrixBase_reverse.cpp | 8 + .../doc/snippets/MatrixBase_rightCols_int.cpp | 6 + .../Eigen/doc/snippets/MatrixBase_row.cpp | 3 + .../Eigen/doc/snippets/MatrixBase_rowwise.cpp | 5 + .../snippets/MatrixBase_segment_int_int.cpp | 5 + .../Eigen/doc/snippets/MatrixBase_select.cpp | 6 + .../Eigen/doc/snippets/MatrixBase_set.cpp | 13 + .../doc/snippets/MatrixBase_setIdentity.cpp | 3 + .../Eigen/doc/snippets/MatrixBase_setOnes.cpp | 3 + .../doc/snippets/MatrixBase_setRandom.cpp | 3 + .../Eigen/doc/snippets/MatrixBase_setZero.cpp | 3 + .../doc/snippets/MatrixBase_start_int.cpp | 5 + .../MatrixBase_template_int_bottomRows.cpp | 6 + .../snippets/MatrixBase_template_int_end.cpp | 5 + ...Base_template_int_int_bottomLeftCorner.cpp | 6 + ...ase_template_int_int_bottomRightCorner.cpp | 6 + ...rixBase_template_int_int_topLeftCorner.cpp | 6 + ...ixBase_template_int_int_topRightCorner.cpp | 6 + .../MatrixBase_template_int_leftCols.cpp | 6 + .../MatrixBase_template_int_rightCols.cpp | 6 + .../MatrixBase_template_int_segment.cpp | 5 + .../MatrixBase_template_int_start.cpp | 5 + .../MatrixBase_template_int_topRows.cpp | 6 + .../MatrixBase_topLeftCorner_int_int.cpp | 6 + .../MatrixBase_topRightCorner_int_int.cpp | 6 + .../doc/snippets/MatrixBase_topRows_int.cpp | 6 + .../doc/snippets/MatrixBase_transpose.cpp | 8 + .../Eigen/doc/snippets/MatrixBase_zero.cpp | 2 + .../doc/snippets/MatrixBase_zero_int.cpp | 2 + .../doc/snippets/MatrixBase_zero_int_int.cpp | 1 + .../snippets/Matrix_resize_NoChange_int.cpp | 3 + .../Eigen/doc/snippets/Matrix_resize_int.cpp | 6 + .../snippets/Matrix_resize_int_NoChange.cpp | 3 + .../doc/snippets/Matrix_resize_int_int.cpp | 9 + .../doc/snippets/Matrix_setConstant_int.cpp | 3 + .../snippets/Matrix_setConstant_int_int.cpp | 3 + .../snippets/Matrix_setIdentity_int_int.cpp | 3 + .../Eigen/doc/snippets/Matrix_setOnes_int.cpp | 3 + .../doc/snippets/Matrix_setOnes_int_int.cpp | 3 + .../doc/snippets/Matrix_setRandom_int.cpp | 3 + .../doc/snippets/Matrix_setRandom_int_int.cpp | 3 + .../Eigen/doc/snippets/Matrix_setZero_int.cpp | 3 + .../doc/snippets/Matrix_setZero_int_int.cpp | 3 + .../Eigen/doc/snippets/PartialPivLU_solve.cpp | 7 + .../Eigen/doc/snippets/PartialRedux_count.cpp | 3 + .../doc/snippets/PartialRedux_maxCoeff.cpp | 3 + .../doc/snippets/PartialRedux_minCoeff.cpp | 3 + .../Eigen/doc/snippets/PartialRedux_norm.cpp | 3 + .../Eigen/doc/snippets/PartialRedux_prod.cpp | 3 + .../doc/snippets/PartialRedux_squaredNorm.cpp | 3 + .../Eigen/doc/snippets/PartialRedux_sum.cpp | 3 + .../RealSchur_RealSchur_MatrixType.cpp | 10 + .../Eigen/doc/snippets/RealSchur_compute.cpp | 6 + ...ointEigenSolver_SelfAdjointEigenSolver.cpp | 7 + ...lver_SelfAdjointEigenSolver_MatrixType.cpp | 17 + ...ver_SelfAdjointEigenSolver_MatrixType2.cpp | 16 + ...fAdjointEigenSolver_compute_MatrixType.cpp | 7 + ...AdjointEigenSolver_compute_MatrixType2.cpp | 9 + .../SelfAdjointEigenSolver_eigenvalues.cpp | 4 + .../SelfAdjointEigenSolver_eigenvectors.cpp | 4 + ...AdjointEigenSolver_operatorInverseSqrt.cpp | 9 + .../SelfAdjointEigenSolver_operatorSqrt.cpp | 8 + .../snippets/SelfAdjointView_eigenvalues.cpp | 3 + .../snippets/SelfAdjointView_operatorNorm.cpp | 3 + .../doc/snippets/TopicAliasing_block.cpp | 7 + .../snippets/TopicAliasing_block_correct.cpp | 7 + .../doc/snippets/TopicAliasing_cwise.cpp | 20 + .../doc/snippets/TopicAliasing_mult1.cpp | 4 + .../doc/snippets/TopicAliasing_mult2.cpp | 10 + .../doc/snippets/TopicAliasing_mult3.cpp | 4 + .../snippets/TopicStorageOrders_example.cpp | 18 + ...lization_Tridiagonalization_MatrixType.cpp | 9 + .../snippets/Tridiagonalization_compute.cpp | 9 + .../Tridiagonalization_decomposeInPlace.cpp | 10 + .../snippets/Tridiagonalization_diagonal.cpp | 13 + ...iagonalization_householderCoefficients.cpp | 6 + .../Tridiagonalization_packedMatrix.cpp | 8 + .../Tutorial_AdvancedInitialization_Block.cpp | 5 + ..._AdvancedInitialization_CommaTemporary.cpp | 4 + .../Tutorial_AdvancedInitialization_Join.cpp | 11 + ...orial_AdvancedInitialization_LinSpaced.cpp | 7 + ...orial_AdvancedInitialization_ThreeWays.cpp | 20 + .../Tutorial_AdvancedInitialization_Zero.cpp | 13 + .../doc/snippets/Tutorial_commainit_01.cpp | 5 + .../doc/snippets/Tutorial_commainit_01b.cpp | 5 + .../doc/snippets/Tutorial_commainit_02.cpp | 7 + .../Tutorial_solve_matrix_inverse.cpp | 6 + .../snippets/Tutorial_solve_multiple_rhs.cpp | 10 + .../Tutorial_solve_reuse_decomposition.cpp | 13 + .../doc/snippets/Tutorial_solve_singular.cpp | 9 + .../snippets/Tutorial_solve_triangular.cpp | 8 + .../Tutorial_solve_triangular_inplace.cpp | 6 + .../Eigen/doc/snippets/Vectorwise_reverse.cpp | 10 + .../Eigen/doc/snippets/class_FullPivLU.cpp | 16 + .../Eigen/doc/snippets/compile_snippet.cpp.in | 18 + .../snippets/tut_arithmetic_redux_minmax.cpp | 12 + .../tut_arithmetic_transpose_aliasing.cpp | 5 + .../tut_arithmetic_transpose_conjugate.cpp | 12 + .../tut_arithmetic_transpose_inplace.cpp | 6 + .../tut_matrix_assignment_resizing.cpp | 5 + gtsam/3rdparty/Eigen/doc/tutorial.cpp | 62 + .../Eigen/doc/unsupported_modules.dox | 64 + gtsam/3rdparty/Eigen/eigen3.pc.in | 6 + gtsam/3rdparty/Eigen/failtest/CMakeLists.txt | 37 + .../block_nonconst_ctor_on_const_xpr_0.cpp | 15 + .../block_nonconst_ctor_on_const_xpr_1.cpp | 15 + .../block_nonconst_ctor_on_const_xpr_2.cpp | 16 + .../block_on_const_type_actually_const_0.cpp | 16 + .../block_on_const_type_actually_const_1.cpp | 16 + .../const_qualified_block_method_retval_0.cpp | 15 + .../const_qualified_block_method_retval_1.cpp | 15 + ...const_qualified_diagonal_method_retval.cpp | 15 + ...onst_qualified_transpose_method_retval.cpp | 15 + .../diagonal_nonconst_ctor_on_const_xpr.cpp | 15 + .../diagonal_on_const_type_actually_const.cpp | 16 + .../Eigen/failtest/failtest_sanity_check.cpp | 5 + .../map_nonconst_ctor_on_const_ptr_0.cpp | 15 + .../map_nonconst_ctor_on_const_ptr_1.cpp | 15 + .../map_nonconst_ctor_on_const_ptr_2.cpp | 15 + .../map_nonconst_ctor_on_const_ptr_3.cpp | 15 + .../map_nonconst_ctor_on_const_ptr_4.cpp | 15 + .../map_on_const_type_actually_const_0.cpp | 15 + .../map_on_const_type_actually_const_1.cpp | 15 + .../transpose_nonconst_ctor_on_const_xpr.cpp | 15 + ...transpose_on_const_type_actually_const.cpp | 16 + gtsam/3rdparty/Eigen/lapack/CMakeLists.txt | 378 ++ gtsam/3rdparty/Eigen/lapack/cholesky.cpp | 87 + .../3rdparty/Eigen/lapack/complex_double.cpp | 32 + .../3rdparty/Eigen/lapack/complex_single.cpp | 32 + gtsam/3rdparty/Eigen/lapack/double.cpp | 32 + gtsam/3rdparty/Eigen/lapack/eigenvalues.cpp | 94 + gtsam/3rdparty/Eigen/lapack/lapack_common.h | 38 + gtsam/3rdparty/Eigen/lapack/lu.cpp | 104 + gtsam/3rdparty/Eigen/lapack/single.cpp | 32 + gtsam/3rdparty/Eigen/scripts/CMakeLists.txt | 6 + gtsam/3rdparty/Eigen/scripts/buildtests.in | 22 + gtsam/3rdparty/Eigen/scripts/check.in | 21 + gtsam/3rdparty/Eigen/scripts/debug.in | 3 + .../Eigen/scripts/eigen_gen_credits.cpp | 232 + gtsam/3rdparty/Eigen/scripts/eigen_gen_docs | 21 + gtsam/3rdparty/Eigen/scripts/release.in | 3 + .../Eigen/signature_of_eigen3_matrix_library | 1 + gtsam/3rdparty/Eigen/test/CMakeLists.txt | 143 + gtsam/3rdparty/Eigen/test/adjoint.cpp | 150 + gtsam/3rdparty/Eigen/test/array.cpp | 242 + .../3rdparty/Eigen/test/array_for_matrix.cpp | 185 + gtsam/3rdparty/Eigen/test/array_replicate.cpp | 85 + gtsam/3rdparty/Eigen/test/array_reverse.cpp | 143 + gtsam/3rdparty/Eigen/test/bandmatrix.cpp | 89 + gtsam/3rdparty/Eigen/test/basicstuff.cpp | 233 + gtsam/3rdparty/Eigen/test/block.cpp | 241 + gtsam/3rdparty/Eigen/test/cholesky.cpp | 290 ++ .../3rdparty/Eigen/test/commainitializer.cpp | 61 + .../Eigen/test/conservative_resize.cpp | 129 + gtsam/3rdparty/Eigen/test/corners.cpp | 113 + gtsam/3rdparty/Eigen/test/cwiseop.cpp | 175 + gtsam/3rdparty/Eigen/test/determinant.cpp | 80 + gtsam/3rdparty/Eigen/test/diagonal.cpp | 83 + .../3rdparty/Eigen/test/diagonalmatrices.cpp | 109 + gtsam/3rdparty/Eigen/test/dontalign.cpp | 78 + gtsam/3rdparty/Eigen/test/dynalloc.cpp | 148 + .../3rdparty/Eigen/test/eigen2/CMakeLists.txt | 60 + .../Eigen/test/eigen2/eigen2_adjoint.cpp | 116 + .../Eigen/test/eigen2/eigen2_alignedbox.cpp | 75 + .../Eigen/test/eigen2/eigen2_array.cpp | 157 + .../Eigen/test/eigen2/eigen2_basicstuff.cpp | 123 + .../Eigen/test/eigen2/eigen2_bug_132.cpp | 41 + .../Eigen/test/eigen2/eigen2_cholesky.cpp | 128 + .../test/eigen2/eigen2_commainitializer.cpp | 61 + .../Eigen/test/eigen2/eigen2_cwiseop.cpp | 173 + .../Eigen/test/eigen2/eigen2_determinant.cpp | 76 + .../Eigen/test/eigen2/eigen2_dynalloc.cpp | 146 + .../Eigen/test/eigen2/eigen2_eigensolver.cpp | 161 + .../test/eigen2/eigen2_first_aligned.cpp | 64 + .../Eigen/test/eigen2/eigen2_geometry.cpp | 446 ++ .../eigen2_geometry_with_eigen2_prefix.cpp | 449 ++ .../Eigen/test/eigen2/eigen2_hyperplane.cpp | 141 + .../Eigen/test/eigen2/eigen2_inverse.cpp | 78 + .../test/eigen2/eigen2_linearstructure.cpp | 99 + .../3rdparty/Eigen/test/eigen2/eigen2_lu.cpp | 137 + .../3rdparty/Eigen/test/eigen2/eigen2_map.cpp | 129 + .../Eigen/test/eigen2/eigen2_meta.cpp | 75 + .../Eigen/test/eigen2/eigen2_miscmatrices.cpp | 63 + .../Eigen/test/eigen2/eigen2_mixingtypes.cpp | 92 + .../Eigen/test/eigen2/eigen2_newstdvector.cpp | 164 + .../Eigen/test/eigen2/eigen2_nomalloc.cpp | 78 + .../Eigen/test/eigen2/eigen2_packetmath.cpp | 147 + .../test/eigen2/eigen2_parametrizedline.cpp | 77 + .../test/eigen2/eigen2_prec_inverse_4x4.cpp | 99 + .../test/eigen2/eigen2_product_large.cpp | 60 + .../test/eigen2/eigen2_product_small.cpp | 37 + .../3rdparty/Eigen/test/eigen2/eigen2_qr.cpp | 84 + .../Eigen/test/eigen2/eigen2_qtvector.cpp | 173 + .../Eigen/test/eigen2/eigen2_regression.cpp | 151 + .../Eigen/test/eigen2/eigen2_sizeof.cpp | 46 + .../Eigen/test/eigen2/eigen2_smallvectors.cpp | 57 + .../Eigen/test/eigen2/eigen2_sparse_basic.cpp | 332 ++ .../test/eigen2/eigen2_sparse_product.cpp | 130 + .../test/eigen2/eigen2_sparse_solvers.cpp | 215 + .../test/eigen2/eigen2_sparse_vector.cpp | 99 + .../Eigen/test/eigen2/eigen2_stdvector.cpp | 163 + .../Eigen/test/eigen2/eigen2_submatrices.cpp | 163 + .../3rdparty/Eigen/test/eigen2/eigen2_sum.cpp | 86 + .../3rdparty/Eigen/test/eigen2/eigen2_svd.cpp | 102 + .../Eigen/test/eigen2/eigen2_swap.cpp | 98 + .../Eigen/test/eigen2/eigen2_triangular.cpp | 173 + .../test/eigen2/eigen2_unalignedassert.cpp | 131 + .../Eigen/test/eigen2/eigen2_visitor.cpp | 131 + gtsam/3rdparty/Eigen/test/eigen2/gsl_helper.h | 190 + gtsam/3rdparty/Eigen/test/eigen2/main.h | 414 ++ gtsam/3rdparty/Eigen/test/eigen2/product.h | 147 + gtsam/3rdparty/Eigen/test/eigen2/runtest.sh | 28 + gtsam/3rdparty/Eigen/test/eigen2/sparse.h | 169 + .../Eigen/test/eigen2/testsuite.cmake | 197 + gtsam/3rdparty/Eigen/test/eigen2support.cpp | 80 + .../Eigen/test/eigensolver_complex.cpp | 125 + .../Eigen/test/eigensolver_generic.cpp | 118 + .../Eigen/test/eigensolver_selfadjoint.cpp | 195 + gtsam/3rdparty/Eigen/test/exceptions.cpp | 124 + gtsam/3rdparty/Eigen/test/first_aligned.cpp | 66 + gtsam/3rdparty/Eigen/test/geo_alignedbox.cpp | 186 + gtsam/3rdparty/Eigen/test/geo_eulerangles.cpp | 70 + gtsam/3rdparty/Eigen/test/geo_homogeneous.cpp | 122 + gtsam/3rdparty/Eigen/test/geo_hyperplane.cpp | 172 + .../3rdparty/Eigen/test/geo_orthomethods.cpp | 138 + .../Eigen/test/geo_parametrizedline.cpp | 109 + gtsam/3rdparty/Eigen/test/geo_quaternion.cpp | 209 + .../Eigen/test/geo_transformations.cpp | 474 ++ gtsam/3rdparty/Eigen/test/gsl_helper.h | 212 + gtsam/3rdparty/Eigen/test/hessenberg.cpp | 77 + gtsam/3rdparty/Eigen/test/householder.cpp | 138 + gtsam/3rdparty/Eigen/test/integer_types.cpp | 176 + gtsam/3rdparty/Eigen/test/inverse.cpp | 117 + gtsam/3rdparty/Eigen/test/jacobi.cpp | 96 + gtsam/3rdparty/Eigen/test/jacobisvd.cpp | 339 ++ gtsam/3rdparty/Eigen/test/linearstructure.cpp | 99 + gtsam/3rdparty/Eigen/test/lu.cpp | 222 + gtsam/3rdparty/Eigen/test/main.h | 548 ++ gtsam/3rdparty/Eigen/test/map.cpp | 159 + .../3rdparty/Eigen/test/mapstaticmethods.cpp | 188 + gtsam/3rdparty/Eigen/test/mapstride.cpp | 161 + gtsam/3rdparty/Eigen/test/meta.cpp | 91 + gtsam/3rdparty/Eigen/test/miscmatrices.cpp | 63 + gtsam/3rdparty/Eigen/test/mixingtypes.cpp | 147 + gtsam/3rdparty/Eigen/test/nesting_ops.cpp | 56 + gtsam/3rdparty/Eigen/test/nomalloc.cpp | 180 + gtsam/3rdparty/Eigen/test/nullary.cpp | 128 + gtsam/3rdparty/Eigen/test/packetmath.cpp | 360 ++ .../Eigen/test/permutationmatrices.cpp | 149 + .../3rdparty/Eigen/test/prec_inverse_4x4.cpp | 83 + gtsam/3rdparty/Eigen/test/product.h | 161 + gtsam/3rdparty/Eigen/test/product_extra.cpp | 152 + gtsam/3rdparty/Eigen/test/product_large.cpp | 79 + gtsam/3rdparty/Eigen/test/product_mmtr.cpp | 80 + .../Eigen/test/product_notemporary.cpp | 153 + .../Eigen/test/product_selfadjoint.cpp | 95 + gtsam/3rdparty/Eigen/test/product_small.cpp | 45 + gtsam/3rdparty/Eigen/test/product_symm.cpp | 111 + gtsam/3rdparty/Eigen/test/product_syrk.cpp | 113 + gtsam/3rdparty/Eigen/test/product_trmm.cpp | 93 + gtsam/3rdparty/Eigen/test/product_trmv.cpp | 103 + gtsam/3rdparty/Eigen/test/product_trsolve.cpp | 108 + gtsam/3rdparty/Eigen/test/qr.cpp | 141 + gtsam/3rdparty/Eigen/test/qr_colpivoting.cpp | 165 + gtsam/3rdparty/Eigen/test/qr_fullpivoting.cpp | 147 + gtsam/3rdparty/Eigen/test/qtvector.cpp | 173 + gtsam/3rdparty/Eigen/test/redux.cpp | 164 + gtsam/3rdparty/Eigen/test/resize.cpp | 56 + gtsam/3rdparty/Eigen/test/runtest.sh | 20 + gtsam/3rdparty/Eigen/test/schur_complex.cpp | 89 + gtsam/3rdparty/Eigen/test/schur_real.cpp | 108 + gtsam/3rdparty/Eigen/test/selfadjoint.cpp | 74 + gtsam/3rdparty/Eigen/test/sizeof.cpp | 49 + gtsam/3rdparty/Eigen/test/smallvectors.cpp | 57 + gtsam/3rdparty/Eigen/test/sparse.h | 175 + gtsam/3rdparty/Eigen/test/sparse_basic.cpp | 282 + gtsam/3rdparty/Eigen/test/sparse_product.cpp | 173 + gtsam/3rdparty/Eigen/test/sparse_solvers.cpp | 118 + gtsam/3rdparty/Eigen/test/sparse_vector.cpp | 101 + gtsam/3rdparty/Eigen/test/stable_norm.cpp | 125 + gtsam/3rdparty/Eigen/test/stddeque.cpp | 147 + gtsam/3rdparty/Eigen/test/stdlist.cpp | 147 + gtsam/3rdparty/Eigen/test/stdvector.cpp | 163 + .../Eigen/test/stdvector_overload.cpp | 176 + gtsam/3rdparty/Eigen/test/swap.cpp | 98 + gtsam/3rdparty/Eigen/test/testsuite.cmake | 229 + gtsam/3rdparty/Eigen/test/triangular.cpp | 265 + gtsam/3rdparty/Eigen/test/umeyama.cpp | 198 + gtsam/3rdparty/Eigen/test/unalignedassert.cpp | 142 + gtsam/3rdparty/Eigen/test/unalignedcount.cpp | 59 + .../Eigen/test/upperbidiagonalization.cpp | 56 + .../Eigen/test/vectorization_logic.cpp | 250 + gtsam/3rdparty/Eigen/test/visitor.cpp | 133 + gtsam/3rdparty/Eigen/test/zerosized.cpp | 69 + .../3rdparty/Eigen/unsupported/CMakeLists.txt | 7 + .../Eigen/unsupported/Eigen/AdolcForward | 182 + .../Eigen/unsupported/Eigen/AlignedVector3 | 204 + .../3rdparty/Eigen/unsupported/Eigen/AutoDiff | 55 + gtsam/3rdparty/Eigen/unsupported/Eigen/BVH | 111 + .../Eigen/unsupported/Eigen/CMakeLists.txt | 11 + .../Eigen/unsupported/Eigen/CholmodSupport | 33 + gtsam/3rdparty/Eigen/unsupported/Eigen/FFT | 433 ++ .../Eigen/unsupported/Eigen/IterativeSolvers | 51 + .../Eigen/unsupported/Eigen/MPRealSupport | 162 + .../Eigen/unsupported/Eigen/MatrixFunctions | 269 + .../Eigen/unsupported/Eigen/MoreVectorization | 16 + .../unsupported/Eigen/NonLinearOptimization | 154 + .../Eigen/unsupported/Eigen/NumericalDiff | 70 + .../Eigen/unsupported/Eigen/OpenGLSupport | 332 ++ .../Eigen/unsupported/Eigen/Polynomials | 137 + .../3rdparty/Eigen/unsupported/Eigen/Skyline | 35 + .../Eigen/unsupported/Eigen/SparseExtra | 69 + .../Eigen/unsupported/Eigen/SuperLUSupport | 35 + .../Eigen/unsupported/Eigen/UmfPackSupport | 33 + .../Eigen/src/AutoDiff/AutoDiffJacobian.h | 98 + .../Eigen/src/AutoDiff/AutoDiffScalar.h | 576 ++ .../Eigen/src/AutoDiff/AutoDiffVector.h | 235 + .../Eigen/src/AutoDiff/CMakeLists.txt | 6 + .../unsupported/Eigen/src/BVH/BVAlgorithms.h | 304 ++ .../unsupported/Eigen/src/BVH/CMakeLists.txt | 6 + .../Eigen/unsupported/Eigen/src/BVH/KdBVH.h | 233 + .../unsupported/Eigen/src/CMakeLists.txt | 11 + .../unsupported/Eigen/src/FFT/CMakeLists.txt | 6 + .../unsupported/Eigen/src/FFT/ei_fftw_impl.h | 272 + .../Eigen/src/FFT/ei_kissfft_impl.h | 422 ++ .../Eigen/src/IterativeSolvers/CMakeLists.txt | 6 + .../IterativeSolvers/ConstrainedConjGrad.h | 198 + .../IterativeSolvers/IterationController.h | 166 + .../Eigen/src/MatrixFunctions/CMakeLists.txt | 6 + .../src/MatrixFunctions/MatrixExponential.h | 351 ++ .../src/MatrixFunctions/MatrixFunction.h | 589 +++ .../MatrixFunctions/MatrixFunctionAtomic.h | 142 + .../Eigen/src/MatrixFunctions/StemFunction.h | 116 + .../src/MoreVectorization/CMakeLists.txt | 6 + .../src/MoreVectorization/MathFunctions.h | 106 + .../src/NonLinearOptimization/CMakeLists.txt | 6 + .../HybridNonLinearSolver.h | 609 +++ .../LevenbergMarquardt.h | 656 +++ .../Eigen/src/NonLinearOptimization/chkder.h | 60 + .../Eigen/src/NonLinearOptimization/covar.h | 65 + .../Eigen/src/NonLinearOptimization/dogleg.h | 100 + .../Eigen/src/NonLinearOptimization/fdjac1.h | 72 + .../Eigen/src/NonLinearOptimization/lmpar.h | 290 ++ .../Eigen/src/NonLinearOptimization/qrsolv.h | 87 + .../Eigen/src/NonLinearOptimization/r1mpyq.h | 26 + .../Eigen/src/NonLinearOptimization/r1updt.h | 92 + .../Eigen/src/NonLinearOptimization/rwupdt.h | 46 + .../Eigen/src/NumericalDiff/CMakeLists.txt | 6 + .../Eigen/src/NumericalDiff/NumericalDiff.h | 139 + .../Eigen/src/Polynomials/CMakeLists.txt | 6 + .../Eigen/src/Polynomials/Companion.h | 286 + .../Eigen/src/Polynomials/PolynomialSolver.h | 397 ++ .../Eigen/src/Polynomials/PolynomialUtils.h | 153 + .../Eigen/src/Skyline/CMakeLists.txt | 6 + .../Eigen/src/Skyline/SkylineInplaceLU.h | 363 ++ .../Eigen/src/Skyline/SkylineMatrix.h | 873 ++++ .../Eigen/src/Skyline/SkylineMatrixBase.h | 223 + .../Eigen/src/Skyline/SkylineProduct.h | 306 ++ .../Eigen/src/Skyline/SkylineStorage.h | 270 + .../Eigen/src/Skyline/SkylineUtil.h | 101 + .../unsupported/Eigen/src/SparseExtra/Amd.h | 448 ++ .../Eigen/src/SparseExtra/CMakeLists.txt | 6 + .../Eigen/src/SparseExtra/CholmodSupport.h | 399 ++ .../src/SparseExtra/CholmodSupportLegacy.h | 517 ++ .../Eigen/src/SparseExtra/RandomSetter.h | 340 ++ .../src/SparseExtra/SimplicialCholesky.h | 477 ++ .../unsupported/Eigen/src/SparseExtra/Solve.h | 82 + .../Eigen/src/SparseExtra/SparseLDLTLegacy.h | 414 ++ .../Eigen/src/SparseExtra/SparseLLT.h | 245 + .../Eigen/src/SparseExtra/SparseLU.h | 163 + .../Eigen/src/SparseExtra/SuperLUSupport.h | 667 +++ .../Eigen/src/SparseExtra/UmfPackSupport.h | 350 ++ gtsam/3rdparty/Eigen/unsupported/README.txt | 50 + .../Eigen/unsupported/doc/CMakeLists.txt | 4 + .../Eigen/unsupported/doc/Doxyfile.in | 1459 ++++++ .../Eigen/unsupported/doc/Overview.dox | 13 + .../unsupported/doc/examples/BVH_Example.cpp | 52 + .../unsupported/doc/examples/CMakeLists.txt | 22 + .../Eigen/unsupported/doc/examples/FFT.cpp | 118 + .../doc/examples/MatrixExponential.cpp | 16 + .../doc/examples/MatrixFunction.cpp | 23 + .../unsupported/doc/examples/MatrixSine.cpp | 20 + .../unsupported/doc/examples/MatrixSinh.cpp | 20 + .../doc/examples/PolynomialSolver1.cpp | 53 + .../doc/examples/PolynomialUtils1.cpp | 20 + .../unsupported/doc/snippets/CMakeLists.txt | 28 + gtsam/3rdparty/Eigen/unsupported/test/BVH.cpp | 237 + .../Eigen/unsupported/test/CMakeLists.txt | 138 + gtsam/3rdparty/Eigen/unsupported/test/FFT.cpp | 2 + .../3rdparty/Eigen/unsupported/test/FFTW.cpp | 280 + .../test/NonLinearOptimization.cpp | 1861 +++++++ .../Eigen/unsupported/test/NumericalDiff.cpp | 114 + .../Eigen/unsupported/test/alignedvector3.cpp | 74 + .../Eigen/unsupported/test/autodiff.cpp | 164 + .../Eigen/unsupported/test/forward_adolc.cpp | 141 + .../unsupported/test/matrix_exponential.cpp | 161 + .../unsupported/test/matrix_function.cpp | 188 + .../Eigen/unsupported/test/mpreal.cpp | 408 ++ .../3rdparty/Eigen/unsupported/test/mpreal.h | 3122 +++++++++++ .../Eigen/unsupported/test/mpreal_support.cpp | 44 + .../Eigen/unsupported/test/openglsupport.cpp | 352 ++ .../unsupported/test/polynomialsolver.cpp | 262 + .../unsupported/test/polynomialutils.cpp | 128 + .../Eigen/unsupported/test/sparse_extra.cpp | 154 + .../Eigen/unsupported/test/sparse_ldlt.cpp | 175 + .../Eigen/unsupported/test/sparse_llt.cpp | 140 + .../Eigen/unsupported/test/sparse_lu.cpp | 113 + gtsam/3rdparty/UFconfig/README.txt | 35 + gtsam/3rdparty/UFconfig/UFconfig.c | 71 + gtsam/3rdparty/UFconfig/UFconfig.h | 152 + gtsam/3rdparty/UFconfig/UFconfig.mk | 386 ++ gtsam/3rdparty/UFconfig/xerbla/xerbla.c | 12 + gtsam/3rdparty/UFconfig/xerbla/xerbla.f | 46 + gtsam/3rdparty/UFconfig/xerbla/xerbla.h | 2 + 1204 files changed, 195552 insertions(+) create mode 100755 gtsam/3rdparty/CCOLAMD/Demo/ccolamd_example create mode 100644 gtsam/3rdparty/CCOLAMD/Demo/ccolamd_example.c create mode 100644 gtsam/3rdparty/CCOLAMD/Demo/ccolamd_example.out create mode 100755 gtsam/3rdparty/CCOLAMD/Demo/ccolamd_l_example create mode 100644 gtsam/3rdparty/CCOLAMD/Demo/ccolamd_l_example.c create mode 100644 gtsam/3rdparty/CCOLAMD/Demo/ccolamd_l_example.out create mode 100644 gtsam/3rdparty/CCOLAMD/Demo/my_ccolamd_example.out create mode 100644 gtsam/3rdparty/CCOLAMD/Demo/my_ccolamd_l_example.out create mode 100644 gtsam/3rdparty/CCOLAMD/Doc/ChangeLog create mode 100644 gtsam/3rdparty/CCOLAMD/Doc/lesser.txt create mode 100644 gtsam/3rdparty/CCOLAMD/Include/ccolamd.h create mode 100644 gtsam/3rdparty/CCOLAMD/Lib/ccolamd.o create mode 100644 gtsam/3rdparty/CCOLAMD/Lib/ccolamd_global.o create mode 100644 gtsam/3rdparty/CCOLAMD/Lib/ccolamd_l.o create mode 100644 gtsam/3rdparty/CCOLAMD/Lib/libccolamd.a create mode 100644 gtsam/3rdparty/CCOLAMD/MATLAB/Contents.m create mode 100644 gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd.m create mode 100644 gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_demo.m create mode 100644 gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_install.m create mode 100644 gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_make.m create mode 100644 gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_test.m create mode 100644 gtsam/3rdparty/CCOLAMD/MATLAB/ccolamdmex.c create mode 100644 gtsam/3rdparty/CCOLAMD/MATLAB/ccolamdtestmex.c create mode 100644 gtsam/3rdparty/CCOLAMD/MATLAB/ccolamdtestmex.m create mode 100644 gtsam/3rdparty/CCOLAMD/MATLAB/csymamd.m create mode 100644 gtsam/3rdparty/CCOLAMD/MATLAB/csymamdmex.c create mode 100644 gtsam/3rdparty/CCOLAMD/MATLAB/csymamdtestmex.c create mode 100644 gtsam/3rdparty/CCOLAMD/MATLAB/csymamdtestmex.m create mode 100644 gtsam/3rdparty/CCOLAMD/MATLAB/luflops.m create mode 100644 gtsam/3rdparty/CCOLAMD/README.txt create mode 100644 gtsam/3rdparty/CCOLAMD/Source/ccolamd.c create mode 100644 gtsam/3rdparty/CCOLAMD/Source/ccolamd_global.c create mode 100644 gtsam/3rdparty/Eigen/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/COPYING.GPL create mode 100644 gtsam/3rdparty/Eigen/COPYING.LGPL create mode 100644 gtsam/3rdparty/Eigen/CTestConfig.cmake create mode 100644 gtsam/3rdparty/Eigen/CTestCustom.cmake.in create mode 100644 gtsam/3rdparty/Eigen/Eigen/Array create mode 100644 gtsam/3rdparty/Eigen/Eigen/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/Cholesky create mode 100644 gtsam/3rdparty/Eigen/Eigen/Core create mode 100644 gtsam/3rdparty/Eigen/Eigen/Dense create mode 100644 gtsam/3rdparty/Eigen/Eigen/Eigen create mode 100644 gtsam/3rdparty/Eigen/Eigen/Eigen2Support create mode 100644 gtsam/3rdparty/Eigen/Eigen/Eigenvalues create mode 100644 gtsam/3rdparty/Eigen/Eigen/Geometry create mode 100644 gtsam/3rdparty/Eigen/Eigen/Householder create mode 100644 gtsam/3rdparty/Eigen/Eigen/Jacobi create mode 100644 gtsam/3rdparty/Eigen/Eigen/LU create mode 100644 gtsam/3rdparty/Eigen/Eigen/LeastSquares create mode 100644 gtsam/3rdparty/Eigen/Eigen/QR create mode 100644 gtsam/3rdparty/Eigen/Eigen/QtAlignedMalloc create mode 100644 gtsam/3rdparty/Eigen/Eigen/SVD create mode 100644 gtsam/3rdparty/Eigen/Eigen/Sparse create mode 100644 gtsam/3rdparty/Eigen/Eigen/StdDeque create mode 100644 gtsam/3rdparty/Eigen/Eigen/StdList create mode 100644 gtsam/3rdparty/Eigen/Eigen/StdVector create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Cholesky/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Cholesky/LDLT.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Cholesky/LLT.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/Array.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/ArrayBase.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/ArrayWrapper.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/Assign.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/BandMatrix.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/Block.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/BooleanRedux.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/CommaInitializer.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/CwiseBinaryOp.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/CwiseNullaryOp.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/CwiseUnaryOp.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/CwiseUnaryView.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/DenseBase.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/DenseCoeffsBase.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/DenseStorage.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/Diagonal.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/DiagonalMatrix.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/DiagonalProduct.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/Dot.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/EigenBase.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/Flagged.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/ForceAlignedAccess.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/Functors.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/Fuzzy.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/GenericPacketMath.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/GlobalFunctions.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/IO.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/Map.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/MapBase.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/MathFunctions.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/Matrix.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/MatrixBase.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/NestByValue.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/NoAlias.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/NumTraits.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/PermutationMatrix.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/PlainObjectBase.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/Product.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/ProductBase.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/Random.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/Redux.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/Replicate.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/ReturnByValue.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/Reverse.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/Select.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/SelfAdjointView.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/SelfCwiseBinaryOp.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/SolveTriangular.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/StableNorm.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/Stride.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/Swap.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/Transpose.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/Transpositions.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/TriangularMatrix.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/VectorBlock.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/VectorwiseOp.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/Visitor.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/arch/AltiVec/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/arch/AltiVec/Complex.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/arch/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/arch/Default/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/arch/Default/Settings.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/arch/NEON/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/arch/NEON/Complex.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/arch/NEON/PacketMath.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/arch/SSE/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/arch/SSE/Complex.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/arch/SSE/MathFunctions.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/arch/SSE/PacketMath.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/products/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/products/CoeffBasedProduct.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/products/GeneralMatrixVector.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/products/Parallelizer.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/products/SelfadjointProduct.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/products/SelfadjointRank2Update.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/products/TriangularMatrixVector.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/products/TriangularSolverMatrix.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/products/TriangularSolverVector.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/util/BlasUtil.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/util/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/util/Constants.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/util/DisableStupidWarnings.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/util/ForwardDeclarations.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/util/Macros.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/util/Memory.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/util/Meta.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/util/ReenableStupidWarnings.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/util/StaticAssert.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Core/util/XprHelper.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/Block.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/Cwise.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/CwiseOperators.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/Geometry/AlignedBox.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/Geometry/All.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/Geometry/AngleAxis.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/Geometry/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/Geometry/Hyperplane.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/Geometry/ParametrizedLine.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/Geometry/Quaternion.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/Geometry/Rotation2D.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/Geometry/RotationBase.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/Geometry/Scaling.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/Geometry/Transform.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/Geometry/Translation.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/LU.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/Lazy.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/LeastSquares.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/Macros.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/MathFunctions.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/Memory.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/Meta.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/Minor.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/QR.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/SVD.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/TriangularSolver.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigen2Support/VectorBlock.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigenvalues/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigenvalues/ComplexSchur.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigenvalues/EigenSolver.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigenvalues/EigenvaluesCommon.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigenvalues/RealSchur.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Eigenvalues/Tridiagonalization.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Geometry/AlignedBox.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Geometry/AngleAxis.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Geometry/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Geometry/EulerAngles.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Geometry/Homogeneous.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Geometry/Hyperplane.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Geometry/OrthoMethods.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Geometry/ParametrizedLine.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Geometry/Quaternion.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Geometry/Rotation2D.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Geometry/RotationBase.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Geometry/Scaling.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Geometry/Transform.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Geometry/Translation.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Geometry/Umeyama.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Geometry/arch/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Geometry/arch/Geometry_SSE.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Householder/BlockHouseholder.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Householder/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Householder/Householder.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Householder/HouseholderSequence.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Jacobi/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Jacobi/Jacobi.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/LU/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/LU/Determinant.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/LU/FullPivLU.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/LU/Inverse.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/LU/PartialPivLU.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/LU/arch/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/LU/arch/Inverse_SSE.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/QR/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/QR/ColPivHouseholderQR.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/QR/FullPivHouseholderQR.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/QR/HouseholderQR.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/SVD/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/SVD/JacobiSVD.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/SVD/UpperBidiagonalization.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/AmbiVector.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/CompressedStorage.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/CoreIterators.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/DynamicSparseMatrix.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/MappedSparseMatrix.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/SparseAssign.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/SparseBlock.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/SparseCwiseBinaryOp.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/SparseCwiseUnaryOp.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/SparseDenseProduct.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/SparseDiagonalProduct.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/SparseDot.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/SparseFuzzy.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/SparseMatrix.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/SparseMatrixBase.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/SparseProduct.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/SparseRedux.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/SparseSelfAdjointView.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/SparseSparseProduct.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/SparseTranspose.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/SparseTriangularView.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/SparseUtil.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/SparseVector.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/SparseView.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/Sparse/TriangularSolver.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/StlSupport/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/StlSupport/StdDeque.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/StlSupport/StdList.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/StlSupport/StdVector.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/StlSupport/details.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/misc/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/misc/Image.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/misc/Kernel.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/misc/Solve.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/plugins/BlockMethods.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/plugins/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/plugins/CommonCwiseBinaryOps.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/plugins/CommonCwiseUnaryOps.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h create mode 100644 gtsam/3rdparty/Eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h create mode 100644 gtsam/3rdparty/Eigen/INSTALL create mode 100644 gtsam/3rdparty/Eigen/bench/BenchSparseUtil.h create mode 100644 gtsam/3rdparty/Eigen/bench/BenchTimer.h create mode 100644 gtsam/3rdparty/Eigen/bench/BenchUtil.h create mode 100644 gtsam/3rdparty/Eigen/bench/README.txt create mode 100644 gtsam/3rdparty/Eigen/bench/basicbench.cxxlist create mode 100644 gtsam/3rdparty/Eigen/bench/basicbenchmark.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/basicbenchmark.h create mode 100644 gtsam/3rdparty/Eigen/bench/benchBlasGemm.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/benchCholesky.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/benchEigenSolver.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/benchFFT.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/benchVecAdd.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/bench_gemm.cpp create mode 100755 gtsam/3rdparty/Eigen/bench/bench_multi_compilers.sh create mode 100644 gtsam/3rdparty/Eigen/bench/bench_norm.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/bench_reverse.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/bench_sum.cpp create mode 100755 gtsam/3rdparty/Eigen/bench/bench_unrolling create mode 100644 gtsam/3rdparty/Eigen/bench/benchmark.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/benchmarkSlice.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/benchmarkX.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/benchmarkXcwise.cpp create mode 100755 gtsam/3rdparty/Eigen/bench/benchmark_suite create mode 100644 gtsam/3rdparty/Eigen/bench/btl/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/bench/btl/COPYING create mode 100644 gtsam/3rdparty/Eigen/bench/btl/README create mode 100644 gtsam/3rdparty/Eigen/bench/btl/actions/action_aat_product.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/actions/action_ata_product.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/actions/action_atv_product.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/actions/action_axpby.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/actions/action_axpy.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/actions/action_cholesky.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/actions/action_ger.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/actions/action_hessenberg.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/actions/action_lu_decomp.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/actions/action_lu_solve.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/actions/action_matrix_matrix_product.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/actions/action_matrix_matrix_product_bis.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/actions/action_matrix_vector_product.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/actions/action_partial_lu.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/actions/action_rot.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/actions/action_symv.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/actions/action_syr2.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/actions/action_trisolve.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/actions/action_trisolve_matrix.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/actions/action_trmm.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/actions/basic_actions.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/cmake/FindACML.cmake create mode 100644 gtsam/3rdparty/Eigen/bench/btl/cmake/FindATLAS.cmake create mode 100644 gtsam/3rdparty/Eigen/bench/btl/cmake/FindBlitz.cmake create mode 100644 gtsam/3rdparty/Eigen/bench/btl/cmake/FindCBLAS.cmake create mode 100644 gtsam/3rdparty/Eigen/bench/btl/cmake/FindEigen3.cmake create mode 100644 gtsam/3rdparty/Eigen/bench/btl/cmake/FindGMM.cmake create mode 100644 gtsam/3rdparty/Eigen/bench/btl/cmake/FindGOTO.cmake create mode 100644 gtsam/3rdparty/Eigen/bench/btl/cmake/FindGOTO2.cmake create mode 100644 gtsam/3rdparty/Eigen/bench/btl/cmake/FindMKL.cmake create mode 100644 gtsam/3rdparty/Eigen/bench/btl/cmake/FindMTL4.cmake create mode 100644 gtsam/3rdparty/Eigen/bench/btl/cmake/FindPackageHandleStandardArgs.cmake create mode 100644 gtsam/3rdparty/Eigen/bench/btl/cmake/FindTvmet.cmake create mode 100644 gtsam/3rdparty/Eigen/bench/btl/cmake/MacroOptionalAddSubdirectory.cmake create mode 100644 gtsam/3rdparty/Eigen/bench/btl/data/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/bench/btl/data/action_settings.txt create mode 100644 gtsam/3rdparty/Eigen/bench/btl/data/gnuplot_common_settings.hh create mode 100755 gtsam/3rdparty/Eigen/bench/btl/data/go_mean create mode 100644 gtsam/3rdparty/Eigen/bench/btl/data/mean.cxx create mode 100644 gtsam/3rdparty/Eigen/bench/btl/data/mk_gnuplot_script.sh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/data/mk_mean_script.sh create mode 100755 gtsam/3rdparty/Eigen/bench/btl/data/mk_new_gnuplot.sh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/data/perlib_plot_settings.txt create mode 100644 gtsam/3rdparty/Eigen/bench/btl/data/regularize.cxx create mode 100644 gtsam/3rdparty/Eigen/bench/btl/data/smooth.cxx create mode 100755 gtsam/3rdparty/Eigen/bench/btl/data/smooth_all.sh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/generic_bench/bench.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/generic_bench/bench_parameter.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/generic_bench/btl.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/generic_bench/init/init_function.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/generic_bench/init/init_matrix.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/generic_bench/init/init_vector.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/generic_bench/static/bench_static.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/generic_bench/static/intel_bench_fixed_size.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/generic_bench/static/static_size_generator.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/generic_bench/timers/STL_perf_analyzer.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/generic_bench/timers/STL_timer.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/generic_bench/timers/mixed_perf_analyzer.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/generic_bench/timers/portable_perf_analyzer.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/generic_bench/timers/portable_perf_analyzer_old.hh create mode 100755 gtsam/3rdparty/Eigen/bench/btl/generic_bench/timers/portable_timer.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/generic_bench/timers/x86_perf_analyzer.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/generic_bench/timers/x86_timer.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/generic_bench/utils/size_lin_log.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/generic_bench/utils/size_log.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/generic_bench/utils/utilities.h create mode 100644 gtsam/3rdparty/Eigen/bench/btl/generic_bench/utils/xy_file.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/C/CMakeLists.txt create mode 100755 gtsam/3rdparty/Eigen/bench/btl/libs/C/C_interface.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/C/main.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/C_BLAS/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/C_BLAS/C_BLAS_interface.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/C_BLAS/blas.h create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/C_BLAS/cblas.h create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/C_BLAS/main.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/STL/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/STL/STL_interface.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/STL/main.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/STL_algo/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/STL_algo/STL_algo_interface.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/STL_algo/main.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/blitz/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/blitz/blitz_LU_solve_interface.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/blitz/blitz_interface.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/blitz/btl_blitz.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/blitz/btl_tiny_blitz.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/blitz/tiny_blitz_interface.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/eigen3/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/eigen3/btl_tiny_eigen3.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/eigen3/eigen3_interface.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/eigen3/main_adv.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/eigen3/main_linear.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/eigen3/main_matmat.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/eigen3/main_vecmat.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/f77/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/f77/daat.f create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/f77/data.f create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/f77/daxpy.f create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/f77/dmxm.f create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/f77/dmxm.f.mfr create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/f77/dmxv.f create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/f77/f77_interface.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/f77/f77_interface_base.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/f77/main.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/f77/saat.f create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/f77/sata.f create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/f77/saxpy.f create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/f77/smxm.f create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/f77/smxv.f create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/f77/test_interface.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/gmm/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/gmm/gmm_LU_solve_interface.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/gmm/gmm_interface.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/gmm/main.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/hand_vec/CMakeLists.txt create mode 100755 gtsam/3rdparty/Eigen/bench/btl/libs/hand_vec/hand_vec_interface.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/hand_vec/main.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/mtl4/.kdbgrc.main create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/mtl4/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/mtl4/main.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/mtl4/mtl4_LU_solve_interface.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/mtl4/mtl4_interface.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/tvmet/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/tvmet/main.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/tvmet/tvmet_interface.hh create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/ublas/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/ublas/main.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/btl/libs/ublas/ublas_interface.hh create mode 100644 gtsam/3rdparty/Eigen/bench/check_cache_queries.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/eig33.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/geometry.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/product_threshold.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/quat_slerp.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/quatmul.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/sparse_cholesky.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/sparse_dense_product.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/sparse_lu.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/sparse_product.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/sparse_randomsetter.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/sparse_setter.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/sparse_transpose.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/sparse_trisolver.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/spmv.cpp create mode 100644 gtsam/3rdparty/Eigen/bench/vdw_new.cpp create mode 100644 gtsam/3rdparty/Eigen/blas/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/blas/README.txt create mode 100644 gtsam/3rdparty/Eigen/blas/chbmv.f create mode 100644 gtsam/3rdparty/Eigen/blas/chpmv.f create mode 100644 gtsam/3rdparty/Eigen/blas/chpr.f create mode 100644 gtsam/3rdparty/Eigen/blas/chpr2.f create mode 100644 gtsam/3rdparty/Eigen/blas/common.h create mode 100644 gtsam/3rdparty/Eigen/blas/complex_double.cpp create mode 100644 gtsam/3rdparty/Eigen/blas/complex_single.cpp create mode 100644 gtsam/3rdparty/Eigen/blas/complexdots.f create mode 100644 gtsam/3rdparty/Eigen/blas/ctbmv.f create mode 100644 gtsam/3rdparty/Eigen/blas/ctbsv.f create mode 100644 gtsam/3rdparty/Eigen/blas/ctpmv.f create mode 100644 gtsam/3rdparty/Eigen/blas/ctpsv.f create mode 100644 gtsam/3rdparty/Eigen/blas/double.cpp create mode 100644 gtsam/3rdparty/Eigen/blas/drotm.f create mode 100644 gtsam/3rdparty/Eigen/blas/drotmg.f create mode 100644 gtsam/3rdparty/Eigen/blas/dsbmv.f create mode 100644 gtsam/3rdparty/Eigen/blas/dspmv.f create mode 100644 gtsam/3rdparty/Eigen/blas/dspr.f create mode 100644 gtsam/3rdparty/Eigen/blas/dspr2.f create mode 100644 gtsam/3rdparty/Eigen/blas/dtbmv.f create mode 100644 gtsam/3rdparty/Eigen/blas/dtbsv.f create mode 100644 gtsam/3rdparty/Eigen/blas/dtpmv.f create mode 100644 gtsam/3rdparty/Eigen/blas/dtpsv.f create mode 100644 gtsam/3rdparty/Eigen/blas/level1_cplx_impl.h create mode 100644 gtsam/3rdparty/Eigen/blas/level1_impl.h create mode 100644 gtsam/3rdparty/Eigen/blas/level1_real_impl.h create mode 100644 gtsam/3rdparty/Eigen/blas/level2_cplx_impl.h create mode 100644 gtsam/3rdparty/Eigen/blas/level2_impl.h create mode 100644 gtsam/3rdparty/Eigen/blas/level2_real_impl.h create mode 100644 gtsam/3rdparty/Eigen/blas/level3_impl.h create mode 100644 gtsam/3rdparty/Eigen/blas/lsame.f create mode 100644 gtsam/3rdparty/Eigen/blas/single.cpp create mode 100644 gtsam/3rdparty/Eigen/blas/srotm.f create mode 100644 gtsam/3rdparty/Eigen/blas/srotmg.f create mode 100644 gtsam/3rdparty/Eigen/blas/ssbmv.f create mode 100644 gtsam/3rdparty/Eigen/blas/sspmv.f create mode 100644 gtsam/3rdparty/Eigen/blas/sspr.f create mode 100644 gtsam/3rdparty/Eigen/blas/sspr2.f create mode 100644 gtsam/3rdparty/Eigen/blas/stbmv.f create mode 100644 gtsam/3rdparty/Eigen/blas/stbsv.f create mode 100644 gtsam/3rdparty/Eigen/blas/stpmv.f create mode 100644 gtsam/3rdparty/Eigen/blas/stpsv.f create mode 100644 gtsam/3rdparty/Eigen/blas/testing/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/blas/testing/cblat1.f create mode 100644 gtsam/3rdparty/Eigen/blas/testing/cblat2.dat create mode 100644 gtsam/3rdparty/Eigen/blas/testing/cblat2.f create mode 100644 gtsam/3rdparty/Eigen/blas/testing/cblat3.dat create mode 100644 gtsam/3rdparty/Eigen/blas/testing/cblat3.f create mode 100644 gtsam/3rdparty/Eigen/blas/testing/dblat1.f create mode 100644 gtsam/3rdparty/Eigen/blas/testing/dblat2.dat create mode 100644 gtsam/3rdparty/Eigen/blas/testing/dblat2.f create mode 100644 gtsam/3rdparty/Eigen/blas/testing/dblat3.dat create mode 100644 gtsam/3rdparty/Eigen/blas/testing/dblat3.f create mode 100755 gtsam/3rdparty/Eigen/blas/testing/runblastest.sh create mode 100644 gtsam/3rdparty/Eigen/blas/testing/sblat1.f create mode 100644 gtsam/3rdparty/Eigen/blas/testing/sblat2.dat create mode 100644 gtsam/3rdparty/Eigen/blas/testing/sblat2.f create mode 100644 gtsam/3rdparty/Eigen/blas/testing/sblat3.dat create mode 100644 gtsam/3rdparty/Eigen/blas/testing/sblat3.f create mode 100644 gtsam/3rdparty/Eigen/blas/testing/zblat1.f create mode 100644 gtsam/3rdparty/Eigen/blas/testing/zblat2.dat create mode 100644 gtsam/3rdparty/Eigen/blas/testing/zblat2.f create mode 100644 gtsam/3rdparty/Eigen/blas/testing/zblat3.dat create mode 100644 gtsam/3rdparty/Eigen/blas/testing/zblat3.f create mode 100644 gtsam/3rdparty/Eigen/blas/xerbla.cpp create mode 100644 gtsam/3rdparty/Eigen/blas/zhbmv.f create mode 100644 gtsam/3rdparty/Eigen/blas/zhpmv.f create mode 100644 gtsam/3rdparty/Eigen/blas/zhpr.f create mode 100644 gtsam/3rdparty/Eigen/blas/zhpr2.f create mode 100644 gtsam/3rdparty/Eigen/blas/ztbmv.f create mode 100644 gtsam/3rdparty/Eigen/blas/ztbsv.f create mode 100644 gtsam/3rdparty/Eigen/blas/ztpmv.f create mode 100644 gtsam/3rdparty/Eigen/blas/ztpsv.f create mode 100644 gtsam/3rdparty/Eigen/cmake/EigenTesting.cmake create mode 100644 gtsam/3rdparty/Eigen/cmake/FindAdolc.cmake create mode 100644 gtsam/3rdparty/Eigen/cmake/FindBLAS.cmake create mode 100644 gtsam/3rdparty/Eigen/cmake/FindCholmod.cmake create mode 100644 gtsam/3rdparty/Eigen/cmake/FindEigen2.cmake create mode 100644 gtsam/3rdparty/Eigen/cmake/FindEigen3.cmake create mode 100644 gtsam/3rdparty/Eigen/cmake/FindFFTW.cmake create mode 100644 gtsam/3rdparty/Eigen/cmake/FindGLEW.cmake create mode 100644 gtsam/3rdparty/Eigen/cmake/FindGMP.cmake create mode 100644 gtsam/3rdparty/Eigen/cmake/FindGSL.cmake create mode 100644 gtsam/3rdparty/Eigen/cmake/FindGoogleHash.cmake create mode 100644 gtsam/3rdparty/Eigen/cmake/FindLAPACK.cmake create mode 100644 gtsam/3rdparty/Eigen/cmake/FindMPFR.cmake create mode 100644 gtsam/3rdparty/Eigen/cmake/FindStandardMathLibrary.cmake create mode 100644 gtsam/3rdparty/Eigen/cmake/FindSuperLU.cmake create mode 100644 gtsam/3rdparty/Eigen/cmake/FindUmfpack.cmake create mode 100644 gtsam/3rdparty/Eigen/cmake/RegexUtils.cmake create mode 100644 gtsam/3rdparty/Eigen/debug/gdb/__init__.py create mode 100644 gtsam/3rdparty/Eigen/debug/gdb/printers.py create mode 100644 gtsam/3rdparty/Eigen/debug/msvc/eigen_autoexp_part.dat create mode 100644 gtsam/3rdparty/Eigen/demos/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/demos/mandelbrot/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/demos/mandelbrot/README create mode 100644 gtsam/3rdparty/Eigen/demos/mandelbrot/mandelbrot.cpp create mode 100644 gtsam/3rdparty/Eigen/demos/mandelbrot/mandelbrot.h create mode 100644 gtsam/3rdparty/Eigen/demos/mix_eigen_and_c/README create mode 100644 gtsam/3rdparty/Eigen/demos/mix_eigen_and_c/binary_library.cpp create mode 100644 gtsam/3rdparty/Eigen/demos/mix_eigen_and_c/binary_library.h create mode 100644 gtsam/3rdparty/Eigen/demos/mix_eigen_and_c/example.c create mode 100644 gtsam/3rdparty/Eigen/demos/opengl/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/demos/opengl/README create mode 100644 gtsam/3rdparty/Eigen/demos/opengl/camera.cpp create mode 100644 gtsam/3rdparty/Eigen/demos/opengl/camera.h create mode 100644 gtsam/3rdparty/Eigen/demos/opengl/gpuhelper.cpp create mode 100644 gtsam/3rdparty/Eigen/demos/opengl/gpuhelper.h create mode 100644 gtsam/3rdparty/Eigen/demos/opengl/icosphere.cpp create mode 100644 gtsam/3rdparty/Eigen/demos/opengl/icosphere.h create mode 100644 gtsam/3rdparty/Eigen/demos/opengl/quaternion_demo.cpp create mode 100644 gtsam/3rdparty/Eigen/demos/opengl/quaternion_demo.h create mode 100644 gtsam/3rdparty/Eigen/demos/opengl/trackball.cpp create mode 100644 gtsam/3rdparty/Eigen/demos/opengl/trackball.h create mode 100644 gtsam/3rdparty/Eigen/doc/A05_PortingFrom2To3.dox create mode 100644 gtsam/3rdparty/Eigen/doc/A10_Eigen2SupportModes.dox create mode 100644 gtsam/3rdparty/Eigen/doc/AsciiQuickReference.txt create mode 100644 gtsam/3rdparty/Eigen/doc/B01_Experimental.dox create mode 100644 gtsam/3rdparty/Eigen/doc/C00_QuickStartGuide.dox create mode 100644 gtsam/3rdparty/Eigen/doc/C01_TutorialMatrixClass.dox create mode 100644 gtsam/3rdparty/Eigen/doc/C02_TutorialMatrixArithmetic.dox create mode 100644 gtsam/3rdparty/Eigen/doc/C03_TutorialArrayClass.dox create mode 100644 gtsam/3rdparty/Eigen/doc/C04_TutorialBlockOperations.dox create mode 100644 gtsam/3rdparty/Eigen/doc/C05_TutorialAdvancedInitialization.dox create mode 100644 gtsam/3rdparty/Eigen/doc/C06_TutorialLinearAlgebra.dox create mode 100644 gtsam/3rdparty/Eigen/doc/C07_TutorialReductionsVisitorsBroadcasting.dox create mode 100644 gtsam/3rdparty/Eigen/doc/C08_TutorialGeometry.dox create mode 100644 gtsam/3rdparty/Eigen/doc/C09_TutorialSparse.dox create mode 100644 gtsam/3rdparty/Eigen/doc/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/doc/D01_StlContainers.dox create mode 100644 gtsam/3rdparty/Eigen/doc/D03_WrongStackAlignment.dox create mode 100644 gtsam/3rdparty/Eigen/doc/D07_PassingByValue.dox create mode 100644 gtsam/3rdparty/Eigen/doc/D09_StructHavingEigenMembers.dox create mode 100644 gtsam/3rdparty/Eigen/doc/D11_UnalignedArrayAssert.dox create mode 100644 gtsam/3rdparty/Eigen/doc/Doxyfile.in create mode 100644 gtsam/3rdparty/Eigen/doc/Eigen_Silly_Professor_64x64.png create mode 100644 gtsam/3rdparty/Eigen/doc/I00_CustomizingEigen.dox create mode 100644 gtsam/3rdparty/Eigen/doc/I01_TopicLazyEvaluation.dox create mode 100644 gtsam/3rdparty/Eigen/doc/I02_HiPerformance.dox create mode 100644 gtsam/3rdparty/Eigen/doc/I03_InsideEigenExample.dox create mode 100644 gtsam/3rdparty/Eigen/doc/I05_FixedSizeVectorizable.dox create mode 100644 gtsam/3rdparty/Eigen/doc/I06_TopicEigenExpressionTemplates.dox create mode 100644 gtsam/3rdparty/Eigen/doc/I07_TopicScalarTypes.dox create mode 100644 gtsam/3rdparty/Eigen/doc/I08_Resizing.dox create mode 100644 gtsam/3rdparty/Eigen/doc/I09_Vectorization.dox create mode 100644 gtsam/3rdparty/Eigen/doc/I10_Assertions.dox create mode 100644 gtsam/3rdparty/Eigen/doc/I11_Aliasing.dox create mode 100644 gtsam/3rdparty/Eigen/doc/I12_ClassHierarchy.dox create mode 100644 gtsam/3rdparty/Eigen/doc/I13_FunctionsTakingEigenTypes.dox create mode 100644 gtsam/3rdparty/Eigen/doc/I14_PreprocessorDirectives.dox create mode 100644 gtsam/3rdparty/Eigen/doc/I15_StorageOrders.dox create mode 100644 gtsam/3rdparty/Eigen/doc/Overview.dox create mode 100644 gtsam/3rdparty/Eigen/doc/QuickReference.dox create mode 100644 gtsam/3rdparty/Eigen/doc/TopicLinearAlgebraDecompositions.dox create mode 100644 gtsam/3rdparty/Eigen/doc/eigendoxy.css create mode 100644 gtsam/3rdparty/Eigen/doc/eigendoxy_footer.html.in create mode 100644 gtsam/3rdparty/Eigen/doc/eigendoxy_header.html.in create mode 100644 gtsam/3rdparty/Eigen/doc/eigendoxy_tabs.css create mode 100644 gtsam/3rdparty/Eigen/doc/examples/.krazy create mode 100644 gtsam/3rdparty/Eigen/doc/examples/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/doc/examples/DenseBase_middleCols_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/DenseBase_middleRows_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/DenseBase_template_int_middleCols.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/DenseBase_template_int_middleRows.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/MatrixBase_cwise_const.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/QuickStart_example.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/QuickStart_example2_dynamic.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/QuickStart_example2_fixed.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/TutorialLinAlgComputeTwice.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/TutorialLinAlgExComputeSolveError.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/TutorialLinAlgExSolveColPivHouseholderQR.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/TutorialLinAlgExSolveLDLT.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/TutorialLinAlgInverseDeterminant.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/TutorialLinAlgRankRevealing.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/TutorialLinAlgSVDSolve.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/TutorialLinAlgSelfAdjointEigenSolver.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/TutorialLinAlgSetThreshold.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_ArrayClass_accessors.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_ArrayClass_addition.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_ArrayClass_cwise_other.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_ArrayClass_interop.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_ArrayClass_interop_matrix.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_ArrayClass_mult.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_BlockOperations_block_assignment.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_BlockOperations_colrow.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_BlockOperations_corner.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_BlockOperations_print_block.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_BlockOperations_vector.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_PartialLU_solve.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_rowwise.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_simple_example_dynamic_size.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/Tutorial_simple_example_fixed_size.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/class_Block.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/class_CwiseBinaryOp.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/class_CwiseUnaryOp.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/class_CwiseUnaryOp_ptrfun.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/class_FixedBlock.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/class_FixedVectorBlock.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/class_VectorBlock.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/function_taking_eigenbase.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/tut_arithmetic_add_sub.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/tut_arithmetic_dot_cross.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/tut_arithmetic_matrix_mul.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/tut_arithmetic_redux_basic.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/tut_arithmetic_scalar_mul_div.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/tut_matrix_coefficient_accessors.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/tut_matrix_resize.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/examples/tut_matrix_resize_fixed_size.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/.krazy create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/AngleAxis_mimic_euler.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/ColPivHouseholderQR_solve.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/ComplexEigenSolver_compute.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/ComplexEigenSolver_eigenvalues.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/ComplexEigenSolver_eigenvectors.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/ComplexSchur_compute.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/ComplexSchur_matrixT.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/ComplexSchur_matrixU.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_abs.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_abs2.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_acos.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_cos.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_cube.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_equal_equal.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_exp.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_greater.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_greater_equal.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_inverse.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_less.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_less_equal.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_log.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_max.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_min.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_minus.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_minus_equal.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_not_equal.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_plus.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_plus_equal.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_pow.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_product.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_quotient.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_sin.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_slash_equal.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_sqrt.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_square.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_tan.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Cwise_times_equal.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/DenseBase_LinSpaced.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/DenseBase_LinSpaced_seq.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/DenseBase_setLinSpaced.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/DirectionWise_replicate.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/DirectionWise_replicate_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/EigenSolver_EigenSolver_MatrixType.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/EigenSolver_compute.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/EigenSolver_eigenvalues.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/EigenSolver_eigenvectors.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/EigenSolver_pseudoEigenvectors.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/FullPivHouseholderQR_solve.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/FullPivLU_image.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/FullPivLU_kernel.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/FullPivLU_solve.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/HessenbergDecomposition_compute.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/HessenbergDecomposition_matrixH.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/HessenbergDecomposition_packedMatrix.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/HouseholderQR_solve.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/HouseholderSequence_HouseholderSequence.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/IOFormat.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/JacobiSVD_basic.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Jacobi_makeGivens.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Jacobi_makeJacobi.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/LLT_solve.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Map_general_stride.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Map_inner_stride.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Map_outer_stride.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Map_placement_new.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Map_simple.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_adjoint.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_all.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_array.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_array_const.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_asDiagonal.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_block_int_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_block_int_int_int_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_bottomLeftCorner_int_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_bottomRightCorner_int_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_bottomRows_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_cast.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_col.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_colwise.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_computeInverseAndDetWithCheck.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_computeInverseWithCheck.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_cwiseAbs.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_cwiseAbs2.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_cwiseEqual.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_cwiseInverse.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_cwiseMax.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_cwiseMin.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_cwiseNotEqual.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_cwiseProduct.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_cwiseQuotient.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_cwiseSqrt.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_diagonal.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_diagonal_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_diagonal_template_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_eigenvalues.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_end_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_eval.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_extract.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_fixedBlock_int_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_identity.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_identity_int_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_inverse.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_isDiagonal.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_isIdentity.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_isOnes.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_isOrthogonal.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_isUnitary.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_isZero.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_leftCols_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_marked.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_noalias.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_ones.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_ones_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_ones_int_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_operatorNorm.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_part.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_prod.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_random.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_random_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_random_int_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_replicate.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_replicate_int_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_reverse.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_rightCols_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_row.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_rowwise.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_segment_int_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_select.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_set.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_setIdentity.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_setOnes.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_setRandom.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_setZero.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_start_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_template_int_bottomRows.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_template_int_end.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_template_int_int_bottomLeftCorner.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_template_int_int_bottomRightCorner.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_template_int_int_topLeftCorner.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_template_int_int_topRightCorner.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_template_int_leftCols.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_template_int_rightCols.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_template_int_segment.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_template_int_start.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_template_int_topRows.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_topLeftCorner_int_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_topRightCorner_int_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_topRows_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_transpose.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_zero.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_zero_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/MatrixBase_zero_int_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Matrix_resize_NoChange_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Matrix_resize_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Matrix_resize_int_NoChange.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Matrix_resize_int_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Matrix_setConstant_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Matrix_setConstant_int_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Matrix_setIdentity_int_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Matrix_setOnes_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Matrix_setOnes_int_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Matrix_setRandom_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Matrix_setRandom_int_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Matrix_setZero_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Matrix_setZero_int_int.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/PartialPivLU_solve.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/PartialRedux_count.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/PartialRedux_maxCoeff.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/PartialRedux_minCoeff.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/PartialRedux_norm.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/PartialRedux_prod.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/PartialRedux_squaredNorm.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/PartialRedux_sum.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/RealSchur_RealSchur_MatrixType.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/RealSchur_compute.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType2.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/SelfAdjointEigenSolver_compute_MatrixType.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/SelfAdjointEigenSolver_compute_MatrixType2.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/SelfAdjointEigenSolver_eigenvalues.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/SelfAdjointEigenSolver_eigenvectors.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/SelfAdjointEigenSolver_operatorSqrt.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/SelfAdjointView_eigenvalues.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/SelfAdjointView_operatorNorm.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/TopicAliasing_block.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/TopicAliasing_block_correct.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/TopicAliasing_cwise.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/TopicAliasing_mult1.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/TopicAliasing_mult2.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/TopicAliasing_mult3.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/TopicStorageOrders_example.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Tridiagonalization_Tridiagonalization_MatrixType.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Tridiagonalization_compute.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Tridiagonalization_decomposeInPlace.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Tridiagonalization_diagonal.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Tridiagonalization_householderCoefficients.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Tridiagonalization_packedMatrix.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Tutorial_AdvancedInitialization_Block.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Tutorial_AdvancedInitialization_CommaTemporary.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Tutorial_AdvancedInitialization_Join.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Tutorial_AdvancedInitialization_LinSpaced.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Tutorial_AdvancedInitialization_ThreeWays.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Tutorial_AdvancedInitialization_Zero.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Tutorial_commainit_01.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Tutorial_commainit_01b.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Tutorial_commainit_02.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Tutorial_solve_matrix_inverse.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Tutorial_solve_multiple_rhs.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Tutorial_solve_reuse_decomposition.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Tutorial_solve_singular.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Tutorial_solve_triangular.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Tutorial_solve_triangular_inplace.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/Vectorwise_reverse.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/class_FullPivLU.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/compile_snippet.cpp.in create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/tut_arithmetic_redux_minmax.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/tut_arithmetic_transpose_aliasing.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/tut_arithmetic_transpose_conjugate.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/tut_arithmetic_transpose_inplace.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/snippets/tut_matrix_assignment_resizing.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/tutorial.cpp create mode 100644 gtsam/3rdparty/Eigen/doc/unsupported_modules.dox create mode 100644 gtsam/3rdparty/Eigen/eigen3.pc.in create mode 100644 gtsam/3rdparty/Eigen/failtest/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/failtest/block_nonconst_ctor_on_const_xpr_0.cpp create mode 100644 gtsam/3rdparty/Eigen/failtest/block_nonconst_ctor_on_const_xpr_1.cpp create mode 100644 gtsam/3rdparty/Eigen/failtest/block_nonconst_ctor_on_const_xpr_2.cpp create mode 100644 gtsam/3rdparty/Eigen/failtest/block_on_const_type_actually_const_0.cpp create mode 100644 gtsam/3rdparty/Eigen/failtest/block_on_const_type_actually_const_1.cpp create mode 100644 gtsam/3rdparty/Eigen/failtest/const_qualified_block_method_retval_0.cpp create mode 100644 gtsam/3rdparty/Eigen/failtest/const_qualified_block_method_retval_1.cpp create mode 100644 gtsam/3rdparty/Eigen/failtest/const_qualified_diagonal_method_retval.cpp create mode 100644 gtsam/3rdparty/Eigen/failtest/const_qualified_transpose_method_retval.cpp create mode 100644 gtsam/3rdparty/Eigen/failtest/diagonal_nonconst_ctor_on_const_xpr.cpp create mode 100644 gtsam/3rdparty/Eigen/failtest/diagonal_on_const_type_actually_const.cpp create mode 100644 gtsam/3rdparty/Eigen/failtest/failtest_sanity_check.cpp create mode 100644 gtsam/3rdparty/Eigen/failtest/map_nonconst_ctor_on_const_ptr_0.cpp create mode 100644 gtsam/3rdparty/Eigen/failtest/map_nonconst_ctor_on_const_ptr_1.cpp create mode 100644 gtsam/3rdparty/Eigen/failtest/map_nonconst_ctor_on_const_ptr_2.cpp create mode 100644 gtsam/3rdparty/Eigen/failtest/map_nonconst_ctor_on_const_ptr_3.cpp create mode 100644 gtsam/3rdparty/Eigen/failtest/map_nonconst_ctor_on_const_ptr_4.cpp create mode 100644 gtsam/3rdparty/Eigen/failtest/map_on_const_type_actually_const_0.cpp create mode 100644 gtsam/3rdparty/Eigen/failtest/map_on_const_type_actually_const_1.cpp create mode 100644 gtsam/3rdparty/Eigen/failtest/transpose_nonconst_ctor_on_const_xpr.cpp create mode 100644 gtsam/3rdparty/Eigen/failtest/transpose_on_const_type_actually_const.cpp create mode 100644 gtsam/3rdparty/Eigen/lapack/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/lapack/cholesky.cpp create mode 100644 gtsam/3rdparty/Eigen/lapack/complex_double.cpp create mode 100644 gtsam/3rdparty/Eigen/lapack/complex_single.cpp create mode 100644 gtsam/3rdparty/Eigen/lapack/double.cpp create mode 100644 gtsam/3rdparty/Eigen/lapack/eigenvalues.cpp create mode 100644 gtsam/3rdparty/Eigen/lapack/lapack_common.h create mode 100644 gtsam/3rdparty/Eigen/lapack/lu.cpp create mode 100644 gtsam/3rdparty/Eigen/lapack/single.cpp create mode 100644 gtsam/3rdparty/Eigen/scripts/CMakeLists.txt create mode 100755 gtsam/3rdparty/Eigen/scripts/buildtests.in create mode 100755 gtsam/3rdparty/Eigen/scripts/check.in create mode 100755 gtsam/3rdparty/Eigen/scripts/debug.in create mode 100644 gtsam/3rdparty/Eigen/scripts/eigen_gen_credits.cpp create mode 100644 gtsam/3rdparty/Eigen/scripts/eigen_gen_docs create mode 100755 gtsam/3rdparty/Eigen/scripts/release.in create mode 100644 gtsam/3rdparty/Eigen/signature_of_eigen3_matrix_library create mode 100644 gtsam/3rdparty/Eigen/test/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/test/adjoint.cpp create mode 100644 gtsam/3rdparty/Eigen/test/array.cpp create mode 100644 gtsam/3rdparty/Eigen/test/array_for_matrix.cpp create mode 100644 gtsam/3rdparty/Eigen/test/array_replicate.cpp create mode 100644 gtsam/3rdparty/Eigen/test/array_reverse.cpp create mode 100644 gtsam/3rdparty/Eigen/test/bandmatrix.cpp create mode 100644 gtsam/3rdparty/Eigen/test/basicstuff.cpp create mode 100644 gtsam/3rdparty/Eigen/test/block.cpp create mode 100644 gtsam/3rdparty/Eigen/test/cholesky.cpp create mode 100644 gtsam/3rdparty/Eigen/test/commainitializer.cpp create mode 100644 gtsam/3rdparty/Eigen/test/conservative_resize.cpp create mode 100644 gtsam/3rdparty/Eigen/test/corners.cpp create mode 100644 gtsam/3rdparty/Eigen/test/cwiseop.cpp create mode 100644 gtsam/3rdparty/Eigen/test/determinant.cpp create mode 100644 gtsam/3rdparty/Eigen/test/diagonal.cpp create mode 100644 gtsam/3rdparty/Eigen/test/diagonalmatrices.cpp create mode 100644 gtsam/3rdparty/Eigen/test/dontalign.cpp create mode 100644 gtsam/3rdparty/Eigen/test/dynalloc.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_adjoint.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_alignedbox.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_array.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_basicstuff.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_bug_132.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_cholesky.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_commainitializer.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_cwiseop.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_determinant.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_dynalloc.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_eigensolver.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_first_aligned.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_geometry.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_geometry_with_eigen2_prefix.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_hyperplane.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_inverse.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_linearstructure.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_lu.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_map.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_meta.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_miscmatrices.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_mixingtypes.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_newstdvector.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_nomalloc.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_packetmath.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_parametrizedline.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_prec_inverse_4x4.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_product_large.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_product_small.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_qr.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_qtvector.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_regression.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_sizeof.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_smallvectors.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_sparse_basic.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_sparse_product.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_sparse_solvers.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_sparse_vector.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_stdvector.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_submatrices.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_sum.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_svd.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_swap.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_triangular.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_unalignedassert.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/eigen2_visitor.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/gsl_helper.h create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/main.h create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/product.h create mode 100755 gtsam/3rdparty/Eigen/test/eigen2/runtest.sh create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/sparse.h create mode 100644 gtsam/3rdparty/Eigen/test/eigen2/testsuite.cmake create mode 100644 gtsam/3rdparty/Eigen/test/eigen2support.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigensolver_complex.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigensolver_generic.cpp create mode 100644 gtsam/3rdparty/Eigen/test/eigensolver_selfadjoint.cpp create mode 100644 gtsam/3rdparty/Eigen/test/exceptions.cpp create mode 100644 gtsam/3rdparty/Eigen/test/first_aligned.cpp create mode 100644 gtsam/3rdparty/Eigen/test/geo_alignedbox.cpp create mode 100644 gtsam/3rdparty/Eigen/test/geo_eulerangles.cpp create mode 100644 gtsam/3rdparty/Eigen/test/geo_homogeneous.cpp create mode 100644 gtsam/3rdparty/Eigen/test/geo_hyperplane.cpp create mode 100644 gtsam/3rdparty/Eigen/test/geo_orthomethods.cpp create mode 100644 gtsam/3rdparty/Eigen/test/geo_parametrizedline.cpp create mode 100644 gtsam/3rdparty/Eigen/test/geo_quaternion.cpp create mode 100644 gtsam/3rdparty/Eigen/test/geo_transformations.cpp create mode 100644 gtsam/3rdparty/Eigen/test/gsl_helper.h create mode 100644 gtsam/3rdparty/Eigen/test/hessenberg.cpp create mode 100644 gtsam/3rdparty/Eigen/test/householder.cpp create mode 100644 gtsam/3rdparty/Eigen/test/integer_types.cpp create mode 100644 gtsam/3rdparty/Eigen/test/inverse.cpp create mode 100644 gtsam/3rdparty/Eigen/test/jacobi.cpp create mode 100644 gtsam/3rdparty/Eigen/test/jacobisvd.cpp create mode 100644 gtsam/3rdparty/Eigen/test/linearstructure.cpp create mode 100644 gtsam/3rdparty/Eigen/test/lu.cpp create mode 100644 gtsam/3rdparty/Eigen/test/main.h create mode 100644 gtsam/3rdparty/Eigen/test/map.cpp create mode 100644 gtsam/3rdparty/Eigen/test/mapstaticmethods.cpp create mode 100644 gtsam/3rdparty/Eigen/test/mapstride.cpp create mode 100644 gtsam/3rdparty/Eigen/test/meta.cpp create mode 100644 gtsam/3rdparty/Eigen/test/miscmatrices.cpp create mode 100644 gtsam/3rdparty/Eigen/test/mixingtypes.cpp create mode 100644 gtsam/3rdparty/Eigen/test/nesting_ops.cpp create mode 100644 gtsam/3rdparty/Eigen/test/nomalloc.cpp create mode 100644 gtsam/3rdparty/Eigen/test/nullary.cpp create mode 100644 gtsam/3rdparty/Eigen/test/packetmath.cpp create mode 100644 gtsam/3rdparty/Eigen/test/permutationmatrices.cpp create mode 100644 gtsam/3rdparty/Eigen/test/prec_inverse_4x4.cpp create mode 100644 gtsam/3rdparty/Eigen/test/product.h create mode 100644 gtsam/3rdparty/Eigen/test/product_extra.cpp create mode 100644 gtsam/3rdparty/Eigen/test/product_large.cpp create mode 100644 gtsam/3rdparty/Eigen/test/product_mmtr.cpp create mode 100644 gtsam/3rdparty/Eigen/test/product_notemporary.cpp create mode 100644 gtsam/3rdparty/Eigen/test/product_selfadjoint.cpp create mode 100644 gtsam/3rdparty/Eigen/test/product_small.cpp create mode 100644 gtsam/3rdparty/Eigen/test/product_symm.cpp create mode 100644 gtsam/3rdparty/Eigen/test/product_syrk.cpp create mode 100644 gtsam/3rdparty/Eigen/test/product_trmm.cpp create mode 100644 gtsam/3rdparty/Eigen/test/product_trmv.cpp create mode 100644 gtsam/3rdparty/Eigen/test/product_trsolve.cpp create mode 100644 gtsam/3rdparty/Eigen/test/qr.cpp create mode 100644 gtsam/3rdparty/Eigen/test/qr_colpivoting.cpp create mode 100644 gtsam/3rdparty/Eigen/test/qr_fullpivoting.cpp create mode 100644 gtsam/3rdparty/Eigen/test/qtvector.cpp create mode 100644 gtsam/3rdparty/Eigen/test/redux.cpp create mode 100644 gtsam/3rdparty/Eigen/test/resize.cpp create mode 100755 gtsam/3rdparty/Eigen/test/runtest.sh create mode 100644 gtsam/3rdparty/Eigen/test/schur_complex.cpp create mode 100644 gtsam/3rdparty/Eigen/test/schur_real.cpp create mode 100644 gtsam/3rdparty/Eigen/test/selfadjoint.cpp create mode 100644 gtsam/3rdparty/Eigen/test/sizeof.cpp create mode 100644 gtsam/3rdparty/Eigen/test/smallvectors.cpp create mode 100644 gtsam/3rdparty/Eigen/test/sparse.h create mode 100644 gtsam/3rdparty/Eigen/test/sparse_basic.cpp create mode 100644 gtsam/3rdparty/Eigen/test/sparse_product.cpp create mode 100644 gtsam/3rdparty/Eigen/test/sparse_solvers.cpp create mode 100644 gtsam/3rdparty/Eigen/test/sparse_vector.cpp create mode 100644 gtsam/3rdparty/Eigen/test/stable_norm.cpp create mode 100644 gtsam/3rdparty/Eigen/test/stddeque.cpp create mode 100644 gtsam/3rdparty/Eigen/test/stdlist.cpp create mode 100644 gtsam/3rdparty/Eigen/test/stdvector.cpp create mode 100644 gtsam/3rdparty/Eigen/test/stdvector_overload.cpp create mode 100644 gtsam/3rdparty/Eigen/test/swap.cpp create mode 100644 gtsam/3rdparty/Eigen/test/testsuite.cmake create mode 100644 gtsam/3rdparty/Eigen/test/triangular.cpp create mode 100644 gtsam/3rdparty/Eigen/test/umeyama.cpp create mode 100644 gtsam/3rdparty/Eigen/test/unalignedassert.cpp create mode 100644 gtsam/3rdparty/Eigen/test/unalignedcount.cpp create mode 100644 gtsam/3rdparty/Eigen/test/upperbidiagonalization.cpp create mode 100644 gtsam/3rdparty/Eigen/test/vectorization_logic.cpp create mode 100644 gtsam/3rdparty/Eigen/test/visitor.cpp create mode 100644 gtsam/3rdparty/Eigen/test/zerosized.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/AdolcForward create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/AlignedVector3 create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/AutoDiff create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/BVH create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/CholmodSupport create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/FFT create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/IterativeSolvers create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/MPRealSupport create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/MatrixFunctions create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/MoreVectorization create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/NonLinearOptimization create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/NumericalDiff create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/OpenGLSupport create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/Polynomials create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/Skyline create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/SparseExtra create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/SuperLUSupport create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/UmfPackSupport create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/AutoDiff/AutoDiffJacobian.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/AutoDiff/AutoDiffVector.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/AutoDiff/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/BVH/BVAlgorithms.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/BVH/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/BVH/KdBVH.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/FFT/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/FFT/ei_fftw_impl.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/FFT/ei_kissfft_impl.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/IterativeSolvers/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/IterativeSolvers/ConstrainedConjGrad.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/IterativeSolvers/IterationController.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/MatrixFunctions/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/MatrixFunctions/MatrixFunctionAtomic.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/MatrixFunctions/StemFunction.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/MoreVectorization/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/MoreVectorization/MathFunctions.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/NonLinearOptimization/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/NonLinearOptimization/chkder.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/NonLinearOptimization/covar.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/NonLinearOptimization/dogleg.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/NonLinearOptimization/fdjac1.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/NonLinearOptimization/lmpar.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/NonLinearOptimization/qrsolv.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/NonLinearOptimization/r1updt.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/NonLinearOptimization/rwupdt.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/NumericalDiff/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/NumericalDiff/NumericalDiff.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/Polynomials/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/Polynomials/Companion.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/Polynomials/PolynomialSolver.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/Polynomials/PolynomialUtils.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/Skyline/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/Skyline/SkylineInplaceLU.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/Skyline/SkylineMatrix.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/Skyline/SkylineMatrixBase.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/Skyline/SkylineProduct.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/Skyline/SkylineStorage.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/Skyline/SkylineUtil.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/SparseExtra/Amd.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/SparseExtra/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/SparseExtra/CholmodSupport.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/SparseExtra/CholmodSupportLegacy.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/SparseExtra/RandomSetter.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/SparseExtra/SimplicialCholesky.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/SparseExtra/Solve.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/SparseExtra/SparseLDLTLegacy.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/SparseExtra/SparseLLT.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/SparseExtra/SparseLU.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/SparseExtra/SuperLUSupport.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/Eigen/src/SparseExtra/UmfPackSupport.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/README.txt create mode 100644 gtsam/3rdparty/Eigen/unsupported/doc/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/unsupported/doc/Doxyfile.in create mode 100644 gtsam/3rdparty/Eigen/unsupported/doc/Overview.dox create mode 100644 gtsam/3rdparty/Eigen/unsupported/doc/examples/BVH_Example.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/doc/examples/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/unsupported/doc/examples/FFT.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/doc/examples/MatrixExponential.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/doc/examples/MatrixFunction.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/doc/examples/MatrixSine.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/doc/examples/MatrixSinh.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/doc/examples/PolynomialSolver1.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/doc/examples/PolynomialUtils1.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/doc/snippets/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/unsupported/test/BVH.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/test/CMakeLists.txt create mode 100644 gtsam/3rdparty/Eigen/unsupported/test/FFT.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/test/FFTW.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/test/NonLinearOptimization.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/test/NumericalDiff.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/test/alignedvector3.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/test/autodiff.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/test/forward_adolc.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/test/matrix_exponential.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/test/matrix_function.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/test/mpreal.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/test/mpreal.h create mode 100644 gtsam/3rdparty/Eigen/unsupported/test/mpreal_support.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/test/openglsupport.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/test/polynomialsolver.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/test/polynomialutils.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/test/sparse_extra.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/test/sparse_ldlt.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/test/sparse_llt.cpp create mode 100644 gtsam/3rdparty/Eigen/unsupported/test/sparse_lu.cpp create mode 100644 gtsam/3rdparty/UFconfig/README.txt create mode 100644 gtsam/3rdparty/UFconfig/UFconfig.c create mode 100644 gtsam/3rdparty/UFconfig/UFconfig.h create mode 100644 gtsam/3rdparty/UFconfig/UFconfig.mk create mode 100644 gtsam/3rdparty/UFconfig/xerbla/xerbla.c create mode 100644 gtsam/3rdparty/UFconfig/xerbla/xerbla.f create mode 100644 gtsam/3rdparty/UFconfig/xerbla/xerbla.h diff --git a/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_example b/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_example new file mode 100755 index 0000000000000000000000000000000000000000..aa64a157d949477d40c8e77443a9e47d6bd5939e GIT binary patch literal 34002 zcmchA3w%`7x$mB2fB_?Wuu)@+b=0v<1d(X8jG)d=_P`#T07a~}QbU*oh=wFhW*}JP zHJQNfW-vWht>+wC={dbUoO`I!Q)_({CcFY_Yrq#T6(86P;So^*A2|2_UwiM#B!;&4 z+;i{FFSFMA*6Ul}`qsC;?^|onEDeMv<~SUZ{p3iuNFp`ZFF@v}BrW@qT|$!l(l}`- zKEEk_LmCY5ApG0q{8r2k&sa^{q04F}7oijX<8n;ExE#NT*x^VMEZL!rAw%}p`}nP> z8RplSNjsDzj{vY9aV@a&3+iSGxEIqGwE3FmaW`IbW67AN`Z3pual3&C%TAhdhd{}uql^@B z&c{D_fcdFm>TBOR|K|Mv_3nyUf4M=rs`}?0Qceh&C#z%Lk}{LSZp|L`2}G3S6!wcu@o{D}2F^@y_H z&VKOkS@1*s;1cLRpX9z#s;HPdzrL=bDN@-Osi=@DCNHR%UOl&_DN@~7R$JNBRNW*s z{ird*8ezLeLt{-{WKKnR-hEPab4^4t(^9yywzfWu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^ooliKn-J2MxO-`?EnJo+}NP zY&n{pnJdYVivyK+XMX3nZ+UQ+Ezhzta`8*Kww%fWgZf{C+?kaP67gJEOSW9e&di0i zV9SfX@QWl{4)ldzoUtSN!V4sO-S&lFBH8P)FZ}D-Nf9^K!THkYe)Qz}a!Mbj`&Xb| z=NNzvR}1)8=`c>fzee^tH(&ryCJ z;3Kl+p3~}Tp;ey0xtjgx0)D=9sK|uRw=(}3aQ6W7vfe5`tKYo*!Ge1%I?uD(c@gjt zIR%p6TEBMRdjsd<0Pcod>M!3M*l$T^zg6B+<0Za@M!4rY zeo#_;FW%VtcS zUJ(l3K7+s4UZM6$O)ksIs;aM;TU$T7vbI8a87eBH%@RBa4Yk!c7#s7QlIuz&W>nNv zH8XW1eyE*}imK@R`HSp+0#j7c&BWJC+N@*xS5{XVKdBj*zU02l?Ab$8>s!+c_MJW%KN%XatKV6?` z-s<1{k$b;C`*-ZEpSlk>MJt5U#~NfsQ+1@Gs(Makv^LTt^=q!7z6mtPnKAH~JHNip z%qEQ|FQ}MaJr_r*)s1C1U2Lju%HS}kspkG_sk*r)(jNg6t%~rx`+9S(A5$Wk2w4b< zK~~JKtf}iQblsR6q>A8FbYE3dR}pQ(WXx%-uI^jF9uSePh#(tCXOqZ0fwiZ|F5Osd z`l+hWCdxO}SIn!dtEy#X!L2su)Yi-nSCDwZdsa~a7gt|m+2g-X;)19T_eD-jrrl>{ iLqqK%lXawuYT+_#`cY#)a@mDVqGb+{Nf^mQ;(r4XPZR(E literal 0 HcmV?d00001 diff --git a/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_example.c b/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_example.c new file mode 100644 index 000000000..253fdc988 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_example.c @@ -0,0 +1,185 @@ +/* ========================================================================== */ +/* === ccolamd and csymamd example ========================================== */ +/* ========================================================================== */ + +/* ---------------------------------------------------------------------------- + * CCOLAMD Copyright (C), Univ. of Florida. Authors: Timothy A. Davis, + * Sivasankaran Rajamanickam, and Stefan Larimore + * See License.txt for the Version 2.1 of the GNU Lesser General Public License + * http://www.cise.ufl.edu/research/sparse + * -------------------------------------------------------------------------- */ + +/* + * ccolamd example of use, to order the columns of a 5-by-4 matrix with + * 11 nonzero entries in the following nonzero pattern, with default knobs + * and no ordering constraints. + * + * x 0 x 0 + * x 0 x x + * 0 x x 0 + * 0 0 x x + * x x 0 0 + * + * csymamd example of use, to order the rows and columns of a 5-by-5 + * matrix with 13 nonzero entries in the following nonzero pattern, + * with default knobs and no ordering constraints. + * + * x x 0 0 0 + * x x x x 0 + * 0 x x 0 0 + * 0 x 0 x x + * 0 0 0 x x + * + * (where x denotes a nonzero value). + */ + +/* ========================================================================== */ + +#include +#include "ccolamd.h" + +#define A_NNZ 11 +#define A_NROW 5 +#define A_NCOL 4 +#define ALEN 150 /* size max (2.2*nnz+17*ncol+7*nrow+6, 23*ncol+7*nrow+6) */ + +#define B_NNZ 4 +#define B_N 5 + +int main (void) +{ + + /* ====================================================================== */ + /* input matrix A definition */ + /* ====================================================================== */ + + int A [ALEN] = { + + 0, 1, 4, /* row indices of nonzeros in column 0 */ + 2, 4, /* row indices of nonzeros in column 1 */ + 0, 1, 2, 3, /* row indices of nonzeros in column 2 */ + 1, 3} ; /* row indices of nonzeros in column 3 */ + + int p [ ] = { + + 0, /* column 0 is in A [0..2] */ + 3, /* column 1 is in A [3..4] */ + 5, /* column 2 is in A [5..8] */ + 9, /* column 3 is in A [9..10] */ + A_NNZ} ; /* number of nonzeros in A */ + + /* ====================================================================== */ + /* input matrix B definition */ + /* ====================================================================== */ + + int B [ ] = { /* Note: only strictly lower triangular part */ + /* is included, since symamd ignores the */ + /* diagonal and upper triangular part of B. */ + + 1, /* row indices of nonzeros in column 0 */ + 2, 3, /* row indices of nonzeros in column 1 */ + /* row indices of nonzeros in column 2 (none) */ + 4 /* row indices of nonzeros in column 3 */ + } ; /* row indices of nonzeros in column 4 (none) */ + + int q [ ] = { + + 0, /* column 0 is in B [0] */ + 1, /* column 1 is in B [1..2] */ + 3, /* column 2 is empty */ + 3, /* column 3 is in B [3] */ + 4, /* column 4 is empty */ + B_NNZ} ; /* number of nonzeros in strictly lower B */ + + /* ====================================================================== */ + /* other variable definitions */ + /* ====================================================================== */ + + int perm [B_N+1] ; /* note the size is N+1 */ + int stats [CCOLAMD_STATS] ; /* for ccolamd and csymamd output statistics */ + + int row, col, pp, length, ok ; + + /* ====================================================================== */ + /* dump the input matrix A */ + /* ====================================================================== */ + + printf ("ccolamd %d-by-%d input matrix:\n", A_NROW, A_NCOL) ; + for (col = 0 ; col < A_NCOL ; col++) + { + length = p [col+1] - p [col] ; + printf ("Column %d, with %d entries:\n", col, length) ; + for (pp = p [col] ; pp < p [col+1] ; pp++) + { + row = A [pp] ; + printf (" row %d\n", row) ; + } + } + + /* ====================================================================== */ + /* order the matrix. Note that this destroys A and overwrites p */ + /* ====================================================================== */ + + ok = ccolamd (A_NROW, A_NCOL, ALEN, A, p, (double *) NULL, stats, NULL) ; + ccolamd_report (stats) ; + + if (!ok) + { + printf ("ccolamd error!\n") ; + exit (1) ; + } + + /* ====================================================================== */ + /* print the column ordering */ + /* ====================================================================== */ + + printf ("ccolamd column ordering:\n") ; + printf ("1st column: %d\n", p [0]) ; + printf ("2nd column: %d\n", p [1]) ; + printf ("3rd column: %d\n", p [2]) ; + printf ("4th column: %d\n", p [3]) ; + + /* ====================================================================== */ + /* dump the strictly lower triangular part of symmetric input matrix B */ + /* ====================================================================== */ + + printf ("\n\ncsymamd %d-by-%d input matrix:\n", B_N, B_N) ; + printf ("Entries in strictly lower triangular part:\n") ; + for (col = 0 ; col < B_N ; col++) + { + length = q [col+1] - q [col] ; + printf ("Column %d, with %d entries:\n", col, length) ; + for (pp = q [col] ; pp < q [col+1] ; pp++) + { + row = B [pp] ; + printf (" row %d\n", row) ; + } + } + + /* ====================================================================== */ + /* order the matrix B. Note that this does not modify B or q. */ + /* ====================================================================== */ + + ok = csymamd (B_N, B, q, perm, (double *) NULL, stats, &calloc, &free, + NULL, -1) ; + csymamd_report (stats) ; + + if (!ok) + { + printf ("csymamd error!\n") ; + exit (1) ; + } + + /* ====================================================================== */ + /* print the symmetric ordering */ + /* ====================================================================== */ + + printf ("csymamd column ordering:\n") ; + printf ("1st row/column: %d\n", perm [0]) ; + printf ("2nd row/column: %d\n", perm [1]) ; + printf ("3rd row/column: %d\n", perm [2]) ; + printf ("4th row/column: %d\n", perm [3]) ; + printf ("5th row/column: %d\n", perm [4]) ; + + return (0) ; +} diff --git a/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_example.out b/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_example.out new file mode 100644 index 000000000..dd2dc4955 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_example.out @@ -0,0 +1,50 @@ +ccolamd 5-by-4 input matrix: +Column 0, with 3 entries: + row 0 + row 1 + row 4 +Column 1, with 2 entries: + row 2 + row 4 +Column 2, with 4 entries: + row 0 + row 1 + row 2 + row 3 +Column 3, with 2 entries: + row 1 + row 3 + +ccolamd version 2.7, Jan 25, 2011: OK. +ccolamd: number of dense or empty rows ignored: 0 +ccolamd: number of dense or empty columns ignored: 0 +ccolamd: number of garbage collections performed: 0 +ccolamd column ordering: +1st column: 1 +2nd column: 0 +3rd column: 3 +4th column: 2 + + +csymamd 5-by-5 input matrix: +Entries in strictly lower triangular part: +Column 0, with 1 entries: + row 1 +Column 1, with 2 entries: + row 2 + row 3 +Column 2, with 0 entries: +Column 3, with 1 entries: + row 4 +Column 4, with 0 entries: + +csymamd version 2.7, Jan 25, 2011: OK. +csymamd: number of dense or empty rows ignored: 0 +csymamd: number of dense or empty columns ignored: 0 +csymamd: number of garbage collections performed: 0 +csymamd column ordering: +1st row/column: 0 +2nd row/column: 2 +3rd row/column: 1 +4th row/column: 3 +5th row/column: 4 diff --git a/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_l_example b/gtsam/3rdparty/CC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*@n8fcl4}@O}xidc*B;u*C zdX-#B&P>(D;&+{|RQ@_m$$^38uTR(!1L4`4TDJq?<21D%2f}YiPKvl(2P3tKgXqci zm8N|hA6$WYoeRGhtmL)IzeT_=r$do|UrvWIz*Dr5+RQ=yJ|fEZJ^-AFUa+KE(Q;A0Xh2qnsY)h7VLH-^}C z4!k#4!i6si@UJ@XOhdwj4+!vFz^{b=-GIAbrK)`fMa4tED1SjZYY;svuL7q}&2@jJJ1^PxL2zVu;b_HU^=x|3oG}wmaqdYr=e#jE_2SZ4jUESH#$U zevT~fLz)l2i-~aUE}uvX-x^~4ekr$r4E*@`D)1pdfOrmmuD=SrK)^4TV|QJp`~w0$ zQuEFAi7tds4zc-wk4}<%X$}HZ_=(Tp-}`w05hp&|H zlh=z#H{XAg<scM0ndb78Z6(2 zVBN4^x6?0XPCVB+aG!%eCXPMK^%u1gq>X->yxl?{H zJ`XtM^9SLxSin_p{ozW$M}z*xAo<2~0FJBI;alP3N41E6Ut!-|i1W{+A7MIu4)-R~6tq@*@ipt;$4IYGs+G-q# z=G|2|sZe7^MNQQTrtZWKwbM~i6rRt|_MycrLzFEcovI>=AH!9xWi*RYkUT}~k zj^8V)S5&e?AnqLM_s1&ga15r=b5g-$y9(54(%?L)s!*rr@|Wc+8mk*{hAT@pEv)Cc zx;8tn;LbZ#o6ayvovBv&lwzx*{J#6{FPmL4yLgIKMks=s#v(>iT<41^9nVm z+ltzn1q+=gs_-D=Mx?g{JC2MOF2p z%3y7vNsXpL5~m`7Mv`Ea4Gpy` +#include "ccolamd.h" + +#define A_NNZ 11 +#define A_NROW 5 +#define A_NCOL 4 +#define ALEN 150 /* size max (2.2*nnz+17*ncol+7*nrow+6, 23*ncol+7*nrow+6) */ + +#define B_NNZ 4 +#define B_N 5 + +/* define UF_long */ +#include "UFconfig.h" + +int main (void) +{ + + /* ====================================================================== */ + /* input matrix A definition */ + /* ====================================================================== */ + + UF_long A [ALEN] = { + + 0, 1, 4, /* row indices of nonzeros in column 0 */ + 2, 4, /* row indices of nonzeros in column 1 */ + 0, 1, 2, 3, /* row indices of nonzeros in column 2 */ + 1, 3} ; /* row indices of nonzeros in column 3 */ + + UF_long p [ ] = { + + 0, /* column 0 is in A [0..2] */ + 3, /* column 1 is in A [3..4] */ + 5, /* column 2 is in A [5..8] */ + 9, /* column 3 is in A [9..10] */ + A_NNZ} ; /* number of nonzeros in A */ + + /* ====================================================================== */ + /* input matrix B definition */ + /* ====================================================================== */ + + UF_long B [ ] = { /* Note: only strictly lower triangular part */ + /* is included, since symamd ignores the */ + /* diagonal and upper triangular part of B. */ + + 1, /* row indices of nonzeros in column 0 */ + 2, 3, /* row indices of nonzeros in column 1 */ + /* row indices of nonzeros in column 2 (none) */ + 4 /* row indices of nonzeros in column 3 */ + } ; /* row indices of nonzeros in column 4 (none) */ + + UF_long q [ ] = { + + 0, /* column 0 is in B [0] */ + 1, /* column 1 is in B [1..2] */ + 3, /* column 2 is empty */ + 3, /* column 3 is in B [3] */ + 4, /* column 4 is empty */ + B_NNZ} ; /* number of nonzeros in strictly lower B */ + + /* ====================================================================== */ + /* other variable definitions */ + /* ====================================================================== */ + + UF_long perm [B_N+1] ; /* note the size is N+1 */ + UF_long stats [CCOLAMD_STATS] ; /* for ccolamd and csymamd output stats */ + + UF_long row, col, pp, length, ok ; + + /* ====================================================================== */ + /* dump the input matrix A */ + /* ====================================================================== */ + + printf ("ccolamd %d-by-%d input matrix:\n", A_NROW, A_NCOL) ; + for (col = 0 ; col < A_NCOL ; col++) + { + length = p [col+1] - p [col] ; + printf ("Column %ld, with %ld entries:\n", col, length) ; + for (pp = p [col] ; pp < p [col+1] ; pp++) + { + row = A [pp] ; + printf (" row %ld\n", row) ; + } + } + + /* ====================================================================== */ + /* order the matrix. Note that this destroys A and overwrites p */ + /* ====================================================================== */ + + ok = ccolamd_l (A_NROW, A_NCOL, ALEN, A, p, (double *) NULL, stats, NULL) ; + ccolamd_l_report (stats) ; + + if (!ok) + { + printf ("ccolamd error!\n") ; + exit (1) ; + } + + /* ====================================================================== */ + /* print the column ordering */ + /* ====================================================================== */ + + printf ("ccolamd_l column ordering:\n") ; + printf ("1st column: %ld\n", p [0]) ; + printf ("2nd column: %ld\n", p [1]) ; + printf ("3rd column: %ld\n", p [2]) ; + printf ("4th column: %ld\n", p [3]) ; + + /* ====================================================================== */ + /* dump the strictly lower triangular part of symmetric input matrix B */ + /* ====================================================================== */ + + printf ("\n\ncsymamd_l %d-by-%d input matrix:\n", B_N, B_N) ; + printf ("Entries in strictly lower triangular part:\n") ; + for (col = 0 ; col < B_N ; col++) + { + length = q [col+1] - q [col] ; + printf ("Column %ld, with %ld entries:\n", col, length) ; + for (pp = q [col] ; pp < q [col+1] ; pp++) + { + row = B [pp] ; + printf (" row %ld\n", row) ; + } + } + + /* ====================================================================== */ + /* order the matrix B. Note that this does not modify B or q. */ + /* ====================================================================== */ + + ok = csymamd_l (B_N, B, q, perm, (double *) NULL, stats, &calloc, &free, + NULL, -1) ; + csymamd_l_report (stats) ; + + if (!ok) + { + printf ("csymamd error!\n") ; + exit (1) ; + } + + /* ====================================================================== */ + /* print the symmetric ordering */ + /* ====================================================================== */ + + printf ("csymamd_l column ordering:\n") ; + printf ("1st row/column: %ld\n", perm [0]) ; + printf ("2nd row/column: %ld\n", perm [1]) ; + printf ("3rd row/column: %ld\n", perm [2]) ; + printf ("4th row/column: %ld\n", perm [3]) ; + printf ("5th row/column: %ld\n", perm [4]) ; + + return (0) ; +} diff --git a/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_l_example.out b/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_l_example.out new file mode 100644 index 000000000..fc87f5474 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/Demo/ccolamd_l_example.out @@ -0,0 +1,50 @@ +ccolamd 5-by-4 input matrix: +Column 0, with 3 entries: + row 0 + row 1 + row 4 +Column 1, with 2 entries: + row 2 + row 4 +Column 2, with 4 entries: + row 0 + row 1 + row 2 + row 3 +Column 3, with 2 entries: + row 1 + row 3 + +ccolamd version 2.7, Jan 25, 2011: OK. +ccolamd: number of dense or empty rows ignored: 0 +ccolamd: number of dense or empty columns ignored: 0 +ccolamd: number of garbage collections performed: 0 +ccolamd_l column ordering: +1st column: 1 +2nd column: 0 +3rd column: 3 +4th column: 2 + + +csymamd_l 5-by-5 input matrix: +Entries in strictly lower triangular part: +Column 0, with 1 entries: + row 1 +Column 1, with 2 entries: + row 2 + row 3 +Column 2, with 0 entries: +Column 3, with 1 entries: + row 4 +Column 4, with 0 entries: + +csymamd version 2.7, Jan 25, 2011: OK. +csymamd: number of dense or empty rows ignored: 0 +csymamd: number of dense or empty columns ignored: 0 +csymamd: number of garbage collections performed: 0 +csymamd_l column ordering: +1st row/column: 0 +2nd row/column: 2 +3rd row/column: 1 +4th row/column: 3 +5th row/column: 4 diff --git a/gtsam/3rdparty/CCOLAMD/Demo/my_ccolamd_example.out b/gtsam/3rdparty/CCOLAMD/Demo/my_ccolamd_example.out new file mode 100644 index 000000000..dd2dc4955 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/Demo/my_ccolamd_example.out @@ -0,0 +1,50 @@ +ccolamd 5-by-4 input matrix: +Column 0, with 3 entries: + row 0 + row 1 + row 4 +Column 1, with 2 entries: + row 2 + row 4 +Column 2, with 4 entries: + row 0 + row 1 + row 2 + row 3 +Column 3, with 2 entries: + row 1 + row 3 + +ccolamd version 2.7, Jan 25, 2011: OK. +ccolamd: number of dense or empty rows ignored: 0 +ccolamd: number of dense or empty columns ignored: 0 +ccolamd: number of garbage collections performed: 0 +ccolamd column ordering: +1st column: 1 +2nd column: 0 +3rd column: 3 +4th column: 2 + + +csymamd 5-by-5 input matrix: +Entries in strictly lower triangular part: +Column 0, with 1 entries: + row 1 +Column 1, with 2 entries: + row 2 + row 3 +Column 2, with 0 entries: +Column 3, with 1 entries: + row 4 +Column 4, with 0 entries: + +csymamd version 2.7, Jan 25, 2011: OK. +csymamd: number of dense or empty rows ignored: 0 +csymamd: number of dense or empty columns ignored: 0 +csymamd: number of garbage collections performed: 0 +csymamd column ordering: +1st row/column: 0 +2nd row/column: 2 +3rd row/column: 1 +4th row/column: 3 +5th row/column: 4 diff --git a/gtsam/3rdparty/CCOLAMD/Demo/my_ccolamd_l_example.out b/gtsam/3rdparty/CCOLAMD/Demo/my_ccolamd_l_example.out new file mode 100644 index 000000000..fc87f5474 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/Demo/my_ccolamd_l_example.out @@ -0,0 +1,50 @@ +ccolamd 5-by-4 input matrix: +Column 0, with 3 entries: + row 0 + row 1 + row 4 +Column 1, with 2 entries: + row 2 + row 4 +Column 2, with 4 entries: + row 0 + row 1 + row 2 + row 3 +Column 3, with 2 entries: + row 1 + row 3 + +ccolamd version 2.7, Jan 25, 2011: OK. +ccolamd: number of dense or empty rows ignored: 0 +ccolamd: number of dense or empty columns ignored: 0 +ccolamd: number of garbage collections performed: 0 +ccolamd_l column ordering: +1st column: 1 +2nd column: 0 +3rd column: 3 +4th column: 2 + + +csymamd_l 5-by-5 input matrix: +Entries in strictly lower triangular part: +Column 0, with 1 entries: + row 1 +Column 1, with 2 entries: + row 2 + row 3 +Column 2, with 0 entries: +Column 3, with 1 entries: + row 4 +Column 4, with 0 entries: + +csymamd version 2.7, Jan 25, 2011: OK. +csymamd: number of dense or empty rows ignored: 0 +csymamd: number of dense or empty columns ignored: 0 +csymamd: number of garbage collections performed: 0 +csymamd_l column ordering: +1st row/column: 0 +2nd row/column: 2 +3rd row/column: 1 +4th row/column: 3 +5th row/column: 4 diff --git a/gtsam/3rdparty/CCOLAMD/Doc/ChangeLog b/gtsam/3rdparty/CCOLAMD/Doc/ChangeLog new file mode 100644 index 000000000..499d2fc69 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/Doc/ChangeLog @@ -0,0 +1,44 @@ +Jan 25, 2011: version 2.7.3 + + * minor fix to "make install" + * fixed stats [CCOLAMD_EMPTY_ROW] output + +Nov 30, 2009: version 2.7.2 + + * added "make install" and "make uninstall" + +Nov 1, 2007: version 2.7.1 + + * minor changes to MATLAB test code + +May 31, 2007: version 2.7.0 + + * ported to 64-bit MATLAB + + * subdirectories added (Source/, Include/, Lib/, Doc/, MATLAB/, Demo/) + +Dec 12, 2006, version 2.5.2 + + * minor MATLAB clean up + +Apr 30, 2006: version 2.5 + + * ccolamd_recommended modified. Now returns size_t; 0 on error, > 0 + if successful. Version number updated to synchronize with COLAMD. + + * long replaced with UF_long integer, which is long except on WIN64 + +Nov 15, 2005 + + * ccolamd_global.c added to ccolamd_make.m (version is still 1.0). + +Oct 10, 2005 + + * changed definition of ccolamd_printf to "extern" + +Version 1.0, released (Aug. 30, 2005) + + * CCOLAMD version 1.0 is derived from COLAMD version 2.4. Refer to the + COLAMD ChangeLog file for the changes made to COLAMD since + COLAMD Version 1.0. + diff --git a/gtsam/3rdparty/CCOLAMD/Doc/lesser.txt b/gtsam/3rdparty/CCOLAMD/Doc/lesser.txt new file mode 100644 index 000000000..8add30ad5 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/Doc/lesser.txt @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/gtsam/3rdparty/CCOLAMD/Include/ccolamd.h b/gtsam/3rdparty/CCOLAMD/Include/ccolamd.h new file mode 100644 index 000000000..c253ed522 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/Include/ccolamd.h @@ -0,0 +1,365 @@ +/* ========================================================================== */ +/* === CCOLAMD/ccolamd.h ==================================================== */ +/* ========================================================================== */ + +/* ---------------------------------------------------------------------------- + * CCOLAMD Copyright (C), Univ. of Florida. Authors: Timothy A. Davis, + * Sivasankaran Rajamanickam, and Stefan Larimore + * See License.txt for the Version 2.1 of the GNU Lesser General Public License + * http://www.cise.ufl.edu/research/sparse + * -------------------------------------------------------------------------- */ + +/* + * You must include this file (ccolamd.h) in any routine that uses ccolamd, + * csymamd, or the related macros and definitions. + */ + +#ifndef CCOLAMD_H +#define CCOLAMD_H + +/* make it easy for C++ programs to include CCOLAMD */ +#ifdef __cplusplus +extern "C" { +#endif + +/* for size_t definition: */ +#include + +/* ========================================================================== */ +/* === CCOLAMD version ====================================================== */ +/* ========================================================================== */ + +/* All versions of CCOLAMD will include the following definitions. + * As an example, to test if the version you are using is 1.3 or later: + * + * if (CCOLAMD_VERSION >= CCOLAMD_VERSION_CODE (1,3)) ... + * + * This also works during compile-time: + * + * #if CCOLAMD_VERSION >= CCOLAMD_VERSION_CODE (1,3) + * printf ("This is version 1.3 or later\n") ; + * #else + * printf ("This is an early version\n") ; + * #endif + */ + +#define CCOLAMD_DATE "Jan 25, 2011" +#define CCOLAMD_VERSION_CODE(main,sub) ((main) * 1000 + (sub)) +#define CCOLAMD_MAIN_VERSION 2 +#define CCOLAMD_SUB_VERSION 7 +#define CCOLAMD_SUBSUB_VERSION 3 +#define CCOLAMD_VERSION \ + CCOLAMD_VERSION_CODE(CCOLAMD_MAIN_VERSION,CCOLAMD_SUB_VERSION) + +/* ========================================================================== */ +/* === Knob and statistics definitions ====================================== */ +/* ========================================================================== */ + +/* size of the knobs [ ] array. Only knobs [0..3] are currently used. */ +#define CCOLAMD_KNOBS 20 + +/* number of output statistics. Only stats [0..10] are currently used. */ +#define CCOLAMD_STATS 20 + +/* knobs [0] and stats [0]: dense row knob and output statistic. */ +#define CCOLAMD_DENSE_ROW 0 + +/* knobs [1] and stats [1]: dense column knob and output statistic. */ +#define CCOLAMD_DENSE_COL 1 + +/* knobs [2]: aggressive absorption option */ +#define CCOLAMD_AGGRESSIVE 2 + +/* knobs [3]: LU or Cholesky factorization option */ +#define CCOLAMD_LU 3 + +/* stats [2]: memory defragmentation count output statistic */ +#define CCOLAMD_DEFRAG_COUNT 2 + +/* stats [3]: ccolamd status: zero OK, > 0 warning or notice, < 0 error */ +#define CCOLAMD_STATUS 3 + +/* stats [4..6]: error info, or info on jumbled columns */ +#define CCOLAMD_INFO1 4 +#define CCOLAMD_INFO2 5 +#define CCOLAMD_INFO3 6 + +/* stats [7]: number of originally empty rows */ +#define CCOLAMD_EMPTY_ROW 7 +/* stats [8]: number of originally empty cols */ +#define CCOLAMD_EMPTY_COL 8 +/* stats [9]: number of rows with entries only in dense cols */ +#define CCOLAMD_NEWLY_EMPTY_ROW 9 +/* stats [10]: number of cols with entries only in dense rows */ +#define CCOLAMD_NEWLY_EMPTY_COL 10 + +/* error codes returned in stats [3]: */ +#define CCOLAMD_OK (0) +#define CCOLAMD_OK_BUT_JUMBLED (1) +#define CCOLAMD_ERROR_A_not_present (-1) +#define CCOLAMD_ERROR_p_not_present (-2) +#define CCOLAMD_ERROR_nrow_negative (-3) +#define CCOLAMD_ERROR_ncol_negative (-4) +#define CCOLAMD_ERROR_nnz_negative (-5) +#define CCOLAMD_ERROR_p0_nonzero (-6) +#define CCOLAMD_ERROR_A_too_small (-7) +#define CCOLAMD_ERROR_col_length_negative (-8) +#define CCOLAMD_ERROR_row_index_out_of_bounds (-9) +#define CCOLAMD_ERROR_out_of_memory (-10) +#define CCOLAMD_ERROR_invalid_cmember (-11) +#define CCOLAMD_ERROR_internal_error (-999) + +/* ========================================================================== */ +/* === Prototypes of user-callable routines ================================= */ +/* ========================================================================== */ + +/* define UF_long */ +#include "UFconfig.h" + +size_t ccolamd_recommended /* returns recommended value of Alen, */ + /* or 0 if input arguments are erroneous */ +( + int nnz, /* nonzeros in A */ + int n_row, /* number of rows in A */ + int n_col /* number of columns in A */ +) ; + +size_t ccolamd_l_recommended /* returns recommended value of Alen, */ + /* or 0 if input arguments are erroneous */ +( + UF_long nnz, /* nonzeros in A */ + UF_long n_row, /* number of rows in A */ + UF_long n_col /* number of columns in A */ +) ; + +void ccolamd_set_defaults /* sets default parameters */ +( /* knobs argument is modified on output */ + double knobs [CCOLAMD_KNOBS] /* parameter settings for ccolamd */ +) ; + +void ccolamd_l_set_defaults /* sets default parameters */ +( /* knobs argument is modified on output */ + double knobs [CCOLAMD_KNOBS] /* parameter settings for ccolamd */ +) ; + +int ccolamd /* returns (1) if successful, (0) otherwise*/ +( /* A and p arguments are modified on output */ + int n_row, /* number of rows in A */ + int n_col, /* number of columns in A */ + int Alen, /* size of the array A */ + int A [ ], /* row indices of A, of size Alen */ + int p [ ], /* column pointers of A, of size n_col+1 */ + double knobs [CCOLAMD_KNOBS],/* parameter settings for ccolamd */ + int stats [CCOLAMD_STATS], /* ccolamd output statistics and error codes */ + int cmember [ ] /* Constraint set of A, of size n_col */ +) ; + +UF_long ccolamd_l /* same as ccolamd, but with UF_long integers */ +( + UF_long n_row, + UF_long n_col, + UF_long Alen, + UF_long A [ ], + UF_long p [ ], + double knobs [CCOLAMD_KNOBS], + UF_long stats [CCOLAMD_STATS], + UF_long cmember [ ] +) ; + +int csymamd /* return (1) if OK, (0) otherwise */ +( + int n, /* number of rows and columns of A */ + int A [ ], /* row indices of A */ + int p [ ], /* column pointers of A */ + int perm [ ], /* output permutation, size n_col+1 */ + double knobs [CCOLAMD_KNOBS],/* parameters (uses defaults if NULL) */ + int stats [CCOLAMD_STATS], /* output statistics and error codes */ + void * (*allocate) (size_t, size_t), /* pointer to calloc (ANSI C) or */ + /* mxCalloc (for MATLAB mexFunction) */ + void (*release) (void *), /* pointer to free (ANSI C) or */ + /* mxFree (for MATLAB mexFunction) */ + int cmember [ ], /* Constraint set of A */ + int stype /* 0: use both parts, >0: upper, <0: lower */ +) ; + +UF_long csymamd_l /* same as csymamd, but with UF_long integers */ +( + UF_long n, + UF_long A [ ], + UF_long p [ ], + UF_long perm [ ], + double knobs [CCOLAMD_KNOBS], + UF_long stats [CCOLAMD_STATS], + void * (*allocate) (size_t, size_t), + void (*release) (void *), + UF_long cmember [ ], + UF_long stype +) ; + +void ccolamd_report +( + int stats [CCOLAMD_STATS] +) ; + +void ccolamd_l_report +( + UF_long stats [CCOLAMD_STATS] +) ; + +void csymamd_report +( + int stats [CCOLAMD_STATS] +) ; + +void csymamd_l_report +( + UF_long stats [CCOLAMD_STATS] +) ; + + +/* ========================================================================== */ +/* === Prototypes of "expert" routines ====================================== */ +/* ========================================================================== */ + +/* These routines are meant to be used internally, or in a future version of + * UMFPACK. They appear here so that UMFPACK can use them, but they should not + * be called directly by the user. + */ + +int ccolamd2 +( /* A and p arguments are modified on output */ + int n_row, /* number of rows in A */ + int n_col, /* number of columns in A */ + int Alen, /* size of the array A */ + int A [ ], /* row indices of A, of size Alen */ + int p [ ], /* column pointers of A, of size n_col+1 */ + double knobs [CCOLAMD_KNOBS],/* parameter settings for ccolamd */ + int stats [CCOLAMD_STATS], /* ccolamd output statistics and error codes */ + /* each Front_ array is of size n_col+1: */ + int Front_npivcol [ ], /* # pivot cols in each front */ + int Front_nrows [ ], /* # of rows in each front (incl. pivot rows) */ + int Front_ncols [ ], /* # of cols in each front (incl. pivot cols) */ + int Front_parent [ ], /* parent of each front */ + int Front_cols [ ], /* link list of pivot columns for each front */ + int *p_nfr, /* total number of frontal matrices */ + int InFront [ ], /* InFront [row] = f if row in front f */ + int cmember [ ] /* Constraint set of A */ +) ; + +UF_long ccolamd2_l /* same as ccolamd2, but with UF_long integers */ +( + UF_long n_row, + UF_long n_col, + UF_long Alen, + UF_long A [ ], + UF_long p [ ], + double knobs [CCOLAMD_KNOBS], + UF_long stats [CCOLAMD_STATS], + UF_long Front_npivcol [ ], + UF_long Front_nrows [ ], + UF_long Front_ncols [ ], + UF_long Front_parent [ ], + UF_long Front_cols [ ], + UF_long *p_nfr, + UF_long InFront [ ], + UF_long cmember [ ] +) ; + +void ccolamd_apply_order +( + int Front [ ], + const int Order [ ], + int Temp [ ], + int nn, + int nfr +) ; + +void ccolamd_l_apply_order +( + UF_long Front [ ], + const UF_long Order [ ], + UF_long Temp [ ], + UF_long nn, + UF_long nfr +) ; + + +void ccolamd_fsize +( + int nn, + int MaxFsize [ ], + int Fnrows [ ], + int Fncols [ ], + int Parent [ ], + int Npiv [ ] +) ; + +void ccolamd_l_fsize +( + UF_long nn, + UF_long MaxFsize [ ], + UF_long Fnrows [ ], + UF_long Fncols [ ], + UF_long Parent [ ], + UF_long Npiv [ ] +) ; + +void ccolamd_postorder +( + int nn, + int Parent [ ], + int Npiv [ ], + int Fsize [ ], + int Order [ ], + int Child [ ], + int Sibling [ ], + int Stack [ ], + int Front_cols [ ], + int cmember [ ] +) ; + +void ccolamd_l_postorder +( + UF_long nn, + UF_long Parent [ ], + UF_long Npiv [ ], + UF_long Fsize [ ], + UF_long Order [ ], + UF_long Child [ ], + UF_long Sibling [ ], + UF_long Stack [ ], + UF_long Front_cols [ ], + UF_long cmember [ ] +) ; + +int ccolamd_post_tree +( + int root, + int k, + int Child [ ], + const int Sibling [ ], + int Order [ ], + int Stack [ ] +) ; + +UF_long ccolamd_l_post_tree +( + UF_long root, + UF_long k, + UF_long Child [ ], + const UF_long Sibling [ ], + UF_long Order [ ], + UF_long Stack [ ] +) ; + +#ifndef EXTERN +#define EXTERN extern +#endif + +EXTERN int (*ccolamd_printf) (const char *, ...) ; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/gtsam/3rdparty/CCOLAMD/Lib/ccolamd.o b/gtsam/3rdparty/CCOLAMD/Lib/ccolamd.o new file mode 100644 index 0000000000000000000000000000000000000000..0e2eddee28bf0f25f595926418af1117003147cf GIT binary patch literal 29848 zcmch93w%`7wfC81fPhm@v{9p`b!x{pk(3fmTaLt>z3ylN4by`=QTGJ8MIvX#Jr#yBC`eURTKjDvl+OUR)#ED>HTWmY3(Y_)BxJ@t*-d&nQdx1(5t#awcGRx57-_F^ImRhM@_Zn z70JT;81>B?ZL<0koS*b4fS`gH07iULUAgcSM^kbo3fb;YVp7zVx5}ET3&BgaW;bhA zOkj<60^M|?DaV9Yn=_47i5=nOj^;Wu84mb5jew5~cmLmyGZ|}2z-Nl~#E$3~vGa*pGiT0h|LEf5`?sGg+bzf9 zJ=@f_V=}gbmBvq)S7D4x7Y^&mhtgK0%=o6ln>Y3hwKW*?8J&a`<*p~Q(>sjI*NmqM z%&XSnEp{OE7$J%hs5YOgB-DEv&;m!lPTdS0Cj`q=fEOSN#V@XeQ_Q!{S*}Yz0D3sbO93HAS}} zZcy-AV2naBzR`;^o}2wxRO+hPXl96;O7!?fPiJ)j#bju&cUJqzOJ{Wn$Y0!CgTI{;h~gq*0V zu~!qv)YX-!2_-R8!HNt<7Y%%D3L|hNB(_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iS2+A% zcD)PYC)!GGq!Tl&HOuLB?H>_6-`*N%N72mVRax%|w@ zfiuQ+;XiZy5z;v~2mbtLQNX7^{h-4z;pgGMOXt2p;0JQx{v7-X4EXRN9Y6lNbpDeL z8b1Budj^5eE$zk6l|$oY1H(g?_rhrs++T>h(Sd*Qj`{muAZc<#8)F?->; z1F!B!r_F&o;?LqYJ8*ZOap_k(@SFP4d5A*7=N9?5m;Y)9?swpn4gb3zmrob&`u}!( zV&k&T_5Wu(4PAUUBwX7M?#6e|^@F?d+JSy>H(rneK%Gn9jTee2fE>6RFO>F!yYT|Q zdYOyw#tXOfgWuxVUpGJC_UpzATl?XUapDD6h%UYxKaM2;9~bV%5$^u!!reIH{{hKN B0!07- literal 0 HcmV?d00001 diff --git a/gtsam/3rdparty/CCOLAMD/Lib/ccolamd_global.o b/gtsam/3rdparty/CCOLAMD/Lib/ccolamd_global.o new file mode 100644 index 0000000000000000000000000000000000000000..ea1e61b09c418cc22a39b9ac0a8cbd563a228eb6 GIT binary patch literal 1112 zcmbVK%}&BV5S~)}J&7k0FK{uK$SMh3IG83xF@|{KY__E;u|K9=5x6uO24Q{;x$M>#2TqQ7$dUVZ|;2_G79}#bzB-4K(E5DaQH-PP8cX8#qFw+bZWr{I32@JE)G;GsynTOQgIy{QOFue0M#)&8WNcB$O}z+Dhkc-CE}N wHVdP7if^M*pXbm<{$wi~i6BTL9nYR#qSV)s3f9DXHc!kmSYRogmunLD2RhR}p8x;= literal 0 HcmV?d00001 diff --git a/gtsam/3rdparty/CCOLAMD/Lib/ccolamd_l.o b/gtsam/3rdparty/CCOLAMD/Lib/ccolamd_l.o new file mode 100644 index 0000000000000000000000000000000000000000..213b1cc0cf271fd70f84a528f1e5cb7de5bf430b GIT binary patch literal 29328 zcmch94SZD9nfD9{5H#jSjT$P|*>>zELNTMUW|Y>15IGm_5UQxCAo3A}8VF5h04-lK zN#J@Jn%%YU&)xOivRi*$x7&T|+tSvrZ71PlK&z5iAWF6ItIZI;#1#S-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v;Rx*Kl6&~{(YH1JiGPX`%=J$s^6pQv)|0ieRuDxP{{ga znMim(q3d&gGcV%ua_<{5o(Xraare1TgYRxV7s~l1ESvv6U4KJXfje%uej6T!;(z}N zh4F;$kmIEuck8?Sr%KEc5m|BDTzT_+SKU&7v*{m-b|S|Ys4A;<)!xiJFZjc zj+}WZ!VBqy;d0@x;aT>p;m2jE$Mb=Pt6%Ezcq+AseXQX#^*p*h)EJZxMNa|XY=0jG z50~_naQ}ja_l%cdCEy0Gi#)u;P+fq?0&N9zNs zdD=iEP~`O`Ex?3-E(2b!;aowkF2$oq?Erb?3MJf?v)WqZh+n2&Jw+Ox&4+8V@Rw-(8-~H3nuWhjFtAf49beY#981%))o$sviu4|H~|Vfpy8NZy5X&S@;_?{ue1s zxU%_KqTw$8pV9c$!{ATP!td4i(P8i(&%)>C0k7{3ga5Bt_+=V@$1wOWXW>7f@!uN; z|Dz0i&hJb~4c6Z<_=OBKaJl?>Lbv}#4d*MXy6g9*Ec|^Mzj_$_6U2AoWxxYpOv5wVf5V@KU!H+~gB}R!$%H?a0rzF#9~%aKzqX%jClmkg zhk;Kn0V1w!K8(M1X!uWW7#jZLucYBL`7VDhy(taF zQo}_S+^6B1J*jqjwVj)tg2daeHx!z*_m)Rj+mJRcjJgfS#UQ_ obn^yoziu4CP4CS1-8jN!qKogwl@$cwa^XH5U#!T2yYa>U1NJ!q_y7O^ literal 0 HcmV?d00001 diff --git a/gtsam/3rdparty/CCOLAMD/Lib/libccolamd.a b/gtsam/3rdparty/CCOLAMD/Lib/libccolamd.a new file mode 100644 index 0000000000000000000000000000000000000000..dc4502e9ecd5b5dafa201bc7efc45413322a7d6b GIT binary patch literal 61080 zcmce94PaE&mH$jKzrgb6if`(%RU} zIkj_V#}~wwx}r<(TBtHESzH&(=Bcag6P&$d$%4CPF0PwXTbIo;cj^4QYqOyxiQ=`StFcUZ(p$Zw%H5DF22->!K=#U&{jpj=PNHO z17T(VUU_AO&v#j1T!pG|)`(SM^V&SO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zmq%~BD53lD|5IH;f49d!OAEqyeEJ`F^sLAK-zoIZ>iWreeEu(`&~K;*BV1Symt9(& z{@q#C>EFI8p>xT%`kCfoSzhST8$CL!*7z5u(CDe#|DHn6+?1s2$8$jn{Y8)NmuutvBp#pM)t1ox@_tzt zj<7%6trHIEToSE*e&*5r_@_}(ha=N-!b?BX3s!4D<2Pk|S3ozt@0oyZdfZP#y3VswQ21H=rbmQW zmZnE=E1NFn*Ljv3ras;Dh!p|-km?s^H?Vk2kKm@aACKt~R*A-MdSw#{a7H)%Vtqh2 z{o+dCRQk@aEN26-vKp3UV`Jlo9sj9gS(YS6?!OlKY013P*PU-_ZM`O2zj%4)oyE>8 z+t%EiI5 zJnmdqY;U;f=EYZRC@#C*>8)PIPUDe7md*3_AZ$zUZm*%;=n{A^yow&imTA!^n^Vjq ze7_JLVVvY`QKAk#u|cu~>VOnNOwK>RwSa`@`C?~U_o|L{%a?U{CJVI> N=#TNUycQ>E{|99m8S?-D literal 0 HcmV?d00001 diff --git a/gtsam/3rdparty/CCOLAMD/MATLAB/Contents.m b/gtsam/3rdparty/CCOLAMD/MATLAB/Contents.m new file mode 100644 index 000000000..6ad7eb381 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/MATLAB/Contents.m @@ -0,0 +1,20 @@ +% CCOLAMD, constrained approximate minimum degree ordering +% +% Primary functions: +% csymamd - constrained symmetric approximate minimum degree permutation +% ccolamd - constrained column approximate minimum degree permutation. +% +% helper and test functions: +% ccolamd_demo - demo for ccolamd and csymamd +% ccolamd_make - compiles CCOLAMD and CSYMAMD for MATLAB +% ccolamd_install - compiles and installs ccolamd and csymamd for MATLAB +% ccolamd_test - extensive test of ccolamd and csymamd +% luflops - compute the flop count for sparse LU factorization +% ccolamdtestmex - test function for ccolamd +% csymamdtestmex - test function for csymamd +% +% Example: +% p = ccolamd (S, knobs, cmember) + +% Copyright 1998-2007, Timothy A. Davis, Stefan Larimore, and Siva Rajamanickam +% Developed in collaboration with J. Gilbert and E. Ng. diff --git a/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd.m b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd.m new file mode 100644 index 000000000..e3234e916 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd.m @@ -0,0 +1,48 @@ +function [p, stats] = ccolamd (S, knobs, cmember) %#ok +%CCOLAMD constrained column approximate minimum degree permutation. +% p = CCOLAMD(S) returns the column approximate minimum degree permutation +% vector for the sparse matrix S. For a non-symmetric matrix S, S(:,p) +% tends to have sparser LU factors than S. chol(S(:,p)'*S(:,p)) also tends +% to be sparser than chol(S'*S). p=ccolamd(S,1) optimizes the ordering for +% lu(S(:,p)). The ordering is followed by a column elimination tree post- +% ordering. +% +% Example: +% p = ccolamd (S) +% p = ccolamd (S,knobs,cmember) +% +% knobs is an optional one- to five-element input vector, with a default +% value of [0 10 10 1 0] if not present or empty ([ ]). Entries not present +% are set to their defaults. +% +% knobs(1): if nonzero, the ordering is optimized for lu(S(:,p)). It will +% be a poor ordering for chol(S(:,p)'*S(:,p)). This is the most +% important knob for ccolamd. +% knobs(2): if S is m-by-n, rows with more than max(16,knobs(2)*sqrt(n)) +% entries are ignored. +% knobs(3): columns with more than max(16,knobs(3)*sqrt(min(m,n))) entries +% are ignored and ordered last in the output permutation (subject to the +% cmember constraints). +% knobs(4): if nonzero, aggressive absorption is performed. +% knobs(5): if nonzero, statistics and knobs are printed. +% +% cmember is an optional vector of length n. It defines the constraints on +% the column ordering. If cmember(j)=s, then column j is in constraint set +% s (s must be in the range 1 to n). In the output permutation p, all +% columns in set 1 appear first, followed by all columns in set 2, and so +% on. cmember=ones(1,n) if not present or empty. ccolamd(S,[],1:n) returns +% 1:n. +% +% p = ccolamd(S) is about the same as p = colamd(S). knobs and its default +% values differ. colamd always does aggressive absorption, and it finds an +% ordering suitable for both lu(S(:,p)) and chol(S(:,p)'*S(:,p)); it cannot +% optimize its ordering for lu(S(:,p)) to the extent that ccolamd(S,1) can. +% +% See also AMD, CSYMAMD, COLAMD, SYMAMD, SYMRCM. + +% Copyright 1998-2007, Timothy A. Davis, Stefan Larimore, and Siva Rajamanickam +% Developed in collaboration with J. Gilbert and E. Ng. +% Supported by the National Science Foundation (DMS-9504974, DMS-9803599, +% CCR-0203270), and a grant from Sandia National Lab. + +error ('ccolamd: mexFunction not found') ; diff --git a/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_demo.m b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_demo.m new file mode 100644 index 000000000..e2fd68457 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_demo.m @@ -0,0 +1,209 @@ +%CCOLAMD_DEMO demo for ccolamd and csymamd +% minimum degree ordering algorithm. +% +% Example: +% ccolamd_demo +% +% See also ccolamd + +% Copyright 1998-2007, Timothy A. Davis, Stefan Larimore, and Siva Rajamanickam +% Developed in collaboration with J. Gilbert and E. Ng. + +%------------------------------------------------------------------------------- +% Print the introduction, the help info, and compile the mexFunctions +%------------------------------------------------------------------------------- + +fprintf (1, '\n-----------------------------------------------------------\n') ; +fprintf (1, 'ccolamd/csymamd demo.') ; +fprintf (1, '\n-----------------------------------------------------------\n') ; +help ccolamd_demo ; + +fprintf (1, '\n-----------------------------------------------------------\n') ; +fprintf (1, 'ccolamd help information:') ; +fprintf (1, '\n-----------------------------------------------------------\n') ; +help ccolamd ; + +fprintf (1, '\n-----------------------------------------------------------\n') ; +fprintf (1, 'csymamd help information:') ; +fprintf (1, '\n-----------------------------------------------------------\n') ; +help csymamd ; + +%------------------------------------------------------------------------------- +% Solving Ax=b +%------------------------------------------------------------------------------- + +n = 100 ; +fprintf (1, '\n-----------------------------------------------------------\n') ; +fprintf (1, 'Solving Ax=b for a small %d-by-%d random matrix:', n, n) ; +fprintf (1, '\n-----------------------------------------------------------\n') ; +fprintf (1, '\nNote: Random sparse matrices are AWFUL test cases.\n') ; +fprintf (1, 'They''re just easy to generate in a demo.\n') ; + +% set up the system + +rand ('state', 0) ; +randn ('state', 0) ; +spparms ('default') ; +A = sprandn (n, n, 2/n) + speye (n) ; +b = (1:n)' ; + +figure (1) +clf ; +subplot (2,2,1) +spy (A) +title ('original matrix') + +fprintf (1, '\n\nSolving via lu (PAQ = LU), where Q is from ccolamd:\n') ; +q = ccolamd (A, 1) ; +I = speye (n) ; +Q = I (:, q) ; +[L,U,P] = lu (A*Q) ; +fl = luflops (L, U) ; +x = Q * (U \ (L \ (P * b))) ; +fprintf (1, '\nFlop count for [L,U,P] = lu (A*Q): %d\n', fl) ; +fprintf (1, 'residual: %e\n', norm (A*x-b)); +subplot (2,2,2) ; +spy (L|U) ; +title ('LU with ccolamd') ; + +try +fprintf (1, '\n\nSolving via lu (PAQ = LU), where Q is from colamd:\n') ; +q = colamd (A) ; +I = speye (n) ; +Q = I (:, q) ; +[L,U,P] = lu (A*Q) ; +fl = luflops (L, U) ; +x = Q * (U \ (L \ (P * b))) ; +fprintf (1, '\nFlop count for [L,U,P] = lu (A*Q): %d\n', fl) ; +fprintf (1, 'residual: %e\n', norm (A*x-b)); +subplot (2,2,3) ; +spy (L|U) ; +title ('LU with colamd') ; +catch +fprintf (1, 'You have a very old version of MATLAB (no colamd) \n') ; +end + +fprintf (1, '\n\nSolving via lu (PA = LU), without regard for sparsity:\n') ; +[L,U,P] = lu (A) ; +fl = luflops (L, U) ; +x = U \ (L \ (P * b)) ; +fprintf (1, '\nFlop count for [L,U,P] = lu (A*Q): %d\n', fl) ; +fprintf (1, 'residual: %e\n', norm (A*x-b)); +subplot (2,2,4) ; +spy (L|U) ; +title ('LU with no ordering') ; + +%------------------------------------------------------------------------------- +% Large demo for ccolamd +%------------------------------------------------------------------------------- + +% Since the analysis will be done on the Cholesky factorization of A'A, +% set the knob to tell ccolamd to order for Cholesky, not LU. + +fprintf (1, '\n-----------------------------------------------------------\n') ; +fprintf (1, 'Large demo for ccolamd (symbolic analysis only):') ; +fprintf (1, '\n-----------------------------------------------------------\n') ; + +rand ('state', 0) ; +randn ('state', 0) ; +spparms ('default') ; +n = 1000 ; +fprintf (1, 'Generating a random %d-by-%d sparse matrix.\n', n, n) ; +A = sprandn (n, n, 2/n) + speye (n) ; + +figure (2) +clf ; +subplot (2,2,1) +spy (A) +title ('original matrix') + +fprintf (1, '\n\nUnordered matrix:\n') ; +[lnz,h,parent,post,R] = symbfact (A, 'col') ; +fprintf (1, 'nz in Cholesky factors of A''A: %d\n', sum (lnz)) ; +fprintf (1, 'flop count for Cholesky of A''A: %d\n', sum (lnz.^2)) ; +subplot (2,2,4) ; +spy (R) ; +title ('Cholesky with no ordering') ; + +tic ; +p = ccolamd (A) ; +t = toc ; +[lnz,h,parent,post,R] = symbfact (A (:,p), 'col') ; +fprintf (1, '\n\nccolamd run time: %f\n', t) ; +fprintf (1, 'ccolamd ordering quality: \n') ; +fprintf (1, 'nz in Cholesky factors of A(:,p)''A(:,p): %d\n', sum (lnz)) ; +fprintf (1, 'flop count for Cholesky of A(:,p)''A(:,p): %d\n', sum (lnz.^2)) ; +subplot (2,2,2) ; +spy (R) ; +title ('Cholesky with ccolamd') ; + +try +tic ; +p = colamd (A) ; +t = toc ; +[lnz,h,parent,post,R] = symbfact (A (:,p), 'col') ; +fprintf (1, '\n\ncolamd run time: %f\n', t) ; +fprintf (1, 'colamd ordering quality: \n') ; +fprintf (1, 'nz in Cholesky factors of A(:,p)''A(:,p): %d\n', sum (lnz)) ; +fprintf (1, 'flop count for Cholesky of A(:,p)''A(:,p): %d\n', sum (lnz.^2)) ; +subplot (2,2,3) ; +spy (R) ; +title ('Cholesky with colamd') ; +catch +fprintf (1, 'You have a very old version of MATLAB (no colamd) \n') ; +end + +%------------------------------------------------------------------------------- +% Large demo for csymamd +%------------------------------------------------------------------------------- + +fprintf (1, '\n-----------------------------------------------------------\n') ; +fprintf (1, 'Large demo for csymamd (symbolic analysis only):') ; +fprintf (1, '\n-----------------------------------------------------------\n') ; + +fprintf (1, 'Generating a random symmetric %d-by-%d sparse matrix.\n', n, n) ; +A = A+A' ; + +figure (3) +clf ; +subplot (2,2,1) +spy (A) +title ('original matrix') + +fprintf (1, '\n\nUnordered matrix:\n') ; +[lnz,h,parent,post,R] = symbfact (A, 'sym') ; +fprintf (1, 'nz in Cholesky factors of A: %d\n', sum (lnz)) ; +fprintf (1, 'flop count for Cholesky of A: %d\n', sum (lnz.^2)) ; +subplot (2,2,4) ; +spy (R) ; +title ('Cholesky with no ordering') ; + +tic ; +p = csymamd (A) ; +t = toc ; +[lnz,h,parent,post,R] = symbfact (A (p,p), 'sym') ; +fprintf (1, '\n\ncsymamd run time: %f\n', t) ; +fprintf (1, 'csymamd ordering quality: \n') ; +fprintf (1, 'nz in Cholesky factors of A(p,p): %d\n', sum (lnz)) ; +fprintf (1, 'flop count for Cholesky of A(p,p): %d\n', sum (lnz.^2)) ; +subplot (2,2,2) ; +spy (R) ; +title ('Cholesky with csymamd') ; + +try +tic ; +p = symamd (A) ; +t = toc ; +lnz = symbfact (A (p,p), 'sym') ; +fprintf (1, '\n\nsymamd run time: %f\n', t) ; +fprintf (1, 'symamd ordering quality: \n') ; +fprintf (1, 'nz in Cholesky factors of A(p,p): %d\n', sum (lnz)) ; +fprintf (1, 'flop count for Cholesky of A(p,p): %d\n', sum (lnz.^2)) ; +subplot (2,2,3) ; +spy (R) ; +title ('Cholesky with symamd') ; +catch +fprintf (1, 'You have a very old version of MATLAB (no symamd) \n') ; +end + +drawnow diff --git a/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_install.m b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_install.m new file mode 100644 index 000000000..0d0428e96 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_install.m @@ -0,0 +1,18 @@ +function ccolamd_install +%CCOLAMD_INSTALL compiles and installs ccolamd and csymamd for MATLAB +% Your current directory must be CCOLAMD/MATLAB for this function to work. +% +% Example: +% ccolamd_install +% +% See also ccolamd, csymamd. + +% Copyright 1998-2007, Timothy A. Davis, Stefan Larimore, and Siva Rajamanickam +% Developed in collaboration with J. Gilbert and E. Ng. + +ccolamd_make +addpath (pwd) +fprintf ('\nThe following path has been added. You may wish to add it\n') ; +fprintf ('permanently, using the MATLAB pathtool command.\n') ; +fprintf ('%s\n\n', pwd) ; +ccolamd_demo diff --git a/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_make.m b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_make.m new file mode 100644 index 000000000..4637f3884 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_make.m @@ -0,0 +1,29 @@ +function ccolamd_make +%CCOLAMD_MAKE compiles CCOLAMD and CSYMAMD for MATLAB +% +% Example: +% ccolamd_make +% +% See also ccolamd, csymamd + +% Copyright 1998-2007, Timothy A. Davis, Stefan Larimore, and Siva Rajamanickam +% Developed in collaboration with J. Gilbert and E. Ng. + +details = 0 ; % 1 if details of each command are to be printed +d = '' ; +if (~isempty (strfind (computer, '64'))) + d = '-largeArrayDims' ; +end +src = '../Source/ccolamd.c ../Source/ccolamd_global.c' ; +cmd = sprintf ('mex -DDLONG -O %s -I../../UFconfig -I../Include -output ', d) ; +s = [cmd 'ccolamd ccolamdmex.c ' src] ; +if (details) + fprintf ('%s\n', s) ; +end +eval (s) ; +s = [cmd 'csymamd csymamdmex.c ' src] ; +if (details) + fprintf ('%s\n', s) ; +end +eval (s) ; +fprintf ('CCOLAMD and CSYMAMD successfully compiled.\n') ; diff --git a/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_test.m b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_test.m new file mode 100644 index 000000000..e359b9fea --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamd_test.m @@ -0,0 +1,485 @@ +function ccolamd_test +%CCOLAMD_TEST extensive test of ccolamd and csymamd +% +% Example: +% ccolamd_test +% +% See also csymamd, ccolamd, ccolamd_make. + +% Copyright 1998-2007, Timothy A. Davis, Stefan Larimore, and Siva Rajamanickam +% Developed in collaboration with J. Gilbert and E. Ng. + +help ccolamd_test + +global ccolamd_default_knobs csymamd_default_knobs +ccolamd_default_knobs = [0 10 10 1 0] ; +csymamd_default_knobs = [10 1 0] ; + + fprintf ('Compiling ccolamd, csymamd, and test mexFunctions.\n') ; + ccolamd_make ; + + d = '' ; + if (~isempty (strfind (computer, '64'))) + d = '-largeArrayDims' ; + end + src = '../Source/ccolamd.c ../Source/ccolamd_global.c' ; + cmd = sprintf ('mex -DDLONG -O %s -I../../UFconfig -I../Include ', d) ; + eval ([cmd 'ccolamdtestmex.c ' src]) ; + eval ([cmd 'csymamdtestmex.c ' src]) ; + fprintf ('Done compiling.\n') ; + + +fprintf ('\nThe following codes will be tested:\n') ; +which ccolamd +which csymamd +which ccolamdtestmex +which csymamdtestmex + +fprintf ('\nStarting the tests. Please be patient.\n') ; + +h = waitbar (0, 'COLAMD test') ; + +rand ('state', 0) ; +randn ('state', 0) ; + +A = sprandn (500,500,0.4) ; + +p = ccolamd (A, [0 10 10 1 1]) ; check_perm (p, A) ; +p = ccolamd (A, [1 2 7 1 1]) ; check_perm (p, A) ; +p = ccolamd (A, [1 2 10 0 1]) ; check_perm (p, A) ; +p = ccolamd (A, [9 2 3 1 1]) ; check_perm (p, A) ; + +p = csymamd (A, [10 1 1]) ; check_perm (p, A) ; +p = csymamd (A, [4 1 1]) ; check_perm (p, A) ; +p = csymamd (A, [9 0 1]) ; check_perm (p, A) ; + +fprintf ('Null matrices') ; +A = zeros (0,0) ; +A = sparse (A) ; + +p = ccolamd (A) ; +check_perm (p, A) ; + +p = csymamd (A) ; +check_perm (p, A) ; + +A = zeros (0, 100) ; +A = sparse (A) ; +p = ccolamd (A) ; +check_perm (p, A) ; + +A = zeros (100, 0) ; +A = sparse (A) ; +p = ccolamd (A) ; +check_perm (p, A) ; +fprintf (' OK\n') ; + + +fprintf ('Matrices with a few dense row/cols\n') ; +for trial = 1:20 + + waitbar (trial/20, h, 'CCOLAMD: dense rows/cols') ; + + % random square unsymmetric matrix + A = rand_matrix (1000, 1000, 1, 10, 20) ; + [m n] = size (A) ; + + cmember = irand (min (trial,n), n) ; + + for tol = [0:.1:2 3:20 1e6] + B = A + A' ; + + p = ccolamd (A, [ ]) ; check_perm (p, A) ; + p = ccolamd (A, [1 tol tol 1]) ; check_perm (p, A) ; + p = ccolamd (A, [0 tol tol 1]) ; check_perm (p, A) ; + p = ccolamd (A, [1 tol tol 0]) ; check_perm (p, A) ; + p = ccolamd (A, [0 tol tol 1]) ; check_perm (p, A) ; + p = csymamd (A, [tol 1]) ; check_perm (p, A) ; + p = csymamd (A, tol) ; check_perm (p, A) ; + p = csymamd (A, [ ]) ; check_perm (p, A) ; + p = csymamd (B, [tol 0]) ; check_perm (p, A) ; + p = ccolamd (A, [0 tol -1 1]) ; check_perm (p, A) ; + p = ccolamd (A, [0 -1 tol 1]) ; check_perm (p, A) ; + + % check with non-null cmember + + p = ccolamd (A, [ ], cmember) ; check_perm (p, A) ; + p = ccolamd (A, [1 tol tol 1], cmember) ; check_perm (p, A) ; + p = ccolamd (A, [0 tol tol 1], cmember) ; check_perm (p, A) ; + p = ccolamd (A, [1 tol tol 0], cmember) ; check_perm (p, A) ; + p = ccolamd (A, [0 tol tol 1], cmember) ; check_perm (p, A) ; + p = csymamd (A, [tol 1], cmember) ; check_perm (p, A) ; + p = csymamd (A, tol, cmember) ; check_perm (p, A) ; + p = csymamd (A, [ ], cmember) ; check_perm (p, A) ; + p = csymamd (B, [tol 0], cmember) ; check_perm (p, A) ; + p = ccolamd (A, [0 tol -1 1], cmember) ; check_perm (p, A) ; + p = ccolamd (A, [0 -1 tol 1], cmember) ; check_perm (p, A) ; + + p = ccolamd (A, [ ], [ ]) ; check_perm (p, A) ; + p = ccolamd (A, [1 tol tol 1], [ ]) ; check_perm (p, A) ; + p = ccolamd (A, [0 tol tol 1], [ ]) ; check_perm (p, A) ; + p = ccolamd (A, [1 tol tol 0], [ ]) ; check_perm (p, A) ; + p = ccolamd (A, [0 tol tol 1], [ ]) ; check_perm (p, A) ; + p = csymamd (A, [tol 1], [ ]) ; check_perm (p, A) ; + p = csymamd (A, tol, [ ]) ; check_perm (p, A) ; + p = csymamd (A, [ ], [ ]) ; check_perm (p, A) ; + p = csymamd (B, [tol 0], [ ]) ; check_perm (p, A) ; + p = ccolamd (A, [0 tol -1 1], [ ]) ; check_perm (p, A) ; + p = ccolamd (A, [0 -1 tol 1], [ ]) ; check_perm (p, A) ; + + end +end +fprintf (' OK\n') ; + +fprintf ('General matrices\n') ; +for trial = 1:400 + + waitbar (trial/400, h, 'CCOLAMD: with dense rows/cols') ; + + % matrix of random mtype + mtype = irand (3) ; + A = rand_matrix (2000, 2000, mtype, 0, 0) ; + p = ccolamd (A) ; + check_perm (p, A) ; + + if (mtype == 3) + p = csymamd (A) ; + check_perm (p, A) ; + end + +end +fprintf (' OK\n') ; + + + +fprintf ('Test error handling with invalid inputs\n') ; + +% Check different erroneous input. +for trial = 1:30 + + waitbar (trial/30, h, 'CCOLAMD: error handling') ; + + A = rand_matrix (1000, 1000, 2, 0, 0) ; + + for err = 1:13 + + p = Tcolamd (A, [ccolamd_default_knobs 1 err], [ ]) ; + if (p(1) ~= -1) %#ok + check_perm (p, A) ; + end + + if (err == 1) + % check different (valid) input args to ccolamd + p = Acolamd (A) ; + p2 = Acolamd (A, [ccolamd_default_knobs 0 0]) ; + if (any (p ~= p2)) + error ('ccolamd: mismatch 1!') ; + end + end + + B = A'*A ; + p = Tsymamd (B, [-1 1 0 err], [ ]) ; + if (p(1) ~= -1) %#ok + check_perm (p, A) ; + end + + if (err == 1) + + % check different (valid) input args to csymamd + p = Asymamd (B) ; + check_perm (p, A) ; + p2 = Asymamd (B, [csymamd_default_knobs 0]) ; + if (any (p ~= p2)) + error ('symamd: mismatch 1!') ; + end + end + + end + +end +fprintf (' OK\n') ; + +fprintf ('Matrices with a few empty columns\n') ; + +for trial = 1:400 + + waitbar (trial/400, h, 'CCOLAMD: with empty rows/cols') ; + + % some are square, some are rectangular + n = 0 ; + while (n < 5) + A = rand_matrix (1000, 1000, irand (2), 0, 0) ; + [m n] = size (A) ; + end + + % Add 5 null columns at random locations. + null_col = randperm (n) ; + A (:, null_col) = 0 ; + + % Order the matrix and make sure that the null columns are ordered last. + p = ccolamd (A, [1 1e6 1e6 0]) ; + check_perm (p, A) ; + + % find all null columns in A + null_col = find (sum (spones (A), 1) == 0) ; + nnull = length (null_col) ; + if (any (null_col ~= p ((n-nnull+1):n))) + error ('ccolamd: Null cols are not ordered last in natural order') ; + end + +end +fprintf (' OK\n') ; + +fprintf ('Matrices with a few empty rows and columns\n') ; + +for trial = 1:400 + + waitbar (trial/400, h, 'CCOLAMD: with empty rows/cols') ; + + % symmetric matrices + n = 0 ; + while (n < 5) + A = rand_matrix (1000, 1000, 3, 0, 0) ; + [m n] = size (A) ; + end + + % Add 5 null columns and rows at random locations. + null_col = randperm (n) ; + A (:, null_col) = 0 ; + A (null_col, :) = 0 ; + + % Order the matrix and make sure that the null rows/cols are ordered last. + p = csymamd (A, -1) ; + check_perm (p, A) ; + + % find all null rows/columns in A + Alo = tril (A, -1) ; + null_col = ... + find ((sum (spones (Alo), 1) == 0) & (sum (spones (Alo), 2) == 0)') ; + nnull = length (null_col) ; + if (any (null_col ~= p ((n-nnull+1):n))) + error ('csymamd: Null cols are not ordered last in natural order') ; + end + +end +fprintf (' OK\n') ; + +fprintf ('Matrices with a few empty rows\n') ; + +% Test matrices with null rows inserted. + +for trial = 1:400 + + waitbar (trial/400, h, 'CCOLAMD: with null rows') ; + m = 0 ; + while (m < 5) + A = rand_matrix (1000, 1000, 2, 0, 0) ; + m = size (A,1) ; + end + + % Add 5 null rows at random locations. + null_row = randperm (m) ; + null_row = sort (null_row (1:5)) ; + A (null_row, :) = 0 ; + + p = ccolamd (A) ; + check_perm (p, A) ; + +end +fprintf (' OK\n') ; + +fprintf ('\nccolamd and csymamd: all tests passed\n\n') ; +close (h) ; + +%------------------------------------------------------------------------------- + +function p = Acolamd (S, knobs) +% Acolamd: compare ccolamd and Tcolamd results + +global ccolamd_default_knobs + +if (nargin < 2) + p = ccolamd (S) ; + p1 = Tcolamd (S, [ccolamd_default_knobs 0 0], [ ]) ; +else + p = ccolamd (S, knobs) ; + p1 = Tcolamd (S, knobs, [ ]) ; +end + +check_perm (p, S) ; +check_perm (p1, S) ; + +if (any (p1 ~= p)) + narg = nargin ; + if (nargin == 2) + save bad S narg knobs + else + save bad S narg + end + error ('Acolamd mismatch!') ; +end + +%------------------------------------------------------------------------------- + +function p = Asymamd (S, knobs) +% Asymamd: compare csymamd and Tsymamd results + +global csymamd_default_knobs + +if (nargin < 2) + p = csymamd (S) ; + p1 = Tsymamd (S, [csymamd_default_knobs 0], [ ]) ; +else + p = csymamd (S, knobs) ; + p1 = Tsymamd (S, knobs, [ ]) ; +end + +if (any (p1 ~= p)) + error ('Asymamd mismatch!') ; +end + + +%------------------------------------------------------------------------------- + +function check_perm (p, A, cmember) +% check_perm: check for a valid permutation vector + +if (isempty (A) & isempty (p)) %#ok + % empty permutation vectors of empty matrices are OK + return +end + +if (isempty (p)) + error ('Bad permutation: cannot be empty') ; +end + +[m n] = size (A) ; +[p_m p_n] = size (p) ; +if (p_n == 1) + % force p to be a row vector + p = p' ; + [p_m p_n] = size (p) ; +end + +if (n ~= p_n) + error ('Bad permutation: wrong size') ; +end + +if (p_m ~= 1) ; + % p must be a vector + error ('Bad permutation: not a vector') ; +else + if (any (sort (p) - (1:p_n))) + error ('Bad permutation') ; + end +end + +if (nargin > 2) + % check cmember + c = cmember (p) ; + % c must be monotonically non-decreasing + c = diff (c) ; + if (any (c < 0)) + error ('permutation breaks the cmember constraints') ; + end +end + +%------------------------------------------------------------------------------- + +function i = irand (n,s) +% irand: return a random vector of size s, with values between 1 and n +if (nargin == 1) + s = 1 ; +end +i = min (n, 1 + floor (rand (1,s) * n)) ; + +%------------------------------------------------------------------------------- + +function A = rand_matrix (n_max, m_max, mtype, d_rows, d_cols) +% rand_matrix: return a random sparse matrix +% +% A = rand_matrix (n_max, m_max, mtype, d_rows, d_cols) +% +% A binary matrix of random size, at most n_max-by-m_max, with d_rows dense rows +% and d_cols dense columns. +% +% mtype 1: square unsymmetric (m_max is ignored) +% mtype 2: rectangular +% mtype 3: symmetric (m_max is ignored) + +n = irand (n_max) ; +if (mtype ~= 2) + % square + m = n ; +else + m = irand (m_max) ; +end + +A = sprand (m, n, 10 / max (m,n)) ; + +if (d_rows > 0) + % add dense rows + for k = 1:d_rows + i = irand (m) ; + nz = irand (n) ; + p = randperm (n) ; + p = p (1:nz) ; + A (i,p) = 1 ; + end +end + +if (d_cols > 0) + % add dense cols + for k = 1:d_cols + j = irand (n) ; + nz = irand (m) ; + p = randperm (m) ; + p = p (1:nz) ; + A (p,j) = 1 ; + end +end + +A = spones (A) ; + +% ensure that there are no empty columns +d = find (full (sum (A,1)) == 0) ; %#ok +A (m,d) = 1 ; %#ok + +% ensure that there are no empty rows +d = find (full (sum (A,2)) == 0) ; %#ok +A (d,n) = 1 ; %#ok + +if (mtype == 3) + % symmetric + A = A + A' + speye (n) ; +end + +A = spones (A) ; + +%------------------------------------------------------------------------------- +% Tcolamd: run ccolamd in a testing mode +%------------------------------------------------------------------------------- + +function p = Tcolamd (S, knobs, cmember) + +% knobs (5) = 1 ; +p = ccolamdtestmex (S, knobs, cmember) ; + +if (p (1) ~= -1) + check_perm (p, S) ; +end + + +%------------------------------------------------------------------------------- +% Tsymamd: run csymamd in a testing mode +%------------------------------------------------------------------------------- + +function p = Tsymamd (S, knobs, cmember) + +% knobs (2) = 1 ; +p = csymamdtestmex (S, knobs, cmember) ; + +if (p (1) ~= -1) + check_perm (p, S) ; +end + diff --git a/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamdmex.c b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamdmex.c new file mode 100644 index 000000000..fbcb87873 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamdmex.c @@ -0,0 +1,228 @@ +/* ========================================================================== */ +/* === ccolamd mexFunction ================================================== */ +/* ========================================================================== */ + +/* ---------------------------------------------------------------------------- + * CCOLAMD, Copyright (C), Univ. of Florida. Authors: Timothy A. Davis, + * Sivasankaran Rajamanickam, and Stefan Larimore + * See License.txt for the Version 2.1 of the GNU Lesser General Public License + * http://www.cise.ufl.edu/research/sparse + * -------------------------------------------------------------------------- */ + +/* + * Usage: + * p = ccolamd (A) ; + * [p stats] = ccolamd (A, knobs, cmember) ; + * + * See ccolamd.m for a description. + */ + +/* ========================================================================== */ +/* === Include files ======================================================== */ +/* ========================================================================== */ + +#include "ccolamd.h" +#include "mex.h" +#include "matrix.h" +#include +#include +#include "UFconfig.h" + +/* ========================================================================== */ +/* === ccolamd mexFunction ================================================== */ +/* ========================================================================== */ + +void mexFunction +( + /* === Parameters ======================================================= */ + + int nargout, + mxArray *pargout [ ], + int nargin, + const mxArray *pargin [ ] +) +{ + /* === Local variables ================================================== */ + + UF_long *A ; /* ccolamd's copy of the matrix and workspace */ + UF_long *cmember ; /* ccolamd's copy of the constraint set */ + double *in_cmember ; /* input constraint set */ + UF_long *p ; /* ccolamd's copy of the column pointers */ + UF_long Alen ; /* size of A */ + UF_long cslen ; /* size of CS */ + UF_long n_col ; /* number of columns of A */ + UF_long n_row ; /* number of rows of A */ + UF_long nnz ; /* number of entries in A */ + UF_long full ; /* TRUE if input matrix full, FALSE if sparse */ + double knobs [CCOLAMD_KNOBS] ; /* ccolamd user-controllable parameters */ + double *out_perm ; /* output permutation vector */ + double *out_stats ; /* output stats vector */ + double *in_knobs ; /* input knobs vector */ + UF_long i ; /* loop counter */ + mxArray *Ainput ; /* input matrix handle */ + UF_long spumoni ; /* verbosity variable */ + UF_long stats [CCOLAMD_STATS] ; /* stats for ccolamd */ + + /* === Check inputs ===================================================== */ + + if (nargin < 1 || nargin > 3 || nargout < 0 || nargout > 2) + { + mexErrMsgTxt ("Usage: [p stats] = ccolamd (A, knobs, cmember)") ; + } + + /* === Get cmember ====================================================== */ + + cmember = NULL ; + cslen = 0 ; + if (nargin > 2) + { + in_cmember = mxGetPr (pargin [2]) ; + cslen = mxGetNumberOfElements (pargin [2]) ; + if (cslen != 0) + { + cmember = (UF_long *) mxCalloc (cslen, sizeof (UF_long)) ; + for (i = 0 ; i < cslen ; i++) + { + /* convert cmember from 1-based to 0-based */ + cmember[i] = ((UF_long) in_cmember [i] - 1) ; + } + } + } + + /* === Get knobs ======================================================== */ + + ccolamd_l_set_defaults (knobs) ; + spumoni = 0 ; + + /* check for user-passed knobs */ + if (nargin > 1) + { + in_knobs = mxGetPr (pargin [1]) ; + i = mxGetNumberOfElements (pargin [1]) ; + if (i > 0) knobs [CCOLAMD_LU] = (in_knobs [0] != 0) ; + if (i > 1) knobs [CCOLAMD_DENSE_ROW] = in_knobs [1] ; + if (i > 2) knobs [CCOLAMD_DENSE_COL] = in_knobs [2] ; + if (i > 3) knobs [CCOLAMD_AGGRESSIVE] = (in_knobs [3] != 0) ; + if (i > 4) spumoni = (in_knobs [4] != 0) ; + } + + /* print knob settings if spumoni is set */ + if (spumoni) + { + mexPrintf ("\nccolamd version %d.%d, %s:\nknobs(1): %g, order for %s\n", + CCOLAMD_MAIN_VERSION, CCOLAMD_SUB_VERSION, CCOLAMD_DATE, + in_knobs [0], + (knobs [CCOLAMD_LU] != 0) ? "lu(A)" : "chol(A'*A)") ; + if (knobs [CCOLAMD_DENSE_ROW] >= 0) + { + mexPrintf ("knobs(2): %g, rows with > max(16,%g*sqrt(size(A,2)))" + " entries removed\n", in_knobs [1], knobs [CCOLAMD_DENSE_ROW]) ; + } + else + { + mexPrintf ("knobs(2): %g, no dense rows removed\n", in_knobs [1]) ; + } + if (knobs [CCOLAMD_DENSE_COL] >= 0) + { + mexPrintf ("knobs(3): %g, cols with > max(16,%g*sqrt(min(size(A)))" + " entries removed\n", in_knobs [2], knobs [CCOLAMD_DENSE_COL]) ; + } + else + { + mexPrintf ("knobs(3): no dense columns removed\n", in_knobs [2]) ; + } + mexPrintf ("knobs(4): %g, aggressive absorption: %s\n", + in_knobs [3], (knobs [CCOLAMD_AGGRESSIVE] != 0) ? "yes" : "no") ; + mexPrintf ("knobs(5): %g, statistics and knobs printed\n", + in_knobs [4]) ; + } + + /* === If A is full, convert to a sparse matrix ========================= */ + + Ainput = (mxArray *) pargin [0] ; + if (mxGetNumberOfDimensions (Ainput) != 2) + { + mexErrMsgTxt ("ccolamd: input matrix must be 2-dimensional") ; + } + full = !mxIsSparse (Ainput) ; + if (full) + { + mexCallMATLAB (1, &Ainput, 1, (mxArray **) pargin, "sparse") ; + } + + /* === Allocate workspace for ccolamd =================================== */ + + /* get size of matrix */ + n_row = mxGetM (Ainput) ; + n_col = mxGetN (Ainput) ; + + /* get column pointer vector */ + p = (UF_long *) mxCalloc (n_col+1, sizeof (UF_long)) ; + (void) memcpy (p, mxGetJc (Ainput), (n_col+1)*sizeof (UF_long)) ; + nnz = p [n_col] ; + Alen = (UF_long) ccolamd_l_recommended (nnz, n_row, n_col) ; + if (Alen == 0) + { + mexErrMsgTxt ("ccolamd: problem too large") ; + } + + /* === Copy input matrix into workspace ================================= */ + + A = (UF_long *) mxCalloc (Alen, sizeof (UF_long)) ; + (void) memcpy (A, mxGetIr (Ainput), nnz*sizeof (UF_long)) ; + + if (full) + { + mxDestroyArray (Ainput) ; + } + + /* Check constraint set size */ + if (cmember != NULL && cslen != n_col) + { + mexErrMsgTxt ("ccolamd: cmember must be of length equal to #cols of A"); + } + + /* === Order the columns (destroys A) =================================== */ + + if (!ccolamd_l (n_row, n_col, Alen, A, p, knobs, stats, cmember)) + { + ccolamd_l_report (stats) ; + mexErrMsgTxt ("ccolamd error!") ; + } + mxFree (A) ; + mxFree (cmember) ; + + /* === Return the permutation vector ==================================== */ + + pargout [0] = mxCreateDoubleMatrix (1, n_col, mxREAL) ; + out_perm = mxGetPr (pargout [0]) ; + for (i = 0 ; i < n_col ; i++) + { + /* ccolamd is 0-based, but MATLAB expects this to be 1-based */ + out_perm [i] = p [i] + 1 ; + } + mxFree (p) ; + + /* === Return the stats vector ========================================== */ + + /* print stats if spumoni is set */ + if (spumoni) + { + ccolamd_l_report (stats) ; + } + + if (nargout == 2) + { + pargout [1] = mxCreateDoubleMatrix (1, CCOLAMD_STATS, mxREAL) ; + out_stats = mxGetPr (pargout [1]) ; + for (i = 0 ; i < CCOLAMD_STATS ; i++) + { + out_stats [i] = stats [i] ; + } + + /* fix stats (5) and (6), for 1-based information on jumbled matrix. */ + /* note that this correction doesn't occur if symamd returns FALSE */ + out_stats [CCOLAMD_INFO1] ++ ; + out_stats [CCOLAMD_INFO2] ++ ; + } +} diff --git a/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamdtestmex.c b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamdtestmex.c new file mode 100644 index 000000000..b5b04da73 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamdtestmex.c @@ -0,0 +1,533 @@ +/* ========================================================================== */ +/* === ccolamdtest mexFunction ============================================== */ +/* ========================================================================== */ + +/* ---------------------------------------------------------------------------- + * CCOLAMD Copyright (C), Univ. of Florida. Authors: Timothy A. Davis, + * Sivasankaran Rajamanickam, and Stefan Larimore + * See License.txt for the Version 2.1 of the GNU Lesser General Public License + * http://www.cise.ufl.edu/research/sparse + * -------------------------------------------------------------------------- */ + +/* + * This MATLAB mexFunction is for testing only. It is not meant for + * production use. See ccolamdmex.c and ccolamd.m instead. + * + * Usage: + * + * [ P, stats ] = ccolamdtest (A, knobs) ; + * + * The stats vector is optional. knobs is required: + * + * knobs (1) order for LU if nonzero, Cholesky otherwise. default 0 + * knobs (2) spumoni, default 0. + * knobs (3) dense row control. default 10 + * knobs (4) dense column control. default 10 + * knobs (5) aggresive absorption if nonzero. default: 1 + * + * knobs (6) for testing only. Controls the workspace used. + * knobs (7) for testing only. Controls how the input matrix is + * jumbled prior to calling colamd, to test its error + * handling capability. + * + * see ccolamd.c for a description of the stats array. + * + */ + +/* ========================================================================== */ +/* === Include files ======================================================== */ +/* ========================================================================== */ + +#include "ccolamd.h" +#include "mex.h" +#include "matrix.h" +#include +#include +#include "UFconfig.h" + +/* Here only for testing */ +#undef MIN +#undef MAX +#define MIN(a,b) (((a) < (b)) ? (a) : (b)) +#define MAX(a,b) (((a) > (b)) ? (a) : (b)) +#define CCOLAMD_MIN_MEMORY(nnz,n_row,n_col) \ + (MAX (2 * nnz, 4 * n_col) + \ + 8*n_col + 6*n_row + n_col + (nnz / 5) \ + + ((3 * n_col) + 1) + 5 * (n_col + 1) + n_row) + +/* ========================================================================== */ +/* === dump_matrix ========================================================== */ +/* ========================================================================== */ + +static void dump_matrix +( + UF_long A [ ], + UF_long p [ ], + UF_long n_row, + UF_long n_col, + UF_long Alen, + UF_long limit +) +{ + UF_long col, k, row ; + + mexPrintf ("dump matrix: nrow %d ncol %d Alen %d\n", n_row, n_col, Alen) ; + + for (col = 0 ; col < MIN (n_col, limit) ; col++) + { + mexPrintf ("column %d, p[col] %d, p [col+1] %d, length %d\n", + col, p [col], p [col+1], p [col+1] - p [col]) ; + for (k = p [col] ; k < p [col+1] ; k++) + { + row = A [k] ; + mexPrintf (" %d", row) ; + } + mexPrintf ("\n") ; + } +} + +/* ========================================================================== */ +/* === ccolamd mexFunction ================================================== */ +/* ========================================================================== */ + +void mexFunction +( + /* === Parameters ======================================================= */ + + int nargout, /* number of left-hand sides */ + mxArray *pargout [ ], /* left-hand side matrices */ + int nargin, /* number of right--hand sides */ + const mxArray *pargin [ ] /* right-hand side matrices */ +) +{ + /* === Local variables ================================================== */ + + UF_long *A ; /* ccolamd's copy of the matrix and workspace */ + UF_long *p ; /* ccolamd's copy of the column pointers */ + UF_long Alen ; /* size of A */ + UF_long n_col ; /* number of columns of A */ + UF_long n_row ; /* number of rows of A */ + UF_long nnz ; /* number of entries in A */ + UF_long full ; /* TRUE if input matrix full, FALSE if sparse */ + double knobs [CCOLAMD_KNOBS] ; /* ccolamd user-controllable parameters */ + double *out_perm ; /* output permutation vector */ + double *out_stats ; /* output stats vector */ + double *in_knobs ; /* input knobs vector */ + UF_long i ; /* loop counter */ + mxArray *Ainput ; /* input matrix handle */ + UF_long spumoni ; /* verbosity variable */ + UF_long stats2 [CCOLAMD_STATS] ; /* stats for ccolamd */ + + UF_long *cp, *cp_end, result, col, length, ok ; + UF_long *stats ; + stats = stats2 ; + + /* === Check inputs ===================================================== */ + + if (nargin != 3 || nargout < 0 || nargout > 2) + { + mexErrMsgTxt ( + "ccolamdtest: incorrect number of input and/or output arguments") ; + } + /* for testing we require all 7 knobs */ + if (mxGetNumberOfElements (pargin [1]) != 7) + { + mexErrMsgTxt ("ccolamdtest: must have all 7 knobs for testing") ; + } + + /* === Get knobs ======================================================== */ + + ccolamd_l_set_defaults (knobs) ; + spumoni = 0 ; + + in_knobs = mxGetPr (pargin [1]) ; + knobs [CCOLAMD_LU] = (in_knobs [0] != 0) ; + knobs [CCOLAMD_DENSE_ROW] = in_knobs [1] ; + knobs [CCOLAMD_DENSE_COL] = in_knobs [2] ; + knobs [CCOLAMD_AGGRESSIVE] = (in_knobs [3] != 0) ; + spumoni = (in_knobs [4] != 0) ; + + /* print knob settings if spumoni is set */ + if (spumoni) + { + mexPrintf ("\nccolamd version %d.%d, %s:\nknobs(1): %g, order for %s\n", + CCOLAMD_MAIN_VERSION, CCOLAMD_SUB_VERSION, CCOLAMD_DATE, + in_knobs [0], + (knobs [CCOLAMD_LU] != 0) ? "lu(A)" : "chol(A'*A)") ; + if (knobs [CCOLAMD_DENSE_ROW] >= 0) + { + mexPrintf ("knobs(2): %g, rows with > max(16,%g*sqrt(size(A,2)))" + " entries removed\n", in_knobs [1], knobs [CCOLAMD_DENSE_ROW]) ; + } + else + { + mexPrintf ("knobs(2): %g, no dense rows removed\n", in_knobs [1]) ; + } + if (knobs [CCOLAMD_DENSE_COL] >= 0) + { + mexPrintf ("knobs(3): %g, cols with > max(16,%g*sqrt(min(size(A)))" + " entries removed\n", in_knobs [2], knobs [CCOLAMD_DENSE_COL]) ; + } + else + { + mexPrintf ("knobs(3): no dense columns removed\n", in_knobs [2]) ; + } + mexPrintf ("knobs(4): %g, aggressive absorption: %s\n", + in_knobs [3], (knobs [CCOLAMD_AGGRESSIVE] != 0) ? "yes" : "no") ; + mexPrintf ("knobs(5): %g, statistics and knobs printed\n", + in_knobs [4]) ; + mexPrintf ("Testing: %g %g\n", in_knobs [5], in_knobs[6]) ; + } + + /* === If A is full, convert to a sparse matrix ========================= */ + + Ainput = (mxArray *) pargin [0] ; + if (mxGetNumberOfDimensions (Ainput) != 2) + { + mexErrMsgTxt ("ccolamd: input matrix must be 2-dimensional") ; + } + full = !mxIsSparse (Ainput) ; + if (full) + { + mexCallMATLAB (1, &Ainput, 1, (mxArray **) pargin, "sparse") ; + } + + /* === Allocate workspace for ccolamd =================================== */ + + /* get size of matrix */ + n_row = mxGetM (Ainput) ; + n_col = mxGetN (Ainput) ; + + /* get column pointer vector so we can find nnz */ + p = (UF_long *) mxCalloc (n_col+1, sizeof (UF_long)) ; + (void) memcpy (p, mxGetJc (Ainput), (n_col+1)*sizeof (UF_long)) ; + nnz = p [n_col] ; + Alen = (UF_long) ccolamd_l_recommended (nnz, n_row, n_col) ; + if (Alen == 0) + { + mexErrMsgTxt ("ccolamd: problem too large") ; + } + + /* === Modify size of Alen if testing =================================== */ + /* + knobs [5] amount of workspace given to colamd. + < 0 : TIGHT memory + > 0 : MIN + knob [3] - 1 + == 0 : RECOMMENDED memory + */ + + /* get knob [5], if negative */ + if (in_knobs [5] < 0) + { + Alen = CCOLAMD_MIN_MEMORY (nnz, n_row, n_col) + n_col ; + } + else if (in_knobs [5] > 0) + { + Alen = CCOLAMD_MIN_MEMORY (nnz, n_row, n_col) + in_knobs [5] - 1 ; + } + + /* otherwise, we use the recommended amount set above */ + + /* === Copy input matrix into workspace ================================= */ + + A = (UF_long *) mxCalloc (Alen, sizeof (UF_long)) ; + (void) memcpy (A, mxGetIr (Ainput), nnz*sizeof (UF_long)) ; + + if (full) + { + mxDestroyArray (Ainput) ; + } + + + /* === Jumble matrix ==================================================== */ + + /* + knobs [6] FOR TESTING ONLY: Specifies how to jumble matrix + 0 : No jumbling + 1 : Make n_row less than zero + 2 : Make first pointer non-zero + 3 : Make column pointers not non-decreasing + 4 : Make a column pointer greater or equal to Alen + 5 : Make row indices not strictly increasing + 6 : Make a row index greater or equal to n_row + 7 : Set A = NULL + 8 : Set p = NULL + 9 : Repeat row index + 10: make row indices not sorted + 11: jumble columns massively (note this changes + the pattern of the matrix A.) + 12: Set stats = NULL + 13: Make n_col less than zero + */ + + /* jumble appropriately */ + switch ((UF_long) in_knobs [6]) + { + + case 0 : + if (spumoni) + { + mexPrintf ("ccolamdtest: no errors expected\n") ; + } + result = 1 ; /* no errors */ + break ; + + case 1 : + if (spumoni) + { + mexPrintf ("ccolamdtest: nrow out of range\n") ; + } + result = 0 ; /* nrow out of range */ + n_row = -1 ; + break ; + + case 2 : + if (spumoni) + { + mexPrintf ("ccolamdtest: p [0] nonzero\n") ; + } + result = 0 ; /* p [0] must be zero */ + p [0] = 1 ; + break ; + + case 3 : + if (spumoni) + { + mexPrintf ("colamdtest: negative length last column\n") ; + } + result = (n_col == 0) ; /* p must be monotonically inc. */ + p [n_col] = p [0] ; + break ; + + case 4 : + if (spumoni) + { + mexPrintf ("colamdtest: Alen too small\n") ; + } + result = 0 ; /* out of memory */ + p [n_col] = Alen ; + break ; + + case 5 : + if (spumoni) + { + mexPrintf ("colamdtest: row index out of range (-1)\n") ; + } + if (nnz > 0) /* row index out of range */ + { + result = 0 ; + A [nnz-1] = -1 ; + } + else + { + if (spumoni) + { + mexPrintf ("Note: no row indices to put out of range\n") ; + } + result = 1 ; + } + break ; + + case 6 : + if (spumoni) + { + mexPrintf ("ccolamdtest: row index out of range (n_row)\n") ; + } + if (nnz > 0) /* row index out of range */ + { + if (spumoni) + { + mexPrintf ("Changing A[nnz-1] from %d to %d\n", + A [nnz-1], n_row) ; + } + result = 0 ; + A [nnz-1] = n_row ; + } + else + { + if (spumoni) + { + mexPrintf ("Note: no row indices to put out of range\n") ; + } + result = 1 ; + } + break ; + + case 7 : + if (spumoni) + { + mexPrintf ("ccolamdtest: A not present\n") ; + } + result = 0 ; /* A not present */ + A = (UF_long *) NULL ; + break ; + + case 8 : + if (spumoni) + { + mexPrintf ("ccolamdtest: p not present\n") ; + } + result = 0 ; /* p not present */ + p = (UF_long *) NULL ; + break ; + + case 9 : + if (spumoni) + { + mexPrintf ("ccolamdtest: duplicate row index\n") ; + } + result = 1 ; /* duplicate row index */ + + for (col = 0 ; col < n_col ; col++) + { + length = p [col+1] - p [col] ; + if (length > 1) + { + A [p [col]] = A [p [col] + 1] ; + if (spumoni) + { + mexPrintf ("Made duplicate row %d in col %d\n", + A [p [col] + 1], col) ; + } + break ; + } + } + + if (spumoni > 1) + { + dump_matrix (A, p, n_row, n_col, Alen, col+2) ; + } + break ; + + case 10 : + if (spumoni) + { + mexPrintf ("ccolamdtest: unsorted column\n") ; + } + result = 1 ; /* jumbled columns */ + + for (col = 0 ; col < n_col ; col++) + { + length = p [col+1] - p [col] ; + if (length > 1) + { + i = A[p [col]] ; + A [p [col]] = A[p [col] + 1] ; + A [p [col] + 1] = i ; + if (spumoni) + { + mexPrintf ("Unsorted column %d \n", col) ; + } + break ; + } + } + + if (spumoni > 1) + { + dump_matrix (A, p, n_row, n_col, Alen, col+2) ; + } + break ; + + case 11 : + if (spumoni) + { + mexPrintf ("ccolamdtest: massive jumbling\n") ; + } + result = 1 ; /* massive jumbling, but no errors */ + srand (1) ; + for (i = 0 ; i < n_col ; i++) + { + cp = &A [p [i]] ; + cp_end = &A [p [i+1]] ; + while (cp < cp_end) + { + *cp++ = rand() % n_row ; + } + } + if (spumoni > 1) + { + dump_matrix (A, p, n_row, n_col, Alen, n_col) ; + } + break ; + + case 12 : + if (spumoni) + { + mexPrintf ("ccolamdtest: stats not present\n") ; + } + result = 0 ; /* stats not present */ + stats = (UF_long *) NULL ; + break ; + + case 13 : + if (spumoni) + { + mexPrintf ("ccolamdtest: ncol out of range\n") ; + } + result = 0 ; /* ncol out of range */ + n_col = -1 ; + break ; + + } + + + /* === Order the columns (destroys A) =================================== */ + + ok = ccolamd_l (n_row, n_col, Alen, A, p, knobs, stats, NULL) ; + if (spumoni) + { + ccolamd_l_report (stats) ; + } + + /* === Return the stats vector ========================================== */ + + if (nargout == 2) + { + pargout [1] = mxCreateDoubleMatrix (1, CCOLAMD_STATS, mxREAL) ; + out_stats = mxGetPr (pargout [1]) ; + for (i = 0 ; i < CCOLAMD_STATS ; i++) + { + out_stats [i] = (stats == NULL) ? (-1) : (stats [i]) ; + } + /* fix stats (5) and (6), for 1-based information on jumbled matrix. */ + /* note that this correction doesn't occur if csymamd returns FALSE */ + out_stats [CCOLAMD_INFO1] ++ ; + out_stats [CCOLAMD_INFO2] ++ ; + } + + mxFree (A) ; + + if (ok) + { + + /* === Return the permutation vector ================================ */ + + pargout [0] = mxCreateDoubleMatrix (1, n_col, mxREAL) ; + out_perm = mxGetPr (pargout [0]) ; + for (i = 0 ; i < n_col ; i++) + { + /* ccolamd is 0-based, but MATLAB expects this to be 1-based */ + out_perm [i] = p [i] + 1 ; + } + if (!result) + { + ccolamd_l_report (stats) ; + mexErrMsgTxt ("ccolamd should have returned TRUE\n") ; + } + } + else + { + + /* return p = -1 if ccolamd failed */ + pargout [0] = mxCreateDoubleMatrix (1, 1, mxREAL) ; + out_perm = mxGetPr (pargout [0]) ; + out_perm [0] = -1 ; + if (result) + { + ccolamd_l_report (stats) ; + mexErrMsgTxt ("ccolamd should have returned FALSE\n") ; + } + } + + mxFree (p) ; +} diff --git a/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamdtestmex.m b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamdtestmex.m new file mode 100644 index 000000000..9a563871f --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/MATLAB/ccolamdtestmex.m @@ -0,0 +1,10 @@ +function [P, stats] = ccolamdtestmex (A, knobs) %#ok +% CCOLAMDTESTMEX test function for ccolamd +% Example: +% [ P, stats ] = ccolamdtest (A, knobs) ; +% See also ccolamd + +% Copyright 1998-2007, Timothy A. Davis, Stefan Larimore, and Siva Rajamanickam +% Developed in collaboration with J. Gilbert and E. Ng. + +error ('ccolamdtestmex mexFunction not found') ; diff --git a/gtsam/3rdparty/CCOLAMD/MATLAB/csymamd.m b/gtsam/3rdparty/CCOLAMD/MATLAB/csymamd.m new file mode 100644 index 000000000..901040df6 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/MATLAB/csymamd.m @@ -0,0 +1,48 @@ +function [p, stats] = csymamd (S, knobs, cmember) %#ok +%CSYMAMD constrained symmetric approximate minimum degree permutation +% P = CSYMAMD(S) for a symmetric positive definite matrix S, returns the +% permutation vector p such that S(p,p) tends to have a sparser Cholesky +% factor than S. Sometimes CSYMAMD works well for symmetric indefinite +% matrices too. The matrix S is assumed to be symmetric; only the +% strictly lower triangular part is referenced. S must be square. Note +% that p=amd(S) is faster, but does not allow for a constrained ordering. +% The ordering is followed by an elimination tree post-ordering. +% +% See also AMD, CCOLAMD, COLAMD, SYMAMD. +% +% Example: +% p = csymamd (S) +% p = csymamd (S,knobs,cmember) +% +% knobs is an optional one- to three-element input vector, with a default +% value of [10 1 0] if present or empty ([ ]). Entries not present are set +% to their defaults. +% +% knobs(1): If S is n-by-n, then rows and columns with more than +% max(16,knobs(1)*sqrt(n)) entries are ignored, and ordered last in the +% output permutation (subject to the cmember constraints). +% knobs(2): if nonzero, aggressive absorption is performed. +% knobs(3): if nonzero, statistics and knobs are printed. +% +% cmember is an optional vector of length n. It defines the constraints on +% the ordering. If cmember(j)=s, then row/column j is in constraint set s +% (s must be in the range 1 to n). In the output permutation p, +% rows/columns in set 1 appear first, followed by all rows/columns in set 2, +% and so on. cmember=ones(1,n) if not present or empty. csymamd(S,[],1:n) +% returns 1:n. +% +% p = csymamd(S) is about the same as p = symamd(S). knobs and its default +% values differ. +% +% Authors: S. Larimore, T. Davis (Univ of Florida), and S. Rajamanickam, in +% collaboration with J. Gilbert and E. Ng. Supported by the National +% Science Foundation (DMS-9504974, DMS-9803599, CCR-0203270), and a grant +% from Sandia National Lab. See http://www.cise.ufl.edu/research/sparse +% for ccolamd, csymamd, amd, colamd, symamd, and other related orderings. +% +% See also AMD, CCOLAMD, COLAMD, SYMAMD, SYMRCM. + +% Copyright 1998-2007, Timothy A. Davis, Stefan Larimore, and Siva Rajamanickam +% Developed in collaboration with J. Gilbert and E. Ng. + +error ('csymamd: mexFunction not found') ; diff --git a/gtsam/3rdparty/CCOLAMD/MATLAB/csymamdmex.c b/gtsam/3rdparty/CCOLAMD/MATLAB/csymamdmex.c new file mode 100644 index 000000000..e52d92619 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/MATLAB/csymamdmex.c @@ -0,0 +1,208 @@ +/* ========================================================================== */ +/* === csymamd mexFunction ================================================== */ +/* ========================================================================== */ + +/* ---------------------------------------------------------------------------- + * CCOLAMD, Copyright (C), Univ. of Florida. Authors: Timothy A. Davis, + * Sivasankaran Rajamanickam, and Stefan Larimore + * See License.txt for the Version 2.1 of the GNU Lesser General Public License + * http://www.cise.ufl.edu/research/sparse + * -------------------------------------------------------------------------- */ + +/* + * Usage: + * p = csymamd (A) ; + * [p stats] = csymamd (A, knobs, cmember) ; + * + * See csymamd.m for a description. + */ + +/* ========================================================================== */ +/* === Include files ======================================================== */ +/* ========================================================================== */ + +#include "ccolamd.h" +#include "mex.h" +#include "matrix.h" +#include +#include "UFconfig.h" + +/* ========================================================================== */ +/* === csymamd mexFunction ================================================== */ +/* ========================================================================== */ + +void mexFunction +( + /* === Parameters ======================================================= */ + + int nargout, + mxArray *pargout [ ], + int nargin, + const mxArray *pargin [ ] +) +{ + /* === Local variables ================================================== */ + + UF_long *A ; /* row indices of input matrix A */ + UF_long *perm ; /* column ordering of M and ordering of A */ + UF_long *cmember ; /* csymamd's copy of the constraint set */ + double *in_cmember ; /* input constraint set */ + UF_long *p ; /* column pointers of input matrix A */ + UF_long cslen ; /* size of constraint set */ + UF_long n_col ; /* number of columns of A */ + UF_long n_row ; /* number of rows of A */ + UF_long full ; /* TRUE if input matrix full, FALSE if sparse */ + double knobs [CCOLAMD_KNOBS] ; /* csymamd user-controllable parameters */ + double *out_perm ; /* output permutation vector */ + double *out_stats ; /* output stats vector */ + double *in_knobs ; /* input knobs vector */ + UF_long i ; /* loop counter */ + mxArray *Ainput ; /* input matrix handle */ + UF_long spumoni ; /* verbosity variable */ + UF_long stats [CCOLAMD_STATS] ; /* stats for symamd */ + + /* === Check inputs ===================================================== */ + + if (nargin < 1 || nargin > 3 || nargout < 0 || nargout > 2) + { + mexErrMsgTxt ("Usage: [p stats] = csymamd (S, knobs, cmember)") ; + } + + /* === Get cmember ====================================================== */ + + cmember = NULL ; + cslen = 0 ; + if (nargin > 2) + { + in_cmember = mxGetPr (pargin [2]) ; + cslen = mxGetNumberOfElements (pargin [2]) ; + if (cslen != 0) + { + cmember = (UF_long *) mxCalloc (cslen, sizeof (UF_long)) ; + for (i = 0 ; i < cslen ; i++) + { + /* convert cmember from 1-based to 0-based */ + cmember[i] = ((UF_long) in_cmember [i] - 1) ; + } + } + } + + /* === Get knobs ======================================================== */ + + ccolamd_l_set_defaults (knobs) ; + spumoni = 0 ; + + /* check for user-passed knobs */ + i = 0 ; + if (nargin > 1) + { + in_knobs = mxGetPr (pargin [1]) ; + i = mxGetNumberOfElements (pargin [1]) ; + if (i > 0) knobs [CCOLAMD_DENSE_ROW] = in_knobs [0] ; + if (i > 1) knobs [CCOLAMD_AGGRESSIVE] = in_knobs [1] ; + if (i > 2) spumoni = (in_knobs [2] != 0) ; + } + + /* print knob settings if spumoni is set */ + if (spumoni) + { + mexPrintf ("\ncsymamd version %d.%d, %s:\n", + CCOLAMD_MAIN_VERSION, CCOLAMD_SUB_VERSION, CCOLAMD_DATE) ; + if (knobs [CCOLAMD_DENSE_ROW] >= 0) + { + mexPrintf ("knobs(1): %g, rows/cols with > " + "max(16,%g*sqrt(size(A,2))) entries removed\n", + in_knobs [0], knobs [CCOLAMD_DENSE_ROW]) ; + } + else + { + mexPrintf ("knobs(1): %g, no dense rows removed\n", + in_knobs [0]) ; + } + mexPrintf ("knobs(2): %g, aggressive absorption: %s\n", + in_knobs [1], (knobs [CCOLAMD_AGGRESSIVE] != 0) ? "yes" : "no") ; + mexPrintf ("knobs(3): %g, statistics and knobs printed\n", + in_knobs [2]) ; + } + + /* === If A is full, convert to a sparse matrix ========================= */ + + Ainput = (mxArray *) pargin [0] ; + if (mxGetNumberOfDimensions (Ainput) != 2) + { + mexErrMsgTxt ("csymamd: input matrix must be 2-dimensional.") ; + } + full = !mxIsSparse (Ainput) ; + if (full) + { + mexCallMATLAB (1, &Ainput, 1, (mxArray **) pargin, "sparse") ; + } + + /* === Allocate workspace for csymamd =================================== */ + + /* get size of matrix */ + n_row = mxGetM (Ainput) ; + n_col = mxGetN (Ainput) ; + if (n_col != n_row) + { + mexErrMsgTxt ("csymamd: matrix must be square.") ; + } + + if (cmember != NULL && cslen != n_col) + { + mexErrMsgTxt ("csymamd: cmember must be of length equal to #cols of A"); + } + + A = (UF_long *) mxGetIr (Ainput) ; + p = (UF_long *) mxGetJc (Ainput) ; + perm = (UF_long *) mxCalloc (n_col+1, sizeof (UF_long)) ; + + /* === Order the rows and columns of A (does not destroy A) ============= */ + + if (!csymamd_l (n_col, A, p, perm, knobs, stats, &mxCalloc, &mxFree, + cmember, -1)) + { + csymamd_l_report (stats) ; + mexErrMsgTxt ("csymamd error!") ; + } + + if (full) + { + mxDestroyArray (Ainput) ; + } + + /* === Return the permutation vector ==================================== */ + + pargout [0] = mxCreateDoubleMatrix (1, n_col, mxREAL) ; + out_perm = mxGetPr (pargout [0]) ; + for (i = 0 ; i < n_col ; i++) + { + /* symamd is 0-based, but MATLAB expects this to be 1-based */ + out_perm [i] = perm [i] + 1 ; + } + mxFree (perm) ; + mxFree (cmember) ; + + /* === Return the stats vector ========================================== */ + + /* print stats if spumoni is set */ + if (spumoni) + { + csymamd_l_report (stats) ; + } + + if (nargout == 2) + { + pargout [1] = mxCreateDoubleMatrix (1, CCOLAMD_STATS, mxREAL) ; + out_stats = mxGetPr (pargout [1]) ; + for (i = 0 ; i < CCOLAMD_STATS ; i++) + { + out_stats [i] = stats [i] ; + } + + /* fix stats (5) and (6), for 1-based information on jumbled matrix. */ + /* note that this correction doesn't occur if symamd returns FALSE */ + out_stats [CCOLAMD_INFO1] ++ ; + out_stats [CCOLAMD_INFO2] ++ ; + } +} diff --git a/gtsam/3rdparty/CCOLAMD/MATLAB/csymamdtestmex.c b/gtsam/3rdparty/CCOLAMD/MATLAB/csymamdtestmex.c new file mode 100644 index 000000000..428b41185 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/MATLAB/csymamdtestmex.c @@ -0,0 +1,502 @@ +/* ========================================================================== */ +/* === csymamdtest mexFunction ============================================== */ +/* ========================================================================== */ + +/* ---------------------------------------------------------------------------- + * CCOLAMD Copyright (C), Univ. of Florida. Authors: Timothy A. Davis, + * Sivasankaran Rajamanickam, and Stefan Larimore + * See License.txt for the Version 2.1 of the GNU Lesser General Public License + * http://www.cise.ufl.edu/research/sparse + * -------------------------------------------------------------------------- */ + +/* + * This MATLAB mexFunction is for testing only. It is not meant for + * production use. See csymamdmex.c and csymamd.m instead. + * + * Usage: + * + * [ P, stats ] = csymamdtest (A, knobs, cmember) ; + * + * The knobs and stats vectors are optional: + * + * knobs (1) dense row/col control. default 10 + * knobs (2) spumoni, default 0. + * knobs (3) aggresive absorption if nonzero. default 1 + * + * knobs (4) for testing only. Controls how the input matrix is + * jumbled prior to calling colamd, to test its error + * handling capability. + */ + +/* ========================================================================== */ +/* === Include files ======================================================== */ +/* ========================================================================== */ + +#include "ccolamd.h" +#include "mex.h" +#include "matrix.h" +#include +#include +#include "UFconfig.h" + +#ifdef MIN +#undef MIN +#endif +#define MIN(a,b) (((a) < (b)) ? (a) : (b)) + + +static void dump_matrix +( + UF_long A [ ], + UF_long p [ ], + UF_long n_row, + UF_long n_col, + UF_long Alen, + UF_long limit +) +{ + UF_long col, k, row ; + + mexPrintf ("dump matrix: nrow %d ncol %d Alen %d\n", n_row, n_col, Alen) ; + + if (!A) + { + mexPrintf ("A not present\n") ; + return ; + } + + if (!p) + { + mexPrintf ("p not present\n") ; + return ; + } + + for (col = 0 ; col < MIN (n_col, limit) ; col++) + { + mexPrintf ("column %d, p[col] %d, p [col+1] %d, length %d\n", + col, p [col], p [col+1], p [col+1] - p [col]) ; + for (k = p [col] ; k < p [col+1] ; k++) + { + row = A [k] ; + mexPrintf (" %d", row) ; + } + mexPrintf ("\n") ; + } +} + +/* ========================================================================== */ +/* === csymamd mexFunction ================================================== */ +/* ========================================================================== */ + +void mexFunction +( + /* === Parameters ======================================================= */ + + int nargout, /* number of left-hand sides */ + mxArray *pargout [ ], /* left-hand side matrices */ + int nargin, /* number of right--hand sides */ + const mxArray *pargin [ ] /* right-hand side matrices */ +) +{ + /* === Local variables ================================================== */ + + UF_long *perm ; /* column ordering of M and ordering of A */ + UF_long *A ; /* row indices of input matrix A */ + UF_long *p ; /* column pointers of input matrix A */ + UF_long n_col ; /* number of columns of A */ + UF_long n_row ; /* number of rows of A */ + UF_long full ; /* TRUE if input matrix full, FALSE if sparse */ + double knobs [CCOLAMD_KNOBS] ; /* ccolamd user-controllable parameters */ + double *out_perm ; /* output permutation vector */ + double *out_stats ; /* output stats vector */ + double *in_knobs ; /* input knobs vector */ + UF_long i ; /* loop counter */ + mxArray *Ainput ; /* input matrix handle */ + UF_long spumoni ; /* verbosity variable */ + UF_long stats2 [CCOLAMD_STATS] ;/* stats for csymamd */ + + UF_long *cp, *cp_end, result, nnz, col, length, ok ; + UF_long *stats ; + stats = stats2 ; + + /* === Check inputs ===================================================== */ + + if (nargin != 3 || nargout > 2) + { + mexErrMsgTxt ( + "csymamdtest: incorrect number of input and/or output arguments.") ; + } + /* for testing we require all 4 knobs */ + if (mxGetNumberOfElements (pargin [1]) != 4) + { + mexErrMsgTxt ("csymamdtest: must have 4 knobs for testing") ; + } + + /* === Get knobs ======================================================== */ + + ccolamd_l_set_defaults (knobs) ; + spumoni = 0 ; + + in_knobs = mxGetPr (pargin [1]) ; + + i = mxGetNumberOfElements (pargin [1]) ; + knobs [CCOLAMD_DENSE_ROW] = in_knobs [0] ; + knobs [CCOLAMD_DENSE_COL] = in_knobs [0] ; + knobs [CCOLAMD_AGGRESSIVE] = (in_knobs [1] != 0) ; + spumoni = (in_knobs [2] != 0) ; + + /* print knob settings if spumoni is set */ + if (spumoni) + { + mexPrintf ("\ncsymamd version %d.%d, %s:\n", + CCOLAMD_MAIN_VERSION, CCOLAMD_SUB_VERSION, CCOLAMD_DATE) ; + if (knobs [CCOLAMD_DENSE_ROW] >= 0) + { + mexPrintf ("knobs(1): %g, rows/cols with > " + "max(16,%g*sqrt(size(A,2))) entries removed\n", + in_knobs [0], knobs [CCOLAMD_DENSE_ROW]) ; + } + else + { + mexPrintf ("knobs(1): %g, no dense rows removed\n", + in_knobs [0]) ; + } + mexPrintf ("knobs(2): %g, aggressive absorption: %s\n", + in_knobs [1], (knobs [CCOLAMD_AGGRESSIVE] != 0) ? "yes" : "no") ; + mexPrintf ("knobs(3): %g, statistics and knobs printed\n", + in_knobs [2]) ; + mexPrintf ("Testing: %g\n", in_knobs [3]) ; + } + + /* === If A is full, convert to a sparse matrix ========================= */ + + Ainput = (mxArray *) pargin [0] ; + if (mxGetNumberOfDimensions (Ainput) != 2) + { + mexErrMsgTxt ("csymamd: input matrix must be 2-dimensional.") ; + } + full = !mxIsSparse (Ainput) ; + if (full) + { + mexCallMATLAB (1, &Ainput, 1, (mxArray **) pargin, "sparse") ; + } + + /* === Allocate workspace for csymamd =================================== */ + + /* get size of matrix */ + n_row = mxGetM (Ainput) ; + n_col = mxGetN (Ainput) ; + if (n_col != n_row) + { + mexErrMsgTxt ("csymamd: matrix must be square.") ; + } + + /* p = mxGetJc (Ainput) ; */ + p = (UF_long *) mxCalloc (n_col+1, sizeof (UF_long)) ; + (void) memcpy (p, mxGetJc (Ainput), (n_col+1)*sizeof (UF_long)) ; + + nnz = p [n_col] ; + if (spumoni) + { + mexPrintf ("csymamdtest: nnz %d\n", nnz) ; + } + + /* A = mxGetIr (Ainput) ; */ + A = (UF_long *) mxCalloc (nnz+1, sizeof (UF_long)) ; + (void) memcpy (A, mxGetIr (Ainput), nnz*sizeof (UF_long)) ; + + perm = (UF_long *) mxCalloc (n_col+1, sizeof (UF_long)) ; + + /* === Jumble matrix ==================================================== */ + + + /* + knobs [4] FOR TESTING ONLY: Specifies how to jumble matrix + 0 : No jumbling + 1 : (no errors) + 2 : Make first pointer non-zero + 3 : Make column pointers not non-decreasing + 4 : (no errors) + 5 : Make row indices not strictly increasing + 6 : Make a row index greater or equal to n_row + 7 : Set A = NULL + 8 : Set p = NULL + 9 : Repeat row index + 10: make row indices not sorted + 11: jumble columns massively (note this changes + the pattern of the matrix A.) + 12: Set stats = NULL + 13: Make n_col less than zero + */ + + /* jumble appropriately */ + switch ((UF_long) in_knobs [3]) + { + + case 0 : + if (spumoni) + { + mexPrintf ("csymamdtest: no errors expected\n") ; + } + result = 1 ; /* no errors */ + break ; + + case 1 : + if (spumoni) + { + mexPrintf ("csymamdtest: no errors expected (1)\n") ; + } + result = 1 ; + break ; + + case 2 : + if (spumoni) + { + mexPrintf ("csymamdtest: p [0] nonzero\n") ; + } + result = 0 ; /* p [0] must be zero */ + p [0] = 1 ; + break ; + + case 3 : + if (spumoni) + { + mexPrintf ("csymamdtest: negative length last column\n") ; + } + result = (n_col == 0) ; /* p must be monotonically inc. */ + p [n_col] = p [0] ; + break ; + + case 4 : + if (spumoni) + { + mexPrintf ("csymamdtest: no errors expected (4)\n") ; + } + result = 1 ; + break ; + + case 5 : + if (spumoni) + { + mexPrintf ("csymamdtest: row index out of range (-1)\n") ; + } + if (nnz > 0) /* row index out of range */ + { + result = 0 ; + A [nnz-1] = -1 ; + } + else + { + if (spumoni) + { + mexPrintf ("Note: no row indices to put out of range\n") ; + } + result = 1 ; + } + break ; + + case 6 : + if (spumoni) + { + mexPrintf ("csymamdtest: row index out of range (ncol)\n") ; + } + if (nnz > 0) /* row index out of range */ + { + result = 0 ; + A [nnz-1] = n_col ; + } + else + { + if (spumoni) + { + mexPrintf ("Note: no row indices to put out of range\n") ; + } + result = 1 ; + } + break ; + + case 7 : + if (spumoni) + { + mexPrintf ("csymamdtest: A not present\n") ; + } + result = 0 ; /* A not present */ + A = (UF_long *) NULL ; + break ; + + case 8 : + if (spumoni) + { + mexPrintf ("csymamdtest: p not present\n") ; + } + result = 0 ; /* p not present */ + p = (UF_long *) NULL ; + break ; + + case 9 : + if (spumoni) + { + mexPrintf ("csymamdtest: duplicate row index\n") ; + } + result = 1 ; /* duplicate row index */ + + for (col = 0 ; col < n_col ; col++) + { + length = p [col+1] - p [col] ; + if (length > 1) + { + A [p [col+1]-2] = A [p [col+1] - 1] ; + if (spumoni) + { + mexPrintf ("Made duplicate row %d in col %d\n", + A [p [col+1] - 1], col) ; + } + break ; + } + } + + if (spumoni > 1) + { + dump_matrix (A, p, n_row, n_col, nnz, col+2) ; + } + break ; + + case 10 : + if (spumoni) + { + mexPrintf ("csymamdtest: unsorted column\n") ; + } + result = 1 ; /* jumbled columns */ + + for (col = 0 ; col < n_col ; col++) + { + length = p [col+1] - p [col] ; + if (length > 1) + { + i = A[p [col]] ; + A [p [col]] = A[p [col] + 1] ; + A [p [col] + 1] = i ; + if (spumoni) + { + mexPrintf ("Unsorted column %d \n", col) ; + } + break ; + } + } + + if (spumoni > 1) + { + dump_matrix (A, p, n_row, n_col, nnz, col+2) ; + } + break ; + + case 11 : + if (spumoni) + { + mexPrintf ("csymamdtest: massive jumbling\n") ; + } + result = 1 ; /* massive jumbling, but no errors */ + srand (1) ; + for (i = 0 ; i < n_col ; i++) + { + cp = &A [p [i]] ; + cp_end = &A [p [i+1]] ; + while (cp < cp_end) + { + *cp++ = rand() % n_row ; + } + } + if (spumoni > 1) + { + dump_matrix (A, p, n_row, n_col, nnz, n_col) ; + } + break ; + + case 12 : + if (spumoni) + { + mexPrintf ("csymamdtest: stats not present\n") ; + } + result = 0 ; /* stats not present */ + stats = (UF_long *) NULL ; + break ; + + case 13 : + if (spumoni) + { + mexPrintf ("csymamdtest: ncol out of range\n") ; + } + result = 0 ; /* ncol out of range */ + n_col = -1 ; + break ; + + } + + /* === Order the rows and columns of A (does not destroy A) ============= */ + + ok = csymamd_l (n_col, A, p, perm, knobs, stats, &mxCalloc, &mxFree, + NULL, -1) ; + + if (full) + { + mxDestroyArray (Ainput) ; + } + + if (spumoni) + { + csymamd_l_report (stats) ; + } + + /* === Return the stats vector ========================================== */ + + if (nargout == 2) + { + pargout [1] = mxCreateDoubleMatrix (1, CCOLAMD_STATS, mxREAL) ; + out_stats = mxGetPr (pargout [1]) ; + for (i = 0 ; i < CCOLAMD_STATS ; i++) + { + out_stats [i] = (stats == NULL) ? (-1) : (stats [i]) ; + } + /* fix stats (5) and (6), for 1-based information on jumbled matrix. */ + /* note that this correction doesn't occur if csymamd returns FALSE */ + out_stats [CCOLAMD_INFO1] ++ ; + out_stats [CCOLAMD_INFO2] ++ ; + } + + mxFree (A) ; + + if (ok) + { + + /* === Return the permutation vector ================================ */ + + pargout [0] = mxCreateDoubleMatrix (1, n_col, mxREAL) ; + out_perm = mxGetPr (pargout [0]) ; + for (i = 0 ; i < n_col ; i++) + { + /* csymamd is 0-based, but MATLAB expects this to be 1-based */ + out_perm [i] = perm [i] + 1 ; + } + if (!result) + { + csymamd_l_report (stats) ; + mexErrMsgTxt ("csymamd should have returned TRUE\n") ; + } + } + else + { + + /* return p = -1 if csymamd failed */ + pargout [0] = mxCreateDoubleMatrix (1, 1, mxREAL) ; + out_perm = mxGetPr (pargout [0]) ; + out_perm [0] = -1 ; + if (result) + { + csymamd_l_report (stats) ; + mexErrMsgTxt ("csymamd should have returned FALSE\n") ; + } + } + + mxFree (p) ; + mxFree (perm) ; +} diff --git a/gtsam/3rdparty/CCOLAMD/MATLAB/csymamdtestmex.m b/gtsam/3rdparty/CCOLAMD/MATLAB/csymamdtestmex.m new file mode 100644 index 000000000..4510e6ed7 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/MATLAB/csymamdtestmex.m @@ -0,0 +1,10 @@ +function [P, stats] = csymamdtestmex (A, knobs) %#ok +% CSYMAMDTESTMEX test function for csymamd +% Example: +% [ P, stats ] = csymamdtest (A, knobs) ; +% See also csymamd + +% Copyright 1998-2007, Timothy A. Davis, Stefan Larimore, and Siva Rajamanickam +% Developed in collaboration with J. Gilbert and E. Ng. + +error ('csymamdtestmex mexFunction not found') ; diff --git a/gtsam/3rdparty/CCOLAMD/MATLAB/luflops.m b/gtsam/3rdparty/CCOLAMD/MATLAB/luflops.m new file mode 100644 index 000000000..1ed7f30f6 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/MATLAB/luflops.m @@ -0,0 +1,33 @@ +function fl = luflops (L, U) +%LUFLOPS compute the flop count for sparse LU factorization +% +% Example: +% fl = luflops (L,U) +% +% Given a sparse LU factorization (L and U), return the flop count required +% by a conventional LU factorization algorithm to compute it. L and U can +% be either sparse or full matrices. L must be lower triangular and U must +% be upper triangular. Do not attempt to use this on the permuted L from +% [L,U] = lu (A). Instead, use [L,U,P] = lu (A) or [L,U,P,Q] = lu (A). +% +% Note that there is a subtle undercount in this estimate. Suppose A is +% completely dense, but during LU factorization exact cancellation occurs, +% causing some of the entries in L and U to become identically zero. The +% flop count returned by this routine is an undercount. There is a simple +% way to fix this (L = spones (L) + spones (tril (A))), but the fix is partial. +% It can also occur that some entry in L is a "symbolic" fill-in (zero in +% A, but a fill-in entry and thus must be computed), but numerically +% zero. The only way to get a reliable LU factorization would be to do a +% purely symbolic factorization of A. This cannot be done with +% symbfact (A, 'col'). +% +% See NA Digest, Vol 00, #50, Tuesday, Dec. 5, 2000 +% +% See also symbfact + +% Copyright 1998-2007, Timothy A. Davis + +Lnz = full (sum (spones (L))) - 1 ; % off diagonal nz in cols of L +Unz = full (sum (spones (U')))' - 1 ; % off diagonal nz in rows of U +fl = 2*Lnz*Unz + sum (Lnz) ; + diff --git a/gtsam/3rdparty/CCOLAMD/README.txt b/gtsam/3rdparty/CCOLAMD/README.txt new file mode 100644 index 000000000..ccc5a19a5 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/README.txt @@ -0,0 +1,150 @@ +CCOLAMD: constrained column approximate minimum degree ordering +Copyright (C) 2005-2011, Univ. of Florida. Authors: Timothy A. Davis, +Sivasankaran Rajamanickam, and Stefan Larimore. Closely based on COLAMD by +Davis, Stefan Larimore, in collaboration with Esmond Ng, and John Gilbert. +http://www.cise.ufl.edu/research/sparse +------------------------------------------------------------------------------- + +The CCOLAMD column approximate minimum degree ordering algorithm computes +a permutation vector P such that the LU factorization of A (:,P) +tends to be sparser than that of A. The Cholesky factorization of +(A (:,P))'*(A (:,P)) will also tend to be sparser than that of A'*A. +CSYMAMD is a symmetric minimum degree ordering method based on CCOLAMD, also +available as a MATLAB-callable function. It constructs a matrix M such +that M'*M has the same pattern as A, and then uses CCOLAMD to compute a column +ordering of M. + +Requires UFconfig, in the ../UFconfig directory relative to this directory. + +To compile and install the ccolamd m-files and mexFunctions, just cd to +CCOLAMD/MATLAB and type ccolamd_install in the MATLAB command window. +A short demo will run. Optionally, type ccolamd_test to run an extensive tests. +Type "make" in Unix in the CCOLAMD directory to compile the C-callable +library and to run a short demo. + +If you have MATLAB 7.2 or earlier, you must first edit UFconfig/UFconfig.h to +remove the "-largeArrayDims" option from the MEX command (or just use +ccolamd_install.m inside MATLAB). + +Other "make" targets: + + make mex compiles MATLAB mexFunctions only + make libccolamd.a compiles a C-callable library containing ccolamd + make clean removes all files not in the distribution, except for + libccolamd.a + make distclean removes all files not in the distribution + +To use ccolamd and csymamd within an application written in C, all you need are +ccolamd.c and ccolamd.h, which are the C-callable ccolamd/csymamd codes. +See ccolamd.c for more information on how to call ccolamd from a C program. +It contains a complete description of the C-interface to CCOLAMD and CSYMAMD. + + Copyright (c) 1998-2007 by the University of Florida. + All Rights Reserved. + + Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. + +------------------------------------------------------------------------------- + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +------------------------------------------------------------------------------- + + +Related papers: + + T. A. Davis and W. W. Hager, Rajamanickam, Multiple-rank updates + to a supernodal sparse Cholesky factorization, submitted. + + T. A. Davis, W. W. Hager, S. Rajamanickam, and Y. Chen, CHOLMOD: a + sparse Cholesky update/downdate package, submitted. CHOLMOD's + nested dissection ordering relies on CCOLAMD and CSYMAMD to order + the matrix after graph partitioning is used to find the ordering + constraints. + + T. A. Davis, J. R. Gilbert, S. Larimore, E. Ng, An approximate column + minimum degree ordering algorithm, ACM Transactions on Mathematical + Software, vol. 30, no. 3., pp. 353-376, 2004. + + T. A. Davis, J. R. Gilbert, S. Larimore, E. Ng, Algorithm 836: COLAMD, + an approximate column minimum degree ordering algorithm, ACM + Transactions on Mathematical Software, vol. 30, no. 3., pp. 377-380, + 2004. + + "An approximate minimum degree column ordering algorithm", + S. I. Larimore, MS Thesis, Dept. of Computer and Information + Science and Engineering, University of Florida, Gainesville, FL, + 1998. CISE Tech Report TR-98-016. Available at + ftp://ftp.cise.ufl.edu/cis/tech-reports/tr98/tr98-016.ps + via anonymous ftp. + + Approximate Deficiency for Ordering the Columns of a Matrix, + J. L. Kern, Senior Thesis, Dept. of Computer and Information + Science and Engineering, University of Florida, Gainesville, FL, + 1999. Available at http://www.cise.ufl.edu/~davis/Kern/kern.ps + +Authors: Timothy A. Davis, Sivasankaran Rajamanickam, and Stefan Larimore. + Closely based on COLAMD by Stefan I. Larimore and Timothy A. Davis, + University of Florida, in collaboration with John Gilbert, Xerox PARC + (now at UC Santa Barbara), and Esmong Ng, Lawrence Berkeley National + Laboratory (much of this work he did while at Oak Ridge National + Laboratory). + +CCOLAMD files: + + Demo simple demo + Doc additional documentation (see ccolamd.c for more) + Include include file + Lib compiled C-callable library + Makefile primary Unix Makefile + MATLAB MATLAB functions + README.txt this file + Source C source code + + ./Demo: + ccolamd_example.c simple example + ccolamd_example.out output of colamd_example.c + ccolamd_l_example.c simple example, long integers + ccolamd_l_example.out output of colamd_l_example.c + Makefile Makefile for C demos + + ./Doc: + ChangeLog change log + lesser.txt license + + ./Include: + ccolamd.h include file + + ./Lib: + Makefile Makefile for C-callable library + + ./MATLAB: + ccolamd.m MATLAB interface for ccolamd + ccolamd_demo.m simple demo + ccolamd_install.m compile and install ccolamd and csymamd + ccolamd_make.m compile colamd2 and symamd2 + ccolamdmex.c MATLAB mexFunction for ccolamd + ccolamd_test.m extensive test + ccolamdtestmex.c test function for ccolamd + Contents.m contents of the MATLAB directory + luflops.m test code + Makefile Makefile for MATLAB functions + csymamd.m MATLAB interface for csymamd + csymamdmex.c MATLAB mexFunction for csymamd + symamdtestmex.c test function for csymamd + + ./Source: + ccolamd.c primary source code + ccolamd_global.c globally defined function pointers (malloc, free, ...) diff --git a/gtsam/3rdparty/CCOLAMD/Source/ccolamd.c b/gtsam/3rdparty/CCOLAMD/Source/ccolamd.c new file mode 100644 index 000000000..36ffa1ada --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/Source/ccolamd.c @@ -0,0 +1,4620 @@ +/* ========================================================================== */ +/* === CCOLAMD/CSYMAMD - a constrained column ordering algorithm ============ */ +/* ========================================================================== */ + +/* ---------------------------------------------------------------------------- + * CCOLAMD, Copyright (C) Univ. of Florida. Authors: Timothy A. Davis, + * Sivasankaran Rajamanickam, and Stefan Larimore + * See License.txt for the Version 2.1 of the GNU Lesser General Public License + * http://www.cise.ufl.edu/research/sparse + * -------------------------------------------------------------------------- */ + +/* + * ccolamd: a constrained approximate minimum degree column ordering + * algorithm, LU factorization of symmetric or unsymmetric matrices, + * QR factorization, least squares, interior point methods for + * linear programming problems, and other related problems. + * + * csymamd: a constrained approximate minimum degree ordering algorithm for + * Cholesky factorization of symmetric matrices. + * + * Purpose: + * + * CCOLAMD computes a permutation Q such that the Cholesky factorization of + * (AQ)'(AQ) has less fill-in and requires fewer floating point operations + * than A'A. This also provides a good ordering for sparse partial + * pivoting methods, P(AQ) = LU, where Q is computed prior to numerical + * factorization, and P is computed during numerical factorization via + * conventional partial pivoting with row interchanges. CCOLAMD is an + * extension of COLAMD, available as built-in function in MATLAB Version 6, + * available from MathWorks, Inc. (http://www.mathworks.com). This + * routine can be used in place of COLAMD in MATLAB. + * + * CSYMAMD computes a permutation P of a symmetric matrix A such that the + * Cholesky factorization of PAP' has less fill-in and requires fewer + * floating point operations than A. CSYMAMD constructs a matrix M such + * that M'M has the same nonzero pattern of A, and then orders the columns + * of M using colmmd. The column ordering of M is then returned as the + * row and column ordering P of A. CSYMAMD is an extension of SYMAMD. + * + * Authors: + * + * Timothy A. Davis and S. Rajamanickam wrote CCOLAMD, based directly on + * COLAMD by Stefan I. Larimore and Timothy A. Davis, University of + * Florida. The algorithm was developed in collaboration with John + * Gilbert, (UCSB, then at Xerox PARC), and Esmond Ng, (Lawrence Berkeley + * National Lab, then at Oak Ridge National Laboratory). + * + * Acknowledgements: + * + * This work was supported by the National Science Foundation, under + * grants DMS-9504974 and DMS-9803599, CCR-0203270, and a grant from the + * Sandia National Laboratory (Dept. of Energy). + * + * Copyright and License: + * + * Copyright (c) 1998-2005 by the University of Florida. + * All Rights Reserved. + * COLAMD is also available under alternate licenses, contact T. Davis + * for details. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * Permission is hereby granted to use or copy this program under the + * terms of the GNU LGPL, provided that the Copyright, this License, + * and the Availability of the original version is retained on all copies. + * User documentation of any code that uses this code or any modified + * version of this code must cite the Copyright, this License, the + * Availability note, and "Used by permission." Permission to modify + * the code and to distribute modified code is granted, provided the + * Copyright, this License, and the Availability note are retained, + * and a notice that the code was modified is included. + * + * Availability: + * + * The CCOLAMD/CSYMAMD library is available at + * + * http://www.cise.ufl.edu/research/sparse/ccolamd/ + * + * This is the http://www.cise.ufl.edu/research/sparse/ccolamd/ccolamd.c + * file. + * + * See the ChangeLog file for changes since Version 1.0. + */ + +/* ========================================================================== */ +/* === Description of user-callable routines ================================ */ +/* ========================================================================== */ + +/* CCOLAMD includes both int and UF_long versions of all its routines. The + * description below is for the int version. For UF_long, all int arguments + * become UF_long integers. UF_long is normally defined as long, except for + * WIN64 */ + +/* ---------------------------------------------------------------------------- + * ccolamd_recommended: + * ---------------------------------------------------------------------------- + * + * C syntax: + * + * #include "ccolamd.h" + * size_t ccolamd_recommended (int nnz, int n_row, int n_col) ; + * size_t ccolamd_l_recommended (UF_long nnz, UF_long n_row, + * UF_long n_col) ; + * + * Purpose: + * + * Returns recommended value of Alen for use by ccolamd. Returns 0 + * if any input argument is negative. The use of this routine + * is optional. Not needed for csymamd, which dynamically allocates + * its own memory. + * + * Arguments (all input arguments): + * + * int nnz ; Number of nonzeros in the matrix A. This must + * be the same value as p [n_col] in the call to + * ccolamd - otherwise you will get a wrong value + * of the recommended memory to use. + * + * int n_row ; Number of rows in the matrix A. + * + * int n_col ; Number of columns in the matrix A. + * + * ---------------------------------------------------------------------------- + * ccolamd_set_defaults: + * ---------------------------------------------------------------------------- + * + * C syntax: + * + * #include "ccolamd.h" + * ccolamd_set_defaults (double knobs [CCOLAMD_KNOBS]) ; + * ccolamd_l_set_defaults (double knobs [CCOLAMD_KNOBS]) ; + * + * Purpose: + * + * Sets the default parameters. The use of this routine is optional. + * Passing a (double *) NULL pointer for the knobs results in the + * default parameter settings. + * + * Arguments: + * + * double knobs [CCOLAMD_KNOBS] ; Output only. + * + * knobs [0] and knobs [1] behave differently than they did in COLAMD. + * The other knobs are new to CCOLAMD. + * + * knobs [0]: dense row control + * + * For CCOLAMD, rows with more than + * max (16, knobs [CCOLAMD_DENSE_ROW] * sqrt (n_col)) + * entries are removed prior to ordering. + * + * For CSYMAMD, rows and columns with more than + * max (16, knobs [CCOLAMD_DENSE_ROW] * sqrt (n)) + * entries are removed prior to ordering, and placed last in the + * output ordering (subject to the constraints). + * + * If negative, only completely dense rows are removed. If you + * intend to use CCOLAMD for a Cholesky factorization of A*A', set + * knobs [CCOLAMD_DENSE_ROW] to -1, which is more appropriate for + * that case. + * + * Default: 10. + * + * knobs [1]: dense column control + * + * For CCOLAMD, columns with more than + * max (16, knobs [CCOLAMD_DENSE_COL] * sqrt (MIN (n_row,n_col))) + * entries are removed prior to ordering, and placed last in the + * output column ordering (subject to the constraints). + * Not used by CSYMAMD. If negative, only completely dense + * columns are removed. Default: 10. + * + * knobs [2]: aggressive absorption + * + * knobs [CCOLAMD_AGGRESSIVE] controls whether or not to do + * aggressive absorption during the ordering. Default is TRUE + * (nonzero). If zero, no aggressive absorption is performed. + * + * knobs [3]: optimize ordering for LU or Cholesky + * + * knobs [CCOLAMD_LU] controls an option that optimizes the + * ordering for the LU of A or the Cholesky factorization of A'A. + * If TRUE (nonzero), an ordering optimized for LU is performed. + * If FALSE (zero), an ordering for Cholesky is performed. + * Default is FALSE. CSYMAMD ignores this parameter; it always + * orders for Cholesky. + * + * ---------------------------------------------------------------------------- + * ccolamd: + * ---------------------------------------------------------------------------- + * + * C syntax: + * + * #include "ccolamd.h" + * int ccolamd (int n_row, int n_col, int Alen, int *A, int *p, + * double knobs [CCOLAMD_KNOBS], int stats [CCOLAMD_STATS], + * int *cmember) ; + * + * UF_long ccolamd_l (UF_long n_row, UF_long n_col, UF_long Alen, + * UF_long *A, UF_long *p, double knobs [CCOLAMD_KNOBS], + * UF_long stats [CCOLAMD_STATS], UF_long *cmember) ; + * + * Purpose: + * + * Computes a column ordering (Q) of A such that P(AQ)=LU or + * (AQ)'AQ=LL' have less fill-in and require fewer floating point + * operations than factorizing the unpermuted matrix A or A'A, + * respectively. + * + * Returns: + * + * TRUE (1) if successful, FALSE (0) otherwise. + * + * Arguments (for int version): + * + * int n_row ; Input argument. + * + * Number of rows in the matrix A. + * Restriction: n_row >= 0. + * ccolamd returns FALSE if n_row is negative. + * + * int n_col ; Input argument. + * + * Number of columns in the matrix A. + * Restriction: n_col >= 0. + * ccolamd returns FALSE if n_col is negative. + * + * int Alen ; Input argument. + * + * Restriction (see note): + * Alen >= MAX (2*nnz, 4*n_col) + 17*n_col + 7*n_row + 7, where + * nnz = p [n_col]. ccolamd returns FALSE if this condition is + * not met. We recommend about nnz/5 more space for better + * efficiency. This restriction makes an modest assumption + * regarding the size of two typedef'd structures in ccolamd.h. + * We do, however, guarantee that + * + * Alen >= ccolamd_recommended (nnz, n_row, n_col) + * + * will work efficiently. + * + * int A [Alen] ; Input argument, undefined on output. + * + * A is an integer array of size Alen. Alen must be at least as + * large as the bare minimum value given above, but this is very + * low, and can result in excessive run time. For best + * performance, we recommend that Alen be greater than or equal to + * ccolamd_recommended (nnz, n_row, n_col), which adds + * nnz/5 to the bare minimum value given above. + * + * On input, the row indices of the entries in column c of the + * matrix are held in A [(p [c]) ... (p [c+1]-1)]. The row indices + * in a given column c need not be in ascending order, and + * duplicate row indices may be be present. However, ccolamd will + * work a little faster if both of these conditions are met + * (ccolamd puts the matrix into this format, if it finds that the + * the conditions are not met). + * + * The matrix is 0-based. That is, rows are in the range 0 to + * n_row-1, and columns are in the range 0 to n_col-1. ccolamd + * returns FALSE if any row index is out of range. + * + * The contents of A are modified during ordering, and are + * undefined on output. + * + * int p [n_col+1] ; Both input and output argument. + * + * p is an integer array of size n_col+1. On input, it holds the + * "pointers" for the column form of the matrix A. Column c of + * the matrix A is held in A [(p [c]) ... (p [c+1]-1)]. The first + * entry, p [0], must be zero, and p [c] <= p [c+1] must hold + * for all c in the range 0 to n_col-1. The value nnz = p [n_col] + * is thus the total number of entries in the pattern of the + * matrix A. ccolamd returns FALSE if these conditions are not + * met. + * + * On output, if ccolamd returns TRUE, the array p holds the column + * permutation (Q, for P(AQ)=LU or (AQ)'(AQ)=LL'), where p [0] is + * the first column index in the new ordering, and p [n_col-1] is + * the last. That is, p [k] = j means that column j of A is the + * kth pivot column, in AQ, where k is in the range 0 to n_col-1 + * (p [0] = j means that column j of A is the first column in AQ). + * + * If ccolamd returns FALSE, then no permutation is returned, and + * p is undefined on output. + * + * double knobs [CCOLAMD_KNOBS] ; Input argument. + * + * See ccolamd_set_defaults for a description. + * + * int stats [CCOLAMD_STATS] ; Output argument. + * + * Statistics on the ordering, and error status. + * See ccolamd.h for related definitions. + * ccolamd returns FALSE if stats is not present. + * + * stats [0]: number of dense or empty rows ignored. + * + * stats [1]: number of dense or empty columns ignored (and + * ordered last in the output permutation p, subject to the + * constraints). Note that a row can become "empty" if it + * contains only "dense" and/or "empty" columns, and similarly + * a column can become "empty" if it only contains "dense" + * and/or "empty" rows. + * + * stats [2]: number of garbage collections performed. This can + * be excessively high if Alen is close to the minimum + * required value. + * + * stats [3]: status code. < 0 is an error code. + * > 1 is a warning or notice. + * + * 0 OK. Each column of the input matrix contained row + * indices in increasing order, with no duplicates. + * + * 1 OK, but columns of input matrix were jumbled (unsorted + * columns or duplicate entries). CCOLAMD had to do some + * extra work to sort the matrix first and remove + * duplicate entries, but it still was able to return a + * valid permutation (return value of ccolamd was TRUE). + * + * stats [4]: highest column index of jumbled columns + * stats [5]: last seen duplicate or unsorted row index + * stats [6]: number of duplicate or unsorted row indices + * + * -1 A is a null pointer + * + * -2 p is a null pointer + * + * -3 n_row is negative. stats [4]: n_row + * + * -4 n_col is negative. stats [4]: n_col + * + * -5 number of nonzeros in matrix is negative + * + * stats [4]: number of nonzeros, p [n_col] + * + * -6 p [0] is nonzero + * + * stats [4]: p [0] + * + * -7 A is too small + * + * stats [4]: required size + * stats [5]: actual size (Alen) + * + * -8 a column has a negative number of entries + * + * stats [4]: column with < 0 entries + * stats [5]: number of entries in col + * + * -9 a row index is out of bounds + * + * stats [4]: column with bad row index + * stats [5]: bad row index + * stats [6]: n_row, # of rows of matrx + * + * -10 (unused; see csymamd) + * + * int cmember [n_col] ; Input argument. + * + * cmember is new to CCOLAMD. It did not appear in COLAMD. + * It places contraints on the output ordering. s = cmember [j] + * gives the constraint set s that contains the column j + * (Restriction: 0 <= s < n_col). In the output column + * permutation, all columns in set 0 appear first, followed by + * all columns in set 1, and so on. If NULL, all columns are + * treated as if they were in a single constraint set, and you + * will obtain the same ordering as COLAMD (with one exception: + * the dense row/column threshold and other default knobs in + * CCOLAMD and COLAMD are different). + * + * Example: + * + * See + * http://www.cise.ufl.edu/research/sparse/ccolamd/ccolamd_example.c + * for a complete example. + * + * To order the columns of a 5-by-4 matrix with 11 nonzero entries in + * the following nonzero pattern + * + * x 0 x 0 + * x 0 x x + * 0 x x 0 + * 0 0 x x + * x x 0 0 + * + * with default knobs, no output statistics, and no ordering + * constraints, do the following: + * + * #include "ccolamd.h" + * #define ALEN 144 + * int A [ALEN] = {0, 1, 4, 2, 4, 0, 1, 2, 3, 1, 3} ; + * int p [ ] = {0, 3, 5, 9, 11} ; + * int stats [CCOLAMD_STATS] ; + * ccolamd (5, 4, ALEN, A, p, (double *) NULL, stats, NULL) ; + * + * The permutation is returned in the array p, and A is destroyed. + * + * ---------------------------------------------------------------------------- + * csymamd: + * ---------------------------------------------------------------------------- + * + * C syntax: + * + * #include "ccolamd.h" + * + * int csymamd (int n, int *A, int *p, int *perm, + * double knobs [CCOLAMD_KNOBS], int stats [CCOLAMD_STATS], + * void (*allocate) (size_t, size_t), void (*release) (void *), + * int *cmember, int stype) ; + * + * UF_long csymamd_l (UF_long n, UF_long *A, UF_long *p, UF_long *perm, + * double knobs [CCOLAMD_KNOBS], UF_long stats [CCOLAMD_STATS], + * void (*allocate) (size_t, size_t), void (*release) (void *), + * UF_long *cmember, UF_long stype) ; + * + * Purpose: + * + * The csymamd routine computes an ordering P of a symmetric sparse + * matrix A such that the Cholesky factorization PAP' = LL' remains + * sparse. It is based on a column ordering of a matrix M constructed + * so that the nonzero pattern of M'M is the same as A. Either the + * lower or upper triangular part of A can be used, or the pattern + * A+A' can be used. You must pass your selected memory allocator + * (usually calloc/free or mxCalloc/mxFree) to csymamd, for it to + * allocate memory for the temporary matrix M. + * + * Returns: + * + * TRUE (1) if successful, FALSE (0) otherwise. + * + * Arguments: + * + * int n ; Input argument. + * + * Number of rows and columns in the symmetrix matrix A. + * Restriction: n >= 0. + * csymamd returns FALSE if n is negative. + * + * int A [nnz] ; Input argument. + * + * A is an integer array of size nnz, where nnz = p [n]. + * + * The row indices of the entries in column c of the matrix are + * held in A [(p [c]) ... (p [c+1]-1)]. The row indices in a + * given column c need not be in ascending order, and duplicate + * row indices may be present. However, csymamd will run faster + * if the columns are in sorted order with no duplicate entries. + * + * The matrix is 0-based. That is, rows are in the range 0 to + * n-1, and columns are in the range 0 to n-1. csymamd + * returns FALSE if any row index is out of range. + * + * The contents of A are not modified. + * + * int p [n+1] ; Input argument. + * + * p is an integer array of size n+1. On input, it holds the + * "pointers" for the column form of the matrix A. Column c of + * the matrix A is held in A [(p [c]) ... (p [c+1]-1)]. The first + * entry, p [0], must be zero, and p [c] <= p [c+1] must hold + * for all c in the range 0 to n-1. The value p [n] is + * thus the total number of entries in the pattern of the matrix A. + * csymamd returns FALSE if these conditions are not met. + * + * The contents of p are not modified. + * + * int perm [n+1] ; Output argument. + * + * On output, if csymamd returns TRUE, the array perm holds the + * permutation P, where perm [0] is the first index in the new + * ordering, and perm [n-1] is the last. That is, perm [k] = j + * means that row and column j of A is the kth column in PAP', + * where k is in the range 0 to n-1 (perm [0] = j means + * that row and column j of A are the first row and column in + * PAP'). The array is used as a workspace during the ordering, + * which is why it must be of length n+1, not just n. + * + * double knobs [CCOLAMD_KNOBS] ; Input argument. + * + * See colamd_set_defaults for a description. + * + * int stats [CCOLAMD_STATS] ; Output argument. + * + * Statistics on the ordering, and error status. + * See ccolamd.h for related definitions. + * csymand returns FALSE if stats is not present. + * + * stats [0]: number of dense or empty row and columns ignored + * (and ordered last in the output permutation perm, subject + * to the constraints). Note that a row/column can become + * "empty" if it contains only "dense" and/or "empty" + * columns/rows. + * + * stats [1]: (same as stats [0]) + * + * stats [2]: number of garbage collections performed. + * + * stats [3]: status code. < 0 is an error code. + * > 1 is a warning or notice. + * + * 0 to -9: same as ccolamd, with n replacing n_col and n_row, + * and -3 and -7 are unused. + * + * -10 out of memory (unable to allocate temporary workspace + * for M or count arrays using the "allocate" routine + * passed into csymamd). + * + * void * (*allocate) (size_t, size_t) + * + * A pointer to a function providing memory allocation. The + * allocated memory must be returned initialized to zero. For a + * C application, this argument should normally be a pointer to + * calloc. For a MATLAB mexFunction, the routine mxCalloc is + * passed instead. + * + * void (*release) (size_t, size_t) + * + * A pointer to a function that frees memory allocated by the + * memory allocation routine above. For a C application, this + * argument should normally be a pointer to free. For a MATLAB + * mexFunction, the routine mxFree is passed instead. + * + * int cmember [n] ; Input argument. + * + * Same as ccolamd, except that cmember is of size n, and it places + * contraints symmetrically, on both the row and column ordering. + * Entries in cmember must be in the range 0 to n-1. + * + * int stype ; Input argument. + * + * If stype < 0, then only the strictly lower triangular part of + * A is accessed. The upper triangular part is assumed to be the + * transpose of the lower triangular part. This is the same as + * SYMAMD, which did not have an stype parameter. + * + * If stype > 0, only the strictly upper triangular part of A is + * accessed. The lower triangular part is assumed to be the + * transpose of the upper triangular part. + * + * If stype == 0, then the nonzero pattern of A+A' is ordered. + * + * ---------------------------------------------------------------------------- + * ccolamd_report: + * ---------------------------------------------------------------------------- + * + * C syntax: + * + * #include "ccolamd.h" + * ccolamd_report (int stats [CCOLAMD_STATS]) ; + * ccolamd_l_report (UF_long stats [CCOLAMD_STATS]) ; + * + * Purpose: + * + * Prints the error status and statistics recorded in the stats + * array on the standard error output (for a standard C routine) + * or on the MATLAB output (for a mexFunction). + * + * Arguments: + * + * int stats [CCOLAMD_STATS] ; Input only. Statistics from ccolamd. + * + * + * ---------------------------------------------------------------------------- + * csymamd_report: + * ---------------------------------------------------------------------------- + * + * C syntax: + * + * #include "ccolamd.h" + * csymamd_report (int stats [CCOLAMD_STATS]) ; + * csymamd_l_report (UF_long stats [CCOLAMD_STATS]) ; + * + * Purpose: + * + * Prints the error status and statistics recorded in the stats + * array on the standard error output (for a standard C routine) + * or on the MATLAB output (for a mexFunction). + * + * Arguments: + * + * int stats [CCOLAMD_STATS] ; Input only. Statistics from csymamd. + * + */ + + +/* ========================================================================== */ +/* === Scaffolding code definitions ======================================== */ +/* ========================================================================== */ + +/* Ensure that debugging is turned off: */ +#ifndef NDEBUG +#define NDEBUG +#endif + +/* turn on debugging by uncommenting the following line + #undef NDEBUG + */ + +/* ========================================================================== */ +/* === Include files ======================================================== */ +/* ========================================================================== */ + +#include "ccolamd.h" + +#include +#include +#include + +#ifdef MATLAB_MEX_FILE +#include "mex.h" +#include "matrix.h" +#endif + +#if !defined (NPRINT) || !defined (NDEBUG) +#include +#endif + +#ifndef NULL +#define NULL ((void *) 0) +#endif + +/* ========================================================================== */ +/* === int or UF_long ======================================================= */ +/* ========================================================================== */ + +/* define UF_long */ +#include "UFconfig.h" + +#ifdef DLONG + +#define Int UF_long +#define ID UF_long_id +#define Int_MAX UF_long_max + +#define CCOLAMD_recommended ccolamd_l_recommended +#define CCOLAMD_set_defaults ccolamd_l_set_defaults +#define CCOLAMD_2 ccolamd2_l +#define CCOLAMD_MAIN ccolamd_l +#define CCOLAMD_apply_order ccolamd_l_apply_order +#define CCOLAMD_postorder ccolamd_l_postorder +#define CCOLAMD_post_tree ccolamd_l_post_tree +#define CCOLAMD_fsize ccolamd_l_fsize +#define CSYMAMD_MAIN csymamd_l +#define CCOLAMD_report ccolamd_l_report +#define CSYMAMD_report csymamd_l_report + +#else + +#define Int int +#define ID "%d" +#define Int_MAX INT_MAX + +#define CCOLAMD_recommended ccolamd_recommended +#define CCOLAMD_set_defaults ccolamd_set_defaults +#define CCOLAMD_2 ccolamd2 +#define CCOLAMD_MAIN ccolamd +#define CCOLAMD_apply_order ccolamd_apply_order +#define CCOLAMD_postorder ccolamd_postorder +#define CCOLAMD_post_tree ccolamd_post_tree +#define CCOLAMD_fsize ccolamd_fsize +#define CSYMAMD_MAIN csymamd +#define CCOLAMD_report ccolamd_report +#define CSYMAMD_report csymamd_report + +#endif + +/* ========================================================================== */ +/* === Row and Column structures ============================================ */ +/* ========================================================================== */ + +typedef struct CColamd_Col_struct +{ + /* size of this struct is 8 integers if no padding occurs */ + + Int start ; /* index for A of first row in this column, or DEAD */ + /* if column is dead */ + Int length ; /* number of rows in this column */ + union + { + Int thickness ; /* number of original columns represented by this */ + /* col, if the column is alive */ + Int parent ; /* parent in parent tree super-column structure, if */ + /* the column is dead */ + } shared1 ; + union + { + Int score ; + Int order ; + } shared2 ; + union + { + Int headhash ; /* head of a hash bucket, if col is at the head of */ + /* a degree list */ + Int hash ; /* hash value, if col is not in a degree list */ + Int prev ; /* previous column in degree list, if col is in a */ + /* degree list (but not at the head of a degree list) */ + } shared3 ; + union + { + Int degree_next ; /* next column, if col is in a degree list */ + Int hash_next ; /* next column, if col is in a hash list */ + } shared4 ; + + Int nextcol ; /* next column in this supercolumn */ + Int lastcol ; /* last column in this supercolumn */ + +} CColamd_Col ; + + +typedef struct CColamd_Row_struct +{ + /* size of this struct is 6 integers if no padding occurs */ + + Int start ; /* index for A of first col in this row */ + Int length ; /* number of principal columns in this row */ + union + { + Int degree ; /* number of principal & non-principal columns in row */ + Int p ; /* used as a row pointer in init_rows_cols () */ + } shared1 ; + union + { + Int mark ; /* for computing set differences and marking dead rows*/ + Int first_column ;/* first column in row (used in garbage collection) */ + } shared2 ; + + Int thickness ; /* number of original rows represented by this row */ + /* that are not yet pivotal */ + Int front ; /* -1 if an original row */ + /* k if this row represents the kth frontal matrix */ + /* where k goes from 0 to at most n_col-1 */ + +} CColamd_Row ; + +/* ========================================================================== */ +/* === basic definitions ==================================================== */ +/* ========================================================================== */ + +#define EMPTY (-1) +#define MAX(a,b) (((a) > (b)) ? (a) : (b)) +#define MIN(a,b) (((a) < (b)) ? (a) : (b)) + +/* Routines are either PUBLIC (user-callable) or PRIVATE (not user-callable) */ +#define GLOBAL +#define PUBLIC +#define PRIVATE static + +#define DENSE_DEGREE(alpha,n) \ + ((Int) MAX (16.0, (alpha) * sqrt ((double) (n)))) + +#define CMEMBER(c) ((cmember == (Int *) NULL) ? (0) : (cmember [c])) + +/* True if x is NaN */ +#define SCALAR_IS_NAN(x) ((x) != (x)) + +/* true if an integer (stored in double x) would overflow (or if x is NaN) */ +#define INT_OVERFLOW(x) ((!((x) * (1.0+1e-8) <= (double) Int_MAX)) \ + || SCALAR_IS_NAN (x)) + +#define ONES_COMPLEMENT(r) (-(r)-1) +#undef TRUE +#undef FALSE +#define TRUE (1) +#define FALSE (0) + +/* Row and column status */ +#define ALIVE (0) +#define DEAD (-1) + +/* Column status */ +#define DEAD_PRINCIPAL (-1) +#define DEAD_NON_PRINCIPAL (-2) + +/* Macros for row and column status update and checking. */ +#define ROW_IS_DEAD(r) ROW_IS_MARKED_DEAD (Row[r].shared2.mark) +#define ROW_IS_MARKED_DEAD(row_mark) (row_mark < ALIVE) +#define ROW_IS_ALIVE(r) (Row [r].shared2.mark >= ALIVE) +#define COL_IS_DEAD(c) (Col [c].start < ALIVE) +#define COL_IS_ALIVE(c) (Col [c].start >= ALIVE) +#define COL_IS_DEAD_PRINCIPAL(c) (Col [c].start == DEAD_PRINCIPAL) +#define KILL_ROW(r) { Row [r].shared2.mark = DEAD ; } +#define KILL_PRINCIPAL_COL(c) { Col [c].start = DEAD_PRINCIPAL ; } +#define KILL_NON_PRINCIPAL_COL(c) { Col [c].start = DEAD_NON_PRINCIPAL ; } + + +/* ========================================================================== */ +/* === ccolamd reporting mechanism ========================================== */ +/* ========================================================================== */ + +#if defined (MATLAB_MEX_FILE) || defined (MATHWORKS) +/* In MATLAB, matrices are 1-based to the user, but 0-based internally */ +#define INDEX(i) ((i)+1) +#else +/* In C, matrices are 0-based and indices are reported as such in *_report */ +#define INDEX(i) (i) +#endif + +/* All output goes through the PRINTF macro. */ +#define PRINTF(params) { if (ccolamd_printf != NULL) (void) ccolamd_printf params ; } + + +/* ========================================================================== */ +/* === Debugging prototypes and definitions ================================= */ +/* ========================================================================== */ + +#ifndef NDEBUG + +#include + +/* debug print level, present only when debugging */ +PRIVATE Int ccolamd_debug ; + +/* debug print statements */ +#define DEBUG0(params) { PRINTF (params) ; } +#define DEBUG1(params) { if (ccolamd_debug >= 1) PRINTF (params) ; } +#define DEBUG2(params) { if (ccolamd_debug >= 2) PRINTF (params) ; } +#define DEBUG3(params) { if (ccolamd_debug >= 3) PRINTF (params) ; } +#define DEBUG4(params) { if (ccolamd_debug >= 4) PRINTF (params) ; } + +#ifdef MATLAB_MEX_FILE +#define ASSERT(expression) (mxAssert ((expression), "")) +#else +#define ASSERT(expression) (assert (expression)) +#endif + +PRIVATE void ccolamd_get_debug +( + char *method +) ; + +PRIVATE void debug_mark +( + Int n_row, + CColamd_Row Row [], + Int tag_mark, + Int max_mark +) ; + +PRIVATE void debug_matrix +( + Int n_row, + Int n_col, + CColamd_Row Row [], + CColamd_Col Col [], + Int A [] +) ; + +PRIVATE void debug_structures +( + Int n_row, + Int n_col, + CColamd_Row Row [], + CColamd_Col Col [], + Int A [], + Int in_cset [], + Int cset_start [] +) ; + +PRIVATE void dump_super +( + Int super_c, + CColamd_Col Col [], + Int n_col +) ; + +PRIVATE void debug_deg_lists +( + Int n_row, + Int n_col, + CColamd_Row Row [ ], + CColamd_Col Col [ ], + Int head [ ], + Int min_score, + Int should, + Int max_deg +) ; + +#else + +/* === No debugging ========================================================= */ + +#define DEBUG0(params) ; +#define DEBUG1(params) ; +#define DEBUG2(params) ; +#define DEBUG3(params) ; +#define DEBUG4(params) ; + +#define ASSERT(expression) + +#endif + +/* ========================================================================== */ +/* === Prototypes of PRIVATE routines ======================================= */ +/* ========================================================================== */ + +PRIVATE Int init_rows_cols +( + Int n_row, + Int n_col, + CColamd_Row Row [ ], + CColamd_Col Col [ ], + Int A [ ], + Int p [ ], + Int stats [CCOLAMD_STATS] +) ; + +PRIVATE void init_scoring +( + Int n_row, + Int n_col, + CColamd_Row Row [ ], + CColamd_Col Col [ ], + Int A [ ], + Int head [ ], + double knobs [CCOLAMD_KNOBS], + Int *p_n_row2, + Int *p_n_col2, + Int *p_max_deg, + Int cmember [ ], + Int n_cset, + Int cset_start [ ], + Int dead_cols [ ], + Int *p_ndense_row, /* number of dense rows */ + Int *p_nempty_row, /* number of original empty rows */ + Int *p_nnewlyempty_row, /* number of newly empty rows */ + Int *p_ndense_col, /* number of dense cols (excl "empty" cols) */ + Int *p_nempty_col, /* number of original empty cols */ + Int *p_nnewlyempty_col /* number of newly empty cols */ +) ; + +PRIVATE Int find_ordering +( + Int n_row, + Int n_col, + Int Alen, + CColamd_Row Row [ ], + CColamd_Col Col [ ], + Int A [ ], + Int head [ ], +#ifndef NDEBUG + Int n_col2, +#endif + Int max_deg, + Int pfree, + Int cset [ ], + Int cset_start [ ], +#ifndef NDEBUG + Int n_cset, +#endif + Int cmember [ ], + Int Front_npivcol [ ], + Int Front_nrows [ ], + Int Front_ncols [ ], + Int Front_parent [ ], + Int Front_cols [ ], + Int *p_nfr, + Int aggressive, + Int InFront [ ], + Int order_for_lu +) ; + +PRIVATE void detect_super_cols +( +#ifndef NDEBUG + Int n_col, + CColamd_Row Row [ ], +#endif + CColamd_Col Col [ ], + Int A [ ], + Int head [ ], + Int row_start, + Int row_length, + Int in_set [ ] +) ; + +PRIVATE Int garbage_collection +( + Int n_row, + Int n_col, + CColamd_Row Row [ ], + CColamd_Col Col [ ], + Int A [ ], + Int *pfree +) ; + +PRIVATE Int clear_mark +( + Int tag_mark, + Int max_mark, + Int n_row, + CColamd_Row Row [ ] +) ; + +PRIVATE void print_report +( + char *method, + Int stats [CCOLAMD_STATS] +) ; + + +/* ========================================================================== */ +/* === USER-CALLABLE ROUTINES: ============================================== */ +/* ========================================================================== */ + + +/* ========================================================================== */ +/* === ccolamd_recommended ================================================== */ +/* ========================================================================== */ + +/* + * The ccolamd_recommended routine returns the suggested size for Alen. This + * value has been determined to provide good balance between the number of + * garbage collections and the memory requirements for ccolamd. If any + * argument is negative, or if integer overflow occurs, a 0 is returned as + * an error condition. + * + * 2*nnz space is required for the row and column indices of the matrix + * (or 4*n_col, which ever is larger). + * + * CCOLAMD_C (n_col) + CCOLAMD_R (n_row) space is required for the Col and Row + * arrays, respectively, which are internal to ccolamd. This is equal to + * 8*n_col + 6*n_row if the structures are not padded. + * + * An additional n_col space is the minimal amount of "elbow room", + * and nnz/5 more space is recommended for run time efficiency. + * + * The remaining (((3 * n_col) + 1) + 5 * (n_col + 1) + n_row) space is + * for other workspace used in ccolamd which did not appear in colamd. + */ + +/* add two values of type size_t, and check for integer overflow */ +static size_t t_add (size_t a, size_t b, int *ok) +{ + (*ok) = (*ok) && ((a + b) >= MAX (a,b)) ; + return ((*ok) ? (a + b) : 0) ; +} + +/* compute a*k where k is a small integer, and check for integer overflow */ +static size_t t_mult (size_t a, size_t k, int *ok) +{ + size_t i, s = 0 ; + for (i = 0 ; i < k ; i++) + { + s = t_add (s, a, ok) ; + } + return (s) ; +} + +/* size of the Col and Row structures */ +#define CCOLAMD_C(n_col,ok) \ + ((t_mult (t_add (n_col, 1, ok), sizeof (CColamd_Col), ok) / sizeof (Int))) + +#define CCOLAMD_R(n_row,ok) \ + ((t_mult (t_add (n_row, 1, ok), sizeof (CColamd_Row), ok) / sizeof (Int))) + +/* +#define CCOLAMD_RECOMMENDED(nnz, n_row, n_col) \ + MAX (2 * nnz, 4 * n_col) + \ + CCOLAMD_C (n_col) + CCOLAMD_R (n_row) + n_col + (nnz / 5) \ + + ((3 * n_col) + 1) + 5 * (n_col + 1) + n_row + */ + +static size_t ccolamd_need (Int nnz, Int n_row, Int n_col, int *ok) +{ + + /* ccolamd_need, compute the following, and check for integer overflow: + need = MAX (2*nnz, 4*n_col) + n_col + + Col_size + Row_size + + (3*n_col+1) + (5*(n_col+1)) + n_row ; + */ + size_t s, c, r, t ; + + /* MAX (2*nnz, 4*n_col) */ + s = t_mult (nnz, 2, ok) ; /* 2*nnz */ + t = t_mult (n_col, 4, ok) ; /* 4*n_col */ + s = MAX (s,t) ; + + s = t_add (s, n_col, ok) ; /* bare minimum elbow room */ + + /* Col and Row arrays */ + c = CCOLAMD_C (n_col, ok) ; /* size of column structures */ + r = CCOLAMD_R (n_row, ok) ; /* size of row structures */ + s = t_add (s, c, ok) ; + s = t_add (s, r, ok) ; + + c = t_mult (n_col, 3, ok) ; /* 3*n_col + 1 */ + c = t_add (c, 1, ok) ; + s = t_add (s, c, ok) ; + + c = t_add (n_col, 1, ok) ; /* 5 * (n_col + 1) */ + c = t_mult (c, 5, ok) ; + s = t_add (s, c, ok) ; + + s = t_add (s, n_row, ok) ; /* n_row */ + + return (ok ? s : 0) ; +} + +PUBLIC size_t CCOLAMD_recommended /* returns recommended value of Alen. */ +( + /* === Parameters ======================================================= */ + + Int nnz, /* number of nonzeros in A */ + Int n_row, /* number of rows in A */ + Int n_col /* number of columns in A */ +) +{ + size_t s ; + int ok = TRUE ; + if (nnz < 0 || n_row < 0 || n_col < 0) + { + return (0) ; + } + s = ccolamd_need (nnz, n_row, n_col, &ok) ; /* bare minimum needed */ + s = t_add (s, nnz/5, &ok) ; /* extra elbow room */ + ok = ok && (s < Int_MAX) ; + return (ok ? s : 0) ; +} + + +/* ========================================================================== */ +/* === ccolamd_set_defaults ================================================= */ +/* ========================================================================== */ + +/* + * The ccolamd_set_defaults routine sets the default values of the user- + * controllable parameters for ccolamd. + */ + +PUBLIC void CCOLAMD_set_defaults +( + /* === Parameters ======================================================= */ + + double knobs [CCOLAMD_KNOBS] /* knob array */ +) +{ + /* === Local variables ================================================== */ + + Int i ; + + if (!knobs) + { + return ; /* no knobs to initialize */ + } + for (i = 0 ; i < CCOLAMD_KNOBS ; i++) + { + knobs [i] = 0 ; + } + knobs [CCOLAMD_DENSE_ROW] = 10 ; + knobs [CCOLAMD_DENSE_COL] = 10 ; + knobs [CCOLAMD_AGGRESSIVE] = TRUE ; /* default: do aggressive absorption*/ + knobs [CCOLAMD_LU] = FALSE ; /* default: order for Cholesky */ +} + + +/* ========================================================================== */ +/* === symamd =============================================================== */ +/* ========================================================================== */ + +PUBLIC Int CSYMAMD_MAIN /* return TRUE if OK, FALSE otherwise */ +( + /* === Parameters ======================================================= */ + + Int n, /* number of rows and columns of A */ + Int A [ ], /* row indices of A */ + Int p [ ], /* column pointers of A */ + Int perm [ ], /* output permutation, size n+1 */ + double knobs [CCOLAMD_KNOBS], /* parameters (uses defaults if NULL) */ + Int stats [CCOLAMD_STATS], /* output statistics and error codes */ + void * (*allocate) (size_t, size_t),/* pointer to calloc (ANSI C) or */ + /* mxCalloc (for MATLAB mexFunction) */ + void (*release) (void *), /* pointer to free (ANSI C) or */ + /* mxFree (for MATLAB mexFunction) */ + Int cmember [ ], /* constraint set */ + Int stype /* stype of A */ +) +{ + /* === Local variables ================================================== */ + + double cknobs [CCOLAMD_KNOBS] ; + double default_knobs [CCOLAMD_KNOBS] ; + + Int *count ; /* length of each column of M, and col pointer*/ + Int *mark ; /* mark array for finding duplicate entries */ + Int *M ; /* row indices of matrix M */ + size_t Mlen ; /* length of M */ + Int n_row ; /* number of rows in M */ + Int nnz ; /* number of entries in A */ + Int i ; /* row index of A */ + Int j ; /* column index of A */ + Int k ; /* row index of M */ + Int mnz ; /* number of nonzeros in M */ + Int pp ; /* index into a column of A */ + Int last_row ; /* last row seen in the current column */ + Int length ; /* number of nonzeros in a column */ + Int both ; /* TRUE if ordering A+A' */ + Int upper ; /* TRUE if ordering triu(A)+triu(A)' */ + Int lower ; /* TRUE if ordering tril(A)+tril(A)' */ + +#ifndef NDEBUG + ccolamd_get_debug ("csymamd") ; +#endif + + both = (stype == 0) ; + upper = (stype > 0) ; + lower = (stype < 0) ; + + /* === Check the input arguments ======================================== */ + + if (!stats) + { + DEBUG1 (("csymamd: stats not present\n")) ; + return (FALSE) ; + } + for (i = 0 ; i < CCOLAMD_STATS ; i++) + { + stats [i] = 0 ; + } + stats [CCOLAMD_STATUS] = CCOLAMD_OK ; + stats [CCOLAMD_INFO1] = -1 ; + stats [CCOLAMD_INFO2] = -1 ; + + if (!A) + { + stats [CCOLAMD_STATUS] = CCOLAMD_ERROR_A_not_present ; + DEBUG1 (("csymamd: A not present\n")) ; + return (FALSE) ; + } + + if (!p) /* p is not present */ + { + stats [CCOLAMD_STATUS] = CCOLAMD_ERROR_p_not_present ; + DEBUG1 (("csymamd: p not present\n")) ; + return (FALSE) ; + } + + if (n < 0) /* n must be >= 0 */ + { + stats [CCOLAMD_STATUS] = CCOLAMD_ERROR_ncol_negative ; + stats [CCOLAMD_INFO1] = n ; + DEBUG1 (("csymamd: n negative "ID" \n", n)) ; + return (FALSE) ; + } + + nnz = p [n] ; + if (nnz < 0) /* nnz must be >= 0 */ + { + stats [CCOLAMD_STATUS] = CCOLAMD_ERROR_nnz_negative ; + stats [CCOLAMD_INFO1] = nnz ; + DEBUG1 (("csymamd: number of entries negative "ID" \n", nnz)) ; + return (FALSE) ; + } + + if (p [0] != 0) + { + stats [CCOLAMD_STATUS] = CCOLAMD_ERROR_p0_nonzero ; + stats [CCOLAMD_INFO1] = p [0] ; + DEBUG1 (("csymamd: p[0] not zero "ID"\n", p [0])) ; + return (FALSE) ; + } + + /* === If no knobs, set default knobs =================================== */ + + if (!knobs) + { + CCOLAMD_set_defaults (default_knobs) ; + knobs = default_knobs ; + } + + /* === Allocate count and mark ========================================== */ + + count = (Int *) ((*allocate) (n+1, sizeof (Int))) ; + if (!count) + { + stats [CCOLAMD_STATUS] = CCOLAMD_ERROR_out_of_memory ; + DEBUG1 (("csymamd: allocate count (size "ID") failed\n", n+1)) ; + return (FALSE) ; + } + + mark = (Int *) ((*allocate) (n+1, sizeof (Int))) ; + if (!mark) + { + stats [CCOLAMD_STATUS] = CCOLAMD_ERROR_out_of_memory ; + (*release) ((void *) count) ; + DEBUG1 (("csymamd: allocate mark (size "ID") failed\n", n+1)) ; + return (FALSE) ; + } + + /* === Compute column counts of M, check if A is valid ================== */ + + stats [CCOLAMD_INFO3] = 0 ; /* number of duplicate or unsorted row indices*/ + + for (i = 0 ; i < n ; i++) + { + mark [i] = -1 ; + } + + for (j = 0 ; j < n ; j++) + { + last_row = -1 ; + + length = p [j+1] - p [j] ; + if (length < 0) + { + /* column pointers must be non-decreasing */ + stats [CCOLAMD_STATUS] = CCOLAMD_ERROR_col_length_negative ; + stats [CCOLAMD_INFO1] = j ; + stats [CCOLAMD_INFO2] = length ; + (*release) ((void *) count) ; + (*release) ((void *) mark) ; + DEBUG1 (("csymamd: col "ID" negative length "ID"\n", j, length)) ; + return (FALSE) ; + } + + for (pp = p [j] ; pp < p [j+1] ; pp++) + { + i = A [pp] ; + if (i < 0 || i >= n) + { + /* row index i, in column j, is out of bounds */ + stats [CCOLAMD_STATUS] = CCOLAMD_ERROR_row_index_out_of_bounds ; + stats [CCOLAMD_INFO1] = j ; + stats [CCOLAMD_INFO2] = i ; + stats [CCOLAMD_INFO3] = n ; + (*release) ((void *) count) ; + (*release) ((void *) mark) ; + DEBUG1 (("csymamd: row "ID" col "ID" out of bounds\n", i, j)) ; + return (FALSE) ; + } + + if (i <= last_row || mark [i] == j) + { + /* row index is unsorted or repeated (or both), thus col */ + /* is jumbled. This is a notice, not an error condition. */ + stats [CCOLAMD_STATUS] = CCOLAMD_OK_BUT_JUMBLED ; + stats [CCOLAMD_INFO1] = j ; + stats [CCOLAMD_INFO2] = i ; + (stats [CCOLAMD_INFO3]) ++ ; + DEBUG1 (("csymamd: row "ID" col "ID" unsorted/dupl.\n", i, j)) ; + } + + if (mark [i] != j) + { + if ((both && i != j) || (lower && i > j) || (upper && i < j)) + { + /* row k of M will contain column indices i and j */ + count [i]++ ; + count [j]++ ; + } + } + + /* mark the row as having been seen in this column */ + mark [i] = j ; + + last_row = i ; + } + } + + /* === Compute column pointers of M ===================================== */ + + /* use output permutation, perm, for column pointers of M */ + perm [0] = 0 ; + for (j = 1 ; j <= n ; j++) + { + perm [j] = perm [j-1] + count [j-1] ; + } + for (j = 0 ; j < n ; j++) + { + count [j] = perm [j] ; + } + + /* === Construct M ====================================================== */ + + mnz = perm [n] ; + n_row = mnz / 2 ; + Mlen = CCOLAMD_recommended (mnz, n_row, n) ; + M = (Int *) ((*allocate) (Mlen, sizeof (Int))) ; + DEBUG1 (("csymamd: M is "ID"-by-"ID" with "ID" entries, Mlen = %g\n", + n_row, n, mnz, (double) Mlen)) ; + + if (!M) + { + stats [CCOLAMD_STATUS] = CCOLAMD_ERROR_out_of_memory ; + (*release) ((void *) count) ; + (*release) ((void *) mark) ; + DEBUG1 (("csymamd: allocate M (size %g) failed\n", (double) Mlen)) ; + return (FALSE) ; + } + + k = 0 ; + + if (stats [CCOLAMD_STATUS] == CCOLAMD_OK) + { + /* Matrix is OK */ + for (j = 0 ; j < n ; j++) + { + ASSERT (p [j+1] - p [j] >= 0) ; + for (pp = p [j] ; pp < p [j+1] ; pp++) + { + i = A [pp] ; + ASSERT (i >= 0 && i < n) ; + if ((both && i != j) || (lower && i > j) || (upper && i < j)) + { + /* row k of M contains column indices i and j */ + M [count [i]++] = k ; + M [count [j]++] = k ; + k++ ; + } + } + } + } + else + { + /* Matrix is jumbled. Do not add duplicates to M. Unsorted cols OK. */ + DEBUG1 (("csymamd: Duplicates in A.\n")) ; + for (i = 0 ; i < n ; i++) + { + mark [i] = -1 ; + } + for (j = 0 ; j < n ; j++) + { + ASSERT (p [j+1] - p [j] >= 0) ; + for (pp = p [j] ; pp < p [j+1] ; pp++) + { + i = A [pp] ; + ASSERT (i >= 0 && i < n) ; + if (mark [i] != j) + { + if ((both && i != j) || (lower && i > j) || (upper && i= 0 */ + { + stats [CCOLAMD_STATUS] = CCOLAMD_ERROR_nrow_negative ; + stats [CCOLAMD_INFO1] = n_row ; + DEBUG1 (("ccolamd: nrow negative "ID"\n", n_row)) ; + return (FALSE) ; + } + + if (n_col < 0) /* n_col must be >= 0 */ + { + stats [CCOLAMD_STATUS] = CCOLAMD_ERROR_ncol_negative ; + stats [CCOLAMD_INFO1] = n_col ; + DEBUG1 (("ccolamd: ncol negative "ID"\n", n_col)) ; + return (FALSE) ; + } + + nnz = p [n_col] ; + if (nnz < 0) /* nnz must be >= 0 */ + { + stats [CCOLAMD_STATUS] = CCOLAMD_ERROR_nnz_negative ; + stats [CCOLAMD_INFO1] = nnz ; + DEBUG1 (("ccolamd: number of entries negative "ID"\n", nnz)) ; + return (FALSE) ; + } + + if (p [0] != 0) + { + stats [CCOLAMD_STATUS] = CCOLAMD_ERROR_p0_nonzero ; + stats [CCOLAMD_INFO1] = p [0] ; + DEBUG1 (("ccolamd: p[0] not zero "ID"\n", p [0])) ; + return (FALSE) ; + } + + /* === If no knobs, set default knobs =================================== */ + + if (!knobs) + { + CCOLAMD_set_defaults (default_knobs) ; + knobs = default_knobs ; + } + + aggressive = (knobs [CCOLAMD_AGGRESSIVE] != FALSE) ; + order_for_lu = (knobs [CCOLAMD_LU] != FALSE) ; + + /* === Allocate workspace from array A ================================== */ + + ok = TRUE ; + Col_size = CCOLAMD_C (n_col, &ok) ; + Row_size = CCOLAMD_R (n_row, &ok) ; + + /* min size of A is 2nnz+ncol. cset and cset_start are of size 2ncol+1 */ + /* Each of the 5 fronts is of size n_col + 1. InFront is of size nrow. */ + + /* + need = MAX (2*nnz, 4*n_col) + n_col + + Col_size + Row_size + + (3*n_col+1) + (5*(n_col+1)) + n_row ; + */ + need = ccolamd_need (nnz, n_row, n_col, &ok) ; + + if (!ok || need > (size_t) Alen || need > Int_MAX) + { + /* not enough space in array A to perform the ordering */ + stats [CCOLAMD_STATUS] = CCOLAMD_ERROR_A_too_small ; + stats [CCOLAMD_INFO1] = need ; + stats [CCOLAMD_INFO2] = Alen ; + DEBUG1 (("ccolamd: Need Alen >= "ID", given "ID"\n", need, Alen)) ; + return (FALSE) ; + } + + /* since integer overflow has been check, the following cannot overflow: */ + Alen -= Col_size + Row_size + (3*n_col + 1) + 5*(n_col+1) + n_row ; + + /* Size of A is now Alen >= MAX (2*nnz, 4*n_col) + n_col. The ordering + * requires Alen >= 2*nnz + n_col, and the postorder requires + * Alen >= 5*n_col. */ + + ap = Alen ; + + /* Front array workspace: 5*(n_col+1) + n_row */ + if (!Front_npivcol || !Front_nrows || !Front_ncols || !Front_parent || + !Front_cols || !Front_cols || !InFront) + { + Front_npivcol = &A [ap] ; ap += (n_col + 1) ; + Front_nrows = &A [ap] ; ap += (n_col + 1) ; + Front_ncols = &A [ap] ; ap += (n_col + 1) ; + Front_parent = &A [ap] ; ap += (n_col + 1) ; + Front_cols = &A [ap] ; ap += (n_col + 1) ; + InFront = &A [ap] ; ap += (n_row) ; + } + else + { + /* Fronts are present. Leave the additional space as elbow room. */ + ap += 5*(n_col+1) + n_row ; + ap = Alen ; + } + + /* Workspace for cset management: 3*n_col+1 */ + /* cset_start is of size n_col + 1 */ + cset_start = &A [ap] ; + ap += n_col + 1 ; + + /* dead_col is of size n_col */ + dead_cols = &A [ap] ; + ap += n_col ; + + /* cset is of size n_col */ + cset = &A [ap] ; + ap += n_col ; + + /* Col is of size Col_size. The space is shared by temp_cstart and csize */ + Col = (CColamd_Col *) &A [ap] ; + temp_cstart = (Int *) Col ; /* [ temp_cstart is of size n_col+1 */ + csize = temp_cstart + (n_col+1) ; /* csize is of size n_col+1 */ + ap += Col_size ; + ASSERT (Col_size >= 2*n_col+1) ; + + /* Row is of size Row_size */ + Row = (CColamd_Row *) &A [ap] ; + ap += Row_size ; + + /* Initialize csize & dead_cols to zero */ + for (i = 0 ; i < n_col ; i++) + { + csize [i] = 0 ; + dead_cols [i] = 0 ; + } + + /* === Construct the constraint set ===================================== */ + + if (n_col == 0) + { + n_cset = 0 ; + } + else if (cmember == (Int *) NULL) + { + /* no constraint set; all columns belong to set zero */ + n_cset = 1 ; + csize [0] = n_col ; + DEBUG1 (("no cmember present\n")) ; + } + else + { + n_cset = 0 ; + for (i = 0 ; i < n_col ; i++) + { + if (cmember [i] < 0 || cmember [i] > n_col) + { + stats [CCOLAMD_STATUS] = CCOLAMD_ERROR_invalid_cmember ; + DEBUG1 (("ccolamd: malformed cmember \n")) ; + return (FALSE) ; + } + n_cset = MAX (n_cset, cmember [i]) ; + csize [cmember [i]]++ ; + } + /* cset is zero based */ + n_cset++ ; + } + + ASSERT ((n_cset >= 0) && (n_cset <= n_col)) ; + + cset_start [0] = temp_cstart [0] = 0 ; + for (i = 1 ; i <= n_cset ; i++) + { + cset_start [i] = cset_start [i-1] + csize [i-1] ; + DEBUG4 ((" cset_start ["ID"] = "ID" \n", i , cset_start [i])) ; + temp_cstart [i] = cset_start [i] ; + } + + /* do in reverse order to encourage natural tie-breaking */ + if (cmember == (Int *) NULL) + { + for (i = n_col-1 ; i >= 0 ; i--) + { + cset [temp_cstart [0]++] = i ; + } + } + else + { + for (i = n_col-1 ; i >= 0 ; i--) + { + cset [temp_cstart [cmember [i]]++] = i ; + } + } + + /* ] temp_cstart and csize are no longer used */ + + /* === Construct the row and column data structures ===================== */ + + if (!init_rows_cols (n_row, n_col, Row, Col, A, p, stats)) + { + /* input matrix is invalid */ + DEBUG1 (("ccolamd: Matrix invalid\n")) ; + return (FALSE) ; + } + + /* === Initialize front info ============================================ */ + + for (col = 0 ; col < n_col ; col++) + { + Front_npivcol [col] = 0 ; + Front_nrows [col] = 0 ; + Front_ncols [col] = 0 ; + Front_parent [col] = EMPTY ; + Front_cols [col] = EMPTY ; + } + + /* === Initialize scores, kill dense rows/columns ======================= */ + + init_scoring (n_row, n_col, Row, Col, A, p, knobs, + &n_row2, &n_col2, &max_deg, cmember, n_cset, cset_start, dead_cols, + &ndense_row, &nempty_row, &nnewlyempty_row, + &ndense_col, &nempty_col, &nnewlyempty_col) ; + + ASSERT (n_row2 == n_row - nempty_row - nnewlyempty_row - ndense_row) ; + ASSERT (n_col2 == n_col - nempty_col - nnewlyempty_col - ndense_col) ; + DEBUG1 (("# dense rows "ID" cols "ID"\n", ndense_row, ndense_col)) ; + + /* === Order the supercolumns =========================================== */ + + ngarbage = find_ordering (n_row, n_col, Alen, Row, Col, A, p, +#ifndef NDEBUG + n_col2, +#endif + max_deg, 2*nnz, cset, cset_start, +#ifndef NDEBUG + n_cset, +#endif + cmember, Front_npivcol, Front_nrows, Front_ncols, Front_parent, + Front_cols, &nfr, aggressive, InFront, order_for_lu) ; + + ASSERT (Alen >= 5*n_col) ; + + /* === Postorder ======================================================== */ + + /* A is no longer needed, so use A [0..5*nfr-1] as workspace [ [ */ + /* This step requires Alen >= 5*n_col */ + Front_child = A ; + Front_sibling = Front_child + nfr ; + Front_stack = Front_sibling + nfr ; + Front_order = Front_stack + nfr ; + Front_size = Front_order + nfr ; + + CCOLAMD_fsize (nfr, Front_size, Front_nrows, Front_ncols, + Front_parent, Front_npivcol) ; + + CCOLAMD_postorder (nfr, Front_parent, Front_npivcol, Front_size, + Front_order, Front_child, Front_sibling, Front_stack, Front_cols, + cmember) ; + + /* Front_size, Front_stack, Front_child, Front_sibling no longer needed ] */ + + /* use A [0..nfr-1] as workspace */ + CCOLAMD_apply_order (Front_npivcol, Front_order, A, nfr, nfr) ; + CCOLAMD_apply_order (Front_nrows, Front_order, A, nfr, nfr) ; + CCOLAMD_apply_order (Front_ncols, Front_order, A, nfr, nfr) ; + CCOLAMD_apply_order (Front_parent, Front_order, A, nfr, nfr) ; + CCOLAMD_apply_order (Front_cols, Front_order, A, nfr, nfr) ; + + /* fix the parent to refer to the new numbering */ + for (i = 0 ; i < nfr ; i++) + { + parent = Front_parent [i] ; + if (parent != EMPTY) + { + Front_parent [i] = Front_order [parent] ; + } + } + + /* fix InFront to refer to the new numbering */ + for (row = 0 ; row < n_row ; row++) + { + i = InFront [row] ; + ASSERT (i >= EMPTY && i < nfr) ; + if (i != EMPTY) + { + InFront [row] = Front_order [i] ; + } + } + + /* Front_order longer needed ] */ + + /* === Order the columns in the fronts ================================== */ + + /* use A [0..n_col-1] as inverse permutation */ + for (i = 0 ; i < n_col ; i++) + { + A [i] = EMPTY ; + } + + k = 0 ; + set1 = 0 ; + for (i = 0 ; i < nfr ; i++) + { + ASSERT (Front_npivcol [i] > 0) ; + + set2 = CMEMBER (Front_cols [i]) ; + while (set1 < set2) + { + k += dead_cols [set1] ; + DEBUG3 (("Skip null/dense columns of set "ID"\n",set1)) ; + set1++ ; + } + set1 = set2 ; + + for (col = Front_cols [i] ; col != EMPTY ; col = Col [col].nextcol) + { + ASSERT (col >= 0 && col < n_col) ; + DEBUG1 (("ccolamd output ordering: k "ID" col "ID"\n", k, col)) ; + p [k] = col ; + ASSERT (A [col] == EMPTY) ; + + cs = CMEMBER (col) ; + ASSERT (k >= cset_start [cs] && k < cset_start [cs+1]) ; + + A [col] = k ; + k++ ; + } + } + + /* === Order the "dense" and null columns =============================== */ + + if (n_col2 < n_col) + { + for (col = 0 ; col < n_col ; col++) + { + if (A [col] == EMPTY) + { + k = Col [col].shared2.order ; + cs = CMEMBER (col) ; +#ifndef NDEBUG + dead_cols [cs]-- ; +#endif + ASSERT (k >= cset_start [cs] && k < cset_start [cs+1]) ; + DEBUG1 (("ccolamd output ordering: k "ID" col "ID + " (dense or null col)\n", k, col)) ; + p [k] = col ; + A [col] = k ; + } + } + } + +#ifndef NDEBUG + for (i = 0 ; i < n_cset ; i++) + { + ASSERT (dead_cols [i] == 0) ; + } +#endif + + /* === Return statistics in stats ======================================= */ + + stats [CCOLAMD_DENSE_ROW] = ndense_row ; + stats [CCOLAMD_EMPTY_ROW] = nempty_row ; /* fixed in 2.7.3 */ + stats [CCOLAMD_NEWLY_EMPTY_ROW] = nnewlyempty_row ; + stats [CCOLAMD_DENSE_COL] = ndense_col ; + stats [CCOLAMD_EMPTY_COL] = nempty_col ; + stats [CCOLAMD_NEWLY_EMPTY_COL] = nnewlyempty_col ; + ASSERT (ndense_col + nempty_col + nnewlyempty_col == n_col - n_col2) ; + if (p_nfr) + { + *p_nfr = nfr ; + } + stats [CCOLAMD_DEFRAG_COUNT] = ngarbage ; + DEBUG1 (("ccolamd: done.\n")) ; + return (TRUE) ; +} + + +/* ========================================================================== */ +/* === colamd_report ======================================================== */ +/* ========================================================================== */ + +PUBLIC void CCOLAMD_report +( + Int stats [CCOLAMD_STATS] +) +{ + print_report ("ccolamd", stats) ; +} + + +/* ========================================================================== */ +/* === symamd_report ======================================================== */ +/* ========================================================================== */ + +PUBLIC void CSYMAMD_report +( + Int stats [CCOLAMD_STATS] +) +{ + print_report ("csymamd", stats) ; +} + + +/* ========================================================================== */ +/* === NON-USER-CALLABLE ROUTINES: ========================================== */ +/* ========================================================================== */ + +/* There are no user-callable routines beyond this point in the file */ + + +/* ========================================================================== */ +/* === init_rows_cols ======================================================= */ +/* ========================================================================== */ + +/* + Takes the column form of the matrix in A and creates the row form of the + matrix. Also, row and column attributes are stored in the Col and Row + structs. If the columns are un-sorted or contain duplicate row indices, + this routine will also sort and remove duplicate row indices from the + column form of the matrix. Returns FALSE if the matrix is invalid, + TRUE otherwise. Not user-callable. +*/ + +PRIVATE Int init_rows_cols /* returns TRUE if OK, or FALSE otherwise */ +( + /* === Parameters ======================================================= */ + + Int n_row, /* number of rows of A */ + Int n_col, /* number of columns of A */ + CColamd_Row Row [ ], /* of size n_row+1 */ + CColamd_Col Col [ ], /* of size n_col+1 */ + Int A [ ], /* row indices of A, of size Alen */ + Int p [ ], /* pointers to columns in A, of size n_col+1 */ + Int stats [CCOLAMD_STATS] /* colamd statistics */ +) +{ + /* === Local variables ================================================== */ + + Int col ; /* a column index */ + Int row ; /* a row index */ + Int *cp ; /* a column pointer */ + Int *cp_end ; /* a pointer to the end of a column */ + Int *rp ; /* a row pointer */ + Int *rp_end ; /* a pointer to the end of a row */ + Int last_row ; /* previous row */ + + /* === Initialize columns, and check column pointers ==================== */ + + for (col = 0 ; col < n_col ; col++) + { + Col [col].start = p [col] ; + Col [col].length = p [col+1] - p [col] ; + + if (Col [col].length < 0) + { + /* column pointers must be non-decreasing */ + stats [CCOLAMD_STATUS] = CCOLAMD_ERROR_col_length_negative ; + stats [CCOLAMD_INFO1] = col ; + stats [CCOLAMD_INFO2] = Col [col].length ; + DEBUG1 (("ccolamd: col "ID" length "ID" < 0\n", + col, Col [col].length)) ; + return (FALSE) ; + } + + Col [col].shared1.thickness = 1 ; + Col [col].shared2.score = 0 ; + Col [col].shared3.prev = EMPTY ; + Col [col].shared4.degree_next = EMPTY ; + Col [col].nextcol = EMPTY ; + Col [col].lastcol = col ; + } + + /* p [0..n_col] no longer needed, used as "head" in subsequent routines */ + + /* === Scan columns, compute row degrees, and check row indices ========= */ + + stats [CCOLAMD_INFO3] = 0 ; /* number of duplicate or unsorted row indices*/ + + for (row = 0 ; row < n_row ; row++) + { + Row [row].length = 0 ; + Row [row].shared2.mark = -1 ; + Row [row].thickness = 1 ; + Row [row].front = EMPTY ; + } + + for (col = 0 ; col < n_col ; col++) + { + DEBUG1 (("\nCcolamd input column "ID":\n", col)) ; + last_row = -1 ; + + cp = &A [p [col]] ; + cp_end = &A [p [col+1]] ; + + while (cp < cp_end) + { + row = *cp++ ; + DEBUG1 (("row: "ID"\n", row)) ; + + /* make sure row indices within range */ + if (row < 0 || row >= n_row) + { + stats [CCOLAMD_STATUS] = CCOLAMD_ERROR_row_index_out_of_bounds ; + stats [CCOLAMD_INFO1] = col ; + stats [CCOLAMD_INFO2] = row ; + stats [CCOLAMD_INFO3] = n_row ; + DEBUG1 (("row "ID" col "ID" out of bounds\n", row, col)) ; + return (FALSE) ; + } + + if (row <= last_row || Row [row].shared2.mark == col) + { + /* row index are unsorted or repeated (or both), thus col */ + /* is jumbled. This is a notice, not an error condition. */ + stats [CCOLAMD_STATUS] = CCOLAMD_OK_BUT_JUMBLED ; + stats [CCOLAMD_INFO1] = col ; + stats [CCOLAMD_INFO2] = row ; + (stats [CCOLAMD_INFO3]) ++ ; + DEBUG1 (("row "ID" col "ID" unsorted/duplicate\n", row, col)) ; + } + + if (Row [row].shared2.mark != col) + { + Row [row].length++ ; + } + else + { + /* this is a repeated entry in the column, */ + /* it will be removed */ + Col [col].length-- ; + } + + /* mark the row as having been seen in this column */ + Row [row].shared2.mark = col ; + + last_row = row ; + } + } + + /* === Compute row pointers ============================================= */ + + /* row form of the matrix starts directly after the column */ + /* form of matrix in A */ + Row [0].start = p [n_col] ; + Row [0].shared1.p = Row [0].start ; + Row [0].shared2.mark = -1 ; + for (row = 1 ; row < n_row ; row++) + { + Row [row].start = Row [row-1].start + Row [row-1].length ; + Row [row].shared1.p = Row [row].start ; + Row [row].shared2.mark = -1 ; + } + + /* === Create row form ================================================== */ + + if (stats [CCOLAMD_STATUS] == CCOLAMD_OK_BUT_JUMBLED) + { + /* if cols jumbled, watch for repeated row indices */ + for (col = 0 ; col < n_col ; col++) + { + cp = &A [p [col]] ; + cp_end = &A [p [col+1]] ; + while (cp < cp_end) + { + row = *cp++ ; + if (Row [row].shared2.mark != col) + { + A [(Row [row].shared1.p)++] = col ; + Row [row].shared2.mark = col ; + } + } + } + } + else + { + /* if cols not jumbled, we don't need the mark (this is faster) */ + for (col = 0 ; col < n_col ; col++) + { + cp = &A [p [col]] ; + cp_end = &A [p [col+1]] ; + while (cp < cp_end) + { + A [(Row [*cp++].shared1.p)++] = col ; + } + } + } + + /* === Clear the row marks and set row degrees ========================== */ + + for (row = 0 ; row < n_row ; row++) + { + Row [row].shared2.mark = 0 ; + Row [row].shared1.degree = Row [row].length ; + } + + /* === See if we need to re-create columns ============================== */ + + if (stats [CCOLAMD_STATUS] == CCOLAMD_OK_BUT_JUMBLED) + { + DEBUG1 (("ccolamd: reconstructing column form, matrix jumbled\n")) ; + +#ifndef NDEBUG + /* make sure column lengths are correct */ + for (col = 0 ; col < n_col ; col++) + { + p [col] = Col [col].length ; + } + for (row = 0 ; row < n_row ; row++) + { + rp = &A [Row [row].start] ; + rp_end = rp + Row [row].length ; + while (rp < rp_end) + { + p [*rp++]-- ; + } + } + for (col = 0 ; col < n_col ; col++) + { + ASSERT (p [col] == 0) ; + } + /* now p is all zero (different than when debugging is turned off) */ +#endif + + /* === Compute col pointers ========================================= */ + + /* col form of the matrix starts at A [0]. */ + /* Note, we may have a gap between the col form and the row */ + /* form if there were duplicate entries, if so, it will be */ + /* removed upon the first garbage collection */ + Col [0].start = 0 ; + p [0] = Col [0].start ; + for (col = 1 ; col < n_col ; col++) + { + /* note that the lengths here are for pruned columns, i.e. */ + /* no duplicate row indices will exist for these columns */ + Col [col].start = Col [col-1].start + Col [col-1].length ; + p [col] = Col [col].start ; + } + + /* === Re-create col form =========================================== */ + + for (row = 0 ; row < n_row ; row++) + { + rp = &A [Row [row].start] ; + rp_end = rp + Row [row].length ; + while (rp < rp_end) + { + A [(p [*rp++])++] = row ; + } + } + } + + /* === Done. Matrix is not (or no longer) jumbled ====================== */ + + + return (TRUE) ; +} + + +/* ========================================================================== */ +/* === init_scoring ========================================================= */ +/* ========================================================================== */ + +/* + Kills dense or empty columns and rows, calculates an initial score for + each column, and places all columns in the degree lists. Not user-callable. +*/ + +PRIVATE void init_scoring +( + /* === Parameters ======================================================= */ + + Int n_row, /* number of rows of A */ + Int n_col, /* number of columns of A */ + CColamd_Row Row [ ], /* of size n_row+1 */ + CColamd_Col Col [ ], /* of size n_col+1 */ + Int A [ ], /* column form and row form of A */ + Int head [ ], /* of size n_col+1 */ + double knobs [CCOLAMD_KNOBS],/* parameters */ + Int *p_n_row2, /* number of non-dense, non-empty rows */ + Int *p_n_col2, /* number of non-dense, non-empty columns */ + Int *p_max_deg, /* maximum row degree */ + Int cmember [ ], + Int n_cset, + Int cset_start [ ], + Int dead_cols [ ], + Int *p_ndense_row, /* number of dense rows */ + Int *p_nempty_row, /* number of original empty rows */ + Int *p_nnewlyempty_row, /* number of newly empty rows */ + Int *p_ndense_col, /* number of dense cols (excl "empty" cols) */ + Int *p_nempty_col, /* number of original empty cols */ + Int *p_nnewlyempty_col /* number of newly empty cols */ +) +{ +/* === Local variables ================================================== */ + + Int c ; /* a column index */ + Int r, row ; /* a row index */ + Int *cp ; /* a column pointer */ + Int deg ; /* degree of a row or column */ + Int *cp_end ; /* a pointer to the end of a column */ + Int *new_cp ; /* new column pointer */ + Int col_length ; /* length of pruned column */ + Int score ; /* current column score */ + Int n_col2 ; /* number of non-dense, non-empty columns */ + Int n_row2 ; /* number of non-dense, non-empty rows */ + Int dense_row_count ; /* remove rows with more entries than this */ + Int dense_col_count ; /* remove cols with more entries than this */ + Int max_deg ; /* maximum row degree */ + Int s ; /* a cset index */ + Int ndense_row ; /* number of dense rows */ + Int nempty_row ; /* number of empty rows */ + Int nnewlyempty_row ; /* number of newly empty rows */ + Int ndense_col ; /* number of dense cols (excl "empty" cols) */ + Int nempty_col ; /* number of original empty cols */ + Int nnewlyempty_col ; /* number of newly empty cols */ + Int ne ; + +#ifndef NDEBUG + Int debug_count ; /* debug only. */ +#endif + + /* === Extract knobs ==================================================== */ + + /* Note: if knobs contains a NaN, this is undefined: */ + if (knobs [CCOLAMD_DENSE_ROW] < 0) + { + /* only remove completely dense rows */ + dense_row_count = n_col-1 ; + } + else + { + dense_row_count = DENSE_DEGREE (knobs [CCOLAMD_DENSE_ROW], n_col) ; + } + if (knobs [CCOLAMD_DENSE_COL] < 0) + { + /* only remove completely dense columns */ + dense_col_count = n_row-1 ; + } + else + { + dense_col_count = + DENSE_DEGREE (knobs [CCOLAMD_DENSE_COL], MIN (n_row, n_col)) ; + } + + DEBUG1 (("densecount: "ID" "ID"\n", dense_row_count, dense_col_count)) ; + max_deg = 0 ; + + n_col2 = n_col ; + n_row2 = n_row ; + + /* Set the head array for bookkeeping of dense and empty columns. */ + /* This will be used as hash buckets later. */ + for (s = 0 ; s < n_cset ; s++) + { + head [s] = cset_start [s+1] ; + } + + ndense_col = 0 ; + nempty_col = 0 ; + nnewlyempty_col = 0 ; + ndense_row = 0 ; + nempty_row = 0 ; + nnewlyempty_row = 0 ; + + /* === Kill empty columns =============================================== */ + + /* Put the empty columns at the end in their natural order, so that LU */ + /* factorization can proceed as far as possible. */ + for (c = n_col-1 ; c >= 0 ; c--) + { + deg = Col [c].length ; + if (deg == 0) + { + /* this is a empty column, kill and order it last of its cset */ + Col [c].shared2.order = --head [CMEMBER (c)] ; + --n_col2 ; + dead_cols [CMEMBER (c)] ++ ; + nempty_col++ ; + KILL_PRINCIPAL_COL (c) ; + } + } + DEBUG1 (("ccolamd: null columns killed: "ID"\n", n_col - n_col2)) ; + + /* === Kill dense columns =============================================== */ + + /* Put the dense columns at the end, in their natural order */ + for (c = n_col-1 ; c >= 0 ; c--) + { + /* skip any dead columns */ + if (COL_IS_DEAD (c)) + { + continue ; + } + deg = Col [c].length ; + if (deg > dense_col_count) + { + /* this is a dense column, kill and order it last of its cset */ + Col [c].shared2.order = --head [CMEMBER (c)] ; + --n_col2 ; + dead_cols [CMEMBER (c)] ++ ; + ndense_col++ ; + /* decrement the row degrees */ + cp = &A [Col [c].start] ; + cp_end = cp + Col [c].length ; + while (cp < cp_end) + { + Row [*cp++].shared1.degree-- ; + } + KILL_PRINCIPAL_COL (c) ; + } + } + DEBUG1 (("Dense and null columns killed: "ID"\n", n_col - n_col2)) ; + + /* === Kill dense and empty rows ======================================== */ + + /* Note that there can now be empty rows, since dense columns have + * been deleted. These are "newly" empty rows. */ + + ne = 0 ; + for (r = 0 ; r < n_row ; r++) + { + deg = Row [r].shared1.degree ; + ASSERT (deg >= 0 && deg <= n_col) ; + if (deg > dense_row_count) + { + /* There is at least one dense row. Continue ordering, but */ + /* symbolic factorization will be redone after ccolamd is done.*/ + ndense_row++ ; + } + if (deg == 0) + { + /* this is a newly empty row, or original empty row */ + ne++ ; + } + if (deg > dense_row_count || deg == 0) + { + /* kill a dense or empty row */ + KILL_ROW (r) ; + Row [r].thickness = 0 ; + --n_row2 ; + } + else + { + /* keep track of max degree of remaining rows */ + max_deg = MAX (max_deg, deg) ; + } + } + nnewlyempty_row = ne - nempty_row ; + DEBUG1 (("ccolamd: Dense and null rows killed: "ID"\n", n_row - n_row2)) ; + + /* === Compute initial column scores ==================================== */ + + /* At this point the row degrees are accurate. They reflect the number */ + /* of "live" (non-dense) columns in each row. No empty rows exist. */ + /* Some "live" columns may contain only dead rows, however. These are */ + /* pruned in the code below. */ + + /* now find the initial COLMMD score for each column */ + for (c = n_col-1 ; c >= 0 ; c--) + { + /* skip dead column */ + if (COL_IS_DEAD (c)) + { + continue ; + } + score = 0 ; + cp = &A [Col [c].start] ; + new_cp = cp ; + cp_end = cp + Col [c].length ; + while (cp < cp_end) + { + /* get a row */ + row = *cp++ ; + /* skip if dead */ + if (ROW_IS_DEAD (row)) + { + continue ; + } + /* compact the column */ + *new_cp++ = row ; + /* add row's external degree */ + score += Row [row].shared1.degree - 1 ; + /* guard against integer overflow */ + score = MIN (score, n_col) ; + } + /* determine pruned column length */ + col_length = (Int) (new_cp - &A [Col [c].start]) ; + if (col_length == 0) + { + /* a newly-made null column (all rows in this col are "dense" */ + /* and have already been killed) */ + DEBUG1 (("Newly null killed: "ID"\n", c)) ; + Col [c].shared2.order = -- head [CMEMBER (c)] ; + --n_col2 ; + dead_cols [CMEMBER (c)] ++ ; + nnewlyempty_col++ ; + KILL_PRINCIPAL_COL (c) ; + } + else + { + /* set column length and set score */ + ASSERT (score >= 0) ; + ASSERT (score <= n_col) ; + Col [c].length = col_length ; + Col [c].shared2.score = score ; + } + } + DEBUG1 (("ccolamd: Dense, null, and newly-null columns killed: "ID"\n", + n_col-n_col2)) ; + + /* At this point, all empty rows and columns are dead. All live columns */ + /* are "clean" (containing no dead rows) and simplicial (no supercolumns */ + /* yet). Rows may contain dead columns, but all live rows contain at */ + /* least one live column. */ + +#ifndef NDEBUG + debug_count = 0 ; +#endif + + /* clear the hash buckets */ + for (c = 0 ; c <= n_col ; c++) + { + head [c] = EMPTY ; + } + +#ifndef NDEBUG + debug_structures (n_row, n_col, Row, Col, A, cmember, cset_start) ; +#endif + + /* === Return number of remaining columns, and max row degree =========== */ + + *p_n_col2 = n_col2 ; + *p_n_row2 = n_row2 ; + *p_max_deg = max_deg ; + *p_ndense_row = ndense_row ; + *p_nempty_row = nempty_row ; /* original empty rows */ + *p_nnewlyempty_row = nnewlyempty_row ; + *p_ndense_col = ndense_col ; + *p_nempty_col = nempty_col ; /* original empty cols */ + *p_nnewlyempty_col = nnewlyempty_col ; +} + + +/* ========================================================================== */ +/* === find_ordering ======================================================== */ +/* ========================================================================== */ + +/* + * Order the principal columns of the supercolumn form of the matrix + * (no supercolumns on input). Uses a minimum approximate column minimum + * degree ordering method. Not user-callable. + */ + +PRIVATE Int find_ordering /* return the number of garbage collections */ +( + /* === Parameters ======================================================= */ + + Int n_row, /* number of rows of A */ + Int n_col, /* number of columns of A */ + Int Alen, /* size of A, 2*nnz + n_col or larger */ + CColamd_Row Row [ ], /* of size n_row+1 */ + CColamd_Col Col [ ], /* of size n_col+1 */ + Int A [ ], /* column form and row form of A */ + Int head [ ], /* of size n_col+1 */ +#ifndef NDEBUG + Int n_col2, /* Remaining columns to order */ +#endif + Int max_deg, /* Maximum row degree */ + Int pfree, /* index of first free slot (2*nnz on entry) */ + Int cset [ ], /* constraint set of A */ + Int cset_start [ ], /* pointer to the start of every cset */ +#ifndef NDEBUG + Int n_cset, /* number of csets */ +#endif + Int cmember [ ], /* col -> cset mapping */ + Int Front_npivcol [ ], + Int Front_nrows [ ], + Int Front_ncols [ ], + Int Front_parent [ ], + Int Front_cols [ ], + Int *p_nfr, /* number of fronts */ + Int aggressive, + Int InFront [ ], + Int order_for_lu +) +{ + /* === Local variables ================================================== */ + + Int k ; /* current pivot ordering step */ + Int pivot_col ; /* current pivot column */ + Int *cp ; /* a column pointer */ + Int *rp ; /* a row pointer */ + Int pivot_row ; /* current pivot row */ + Int *new_cp ; /* modified column pointer */ + Int *new_rp ; /* modified row pointer */ + Int pivot_row_start ; /* pointer to start of pivot row */ + Int pivot_row_degree ; /* number of columns in pivot row */ + Int pivot_row_length ; /* number of supercolumns in pivot row */ + Int pivot_col_score ; /* score of pivot column */ + Int needed_memory ; /* free space needed for pivot row */ + Int *cp_end ; /* pointer to the end of a column */ + Int *rp_end ; /* pointer to the end of a row */ + Int row ; /* a row index */ + Int col ; /* a column index */ + Int max_score ; /* maximum possible score */ + Int cur_score ; /* score of current column */ + unsigned Int hash ; /* hash value for supernode detection */ + Int head_column ; /* head of hash bucket */ + Int first_col ; /* first column in hash bucket */ + Int tag_mark ; /* marker value for mark array */ + Int row_mark ; /* Row [row].shared2.mark */ + Int set_difference ; /* set difference size of row with pivot row */ + Int min_score ; /* smallest column score */ + Int col_thickness ; /* "thickness" (no. of columns in a supercol) */ + Int max_mark ; /* maximum value of tag_mark */ + Int pivot_col_thickness ; /* number of columns represented by pivot col */ + Int prev_col ; /* Used by Dlist operations. */ + Int next_col ; /* Used by Dlist operations. */ + Int ngarbage ; /* number of garbage collections performed */ + Int current_set ; /* consraint set that is being ordered */ + Int score ; /* score of a column */ + Int colstart ; /* pointer to first column in current cset */ + Int colend ; /* pointer to last column in current cset */ + Int deadcol ; /* number of dense & null columns in a cset */ + +#ifndef NDEBUG + Int debug_d ; /* debug loop counter */ + Int debug_step = 0 ; /* debug loop counter */ + Int cols_thickness = 0 ; /* the thickness of the columns in current */ + /* cset degreelist and in pivot row pattern. */ +#endif + + Int pivot_row_thickness ; /* number of rows represented by pivot row */ + Int nfr = 0 ; /* number of fronts */ + Int child ; + + /* === Initialization and clear mark ==================================== */ + + max_mark = Int_MAX - n_col ; /* Int_MAX defined in */ + tag_mark = clear_mark (0, max_mark, n_row, Row) ; + min_score = 0 ; + ngarbage = 0 ; + current_set = -1 ; + deadcol = 0 ; + DEBUG1 (("ccolamd: Ordering, n_col2="ID"\n", n_col2)) ; + + for (row = 0 ; row < n_row ; row++) + { + InFront [row] = EMPTY ; + } + + /* === Order the columns ================================================ */ + + for (k = 0 ; k < n_col ; /* 'k' is incremented below */) + { + + /* make sure degree list isn't empty */ + ASSERT (min_score >= 0) ; + ASSERT (min_score <= n_col) ; + ASSERT (head [min_score] >= EMPTY) ; + +#ifndef NDEBUG + for (debug_d = 0 ; debug_d < min_score ; debug_d++) + { + ASSERT (head [debug_d] == EMPTY) ; + } +#endif + + /* Initialize the degree list with columns from next non-empty cset */ + + while ((k+deadcol) == cset_start [current_set+1]) + { + current_set++ ; + DEBUG1 (("\n\n\n============ CSET: "ID"\n", current_set)) ; + k += deadcol ; /* jump to start of next cset */ + deadcol = 0 ; /* reset dead column count */ + + ASSERT ((current_set == n_cset) == (k == n_col)) ; + + /* return if all columns are ordered. */ + if (k == n_col) + { + *p_nfr = nfr ; + return (ngarbage) ; + } + +#ifndef NDEBUG + for (col = 0 ; col <= n_col ; col++) + { + ASSERT (head [col] == EMPTY) ; + } +#endif + + min_score = n_col ; + colstart = cset_start [current_set] ; + colend = cset_start [current_set+1] ; + + while (colstart < colend) + { + col = cset [colstart++] ; + + if (COL_IS_DEAD(col)) + { + DEBUG1 (("Column "ID" is dead\n", col)) ; + /* count dense and null columns */ + if (Col [col].shared2.order != EMPTY) + { + deadcol++ ; + } + continue ; + } + + /* only add principal columns in current set to degree lists */ + ASSERT (CMEMBER (col) == current_set) ; + + score = Col [col].shared2.score ; + DEBUG1 (("Column "ID" is alive, score "ID"\n", col, score)) ; + + ASSERT (min_score >= 0) ; + ASSERT (min_score <= n_col) ; + ASSERT (score >= 0) ; + ASSERT (score <= n_col) ; + ASSERT (head [score] >= EMPTY) ; + + /* now add this column to dList at proper score location */ + next_col = head [score] ; + Col [col].shared3.prev = EMPTY ; + Col [col].shared4.degree_next = next_col ; + + /* if there already was a column with the same score, set its */ + /* previous pointer to this new column */ + if (next_col != EMPTY) + { + Col [next_col].shared3.prev = col ; + } + head [score] = col ; + + /* see if this score is less than current min */ + min_score = MIN (min_score, score) ; + } + +#ifndef NDEBUG + DEBUG1 (("degree lists initialized \n")) ; + debug_deg_lists (n_row, n_col, Row, Col, head, min_score, + ((cset_start [current_set+1]-cset_start [current_set])-deadcol), + max_deg) ; +#endif + } + +#ifndef NDEBUG + if (debug_step % 100 == 0) + { + DEBUG2 (("\n... Step k: "ID" out of n_col2: "ID"\n", k, n_col2)) ; + } + else + { + DEBUG3 (("\n------Step k: "ID" out of n_col2: "ID"\n", k, n_col2)) ; + } + debug_step++ ; + DEBUG1 (("start of step k="ID": ", k)) ; + debug_deg_lists (n_row, n_col, Row, Col, head, + min_score, cset_start [current_set+1]-(k+deadcol), max_deg) ; + debug_matrix (n_row, n_col, Row, Col, A) ; +#endif + + /* === Select pivot column, and order it ============================ */ + + while (head [min_score] == EMPTY && min_score < n_col) + { + min_score++ ; + } + + pivot_col = head [min_score] ; + + ASSERT (pivot_col >= 0 && pivot_col <= n_col) ; + next_col = Col [pivot_col].shared4.degree_next ; + head [min_score] = next_col ; + if (next_col != EMPTY) + { + Col [next_col].shared3.prev = EMPTY ; + } + + ASSERT (COL_IS_ALIVE (pivot_col)) ; + + /* remember score for defrag check */ + pivot_col_score = Col [pivot_col].shared2.score ; + + /* the pivot column is the kth column in the pivot order */ + Col [pivot_col].shared2.order = k ; + + /* increment order count by column thickness */ + pivot_col_thickness = Col [pivot_col].shared1.thickness ; + k += pivot_col_thickness ; + ASSERT (pivot_col_thickness > 0) ; + DEBUG3 (("Pivot col: "ID" thick "ID"\n", pivot_col, + pivot_col_thickness)) ; + + /* === Garbage_collection, if necessary ============================= */ + + needed_memory = MIN (pivot_col_score, n_col - k) ; + if (pfree + needed_memory >= Alen) + { + pfree = garbage_collection (n_row, n_col, Row, Col, A, &A [pfree]) ; + ngarbage++ ; + /* after garbage collection we will have enough */ + ASSERT (pfree + needed_memory < Alen) ; + /* garbage collection has wiped out Row [ ].shared2.mark array */ + tag_mark = clear_mark (0, max_mark, n_row, Row) ; + +#ifndef NDEBUG + debug_matrix (n_row, n_col, Row, Col, A) ; +#endif + } + + /* === Compute pivot row pattern ==================================== */ + + /* get starting location for this new merged row */ + pivot_row_start = pfree ; + + /* initialize new row counts to zero */ + pivot_row_degree = 0 ; + pivot_row_thickness = 0 ; + + /* tag pivot column as having been visited so it isn't included */ + /* in merged pivot row */ + Col [pivot_col].shared1.thickness = -pivot_col_thickness ; + + /* pivot row is the union of all rows in the pivot column pattern */ + cp = &A [Col [pivot_col].start] ; + cp_end = cp + Col [pivot_col].length ; + while (cp < cp_end) + { + /* get a row */ + row = *cp++ ; + ASSERT (row >= 0 && row < n_row) ; + DEBUG4 (("Pivcol pattern "ID" "ID"\n", ROW_IS_ALIVE (row), row)) ; + /* skip if row is dead */ + if (ROW_IS_ALIVE (row)) + { + /* sum the thicknesses of all the rows */ + pivot_row_thickness += Row [row].thickness ; + + rp = &A [Row [row].start] ; + rp_end = rp + Row [row].length ; + while (rp < rp_end) + { + /* get a column */ + col = *rp++ ; + /* add the column, if alive and untagged */ + col_thickness = Col [col].shared1.thickness ; + if (col_thickness > 0 && COL_IS_ALIVE (col)) + { + /* tag column in pivot row */ + Col [col].shared1.thickness = -col_thickness ; + ASSERT (pfree < Alen) ; + /* place column in pivot row */ + A [pfree++] = col ; + pivot_row_degree += col_thickness ; + DEBUG4 (("\t\t\tNew live col in pivrow: "ID"\n",col)) ; + } +#ifndef NDEBUG + if (col_thickness < 0 && COL_IS_ALIVE (col)) + { + DEBUG4 (("\t\t\tOld live col in pivrow: "ID"\n",col)) ; + } +#endif + } + } + } + + /* pivot_row_thickness is the number of rows in frontal matrix */ + /* including both pivotal rows and nonpivotal rows */ + + /* clear tag on pivot column */ + Col [pivot_col].shared1.thickness = pivot_col_thickness ; + max_deg = MAX (max_deg, pivot_row_degree) ; + +#ifndef NDEBUG + DEBUG3 (("check2\n")) ; + debug_mark (n_row, Row, tag_mark, max_mark) ; +#endif + + /* === Kill all rows used to construct pivot row ==================== */ + + /* also kill pivot row, temporarily */ + cp = &A [Col [pivot_col].start] ; + cp_end = cp + Col [pivot_col].length ; + while (cp < cp_end) + { + /* may be killing an already dead row */ + row = *cp++ ; + DEBUG3 (("Kill row in pivot col: "ID"\n", row)) ; + ASSERT (row >= 0 && row < n_row) ; + if (ROW_IS_ALIVE (row)) + { + if (Row [row].front != EMPTY) + { + /* This row represents a frontal matrix. */ + /* Row [row].front is a child of current front */ + child = Row [row].front ; + Front_parent [child] = nfr ; + DEBUG1 (("Front "ID" => front "ID", normal\n", child, nfr)); + } + else + { + /* This is an original row. Keep track of which front + * is its parent in the row-merge tree. */ + InFront [row] = nfr ; + DEBUG1 (("Row "ID" => front "ID", normal\n", row, nfr)) ; + } + } + + KILL_ROW (row) ; + Row [row].thickness = 0 ; + } + + /* === Select a row index to use as the new pivot row =============== */ + + pivot_row_length = pfree - pivot_row_start ; + if (pivot_row_length > 0) + { + /* pick the "pivot" row arbitrarily (first row in col) */ + pivot_row = A [Col [pivot_col].start] ; + DEBUG3 (("Pivotal row is "ID"\n", pivot_row)) ; + } + else + { + /* there is no pivot row, since it is of zero length */ + pivot_row = EMPTY ; + ASSERT (pivot_row_length == 0) ; + } + ASSERT (Col [pivot_col].length > 0 || pivot_row_length == 0) ; + + /* === Approximate degree computation =============================== */ + + /* Here begins the computation of the approximate degree. The column */ + /* score is the sum of the pivot row "length", plus the size of the */ + /* set differences of each row in the column minus the pattern of the */ + /* pivot row itself. The column ("thickness") itself is also */ + /* excluded from the column score (we thus use an approximate */ + /* external degree). */ + + /* The time taken by the following code (compute set differences, and */ + /* add them up) is proportional to the size of the data structure */ + /* being scanned - that is, the sum of the sizes of each column in */ + /* the pivot row. Thus, the amortized time to compute a column score */ + /* is proportional to the size of that column (where size, in this */ + /* context, is the column "length", or the number of row indices */ + /* in that column). The number of row indices in a column is */ + /* monotonically non-decreasing, from the length of the original */ + /* column on input to colamd. */ + + /* === Compute set differences ====================================== */ + + DEBUG3 (("** Computing set differences phase. **\n")) ; + + /* pivot row is currently dead - it will be revived later. */ + + DEBUG3 (("Pivot row: ")) ; + /* for each column in pivot row */ + rp = &A [pivot_row_start] ; + rp_end = rp + pivot_row_length ; + while (rp < rp_end) + { + col = *rp++ ; + ASSERT (COL_IS_ALIVE (col) && col != pivot_col) ; + DEBUG3 (("Col: "ID"\n", col)) ; + + /* clear tags used to construct pivot row pattern */ + col_thickness = -Col [col].shared1.thickness ; + ASSERT (col_thickness > 0) ; + Col [col].shared1.thickness = col_thickness ; + + /* === Remove column from degree list =========================== */ + + /* only columns in current_set will be in degree list */ + if (CMEMBER (col) == current_set) + { +#ifndef NDEBUG + cols_thickness += col_thickness ; +#endif + cur_score = Col [col].shared2.score ; + prev_col = Col [col].shared3.prev ; + next_col = Col [col].shared4.degree_next ; + DEBUG3 ((" cur_score "ID" prev_col "ID" next_col "ID"\n", + cur_score, prev_col, next_col)) ; + ASSERT (cur_score >= 0) ; + ASSERT (cur_score <= n_col) ; + ASSERT (cur_score >= EMPTY) ; + if (prev_col == EMPTY) + { + head [cur_score] = next_col ; + } + else + { + Col [prev_col].shared4.degree_next = next_col ; + } + if (next_col != EMPTY) + { + Col [next_col].shared3.prev = prev_col ; + } + } + + /* === Scan the column ========================================== */ + + cp = &A [Col [col].start] ; + cp_end = cp + Col [col].length ; + while (cp < cp_end) + { + /* get a row */ + row = *cp++ ; + row_mark = Row [row].shared2.mark ; + /* skip if dead */ + if (ROW_IS_MARKED_DEAD (row_mark)) + { + continue ; + } + ASSERT (row != pivot_row) ; + set_difference = row_mark - tag_mark ; + /* check if the row has been seen yet */ + if (set_difference < 0) + { + ASSERT (Row [row].shared1.degree <= max_deg) ; + set_difference = Row [row].shared1.degree ; + } + /* subtract column thickness from this row's set difference */ + set_difference -= col_thickness ; + ASSERT (set_difference >= 0) ; + /* absorb this row if the set difference becomes zero */ + if (set_difference == 0 && aggressive) + { + DEBUG3 (("aggressive absorption. Row: "ID"\n", row)) ; + + if (Row [row].front != EMPTY) + { + /* Row [row].front is a child of current front. */ + child = Row [row].front ; + Front_parent [child] = nfr ; + DEBUG1 (("Front "ID" => front "ID", aggressive\n", + child, nfr)) ; + } + else + { + /* this is an original row. Keep track of which front + * assembles it, for the row-merge tree */ + InFront [row] = nfr ; + DEBUG1 (("Row "ID" => front "ID", aggressive\n", + row, nfr)) ; + } + + KILL_ROW (row) ; + + /* sum the thicknesses of all the rows */ + pivot_row_thickness += Row [row].thickness ; + Row [row].thickness = 0 ; + } + else + { + /* save the new mark */ + Row [row].shared2.mark = set_difference + tag_mark ; + } + } + } + +#ifndef NDEBUG + debug_deg_lists (n_row, n_col, Row, Col, head, min_score, + cset_start [current_set+1]-(k+deadcol)-(cols_thickness), + max_deg) ; + cols_thickness = 0 ; +#endif + + /* === Add up set differences for each column ======================= */ + + DEBUG3 (("** Adding set differences phase. **\n")) ; + + /* for each column in pivot row */ + rp = &A [pivot_row_start] ; + rp_end = rp + pivot_row_length ; + while (rp < rp_end) + { + /* get a column */ + col = *rp++ ; + ASSERT (COL_IS_ALIVE (col) && col != pivot_col) ; + hash = 0 ; + cur_score = 0 ; + cp = &A [Col [col].start] ; + /* compact the column */ + new_cp = cp ; + cp_end = cp + Col [col].length ; + + DEBUG4 (("Adding set diffs for Col: "ID".\n", col)) ; + + while (cp < cp_end) + { + /* get a row */ + row = *cp++ ; + ASSERT (row >= 0 && row < n_row) ; + row_mark = Row [row].shared2.mark ; + /* skip if dead */ + if (ROW_IS_MARKED_DEAD (row_mark)) + { + DEBUG4 ((" Row "ID", dead\n", row)) ; + continue ; + } + DEBUG4 ((" Row "ID", set diff "ID"\n", row, row_mark-tag_mark)); + ASSERT (row_mark >= tag_mark) ; + /* compact the column */ + *new_cp++ = row ; + /* compute hash function */ + hash += row ; + /* add set difference */ + cur_score += row_mark - tag_mark ; + /* integer overflow... */ + cur_score = MIN (cur_score, n_col) ; + } + + /* recompute the column's length */ + Col [col].length = (Int) (new_cp - &A [Col [col].start]) ; + + /* === Further mass elimination ================================= */ + + if (Col [col].length == 0 && CMEMBER (col) == current_set) + { + DEBUG4 (("further mass elimination. Col: "ID"\n", col)) ; + /* nothing left but the pivot row in this column */ + KILL_PRINCIPAL_COL (col) ; + pivot_row_degree -= Col [col].shared1.thickness ; + ASSERT (pivot_row_degree >= 0) ; + /* order it */ + Col [col].shared2.order = k ; + /* increment order count by column thickness */ + k += Col [col].shared1.thickness ; + pivot_col_thickness += Col [col].shared1.thickness ; + /* add to column list of front */ +#ifndef NDEBUG + DEBUG1 (("Mass")) ; + dump_super (col, Col, n_col) ; +#endif + Col [Col [col].lastcol].nextcol = Front_cols [nfr] ; + Front_cols [nfr] = col ; + } + else + { + /* === Prepare for supercolumn detection ==================== */ + + DEBUG4 (("Preparing supercol detection for Col: "ID".\n", col)); + + /* save score so far */ + Col [col].shared2.score = cur_score ; + + /* add column to hash table, for supercolumn detection */ + hash %= n_col + 1 ; + + DEBUG4 ((" Hash = "ID", n_col = "ID".\n", hash, n_col)) ; + ASSERT (((Int) hash) <= n_col) ; + + head_column = head [hash] ; + if (head_column > EMPTY) + { + /* degree list "hash" is non-empty, use prev (shared3) of */ + /* first column in degree list as head of hash bucket */ + first_col = Col [head_column].shared3.headhash ; + Col [head_column].shared3.headhash = col ; + } + else + { + /* degree list "hash" is empty, use head as hash bucket */ + first_col = - (head_column + 2) ; + head [hash] = - (col + 2) ; + } + Col [col].shared4.hash_next = first_col ; + + /* save hash function in Col [col].shared3.hash */ + Col [col].shared3.hash = (Int) hash ; + ASSERT (COL_IS_ALIVE (col)) ; + } + } + + /* The approximate external column degree is now computed. */ + + /* === Supercolumn detection ======================================== */ + + DEBUG3 (("** Supercolumn detection phase. **\n")) ; + + detect_super_cols ( +#ifndef NDEBUG + n_col, Row, +#endif + Col, A, head, pivot_row_start, pivot_row_length, cmember) ; + + /* === Kill the pivotal column ====================================== */ + + DEBUG1 ((" KILLING column detect supercols "ID" \n", pivot_col)) ; + KILL_PRINCIPAL_COL (pivot_col) ; + + /* add columns to column list of front */ +#ifndef NDEBUG + DEBUG1 (("Pivot")) ; + dump_super (pivot_col, Col, n_col) ; +#endif + Col [Col [pivot_col].lastcol].nextcol = Front_cols [nfr] ; + Front_cols [nfr] = pivot_col ; + + /* === Clear mark =================================================== */ + + tag_mark = clear_mark (tag_mark+max_deg+1, max_mark, n_row, Row) ; + +#ifndef NDEBUG + DEBUG3 (("check3\n")) ; + debug_mark (n_row, Row, tag_mark, max_mark) ; +#endif + + /* === Finalize the new pivot row, and column scores ================ */ + + DEBUG3 (("** Finalize scores phase. **\n")) ; + + /* for each column in pivot row */ + rp = &A [pivot_row_start] ; + /* compact the pivot row */ + new_rp = rp ; + rp_end = rp + pivot_row_length ; + while (rp < rp_end) + { + col = *rp++ ; + /* skip dead columns */ + if (COL_IS_DEAD (col)) + { + continue ; + } + *new_rp++ = col ; + /* add new pivot row to column */ + A [Col [col].start + (Col [col].length++)] = pivot_row ; + + /* retrieve score so far and add on pivot row's degree. */ + /* (we wait until here for this in case the pivot */ + /* row's degree was reduced due to mass elimination). */ + cur_score = Col [col].shared2.score + pivot_row_degree ; + + /* calculate the max possible score as the number of */ + /* external columns minus the 'k' value minus the */ + /* columns thickness */ + max_score = n_col - k - Col [col].shared1.thickness ; + + /* make the score the external degree of the union-of-rows */ + cur_score -= Col [col].shared1.thickness ; + + /* make sure score is less or equal than the max score */ + cur_score = MIN (cur_score, max_score) ; + ASSERT (cur_score >= 0) ; + + /* store updated score */ + Col [col].shared2.score = cur_score ; + + /* === Place column back in degree list ========================= */ + + if (CMEMBER (col) == current_set) + { + ASSERT (min_score >= 0) ; + ASSERT (min_score <= n_col) ; + ASSERT (cur_score >= 0) ; + ASSERT (cur_score <= n_col) ; + ASSERT (head [cur_score] >= EMPTY) ; + next_col = head [cur_score] ; + Col [col].shared4.degree_next = next_col ; + Col [col].shared3.prev = EMPTY ; + if (next_col != EMPTY) + { + Col [next_col].shared3.prev = col ; + } + head [cur_score] = col ; + /* see if this score is less than current min */ + min_score = MIN (min_score, cur_score) ; + } + else + { + Col [col].shared4.degree_next = EMPTY ; + Col [col].shared3.prev = EMPTY ; + } + } + +#ifndef NDEBUG + debug_deg_lists (n_row, n_col, Row, Col, head, + min_score, cset_start [current_set+1]-(k+deadcol), max_deg) ; +#endif + + /* frontal matrix can have more pivot cols than pivot rows for */ + /* singular matrices. */ + + /* number of candidate pivot columns */ + Front_npivcol [nfr] = pivot_col_thickness ; + + /* all rows (not just size of contrib. block) */ + Front_nrows [nfr] = pivot_row_thickness ; + + /* all cols */ + Front_ncols [nfr] = pivot_col_thickness + pivot_row_degree ; + + Front_parent [nfr] = EMPTY ; + + pivot_row_thickness -= pivot_col_thickness ; + DEBUG1 (("Front "ID" Pivot_row_thickness after pivot cols elim: "ID"\n", + nfr, pivot_row_thickness)) ; + pivot_row_thickness = MAX (0, pivot_row_thickness) ; + + /* === Resurrect the new pivot row ================================== */ + + if ((pivot_row_degree > 0 && pivot_row_thickness > 0 && (order_for_lu)) + || (pivot_row_degree > 0 && (!order_for_lu))) + { + /* update pivot row length to reflect any cols that were killed */ + /* during super-col detection and mass elimination */ + Row [pivot_row].start = pivot_row_start ; + Row [pivot_row].length = (Int) (new_rp - &A[pivot_row_start]) ; + Row [pivot_row].shared1.degree = pivot_row_degree ; + Row [pivot_row].shared2.mark = 0 ; + Row [pivot_row].thickness = pivot_row_thickness ; + Row [pivot_row].front = nfr ; + /* pivot row is no longer dead */ + DEBUG1 (("Resurrect Pivot_row "ID" deg: "ID"\n", + pivot_row, pivot_row_degree)) ; + } + +#ifndef NDEBUG + DEBUG1 (("Front "ID" : "ID" "ID" "ID" ", nfr, + Front_npivcol [nfr], Front_nrows [nfr], Front_ncols [nfr])) ; + DEBUG1 ((" cols:[ ")) ; + debug_d = 0 ; + for (col = Front_cols [nfr] ; col != EMPTY ; col = Col [col].nextcol) + { + DEBUG1 ((" "ID, col)) ; + ASSERT (col >= 0 && col < n_col) ; + ASSERT (COL_IS_DEAD (col)) ; + debug_d++ ; + ASSERT (debug_d <= pivot_col_thickness) ; + } + ASSERT (debug_d == pivot_col_thickness) ; + DEBUG1 ((" ]\n ")) ; +#endif + nfr++ ; /* one more front */ + } + + /* === All principal columns have now been ordered ====================== */ + + *p_nfr = nfr ; + return (ngarbage) ; +} + + +/* ========================================================================== */ +/* === detect_super_cols ==================================================== */ +/* ========================================================================== */ + +/* + * Detects supercolumns by finding matches between columns in the hash buckets. + * Check amongst columns in the set A [row_start ... row_start + row_length-1]. + * The columns under consideration are currently *not* in the degree lists, + * and have already been placed in the hash buckets. + * + * The hash bucket for columns whose hash function is equal to h is stored + * as follows: + * + * if head [h] is >= 0, then head [h] contains a degree list, so: + * + * head [h] is the first column in degree bucket h. + * Col [head [h]].headhash gives the first column in hash bucket h. + * + * otherwise, the degree list is empty, and: + * + * -(head [h] + 2) is the first column in hash bucket h. + * + * For a column c in a hash bucket, Col [c].shared3.prev is NOT a "previous + * column" pointer. Col [c].shared3.hash is used instead as the hash number + * for that column. The value of Col [c].shared4.hash_next is the next column + * in the same hash bucket. + * + * Assuming no, or "few" hash collisions, the time taken by this routine is + * linear in the sum of the sizes (lengths) of each column whose score has + * just been computed in the approximate degree computation. + * Not user-callable. + */ + +PRIVATE void detect_super_cols +( + /* === Parameters ======================================================= */ + +#ifndef NDEBUG + /* these two parameters are only needed when debugging is enabled: */ + Int n_col, /* number of columns of A */ + CColamd_Row Row [ ], /* of size n_row+1 */ +#endif + + CColamd_Col Col [ ], /* of size n_col+1 */ + Int A [ ], /* row indices of A */ + Int head [ ], /* head of degree lists and hash buckets */ + Int row_start, /* pointer to set of columns to check */ + Int row_length, /* number of columns to check */ + Int cmember [ ] /* col -> cset mapping */ +) +{ + /* === Local variables ================================================== */ + + Int hash ; /* hash value for a column */ + Int *rp ; /* pointer to a row */ + Int c ; /* a column index */ + Int super_c ; /* column index of the column to absorb into */ + Int *cp1 ; /* column pointer for column super_c */ + Int *cp2 ; /* column pointer for column c */ + Int length ; /* length of column super_c */ + Int prev_c ; /* column preceding c in hash bucket */ + Int i ; /* loop counter */ + Int *rp_end ; /* pointer to the end of the row */ + Int col ; /* a column index in the row to check */ + Int head_column ; /* first column in hash bucket or degree list */ + Int first_col ; /* first column in hash bucket */ + + /* === Consider each column in the row ================================== */ + + rp = &A [row_start] ; + rp_end = rp + row_length ; + while (rp < rp_end) + { + col = *rp++ ; + if (COL_IS_DEAD (col)) + { + continue ; + } + + /* get hash number for this column */ + hash = Col [col].shared3.hash ; + ASSERT (hash <= n_col) ; + + /* === Get the first column in this hash bucket ===================== */ + + head_column = head [hash] ; + if (head_column > EMPTY) + { + first_col = Col [head_column].shared3.headhash ; + } + else + { + first_col = - (head_column + 2) ; + } + + /* === Consider each column in the hash bucket ====================== */ + + for (super_c = first_col ; super_c != EMPTY ; + super_c = Col [super_c].shared4.hash_next) + { + ASSERT (COL_IS_ALIVE (super_c)) ; + ASSERT (Col [super_c].shared3.hash == hash) ; + length = Col [super_c].length ; + + /* prev_c is the column preceding column c in the hash bucket */ + prev_c = super_c ; + + /* === Compare super_c with all columns after it ================ */ + + for (c = Col [super_c].shared4.hash_next ; + c != EMPTY ; c = Col [c].shared4.hash_next) + { + ASSERT (c != super_c) ; + ASSERT (COL_IS_ALIVE (c)) ; + ASSERT (Col [c].shared3.hash == hash) ; + + /* not identical if lengths or scores are different, */ + /* or if in different constraint sets */ + if (Col [c].length != length || + Col [c].shared2.score != Col [super_c].shared2.score + || CMEMBER (c) != CMEMBER (super_c)) + { + prev_c = c ; + continue ; + } + + /* compare the two columns */ + cp1 = &A [Col [super_c].start] ; + cp2 = &A [Col [c].start] ; + + for (i = 0 ; i < length ; i++) + { + /* the columns are "clean" (no dead rows) */ + ASSERT (ROW_IS_ALIVE (*cp1)) ; + ASSERT (ROW_IS_ALIVE (*cp2)) ; + /* row indices will same order for both supercols, */ + /* no gather scatter nessasary */ + if (*cp1++ != *cp2++) + { + break ; + } + } + + /* the two columns are different if the for-loop "broke" */ + /* super columns should belong to the same constraint set */ + if (i != length) + { + prev_c = c ; + continue ; + } + + /* === Got it! two columns are identical =================== */ + + ASSERT (Col [c].shared2.score == Col [super_c].shared2.score) ; + + Col [super_c].shared1.thickness += Col [c].shared1.thickness ; + Col [c].shared1.parent = super_c ; + KILL_NON_PRINCIPAL_COL (c) ; + /* order c later, in order_children() */ + Col [c].shared2.order = EMPTY ; + /* remove c from hash bucket */ + Col [prev_c].shared4.hash_next = Col [c].shared4.hash_next ; + + /* add c to end of list of super_c */ + ASSERT (Col [super_c].lastcol >= 0) ; + ASSERT (Col [super_c].lastcol < n_col) ; + Col [Col [super_c].lastcol].nextcol = c ; + Col [super_c].lastcol = Col [c].lastcol ; +#ifndef NDEBUG + /* dump the supercolumn */ + DEBUG1 (("Super")) ; + dump_super (super_c, Col, n_col) ; +#endif + } + } + + /* === Empty this hash bucket ======================================= */ + + if (head_column > EMPTY) + { + /* corresponding degree list "hash" is not empty */ + Col [head_column].shared3.headhash = EMPTY ; + } + else + { + /* corresponding degree list "hash" is empty */ + head [hash] = EMPTY ; + } + } +} + + +/* ========================================================================== */ +/* === garbage_collection =================================================== */ +/* ========================================================================== */ + +/* + * Defragments and compacts columns and rows in the workspace A. Used when + * all avaliable memory has been used while performing row merging. Returns + * the index of the first free position in A, after garbage collection. The + * time taken by this routine is linear is the size of the array A, which is + * itself linear in the number of nonzeros in the input matrix. + * Not user-callable. + */ + +PRIVATE Int garbage_collection /* returns the new value of pfree */ +( + /* === Parameters ======================================================= */ + + Int n_row, /* number of rows */ + Int n_col, /* number of columns */ + CColamd_Row Row [ ], /* row info */ + CColamd_Col Col [ ], /* column info */ + Int A [ ], /* A [0 ... Alen-1] holds the matrix */ + Int *pfree /* &A [0] ... pfree is in use */ +) +{ + /* === Local variables ================================================== */ + + Int *psrc ; /* source pointer */ + Int *pdest ; /* destination pointer */ + Int j ; /* counter */ + Int r ; /* a row index */ + Int c ; /* a column index */ + Int length ; /* length of a row or column */ + +#ifndef NDEBUG + Int debug_rows ; + DEBUG2 (("Defrag..\n")) ; + for (psrc = &A[0] ; psrc < pfree ; psrc++) ASSERT (*psrc >= 0) ; + debug_rows = 0 ; +#endif + + /* === Defragment the columns =========================================== */ + + pdest = &A[0] ; + for (c = 0 ; c < n_col ; c++) + { + if (COL_IS_ALIVE (c)) + { + psrc = &A [Col [c].start] ; + + /* move and compact the column */ + ASSERT (pdest <= psrc) ; + Col [c].start = (Int) (pdest - &A [0]) ; + length = Col [c].length ; + for (j = 0 ; j < length ; j++) + { + r = *psrc++ ; + if (ROW_IS_ALIVE (r)) + { + *pdest++ = r ; + } + } + Col [c].length = (Int) (pdest - &A [Col [c].start]) ; + } + } + + /* === Prepare to defragment the rows =================================== */ + + for (r = 0 ; r < n_row ; r++) + { + if (ROW_IS_DEAD (r) || (Row [r].length == 0)) + { + /* This row is already dead, or is of zero length. Cannot compact + * a row of zero length, so kill it. NOTE: in the current version, + * there are no zero-length live rows. Kill the row (for the first + * time, or again) just to be safe. */ + KILL_ROW (r) ; + } + else + { + /* save first column index in Row [r].shared2.first_column */ + psrc = &A [Row [r].start] ; + Row [r].shared2.first_column = *psrc ; + ASSERT (ROW_IS_ALIVE (r)) ; + /* flag the start of the row with the one's complement of row */ + *psrc = ONES_COMPLEMENT (r) ; +#ifndef NDEBUG + debug_rows++ ; +#endif + } + } + + /* === Defragment the rows ============================================== */ + + psrc = pdest ; + while (psrc < pfree) + { + /* find a negative number ... the start of a row */ + if (*psrc++ < 0) + { + psrc-- ; + /* get the row index */ + r = ONES_COMPLEMENT (*psrc) ; + ASSERT (r >= 0 && r < n_row) ; + /* restore first column index */ + *psrc = Row [r].shared2.first_column ; + ASSERT (ROW_IS_ALIVE (r)) ; + + /* move and compact the row */ + ASSERT (pdest <= psrc) ; + Row [r].start = (Int) (pdest - &A [0]) ; + length = Row [r].length ; + for (j = 0 ; j < length ; j++) + { + c = *psrc++ ; + if (COL_IS_ALIVE (c)) + { + *pdest++ = c ; + } + } + Row [r].length = (Int) (pdest - &A [Row [r].start]) ; +#ifndef NDEBUG + debug_rows-- ; +#endif + } + } + + /* ensure we found all the rows */ + ASSERT (debug_rows == 0) ; + + /* === Return the new value of pfree ==================================== */ + + return ((Int) (pdest - &A [0])) ; +} + + +/* ========================================================================== */ +/* === clear_mark =========================================================== */ +/* ========================================================================== */ + +/* + * Clears the Row [ ].shared2.mark array, and returns the new tag_mark. + * Return value is the new tag_mark. Not user-callable. + */ + +PRIVATE Int clear_mark /* return the new value for tag_mark */ +( + /* === Parameters ======================================================= */ + + Int tag_mark, /* new value of tag_mark */ + Int max_mark, /* max allowed value of tag_mark */ + + Int n_row, /* number of rows in A */ + CColamd_Row Row [ ] /* Row [0 ... n_row-1].shared2.mark is set to zero */ +) +{ + /* === Local variables ================================================== */ + + Int r ; + + if (tag_mark <= 0 || tag_mark >= max_mark) + { + for (r = 0 ; r < n_row ; r++) + { + if (ROW_IS_ALIVE (r)) + { + Row [r].shared2.mark = 0 ; + } + } + tag_mark = 1 ; + } + + return (tag_mark) ; +} + + +/* ========================================================================== */ +/* === print_report ========================================================= */ +/* ========================================================================== */ + +/* No printing occurs if NPRINT is defined at compile time. */ + +PRIVATE void print_report +( + char *method, + Int stats [CCOLAMD_STATS] +) +{ + + Int i1, i2, i3 ; + + PRINTF (("\n%s version %d.%d, %s: ", method, + CCOLAMD_MAIN_VERSION, CCOLAMD_SUB_VERSION, CCOLAMD_DATE)) ; + + if (!stats) + { + PRINTF (("No statistics available.\n")) ; + return ; + } + + i1 = stats [CCOLAMD_INFO1] ; + i2 = stats [CCOLAMD_INFO2] ; + i3 = stats [CCOLAMD_INFO3] ; + + if (stats [CCOLAMD_STATUS] >= 0) + { + PRINTF(("OK. ")) ; + } + else + { + PRINTF(("ERROR. ")) ; + } + + switch (stats [CCOLAMD_STATUS]) + { + + case CCOLAMD_OK_BUT_JUMBLED: + + PRINTF(("Matrix has unsorted or duplicate row indices.\n")) ; + + PRINTF(("%s: duplicate or out-of-order row indices: "ID"\n", + method, i3)) ; + + PRINTF(("%s: last seen duplicate or out-of-order row: "ID"\n", + method, INDEX (i2))) ; + + PRINTF(("%s: last seen in column: "ID"", + method, INDEX (i1))) ; + + /* no break - fall through to next case instead */ + + case CCOLAMD_OK: + + PRINTF(("\n")) ; + + PRINTF(("%s: number of dense or empty rows ignored: "ID"\n", + method, stats [CCOLAMD_DENSE_ROW])) ; + + PRINTF(("%s: number of dense or empty columns ignored: "ID"\n", + method, stats [CCOLAMD_DENSE_COL])) ; + + PRINTF(("%s: number of garbage collections performed: "ID"\n", + method, stats [CCOLAMD_DEFRAG_COUNT])) ; + break ; + + case CCOLAMD_ERROR_A_not_present: + + PRINTF(("Array A (row indices of matrix) not present.\n")) ; + break ; + + case CCOLAMD_ERROR_p_not_present: + + PRINTF(("Array p (column pointers for matrix) not present.\n")) ; + break ; + + case CCOLAMD_ERROR_nrow_negative: + + PRINTF(("Invalid number of rows ("ID").\n", i1)) ; + break ; + + case CCOLAMD_ERROR_ncol_negative: + + PRINTF(("Invalid number of columns ("ID").\n", i1)) ; + break ; + + case CCOLAMD_ERROR_nnz_negative: + + PRINTF(("Invalid number of nonzero entries ("ID").\n", i1)) ; + break ; + + case CCOLAMD_ERROR_p0_nonzero: + + PRINTF(("Invalid column pointer, p [0] = "ID", must be 0.\n", i1)) ; + break ; + + case CCOLAMD_ERROR_A_too_small: + + PRINTF(("Array A too small.\n")) ; + PRINTF((" Need Alen >= "ID", but given only Alen = "ID".\n", + i1, i2)) ; + break ; + + case CCOLAMD_ERROR_col_length_negative: + + PRINTF(("Column "ID" has a negative number of entries ("ID").\n", + INDEX (i1), i2)) ; + break ; + + case CCOLAMD_ERROR_row_index_out_of_bounds: + + PRINTF(("Row index (row "ID") out of bounds ("ID" to "ID") in" + "column "ID".\n", INDEX (i2), INDEX (0), INDEX (i3-1), + INDEX (i1))) ; + break ; + + case CCOLAMD_ERROR_out_of_memory: + + PRINTF(("Out of memory.\n")) ; + break ; + + case CCOLAMD_ERROR_invalid_cmember: + + PRINTF(("cmember invalid\n")) ; + break ; + } +} + + +/* ========================================================================= */ +/* === "Expert" routines =================================================== */ +/* ========================================================================= */ + +/* The following routines are visible outside this routine, but are not meant + * to be called by the user. They are meant for a future version of UMFPACK, + * to replace UMFPACK internal routines with a similar name. + */ + + +/* ========================================================================== */ +/* === CCOLAMD_apply_order ================================================== */ +/* ========================================================================== */ + +/* + * Apply post-ordering of supernodal elimination tree. + */ + +GLOBAL void CCOLAMD_apply_order +( + Int Front [ ], /* of size nn on input, size nfr on output */ + const Int Order [ ], /* Order [i] = k, i in the range 0..nn-1, + * and k in the range 0..nfr-1, means that node + * i is the kth node in the postordered tree. */ + Int Temp [ ], /* workspace of size nfr */ + Int nn, /* nodes are numbered in the range 0..nn-1 */ + Int nfr /* the number of nodes actually in use */ +) +{ + Int i, k ; + for (i = 0 ; i < nn ; i++) + { + k = Order [i] ; + ASSERT (k >= EMPTY && k < nfr) ; + if (k != EMPTY) + { + Temp [k] = Front [i] ; + } + } + + for (k = 0 ; k < nfr ; k++) + { + Front [k] = Temp [k] ; + } +} + + +/* ========================================================================== */ +/* === CCOLAMD_fsize ======================================================== */ +/* ========================================================================== */ + +/* Determine the largest frontal matrix size for each subtree. + * Only required to sort the children of each + * node prior to postordering the column elimination tree. */ + +GLOBAL void CCOLAMD_fsize +( + Int nn, + Int Fsize [ ], + Int Fnrows [ ], + Int Fncols [ ], + Int Parent [ ], + Int Npiv [ ] +) +{ + double dr, dc ; + Int j, parent, frsize, r, c ; + + for (j = 0 ; j < nn ; j++) + { + Fsize [j] = EMPTY ; + } + + /* ---------------------------------------------------------------------- */ + /* find max front size for tree rooted at node j, for each front j */ + /* ---------------------------------------------------------------------- */ + + DEBUG1 (("\n\n========================================FRONTS:\n")) ; + for (j = 0 ; j < nn ; j++) + { + if (Npiv [j] > 0) + { + /* this is a frontal matrix */ + parent = Parent [j] ; + r = Fnrows [j] ; + c = Fncols [j] ; + /* avoid integer overflow */ + dr = (double) r ; + dc = (double) c ; + frsize = (INT_OVERFLOW (dr * dc)) ? Int_MAX : (r * c) ; + DEBUG1 ((""ID" : npiv "ID" size "ID" parent "ID" ", + j, Npiv [j], frsize, parent)) ; + Fsize [j] = MAX (Fsize [j], frsize) ; + DEBUG1 (("Fsize [j = "ID"] = "ID"\n", j, Fsize [j])) ; + if (parent != EMPTY) + { + /* find the maximum frontsize of self and children */ + ASSERT (Npiv [parent] > 0) ; + ASSERT (parent > j) ; + Fsize [parent] = MAX (Fsize [parent], Fsize [j]) ; + DEBUG1 (("Fsize [parent = "ID"] = "ID"\n", + parent, Fsize [parent])); + } + } + } + DEBUG1 (("fsize done\n")) ; +} + + +/* ========================================================================= */ +/* === CCOLAMD_postorder =================================================== */ +/* ========================================================================= */ + +/* Perform a postordering (via depth-first search) of an assembly tree. */ + +GLOBAL void CCOLAMD_postorder +( + /* inputs, not modified on output: */ + Int nn, /* nodes are in the range 0..nn-1 */ + Int Parent [ ], /* Parent [j] is the parent of j, or EMPTY if root */ + Int Nv [ ], /* Nv [j] > 0 number of pivots represented by node j, + * or zero if j is not a node. */ + Int Fsize [ ], /* Fsize [j]: size of node j */ + + /* output, not defined on input: */ + Int Order [ ], /* output post-order */ + + /* workspaces of size nn: */ + Int Child [ ], + Int Sibling [ ], + Int Stack [ ], + Int Front_cols [ ], + + /* input, not modified on output: */ + Int cmember [ ] +) +{ + Int i, j, k, parent, frsize, f, fprev, maxfrsize, bigfprev, bigf, fnext ; + + for (j = 0 ; j < nn ; j++) + { + Child [j] = EMPTY ; + Sibling [j] = EMPTY ; + } + + /* --------------------------------------------------------------------- */ + /* place the children in link lists - bigger elements tend to be last */ + /* --------------------------------------------------------------------- */ + + for (j = nn-1 ; j >= 0 ; j--) + { + if (Nv [j] > 0) + { + /* this is an element */ + parent = Parent [j] ; + if (parent != EMPTY) + { + /* place the element in link list of the children its parent */ + /* bigger elements will tend to be at the end of the list */ + Sibling [j] = Child [parent] ; + if (CMEMBER (Front_cols[parent]) == CMEMBER (Front_cols[j])) + { + Child [parent] = j ; + } + } + } + } + +#ifndef NDEBUG + { + Int nels, ff, nchild ; + DEBUG1 (("\n\n================================ ccolamd_postorder:\n")); + nels = 0 ; + for (j = 0 ; j < nn ; j++) + { + if (Nv [j] > 0) + { + DEBUG1 ((""ID" : nels "ID" npiv "ID" size "ID + " parent "ID" maxfr "ID"\n", j, nels, + Nv [j], Fsize [j], Parent [j], Fsize [j])) ; + /* this is an element */ + /* dump the link list of children */ + nchild = 0 ; + DEBUG1 ((" Children: ")) ; + for (ff = Child [j] ; ff != EMPTY ; ff = Sibling [ff]) + { + DEBUG1 ((ID" ", ff)) ; + nchild++ ; + ASSERT (nchild < nn) ; + } + DEBUG1 (("\n")) ; + parent = Parent [j] ; + nels++ ; + } + } + } +#endif + + /* --------------------------------------------------------------------- */ + /* place the largest child last in the list of children for each node */ + /* --------------------------------------------------------------------- */ + + for (i = 0 ; i < nn ; i++) + { + if (Nv [i] > 0 && Child [i] != EMPTY) + { + +#ifndef NDEBUG + Int nchild ; + DEBUG1 (("Before partial sort, element "ID"\n", i)) ; + nchild = 0 ; + for (f = Child [i] ; f != EMPTY ; f = Sibling [f]) + { + DEBUG1 ((" f: "ID" size: "ID"\n", f, Fsize [f])) ; + nchild++ ; + } +#endif + + /* find the biggest element in the child list */ + fprev = EMPTY ; + maxfrsize = EMPTY ; + bigfprev = EMPTY ; + bigf = EMPTY ; + for (f = Child [i] ; f != EMPTY ; f = Sibling [f]) + { + frsize = Fsize [f] ; + if (frsize >= maxfrsize) + { + /* this is the biggest seen so far */ + maxfrsize = frsize ; + bigfprev = fprev ; + bigf = f ; + } + fprev = f ; + } + + fnext = Sibling [bigf] ; + + DEBUG1 (("bigf "ID" maxfrsize "ID" bigfprev "ID" fnext "ID + " fprev " ID"\n", bigf, maxfrsize, bigfprev, fnext, fprev)) ; + + if (fnext != EMPTY) + { + /* if fnext is EMPTY then bigf is already at the end of list */ + + if (bigfprev == EMPTY) + { + /* delete bigf from the element of the list */ + Child [i] = fnext ; + } + else + { + /* delete bigf from the middle of the list */ + Sibling [bigfprev] = fnext ; + } + + /* put bigf at the end of the list */ + Sibling [bigf] = EMPTY ; + Sibling [fprev] = bigf ; + } + +#ifndef NDEBUG + DEBUG1 (("After partial sort, element "ID"\n", i)) ; + for (f = Child [i] ; f != EMPTY ; f = Sibling [f]) + { + DEBUG1 ((" "ID" "ID"\n", f, Fsize [f])) ; + nchild-- ; + } +#endif + } + } + + /* --------------------------------------------------------------------- */ + /* postorder the assembly tree */ + /* --------------------------------------------------------------------- */ + + for (i = 0 ; i < nn ; i++) + { + Order [i] = EMPTY ; + } + + k = 0 ; + + for (i = 0 ; i < nn ; i++) + { + if ((Parent [i] == EMPTY + || (CMEMBER (Front_cols [Parent [i]]) != CMEMBER (Front_cols [i]))) + && Nv [i] > 0) + { + DEBUG1 (("Root of assembly tree "ID"\n", i)) ; + k = CCOLAMD_post_tree (i, k, Child, Sibling, Order, Stack) ; + } + } +} + + +/* ========================================================================= */ +/* === CCOLAMD_post_tree =================================================== */ +/* ========================================================================= */ + +/* Post-ordering of a supernodal column elimination tree. */ + +GLOBAL Int CCOLAMD_post_tree +( + Int root, /* root of the tree */ + Int k, /* start numbering at k */ + Int Child [ ], /* input argument of size nn, undefined on + * output. Child [i] is the head of a link + * list of all nodes that are children of node + * i in the tree. */ + const Int Sibling [ ], /* input argument of size nn, not modified. + * If f is a node in the link list of the + * children of node i, then Sibling [f] is the + * next child of node i. + */ + Int Order [ ], /* output order, of size nn. Order [i] = k + * if node i is the kth node of the reordered + * tree. */ + Int Stack [ ] /* workspace of size nn */ +) +{ + Int f, head, h, i ; + +#if 0 + /* --------------------------------------------------------------------- */ + /* recursive version (Stack [ ] is not used): */ + /* --------------------------------------------------------------------- */ + + /* this is simple, but can cause stack overflow if nn is large */ + i = root ; + for (f = Child [i] ; f != EMPTY ; f = Sibling [f]) + { + k = CCOLAMD_post_tree (f, k, Child, Sibling, Order, Stack, nn) ; + } + Order [i] = k++ ; + return (k) ; +#endif + + /* --------------------------------------------------------------------- */ + /* non-recursive version, using an explicit stack */ + /* --------------------------------------------------------------------- */ + + /* push root on the stack */ + head = 0 ; + Stack [0] = root ; + + while (head >= 0) + { + /* get head of stack */ + i = Stack [head] ; + DEBUG1 (("head of stack "ID" \n", i)) ; + + if (Child [i] != EMPTY) + { + /* the children of i are not yet ordered */ + /* push each child onto the stack in reverse order */ + /* so that small ones at the head of the list get popped first */ + /* and the biggest one at the end of the list gets popped last */ + for (f = Child [i] ; f != EMPTY ; f = Sibling [f]) + { + head++ ; + } + h = head ; + for (f = Child [i] ; f != EMPTY ; f = Sibling [f]) + { + ASSERT (h > 0) ; + Stack [h--] = f ; + DEBUG1 (("push "ID" on stack\n", f)) ; + } + ASSERT (Stack [h] == i) ; + + /* delete child list so that i gets ordered next time we see it */ + Child [i] = EMPTY ; + } + else + { + /* the children of i (if there were any) are already ordered */ + /* remove i from the stack and order it. Front i is kth front */ + head-- ; + DEBUG1 (("pop "ID" order "ID"\n", i, k)) ; + Order [i] = k++ ; + } + +#ifndef NDEBUG + DEBUG1 (("\nStack:")) ; + for (h = head ; h >= 0 ; h--) + { + Int j = Stack [h] ; + DEBUG1 ((" "ID, j)) ; + } + DEBUG1 (("\n\n")) ; +#endif + + } + return (k) ; +} + + + +/* ========================================================================== */ +/* === CCOLAMD debugging routines =========================================== */ +/* ========================================================================== */ + +/* When debugging is disabled, the remainder of this file is ignored. */ + +#ifndef NDEBUG + + +/* ========================================================================== */ +/* === debug_structures ===================================================== */ +/* ========================================================================== */ + +/* + * At this point, all empty rows and columns are dead. All live columns + * are "clean" (containing no dead rows) and simplicial (no supercolumns + * yet). Rows may contain dead columns, but all live rows contain at + * least one live column. + */ + +PRIVATE void debug_structures +( + /* === Parameters ======================================================= */ + + Int n_row, + Int n_col, + CColamd_Row Row [ ], + CColamd_Col Col [ ], + Int A [ ], + Int cmember [ ], + Int cset_start [ ] +) +{ + /* === Local variables ================================================== */ + + Int i ; + Int c ; + Int *cp ; + Int *cp_end ; + Int len ; + Int score ; + Int r ; + Int *rp ; + Int *rp_end ; + Int deg ; + Int cs ; + + /* === Check A, Row, and Col ============================================ */ + + for (c = 0 ; c < n_col ; c++) + { + if (COL_IS_ALIVE (c)) + { + len = Col [c].length ; + score = Col [c].shared2.score ; + DEBUG4 (("initial live col %5d %5d %5d\n", c, len, score)) ; + ASSERT (len > 0) ; + ASSERT (score >= 0) ; + ASSERT (Col [c].shared1.thickness == 1) ; + cp = &A [Col [c].start] ; + cp_end = cp + len ; + while (cp < cp_end) + { + r = *cp++ ; + ASSERT (ROW_IS_ALIVE (r)) ; + } + } + else + { + i = Col [c].shared2.order ; + cs = CMEMBER (c) ; + ASSERT (i >= cset_start [cs] && i < cset_start [cs+1]) ; + } + } + + for (r = 0 ; r < n_row ; r++) + { + if (ROW_IS_ALIVE (r)) + { + i = 0 ; + len = Row [r].length ; + deg = Row [r].shared1.degree ; + ASSERT (len > 0) ; + ASSERT (deg > 0) ; + rp = &A [Row [r].start] ; + rp_end = rp + len ; + while (rp < rp_end) + { + c = *rp++ ; + if (COL_IS_ALIVE (c)) + { + i++ ; + } + } + ASSERT (i > 0) ; + } + } +} + + +/* ========================================================================== */ +/* === debug_deg_lists ====================================================== */ +/* ========================================================================== */ + +/* + * Prints the contents of the degree lists. Counts the number of columns + * in the degree list and compares it to the total it should have. Also + * checks the row degrees. + */ + +PRIVATE void debug_deg_lists +( + /* === Parameters ======================================================= */ + + Int n_row, + Int n_col, + CColamd_Row Row [ ], + CColamd_Col Col [ ], + Int head [ ], + Int min_score, + Int should, + Int max_deg +) + +{ + /* === Local variables ================================================== */ + + Int deg ; + Int col ; + Int have ; + Int row ; + + /* === Check the degree lists =========================================== */ + + if (n_col > 10000 && ccolamd_debug <= 0) + { + return ; + } + have = 0 ; + DEBUG4 (("Degree lists: "ID"\n", min_score)) ; + for (deg = 0 ; deg <= n_col ; deg++) + { + col = head [deg] ; + if (col == EMPTY) + { + continue ; + } + DEBUG4 (("%d:", deg)) ; + ASSERT (Col [col].shared3.prev == EMPTY) ; + while (col != EMPTY) + { + DEBUG4 ((" "ID"", col)) ; + have += Col [col].shared1.thickness ; + ASSERT (COL_IS_ALIVE (col)) ; + col = Col [col].shared4.degree_next ; + } + DEBUG4 (("\n")) ; + } + DEBUG4 (("should "ID" have "ID"\n", should, have)) ; + ASSERT (should == have) ; + + /* === Check the row degrees ============================================ */ + + if (n_row > 10000 && ccolamd_debug <= 0) + { + return ; + } + for (row = 0 ; row < n_row ; row++) + { + if (ROW_IS_ALIVE (row)) + { + ASSERT (Row [row].shared1.degree <= max_deg) ; + } + } +} + + +/* ========================================================================== */ +/* === debug_mark =========================================================== */ +/* ========================================================================== */ + +/* + * Ensures that the tag_mark is less that the maximum and also ensures that + * each entry in the mark array is less than the tag mark. + */ + +PRIVATE void debug_mark +( + /* === Parameters ======================================================= */ + + Int n_row, + CColamd_Row Row [ ], + Int tag_mark, + Int max_mark +) +{ + /* === Local variables ================================================== */ + + Int r ; + + /* === Check the Row marks ============================================== */ + + ASSERT (tag_mark > 0 && tag_mark <= max_mark) ; + if (n_row > 10000 && ccolamd_debug <= 0) + { + return ; + } + for (r = 0 ; r < n_row ; r++) + { + ASSERT (Row [r].shared2.mark < tag_mark) ; + } +} + + +/* ========================================================================== */ +/* === debug_matrix ========================================================= */ +/* ========================================================================== */ + +/* Prints out the contents of the columns and the rows. */ + +PRIVATE void debug_matrix +( + /* === Parameters ======================================================= */ + + Int n_row, + Int n_col, + CColamd_Row Row [ ], + CColamd_Col Col [ ], + Int A [ ] +) +{ + /* === Local variables ================================================== */ + + Int r ; + Int c ; + Int *rp ; + Int *rp_end ; + Int *cp ; + Int *cp_end ; + + /* === Dump the rows and columns of the matrix ========================== */ + + if (ccolamd_debug < 3) + { + return ; + } + DEBUG3 (("DUMP MATRIX:\n")) ; + for (r = 0 ; r < n_row ; r++) + { + DEBUG3 (("Row "ID" alive? "ID"\n", r, ROW_IS_ALIVE (r))) ; + if (ROW_IS_DEAD (r)) + { + continue ; + } + + DEBUG3 (("start "ID" length "ID" degree "ID"\nthickness "ID"\n", + Row [r].start, Row [r].length, Row [r].shared1.degree, + Row [r].thickness)) ; + + rp = &A [Row [r].start] ; + rp_end = rp + Row [r].length ; + while (rp < rp_end) + { + c = *rp++ ; + DEBUG4 ((" "ID" col "ID"\n", COL_IS_ALIVE (c), c)) ; + } + } + + for (c = 0 ; c < n_col ; c++) + { + DEBUG3 (("Col "ID" alive? "ID"\n", c, COL_IS_ALIVE (c))) ; + if (COL_IS_DEAD (c)) + { + continue ; + } + DEBUG3 (("start "ID" length "ID" shared1 "ID" shared2 "ID"\n", + Col [c].start, Col [c].length, + Col [c].shared1.thickness, Col [c].shared2.score)) ; + cp = &A [Col [c].start] ; + cp_end = cp + Col [c].length ; + while (cp < cp_end) + { + r = *cp++ ; + DEBUG4 ((" "ID" row "ID"\n", ROW_IS_ALIVE (r), r)) ; + } + } +} + + +/* ========================================================================== */ +/* === dump_super =========================================================== */ +/* ========================================================================== */ + +PRIVATE void dump_super +( + Int super_c, + CColamd_Col Col [ ], + Int n_col +) +{ + Int col, ncols ; + + DEBUG1 ((" =[ ")) ; + ncols = 0 ; + for (col = super_c ; col != EMPTY ; col = Col [col].nextcol) + { + DEBUG1 ((" "ID, col)) ; + ASSERT (col >= 0 && col < n_col) ; + if (col != super_c) + { + ASSERT (COL_IS_DEAD (col)) ; + } + if (Col [col].nextcol == EMPTY) + { + ASSERT (col == Col [super_c].lastcol) ; + } + ncols++ ; + ASSERT (ncols <= Col [super_c].shared1.thickness) ; + } + ASSERT (ncols == Col [super_c].shared1.thickness) ; + DEBUG1 (("]\n")) ; +} + + +/* ========================================================================== */ +/* === ccolamd_get_debug ==================================================== */ +/* ========================================================================== */ + +PRIVATE void ccolamd_get_debug +( + char *method +) +{ + FILE *debug_file ; + ccolamd_debug = 0 ; /* no debug printing */ + + /* Read debug info from the debug file. */ + debug_file = fopen ("debug", "r") ; + if (debug_file) + { + (void) fscanf (debug_file, ""ID"", &ccolamd_debug) ; + (void) fclose (debug_file) ; + } + + DEBUG0 ((":")) ; + DEBUG1 (("%s: debug version, D = "ID" (THIS WILL BE SLOW!)\n", + method, ccolamd_debug)) ; + DEBUG1 ((" Debug printing level: "ID"\n", ccolamd_debug)) ; +} + +#endif diff --git a/gtsam/3rdparty/CCOLAMD/Source/ccolamd_global.c b/gtsam/3rdparty/CCOLAMD/Source/ccolamd_global.c new file mode 100644 index 000000000..d43985126 --- /dev/null +++ b/gtsam/3rdparty/CCOLAMD/Source/ccolamd_global.c @@ -0,0 +1,25 @@ +/* ========================================================================== */ +/* === ccolamd_global.c ===================================================== */ +/* ========================================================================== */ + +/* ---------------------------------------------------------------------------- + * CCOLAMD Copyright (C), Univ. of Florida. Authors: Timothy A. Davis, + * Sivasankaran Rajamanickam, and Stefan Larimore + * See License.txt for the Version 2.1 of the GNU Lesser General Public License + * http://www.cise.ufl.edu/research/sparse + * -------------------------------------------------------------------------- */ + +/* Global variables for CCOLAMD */ + +#ifndef NPRINT +#ifdef MATLAB_MEX_FILE +#include "mex.h" +int (*ccolamd_printf) (const char *, ...) = mexPrintf ; +#else +#include +int (*ccolamd_printf) (const char *, ...) = printf ; +#endif +#else +int (*ccolamd_printf) (const char *, ...) = ((void *) 0) ; +#endif + diff --git a/gtsam/3rdparty/Eigen/CMakeLists.txt b/gtsam/3rdparty/Eigen/CMakeLists.txt new file mode 100644 index 000000000..db571727e --- /dev/null +++ b/gtsam/3rdparty/Eigen/CMakeLists.txt @@ -0,0 +1,393 @@ +project(Eigen) + +cmake_minimum_required(VERSION 2.6.2) + +# guard against in-source builds + +if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + 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. ") +endif() + +# guard against bad build-type strings + +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") +endif() + +string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_tolower) +if( NOT cmake_build_type_tolower STREQUAL "debug" + AND NOT cmake_build_type_tolower STREQUAL "release" + AND NOT cmake_build_type_tolower STREQUAL "relwithdebinfo") + message(FATAL_ERROR "Unknown build type \"${CMAKE_BUILD_TYPE}\". Allowed values are Debug, Release, RelWithDebInfo (case-insensitive).") +endif() + + +############################################################################# +# retrieve version infomation # +############################################################################# + +# automatically parse the version number +file(READ "${PROJECT_SOURCE_DIR}/Eigen/src/Core/util/Macros.h" _eigen_version_header) +string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen_world_version_match "${_eigen_version_header}") +set(EIGEN_WORLD_VERSION "${CMAKE_MATCH_1}") +string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen_major_version_match "${_eigen_version_header}") +set(EIGEN_MAJOR_VERSION "${CMAKE_MATCH_1}") +string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen_minor_version_match "${_eigen_version_header}") +set(EIGEN_MINOR_VERSION "${CMAKE_MATCH_1}") +set(EIGEN_VERSION_NUMBER ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION}) + +# if the mercurial program is absent, this will leave the EIGEN_HG_CHANGESET string empty, +# but won't stop CMake. +execute_process(COMMAND hg tip -R ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE EIGEN_HGTIP_OUTPUT) +execute_process(COMMAND hg branch -R ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE EIGEN_BRANCH_OUTPUT) + +# if this is the default (aka development) branch, extract the mercurial changeset number from the hg tip output... +if(EIGEN_BRANCH_OUTPUT MATCHES "default") +string(REGEX MATCH "^changeset: *[0-9]*:([0-9;a-f]+).*" EIGEN_HG_CHANGESET_MATCH "${EIGEN_HGTIP_OUTPUT}") +set(EIGEN_HG_CHANGESET "${CMAKE_MATCH_1}") +endif(EIGEN_BRANCH_OUTPUT MATCHES "default") +#...and show it next to the version number +if(EIGEN_HG_CHANGESET) + set(EIGEN_VERSION "${EIGEN_VERSION_NUMBER} (mercurial changeset ${EIGEN_HG_CHANGESET})") +else(EIGEN_HG_CHANGESET) + set(EIGEN_VERSION "${EIGEN_VERSION_NUMBER}") +endif(EIGEN_HG_CHANGESET) + + +include(CheckCXXCompilerFlag) + +set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) + +############################################################################# +# find how to link to the standard libraries # +############################################################################# + +find_package(StandardMathLibrary) + +set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "") + +if(NOT STANDARD_MATH_LIBRARY_FOUND) + + message(FATAL_ERROR + "Can't link to the standard math library. Please report to the Eigen developers, telling them about your platform.") + +else() + + if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) + set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO} ${STANDARD_MATH_LIBRARY}") + else() + set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "${STANDARD_MATH_LIBRARY}") + endif() + +endif() + +if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) + message(STATUS "Standard libraries to link to explicitly: ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}") +else() + message(STATUS "Standard libraries to link to explicitly: none") +endif() + +option(EIGEN_BUILD_BTL "Build benchmark suite" OFF) +if(NOT WIN32) + option(EIGEN_BUILD_PKGCONFIG "Build pkg-config .pc file for Eigen" ON) +endif(NOT WIN32) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +option(EIGEN_SPLIT_LARGE_TESTS "Split large tests into smaller executables" ON) + +option(EIGEN_DEFAULT_TO_ROW_MAJOR "Use row-major as default matrix storage order" OFF) +if(EIGEN_DEFAULT_TO_ROW_MAJOR) + add_definitions("-DEIGEN_DEFAULT_TO_ROW_MAJOR") +endif() + +add_definitions("-DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS") + +if(CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fexceptions -fno-check-new -fno-common -fstrict-aliasing") + set(CMAKE_CXX_FLAGS_DEBUG "-g3") + set(CMAKE_CXX_FLAGS_RELEASE "-g0 -O2") + + check_cxx_compiler_flag("-Wno-variadic-macros" COMPILER_SUPPORT_WNOVARIADICMACRO) + if(COMPILER_SUPPORT_WNOVARIADICMACRO) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-variadic-macros") + endif() + + check_cxx_compiler_flag("-Wextra" COMPILER_SUPPORT_WEXTRA) + if(COMPILER_SUPPORT_WEXTRA) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") + endif() + + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic") + + option(EIGEN_TEST_SSE2 "Enable/Disable SSE2 in tests/examples" OFF) + if(EIGEN_TEST_SSE2) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2") + message(STATUS "Enabling SSE2 in tests/examples") + endif() + + option(EIGEN_TEST_SSE3 "Enable/Disable SSE3 in tests/examples" OFF) + if(EIGEN_TEST_SSE3) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse3") + message(STATUS "Enabling SSE3 in tests/examples") + endif() + + option(EIGEN_TEST_SSSE3 "Enable/Disable SSSE3 in tests/examples" OFF) + if(EIGEN_TEST_SSSE3) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3") + message(STATUS "Enabling SSSE3 in tests/examples") + endif() + + option(EIGEN_TEST_SSE4_1 "Enable/Disable SSE4.1 in tests/examples" OFF) + if(EIGEN_TEST_SSE4_1) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1") + message(STATUS "Enabling SSE4.1 in tests/examples") + endif() + + option(EIGEN_TEST_SSE4_2 "Enable/Disable SSE4.2 in tests/examples" OFF) + if(EIGEN_TEST_SSE4_2) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2") + message(STATUS "Enabling SSE4.2 in tests/examples") + endif() + + option(EIGEN_TEST_ALTIVEC "Enable/Disable AltiVec in tests/examples" OFF) + if(EIGEN_TEST_ALTIVEC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maltivec -mabi=altivec") + message(STATUS "Enabling AltiVec in tests/examples") + endif() + + option(EIGEN_TEST_NEON "Enable/Disable Neon in tests/examples" OFF) + if(EIGEN_TEST_NEON) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfloat-abi=softfp -mfpu=neon -mcpu=cortex-a8") + message(STATUS "Enabling NEON in tests/examples") + endif() + + check_cxx_compiler_flag("-fopenmp" COMPILER_SUPPORT_OPENMP) + if(COMPILER_SUPPORT_OPENMP) + option(EIGEN_TEST_OPENMP "Enable/Disable OpenMP in tests/examples" OFF) + if(EIGEN_TEST_OPENMP) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp") + message(STATUS "Enabling OpenMP in tests/examples") + endif() + endif() + +endif(CMAKE_COMPILER_IS_GNUCXX) + +if(MSVC) + # C4127 - conditional expression is constant + # C4714 - marked as __forceinline not inlined (I failed to deactivate it selectively) + # We can disable this warning in the unit tests since it is clear that it occurs + # because we are oftentimes returning objects that have a destructor or may + # throw exceptions - in particular in the unit tests we are throwing extra many + # exceptions to cover indexing errors. + # C4505 - unreferenced local function has been removed (impossible to deactive selectively) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /wd4127 /wd4505 /wd4714") + + # replace all /Wx by /W4 + string(REGEX REPLACE "/W[0-9]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + + check_cxx_compiler_flag("/openmp" COMPILER_SUPPORT_OPENMP) + if(COMPILER_SUPPORT_OPENMP) + option(EIGEN_TEST_OPENMP "Enable/Disable OpenMP in tests/examples" OFF) + if(EIGEN_TEST_OPENMP) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp") + message(STATUS "Enabling OpenMP in tests/examples") + endif() + endif() + + option(EIGEN_TEST_SSE2 "Enable/Disable SSE2 in tests/examples" OFF) + if(EIGEN_TEST_SSE2) + if(NOT CMAKE_CL_64) + # arch is not supported on 64 bit systems, SSE is enabled automatically. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2") + endif(NOT CMAKE_CL_64) + message(STATUS "Enabling SSE2 in tests/examples") + endif(EIGEN_TEST_SSE2) +endif(MSVC) + +option(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION "Disable explicit vectorization in tests/examples" OFF) +option(EIGEN_TEST_X87 "Force using X87 instructions. Implies no vectorization." OFF) +option(EIGEN_TEST_32BIT "Force generating 32bit code." OFF) + +if(EIGEN_TEST_X87) + set(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION ON) + if(CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=387") + message(STATUS "Forcing use of x87 instructions in tests/examples") + else() + message(STATUS "EIGEN_TEST_X87 ignored on your compiler") + endif() +endif() + +if(EIGEN_TEST_32BIT) + if(CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") + message(STATUS "Forcing generation of 32-bit code in tests/examples") + else() + message(STATUS "EIGEN_TEST_32BIT ignored on your compiler") + endif() +endif() + +if(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION) + add_definitions(-DEIGEN_DONT_VECTORIZE=1) + message(STATUS "Disabling vectorization in tests/examples") +endif() + +option(EIGEN_TEST_NO_EXPLICIT_ALIGNMENT "Disable explicit alignment (hence vectorization) in tests/examples" OFF) +if(EIGEN_TEST_NO_EXPLICIT_ALIGNMENT) + add_definitions(-DEIGEN_DONT_ALIGN=1) + message(STATUS "Disabling alignment in tests/examples") +endif() + +option(EIGEN_TEST_C++0x "Enables all C++0x features." OFF) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + +# the user modifiable install path for header files +set(EIGEN_INCLUDE_INSTALL_DIR ${EIGEN_INCLUDE_INSTALL_DIR} CACHE PATH "The directory where we install the header files (optional)") + +# set the internal install path for header files which depends on wether the user modifiable +# EIGEN_INCLUDE_INSTALL_DIR has been set by the user or not. +if(EIGEN_INCLUDE_INSTALL_DIR) + set(INCLUDE_INSTALL_DIR + ${EIGEN_INCLUDE_INSTALL_DIR} + CACHE INTERNAL + "The directory where we install the header files (internal)" + ) +else() + set(INCLUDE_INSTALL_DIR + "${CMAKE_INSTALL_PREFIX}/include/eigen3" + CACHE INTERNAL + "The directory where we install the header files (internal)" + ) +endif() + +# similar to set_target_properties but append the property instead of overwriting it +macro(ei_add_target_property target prop value) + + get_target_property(previous ${target} ${prop}) + # if the property wasn't previously set, ${previous} is now "previous-NOTFOUND" which cmake allows catching with plain if() + if(NOT previous) + set(previous "") + endif(NOT previous) + set_target_properties(${target} PROPERTIES ${prop} "${previous} ${value}") +endmacro(ei_add_target_property) + +install(FILES + signature_of_eigen3_matrix_library + DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel + ) + +if(EIGEN_BUILD_PKGCONFIG) + configure_file(eigen3.pc.in eigen3.pc) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eigen3.pc + DESTINATION share/pkgconfig + ) +endif(EIGEN_BUILD_PKGCONFIG) + +add_subdirectory(Eigen) + +add_subdirectory(doc EXCLUDE_FROM_ALL) + +add_custom_target(buildtests) +add_custom_target(check COMMAND "ctest") +add_dependencies(check buildtests) + +# CMake/Ctest does not allow us to change the build command, +# so we have to workaround by directly editing the generated DartConfiguration.tcl file +# save CMAKE_MAKE_PROGRAM +set(CMAKE_MAKE_PROGRAM_SAVE ${CMAKE_MAKE_PROGRAM}) +# and set a fake one +set(CMAKE_MAKE_PROGRAM "@EIGEN_MAKECOMMAND_PLACEHOLDER@") + +include(CTest) +enable_testing() # must be called from the root CMakeLists, see man page +include(EigenTesting) +ei_init_testing() + +# overwrite default DartConfiguration.tcl +# The worarounds are different for each version of the MSVC IDE +if(MSVC_IDE) + if(MSVC_VERSION EQUAL 1600) # MSVC 2010 + set(EIGEN_MAKECOMMAND_PLACEHOLDER "${CMAKE_MAKE_PROGRAM_SAVE} buildtests.vcxproj /p:Configuration=\${CTEST_CONFIGURATION_TYPE} \n # ") + else() # MSVC 2008 (TODO check MSVC 2005) + set(EIGEN_MAKECOMMAND_PLACEHOLDER "${CMAKE_MAKE_PROGRAM_SAVE} /project buildtests") + endif() +else() + # for make and nmake + set(EIGEN_MAKECOMMAND_PLACEHOLDER "${CMAKE_MAKE_PROGRAM_SAVE} buildtests") +endif() + +configure_file(${CMAKE_BINARY_DIR}/DartConfiguration.tcl ${CMAKE_BINARY_DIR}/DartConfiguration.tcl) +# restore default CMAKE_MAKE_PROGRAM +set(CMAKE_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM_SAVE}) +# un-set temporary variables so that it is like they never existed. +# CMake 2.6.3 introduces the more logical unset() syntax for this. +set(CMAKE_MAKE_PROGRAM_SAVE) +set(EIGEN_MAKECOMMAND_PLACEHOLDER) + +configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake.in ${CMAKE_BINARY_DIR}/CTestCustom.cmake) + + +if(EIGEN_LEAVE_TEST_IN_ALL_TARGET) + add_subdirectory(test) # can't do EXCLUDE_FROM_ALL here, breaks CTest +else() + add_subdirectory(test EXCLUDE_FROM_ALL) +endif() + +if(NOT MSVC) + if(EIGEN_LEAVE_TEST_IN_ALL_TARGET) + add_subdirectory(blas) + add_subdirectory(lapack) + else() + add_subdirectory(blas EXCLUDE_FROM_ALL) + add_subdirectory(lapack EXCLUDE_FROM_ALL) + endif() +endif(NOT MSVC) + +add_subdirectory(unsupported) + +add_subdirectory(demos EXCLUDE_FROM_ALL) + +# must be after test and unsupported, for configuring buildtests.in +add_subdirectory(scripts EXCLUDE_FROM_ALL) + +# TODO: consider also replacing EIGEN_BUILD_BTL by a custom target "make btl"? +if(EIGEN_BUILD_BTL) + add_subdirectory(bench/btl EXCLUDE_FROM_ALL) +endif(EIGEN_BUILD_BTL) + +ei_testing_print_summary() + +message(STATUS "") +message(STATUS "Configured Eigen ${EIGEN_VERSION_NUMBER}") +message(STATUS "") + +option(EIGEN_FAILTEST "Enable failtests." OFF) +if(EIGEN_FAILTEST) + add_subdirectory(failtest) +endif() + +string(TOLOWER "${CMAKE_GENERATOR}" cmake_generator_tolower) +if(cmake_generator_tolower MATCHES "makefile") + message(STATUS "Some things you can do now:") + message(STATUS "--------------+--------------------------------------------------------------") + message(STATUS "Command | Description") + message(STATUS "--------------+--------------------------------------------------------------") + message(STATUS "make install | Install to ${CMAKE_INSTALL_PREFIX}. To change that:") + message(STATUS " | cmake . -DCMAKE_INSTALL_PREFIX=yourpath") + message(STATUS " | Eigen headers will then be installed to:") + message(STATUS " | ${INCLUDE_INSTALL_DIR}") + message(STATUS " | To install Eigen headers to a separate location, do:") + message(STATUS " | cmake . -DEIGEN_INCLUDE_INSTALL_DIR=yourpath") + message(STATUS "make doc | Generate the API documentation, requires Doxygen & LaTeX") + message(STATUS "make check | Build and run the unit-tests. Read this page:") + message(STATUS " | http://eigen.tuxfamily.org/index.php?title=Tests") + message(STATUS "make blas | Build BLAS library (not the same thing as Eigen)") + message(STATUS "--------------+--------------------------------------------------------------") +else() + message(STATUS "To build/run the unit tests, read this page:") + message(STATUS " http://eigen.tuxfamily.org/index.php?title=Tests") +endif() + +message(STATUS "") diff --git a/gtsam/3rdparty/Eigen/COPYING.GPL b/gtsam/3rdparty/Eigen/COPYING.GPL new file mode 100644 index 000000000..94a9ed024 --- /dev/null +++ b/gtsam/3rdparty/Eigen/COPYING.GPL @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/gtsam/3rdparty/Eigen/COPYING.LGPL b/gtsam/3rdparty/Eigen/COPYING.LGPL new file mode 100644 index 000000000..0e4fa8aaf --- /dev/null +++ b/gtsam/3rdparty/Eigen/COPYING.LGPL @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/gtsam/3rdparty/Eigen/CTestConfig.cmake b/gtsam/3rdparty/Eigen/CTestConfig.cmake new file mode 100644 index 000000000..7edc9d48d --- /dev/null +++ b/gtsam/3rdparty/Eigen/CTestConfig.cmake @@ -0,0 +1,13 @@ +## This file should be placed in the root directory of your project. +## Then modify the CMakeLists.txt file in the root directory of your +## project to incorporate the testing dashboard. +## # The following are required to uses Dart and the Cdash dashboard +## ENABLE_TESTING() +## INCLUDE(CTest) +set(CTEST_PROJECT_NAME "Eigen") +set(CTEST_NIGHTLY_START_TIME "00:00:00 UTC") + +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "eigen.tuxfamily.org") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=Eigen") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/gtsam/3rdparty/Eigen/CTestCustom.cmake.in b/gtsam/3rdparty/Eigen/CTestCustom.cmake.in new file mode 100644 index 000000000..3b2bacaa0 --- /dev/null +++ b/gtsam/3rdparty/Eigen/CTestCustom.cmake.in @@ -0,0 +1,4 @@ + +## A tribute to Dynamic! +set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS "33331") +set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS "33331") diff --git a/gtsam/3rdparty/Eigen/Eigen/Array b/gtsam/3rdparty/Eigen/Eigen/Array new file mode 100644 index 000000000..3d004fb69 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/Array @@ -0,0 +1,11 @@ +#ifndef EIGEN_ARRAY_MODULE_H +#define EIGEN_ARRAY_MODULE_H + +// include Core first to handle Eigen2 support macros +#include "Core" + +#ifndef EIGEN2_SUPPORT + #error The Eigen/Array header does no longer exist in Eigen3. All that functionality has moved to Eigen/Core. +#endif + +#endif // EIGEN_ARRAY_MODULE_H diff --git a/gtsam/3rdparty/Eigen/Eigen/CMakeLists.txt b/gtsam/3rdparty/Eigen/Eigen/CMakeLists.txt new file mode 100644 index 000000000..a92dd6f6c --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/CMakeLists.txt @@ -0,0 +1,19 @@ +include(RegexUtils) +test_escape_string_as_regex() + +file(GLOB Eigen_directory_files "*") + +escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + +foreach(f ${Eigen_directory_files}) + if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/src") + list(APPEND Eigen_directory_files_to_install ${f}) + endif() +endforeach(f ${Eigen_directory_files}) + +install(FILES + ${Eigen_directory_files_to_install} + DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel + ) + +add_subdirectory(src) diff --git a/gtsam/3rdparty/Eigen/Eigen/Cholesky b/gtsam/3rdparty/Eigen/Eigen/Cholesky new file mode 100644 index 000000000..53f7bf911 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/Cholesky @@ -0,0 +1,33 @@ +#ifndef EIGEN_CHOLESKY_MODULE_H +#define EIGEN_CHOLESKY_MODULE_H + +#include "Core" + +#include "src/Core/util/DisableStupidWarnings.h" + +namespace Eigen { + +/** \defgroup Cholesky_Module Cholesky module + * + * + * + * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices. + * Those decompositions are accessible via the following MatrixBase methods: + * - MatrixBase::llt(), + * - MatrixBase::ldlt() + * + * \code + * #include + * \endcode + */ + +#include "src/misc/Solve.h" +#include "src/Cholesky/LLT.h" +#include "src/Cholesky/LDLT.h" + +} // namespace Eigen + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_CHOLESKY_MODULE_H +/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/gtsam/3rdparty/Eigen/Eigen/Core b/gtsam/3rdparty/Eigen/Eigen/Core new file mode 100644 index 000000000..2ad4dee25 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/Core @@ -0,0 +1,367 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2007-2011 Benoit Jacob +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_CORE_H +#define EIGEN_CORE_H + +// first thing Eigen does: stop the compiler from committing suicide +#include "src/Core/util/DisableStupidWarnings.h" + +// then include this file where all our macros are defined. It's really important to do it first because +// it's where we do all the alignment settings (platform detection and honoring the user's will if he +// defined e.g. EIGEN_DONT_ALIGN) so it needs to be done before we do anything with vectorization. +#include "src/Core/util/Macros.h" + +// if alignment is disabled, then disable vectorization. Note: EIGEN_ALIGN is the proper check, it takes into +// account both the user's will (EIGEN_DONT_ALIGN) and our own platform checks +#if !EIGEN_ALIGN + #ifndef EIGEN_DONT_VECTORIZE + #define EIGEN_DONT_VECTORIZE + #endif +#endif + +#ifdef _MSC_VER + #include // for _aligned_malloc -- need it regardless of whether vectorization is enabled + #if (_MSC_VER >= 1500) // 2008 or later + // Remember that usage of defined() in a #define is undefined by the standard. + // a user reported that in 64-bit mode, MSVC doesn't care to define _M_IX86_FP. + #if (defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) || defined(_M_X64) + #define EIGEN_SSE2_ON_MSVC_2008_OR_LATER + #endif + #endif +#else + // Remember that usage of defined() in a #define is undefined by the standard + #if (defined __SSE2__) && ( (!defined __GNUC__) || EIGEN_GNUC_AT_LEAST(4,2) ) + #define EIGEN_SSE2_ON_NON_MSVC_BUT_NOT_OLD_GCC + #endif +#endif + +#ifndef EIGEN_DONT_VECTORIZE + + #if defined (EIGEN_SSE2_ON_NON_MSVC_BUT_NOT_OLD_GCC) || defined(EIGEN_SSE2_ON_MSVC_2008_OR_LATER) + + // Defines symbols for compile-time detection of which instructions are + // used. + // EIGEN_VECTORIZE_YY is defined if and only if the instruction set YY is used + #define EIGEN_VECTORIZE + #define EIGEN_VECTORIZE_SSE + #define EIGEN_VECTORIZE_SSE2 + + // Detect sse3/ssse3/sse4: + // gcc and icc defines __SSE3__, ... + // there is no way to know about this on msvc. You can define EIGEN_VECTORIZE_SSE* if you + // want to force the use of those instructions with msvc. + #ifdef __SSE3__ + #define EIGEN_VECTORIZE_SSE3 + #endif + #ifdef __SSSE3__ + #define EIGEN_VECTORIZE_SSSE3 + #endif + #ifdef __SSE4_1__ + #define EIGEN_VECTORIZE_SSE4_1 + #endif + #ifdef __SSE4_2__ + #define EIGEN_VECTORIZE_SSE4_2 + #endif + + // include files + + // This extern "C" works around a MINGW-w64 compilation issue + // https://sourceforge.net/tracker/index.php?func=detail&aid=3018394&group_id=202880&atid=983354 + // In essence, intrin.h is included by windows.h and also declares intrinsics (just as emmintrin.h etc. below do). + // However, intrin.h uses an extern "C" declaration, and g++ thus complains of duplicate declarations + // with conflicting linkage. The linkage for intrinsics doesn't matter, but at that stage the compiler doesn't know; + // so, to avoid compile errors when windows.h is included after Eigen/Core, ensure intrinsics are extern "C" here too. + // notice that since these are C headers, the extern "C" is theoretically needed anyways. + extern "C" { + #include + #include + #ifdef EIGEN_VECTORIZE_SSE3 + #include + #endif + #ifdef EIGEN_VECTORIZE_SSSE3 + #include + #endif + #ifdef EIGEN_VECTORIZE_SSE4_1 + #include + #endif + #ifdef EIGEN_VECTORIZE_SSE4_2 + #include + #endif + } // end extern "C" + #elif defined __ALTIVEC__ + #define EIGEN_VECTORIZE + #define EIGEN_VECTORIZE_ALTIVEC + #include + // We need to #undef all these ugly tokens defined in + // => use __vector instead of vector + #undef bool + #undef vector + #undef pixel + #elif defined __ARM_NEON__ + #define EIGEN_VECTORIZE + #define EIGEN_VECTORIZE_NEON + #include + #endif +#endif + +#if (defined _OPENMP) && (!defined EIGEN_DONT_PARALLELIZE) + #define EIGEN_HAS_OPENMP +#endif + +#ifdef EIGEN_HAS_OPENMP +#include +#endif + +// MSVC for windows mobile does not have the errno.h file +#if !(defined(_MSC_VER) && defined(_WIN32_WCE)) +#define EIGEN_HAS_ERRNO +#endif + +#ifdef EIGEN_HAS_ERRNO +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for CHAR_BIT +// for min/max: +#include + +// for outputting debug info +#ifdef EIGEN_DEBUG_ASSIGN +#include +#endif + +// required for __cpuid, needs to be included after cmath +#if defined(_MSC_VER) && (defined(_M_IX86)||defined(_M_X64)) + #include +#endif + +#if (defined(_CPPUNWIND) || defined(__EXCEPTIONS)) && !defined(EIGEN_NO_EXCEPTIONS) + #define EIGEN_EXCEPTIONS +#endif + +#ifdef EIGEN_EXCEPTIONS + #include +#endif + +// this needs to be done after all possible windows C header includes and before any Eigen source includes +// (system C++ includes are supposed to be able to deal with this already): +// windows.h defines min and max macros which would make Eigen fail to compile. +#if defined(min) || defined(max) +#error The preprocessor symbols 'min' or 'max' are defined. If you are compiling on Windows, do #define NOMINMAX to prevent windows.h from defining these symbols. +#endif + +// defined in bits/termios.h +#undef B0 + +/** \brief Namespace containing all symbols from the %Eigen library. */ +namespace Eigen { + +inline static const char *SimdInstructionSetsInUse(void) { +#if defined(EIGEN_VECTORIZE_SSE4_2) + return "SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2"; +#elif defined(EIGEN_VECTORIZE_SSE4_1) + return "SSE, SSE2, SSE3, SSSE3, SSE4.1"; +#elif defined(EIGEN_VECTORIZE_SSSE3) + return "SSE, SSE2, SSE3, SSSE3"; +#elif defined(EIGEN_VECTORIZE_SSE3) + return "SSE, SSE2, SSE3"; +#elif defined(EIGEN_VECTORIZE_SSE2) + return "SSE, SSE2"; +#elif defined(EIGEN_VECTORIZE_ALTIVEC) + return "AltiVec"; +#elif defined(EIGEN_VECTORIZE_NEON) + return "ARM NEON"; +#else + return "None"; +#endif +} + +#define STAGE10_FULL_EIGEN2_API 10 +#define STAGE20_RESOLVE_API_CONFLICTS 20 +#define STAGE30_FULL_EIGEN3_API 30 +#define STAGE40_FULL_EIGEN3_STRICTNESS 40 +#define STAGE99_NO_EIGEN2_SUPPORT 99 + +#if defined EIGEN2_SUPPORT_STAGE40_FULL_EIGEN3_STRICTNESS + #define EIGEN2_SUPPORT + #define EIGEN2_SUPPORT_STAGE STAGE40_FULL_EIGEN3_STRICTNESS +#elif defined EIGEN2_SUPPORT_STAGE30_FULL_EIGEN3_API + #define EIGEN2_SUPPORT + #define EIGEN2_SUPPORT_STAGE STAGE30_FULL_EIGEN3_API +#elif defined EIGEN2_SUPPORT_STAGE20_RESOLVE_API_CONFLICTS + #define EIGEN2_SUPPORT + #define EIGEN2_SUPPORT_STAGE STAGE20_RESOLVE_API_CONFLICTS +#elif defined EIGEN2_SUPPORT_STAGE10_FULL_EIGEN2_API + #define EIGEN2_SUPPORT + #define EIGEN2_SUPPORT_STAGE STAGE10_FULL_EIGEN2_API +#elif defined EIGEN2_SUPPORT + // default to stage 3, that's what it's always meant + #define EIGEN2_SUPPORT_STAGE30_FULL_EIGEN3_API + #define EIGEN2_SUPPORT_STAGE STAGE30_FULL_EIGEN3_API +#else + #define EIGEN2_SUPPORT_STAGE STAGE99_NO_EIGEN2_SUPPORT +#endif + +#ifdef EIGEN2_SUPPORT +#undef minor +#endif + +// we use size_t frequently and we'll never remember to prepend it with std:: everytime just to +// ensure QNX/QCC support +using std::size_t; +// gcc 4.6.0 wants std:: for ptrdiff_t +using std::ptrdiff_t; + +/** \defgroup Core_Module Core module + * This is the main module of Eigen providing dense matrix and vector support + * (both fixed and dynamic size) with all the features corresponding to a BLAS library + * and much more... + * + * \code + * #include + * \endcode + */ + +#include "src/Core/util/Constants.h" +#include "src/Core/util/ForwardDeclarations.h" +#include "src/Core/util/Meta.h" +#include "src/Core/util/XprHelper.h" +#include "src/Core/util/StaticAssert.h" +#include "src/Core/util/Memory.h" + +#include "src/Core/NumTraits.h" +#include "src/Core/MathFunctions.h" +#include "src/Core/GenericPacketMath.h" + +#if defined EIGEN_VECTORIZE_SSE + #include "src/Core/arch/SSE/PacketMath.h" + #include "src/Core/arch/SSE/MathFunctions.h" + #include "src/Core/arch/SSE/Complex.h" +#elif defined EIGEN_VECTORIZE_ALTIVEC + #include "src/Core/arch/AltiVec/PacketMath.h" + #include "src/Core/arch/AltiVec/Complex.h" +#elif defined EIGEN_VECTORIZE_NEON + #include "src/Core/arch/NEON/PacketMath.h" + #include "src/Core/arch/NEON/Complex.h" +#endif + +#include "src/Core/arch/Default/Settings.h" + +#include "src/Core/Functors.h" +#include "src/Core/DenseCoeffsBase.h" +#include "src/Core/DenseBase.h" +#include "src/Core/MatrixBase.h" +#include "src/Core/EigenBase.h" + +#ifndef EIGEN_PARSED_BY_DOXYGEN // work around Doxygen bug triggered by Assign.h r814874 + // at least confirmed with Doxygen 1.5.5 and 1.5.6 + #include "src/Core/Assign.h" +#endif + +#include "src/Core/util/BlasUtil.h" +#include "src/Core/DenseStorage.h" +#include "src/Core/NestByValue.h" +#include "src/Core/ForceAlignedAccess.h" +#include "src/Core/ReturnByValue.h" +#include "src/Core/NoAlias.h" +#include "src/Core/PlainObjectBase.h" +#include "src/Core/Matrix.h" +#include "src/Core/Array.h" +#include "src/Core/CwiseBinaryOp.h" +#include "src/Core/CwiseUnaryOp.h" +#include "src/Core/CwiseNullaryOp.h" +#include "src/Core/CwiseUnaryView.h" +#include "src/Core/SelfCwiseBinaryOp.h" +#include "src/Core/Dot.h" +#include "src/Core/StableNorm.h" +#include "src/Core/MapBase.h" +#include "src/Core/Stride.h" +#include "src/Core/Map.h" +#include "src/Core/Block.h" +#include "src/Core/VectorBlock.h" +#include "src/Core/Transpose.h" +#include "src/Core/DiagonalMatrix.h" +#include "src/Core/Diagonal.h" +#include "src/Core/DiagonalProduct.h" +#include "src/Core/PermutationMatrix.h" +#include "src/Core/Transpositions.h" +#include "src/Core/Redux.h" +#include "src/Core/Visitor.h" +#include "src/Core/Fuzzy.h" +#include "src/Core/IO.h" +#include "src/Core/Swap.h" +#include "src/Core/CommaInitializer.h" +#include "src/Core/Flagged.h" +#include "src/Core/ProductBase.h" +#include "src/Core/Product.h" +#include "src/Core/TriangularMatrix.h" +#include "src/Core/SelfAdjointView.h" +#include "src/Core/SolveTriangular.h" +#include "src/Core/products/Parallelizer.h" +#include "src/Core/products/CoeffBasedProduct.h" +#include "src/Core/products/GeneralBlockPanelKernel.h" +#include "src/Core/products/GeneralMatrixVector.h" +#include "src/Core/products/GeneralMatrixMatrix.h" +#include "src/Core/products/GeneralMatrixMatrixTriangular.h" +#include "src/Core/products/SelfadjointMatrixVector.h" +#include "src/Core/products/SelfadjointMatrixMatrix.h" +#include "src/Core/products/SelfadjointProduct.h" +#include "src/Core/products/SelfadjointRank2Update.h" +#include "src/Core/products/TriangularMatrixVector.h" +#include "src/Core/products/TriangularMatrixMatrix.h" +#include "src/Core/products/TriangularSolverMatrix.h" +#include "src/Core/products/TriangularSolverVector.h" +#include "src/Core/BandMatrix.h" + +#include "src/Core/BooleanRedux.h" +#include "src/Core/Select.h" +#include "src/Core/VectorwiseOp.h" +#include "src/Core/Random.h" +#include "src/Core/Replicate.h" +#include "src/Core/Reverse.h" +#include "src/Core/ArrayBase.h" +#include "src/Core/ArrayWrapper.h" + +} // namespace Eigen + +#include "src/Core/GlobalFunctions.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#ifdef EIGEN2_SUPPORT +#include "Eigen2Support" +#endif + +#endif // EIGEN_CORE_H diff --git a/gtsam/3rdparty/Eigen/Eigen/Dense b/gtsam/3rdparty/Eigen/Eigen/Dense new file mode 100644 index 000000000..5768910bd --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/Dense @@ -0,0 +1,7 @@ +#include "Core" +#include "LU" +#include "Cholesky" +#include "QR" +#include "SVD" +#include "Geometry" +#include "Eigenvalues" diff --git a/gtsam/3rdparty/Eigen/Eigen/Eigen b/gtsam/3rdparty/Eigen/Eigen/Eigen new file mode 100644 index 000000000..19b40ea4e --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/Eigen @@ -0,0 +1,2 @@ +#include "Dense" +//#include "Sparse" diff --git a/gtsam/3rdparty/Eigen/Eigen/Eigen2Support b/gtsam/3rdparty/Eigen/Eigen/Eigen2Support new file mode 100644 index 000000000..d96592a8d --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/Eigen2Support @@ -0,0 +1,82 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN2SUPPORT_H +#define EIGEN2SUPPORT_H + +#if (!defined(EIGEN2_SUPPORT)) || (!defined(EIGEN_CORE_H)) +#error Eigen2 support must be enabled by defining EIGEN2_SUPPORT before including any Eigen header +#endif + +#include "src/Core/util/DisableStupidWarnings.h" + +namespace Eigen { + +/** \defgroup Eigen2Support_Module Eigen2 support module + * This module provides a couple of deprecated functions improving the compatibility with Eigen2. + * + * To use it, define EIGEN2_SUPPORT before including any Eigen header + * \code + * #define EIGEN2_SUPPORT + * \endcode + * + */ + +#include "src/Eigen2Support/Macros.h" +#include "src/Eigen2Support/Memory.h" +#include "src/Eigen2Support/Meta.h" +#include "src/Eigen2Support/Lazy.h" +#include "src/Eigen2Support/Cwise.h" +#include "src/Eigen2Support/CwiseOperators.h" +#include "src/Eigen2Support/TriangularSolver.h" +#include "src/Eigen2Support/Block.h" +#include "src/Eigen2Support/VectorBlock.h" +#include "src/Eigen2Support/Minor.h" +#include "src/Eigen2Support/MathFunctions.h" + + +} // namespace Eigen + +#include "src/Core/util/ReenableStupidWarnings.h" + +// Eigen2 used to include iostream +#include + +#define USING_PART_OF_NAMESPACE_EIGEN \ +EIGEN_USING_MATRIX_TYPEDEFS \ +using Eigen::Matrix; \ +using Eigen::MatrixBase; \ +using Eigen::ei_random; \ +using Eigen::ei_real; \ +using Eigen::ei_imag; \ +using Eigen::ei_conj; \ +using Eigen::ei_abs; \ +using Eigen::ei_abs2; \ +using Eigen::ei_sqrt; \ +using Eigen::ei_exp; \ +using Eigen::ei_log; \ +using Eigen::ei_sin; \ +using Eigen::ei_cos; + +#endif // EIGEN2SUPPORT_H diff --git a/gtsam/3rdparty/Eigen/Eigen/Eigenvalues b/gtsam/3rdparty/Eigen/Eigen/Eigenvalues new file mode 100644 index 000000000..250c0f466 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/Eigenvalues @@ -0,0 +1,44 @@ +#ifndef EIGEN_EIGENVALUES_MODULE_H +#define EIGEN_EIGENVALUES_MODULE_H + +#include "Core" + +#include "src/Core/util/DisableStupidWarnings.h" + +#include "Cholesky" +#include "Jacobi" +#include "Householder" +#include "LU" + +namespace Eigen { + +/** \defgroup Eigenvalues_Module Eigenvalues module + * + * + * + * This module mainly provides various eigenvalue solvers. + * This module also provides some MatrixBase methods, including: + * - MatrixBase::eigenvalues(), + * - MatrixBase::operatorNorm() + * + * \code + * #include + * \endcode + */ + +#include "src/Eigenvalues/Tridiagonalization.h" +#include "src/Eigenvalues/RealSchur.h" +#include "src/Eigenvalues/EigenSolver.h" +#include "src/Eigenvalues/SelfAdjointEigenSolver.h" +#include "src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h" +#include "src/Eigenvalues/HessenbergDecomposition.h" +#include "src/Eigenvalues/ComplexSchur.h" +#include "src/Eigenvalues/ComplexEigenSolver.h" +#include "src/Eigenvalues/MatrixBaseEigenvalues.h" + +} // namespace Eigen + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_EIGENVALUES_MODULE_H +/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/gtsam/3rdparty/Eigen/Eigen/Geometry b/gtsam/3rdparty/Eigen/Eigen/Geometry new file mode 100644 index 000000000..78277c0c5 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/Geometry @@ -0,0 +1,67 @@ +#ifndef EIGEN_GEOMETRY_MODULE_H +#define EIGEN_GEOMETRY_MODULE_H + +#include "Core" + +#include "src/Core/util/DisableStupidWarnings.h" + +#include "SVD" +#include "LU" +#include + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +namespace Eigen { + +/** \defgroup Geometry_Module Geometry module + * + * + * + * This module provides support for: + * - fixed-size homogeneous transformations + * - translation, scaling, 2D and 3D rotations + * - quaternions + * - \ref MatrixBase::cross() "cross product" + * - \ref MatrixBase::unitOrthogonal() "orthognal vector generation" + * - some linear components: parametrized-lines and hyperplanes + * + * \code + * #include + * \endcode + */ + +#include "src/Geometry/OrthoMethods.h" +#include "src/Geometry/EulerAngles.h" + +#if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS + #include "src/Geometry/Homogeneous.h" + #include "src/Geometry/RotationBase.h" + #include "src/Geometry/Rotation2D.h" + #include "src/Geometry/Quaternion.h" + #include "src/Geometry/AngleAxis.h" + #include "src/Geometry/Transform.h" + #include "src/Geometry/Translation.h" + #include "src/Geometry/Scaling.h" + #include "src/Geometry/Hyperplane.h" + #include "src/Geometry/ParametrizedLine.h" + #include "src/Geometry/AlignedBox.h" + #include "src/Geometry/Umeyama.h" + + #if defined EIGEN_VECTORIZE_SSE + #include "src/Geometry/arch/Geometry_SSE.h" + #endif +#endif + +#ifdef EIGEN2_SUPPORT +#include "src/Eigen2Support/Geometry/All.h" +#endif + +} // namespace Eigen + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_GEOMETRY_MODULE_H +/* vim: set filetype=cpp et sw=2 ts=2 ai: */ + diff --git a/gtsam/3rdparty/Eigen/Eigen/Householder b/gtsam/3rdparty/Eigen/Eigen/Householder new file mode 100644 index 000000000..6b86cf65c --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/Householder @@ -0,0 +1,27 @@ +#ifndef EIGEN_HOUSEHOLDER_MODULE_H +#define EIGEN_HOUSEHOLDER_MODULE_H + +#include "Core" + +#include "src/Core/util/DisableStupidWarnings.h" + +namespace Eigen { + +/** \defgroup Householder_Module Householder module + * This module provides Householder transformations. + * + * \code + * #include + * \endcode + */ + +#include "src/Householder/Householder.h" +#include "src/Householder/HouseholderSequence.h" +#include "src/Householder/BlockHouseholder.h" + +} // namespace Eigen + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_HOUSEHOLDER_MODULE_H +/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/gtsam/3rdparty/Eigen/Eigen/Jacobi b/gtsam/3rdparty/Eigen/Eigen/Jacobi new file mode 100644 index 000000000..afa676813 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/Jacobi @@ -0,0 +1,30 @@ +#ifndef EIGEN_JACOBI_MODULE_H +#define EIGEN_JACOBI_MODULE_H + +#include "Core" + +#include "src/Core/util/DisableStupidWarnings.h" + +namespace Eigen { + +/** \defgroup Jacobi_Module Jacobi module + * This module provides Jacobi and Givens rotations. + * + * \code + * #include + * \endcode + * + * In addition to listed classes, it defines the two following MatrixBase methods to apply a Jacobi or Givens rotation: + * - MatrixBase::applyOnTheLeft() + * - MatrixBase::applyOnTheRight(). + */ + +#include "src/Jacobi/Jacobi.h" + +} // namespace Eigen + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_JACOBI_MODULE_H +/* vim: set filetype=cpp et sw=2 ts=2 ai: */ + diff --git a/gtsam/3rdparty/Eigen/Eigen/LU b/gtsam/3rdparty/Eigen/Eigen/LU new file mode 100644 index 000000000..226f88ca3 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/LU @@ -0,0 +1,42 @@ +#ifndef EIGEN_LU_MODULE_H +#define EIGEN_LU_MODULE_H + +#include "Core" + +#include "src/Core/util/DisableStupidWarnings.h" + +namespace Eigen { + +/** \defgroup LU_Module LU module + * This module includes %LU decomposition and related notions such as matrix inversion and determinant. + * This module defines the following MatrixBase methods: + * - MatrixBase::inverse() + * - MatrixBase::determinant() + * + * \code + * #include + * \endcode + */ + +#include "src/misc/Solve.h" +#include "src/misc/Kernel.h" +#include "src/misc/Image.h" +#include "src/LU/FullPivLU.h" +#include "src/LU/PartialPivLU.h" +#include "src/LU/Determinant.h" +#include "src/LU/Inverse.h" + +#if defined EIGEN_VECTORIZE_SSE + #include "src/LU/arch/Inverse_SSE.h" +#endif + +#ifdef EIGEN2_SUPPORT + #include "src/Eigen2Support/LU.h" +#endif + +} // namespace Eigen + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_LU_MODULE_H +/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/gtsam/3rdparty/Eigen/Eigen/LeastSquares b/gtsam/3rdparty/Eigen/Eigen/LeastSquares new file mode 100644 index 000000000..93a6302dc --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/LeastSquares @@ -0,0 +1,36 @@ +#ifndef EIGEN_REGRESSION_MODULE_H +#define EIGEN_REGRESSION_MODULE_H + +#ifndef EIGEN2_SUPPORT +#error LeastSquares is only available in Eigen2 support mode (define EIGEN2_SUPPORT) +#endif + +// exclude from normal eigen3-only documentation +#ifdef EIGEN2_SUPPORT + +#include "Core" + +#include "src/Core/util/DisableStupidWarnings.h" + +#include "Eigenvalues" +#include "Geometry" + +namespace Eigen { + +/** \defgroup LeastSquares_Module LeastSquares module + * This module provides linear regression and related features. + * + * \code + * #include + * \endcode + */ + +#include "src/Eigen2Support/LeastSquares.h" + +} // namespace Eigen + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN2_SUPPORT + +#endif // EIGEN_REGRESSION_MODULE_H diff --git a/gtsam/3rdparty/Eigen/Eigen/QR b/gtsam/3rdparty/Eigen/Eigen/QR new file mode 100644 index 000000000..97c1788ee --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/QR @@ -0,0 +1,45 @@ +#ifndef EIGEN_QR_MODULE_H +#define EIGEN_QR_MODULE_H + +#include "Core" + +#include "src/Core/util/DisableStupidWarnings.h" + +#include "Cholesky" +#include "Jacobi" +#include "Householder" + +namespace Eigen { + +/** \defgroup QR_Module QR module + * + * + * + * This module provides various QR decompositions + * This module also provides some MatrixBase methods, including: + * - MatrixBase::qr(), + * + * \code + * #include + * \endcode + */ + +#include "src/misc/Solve.h" +#include "src/QR/HouseholderQR.h" +#include "src/QR/FullPivHouseholderQR.h" +#include "src/QR/ColPivHouseholderQR.h" + +#ifdef EIGEN2_SUPPORT +#include "src/Eigen2Support/QR.h" +#endif + +} // namespace Eigen + +#include "src/Core/util/ReenableStupidWarnings.h" + +#ifdef EIGEN2_SUPPORT +#include "Eigenvalues" +#endif + +#endif // EIGEN_QR_MODULE_H +/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/gtsam/3rdparty/Eigen/Eigen/QtAlignedMalloc b/gtsam/3rdparty/Eigen/Eigen/QtAlignedMalloc new file mode 100644 index 000000000..46f7d83b7 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/QtAlignedMalloc @@ -0,0 +1,34 @@ + +#ifndef EIGEN_QTMALLOC_MODULE_H +#define EIGEN_QTMALLOC_MODULE_H + +#include "Core" + +#if (!EIGEN_MALLOC_ALREADY_ALIGNED) + +#include "src/Core/util/DisableStupidWarnings.h" + +void *qMalloc(size_t size) +{ + return Eigen::internal::aligned_malloc(size); +} + +void qFree(void *ptr) +{ + Eigen::internal::aligned_free(ptr); +} + +void *qRealloc(void *ptr, size_t size) +{ + void* newPtr = Eigen::internal::aligned_malloc(size); + memcpy(newPtr, ptr, size); + Eigen::internal::aligned_free(ptr); + return newPtr; +} + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif + +#endif // EIGEN_QTMALLOC_MODULE_H +/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/gtsam/3rdparty/Eigen/Eigen/SVD b/gtsam/3rdparty/Eigen/Eigen/SVD new file mode 100644 index 000000000..d24471fd7 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/SVD @@ -0,0 +1,38 @@ +#ifndef EIGEN_SVD_MODULE_H +#define EIGEN_SVD_MODULE_H + +#include "QR" +#include "Householder" +#include "Jacobi" + +#include "src/Core/util/DisableStupidWarnings.h" + +namespace Eigen { + +/** \defgroup SVD_Module SVD module + * + * + * + * This module provides SVD decomposition for (currently) real matrices. + * This decomposition is accessible via the following MatrixBase method: + * - MatrixBase::svd() + * + * \code + * #include + * \endcode + */ + +#include "src/misc/Solve.h" +#include "src/SVD/JacobiSVD.h" +#include "src/SVD/UpperBidiagonalization.h" + +#ifdef EIGEN2_SUPPORT +#include "src/Eigen2Support/SVD.h" +#endif + +} // namespace Eigen + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_SVD_MODULE_H +/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/gtsam/3rdparty/Eigen/Eigen/Sparse b/gtsam/3rdparty/Eigen/Eigen/Sparse new file mode 100644 index 000000000..7425b3a41 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/Sparse @@ -0,0 +1,69 @@ +#ifndef EIGEN_SPARSE_MODULE_H +#define EIGEN_SPARSE_MODULE_H + +#include "Core" + +#include "src/Core/util/DisableStupidWarnings.h" + +#include +#include +#include +#include +#include + +#ifdef EIGEN2_SUPPORT +#define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET +#endif + +#ifndef EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET +#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. +#endif + +namespace Eigen { + +/** \defgroup Sparse_Module Sparse module + * + * + * + * See the \ref TutorialSparse "Sparse tutorial" + * + * \code + * #include + * \endcode + */ + +/** The type used to identify a general sparse storage. */ +struct Sparse {}; + +#include "src/Sparse/SparseUtil.h" +#include "src/Sparse/SparseMatrixBase.h" +#include "src/Sparse/CompressedStorage.h" +#include "src/Sparse/AmbiVector.h" +#include "src/Sparse/SparseMatrix.h" +#include "src/Sparse/DynamicSparseMatrix.h" +#include "src/Sparse/MappedSparseMatrix.h" +#include "src/Sparse/SparseVector.h" +#include "src/Sparse/CoreIterators.h" +#include "src/Sparse/SparseBlock.h" +#include "src/Sparse/SparseTranspose.h" +#include "src/Sparse/SparseCwiseUnaryOp.h" +#include "src/Sparse/SparseCwiseBinaryOp.h" +#include "src/Sparse/SparseDot.h" +#include "src/Sparse/SparseAssign.h" +#include "src/Sparse/SparseRedux.h" +#include "src/Sparse/SparseFuzzy.h" +#include "src/Sparse/SparseProduct.h" +#include "src/Sparse/SparseSparseProduct.h" +#include "src/Sparse/SparseDenseProduct.h" +#include "src/Sparse/SparseDiagonalProduct.h" +#include "src/Sparse/SparseTriangularView.h" +#include "src/Sparse/SparseSelfAdjointView.h" +#include "src/Sparse/TriangularSolver.h" +#include "src/Sparse/SparseView.h" + +} // namespace Eigen + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_SPARSE_MODULE_H + diff --git a/gtsam/3rdparty/Eigen/Eigen/StdDeque b/gtsam/3rdparty/Eigen/Eigen/StdDeque new file mode 100644 index 000000000..a4f96232d --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/StdDeque @@ -0,0 +1,42 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// Copyright (C) 2009 Hauke Heibel +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_STDDEQUE_MODULE_H +#define EIGEN_STDDEQUE_MODULE_H + +#include "Core" +#include + +#if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ + +#define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...) + +#else + +#include "src/StlSupport/StdDeque.h" + +#endif + +#endif // EIGEN_STDDEQUE_MODULE_H diff --git a/gtsam/3rdparty/Eigen/Eigen/StdList b/gtsam/3rdparty/Eigen/Eigen/StdList new file mode 100644 index 000000000..d914ded4f --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/StdList @@ -0,0 +1,41 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Hauke Heibel +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_STDLIST_MODULE_H +#define EIGEN_STDLIST_MODULE_H + +#include "Core" +#include + +#if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ + +#define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) + +#else + +#include "src/StlSupport/StdList.h" + +#endif + +#endif // EIGEN_STDLIST_MODULE_H diff --git a/gtsam/3rdparty/Eigen/Eigen/StdVector b/gtsam/3rdparty/Eigen/Eigen/StdVector new file mode 100644 index 000000000..3d8995e5a --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/StdVector @@ -0,0 +1,42 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// Copyright (C) 2009 Hauke Heibel +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_STDVECTOR_MODULE_H +#define EIGEN_STDVECTOR_MODULE_H + +#include "Core" +#include + +#if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ + +#define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) + +#else + +#include "src/StlSupport/StdVector.h" + +#endif + +#endif // EIGEN_STDVECTOR_MODULE_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/CMakeLists.txt b/gtsam/3rdparty/Eigen/Eigen/src/CMakeLists.txt new file mode 100644 index 000000000..c326f374d --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/CMakeLists.txt @@ -0,0 +1,7 @@ +file(GLOB Eigen_src_subdirectories "*") +escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") +foreach(f ${Eigen_src_subdirectories}) + if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" ) + add_subdirectory(${f}) + endif() +endforeach() diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Cholesky/CMakeLists.txt b/gtsam/3rdparty/Eigen/Eigen/src/Cholesky/CMakeLists.txt new file mode 100644 index 000000000..d01488b41 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Cholesky/CMakeLists.txt @@ -0,0 +1,6 @@ +FILE(GLOB Eigen_Cholesky_SRCS "*.h") + +INSTALL(FILES + ${Eigen_Cholesky_SRCS} + DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Cholesky COMPONENT Devel + ) diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Cholesky/LDLT.h b/gtsam/3rdparty/Eigen/Eigen/src/Cholesky/LDLT.h new file mode 100644 index 000000000..5e2352caa --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Cholesky/LDLT.h @@ -0,0 +1,461 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2010 Gael Guennebaud +// Copyright (C) 2009 Keir Mierle +// Copyright (C) 2009 Benoit Jacob +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_LDLT_H +#define EIGEN_LDLT_H + +namespace internal { +template struct LDLT_Traits; +} + +/** \ingroup cholesky_Module + * + * \class LDLT + * + * \brief Robust Cholesky decomposition of a matrix with pivoting + * + * \param MatrixType the type of the matrix of which to compute the LDL^T Cholesky decomposition + * + * Perform a robust Cholesky decomposition of a positive semidefinite or negative semidefinite + * matrix \f$ A \f$ such that \f$ A = P^TLDL^*P \f$, where P is a permutation matrix, L + * is lower triangular with a unit diagonal and D is a diagonal matrix. + * + * The decomposition uses pivoting to ensure stability, so that L will have + * zeros in the bottom right rank(A) - n submatrix. Avoiding the square root + * on D also stabilizes the computation. + * + * Remember that Cholesky decompositions are not rank-revealing. Also, do not use a Cholesky + * decomposition to determine whether a system of equations has a solution. + * + * \sa MatrixBase::ldlt(), class LLT + */ + /* THIS PART OF THE DOX IS CURRENTLY DISABLED BECAUSE INACCURATE BECAUSE OF BUG IN THE DECOMPOSITION CODE + * Note that during the decomposition, only the upper triangular part of A is considered. Therefore, + * the strict lower part does not have to store correct values. + */ +template class LDLT +{ + public: + typedef _MatrixType MatrixType; + enum { + RowsAtCompileTime = MatrixType::RowsAtCompileTime, + ColsAtCompileTime = MatrixType::ColsAtCompileTime, + Options = MatrixType::Options & ~RowMajorBit, // these are the options for the TmpMatrixType, we need a ColMajor matrix here! + MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, + MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, + UpLo = _UpLo + }; + typedef typename MatrixType::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + typedef typename MatrixType::Index Index; + typedef Matrix TmpMatrixType; + + typedef Transpositions TranspositionType; + typedef PermutationMatrix PermutationType; + + typedef internal::LDLT_Traits Traits; + + /** \brief Default Constructor. + * + * The default constructor is useful in cases in which the user intends to + * perform decompositions via LDLT::compute(const MatrixType&). + */ + LDLT() : m_matrix(), m_transpositions(), m_isInitialized(false) {} + + /** \brief Default Constructor with memory preallocation + * + * Like the default constructor but with preallocation of the internal data + * according to the specified problem \a size. + * \sa LDLT() + */ + LDLT(Index size) + : m_matrix(size, size), + m_transpositions(size), + m_temporary(size), + m_isInitialized(false) + {} + + LDLT(const MatrixType& matrix) + : m_matrix(matrix.rows(), matrix.cols()), + m_transpositions(matrix.rows()), + m_temporary(matrix.rows()), + m_isInitialized(false) + { + compute(matrix); + } + + /** \returns a view of the upper triangular matrix U */ + inline typename Traits::MatrixU matrixU() const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return Traits::getU(m_matrix); + } + + /** \returns a view of the lower triangular matrix L */ + inline typename Traits::MatrixL matrixL() const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return Traits::getL(m_matrix); + } + + /** \returns the permutation matrix P as a transposition sequence. + */ + inline const TranspositionType& transpositionsP() const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return m_transpositions; + } + + /** \returns the coefficients of the diagonal matrix D */ + inline Diagonal vectorD(void) const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return m_matrix.diagonal(); + } + + /** \returns true if the matrix is positive (semidefinite) */ + inline bool isPositive(void) const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return m_sign == 1; + } + + #ifdef EIGEN2_SUPPORT + inline bool isPositiveDefinite() const + { + return isPositive(); + } + #endif + + /** \returns true if the matrix is negative (semidefinite) */ + inline bool isNegative(void) const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return m_sign == -1; + } + + /** \returns a solution x of \f$ A x = b \f$ using the current decomposition of A. + * + * \note_about_checking_solutions + * + * \sa solveInPlace(), MatrixBase::ldlt() + */ + template + inline const internal::solve_retval + solve(const MatrixBase& b) const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + eigen_assert(m_matrix.rows()==b.rows() + && "LDLT::solve(): invalid number of rows of the right hand side matrix b"); + return internal::solve_retval(*this, b.derived()); + } + + #ifdef EIGEN2_SUPPORT + template + bool solve(const MatrixBase& b, ResultType *result) const + { + *result = this->solve(b); + return true; + } + #endif + + template + bool solveInPlace(MatrixBase &bAndX) const; + + LDLT& compute(const MatrixType& matrix); + + /** \returns the internal LDLT decomposition matrix + * + * TODO: document the storage layout + */ + inline const MatrixType& matrixLDLT() const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return m_matrix; + } + + MatrixType reconstructedMatrix() const; + + inline Index rows() const { return m_matrix.rows(); } + inline Index cols() const { return m_matrix.cols(); } + + protected: + + /** \internal + * Used to compute and store the Cholesky decomposition A = L D L^* = U^* D U. + * The strict upper part is used during the decomposition, the strict lower + * part correspond to the coefficients of L (its diagonal is equal to 1 and + * is not stored), and the diagonal entries correspond to D. + */ + MatrixType m_matrix; + TranspositionType m_transpositions; + TmpMatrixType m_temporary; + int m_sign; + bool m_isInitialized; +}; + +namespace internal { + +template struct ldlt_inplace; + +template<> struct ldlt_inplace +{ + template + static bool unblocked(MatrixType& mat, TranspositionType& transpositions, Workspace& temp, int* sign=0) + { + typedef typename MatrixType::Scalar Scalar; + typedef typename MatrixType::RealScalar RealScalar; + typedef typename MatrixType::Index Index; + eigen_assert(mat.rows()==mat.cols()); + const Index size = mat.rows(); + + if (size <= 1) + { + transpositions.setIdentity(); + if(sign) + *sign = real(mat.coeff(0,0))>0 ? 1:-1; + return true; + } + + RealScalar cutoff = 0, biggest_in_corner; + + for (Index k = 0; k < size; ++k) + { + // Find largest diagonal element + Index index_of_biggest_in_corner; + biggest_in_corner = mat.diagonal().tail(size-k).cwiseAbs().maxCoeff(&index_of_biggest_in_corner); + index_of_biggest_in_corner += k; + + if(k == 0) + { + // The biggest overall is the point of reference to which further diagonals + // are compared; if any diagonal is negligible compared + // to the largest overall, the algorithm bails. + cutoff = abs(NumTraits::epsilon() * biggest_in_corner); + + if(sign) + *sign = real(mat.diagonal().coeff(index_of_biggest_in_corner)) > 0 ? 1 : -1; + } + + // Finish early if the matrix is not full rank. + if(biggest_in_corner < cutoff) + { + for(Index i = k; i < size; i++) transpositions.coeffRef(i) = i; + break; + } + + transpositions.coeffRef(k) = index_of_biggest_in_corner; + if(k != index_of_biggest_in_corner) + { + // apply the transposition while taking care to consider only + // the lower triangular part + Index s = size-index_of_biggest_in_corner-1; // trailing size after the biggest element + mat.row(k).head(k).swap(mat.row(index_of_biggest_in_corner).head(k)); + mat.col(k).tail(s).swap(mat.col(index_of_biggest_in_corner).tail(s)); + std::swap(mat.coeffRef(k,k),mat.coeffRef(index_of_biggest_in_corner,index_of_biggest_in_corner)); + for(int i=k+1;i::IsComplex) + mat.coeffRef(index_of_biggest_in_corner,k) = conj(mat.coeff(index_of_biggest_in_corner,k)); + } + + // partition the matrix: + // A00 | - | - + // lu = A10 | A11 | - + // A20 | A21 | A22 + Index rs = size - k - 1; + Block A21(mat,k+1,k,rs,1); + Block A10(mat,k,0,1,k); + Block A20(mat,k+1,0,rs,k); + + if(k>0) + { + temp.head(k) = mat.diagonal().head(k).asDiagonal() * A10.adjoint(); + mat.coeffRef(k,k) -= (A10 * temp.head(k)).value(); + if(rs>0) + A21.noalias() -= A20 * temp.head(k); + } + if((rs>0) && (abs(mat.coeffRef(k,k)) > cutoff)) + A21 /= mat.coeffRef(k,k); + } + + return true; + } +}; + +template<> struct ldlt_inplace +{ + template + static EIGEN_STRONG_INLINE bool unblocked(MatrixType& mat, TranspositionType& transpositions, Workspace& temp, int* sign=0) + { + Transpose matt(mat); + return ldlt_inplace::unblocked(matt, transpositions, temp, sign); + } +}; + +template struct LDLT_Traits +{ + typedef TriangularView MatrixL; + typedef TriangularView MatrixU; + inline static MatrixL getL(const MatrixType& m) { return m; } + inline static MatrixU getU(const MatrixType& m) { return m.adjoint(); } +}; + +template struct LDLT_Traits +{ + typedef TriangularView MatrixL; + typedef TriangularView MatrixU; + inline static MatrixL getL(const MatrixType& m) { return m.adjoint(); } + inline static MatrixU getU(const MatrixType& m) { return m; } +}; + +} // end namespace internal + +/** Compute / recompute the LDLT decomposition A = L D L^* = U^* D U of \a matrix + */ +template +LDLT& LDLT::compute(const MatrixType& a) +{ + eigen_assert(a.rows()==a.cols()); + const Index size = a.rows(); + + m_matrix = a; + + m_transpositions.resize(size); + m_isInitialized = false; + m_temporary.resize(size); + + internal::ldlt_inplace::unblocked(m_matrix, m_transpositions, m_temporary, &m_sign); + + m_isInitialized = true; + return *this; +} + +namespace internal { +template +struct solve_retval, Rhs> + : solve_retval_base, Rhs> +{ + typedef LDLT<_MatrixType,_UpLo> LDLTType; + EIGEN_MAKE_SOLVE_HELPERS(LDLTType,Rhs) + + template void evalTo(Dest& dst) const + { + eigen_assert(rhs().rows() == dec().matrixLDLT().rows()); + // dst = P b + dst = dec().transpositionsP() * rhs(); + + // dst = L^-1 (P b) + dec().matrixL().solveInPlace(dst); + + // dst = D^-1 (L^-1 P b) + dst = dec().vectorD().asDiagonal().inverse() * dst; + + // dst = L^-T (D^-1 L^-1 P b) + dec().matrixU().solveInPlace(dst); + + // dst = P^-1 (L^-T D^-1 L^-1 P b) = A^-1 b + dst = dec().transpositionsP().transpose() * dst; + } +}; +} + +/** \internal use x = ldlt_object.solve(x); + * + * This is the \em in-place version of solve(). + * + * \param bAndX represents both the right-hand side matrix b and result x. + * + * \returns true always! If you need to check for existence of solutions, use another decomposition like LU, QR, or SVD. + * + * This version avoids a copy when the right hand side matrix b is not + * needed anymore. + * + * \sa LDLT::solve(), MatrixBase::ldlt() + */ +template +template +bool LDLT::solveInPlace(MatrixBase &bAndX) const +{ + eigen_assert(m_isInitialized && "LDLT is not initialized."); + const Index size = m_matrix.rows(); + eigen_assert(size == bAndX.rows()); + + bAndX = this->solve(bAndX); + + return true; +} + +/** \returns the matrix represented by the decomposition, + * i.e., it returns the product: P^T L D L^* P. + * This function is provided for debug purpose. */ +template +MatrixType LDLT::reconstructedMatrix() const +{ + eigen_assert(m_isInitialized && "LDLT is not initialized."); + const Index size = m_matrix.rows(); + MatrixType res(size,size); + + // P + res.setIdentity(); + res = transpositionsP() * res; + // L^* P + res = matrixU() * res; + // D(L^*P) + res = vectorD().asDiagonal() * res; + // L(DL^*P) + res = matrixL() * res; + // P^T (LDL^*P) + res = transpositionsP().transpose() * res; + + return res; +} + +/** \cholesky_module + * \returns the Cholesky decomposition with full pivoting without square root of \c *this + */ +template +inline const LDLT::PlainObject, UpLo> +SelfAdjointView::ldlt() const +{ + return LDLT(m_matrix); +} + +/** \cholesky_module + * \returns the Cholesky decomposition with full pivoting without square root of \c *this + */ +template +inline const LDLT::PlainObject> +MatrixBase::ldlt() const +{ + return LDLT(derived()); +} + +#endif // EIGEN_LDLT_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Cholesky/LLT.h b/gtsam/3rdparty/Eigen/Eigen/src/Cholesky/LLT.h new file mode 100644 index 000000000..a8fc525e8 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Cholesky/LLT.h @@ -0,0 +1,386 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_LLT_H +#define EIGEN_LLT_H + +namespace internal{ +template struct LLT_Traits; +} + +/** \ingroup cholesky_Module + * + * \class LLT + * + * \brief Standard Cholesky decomposition (LL^T) of a matrix and associated features + * + * \param MatrixType the type of the matrix of which we are computing the LL^T Cholesky decomposition + * + * This class performs a LL^T Cholesky decomposition of a symmetric, positive definite + * matrix A such that A = LL^* = U^*U, where L is lower triangular. + * + * While the Cholesky decomposition is particularly useful to solve selfadjoint problems like D^*D x = b, + * for that purpose, we recommend the Cholesky decomposition without square root which is more stable + * and even faster. Nevertheless, this standard Cholesky decomposition remains useful in many other + * situations like generalised eigen problems with hermitian matrices. + * + * Remember that Cholesky decompositions are not rank-revealing. This LLT decomposition is only stable on positive definite matrices, + * use LDLT instead for the semidefinite case. Also, do not use a Cholesky decomposition to determine whether a system of equations + * has a solution. + * + * \sa MatrixBase::llt(), class LDLT + */ + /* HEY THIS DOX IS DISABLED BECAUSE THERE's A BUG EITHER HERE OR IN LDLT ABOUT THAT (OR BOTH) + * Note that during the decomposition, only the upper triangular part of A is considered. Therefore, + * the strict lower part does not have to store correct values. + */ +template class LLT +{ + public: + typedef _MatrixType MatrixType; + enum { + RowsAtCompileTime = MatrixType::RowsAtCompileTime, + ColsAtCompileTime = MatrixType::ColsAtCompileTime, + Options = MatrixType::Options, + MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime + }; + typedef typename MatrixType::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + typedef typename MatrixType::Index Index; + + enum { + PacketSize = internal::packet_traits::size, + AlignmentMask = int(PacketSize)-1, + UpLo = _UpLo + }; + + typedef internal::LLT_Traits Traits; + + /** + * \brief Default Constructor. + * + * The default constructor is useful in cases in which the user intends to + * perform decompositions via LLT::compute(const MatrixType&). + */ + LLT() : m_matrix(), m_isInitialized(false) {} + + /** \brief Default Constructor with memory preallocation + * + * Like the default constructor but with preallocation of the internal data + * according to the specified problem \a size. + * \sa LLT() + */ + LLT(Index size) : m_matrix(size, size), + m_isInitialized(false) {} + + LLT(const MatrixType& matrix) + : m_matrix(matrix.rows(), matrix.cols()), + m_isInitialized(false) + { + compute(matrix); + } + + /** \returns a view of the upper triangular matrix U */ + inline typename Traits::MatrixU matrixU() const + { + eigen_assert(m_isInitialized && "LLT is not initialized."); + return Traits::getU(m_matrix); + } + + /** \returns a view of the lower triangular matrix L */ + inline typename Traits::MatrixL matrixL() const + { + eigen_assert(m_isInitialized && "LLT is not initialized."); + return Traits::getL(m_matrix); + } + + /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A. + * + * Since this LLT class assumes anyway that the matrix A is invertible, the solution + * theoretically exists and is unique regardless of b. + * + * Example: \include LLT_solve.cpp + * Output: \verbinclude LLT_solve.out + * + * \sa solveInPlace(), MatrixBase::llt() + */ + template + inline const internal::solve_retval + solve(const MatrixBase& b) const + { + eigen_assert(m_isInitialized && "LLT is not initialized."); + eigen_assert(m_matrix.rows()==b.rows() + && "LLT::solve(): invalid number of rows of the right hand side matrix b"); + return internal::solve_retval(*this, b.derived()); + } + + #ifdef EIGEN2_SUPPORT + template + bool solve(const MatrixBase& b, ResultType *result) const + { + *result = this->solve(b); + return true; + } + + bool isPositiveDefinite() const { return true; } + #endif + + template + void solveInPlace(MatrixBase &bAndX) const; + + LLT& compute(const MatrixType& matrix); + + /** \returns the LLT decomposition matrix + * + * TODO: document the storage layout + */ + inline const MatrixType& matrixLLT() const + { + eigen_assert(m_isInitialized && "LLT is not initialized."); + return m_matrix; + } + + MatrixType reconstructedMatrix() const; + + + /** \brief Reports whether previous computation was successful. + * + * \returns \c Success if computation was succesful, + * \c NumericalIssue if the matrix.appears to be negative. + */ + ComputationInfo info() const + { + eigen_assert(m_isInitialized && "LLT is not initialized."); + return m_info; + } + + inline Index rows() const { return m_matrix.rows(); } + inline Index cols() const { return m_matrix.cols(); } + + protected: + /** \internal + * Used to compute and store L + * The strict upper part is not used and even not initialized. + */ + MatrixType m_matrix; + bool m_isInitialized; + ComputationInfo m_info; +}; + +namespace internal { + +template struct llt_inplace; + +template<> struct llt_inplace +{ + template + static typename MatrixType::Index unblocked(MatrixType& mat) + { + typedef typename MatrixType::Index Index; + typedef typename MatrixType::Scalar Scalar; + typedef typename MatrixType::RealScalar RealScalar; + + eigen_assert(mat.rows()==mat.cols()); + const Index size = mat.rows(); + for(Index k = 0; k < size; ++k) + { + Index rs = size-k-1; // remaining size + + Block A21(mat,k+1,k,rs,1); + Block A10(mat,k,0,1,k); + Block A20(mat,k+1,0,rs,k); + + RealScalar x = real(mat.coeff(k,k)); + if (k>0) x -= A10.squaredNorm(); + if (x<=RealScalar(0)) + return k; + mat.coeffRef(k,k) = x = sqrt(x); + if (k>0 && rs>0) A21.noalias() -= A20 * A10.adjoint(); + if (rs>0) A21 *= RealScalar(1)/x; + } + return -1; + } + + template + static typename MatrixType::Index blocked(MatrixType& m) + { + typedef typename MatrixType::Index Index; + eigen_assert(m.rows()==m.cols()); + Index size = m.rows(); + if(size<32) + return unblocked(m); + + Index blockSize = size/8; + blockSize = (blockSize/16)*16; + blockSize = std::min(std::max(blockSize,Index(8)), Index(128)); + + for (Index k=0; k A11(m,k, k, bs,bs); + Block A21(m,k+bs,k, rs,bs); + Block A22(m,k+bs,k+bs,rs,rs); + + Index ret; + if((ret=unblocked(A11))>=0) return k+ret; + if(rs>0) A11.adjoint().template triangularView().template solveInPlace(A21); + if(rs>0) A22.template selfadjointView().rankUpdate(A21,-1); // bottleneck + } + return -1; + } +}; + +template<> struct llt_inplace +{ + template + static EIGEN_STRONG_INLINE typename MatrixType::Index unblocked(MatrixType& mat) + { + Transpose matt(mat); + return llt_inplace::unblocked(matt); + } + template + static EIGEN_STRONG_INLINE typename MatrixType::Index blocked(MatrixType& mat) + { + Transpose matt(mat); + return llt_inplace::blocked(matt); + } +}; + +template struct LLT_Traits +{ + typedef TriangularView MatrixL; + typedef TriangularView MatrixU; + inline static MatrixL getL(const MatrixType& m) { return m; } + inline static MatrixU getU(const MatrixType& m) { return m.adjoint(); } + static bool inplace_decomposition(MatrixType& m) + { return llt_inplace::blocked(m)==-1; } +}; + +template struct LLT_Traits +{ + typedef TriangularView MatrixL; + typedef TriangularView MatrixU; + inline static MatrixL getL(const MatrixType& m) { return m.adjoint(); } + inline static MatrixU getU(const MatrixType& m) { return m; } + static bool inplace_decomposition(MatrixType& m) + { return llt_inplace::blocked(m)==-1; } +}; + +} // end namespace internal + +/** Computes / recomputes the Cholesky decomposition A = LL^* = U^*U of \a matrix + * + * + * \returns a reference to *this + */ +template +LLT& LLT::compute(const MatrixType& a) +{ + assert(a.rows()==a.cols()); + const Index size = a.rows(); + m_matrix.resize(size, size); + m_matrix = a; + + m_isInitialized = true; + bool ok = Traits::inplace_decomposition(m_matrix); + m_info = ok ? Success : NumericalIssue; + + return *this; +} + +namespace internal { +template +struct solve_retval, Rhs> + : solve_retval_base, Rhs> +{ + typedef LLT<_MatrixType,UpLo> LLTType; + EIGEN_MAKE_SOLVE_HELPERS(LLTType,Rhs) + + template void evalTo(Dest& dst) const + { + dst = rhs(); + dec().solveInPlace(dst); + } +}; +} + +/** \internal use x = llt_object.solve(x); + * + * This is the \em in-place version of solve(). + * + * \param bAndX represents both the right-hand side matrix b and result x. + * + * \returns true always! If you need to check for existence of solutions, use another decomposition like LU, QR, or SVD. + * + * This version avoids a copy when the right hand side matrix b is not + * needed anymore. + * + * \sa LLT::solve(), MatrixBase::llt() + */ +template +template +void LLT::solveInPlace(MatrixBase &bAndX) const +{ + eigen_assert(m_isInitialized && "LLT is not initialized."); + eigen_assert(m_matrix.rows()==bAndX.rows()); + matrixL().solveInPlace(bAndX); + matrixU().solveInPlace(bAndX); +} + +/** \returns the matrix represented by the decomposition, + * i.e., it returns the product: L L^*. + * This function is provided for debug purpose. */ +template +MatrixType LLT::reconstructedMatrix() const +{ + eigen_assert(m_isInitialized && "LLT is not initialized."); + return matrixL() * matrixL().adjoint().toDenseMatrix(); +} + +/** \cholesky_module + * \returns the LLT decomposition of \c *this + */ +template +inline const LLT::PlainObject> +MatrixBase::llt() const +{ + return LLT(derived()); +} + +/** \cholesky_module + * \returns the LLT decomposition of \c *this + */ +template +inline const LLT::PlainObject, UpLo> +SelfAdjointView::llt() const +{ + return LLT(m_matrix); +} + +#endif // EIGEN_LLT_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/Array.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/Array.h new file mode 100644 index 000000000..a3a2167ad --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/Array.h @@ -0,0 +1,322 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_ARRAY_H +#define EIGEN_ARRAY_H + +/** \class Array + * \ingroup Core_Module + * + * \brief General-purpose arrays with easy API for coefficient-wise operations + * + * The %Array class is very similar to the Matrix class. It provides + * general-purpose one- and two-dimensional arrays. The difference between the + * %Array and the %Matrix class is primarily in the API: the API for the + * %Array class provides easy access to coefficient-wise operations, while the + * API for the %Matrix class provides easy access to linear-algebra + * operations. + * + * This class can be extended with the help of the plugin mechanism described on the page + * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_ARRAY_PLUGIN. + * + * \sa \ref TutorialArrayClass, \ref TopicClassHierarchy + */ +namespace internal { +template +struct traits > : traits > +{ + typedef ArrayXpr XprKind; + typedef ArrayBase > XprBase; +}; +} + +template +class Array + : public PlainObjectBase > +{ + public: + + typedef PlainObjectBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Array) + + enum { Options = _Options }; + typedef typename Base::PlainObject PlainObject; + + protected: + template + friend struct internal::conservative_resize_like_impl; + + using Base::m_storage; + public: + enum { NeedsToAlign = (!(Options&DontAlign)) + && SizeAtCompileTime!=Dynamic && ((static_cast(sizeof(Scalar))*SizeAtCompileTime)%16)==0 }; + EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) + + using Base::base; + using Base::coeff; + using Base::coeffRef; + + /** + * The usage of + * using Base::operator=; + * fails on MSVC. Since the code below is working with GCC and MSVC, we skipped + * the usage of 'using'. This should be done only for operator=. + */ + template + EIGEN_STRONG_INLINE Array& operator=(const EigenBase &other) + { + return Base::operator=(other); + } + + /** Copies the value of the expression \a other into \c *this with automatic resizing. + * + * *this might be resized to match the dimensions of \a other. If *this was a null matrix (not already initialized), + * it will be initialized. + * + * Note that copying a row-vector into a vector (and conversely) is allowed. + * The resizing, if any, is then done in the appropriate way so that row-vectors + * remain row-vectors and vectors remain vectors. + */ + template + EIGEN_STRONG_INLINE Array& operator=(const ArrayBase& other) + { + return Base::_set(other); + } + + /** This is a special case of the templated operator=. Its purpose is to + * prevent a default operator= from hiding the templated operator=. + */ + EIGEN_STRONG_INLINE Array& operator=(const Array& other) + { + return Base::_set(other); + } + + /** Default constructor. + * + * For fixed-size matrices, does nothing. + * + * For dynamic-size matrices, creates an empty matrix of size 0. Does not allocate any array. Such a matrix + * is called a null matrix. This constructor is the unique way to create null matrices: resizing + * a matrix to 0 is not supported. + * + * \sa resize(Index,Index) + */ + EIGEN_STRONG_INLINE explicit Array() : Base() + { + Base::_check_template_params(); + EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + } + +#ifndef EIGEN_PARSED_BY_DOXYGEN + // FIXME is it still needed ?? + /** \internal */ + Array(internal::constructor_without_unaligned_array_assert) + : Base(internal::constructor_without_unaligned_array_assert()) + { + Base::_check_template_params(); + EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + } +#endif + + /** Constructs a vector or row-vector with given dimension. \only_for_vectors + * + * Note that this is only useful for dynamic-size vectors. For fixed-size vectors, + * it is redundant to pass the dimension here, so it makes more sense to use the default + * constructor Matrix() instead. + */ + EIGEN_STRONG_INLINE explicit Array(Index dim) + : Base(dim, RowsAtCompileTime == 1 ? 1 : dim, ColsAtCompileTime == 1 ? 1 : dim) + { + Base::_check_template_params(); + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Array) + eigen_assert(dim >= 0); + eigen_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == dim); + EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + } + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + EIGEN_STRONG_INLINE Array(const T0& x, const T1& y) + { + Base::_check_template_params(); + this->template _init2(x, y); + } + #else + /** constructs an uninitialized matrix with \a rows rows and \a cols columns. + * + * This is useful for dynamic-size matrices. For fixed-size matrices, + * it is redundant to pass these parameters, so one should use the default constructor + * Matrix() instead. */ + Array(Index rows, Index cols); + /** constructs an initialized 2D vector with given coefficients */ + Array(const Scalar& x, const Scalar& y); + #endif + + /** constructs an initialized 3D vector with given coefficients */ + EIGEN_STRONG_INLINE Array(const Scalar& x, const Scalar& y, const Scalar& z) + { + Base::_check_template_params(); + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Array, 3) + m_storage.data()[0] = x; + m_storage.data()[1] = y; + m_storage.data()[2] = z; + } + /** constructs an initialized 4D vector with given coefficients */ + EIGEN_STRONG_INLINE Array(const Scalar& x, const Scalar& y, const Scalar& z, const Scalar& w) + { + Base::_check_template_params(); + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Array, 4) + m_storage.data()[0] = x; + m_storage.data()[1] = y; + m_storage.data()[2] = z; + m_storage.data()[3] = w; + } + + explicit Array(const Scalar *data); + + /** Constructor copying the value of the expression \a other */ + template + EIGEN_STRONG_INLINE Array(const ArrayBase& other) + : Base(other.rows() * other.cols(), other.rows(), other.cols()) + { + Base::_check_template_params(); + Base::_set_noalias(other); + } + /** Copy constructor */ + EIGEN_STRONG_INLINE Array(const Array& other) + : Base(other.rows() * other.cols(), other.rows(), other.cols()) + { + Base::_check_template_params(); + Base::_set_noalias(other); + } + /** Copy constructor with in-place evaluation */ + template + EIGEN_STRONG_INLINE Array(const ReturnByValue& other) + { + Base::_check_template_params(); + Base::resize(other.rows(), other.cols()); + other.evalTo(*this); + } + + /** \sa MatrixBase::operator=(const EigenBase&) */ + template + EIGEN_STRONG_INLINE Array(const EigenBase &other) + : Base(other.derived().rows() * other.derived().cols(), other.derived().rows(), other.derived().cols()) + { + Base::_check_template_params(); + Base::resize(other.rows(), other.cols()); + *this = other; + } + + /** Override MatrixBase::swap() since for dynamic-sized matrices of same type it is enough to swap the + * data pointers. + */ + template + void swap(ArrayBase const & other) + { this->_swap(other.derived()); } + + inline Index innerStride() const { return 1; } + inline Index outerStride() const { return this->innerSize(); } + + #ifdef EIGEN_ARRAY_PLUGIN + #include EIGEN_ARRAY_PLUGIN + #endif + + private: + + template + friend struct internal::matrix_swap_impl; +}; + +/** \defgroup arraytypedefs Global array typedefs + * \ingroup Core_Module + * + * Eigen defines several typedef shortcuts for most common 1D and 2D array types. + * + * The general patterns are the following: + * + * \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, + * 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 + * for complex double. + * + * For example, \c Array33d is a fixed-size 3x3 array type of doubles, and \c ArrayXXf is a dynamic-size matrix of floats. + * + * There are also \c ArraySizeType which are self-explanatory. For example, \c Array4cf is + * a fixed-size 1D array of 4 complex floats. + * + * \sa class Array + */ + +#define EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \ +/** \ingroup arraytypedefs */ \ +typedef Array Array##SizeSuffix##SizeSuffix##TypeSuffix; \ +/** \ingroup arraytypedefs */ \ +typedef Array Array##SizeSuffix##TypeSuffix; + +#define EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, Size) \ +/** \ingroup arraytypedefs */ \ +typedef Array Array##Size##X##TypeSuffix; \ +/** \ingroup arraytypedefs */ \ +typedef Array Array##X##Size##TypeSuffix; + +#define EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \ +EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, 2, 2) \ +EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, 3, 3) \ +EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, 4, 4) \ +EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, Dynamic, X) \ +EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, 2) \ +EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, 3) \ +EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, 4) + +EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(int, i) +EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(float, f) +EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(double, d) +EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(std::complex, cf) +EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(std::complex, cd) + +#undef EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES +#undef EIGEN_MAKE_ARRAY_TYPEDEFS + +#undef EIGEN_MAKE_ARRAY_TYPEDEFS_LARGE + +#define EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, SizeSuffix) \ +using Eigen::Matrix##SizeSuffix##TypeSuffix; \ +using Eigen::Vector##SizeSuffix##TypeSuffix; \ +using Eigen::RowVector##SizeSuffix##TypeSuffix; + +#define EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(TypeSuffix) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 2) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 3) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 4) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, X) \ + +#define EIGEN_USING_ARRAY_TYPEDEFS \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(i) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(f) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(d) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(cf) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(cd) + + +#endif // EIGEN_ARRAY_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/ArrayBase.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/ArrayBase.h new file mode 100644 index 000000000..9399ac3d1 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/ArrayBase.h @@ -0,0 +1,239 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_ARRAYBASE_H +#define EIGEN_ARRAYBASE_H + +template class MatrixWrapper; + +/** \class ArrayBase + * \ingroup Core_Module + * + * \brief Base class for all 1D and 2D array, and related expressions + * + * An array is similar to a dense vector or matrix. While matrices are mathematical + * objects with well defined linear algebra operators, an array is just a collection + * of scalar values arranged in a one or two dimensionnal fashion. As the main consequence, + * all operations applied to an array are performed coefficient wise. Furthermore, + * arrays support scalar math functions of the c++ standard library (e.g., std::sin(x)), and convenient + * constructors allowing to easily write generic code working for both scalar values + * and arrays. + * + * This class is the base that is inherited by all array expression types. + * + * \tparam Derived is the derived type, e.g., an array or an expression type. + * + * This class can be extended with the help of the plugin mechanism described on the page + * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_ARRAYBASE_PLUGIN. + * + * \sa class MatrixBase, \ref TopicClassHierarchy + */ +template class ArrayBase + : public DenseBase +{ + public: +#ifndef EIGEN_PARSED_BY_DOXYGEN + /** The base class for a given storage type. */ + typedef ArrayBase StorageBaseType; + + typedef ArrayBase Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl; + + using internal::special_scalar_op_base::Scalar, + typename NumTraits::Scalar>::Real>::operator*; + + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::Index Index; + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::packet_traits::type PacketScalar; + typedef typename NumTraits::Real RealScalar; + + typedef DenseBase Base; + using Base::RowsAtCompileTime; + using Base::ColsAtCompileTime; + using Base::SizeAtCompileTime; + using Base::MaxRowsAtCompileTime; + using Base::MaxColsAtCompileTime; + using Base::MaxSizeAtCompileTime; + using Base::IsVectorAtCompileTime; + using Base::Flags; + using Base::CoeffReadCost; + + using Base::derived; + using Base::const_cast_derived; + using Base::rows; + using Base::cols; + using Base::size; + using Base::coeff; + using Base::coeffRef; + using Base::lazyAssign; + using Base::operator=; + using Base::operator+=; + using Base::operator-=; + using Base::operator*=; + using Base::operator/=; + + typedef typename Base::CoeffReturnType CoeffReturnType; + +#endif // not EIGEN_PARSED_BY_DOXYGEN + +#ifndef EIGEN_PARSED_BY_DOXYGEN + /** \internal the plain matrix type corresponding to this expression. Note that is not necessarily + * exactly the return type of eval(): in the case of plain matrices, the return type of eval() is a const + * reference to a matrix, not a matrix! It is however guaranteed that the return type of eval() is either + * PlainObject or const PlainObject&. + */ + typedef Array::Scalar, + internal::traits::RowsAtCompileTime, + internal::traits::ColsAtCompileTime, + AutoAlign | (internal::traits::Flags&RowMajorBit ? RowMajor : ColMajor), + internal::traits::MaxRowsAtCompileTime, + internal::traits::MaxColsAtCompileTime + > PlainObject; + + + /** \internal Represents a matrix with all coefficients equal to one another*/ + typedef CwiseNullaryOp,Derived> ConstantReturnType; +#endif // not EIGEN_PARSED_BY_DOXYGEN + +#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::ArrayBase +# include "../plugins/CommonCwiseUnaryOps.h" +# include "../plugins/MatrixCwiseUnaryOps.h" +# include "../plugins/ArrayCwiseUnaryOps.h" +# include "../plugins/CommonCwiseBinaryOps.h" +# include "../plugins/MatrixCwiseBinaryOps.h" +# include "../plugins/ArrayCwiseBinaryOps.h" +# ifdef EIGEN_ARRAYBASE_PLUGIN +# include EIGEN_ARRAYBASE_PLUGIN +# endif +#undef EIGEN_CURRENT_STORAGE_BASE_CLASS + + /** Special case of the template operator=, in order to prevent the compiler + * from generating a default operator= (issue hit with g++ 4.1) + */ + Derived& operator=(const ArrayBase& other) + { + return internal::assign_selector::run(derived(), other.derived()); + } + + Derived& operator+=(const Scalar& scalar) + { return *this = derived() + scalar; } + Derived& operator-=(const Scalar& scalar) + { return *this = derived() - scalar; } + + template + Derived& operator+=(const ArrayBase& other); + template + Derived& operator-=(const ArrayBase& other); + + template + Derived& operator*=(const ArrayBase& other); + + template + Derived& operator/=(const ArrayBase& other); + + public: + ArrayBase& array() { return *this; } + const ArrayBase& array() const { return *this; } + + /** \returns an \link MatrixBase Matrix \endlink expression of this array + * \sa MatrixBase::array() */ + MatrixWrapper matrix() { return derived(); } + const MatrixWrapper matrix() const { return derived(); } + +// template +// inline void evalTo(Dest& dst) const { dst = matrix(); } + + protected: + ArrayBase() : Base() {} + + private: + explicit ArrayBase(Index); + ArrayBase(Index,Index); + template explicit ArrayBase(const ArrayBase&); + protected: + // mixing arrays and matrices is not legal + template Derived& operator+=(const MatrixBase& ) + {EIGEN_STATIC_ASSERT(sizeof(typename OtherDerived::Scalar)==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES);} + // mixing arrays and matrices is not legal + template Derived& operator-=(const MatrixBase& ) + {EIGEN_STATIC_ASSERT(sizeof(typename OtherDerived::Scalar)==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES);} +}; + +/** replaces \c *this by \c *this - \a other. + * + * \returns a reference to \c *this + */ +template +template +EIGEN_STRONG_INLINE Derived & +ArrayBase::operator-=(const ArrayBase &other) +{ + SelfCwiseBinaryOp, Derived, OtherDerived> tmp(derived()); + tmp = other.derived(); + return derived(); +} + +/** replaces \c *this by \c *this + \a other. + * + * \returns a reference to \c *this + */ +template +template +EIGEN_STRONG_INLINE Derived & +ArrayBase::operator+=(const ArrayBase& other) +{ + SelfCwiseBinaryOp, Derived, OtherDerived> tmp(derived()); + tmp = other.derived(); + return derived(); +} + +/** replaces \c *this by \c *this * \a other coefficient wise. + * + * \returns a reference to \c *this + */ +template +template +EIGEN_STRONG_INLINE Derived & +ArrayBase::operator*=(const ArrayBase& other) +{ + SelfCwiseBinaryOp, Derived, OtherDerived> tmp(derived()); + tmp = other.derived(); + return derived(); +} + +/** replaces \c *this by \c *this / \a other coefficient wise. + * + * \returns a reference to \c *this + */ +template +template +EIGEN_STRONG_INLINE Derived & +ArrayBase::operator/=(const ArrayBase& other) +{ + SelfCwiseBinaryOp, Derived, OtherDerived> tmp(derived()); + tmp = other.derived(); + return derived(); +} + +#endif // EIGEN_ARRAYBASE_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/ArrayWrapper.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/ArrayWrapper.h new file mode 100644 index 000000000..07f082e1e --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/ArrayWrapper.h @@ -0,0 +1,239 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009-2010 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_ARRAYWRAPPER_H +#define EIGEN_ARRAYWRAPPER_H + +/** \class ArrayWrapper + * \ingroup Core_Module + * + * \brief Expression of a mathematical vector or matrix as an array object + * + * This class is the return type of MatrixBase::array(), and most of the time + * this is the only way it is use. + * + * \sa MatrixBase::array(), class MatrixWrapper + */ + +namespace internal { +template +struct traits > + : public traits::type > +{ + typedef ArrayXpr XprKind; +}; +} + +template +class ArrayWrapper : public ArrayBase > +{ + public: + typedef ArrayBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(ArrayWrapper) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ArrayWrapper) + + typedef typename internal::conditional< + internal::is_lvalue::value, + Scalar, + const Scalar + >::type ScalarWithConstIfNotLvalue; + + typedef typename internal::nested::type NestedExpressionType; + + inline ArrayWrapper(const ExpressionType& matrix) : m_expression(matrix) {} + + inline Index rows() const { return m_expression.rows(); } + inline Index cols() const { return m_expression.cols(); } + inline Index outerStride() const { return m_expression.outerStride(); } + inline Index innerStride() const { return m_expression.innerStride(); } + + inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } + inline const Scalar* data() const { return m_expression.data(); } + + inline const CoeffReturnType coeff(Index row, Index col) const + { + return m_expression.coeff(row, col); + } + + inline Scalar& coeffRef(Index row, Index col) + { + return m_expression.const_cast_derived().coeffRef(row, col); + } + + inline const Scalar& coeffRef(Index row, Index col) const + { + return m_expression.const_cast_derived().coeffRef(row, col); + } + + inline const CoeffReturnType coeff(Index index) const + { + return m_expression.coeff(index); + } + + inline Scalar& coeffRef(Index index) + { + return m_expression.const_cast_derived().coeffRef(index); + } + + inline const Scalar& coeffRef(Index index) const + { + return m_expression.const_cast_derived().coeffRef(index); + } + + template + inline const PacketScalar packet(Index row, Index col) const + { + return m_expression.template packet(row, col); + } + + template + inline void writePacket(Index row, Index col, const PacketScalar& x) + { + m_expression.const_cast_derived().template writePacket(row, col, x); + } + + template + inline const PacketScalar packet(Index index) const + { + return m_expression.template packet(index); + } + + template + inline void writePacket(Index index, const PacketScalar& x) + { + m_expression.const_cast_derived().template writePacket(index, x); + } + + template + inline void evalTo(Dest& dst) const { dst = m_expression; } + + protected: + const NestedExpressionType m_expression; +}; + +/** \class MatrixWrapper + * \ingroup Core_Module + * + * \brief Expression of an array as a mathematical vector or matrix + * + * This class is the return type of ArrayBase::matrix(), and most of the time + * this is the only way it is use. + * + * \sa MatrixBase::matrix(), class ArrayWrapper + */ + +namespace internal { +template +struct traits > + : public traits::type > +{ + typedef MatrixXpr XprKind; +}; +} + +template +class MatrixWrapper : public MatrixBase > +{ + public: + typedef MatrixBase > Base; + EIGEN_DENSE_PUBLIC_INTERFACE(MatrixWrapper) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixWrapper) + + typedef typename internal::conditional< + internal::is_lvalue::value, + Scalar, + const Scalar + >::type ScalarWithConstIfNotLvalue; + + typedef typename internal::nested::type NestedExpressionType; + + inline MatrixWrapper(const ExpressionType& matrix) : m_expression(matrix) {} + + inline Index rows() const { return m_expression.rows(); } + inline Index cols() const { return m_expression.cols(); } + inline Index outerStride() const { return m_expression.outerStride(); } + inline Index innerStride() const { return m_expression.innerStride(); } + + inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } + inline const Scalar* data() const { return m_expression.data(); } + + inline const CoeffReturnType coeff(Index row, Index col) const + { + return m_expression.coeff(row, col); + } + + inline Scalar& coeffRef(Index row, Index col) + { + return m_expression.const_cast_derived().coeffRef(row, col); + } + + inline const Scalar& coeffRef(Index row, Index col) const + { + return m_expression.derived().coeffRef(row, col); + } + + inline const CoeffReturnType coeff(Index index) const + { + return m_expression.coeff(index); + } + + inline Scalar& coeffRef(Index index) + { + return m_expression.const_cast_derived().coeffRef(index); + } + + inline const Scalar& coeffRef(Index index) const + { + return m_expression.const_cast_derived().coeffRef(index); + } + + template + inline const PacketScalar packet(Index row, Index col) const + { + return m_expression.template packet(row, col); + } + + template + inline void writePacket(Index row, Index col, const PacketScalar& x) + { + m_expression.const_cast_derived().template writePacket(row, col, x); + } + + template + inline const PacketScalar packet(Index index) const + { + return m_expression.template packet(index); + } + + template + inline void writePacket(Index index, const PacketScalar& x) + { + m_expression.const_cast_derived().template writePacket(index, x); + } + + protected: + const NestedExpressionType m_expression; +}; + +#endif // EIGEN_ARRAYWRAPPER_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/Assign.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/Assign.h new file mode 100644 index 000000000..3a17152f0 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/Assign.h @@ -0,0 +1,593 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2007 Michael Olbrich +// Copyright (C) 2006-2010 Benoit Jacob +// Copyright (C) 2008 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_ASSIGN_H +#define EIGEN_ASSIGN_H + +namespace internal { + +/*************************************************************************** +* Part 1 : the logic deciding a strategy for traversal and unrolling * +***************************************************************************/ + +template +struct assign_traits +{ +public: + enum { + DstIsAligned = Derived::Flags & AlignedBit, + DstHasDirectAccess = Derived::Flags & DirectAccessBit, + SrcIsAligned = OtherDerived::Flags & AlignedBit, + JointAlignment = bool(DstIsAligned) && bool(SrcIsAligned) ? Aligned : Unaligned + }; + +private: + enum { + InnerSize = int(Derived::IsVectorAtCompileTime) ? int(Derived::SizeAtCompileTime) + : int(Derived::Flags)&RowMajorBit ? int(Derived::ColsAtCompileTime) + : int(Derived::RowsAtCompileTime), + InnerMaxSize = int(Derived::IsVectorAtCompileTime) ? int(Derived::MaxSizeAtCompileTime) + : int(Derived::Flags)&RowMajorBit ? int(Derived::MaxColsAtCompileTime) + : int(Derived::MaxRowsAtCompileTime), + MaxSizeAtCompileTime = Derived::SizeAtCompileTime, + PacketSize = packet_traits::size + }; + + enum { + StorageOrdersAgree = (int(Derived::IsRowMajor) == int(OtherDerived::IsRowMajor)), + MightVectorize = StorageOrdersAgree + && (int(Derived::Flags) & int(OtherDerived::Flags) & ActualPacketAccessBit), + MayInnerVectorize = MightVectorize && int(InnerSize)!=Dynamic && int(InnerSize)%int(PacketSize)==0 + && int(DstIsAligned) && int(SrcIsAligned), + MayLinearize = StorageOrdersAgree && (int(Derived::Flags) & int(OtherDerived::Flags) & LinearAccessBit), + MayLinearVectorize = MightVectorize && MayLinearize && DstHasDirectAccess + && (DstIsAligned || MaxSizeAtCompileTime == Dynamic), + /* If the destination isn't aligned, we have to do runtime checks and we don't unroll, + so it's only good for large enough sizes. */ + MaySliceVectorize = MightVectorize && DstHasDirectAccess + && (int(InnerMaxSize)==Dynamic || int(InnerMaxSize)>=3*PacketSize) + /* slice vectorization can be slow, so we only want it if the slices are big, which is + indicated by InnerMaxSize rather than InnerSize, think of the case of a dynamic block + in a fixed-size matrix */ + }; + +public: + enum { + Traversal = int(MayInnerVectorize) ? int(InnerVectorizedTraversal) + : int(MayLinearVectorize) ? int(LinearVectorizedTraversal) + : int(MaySliceVectorize) ? int(SliceVectorizedTraversal) + : int(MayLinearize) ? int(LinearTraversal) + : int(DefaultTraversal), + Vectorized = int(Traversal) == InnerVectorizedTraversal + || int(Traversal) == LinearVectorizedTraversal + || int(Traversal) == SliceVectorizedTraversal + }; + +private: + enum { + UnrollingLimit = EIGEN_UNROLLING_LIMIT * (Vectorized ? int(PacketSize) : 1), + MayUnrollCompletely = int(Derived::SizeAtCompileTime) != Dynamic + && int(OtherDerived::CoeffReadCost) != Dynamic + && int(Derived::SizeAtCompileTime) * int(OtherDerived::CoeffReadCost) <= int(UnrollingLimit), + MayUnrollInner = int(InnerSize) != Dynamic + && int(OtherDerived::CoeffReadCost) != Dynamic + && int(InnerSize) * int(OtherDerived::CoeffReadCost) <= int(UnrollingLimit) + }; + +public: + enum { + Unrolling = (int(Traversal) == int(InnerVectorizedTraversal) || int(Traversal) == int(DefaultTraversal)) + ? ( + int(MayUnrollCompletely) ? int(CompleteUnrolling) + : int(MayUnrollInner) ? int(InnerUnrolling) + : int(NoUnrolling) + ) + : int(Traversal) == int(LinearVectorizedTraversal) + ? ( bool(MayUnrollCompletely) && bool(DstIsAligned) ? int(CompleteUnrolling) : int(NoUnrolling) ) + : int(Traversal) == int(LinearTraversal) + ? ( bool(MayUnrollCompletely) ? int(CompleteUnrolling) : int(NoUnrolling) ) + : int(NoUnrolling) + }; + +#ifdef EIGEN_DEBUG_ASSIGN + static void debug() + { + EIGEN_DEBUG_VAR(DstIsAligned) + EIGEN_DEBUG_VAR(SrcIsAligned) + EIGEN_DEBUG_VAR(JointAlignment) + EIGEN_DEBUG_VAR(InnerSize) + EIGEN_DEBUG_VAR(InnerMaxSize) + EIGEN_DEBUG_VAR(PacketSize) + EIGEN_DEBUG_VAR(StorageOrdersAgree) + EIGEN_DEBUG_VAR(MightVectorize) + EIGEN_DEBUG_VAR(MayLinearize) + EIGEN_DEBUG_VAR(MayInnerVectorize) + EIGEN_DEBUG_VAR(MayLinearVectorize) + EIGEN_DEBUG_VAR(MaySliceVectorize) + EIGEN_DEBUG_VAR(Traversal) + EIGEN_DEBUG_VAR(UnrollingLimit) + EIGEN_DEBUG_VAR(MayUnrollCompletely) + EIGEN_DEBUG_VAR(MayUnrollInner) + EIGEN_DEBUG_VAR(Unrolling) + } +#endif +}; + +/*************************************************************************** +* Part 2 : meta-unrollers +***************************************************************************/ + +/************************ +*** Default traversal *** +************************/ + +template +struct assign_DefaultTraversal_CompleteUnrolling +{ + enum { + outer = Index / Derived1::InnerSizeAtCompileTime, + inner = Index % Derived1::InnerSizeAtCompileTime + }; + + EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src) + { + dst.copyCoeffByOuterInner(outer, inner, src); + assign_DefaultTraversal_CompleteUnrolling::run(dst, src); + } +}; + +template +struct assign_DefaultTraversal_CompleteUnrolling +{ + EIGEN_STRONG_INLINE static void run(Derived1 &, const Derived2 &) {} +}; + +template +struct assign_DefaultTraversal_InnerUnrolling +{ + EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src, int outer) + { + dst.copyCoeffByOuterInner(outer, Index, src); + assign_DefaultTraversal_InnerUnrolling::run(dst, src, outer); + } +}; + +template +struct assign_DefaultTraversal_InnerUnrolling +{ + EIGEN_STRONG_INLINE static void run(Derived1 &, const Derived2 &, int) {} +}; + +/*********************** +*** Linear traversal *** +***********************/ + +template +struct assign_LinearTraversal_CompleteUnrolling +{ + EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src) + { + dst.copyCoeff(Index, src); + assign_LinearTraversal_CompleteUnrolling::run(dst, src); + } +}; + +template +struct assign_LinearTraversal_CompleteUnrolling +{ + EIGEN_STRONG_INLINE static void run(Derived1 &, const Derived2 &) {} +}; + +/************************** +*** Inner vectorization *** +**************************/ + +template +struct assign_innervec_CompleteUnrolling +{ + enum { + outer = Index / Derived1::InnerSizeAtCompileTime, + inner = Index % Derived1::InnerSizeAtCompileTime, + JointAlignment = assign_traits::JointAlignment + }; + + EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src) + { + dst.template copyPacketByOuterInner(outer, inner, src); + assign_innervec_CompleteUnrolling::size, Stop>::run(dst, src); + } +}; + +template +struct assign_innervec_CompleteUnrolling +{ + EIGEN_STRONG_INLINE static void run(Derived1 &, const Derived2 &) {} +}; + +template +struct assign_innervec_InnerUnrolling +{ + EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src, int outer) + { + dst.template copyPacketByOuterInner(outer, Index, src); + assign_innervec_InnerUnrolling::size, Stop>::run(dst, src, outer); + } +}; + +template +struct assign_innervec_InnerUnrolling +{ + EIGEN_STRONG_INLINE static void run(Derived1 &, const Derived2 &, int) {} +}; + +/*************************************************************************** +* Part 3 : implementation of all cases +***************************************************************************/ + +template::Traversal, + int Unrolling = assign_traits::Unrolling> +struct assign_impl; + +/************************ +*** Default traversal *** +************************/ + +template +struct assign_impl +{ + inline static void run(Derived1 &, const Derived2 &) { } +}; + +template +struct assign_impl +{ + typedef typename Derived1::Index Index; + inline static void run(Derived1 &dst, const Derived2 &src) + { + const Index innerSize = dst.innerSize(); + const Index outerSize = dst.outerSize(); + for(Index outer = 0; outer < outerSize; ++outer) + for(Index inner = 0; inner < innerSize; ++inner) + dst.copyCoeffByOuterInner(outer, inner, src); + } +}; + +template +struct assign_impl +{ + EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src) + { + assign_DefaultTraversal_CompleteUnrolling + ::run(dst, src); + } +}; + +template +struct assign_impl +{ + typedef typename Derived1::Index Index; + EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src) + { + const Index outerSize = dst.outerSize(); + for(Index outer = 0; outer < outerSize; ++outer) + assign_DefaultTraversal_InnerUnrolling + ::run(dst, src, outer); + } +}; + +/*********************** +*** Linear traversal *** +***********************/ + +template +struct assign_impl +{ + typedef typename Derived1::Index Index; + inline static void run(Derived1 &dst, const Derived2 &src) + { + const Index size = dst.size(); + for(Index i = 0; i < size; ++i) + dst.copyCoeff(i, src); + } +}; + +template +struct assign_impl +{ + EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src) + { + assign_LinearTraversal_CompleteUnrolling + ::run(dst, src); + } +}; + +/************************** +*** Inner vectorization *** +**************************/ + +template +struct assign_impl +{ + typedef typename Derived1::Index Index; + inline static void run(Derived1 &dst, const Derived2 &src) + { + const Index innerSize = dst.innerSize(); + const Index outerSize = dst.outerSize(); + const Index packetSize = packet_traits::size; + for(Index outer = 0; outer < outerSize; ++outer) + for(Index inner = 0; inner < innerSize; inner+=packetSize) + dst.template copyPacketByOuterInner(outer, inner, src); + } +}; + +template +struct assign_impl +{ + EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src) + { + assign_innervec_CompleteUnrolling + ::run(dst, src); + } +}; + +template +struct assign_impl +{ + typedef typename Derived1::Index Index; + EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src) + { + const Index outerSize = dst.outerSize(); + for(Index outer = 0; outer < outerSize; ++outer) + assign_innervec_InnerUnrolling + ::run(dst, src, outer); + } +}; + +/*************************** +*** Linear vectorization *** +***************************/ + +template +struct unaligned_assign_impl +{ + template + static EIGEN_STRONG_INLINE void run(const Derived&, OtherDerived&, typename Derived::Index, typename Derived::Index) {} +}; + +template <> +struct unaligned_assign_impl +{ + // MSVC must not inline this functions. If it does, it fails to optimize the + // packet access path. +#ifdef _MSC_VER + template + static EIGEN_DONT_INLINE void run(const Derived& src, OtherDerived& dst, typename Derived::Index start, typename Derived::Index end) +#else + template + static EIGEN_STRONG_INLINE void run(const Derived& src, OtherDerived& dst, typename Derived::Index start, typename Derived::Index end) +#endif + { + for (typename Derived::Index index = start; index < end; ++index) + dst.copyCoeff(index, src); + } +}; + +template +struct assign_impl +{ + typedef typename Derived1::Index Index; + EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src) + { + const Index size = dst.size(); + typedef packet_traits PacketTraits; + enum { + packetSize = PacketTraits::size, + dstAlignment = PacketTraits::AlignedOnScalar ? Aligned : int(assign_traits::DstIsAligned) , + srcAlignment = assign_traits::JointAlignment + }; + const Index alignedStart = assign_traits::DstIsAligned ? 0 + : first_aligned(&dst.coeffRef(0), size); + const Index alignedEnd = alignedStart + ((size-alignedStart)/packetSize)*packetSize; + + unaligned_assign_impl::DstIsAligned!=0>::run(src,dst,0,alignedStart); + + for(Index index = alignedStart; index < alignedEnd; index += packetSize) + { + dst.template copyPacket(index, src); + } + + unaligned_assign_impl<>::run(src,dst,alignedEnd,size); + } +}; + +template +struct assign_impl +{ + typedef typename Derived1::Index Index; + EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src) + { + enum { size = Derived1::SizeAtCompileTime, + packetSize = packet_traits::size, + alignedSize = (size/packetSize)*packetSize }; + + assign_innervec_CompleteUnrolling::run(dst, src); + assign_DefaultTraversal_CompleteUnrolling::run(dst, src); + } +}; + +/************************** +*** Slice vectorization *** +***************************/ + +template +struct assign_impl +{ + typedef typename Derived1::Index Index; + inline static void run(Derived1 &dst, const Derived2 &src) + { + typedef packet_traits PacketTraits; + enum { + packetSize = PacketTraits::size, + alignable = PacketTraits::AlignedOnScalar, + dstAlignment = alignable ? Aligned : int(assign_traits::DstIsAligned) , + srcAlignment = assign_traits::JointAlignment + }; + const Index packetAlignedMask = packetSize - 1; + const Index innerSize = dst.innerSize(); + const Index outerSize = dst.outerSize(); + const Index alignedStep = alignable ? (packetSize - dst.outerStride() % packetSize) & packetAlignedMask : 0; + Index alignedStart = ((!alignable) || assign_traits::DstIsAligned) ? 0 + : first_aligned(&dst.coeffRef(0,0), innerSize); + + for(Index outer = 0; outer < outerSize; ++outer) + { + const Index alignedEnd = alignedStart + ((innerSize-alignedStart) & ~packetAlignedMask); + // do the non-vectorizable part of the assignment + for(Index inner = 0; inner(outer, inner, src); + + // do the non-vectorizable part of the assignment + for(Index inner = alignedEnd; inner((alignedStart+alignedStep)%packetSize, innerSize); + } + } +}; + +} // end namespace internal + +/*************************************************************************** +* Part 4 : implementation of DenseBase methods +***************************************************************************/ + +template +template +EIGEN_STRONG_INLINE Derived& DenseBase + ::lazyAssign(const DenseBase& other) +{ + enum{ + SameType = internal::is_same::value + }; + + EIGEN_STATIC_ASSERT_LVALUE(Derived) + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived,OtherDerived) + EIGEN_STATIC_ASSERT(SameType,YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) + +#ifdef EIGEN_DEBUG_ASSIGN + internal::assign_traits::debug(); +#endif + eigen_assert(rows() == other.rows() && cols() == other.cols()); + internal::assign_impl::Traversal) + : int(InvalidTraversal)>::run(derived(),other.derived()); +#ifndef EIGEN_NO_DEBUG + checkTransposeAliasing(other.derived()); +#endif + return derived(); +} + +namespace internal { + +template +struct assign_selector; + +template +struct assign_selector { + EIGEN_STRONG_INLINE static Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.derived()); } +}; +template +struct assign_selector { + EIGEN_STRONG_INLINE static Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.eval()); } +}; +template +struct assign_selector { + EIGEN_STRONG_INLINE static Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.transpose()); } +}; +template +struct assign_selector { + EIGEN_STRONG_INLINE static Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.transpose().eval()); } +}; + +} // end namespace internal + +template +template +EIGEN_STRONG_INLINE Derived& DenseBase::operator=(const DenseBase& other) +{ + return internal::assign_selector::run(derived(), other.derived()); +} + +template +EIGEN_STRONG_INLINE Derived& DenseBase::operator=(const DenseBase& other) +{ + return internal::assign_selector::run(derived(), other.derived()); +} + +template +EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const MatrixBase& other) +{ + return internal::assign_selector::run(derived(), other.derived()); +} + +template +template +EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const DenseBase& other) +{ + return internal::assign_selector::run(derived(), other.derived()); +} + +template +template +EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const EigenBase& other) +{ + other.derived().evalTo(derived()); + return derived(); +} + +template +template +EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const ReturnByValue& other) +{ + other.evalTo(derived()); + return derived(); +} + +#endif // EIGEN_ASSIGN_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/BandMatrix.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/BandMatrix.h new file mode 100644 index 000000000..dda8efba3 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/BandMatrix.h @@ -0,0 +1,345 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_BANDMATRIX_H +#define EIGEN_BANDMATRIX_H + +namespace internal { + + +template +class BandMatrixBase : public EigenBase +{ + public: + + enum { + Flags = internal::traits::Flags, + CoeffReadCost = internal::traits::CoeffReadCost, + RowsAtCompileTime = internal::traits::RowsAtCompileTime, + ColsAtCompileTime = internal::traits::ColsAtCompileTime, + MaxRowsAtCompileTime = internal::traits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = internal::traits::MaxColsAtCompileTime, + Supers = internal::traits::Supers, + Subs = internal::traits::Subs, + Options = internal::traits::Options + }; + typedef typename internal::traits::Scalar Scalar; + typedef Matrix DenseMatrixType; + typedef typename DenseMatrixType::Index Index; + typedef typename internal::traits::CoefficientsType CoefficientsType; + typedef EigenBase Base; + + protected: + enum { + DataRowsAtCompileTime = ((Supers!=Dynamic) && (Subs!=Dynamic)) + ? 1 + Supers + Subs + : Dynamic, + SizeAtCompileTime = EIGEN_SIZE_MIN_PREFER_DYNAMIC(RowsAtCompileTime,ColsAtCompileTime) + }; + + public: + + using Base::derived; + using Base::rows; + using Base::cols; + + /** \returns the number of super diagonals */ + inline Index supers() const { return derived().supers(); } + + /** \returns the number of sub diagonals */ + inline Index subs() const { return derived().subs(); } + + /** \returns an expression of the underlying coefficient matrix */ + inline const CoefficientsType& coeffs() const { return derived().coeffs(); } + + /** \returns an expression of the underlying coefficient matrix */ + inline CoefficientsType& coeffs() { return derived().coeffs(); } + + /** \returns a vector expression of the \a i -th column, + * only the meaningful part is returned. + * \warning the internal storage must be column major. */ + inline Block col(Index i) + { + EIGEN_STATIC_ASSERT((Options&RowMajor)==0,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); + Index start = 0; + Index len = coeffs().rows(); + if (i<=supers()) + { + start = supers()-i; + len = std::min(rows(),std::max(0,coeffs().rows() - (supers()-i))); + } + else if (i>=rows()-subs()) + len = std::max(0,coeffs().rows() - (i + 1 - rows() + subs())); + return Block(coeffs(), start, i, len, 1); + } + + /** \returns a vector expression of the main diagonal */ + inline Block diagonal() + { return Block(coeffs(),supers(),0,1,std::min(rows(),cols())); } + + /** \returns a vector expression of the main diagonal (const version) */ + inline const Block diagonal() const + { return Block(coeffs(),supers(),0,1,std::min(rows(),cols())); } + + template struct DiagonalIntReturnType { + enum { + ReturnOpposite = (Options&SelfAdjoint) && (((Index)>0 && Supers==0) || ((Index)<0 && Subs==0)), + Conjugate = ReturnOpposite && NumTraits::IsComplex, + ActualIndex = ReturnOpposite ? -Index : Index, + DiagonalSize = (RowsAtCompileTime==Dynamic || ColsAtCompileTime==Dynamic) + ? Dynamic + : (ActualIndex<0 + ? EIGEN_SIZE_MIN_PREFER_DYNAMIC(ColsAtCompileTime, RowsAtCompileTime + ActualIndex) + : EIGEN_SIZE_MIN_PREFER_DYNAMIC(RowsAtCompileTime, ColsAtCompileTime - ActualIndex)) + }; + typedef Block BuildType; + typedef typename internal::conditional,BuildType >, + BuildType>::type Type; + }; + + /** \returns a vector expression of the \a N -th sub or super diagonal */ + template inline typename DiagonalIntReturnType::Type diagonal() + { + return typename DiagonalIntReturnType::BuildType(coeffs(), supers()-N, std::max(0,N), 1, diagonalLength(N)); + } + + /** \returns a vector expression of the \a N -th sub or super diagonal */ + template inline const typename DiagonalIntReturnType::Type diagonal() const + { + return typename DiagonalIntReturnType::BuildType(coeffs(), supers()-N, std::max(0,N), 1, diagonalLength(N)); + } + + /** \returns a vector expression of the \a i -th sub or super diagonal */ + inline Block diagonal(Index i) + { + eigen_assert((i<0 && -i<=subs()) || (i>=0 && i<=supers())); + return Block(coeffs(), supers()-i, std::max(0,i), 1, diagonalLength(i)); + } + + /** \returns a vector expression of the \a i -th sub or super diagonal */ + inline const Block diagonal(Index i) const + { + eigen_assert((i<0 && -i<=subs()) || (i>=0 && i<=supers())); + return Block(coeffs(), supers()-i, std::max(0,i), 1, diagonalLength(i)); + } + + template inline void evalTo(Dest& dst) const + { + dst.resize(rows(),cols()); + dst.setZero(); + dst.diagonal() = diagonal(); + for (Index i=1; i<=supers();++i) + dst.diagonal(i) = diagonal(i); + for (Index i=1; i<=subs();++i) + dst.diagonal(-i) = diagonal(-i); + } + + DenseMatrixType toDenseMatrix() const + { + DenseMatrixType res(rows(),cols()); + evalTo(res); + return res; + } + + protected: + + inline Index diagonalLength(Index i) const + { return i<0 ? std::min(cols(),rows()+i) : std::min(rows(),cols()-i); } +}; + +/** + * \class BandMatrix + * \ingroup Core_Module + * + * \brief Represents a rectangular matrix with a banded storage + * + * \param _Scalar Numeric type, i.e. float, double, int + * \param Rows Number of rows, or \b Dynamic + * \param Cols Number of columns, or \b Dynamic + * \param Supers Number of super diagonal + * \param Subs Number of sub diagonal + * \param _Options A combination of either \b #RowMajor or \b #ColMajor, and of \b #SelfAdjoint + * The former controls \ref TopicStorageOrders "storage order", and defaults to + * column-major. The latter controls whether the matrix represents a selfadjoint + * matrix in which case either Supers of Subs have to be null. + * + * \sa class TridiagonalMatrix + */ + +template +struct traits > +{ + typedef _Scalar Scalar; + typedef Dense StorageKind; + typedef DenseIndex Index; + enum { + CoeffReadCost = NumTraits::ReadCost, + RowsAtCompileTime = _Rows, + ColsAtCompileTime = _Cols, + MaxRowsAtCompileTime = _Rows, + MaxColsAtCompileTime = _Cols, + Flags = LvalueBit, + Supers = _Supers, + Subs = _Subs, + Options = _Options, + DataRowsAtCompileTime = ((Supers!=Dynamic) && (Subs!=Dynamic)) ? 1 + Supers + Subs : Dynamic + }; + typedef Matrix CoefficientsType; +}; + +template +class BandMatrix : public BandMatrixBase > +{ + public: + + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::traits::Index Index; + typedef typename internal::traits::CoefficientsType CoefficientsType; + + inline BandMatrix(Index rows=Rows, Index cols=Cols, Index supers=Supers, Index subs=Subs) + : m_coeffs(1+supers+subs,cols), + m_rows(rows), m_supers(supers), m_subs(subs) + { + } + + /** \returns the number of columns */ + inline Index rows() const { return m_rows.value(); } + + /** \returns the number of rows */ + inline Index cols() const { return m_coeffs.cols(); } + + /** \returns the number of super diagonals */ + inline Index supers() const { return m_supers.value(); } + + /** \returns the number of sub diagonals */ + inline Index subs() const { return m_subs.value(); } + + inline const CoefficientsType& coeffs() const { return m_coeffs; } + inline CoefficientsType& coeffs() { return m_coeffs; } + + protected: + + CoefficientsType m_coeffs; + internal::variable_if_dynamic m_rows; + internal::variable_if_dynamic m_supers; + internal::variable_if_dynamic m_subs; +}; + +template +class BandMatrixWrapper; + +template +struct traits > +{ + typedef typename _CoefficientsType::Scalar Scalar; + typedef typename _CoefficientsType::StorageKind StorageKind; + typedef typename _CoefficientsType::Index Index; + enum { + CoeffReadCost = internal::traits<_CoefficientsType>::CoeffReadCost, + RowsAtCompileTime = _Rows, + ColsAtCompileTime = _Cols, + MaxRowsAtCompileTime = _Rows, + MaxColsAtCompileTime = _Cols, + Flags = LvalueBit, + Supers = _Supers, + Subs = _Subs, + Options = _Options, + DataRowsAtCompileTime = ((Supers!=Dynamic) && (Subs!=Dynamic)) ? 1 + Supers + Subs : Dynamic + }; + typedef _CoefficientsType CoefficientsType; +}; + +template +class BandMatrixWrapper : public BandMatrixBase > +{ + public: + + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::traits::CoefficientsType CoefficientsType; + typedef typename internal::traits::Index Index; + + inline BandMatrixWrapper(const CoefficientsType& coeffs, Index rows=_Rows, Index cols=_Cols, Index supers=_Supers, Index subs=_Subs) + : m_coeffs(coeffs), + m_rows(rows), m_supers(supers), m_subs(subs) + { + //internal::assert(coeffs.cols()==cols() && (supers()+subs()+1)==coeffs.rows()); + } + + /** \returns the number of columns */ + inline Index rows() const { return m_rows.value(); } + + /** \returns the number of rows */ + inline Index cols() const { return m_coeffs.cols(); } + + /** \returns the number of super diagonals */ + inline Index supers() const { return m_supers.value(); } + + /** \returns the number of sub diagonals */ + inline Index subs() const { return m_subs.value(); } + + inline const CoefficientsType& coeffs() const { return m_coeffs; } + + protected: + + const CoefficientsType& m_coeffs; + internal::variable_if_dynamic m_rows; + internal::variable_if_dynamic m_supers; + internal::variable_if_dynamic m_subs; +}; + +/** + * \class TridiagonalMatrix + * \ingroup Core_Module + * + * \brief Represents a tridiagonal matrix with a compact banded storage + * + * \param _Scalar Numeric type, i.e. float, double, int + * \param Size Number of rows and cols, or \b Dynamic + * \param _Options Can be 0 or \b SelfAdjoint + * + * \sa class BandMatrix + */ +template +class TridiagonalMatrix : public BandMatrix +{ + typedef BandMatrix Base; + typedef typename Base::Index Index; + public: + TridiagonalMatrix(Index size = Size) : Base(size,size,Options&SelfAdjoint?0:1,1) {} + + inline typename Base::template DiagonalIntReturnType<1>::Type super() + { return Base::template diagonal<1>(); } + inline const typename Base::template DiagonalIntReturnType<1>::Type super() const + { return Base::template diagonal<1>(); } + inline typename Base::template DiagonalIntReturnType<-1>::Type sub() + { return Base::template diagonal<-1>(); } + inline const typename Base::template DiagonalIntReturnType<-1>::Type sub() const + { return Base::template diagonal<-1>(); } + protected: +}; + +} // end namespace internal + +#endif // EIGEN_BANDMATRIX_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/Block.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/Block.h new file mode 100644 index 000000000..2b251bc2c --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/Block.h @@ -0,0 +1,349 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2006-2010 Benoit Jacob +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_BLOCK_H +#define EIGEN_BLOCK_H + +/** \class Block + * \ingroup Core_Module + * + * \brief Expression of a fixed-size or dynamic-size block + * + * \param XprType the type of the expression in which we are taking a block + * \param BlockRows the number of rows of the block we are taking at compile time (optional) + * \param BlockCols the number of columns of the block we are taking at compile time (optional) + * \param _DirectAccessStatus \internal used for partial specialization + * + * This class represents an expression of either a fixed-size or dynamic-size block. It is the return + * type of DenseBase::block(Index,Index,Index,Index) and DenseBase::block(Index,Index) and + * most of the time this is the only way it is used. + * + * However, if you want to directly maniputate block expressions, + * for instance if you want to write a function returning such an expression, you + * will need to use this class. + * + * Here is an example illustrating the dynamic case: + * \include class_Block.cpp + * Output: \verbinclude class_Block.out + * + * \note Even though this expression has dynamic size, in the case where \a XprType + * has fixed size, this expression inherits a fixed maximal size which means that evaluating + * it does not cause a dynamic memory allocation. + * + * Here is an example illustrating the fixed-size case: + * \include class_FixedBlock.cpp + * Output: \verbinclude class_FixedBlock.out + * + * \sa DenseBase::block(Index,Index,Index,Index), DenseBase::block(Index,Index), class VectorBlock + */ + +namespace internal { +template +struct traits > : traits +{ + typedef typename traits::Scalar Scalar; + typedef typename traits::StorageKind StorageKind; + typedef typename traits::XprKind XprKind; + typedef typename nested::type XprTypeNested; + typedef typename remove_reference::type _XprTypeNested; + enum{ + MatrixRows = traits::RowsAtCompileTime, + MatrixCols = traits::ColsAtCompileTime, + RowsAtCompileTime = MatrixRows == 0 ? 0 : BlockRows, + ColsAtCompileTime = MatrixCols == 0 ? 0 : BlockCols, + MaxRowsAtCompileTime = BlockRows==0 ? 0 + : RowsAtCompileTime != Dynamic ? int(RowsAtCompileTime) + : int(traits::MaxRowsAtCompileTime), + MaxColsAtCompileTime = BlockCols==0 ? 0 + : ColsAtCompileTime != Dynamic ? int(ColsAtCompileTime) + : int(traits::MaxColsAtCompileTime), + XprTypeIsRowMajor = (int(traits::Flags)&RowMajorBit) != 0, + IsRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1 + : (MaxColsAtCompileTime==1&&MaxRowsAtCompileTime!=1) ? 0 + : XprTypeIsRowMajor, + HasSameStorageOrderAsXprType = (IsRowMajor == XprTypeIsRowMajor), + InnerSize = IsRowMajor ? int(ColsAtCompileTime) : int(RowsAtCompileTime), + InnerStrideAtCompileTime = HasSameStorageOrderAsXprType + ? int(inner_stride_at_compile_time::ret) + : int(outer_stride_at_compile_time::ret), + OuterStrideAtCompileTime = HasSameStorageOrderAsXprType + ? int(outer_stride_at_compile_time::ret) + : int(inner_stride_at_compile_time::ret), + MaskPacketAccessBit = (InnerSize == Dynamic || (InnerSize % packet_traits::size) == 0) + && (InnerStrideAtCompileTime == 1) + ? PacketAccessBit : 0, + MaskAlignedBit = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic) && ((OuterStrideAtCompileTime % packet_traits::size) == 0)) ? AlignedBit : 0, + FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1) ? LinearAccessBit : 0, + FlagsLvalueBit = is_lvalue::value ? LvalueBit : 0, + FlagsRowMajorBit = IsRowMajor ? RowMajorBit : 0, + Flags0 = traits::Flags & ( (HereditaryBits & ~RowMajorBit) | + DirectAccessBit | + MaskPacketAccessBit | + MaskAlignedBit), + Flags = Flags0 | FlagsLinearAccessBit | FlagsLvalueBit | FlagsRowMajorBit + }; +}; +} + +template class Block + : public internal::dense_xpr_base >::type +{ + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Block) + + class InnerIterator; + + /** Column or Row constructor + */ + inline Block(XprType& xpr, Index i) + : m_xpr(xpr), + // It is a row if and only if BlockRows==1 and BlockCols==XprType::ColsAtCompileTime, + // and it is a column if and only if BlockRows==XprType::RowsAtCompileTime and BlockCols==1, + // all other cases are invalid. + // The case a 1x1 matrix seems ambiguous, but the result is the same anyway. + m_startRow( (BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) ? i : 0), + m_startCol( (BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) ? i : 0), + m_blockRows(BlockRows==1 ? 1 : xpr.rows()), + m_blockCols(BlockCols==1 ? 1 : xpr.cols()) + { + eigen_assert( (i>=0) && ( + ((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && i= 0 && BlockRows >= 1 && startRow + BlockRows <= xpr.rows() + && startCol >= 0 && BlockCols >= 1 && startCol + BlockCols <= xpr.cols()); + } + + /** Dynamic-size constructor + */ + inline Block(XprType& xpr, + Index startRow, Index startCol, + Index blockRows, Index blockCols) + : m_xpr(xpr), m_startRow(startRow), m_startCol(startCol), + m_blockRows(blockRows), m_blockCols(blockCols) + { + eigen_assert((RowsAtCompileTime==Dynamic || RowsAtCompileTime==blockRows) + && (ColsAtCompileTime==Dynamic || ColsAtCompileTime==blockCols)); + eigen_assert(startRow >= 0 && blockRows >= 0 && startRow + blockRows <= xpr.rows() + && startCol >= 0 && blockCols >= 0 && startCol + blockCols <= xpr.cols()); + } + + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block) + + inline Index rows() const { return m_blockRows.value(); } + inline Index cols() const { return m_blockCols.value(); } + + inline Scalar& coeffRef(Index row, Index col) + { + EIGEN_STATIC_ASSERT_LVALUE(XprType) + return m_xpr.const_cast_derived() + .coeffRef(row + m_startRow.value(), col + m_startCol.value()); + } + + inline const Scalar& coeffRef(Index row, Index col) const + { + return m_xpr.derived() + .coeffRef(row + m_startRow.value(), col + m_startCol.value()); + } + + EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index row, Index col) const + { + return m_xpr.coeff(row + m_startRow.value(), col + m_startCol.value()); + } + + inline Scalar& coeffRef(Index index) + { + EIGEN_STATIC_ASSERT_LVALUE(XprType) + return m_xpr.const_cast_derived() + .coeffRef(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), + m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); + } + + inline const Scalar& coeffRef(Index index) const + { + return m_xpr.const_cast_derived() + .coeffRef(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), + m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); + } + + inline const CoeffReturnType coeff(Index index) const + { + return m_xpr + .coeff(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), + m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); + } + + template + inline PacketScalar packet(Index row, Index col) const + { + return m_xpr.template packet + (row + m_startRow.value(), col + m_startCol.value()); + } + + template + inline void writePacket(Index row, Index col, const PacketScalar& x) + { + m_xpr.const_cast_derived().template writePacket + (row + m_startRow.value(), col + m_startCol.value(), x); + } + + template + inline PacketScalar packet(Index index) const + { + return m_xpr.template packet + (m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), + m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); + } + + template + inline void writePacket(Index index, const PacketScalar& x) + { + m_xpr.const_cast_derived().template writePacket + (m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), + m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0), x); + } + + #ifdef EIGEN_PARSED_BY_DOXYGEN + /** \sa MapBase::data() */ + inline const Scalar* data() const; + inline Index innerStride() const; + inline Index outerStride() const; + #endif + + protected: + + const typename XprType::Nested m_xpr; + const internal::variable_if_dynamic m_startRow; + const internal::variable_if_dynamic m_startCol; + const internal::variable_if_dynamic m_blockRows; + const internal::variable_if_dynamic m_blockCols; +}; + +/** \internal */ +template +class Block + : public MapBase > +{ + public: + + typedef MapBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Block) + + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block) + + /** Column or Row constructor + */ + inline Block(XprType& xpr, Index i) + : Base(internal::const_cast_ptr(&xpr.coeffRef( + (BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) ? i : 0, + (BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) ? i : 0)), + BlockRows==1 ? 1 : xpr.rows(), + BlockCols==1 ? 1 : xpr.cols()), + m_xpr(xpr) + { + eigen_assert( (i>=0) && ( + ((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && i= 0 && BlockRows >= 1 && startRow + BlockRows <= xpr.rows() + && startCol >= 0 && BlockCols >= 1 && startCol + BlockCols <= xpr.cols()); + init(); + } + + /** Dynamic-size constructor + */ + inline Block(XprType& xpr, + Index startRow, Index startCol, + Index blockRows, Index blockCols) + : Base(internal::const_cast_ptr(&xpr.coeffRef(startRow,startCol)), blockRows, blockCols), + m_xpr(xpr) + { + eigen_assert((RowsAtCompileTime==Dynamic || RowsAtCompileTime==blockRows) + && (ColsAtCompileTime==Dynamic || ColsAtCompileTime==blockCols)); + eigen_assert(startRow >= 0 && blockRows >= 0 && startRow + blockRows <= xpr.rows() + && startCol >= 0 && blockCols >= 0 && startCol + blockCols <= xpr.cols()); + init(); + } + + /** \sa MapBase::innerStride() */ + inline Index innerStride() const + { + return internal::traits::HasSameStorageOrderAsXprType + ? m_xpr.innerStride() + : m_xpr.outerStride(); + } + + /** \sa MapBase::outerStride() */ + inline Index outerStride() const + { + return m_outerStride; + } + + #ifndef __SUNPRO_CC + // FIXME sunstudio is not friendly with the above friend... + // META-FIXME there is no 'friend' keyword around here. Is this obsolete? + protected: + #endif + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /** \internal used by allowAligned() */ + inline Block(XprType& xpr, const Scalar* data, Index blockRows, Index blockCols) + : Base(data, blockRows, blockCols), m_xpr(xpr) + { + init(); + } + #endif + + protected: + void init() + { + m_outerStride = internal::traits::HasSameStorageOrderAsXprType + ? m_xpr.outerStride() + : m_xpr.innerStride(); + } + + const typename XprType::Nested m_xpr; + int m_outerStride; +}; + + +#endif // EIGEN_BLOCK_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/BooleanRedux.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/BooleanRedux.h new file mode 100644 index 000000000..5c3444a57 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/BooleanRedux.h @@ -0,0 +1,149 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_ALLANDANY_H +#define EIGEN_ALLANDANY_H + +namespace internal { + +template +struct all_unroller +{ + enum { + col = (UnrollCount-1) / Derived::RowsAtCompileTime, + row = (UnrollCount-1) % Derived::RowsAtCompileTime + }; + + inline static bool run(const Derived &mat) + { + return all_unroller::run(mat) && mat.coeff(row, col); + } +}; + +template +struct all_unroller +{ + inline static bool run(const Derived &mat) { return mat.coeff(0, 0); } +}; + +template +struct all_unroller +{ + inline static bool run(const Derived &) { return false; } +}; + +template +struct any_unroller +{ + enum { + col = (UnrollCount-1) / Derived::RowsAtCompileTime, + row = (UnrollCount-1) % Derived::RowsAtCompileTime + }; + + inline static bool run(const Derived &mat) + { + return any_unroller::run(mat) || mat.coeff(row, col); + } +}; + +template +struct any_unroller +{ + inline static bool run(const Derived &mat) { return mat.coeff(0, 0); } +}; + +template +struct any_unroller +{ + inline static bool run(const Derived &) { return false; } +}; + +} // end namespace internal + +/** \returns true if all coefficients are true + * + * Example: \include MatrixBase_all.cpp + * Output: \verbinclude MatrixBase_all.out + * + * \sa any(), Cwise::operator<() + */ +template +inline bool DenseBase::all() const +{ + enum { + unroll = SizeAtCompileTime != Dynamic + && CoeffReadCost != Dynamic + && NumTraits::AddCost != Dynamic + && SizeAtCompileTime * (CoeffReadCost + NumTraits::AddCost) <= EIGEN_UNROLLING_LIMIT + }; + if(unroll) + return internal::all_unroller::run(derived()); + else + { + for(Index j = 0; j < cols(); ++j) + for(Index i = 0; i < rows(); ++i) + if (!coeff(i, j)) return false; + return true; + } +} + +/** \returns true if at least one coefficient is true + * + * \sa all() + */ +template +inline bool DenseBase::any() const +{ + enum { + unroll = SizeAtCompileTime != Dynamic + && CoeffReadCost != Dynamic + && NumTraits::AddCost != Dynamic + && SizeAtCompileTime * (CoeffReadCost + NumTraits::AddCost) <= EIGEN_UNROLLING_LIMIT + }; + if(unroll) + return internal::any_unroller::run(derived()); + else + { + for(Index j = 0; j < cols(); ++j) + for(Index i = 0; i < rows(); ++i) + if (coeff(i, j)) return true; + return false; + } +} + +/** \returns the number of coefficients which evaluate to true + * + * \sa all(), any() + */ +template +inline typename DenseBase::Index DenseBase::count() const +{ + return derived().template cast().template cast().sum(); +} + +#endif // EIGEN_ALLANDANY_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/CMakeLists.txt b/gtsam/3rdparty/Eigen/Eigen/src/Core/CMakeLists.txt new file mode 100644 index 000000000..2346fc2bb --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/CMakeLists.txt @@ -0,0 +1,10 @@ +FILE(GLOB Eigen_Core_SRCS "*.h") + +INSTALL(FILES + ${Eigen_Core_SRCS} + DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core COMPONENT Devel + ) + +ADD_SUBDIRECTORY(products) +ADD_SUBDIRECTORY(util) +ADD_SUBDIRECTORY(arch) diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/CommaInitializer.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/CommaInitializer.h new file mode 100644 index 000000000..92422bf2f --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/CommaInitializer.h @@ -0,0 +1,150 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_COMMAINITIALIZER_H +#define EIGEN_COMMAINITIALIZER_H + +/** \class CommaInitializer + * \ingroup Core_Module + * + * \brief Helper class used by the comma initializer operator + * + * This class is internally used to implement the comma initializer feature. It is + * the return type of MatrixBase::operator<<, and most of the time this is the only + * way it is used. + * + * \sa \ref MatrixBaseCommaInitRef "MatrixBase::operator<<", CommaInitializer::finished() + */ +template +struct CommaInitializer +{ + typedef typename XprType::Scalar Scalar; + typedef typename XprType::Index Index; + + inline CommaInitializer(XprType& xpr, const Scalar& s) + : m_xpr(xpr), m_row(0), m_col(1), m_currentBlockRows(1) + { + m_xpr.coeffRef(0,0) = s; + } + + template + inline CommaInitializer(XprType& xpr, const DenseBase& other) + : m_xpr(xpr), m_row(0), m_col(other.cols()), m_currentBlockRows(other.rows()) + { + m_xpr.block(0, 0, other.rows(), other.cols()) = other; + } + + /* inserts a scalar value in the target matrix */ + CommaInitializer& operator,(const Scalar& s) + { + if (m_col==m_xpr.cols()) + { + m_row+=m_currentBlockRows; + m_col = 0; + m_currentBlockRows = 1; + eigen_assert(m_row + CommaInitializer& operator,(const DenseBase& other) + { + if (m_col==m_xpr.cols()) + { + m_row+=m_currentBlockRows; + m_col = 0; + m_currentBlockRows = other.rows(); + eigen_assert(m_row+m_currentBlockRows<=m_xpr.rows() + && "Too many rows passed to comma initializer (operator<<)"); + } + eigen_assert(m_col + (m_row, m_col) = other; + else + m_xpr.block(m_row, m_col, other.rows(), other.cols()) = other; + m_col += other.cols(); + return *this; + } + + inline ~CommaInitializer() + { + eigen_assert((m_row+m_currentBlockRows) == m_xpr.rows() + && m_col == m_xpr.cols() + && "Too few coefficients passed to comma initializer (operator<<)"); + } + + /** \returns the built matrix once all its coefficients have been set. + * Calling finished is 100% optional. Its purpose is to write expressions + * like this: + * \code + * quaternion.fromRotationMatrix((Matrix3f() << axis0, axis1, axis2).finished()); + * \endcode + */ + inline XprType& finished() { return m_xpr; } + + XprType& m_xpr; // target expression + Index m_row; // current row id + Index m_col; // current col id + Index m_currentBlockRows; // current block height +}; + +/** \anchor MatrixBaseCommaInitRef + * Convenient operator to set the coefficients of a matrix. + * + * The coefficients must be provided in a row major order and exactly match + * the size of the matrix. Otherwise an assertion is raised. + * + * Example: \include MatrixBase_set.cpp + * Output: \verbinclude MatrixBase_set.out + * + * \sa CommaInitializer::finished(), class CommaInitializer + */ +template +inline CommaInitializer DenseBase::operator<< (const Scalar& s) +{ + return CommaInitializer(*static_cast(this), s); +} + +/** \sa operator<<(const Scalar&) */ +template +template +inline CommaInitializer +DenseBase::operator<<(const DenseBase& other) +{ + return CommaInitializer(*static_cast(this), other); +} + +#endif // EIGEN_COMMAINITIALIZER_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/CwiseBinaryOp.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/CwiseBinaryOp.h new file mode 100644 index 000000000..7386b2e18 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/CwiseBinaryOp.h @@ -0,0 +1,240 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2009 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_CWISE_BINARY_OP_H +#define EIGEN_CWISE_BINARY_OP_H + +/** \class CwiseBinaryOp + * \ingroup Core_Module + * + * \brief Generic expression where a coefficient-wise binary operator is applied to two expressions + * + * \param BinaryOp template functor implementing the operator + * \param Lhs the type of the left-hand side + * \param Rhs the type of the right-hand side + * + * This class represents an expression where a coefficient-wise binary operator is applied to two expressions. + * It is the return type of binary operators, by which we mean only those binary operators where + * both the left-hand side and the right-hand side are Eigen expressions. + * For example, the return type of matrix1+matrix2 is a CwiseBinaryOp. + * + * Most of the time, this is the only way that it is used, so you typically don't have to name + * CwiseBinaryOp types explicitly. + * + * \sa MatrixBase::binaryExpr(const MatrixBase &,const CustomBinaryOp &) const, class CwiseUnaryOp, class CwiseNullaryOp + */ + +namespace internal { +template +struct traits > +{ + // we must not inherit from traits since it has + // the potential to cause problems with MSVC + typedef typename remove_all::type Ancestor; + typedef typename traits::XprKind XprKind; + enum { + RowsAtCompileTime = traits::RowsAtCompileTime, + ColsAtCompileTime = traits::ColsAtCompileTime, + MaxRowsAtCompileTime = traits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = traits::MaxColsAtCompileTime + }; + + // even though we require Lhs and Rhs to have the same scalar type (see CwiseBinaryOp constructor), + // we still want to handle the case when the result type is different. + typedef typename result_of< + BinaryOp( + typename Lhs::Scalar, + typename Rhs::Scalar + ) + >::type Scalar; + typedef typename promote_storage_type::StorageKind, + typename traits::StorageKind>::ret StorageKind; + typedef typename promote_index_type::Index, + typename traits::Index>::type Index; + typedef typename Lhs::Nested LhsNested; + typedef typename Rhs::Nested RhsNested; + typedef typename remove_reference::type _LhsNested; + typedef typename remove_reference::type _RhsNested; + enum { + LhsCoeffReadCost = _LhsNested::CoeffReadCost, + RhsCoeffReadCost = _RhsNested::CoeffReadCost, + LhsFlags = _LhsNested::Flags, + RhsFlags = _RhsNested::Flags, + SameType = is_same::value, + StorageOrdersAgree = (int(Lhs::Flags)&RowMajorBit)==(int(Rhs::Flags)&RowMajorBit), + Flags0 = (int(LhsFlags) | int(RhsFlags)) & ( + HereditaryBits + | (int(LhsFlags) & int(RhsFlags) & + ( AlignedBit + | (StorageOrdersAgree ? LinearAccessBit : 0) + | (functor_traits::PacketAccess && StorageOrdersAgree && SameType ? PacketAccessBit : 0) + ) + ) + ), + Flags = (Flags0 & ~RowMajorBit) | (LhsFlags & RowMajorBit), + CoeffReadCost = LhsCoeffReadCost + RhsCoeffReadCost + functor_traits::Cost + }; +}; +} // end namespace internal + +// we require Lhs and Rhs to have the same scalar type. Currently there is no example of a binary functor +// that would take two operands of different types. If there were such an example, then this check should be +// moved to the BinaryOp functors, on a per-case basis. This would however require a change in the BinaryOp functors, as +// currently they take only one typename Scalar template parameter. +// It is tempting to always allow mixing different types but remember that this is often impossible in the vectorized paths. +// So allowing mixing different types gives very unexpected errors when enabling vectorization, when the user tries to +// add together a float matrix and a double matrix. +#define EIGEN_CHECK_BINARY_COMPATIBILIY(BINOP,LHS,RHS) \ + EIGEN_STATIC_ASSERT((internal::functor_allows_mixing_real_and_complex::ret \ + ? int(internal::is_same::Real, typename NumTraits::Real>::value) \ + : int(internal::is_same::value)), \ + YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) + +template +class CwiseBinaryOpImpl; + +template +class CwiseBinaryOp : internal::no_assignment_operator, + public CwiseBinaryOpImpl< + BinaryOp, Lhs, Rhs, + typename internal::promote_storage_type::StorageKind, + typename internal::traits::StorageKind>::ret> +{ + public: + + typedef typename CwiseBinaryOpImpl< + BinaryOp, Lhs, Rhs, + typename internal::promote_storage_type::StorageKind, + typename internal::traits::StorageKind>::ret>::Base Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseBinaryOp) + + typedef typename internal::nested::type LhsNested; + typedef typename internal::nested::type RhsNested; + typedef typename internal::remove_reference::type _LhsNested; + typedef typename internal::remove_reference::type _RhsNested; + + EIGEN_STRONG_INLINE CwiseBinaryOp(const Lhs& lhs, const Rhs& rhs, const BinaryOp& func = BinaryOp()) + : m_lhs(lhs), m_rhs(rhs), m_functor(func) + { + EIGEN_CHECK_BINARY_COMPATIBILIY(BinaryOp,typename Lhs::Scalar,typename Rhs::Scalar); + // require the sizes to match + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Lhs, Rhs) + eigen_assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols()); + } + + EIGEN_STRONG_INLINE Index rows() const { + // return the fixed size type if available to enable compile time optimizations + if (internal::traits::type>::RowsAtCompileTime==Dynamic) + return m_rhs.rows(); + else + return m_lhs.rows(); + } + EIGEN_STRONG_INLINE Index cols() const { + // return the fixed size type if available to enable compile time optimizations + if (internal::traits::type>::ColsAtCompileTime==Dynamic) + return m_rhs.cols(); + else + return m_lhs.cols(); + } + + /** \returns the left hand side nested expression */ + const _LhsNested& lhs() const { return m_lhs; } + /** \returns the right hand side nested expression */ + const _RhsNested& rhs() const { return m_rhs; } + /** \returns the functor representing the binary operation */ + const BinaryOp& functor() const { return m_functor; } + + protected: + const LhsNested m_lhs; + const RhsNested m_rhs; + const BinaryOp m_functor; +}; + +template +class CwiseBinaryOpImpl + : public internal::dense_xpr_base >::type +{ + typedef CwiseBinaryOp Derived; + public: + + typedef typename internal::dense_xpr_base >::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE( Derived ) + + EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const + { + return derived().functor()(derived().lhs().coeff(row, col), + derived().rhs().coeff(row, col)); + } + + template + EIGEN_STRONG_INLINE PacketScalar packet(Index row, Index col) const + { + return derived().functor().packetOp(derived().lhs().template packet(row, col), + derived().rhs().template packet(row, col)); + } + + EIGEN_STRONG_INLINE const Scalar coeff(Index index) const + { + return derived().functor()(derived().lhs().coeff(index), + derived().rhs().coeff(index)); + } + + template + EIGEN_STRONG_INLINE PacketScalar packet(Index index) const + { + return derived().functor().packetOp(derived().lhs().template packet(index), + derived().rhs().template packet(index)); + } +}; + +/** replaces \c *this by \c *this - \a other. + * + * \returns a reference to \c *this + */ +template +template +EIGEN_STRONG_INLINE Derived & +MatrixBase::operator-=(const MatrixBase &other) +{ + SelfCwiseBinaryOp, Derived, OtherDerived> tmp(derived()); + tmp = other.derived(); + return derived(); +} + +/** replaces \c *this by \c *this + \a other. + * + * \returns a reference to \c *this + */ +template +template +EIGEN_STRONG_INLINE Derived & +MatrixBase::operator+=(const MatrixBase& other) +{ + SelfCwiseBinaryOp, Derived, OtherDerived> tmp(derived()); + tmp = other.derived(); + return derived(); +} + +#endif // EIGEN_CWISE_BINARY_OP_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/CwiseNullaryOp.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/CwiseNullaryOp.h new file mode 100644 index 000000000..a2f504985 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/CwiseNullaryOp.h @@ -0,0 +1,851 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2010 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_CWISE_NULLARY_OP_H +#define EIGEN_CWISE_NULLARY_OP_H + +/** \class CwiseNullaryOp + * \ingroup Core_Module + * + * \brief Generic expression of a matrix where all coefficients are defined by a functor + * + * \param NullaryOp template functor implementing the operator + * \param PlainObjectType the underlying plain matrix/array type + * + * This class represents an expression of a generic nullary operator. + * It is the return type of the Ones(), Zero(), Constant(), Identity() and Random() methods, + * and most of the time this is the only way it is used. + * + * However, if you want to write a function returning such an expression, you + * will need to use this class. + * + * \sa class CwiseUnaryOp, class CwiseBinaryOp, DenseBase::NullaryExpr() + */ + +namespace internal { +template +struct traits > : traits +{ + enum { + Flags = (traits::Flags + & ( HereditaryBits + | (functor_has_linear_access::ret ? LinearAccessBit : 0) + | (functor_traits::PacketAccess ? PacketAccessBit : 0))) + | (functor_traits::IsRepeatable ? 0 : EvalBeforeNestingBit), + CoeffReadCost = functor_traits::Cost + }; +}; +} + +template +class CwiseNullaryOp : internal::no_assignment_operator, + public internal::dense_xpr_base< CwiseNullaryOp >::type +{ + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(CwiseNullaryOp) + + CwiseNullaryOp(Index rows, Index cols, const NullaryOp& func = NullaryOp()) + : m_rows(rows), m_cols(cols), m_functor(func) + { + eigen_assert(rows >= 0 + && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) + && cols >= 0 + && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)); + } + + EIGEN_STRONG_INLINE Index rows() const { return m_rows.value(); } + EIGEN_STRONG_INLINE Index cols() const { return m_cols.value(); } + + EIGEN_STRONG_INLINE const Scalar coeff(Index rows, Index cols) const + { + return m_functor(rows, cols); + } + + template + EIGEN_STRONG_INLINE PacketScalar packet(Index row, Index col) const + { + return m_functor.packetOp(row, col); + } + + EIGEN_STRONG_INLINE const Scalar coeff(Index index) const + { + return m_functor(index); + } + + template + EIGEN_STRONG_INLINE PacketScalar packet(Index index) const + { + return m_functor.packetOp(index); + } + + protected: + const internal::variable_if_dynamic m_rows; + const internal::variable_if_dynamic m_cols; + const NullaryOp m_functor; +}; + + +/** \returns an expression of a matrix defined by a custom functor \a func + * + * The parameters \a rows and \a cols are the number of rows and of columns of + * the returned matrix. Must be compatible with this MatrixBase type. + * + * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, + * it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used + * instead. + * + * The template parameter \a CustomNullaryOp is the type of the functor. + * + * \sa class CwiseNullaryOp + */ +template +template +EIGEN_STRONG_INLINE const CwiseNullaryOp +DenseBase::NullaryExpr(Index rows, Index cols, const CustomNullaryOp& func) +{ + return CwiseNullaryOp(rows, cols, func); +} + +/** \returns an expression of a matrix defined by a custom functor \a func + * + * The parameter \a size is the size of the returned vector. + * Must be compatible with this MatrixBase type. + * + * \only_for_vectors + * + * This variant is meant to be used for dynamic-size vector types. For fixed-size types, + * it is redundant to pass \a size as argument, so Zero() should be used + * instead. + * + * The template parameter \a CustomNullaryOp is the type of the functor. + * + * \sa class CwiseNullaryOp + */ +template +template +EIGEN_STRONG_INLINE const CwiseNullaryOp +DenseBase::NullaryExpr(Index size, const CustomNullaryOp& func) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + if(RowsAtCompileTime == 1) return CwiseNullaryOp(1, size, func); + else return CwiseNullaryOp(size, 1, func); +} + +/** \returns an expression of a matrix defined by a custom functor \a func + * + * This variant is only for fixed-size DenseBase types. For dynamic-size types, you + * need to use the variants taking size arguments. + * + * The template parameter \a CustomNullaryOp is the type of the functor. + * + * \sa class CwiseNullaryOp + */ +template +template +EIGEN_STRONG_INLINE const CwiseNullaryOp +DenseBase::NullaryExpr(const CustomNullaryOp& func) +{ + return CwiseNullaryOp(RowsAtCompileTime, ColsAtCompileTime, func); +} + +/** \returns an expression of a constant matrix of value \a value + * + * The parameters \a rows and \a cols are the number of rows and of columns of + * the returned matrix. Must be compatible with this DenseBase type. + * + * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, + * it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used + * instead. + * + * The template parameter \a CustomNullaryOp is the type of the functor. + * + * \sa class CwiseNullaryOp + */ +template +EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Constant(Index rows, Index cols, const Scalar& value) +{ + return DenseBase::NullaryExpr(rows, cols, internal::scalar_constant_op(value)); +} + +/** \returns an expression of a constant matrix of value \a value + * + * The parameter \a size is the size of the returned vector. + * Must be compatible with this DenseBase type. + * + * \only_for_vectors + * + * This variant is meant to be used for dynamic-size vector types. For fixed-size types, + * it is redundant to pass \a size as argument, so Zero() should be used + * instead. + * + * The template parameter \a CustomNullaryOp is the type of the functor. + * + * \sa class CwiseNullaryOp + */ +template +EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Constant(Index size, const Scalar& value) +{ + return DenseBase::NullaryExpr(size, internal::scalar_constant_op(value)); +} + +/** \returns an expression of a constant matrix of value \a value + * + * This variant is only for fixed-size DenseBase types. For dynamic-size types, you + * need to use the variants taking size arguments. + * + * The template parameter \a CustomNullaryOp is the type of the functor. + * + * \sa class CwiseNullaryOp + */ +template +EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Constant(const Scalar& value) +{ + EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) + return DenseBase::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_constant_op(value)); +} + +/** + * \brief Sets a linearly space vector. + * + * The function generates 'size' equally spaced values in the closed interval [low,high]. + * This particular version of LinSpaced() uses sequential access, i.e. vector access is + * assumed to be a(0), a(1), ..., a(size). This assumption allows for better vectorization + * and yields faster code than the random access version. + * + * \only_for_vectors + * + * Example: \include DenseBase_LinSpaced_seq.cpp + * Output: \verbinclude DenseBase_LinSpaced_seq.out + * + * \sa setLinSpaced(Index,const Scalar&,const Scalar&), LinSpaced(Index,Scalar,Scalar), CwiseNullaryOp + */ +template +EIGEN_STRONG_INLINE const typename DenseBase::SequentialLinSpacedReturnType +DenseBase::LinSpaced(Sequential_t, Index size, const Scalar& low, const Scalar& high) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + return DenseBase::NullaryExpr(size, internal::linspaced_op(low,high,size)); +} + +/** + * \copydoc DenseBase::LinSpaced(Sequential_t, Index, const Scalar&, const Scalar&) + * Special version for fixed size types which does not require the size parameter. + */ +template +EIGEN_STRONG_INLINE const typename DenseBase::SequentialLinSpacedReturnType +DenseBase::LinSpaced(Sequential_t, const Scalar& low, const Scalar& high) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) + return DenseBase::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op(low,high,Derived::SizeAtCompileTime)); +} + +/** + * \brief Sets a linearly space vector. + * + * The function generates 'size' equally spaced values in the closed interval [low,high]. + * + * \only_for_vectors + * + * Example: \include DenseBase_LinSpaced.cpp + * Output: \verbinclude DenseBase_LinSpaced.out + * + * \sa setLinSpaced(Index,const Scalar&,const Scalar&), LinSpaced(Sequential_t,Index,const Scalar&,const Scalar&,Index), CwiseNullaryOp + */ +template +EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType +DenseBase::LinSpaced(Index size, const Scalar& low, const Scalar& high) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + return DenseBase::NullaryExpr(size, internal::linspaced_op(low,high,size)); +} + +/** + * \copydoc DenseBase::LinSpaced(Index, const Scalar&, const Scalar&) + * Special version for fixed size types which does not require the size parameter. + */ +template +EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType +DenseBase::LinSpaced(const Scalar& low, const Scalar& high) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) + return DenseBase::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op(low,high,Derived::SizeAtCompileTime)); +} + +/** \returns true if all coefficients in this matrix are approximately equal to \a value, to within precision \a prec */ +template +bool DenseBase::isApproxToConstant +(const Scalar& value, RealScalar prec) const +{ + for(Index j = 0; j < cols(); ++j) + for(Index i = 0; i < rows(); ++i) + if(!internal::isApprox(this->coeff(i, j), value, prec)) + return false; + return true; +} + +/** This is just an alias for isApproxToConstant(). + * + * \returns true if all coefficients in this matrix are approximately equal to \a value, to within precision \a prec */ +template +bool DenseBase::isConstant +(const Scalar& value, RealScalar prec) const +{ + return isApproxToConstant(value, prec); +} + +/** Alias for setConstant(): sets all coefficients in this expression to \a value. + * + * \sa setConstant(), Constant(), class CwiseNullaryOp + */ +template +EIGEN_STRONG_INLINE void DenseBase::fill(const Scalar& value) +{ + setConstant(value); +} + +/** Sets all coefficients in this expression to \a value. + * + * \sa fill(), setConstant(Index,const Scalar&), setConstant(Index,Index,const Scalar&), setZero(), setOnes(), Constant(), class CwiseNullaryOp, setZero(), setOnes() + */ +template +EIGEN_STRONG_INLINE Derived& DenseBase::setConstant(const Scalar& value) +{ + return derived() = Constant(rows(), cols(), value); +} + +/** Resizes to the given \a size, and sets all coefficients in this expression to the given \a value. + * + * \only_for_vectors + * + * Example: \include Matrix_setConstant_int.cpp + * Output: \verbinclude Matrix_setConstant_int.out + * + * \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&) + */ +template +EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setConstant(Index size, const Scalar& value) +{ + resize(size); + return setConstant(value); +} + +/** Resizes to the given size, and sets all coefficients in this expression to the given \a value. + * + * \param rows the new number of rows + * \param cols the new number of columns + * \param value the value to which all coefficients are set + * + * Example: \include Matrix_setConstant_int_int.cpp + * Output: \verbinclude Matrix_setConstant_int_int.out + * + * \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&) + */ +template +EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setConstant(Index rows, Index cols, const Scalar& value) +{ + resize(rows, cols); + return setConstant(value); +} + +/** + * \brief Sets a linearly space vector. + * + * The function generates 'size' equally spaced values in the closed interval [low,high]. + * + * \only_for_vectors + * + * Example: \include DenseBase_setLinSpaced.cpp + * Output: \verbinclude DenseBase_setLinSpaced.out + * + * \sa CwiseNullaryOp + */ +template +EIGEN_STRONG_INLINE Derived& DenseBase::setLinSpaced(Index size, const Scalar& low, const Scalar& high) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + return derived() = Derived::NullaryExpr(size, internal::linspaced_op(low,high,size)); +} + +// zero: + +/** \returns an expression of a zero matrix. + * + * The parameters \a rows and \a cols are the number of rows and of columns of + * the returned matrix. Must be compatible with this MatrixBase type. + * + * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, + * it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used + * instead. + * + * Example: \include MatrixBase_zero_int_int.cpp + * Output: \verbinclude MatrixBase_zero_int_int.out + * + * \sa Zero(), Zero(Index) + */ +template +EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Zero(Index rows, Index cols) +{ + return Constant(rows, cols, Scalar(0)); +} + +/** \returns an expression of a zero vector. + * + * The parameter \a size is the size of the returned vector. + * Must be compatible with this MatrixBase type. + * + * \only_for_vectors + * + * This variant is meant to be used for dynamic-size vector types. For fixed-size types, + * it is redundant to pass \a size as argument, so Zero() should be used + * instead. + * + * Example: \include MatrixBase_zero_int.cpp + * Output: \verbinclude MatrixBase_zero_int.out + * + * \sa Zero(), Zero(Index,Index) + */ +template +EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Zero(Index size) +{ + return Constant(size, Scalar(0)); +} + +/** \returns an expression of a fixed-size zero matrix or vector. + * + * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you + * need to use the variants taking size arguments. + * + * Example: \include MatrixBase_zero.cpp + * Output: \verbinclude MatrixBase_zero.out + * + * \sa Zero(Index), Zero(Index,Index) + */ +template +EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Zero() +{ + return Constant(Scalar(0)); +} + +/** \returns true if *this is approximately equal to the zero matrix, + * within the precision given by \a prec. + * + * Example: \include MatrixBase_isZero.cpp + * Output: \verbinclude MatrixBase_isZero.out + * + * \sa class CwiseNullaryOp, Zero() + */ +template +bool DenseBase::isZero(RealScalar prec) const +{ + for(Index j = 0; j < cols(); ++j) + for(Index i = 0; i < rows(); ++i) + if(!internal::isMuchSmallerThan(this->coeff(i, j), static_cast(1), prec)) + return false; + return true; +} + +/** Sets all coefficients in this expression to zero. + * + * Example: \include MatrixBase_setZero.cpp + * Output: \verbinclude MatrixBase_setZero.out + * + * \sa class CwiseNullaryOp, Zero() + */ +template +EIGEN_STRONG_INLINE Derived& DenseBase::setZero() +{ + return setConstant(Scalar(0)); +} + +/** Resizes to the given \a size, and sets all coefficients in this expression to zero. + * + * \only_for_vectors + * + * Example: \include Matrix_setZero_int.cpp + * Output: \verbinclude Matrix_setZero_int.out + * + * \sa DenseBase::setZero(), setZero(Index,Index), class CwiseNullaryOp, DenseBase::Zero() + */ +template +EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setZero(Index size) +{ + resize(size); + return setConstant(Scalar(0)); +} + +/** Resizes to the given size, and sets all coefficients in this expression to zero. + * + * \param rows the new number of rows + * \param cols the new number of columns + * + * Example: \include Matrix_setZero_int_int.cpp + * Output: \verbinclude Matrix_setZero_int_int.out + * + * \sa DenseBase::setZero(), setZero(Index), class CwiseNullaryOp, DenseBase::Zero() + */ +template +EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setZero(Index rows, Index cols) +{ + resize(rows, cols); + return setConstant(Scalar(0)); +} + +// ones: + +/** \returns an expression of a matrix where all coefficients equal one. + * + * The parameters \a rows and \a cols are the number of rows and of columns of + * the returned matrix. Must be compatible with this MatrixBase type. + * + * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, + * it is redundant to pass \a rows and \a cols as arguments, so Ones() should be used + * instead. + * + * Example: \include MatrixBase_ones_int_int.cpp + * Output: \verbinclude MatrixBase_ones_int_int.out + * + * \sa Ones(), Ones(Index), isOnes(), class Ones + */ +template +EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Ones(Index rows, Index cols) +{ + return Constant(rows, cols, Scalar(1)); +} + +/** \returns an expression of a vector where all coefficients equal one. + * + * The parameter \a size is the size of the returned vector. + * Must be compatible with this MatrixBase type. + * + * \only_for_vectors + * + * This variant is meant to be used for dynamic-size vector types. For fixed-size types, + * it is redundant to pass \a size as argument, so Ones() should be used + * instead. + * + * Example: \include MatrixBase_ones_int.cpp + * Output: \verbinclude MatrixBase_ones_int.out + * + * \sa Ones(), Ones(Index,Index), isOnes(), class Ones + */ +template +EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Ones(Index size) +{ + return Constant(size, Scalar(1)); +} + +/** \returns an expression of a fixed-size matrix or vector where all coefficients equal one. + * + * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you + * need to use the variants taking size arguments. + * + * Example: \include MatrixBase_ones.cpp + * Output: \verbinclude MatrixBase_ones.out + * + * \sa Ones(Index), Ones(Index,Index), isOnes(), class Ones + */ +template +EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Ones() +{ + return Constant(Scalar(1)); +} + +/** \returns true if *this is approximately equal to the matrix where all coefficients + * are equal to 1, within the precision given by \a prec. + * + * Example: \include MatrixBase_isOnes.cpp + * Output: \verbinclude MatrixBase_isOnes.out + * + * \sa class CwiseNullaryOp, Ones() + */ +template +bool DenseBase::isOnes +(RealScalar prec) const +{ + return isApproxToConstant(Scalar(1), prec); +} + +/** Sets all coefficients in this expression to one. + * + * Example: \include MatrixBase_setOnes.cpp + * Output: \verbinclude MatrixBase_setOnes.out + * + * \sa class CwiseNullaryOp, Ones() + */ +template +EIGEN_STRONG_INLINE Derived& DenseBase::setOnes() +{ + return setConstant(Scalar(1)); +} + +/** Resizes to the given \a size, and sets all coefficients in this expression to one. + * + * \only_for_vectors + * + * Example: \include Matrix_setOnes_int.cpp + * Output: \verbinclude Matrix_setOnes_int.out + * + * \sa MatrixBase::setOnes(), setOnes(Index,Index), class CwiseNullaryOp, MatrixBase::Ones() + */ +template +EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setOnes(Index size) +{ + resize(size); + return setConstant(Scalar(1)); +} + +/** Resizes to the given size, and sets all coefficients in this expression to one. + * + * \param rows the new number of rows + * \param cols the new number of columns + * + * Example: \include Matrix_setOnes_int_int.cpp + * Output: \verbinclude Matrix_setOnes_int_int.out + * + * \sa MatrixBase::setOnes(), setOnes(Index), class CwiseNullaryOp, MatrixBase::Ones() + */ +template +EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setOnes(Index rows, Index cols) +{ + resize(rows, cols); + return setConstant(Scalar(1)); +} + +// Identity: + +/** \returns an expression of the identity matrix (not necessarily square). + * + * The parameters \a rows and \a cols are the number of rows and of columns of + * the returned matrix. Must be compatible with this MatrixBase type. + * + * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, + * it is redundant to pass \a rows and \a cols as arguments, so Identity() should be used + * instead. + * + * Example: \include MatrixBase_identity_int_int.cpp + * Output: \verbinclude MatrixBase_identity_int_int.out + * + * \sa Identity(), setIdentity(), isIdentity() + */ +template +EIGEN_STRONG_INLINE const typename MatrixBase::IdentityReturnType +MatrixBase::Identity(Index rows, Index cols) +{ + return DenseBase::NullaryExpr(rows, cols, internal::scalar_identity_op()); +} + +/** \returns an expression of the identity matrix (not necessarily square). + * + * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you + * need to use the variant taking size arguments. + * + * Example: \include MatrixBase_identity.cpp + * Output: \verbinclude MatrixBase_identity.out + * + * \sa Identity(Index,Index), setIdentity(), isIdentity() + */ +template +EIGEN_STRONG_INLINE const typename MatrixBase::IdentityReturnType +MatrixBase::Identity() +{ + EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) + return MatrixBase::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_identity_op()); +} + +/** \returns true if *this is approximately equal to the identity matrix + * (not necessarily square), + * within the precision given by \a prec. + * + * Example: \include MatrixBase_isIdentity.cpp + * Output: \verbinclude MatrixBase_isIdentity.out + * + * \sa class CwiseNullaryOp, Identity(), Identity(Index,Index), setIdentity() + */ +template +bool MatrixBase::isIdentity +(RealScalar prec) const +{ + for(Index j = 0; j < cols(); ++j) + { + for(Index i = 0; i < rows(); ++i) + { + if(i == j) + { + if(!internal::isApprox(this->coeff(i, j), static_cast(1), prec)) + return false; + } + else + { + if(!internal::isMuchSmallerThan(this->coeff(i, j), static_cast(1), prec)) + return false; + } + } + } + return true; +} + +namespace internal { + +template=16)> +struct setIdentity_impl +{ + static EIGEN_STRONG_INLINE Derived& run(Derived& m) + { + return m = Derived::Identity(m.rows(), m.cols()); + } +}; + +template +struct setIdentity_impl +{ + typedef typename Derived::Index Index; + static EIGEN_STRONG_INLINE Derived& run(Derived& m) + { + m.setZero(); + const Index size = std::min(m.rows(), m.cols()); + for(Index i = 0; i < size; ++i) m.coeffRef(i,i) = typename Derived::Scalar(1); + return m; + } +}; + +} // end namespace internal + +/** Writes the identity expression (not necessarily square) into *this. + * + * Example: \include MatrixBase_setIdentity.cpp + * Output: \verbinclude MatrixBase_setIdentity.out + * + * \sa class CwiseNullaryOp, Identity(), Identity(Index,Index), isIdentity() + */ +template +EIGEN_STRONG_INLINE Derived& MatrixBase::setIdentity() +{ + return internal::setIdentity_impl::run(derived()); +} + +/** \brief Resizes to the given size, and writes the identity expression (not necessarily square) into *this. + * + * \param rows the new number of rows + * \param cols the new number of columns + * + * Example: \include Matrix_setIdentity_int_int.cpp + * Output: \verbinclude Matrix_setIdentity_int_int.out + * + * \sa MatrixBase::setIdentity(), class CwiseNullaryOp, MatrixBase::Identity() + */ +template +EIGEN_STRONG_INLINE Derived& MatrixBase::setIdentity(Index rows, Index cols) +{ + derived().resize(rows, cols); + return setIdentity(); +} + +/** \returns an expression of the i-th unit (basis) vector. + * + * \only_for_vectors + * + * \sa MatrixBase::Unit(Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() + */ +template +EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::Unit(Index size, Index i) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + return BasisReturnType(SquareMatrixType::Identity(size,size), i); +} + +/** \returns an expression of the i-th unit (basis) vector. + * + * \only_for_vectors + * + * This variant is for fixed-size vector only. + * + * \sa MatrixBase::Unit(Index,Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() + */ +template +EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::Unit(Index i) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + return BasisReturnType(SquareMatrixType::Identity(),i); +} + +/** \returns an expression of the X axis unit vector (1{,0}^*) + * + * \only_for_vectors + * + * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() + */ +template +EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitX() +{ return Derived::Unit(0); } + +/** \returns an expression of the Y axis unit vector (0,1{,0}^*) + * + * \only_for_vectors + * + * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() + */ +template +EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitY() +{ return Derived::Unit(1); } + +/** \returns an expression of the Z axis unit vector (0,0,1{,0}^*) + * + * \only_for_vectors + * + * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() + */ +template +EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitZ() +{ return Derived::Unit(2); } + +/** \returns an expression of the W axis unit vector (0,0,0,1) + * + * \only_for_vectors + * + * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() + */ +template +EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitW() +{ return Derived::Unit(3); } + +#endif // EIGEN_CWISE_NULLARY_OP_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/CwiseUnaryOp.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/CwiseUnaryOp.h new file mode 100644 index 000000000..958571d64 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/CwiseUnaryOp.h @@ -0,0 +1,137 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2010 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_CWISE_UNARY_OP_H +#define EIGEN_CWISE_UNARY_OP_H + +/** \class CwiseUnaryOp + * \ingroup Core_Module + * + * \brief Generic expression where a coefficient-wise unary operator is applied to an expression + * + * \param UnaryOp template functor implementing the operator + * \param XprType the type of the expression to which we are applying the unary operator + * + * This class represents an expression where a unary operator is applied to an expression. + * It is the return type of all operations taking exactly 1 input expression, regardless of the + * presence of other inputs such as scalars. For example, the operator* in the expression 3*matrix + * is considered unary, because only the right-hand side is an expression, and its + * return type is a specialization of CwiseUnaryOp. + * + * Most of the time, this is the only way that it is used, so you typically don't have to name + * CwiseUnaryOp types explicitly. + * + * \sa MatrixBase::unaryExpr(const CustomUnaryOp &) const, class CwiseBinaryOp, class CwiseNullaryOp + */ + +namespace internal { +template +struct traits > + : traits +{ + typedef typename result_of< + UnaryOp(typename XprType::Scalar) + >::type Scalar; + typedef typename XprType::Nested XprTypeNested; + typedef typename remove_reference::type _XprTypeNested; + enum { + Flags = _XprTypeNested::Flags & ( + HereditaryBits | LinearAccessBit | AlignedBit + | (functor_traits::PacketAccess ? PacketAccessBit : 0)), + CoeffReadCost = _XprTypeNested::CoeffReadCost + functor_traits::Cost + }; +}; +} + +template +class CwiseUnaryOpImpl; + +template +class CwiseUnaryOp : internal::no_assignment_operator, + public CwiseUnaryOpImpl::StorageKind> +{ + public: + + typedef typename CwiseUnaryOpImpl::StorageKind>::Base Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseUnaryOp) + + inline CwiseUnaryOp(const XprType& xpr, const UnaryOp& func = UnaryOp()) + : m_xpr(xpr), m_functor(func) {} + + EIGEN_STRONG_INLINE Index rows() const { return m_xpr.rows(); } + EIGEN_STRONG_INLINE Index cols() const { return m_xpr.cols(); } + + /** \returns the functor representing the unary operation */ + const UnaryOp& functor() const { return m_functor; } + + /** \returns the nested expression */ + const typename internal::remove_all::type& + nestedExpression() const { return m_xpr; } + + /** \returns the nested expression */ + typename internal::remove_all::type& + nestedExpression() { return m_xpr.const_cast_derived(); } + + protected: + const typename XprType::Nested m_xpr; + const UnaryOp m_functor; +}; + +// This is the generic implementation for dense storage. +// It can be used for any expression types implementing the dense concept. +template +class CwiseUnaryOpImpl + : public internal::dense_xpr_base >::type +{ + public: + + typedef CwiseUnaryOp Derived; + typedef typename internal::dense_xpr_base >::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Derived) + + EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const + { + return derived().functor()(derived().nestedExpression().coeff(row, col)); + } + + template + EIGEN_STRONG_INLINE PacketScalar packet(Index row, Index col) const + { + return derived().functor().packetOp(derived().nestedExpression().template packet(row, col)); + } + + EIGEN_STRONG_INLINE const Scalar coeff(Index index) const + { + return derived().functor()(derived().nestedExpression().coeff(index)); + } + + template + EIGEN_STRONG_INLINE PacketScalar packet(Index index) const + { + return derived().functor().packetOp(derived().nestedExpression().template packet(index)); + } +}; + +#endif // EIGEN_CWISE_UNARY_OP_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/CwiseUnaryView.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/CwiseUnaryView.h new file mode 100644 index 000000000..d24ef0373 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/CwiseUnaryView.h @@ -0,0 +1,148 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009-2010 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_CWISE_UNARY_VIEW_H +#define EIGEN_CWISE_UNARY_VIEW_H + +/** \class CwiseUnaryView + * \ingroup Core_Module + * + * \brief Generic lvalue expression of a coefficient-wise unary operator of a matrix or a vector + * + * \param ViewOp template functor implementing the view + * \param MatrixType the type of the matrix we are applying the unary operator + * + * This class represents a lvalue expression of a generic unary view operator of a matrix or a vector. + * It is the return type of real() and imag(), and most of the time this is the only way it is used. + * + * \sa MatrixBase::unaryViewExpr(const CustomUnaryOp &) const, class CwiseUnaryOp + */ + +namespace internal { +template +struct traits > + : traits +{ + typedef typename result_of< + ViewOp(typename traits::Scalar) + >::type Scalar; + typedef typename MatrixType::Nested MatrixTypeNested; + typedef typename remove_all::type _MatrixTypeNested; + enum { + Flags = (traits<_MatrixTypeNested>::Flags & (HereditaryBits | LvalueBit | LinearAccessBit | DirectAccessBit)), + CoeffReadCost = traits<_MatrixTypeNested>::CoeffReadCost + functor_traits::Cost, + MatrixTypeInnerStride = inner_stride_at_compile_time::ret, + // need to cast the sizeof's from size_t to int explicitly, otherwise: + // "error: no integral type can represent all of the enumerator values + InnerStrideAtCompileTime = MatrixTypeInnerStride == Dynamic + ? int(Dynamic) + : int(MatrixTypeInnerStride) + * int(sizeof(typename traits::Scalar) / sizeof(Scalar)), + OuterStrideAtCompileTime = outer_stride_at_compile_time::ret + }; +}; +} + +template +class CwiseUnaryViewImpl; + +template +class CwiseUnaryView : internal::no_assignment_operator, + public CwiseUnaryViewImpl::StorageKind> +{ + public: + + typedef typename CwiseUnaryViewImpl::StorageKind>::Base Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseUnaryView) + + inline CwiseUnaryView(const MatrixType& mat, const ViewOp& func = ViewOp()) + : m_matrix(mat), m_functor(func) {} + + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(CwiseUnaryView) + + EIGEN_STRONG_INLINE Index rows() const { return m_matrix.rows(); } + EIGEN_STRONG_INLINE Index cols() const { return m_matrix.cols(); } + + /** \returns the functor representing unary operation */ + const ViewOp& functor() const { return m_functor; } + + /** \returns the nested expression */ + const typename internal::remove_all::type& + nestedExpression() const { return m_matrix; } + + /** \returns the nested expression */ + typename internal::remove_all::type& + nestedExpression() { return m_matrix.const_cast_derived(); } + + protected: + // FIXME changed from MatrixType::Nested because of a weird compilation error with sun CC + const typename internal::nested::type m_matrix; + ViewOp m_functor; +}; + +template +class CwiseUnaryViewImpl + : public internal::dense_xpr_base< CwiseUnaryView >::type +{ + public: + + typedef CwiseUnaryView Derived; + typedef typename internal::dense_xpr_base< CwiseUnaryView >::type Base; + + EIGEN_DENSE_PUBLIC_INTERFACE(Derived) + + inline Index innerStride() const + { + return derived().nestedExpression().innerStride() * sizeof(typename internal::traits::Scalar) / sizeof(Scalar); + } + + inline Index outerStride() const + { + return derived().nestedExpression().outerStride(); + } + + EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const + { + return derived().functor()(derived().nestedExpression().coeff(row, col)); + } + + EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const + { + return derived().functor()(derived().nestedExpression().coeff(index)); + } + + EIGEN_STRONG_INLINE Scalar& coeffRef(Index row, Index col) + { + return derived().functor()(const_cast_derived().nestedExpression().coeffRef(row, col)); + } + + EIGEN_STRONG_INLINE Scalar& coeffRef(Index index) + { + return derived().functor()(const_cast_derived().nestedExpression().coeffRef(index)); + } +}; + + + +#endif // EIGEN_CWISE_UNARY_VIEW_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/DenseBase.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/DenseBase.h new file mode 100644 index 000000000..838fa4030 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/DenseBase.h @@ -0,0 +1,543 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2007-2010 Benoit Jacob +// Copyright (C) 2008-2010 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_DENSEBASE_H +#define EIGEN_DENSEBASE_H + +/** \class DenseBase + * \ingroup Core_Module + * + * \brief Base class for all dense matrices, vectors, and arrays + * + * This class is the base that is inherited by all dense objects (matrix, vector, arrays, + * and related expression types). The common Eigen API for dense objects is contained in this class. + * + * \tparam Derived is the derived type, e.g., a matrix type or an expression. + * + * This class can be extended with the help of the plugin mechanism described on the page + * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_DENSEBASE_PLUGIN. + * + * \sa \ref TopicClassHierarchy + */ +template class DenseBase +#ifndef EIGEN_PARSED_BY_DOXYGEN + : public internal::special_scalar_op_base::Scalar, + typename NumTraits::Scalar>::Real> +#else + : public DenseCoeffsBase +#endif // not EIGEN_PARSED_BY_DOXYGEN +{ + public: + using internal::special_scalar_op_base::Scalar, + typename NumTraits::Scalar>::Real>::operator*; + + class InnerIterator; + + typedef typename internal::traits::StorageKind StorageKind; + + /** \brief The type of indices + * \details To change this, \c \#define the preprocessor symbol \c EIGEN_DEFAULT_DENSE_INDEX_TYPE. + * \sa \ref TopicPreprocessorDirectives. + */ + typedef typename internal::traits::Index Index; + + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::packet_traits::type PacketScalar; + typedef typename NumTraits::Real RealScalar; + + typedef DenseCoeffsBase Base; + using Base::derived; + using Base::const_cast_derived; + using Base::rows; + using Base::cols; + using Base::size; + using Base::rowIndexByOuterInner; + using Base::colIndexByOuterInner; + using Base::coeff; + using Base::coeffByOuterInner; + using Base::packet; + using Base::packetByOuterInner; + using Base::writePacket; + using Base::writePacketByOuterInner; + using Base::coeffRef; + using Base::coeffRefByOuterInner; + using Base::copyCoeff; + using Base::copyCoeffByOuterInner; + using Base::copyPacket; + using Base::copyPacketByOuterInner; + using Base::operator(); + using Base::operator[]; + using Base::x; + using Base::y; + using Base::z; + using Base::w; + using Base::stride; + using Base::innerStride; + using Base::outerStride; + using Base::rowStride; + using Base::colStride; + typedef typename Base::CoeffReturnType CoeffReturnType; + + enum { + + RowsAtCompileTime = internal::traits::RowsAtCompileTime, + /**< The number of rows at compile-time. This is just a copy of the value provided + * by the \a Derived type. If a value is not known at compile-time, + * it is set to the \a Dynamic constant. + * \sa MatrixBase::rows(), MatrixBase::cols(), ColsAtCompileTime, SizeAtCompileTime */ + + ColsAtCompileTime = internal::traits::ColsAtCompileTime, + /**< The number of columns at compile-time. This is just a copy of the value provided + * by the \a Derived type. If a value is not known at compile-time, + * it is set to the \a Dynamic constant. + * \sa MatrixBase::rows(), MatrixBase::cols(), RowsAtCompileTime, SizeAtCompileTime */ + + + SizeAtCompileTime = (internal::size_at_compile_time::RowsAtCompileTime, + internal::traits::ColsAtCompileTime>::ret), + /**< This is equal to the number of coefficients, i.e. the number of + * rows times the number of columns, or to \a Dynamic if this is not + * known at compile-time. \sa RowsAtCompileTime, ColsAtCompileTime */ + + MaxRowsAtCompileTime = internal::traits::MaxRowsAtCompileTime, + /**< This value is equal to the maximum possible number of rows that this expression + * might have. If this expression might have an arbitrarily high number of rows, + * this value is set to \a Dynamic. + * + * This value is useful to know when evaluating an expression, in order to determine + * whether it is possible to avoid doing a dynamic memory allocation. + * + * \sa RowsAtCompileTime, MaxColsAtCompileTime, MaxSizeAtCompileTime + */ + + MaxColsAtCompileTime = internal::traits::MaxColsAtCompileTime, + /**< This value is equal to the maximum possible number of columns that this expression + * might have. If this expression might have an arbitrarily high number of columns, + * this value is set to \a Dynamic. + * + * This value is useful to know when evaluating an expression, in order to determine + * whether it is possible to avoid doing a dynamic memory allocation. + * + * \sa ColsAtCompileTime, MaxRowsAtCompileTime, MaxSizeAtCompileTime + */ + + MaxSizeAtCompileTime = (internal::size_at_compile_time::MaxRowsAtCompileTime, + internal::traits::MaxColsAtCompileTime>::ret), + /**< This value is equal to the maximum possible number of coefficients that this expression + * might have. If this expression might have an arbitrarily high number of coefficients, + * this value is set to \a Dynamic. + * + * This value is useful to know when evaluating an expression, in order to determine + * whether it is possible to avoid doing a dynamic memory allocation. + * + * \sa SizeAtCompileTime, MaxRowsAtCompileTime, MaxColsAtCompileTime + */ + + IsVectorAtCompileTime = internal::traits::MaxRowsAtCompileTime == 1 + || internal::traits::MaxColsAtCompileTime == 1, + /**< This is set to true if either the number of rows or the number of + * columns is known at compile-time to be equal to 1. Indeed, in that case, + * we are dealing with a column-vector (if there is only one column) or with + * a row-vector (if there is only one row). */ + + Flags = internal::traits::Flags, + /**< This stores expression \ref flags flags which may or may not be inherited by new expressions + * constructed from this one. See the \ref flags "list of flags". + */ + + IsRowMajor = int(Flags) & RowMajorBit, /**< True if this expression has row-major storage order. */ + + InnerSizeAtCompileTime = int(IsVectorAtCompileTime) ? SizeAtCompileTime + : int(IsRowMajor) ? ColsAtCompileTime : RowsAtCompileTime, + + CoeffReadCost = internal::traits::CoeffReadCost, + /**< This is a rough measure of how expensive it is to read one coefficient from + * this expression. + */ + + InnerStrideAtCompileTime = internal::inner_stride_at_compile_time::ret, + OuterStrideAtCompileTime = internal::outer_stride_at_compile_time::ret + }; + + enum { ThisConstantIsPrivateInPlainObjectBase }; + + /** \returns the number of nonzero coefficients which is in practice the number + * of stored coefficients. */ + inline Index nonZeros() const { return size(); } + /** \returns true if either the number of rows or the number of columns is equal to 1. + * In other words, this function returns + * \code rows()==1 || cols()==1 \endcode + * \sa rows(), cols(), IsVectorAtCompileTime. */ + + /** \returns the outer size. + * + * \note For a vector, this returns just 1. For a matrix (non-vector), this is the major dimension + * with respect to the \ref TopicStorageOrders "storage order", i.e., the number of columns for a + * column-major matrix, and the number of rows for a row-major matrix. */ + Index outerSize() const + { + return IsVectorAtCompileTime ? 1 + : int(IsRowMajor) ? this->rows() : this->cols(); + } + + /** \returns the inner size. + * + * \note For a vector, this is just the size. For a matrix (non-vector), this is the minor dimension + * with respect to the \ref TopicStorageOrders "storage order", i.e., the number of rows for a + * column-major matrix, and the number of columns for a row-major matrix. */ + Index innerSize() const + { + return IsVectorAtCompileTime ? this->size() + : int(IsRowMajor) ? this->cols() : this->rows(); + } + + /** Only plain matrices/arrays, not expressions, may be resized; therefore the only useful resize methods are + * Matrix::resize() and Array::resize(). The present method only asserts that the new size equals the old size, and does + * nothing else. + */ + void resize(Index size) + { + EIGEN_ONLY_USED_FOR_DEBUG(size); + eigen_assert(size == this->size() + && "DenseBase::resize() does not actually allow to resize."); + } + /** Only plain matrices/arrays, not expressions, may be resized; therefore the only useful resize methods are + * Matrix::resize() and Array::resize(). The present method only asserts that the new size equals the old size, and does + * nothing else. + */ + void resize(Index rows, Index cols) + { + EIGEN_ONLY_USED_FOR_DEBUG(rows); + EIGEN_ONLY_USED_FOR_DEBUG(cols); + eigen_assert(rows == this->rows() && cols == this->cols() + && "DenseBase::resize() does not actually allow to resize."); + } + +#ifndef EIGEN_PARSED_BY_DOXYGEN + + /** \internal Represents a matrix with all coefficients equal to one another*/ + typedef CwiseNullaryOp,Derived> ConstantReturnType; + /** \internal Represents a vector with linearly spaced coefficients that allows sequential access only. */ + typedef CwiseNullaryOp,Derived> SequentialLinSpacedReturnType; + /** \internal Represents a vector with linearly spaced coefficients that allows random access. */ + typedef CwiseNullaryOp,Derived> RandomAccessLinSpacedReturnType; + /** \internal the return type of MatrixBase::eigenvalues() */ + typedef Matrix::Scalar>::Real, internal::traits::ColsAtCompileTime, 1> EigenvaluesReturnType; + +#endif // not EIGEN_PARSED_BY_DOXYGEN + + /** Copies \a other into *this. \returns a reference to *this. */ + template + Derived& operator=(const DenseBase& other); + + /** Special case of the template operator=, in order to prevent the compiler + * from generating a default operator= (issue hit with g++ 4.1) + */ + Derived& operator=(const DenseBase& other); + + template + Derived& operator=(const EigenBase &other); + + template + Derived& operator+=(const EigenBase &other); + + template + Derived& operator-=(const EigenBase &other); + + template + Derived& operator=(const ReturnByValue& func); + +#ifndef EIGEN_PARSED_BY_DOXYGEN + /** Copies \a other into *this without evaluating other. \returns a reference to *this. */ + template + Derived& lazyAssign(const DenseBase& other); +#endif // not EIGEN_PARSED_BY_DOXYGEN + + CommaInitializer operator<< (const Scalar& s); + + template + const Flagged flagged() const; + + template + CommaInitializer operator<< (const DenseBase& other); + + Eigen::Transpose transpose(); + typedef const Transpose ConstTransposeReturnType; + ConstTransposeReturnType transpose() const; + void transposeInPlace(); +#ifndef EIGEN_NO_DEBUG + protected: + template + void checkTransposeAliasing(const OtherDerived& other) const; + public: +#endif + + typedef VectorBlock SegmentReturnType; + typedef const VectorBlock ConstSegmentReturnType; + template struct FixedSegmentReturnType { typedef VectorBlock Type; }; + template struct ConstFixedSegmentReturnType { typedef const VectorBlock Type; }; + + // Note: The "DenseBase::" prefixes are added to help MSVC9 to match these declarations with the later implementations. + SegmentReturnType segment(Index start, Index size); + typename DenseBase::ConstSegmentReturnType segment(Index start, Index size) const; + + SegmentReturnType head(Index size); + typename DenseBase::ConstSegmentReturnType head(Index size) const; + + SegmentReturnType tail(Index size); + typename DenseBase::ConstSegmentReturnType tail(Index size) const; + + template typename FixedSegmentReturnType::Type head(); + template typename ConstFixedSegmentReturnType::Type head() const; + + template typename FixedSegmentReturnType::Type tail(); + template typename ConstFixedSegmentReturnType::Type tail() const; + + template typename FixedSegmentReturnType::Type segment(Index start); + template typename ConstFixedSegmentReturnType::Type segment(Index start) const; + + static const ConstantReturnType + Constant(Index rows, Index cols, const Scalar& value); + static const ConstantReturnType + Constant(Index size, const Scalar& value); + static const ConstantReturnType + Constant(const Scalar& value); + + static const SequentialLinSpacedReturnType + LinSpaced(Sequential_t, Index size, const Scalar& low, const Scalar& high); + static const RandomAccessLinSpacedReturnType + LinSpaced(Index size, const Scalar& low, const Scalar& high); + static const SequentialLinSpacedReturnType + LinSpaced(Sequential_t, const Scalar& low, const Scalar& high); + static const RandomAccessLinSpacedReturnType + LinSpaced(const Scalar& low, const Scalar& high); + + template + static const CwiseNullaryOp + NullaryExpr(Index rows, Index cols, const CustomNullaryOp& func); + template + static const CwiseNullaryOp + NullaryExpr(Index size, const CustomNullaryOp& func); + template + static const CwiseNullaryOp + NullaryExpr(const CustomNullaryOp& func); + + static const ConstantReturnType Zero(Index rows, Index cols); + static const ConstantReturnType Zero(Index size); + static const ConstantReturnType Zero(); + static const ConstantReturnType Ones(Index rows, Index cols); + static const ConstantReturnType Ones(Index size); + static const ConstantReturnType Ones(); + + void fill(const Scalar& value); + Derived& setConstant(const Scalar& value); + Derived& setLinSpaced(Index size, const Scalar& low, const Scalar& high); + Derived& setLinSpaced(const Scalar& low, const Scalar& high); + Derived& setZero(); + Derived& setOnes(); + Derived& setRandom(); + + template + bool isApprox(const DenseBase& other, + RealScalar prec = NumTraits::dummy_precision()) const; + bool isMuchSmallerThan(const RealScalar& other, + RealScalar prec = NumTraits::dummy_precision()) const; + template + bool isMuchSmallerThan(const DenseBase& other, + RealScalar prec = NumTraits::dummy_precision()) const; + + bool isApproxToConstant(const Scalar& value, RealScalar prec = NumTraits::dummy_precision()) const; + bool isConstant(const Scalar& value, RealScalar prec = NumTraits::dummy_precision()) const; + bool isZero(RealScalar prec = NumTraits::dummy_precision()) const; + bool isOnes(RealScalar prec = NumTraits::dummy_precision()) const; + + inline Derived& operator*=(const Scalar& other); + inline Derived& operator/=(const Scalar& other); + + /** \returns the matrix or vector obtained by evaluating this expression. + * + * Notice that in the case of a plain matrix or vector (not an expression) this function just returns + * a const reference, in order to avoid a useless copy. + */ + EIGEN_STRONG_INLINE const typename internal::eval::type eval() const + { + // Even though MSVC does not honor strong inlining when the return type + // is a dynamic matrix, we desperately need strong inlining for fixed + // size types on MSVC. + return typename internal::eval::type(derived()); + } + + /** swaps *this with the expression \a other. + * + */ + template + void swap(const DenseBase& other, + int = OtherDerived::ThisConstantIsPrivateInPlainObjectBase) + { + SwapWrapper(derived()).lazyAssign(other.derived()); + } + + /** swaps *this with the matrix or array \a other. + * + */ + template + void swap(PlainObjectBase& other) + { + SwapWrapper(derived()).lazyAssign(other.derived()); + } + + + inline const NestByValue nestByValue() const; + inline const ForceAlignedAccess forceAlignedAccess() const; + inline ForceAlignedAccess forceAlignedAccess(); + template inline const typename internal::conditional,Derived&>::type forceAlignedAccessIf() const; + template inline typename internal::conditional,Derived&>::type forceAlignedAccessIf(); + + Scalar sum() const; + Scalar mean() const; + Scalar trace() const; + + Scalar prod() const; + + typename internal::traits::Scalar minCoeff() const; + typename internal::traits::Scalar maxCoeff() const; + + template + typename internal::traits::Scalar minCoeff(IndexType* row, IndexType* col) const; + template + typename internal::traits::Scalar maxCoeff(IndexType* row, IndexType* col) const; + template + typename internal::traits::Scalar minCoeff(IndexType* index) const; + template + typename internal::traits::Scalar maxCoeff(IndexType* index) const; + + template + typename internal::result_of::Scalar)>::type + redux(const BinaryOp& func) const; + + template + void visit(Visitor& func) const; + + inline const WithFormat format(const IOFormat& fmt) const; + + /** \returns the unique coefficient of a 1x1 expression */ + CoeffReturnType value() const + { + EIGEN_STATIC_ASSERT_SIZE_1x1(Derived) + eigen_assert(this->rows() == 1 && this->cols() == 1); + return derived().coeff(0,0); + } + +/////////// Array module /////////// + + bool all(void) const; + bool any(void) const; + Index count() const; + + typedef VectorwiseOp RowwiseReturnType; + typedef const VectorwiseOp ConstRowwiseReturnType; + typedef VectorwiseOp ColwiseReturnType; + typedef const VectorwiseOp ConstColwiseReturnType; + + ConstRowwiseReturnType rowwise() const; + RowwiseReturnType rowwise(); + ConstColwiseReturnType colwise() const; + ColwiseReturnType colwise(); + + static const CwiseNullaryOp,Derived> Random(Index rows, Index cols); + static const CwiseNullaryOp,Derived> Random(Index size); + static const CwiseNullaryOp,Derived> Random(); + + template + const Select + select(const DenseBase& thenMatrix, + const DenseBase& elseMatrix) const; + + template + inline const Select + select(const DenseBase& thenMatrix, typename ThenDerived::Scalar elseScalar) const; + + template + inline const Select + select(typename ElseDerived::Scalar thenScalar, const DenseBase& elseMatrix) const; + + template RealScalar lpNorm() const; + + template + const Replicate replicate() const; + const Replicate replicate(Index rowFacor,Index colFactor) const; + + typedef Reverse ReverseReturnType; + typedef const Reverse ConstReverseReturnType; + ReverseReturnType reverse(); + ConstReverseReturnType reverse() const; + void reverseInPlace(); + +#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::DenseBase +# include "../plugins/BlockMethods.h" +# ifdef EIGEN_DENSEBASE_PLUGIN +# include EIGEN_DENSEBASE_PLUGIN +# endif +#undef EIGEN_CURRENT_STORAGE_BASE_CLASS + +#ifdef EIGEN2_SUPPORT + + Block corner(CornerType type, Index cRows, Index cCols); + const Block corner(CornerType type, Index cRows, Index cCols) const; + template + Block corner(CornerType type); + template + const Block corner(CornerType type) const; + +#endif // EIGEN2_SUPPORT + + + // disable the use of evalTo for dense objects with a nice compilation error + template inline void evalTo(Dest& ) const + { + EIGEN_STATIC_ASSERT((internal::is_same::value),THE_EVAL_EVALTO_FUNCTION_SHOULD_NEVER_BE_CALLED_FOR_DENSE_OBJECTS); + } + + protected: + /** Default constructor. Do nothing. */ + DenseBase() + { + /* Just checks for self-consistency of the flags. + * Only do it when debugging Eigen, as this borders on paranoiac and could slow compilation down + */ +#ifdef EIGEN_INTERNAL_DEBUGGING + EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, int(IsRowMajor)) + && EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, int(!IsRowMajor))), + INVALID_STORAGE_ORDER_FOR_THIS_VECTOR_EXPRESSION) +#endif + } + + private: + explicit DenseBase(int); + DenseBase(int,int); + template explicit DenseBase(const DenseBase&); +}; + +#endif // EIGEN_DENSEBASE_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/DenseCoeffsBase.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/DenseCoeffsBase.h new file mode 100644 index 000000000..e45238fb5 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/DenseCoeffsBase.h @@ -0,0 +1,765 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2010 Benoit Jacob +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_DENSECOEFFSBASE_H +#define EIGEN_DENSECOEFFSBASE_H + +namespace internal { +template struct add_const_on_value_type_if_arithmetic +{ + typedef typename conditional::value, T, typename add_const_on_value_type::type>::type type; +}; +} + +/** \brief Base class providing read-only coefficient access to matrices and arrays. + * \ingroup Core_Module + * \tparam Derived Type of the derived class + * \tparam #ReadOnlyAccessors Constant indicating read-only access + * + * This class defines the \c operator() \c const function and friends, which can be used to read specific + * entries of a matrix or array. + * + * \sa DenseCoeffsBase, DenseCoeffsBase, + * \ref TopicClassHierarchy + */ +template +class DenseCoeffsBase : public EigenBase +{ + public: + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::Index Index; + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::packet_traits::type PacketScalar; + + // Explanation for this CoeffReturnType typedef. + // - This is the return type of the coeff() method. + // - The LvalueBit means exactly that we can offer a coeffRef() method, which means exactly that we can get references + // to coeffs, which means exactly that we can have coeff() return a const reference (as opposed to returning a value). + // - The is_artihmetic check is required since "const int", "const double", etc. will cause warnings on some systems + // while the declaration of "const T", where T is a non arithmetic type does not. Always returning "const Scalar&" is + // not possible, since the underlying expressions might not offer a valid address the reference could be referring to. + typedef typename internal::conditional::Flags&LvalueBit), + const Scalar&, + typename internal::conditional::value, Scalar, const Scalar>::type + >::type CoeffReturnType; + + typedef typename internal::add_const_on_value_type_if_arithmetic< + typename internal::packet_traits::type + >::type PacketReturnType; + + typedef EigenBase Base; + using Base::rows; + using Base::cols; + using Base::size; + using Base::derived; + + EIGEN_STRONG_INLINE Index rowIndexByOuterInner(Index outer, Index inner) const + { + return int(Derived::RowsAtCompileTime) == 1 ? 0 + : int(Derived::ColsAtCompileTime) == 1 ? inner + : int(Derived::Flags)&RowMajorBit ? outer + : inner; + } + + EIGEN_STRONG_INLINE Index colIndexByOuterInner(Index outer, Index inner) const + { + return int(Derived::ColsAtCompileTime) == 1 ? 0 + : int(Derived::RowsAtCompileTime) == 1 ? inner + : int(Derived::Flags)&RowMajorBit ? inner + : outer; + } + + /** Short version: don't use this function, use + * \link operator()(Index,Index) const \endlink instead. + * + * Long version: this function is similar to + * \link operator()(Index,Index) const \endlink, but without the assertion. + * Use this for limiting the performance cost of debugging code when doing + * repeated coefficient access. Only use this when it is guaranteed that the + * parameters \a row and \a col are in range. + * + * If EIGEN_INTERNAL_DEBUGGING is defined, an assertion will be made, making this + * function equivalent to \link operator()(Index,Index) const \endlink. + * + * \sa operator()(Index,Index) const, coeffRef(Index,Index), coeff(Index) const + */ + EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const + { + eigen_internal_assert(row >= 0 && row < rows() + && col >= 0 && col < cols()); + return derived().coeff(row, col); + } + + EIGEN_STRONG_INLINE CoeffReturnType coeffByOuterInner(Index outer, Index inner) const + { + return coeff(rowIndexByOuterInner(outer, inner), + colIndexByOuterInner(outer, inner)); + } + + /** \returns the coefficient at given the given row and column. + * + * \sa operator()(Index,Index), operator[](Index) + */ + EIGEN_STRONG_INLINE CoeffReturnType operator()(Index row, Index col) const + { + eigen_assert(row >= 0 && row < rows() + && col >= 0 && col < cols()); + return derived().coeff(row, col); + } + + /** Short version: don't use this function, use + * \link operator[](Index) const \endlink instead. + * + * Long version: this function is similar to + * \link operator[](Index) const \endlink, but without the assertion. + * Use this for limiting the performance cost of debugging code when doing + * repeated coefficient access. Only use this when it is guaranteed that the + * parameter \a index is in range. + * + * If EIGEN_INTERNAL_DEBUGGING is defined, an assertion will be made, making this + * function equivalent to \link operator[](Index) const \endlink. + * + * \sa operator[](Index) const, coeffRef(Index), coeff(Index,Index) const + */ + + EIGEN_STRONG_INLINE CoeffReturnType + coeff(Index index) const + { + eigen_internal_assert(index >= 0 && index < size()); + return derived().coeff(index); + } + + + /** \returns the coefficient at given index. + * + * This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit. + * + * \sa operator[](Index), operator()(Index,Index) const, x() const, y() const, + * z() const, w() const + */ + + EIGEN_STRONG_INLINE CoeffReturnType + operator[](Index index) const + { + #ifndef EIGEN2_SUPPORT + EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime, + THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD) + #endif + eigen_assert(index >= 0 && index < size()); + return derived().coeff(index); + } + + /** \returns the coefficient at given index. + * + * This is synonymous to operator[](Index) const. + * + * This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit. + * + * \sa operator[](Index), operator()(Index,Index) const, x() const, y() const, + * z() const, w() const + */ + + EIGEN_STRONG_INLINE CoeffReturnType + operator()(Index index) const + { + eigen_assert(index >= 0 && index < size()); + return derived().coeff(index); + } + + /** equivalent to operator[](0). */ + + EIGEN_STRONG_INLINE CoeffReturnType + x() const { return (*this)[0]; } + + /** equivalent to operator[](1). */ + + EIGEN_STRONG_INLINE CoeffReturnType + y() const { return (*this)[1]; } + + /** equivalent to operator[](2). */ + + EIGEN_STRONG_INLINE CoeffReturnType + z() const { return (*this)[2]; } + + /** equivalent to operator[](3). */ + + EIGEN_STRONG_INLINE CoeffReturnType + w() const { return (*this)[3]; } + + /** \internal + * \returns the packet of coefficients starting at the given row and column. It is your responsibility + * to ensure that a packet really starts there. This method is only available on expressions having the + * PacketAccessBit. + * + * The \a LoadMode parameter may have the value \a #Aligned or \a #Unaligned. Its effect is to select + * the appropriate vectorization instruction. Aligned access is faster, but is only possible for packets + * starting at an address which is a multiple of the packet size. + */ + + template + EIGEN_STRONG_INLINE PacketReturnType packet(Index row, Index col) const + { + eigen_internal_assert(row >= 0 && row < rows() + && col >= 0 && col < cols()); + return derived().template packet(row,col); + } + + + /** \internal */ + template + EIGEN_STRONG_INLINE PacketReturnType packetByOuterInner(Index outer, Index inner) const + { + return packet(rowIndexByOuterInner(outer, inner), + colIndexByOuterInner(outer, inner)); + } + + /** \internal + * \returns the packet of coefficients starting at the given index. It is your responsibility + * to ensure that a packet really starts there. This method is only available on expressions having the + * PacketAccessBit and the LinearAccessBit. + * + * The \a LoadMode parameter may have the value \a #Aligned or \a #Unaligned. Its effect is to select + * the appropriate vectorization instruction. Aligned access is faster, but is only possible for packets + * starting at an address which is a multiple of the packet size. + */ + + template + EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const + { + eigen_internal_assert(index >= 0 && index < size()); + return derived().template packet(index); + } + + protected: + // explanation: DenseBase is doing "using ..." on the methods from DenseCoeffsBase. + // But some methods are only available in the DirectAccess case. + // So we add dummy methods here with these names, so that "using... " doesn't fail. + // It's not private so that the child class DenseBase can access them, and it's not public + // either since it's an implementation detail, so has to be protected. + void coeffRef(); + void coeffRefByOuterInner(); + void writePacket(); + void writePacketByOuterInner(); + void copyCoeff(); + void copyCoeffByOuterInner(); + void copyPacket(); + void copyPacketByOuterInner(); + void stride(); + void innerStride(); + void outerStride(); + void rowStride(); + void colStride(); +}; + +/** \brief Base class providing read/write coefficient access to matrices and arrays. + * \ingroup Core_Module + * \tparam Derived Type of the derived class + * \tparam #WriteAccessors Constant indicating read/write access + * + * This class defines the non-const \c operator() function and friends, which can be used to write specific + * entries of a matrix or array. This class inherits DenseCoeffsBase which + * defines the const variant for reading specific entries. + * + * \sa DenseCoeffsBase, \ref TopicClassHierarchy + */ +template +class DenseCoeffsBase : public DenseCoeffsBase +{ + public: + + typedef DenseCoeffsBase Base; + + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::Index Index; + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::packet_traits::type PacketScalar; + typedef typename NumTraits::Real RealScalar; + + using Base::coeff; + using Base::rows; + using Base::cols; + using Base::size; + using Base::derived; + using Base::rowIndexByOuterInner; + using Base::colIndexByOuterInner; + using Base::operator[]; + using Base::operator(); + using Base::x; + using Base::y; + using Base::z; + using Base::w; + + /** Short version: don't use this function, use + * \link operator()(Index,Index) \endlink instead. + * + * Long version: this function is similar to + * \link operator()(Index,Index) \endlink, but without the assertion. + * Use this for limiting the performance cost of debugging code when doing + * repeated coefficient access. Only use this when it is guaranteed that the + * parameters \a row and \a col are in range. + * + * If EIGEN_INTERNAL_DEBUGGING is defined, an assertion will be made, making this + * function equivalent to \link operator()(Index,Index) \endlink. + * + * \sa operator()(Index,Index), coeff(Index, Index) const, coeffRef(Index) + */ + EIGEN_STRONG_INLINE Scalar& coeffRef(Index row, Index col) + { + eigen_internal_assert(row >= 0 && row < rows() + && col >= 0 && col < cols()); + return derived().coeffRef(row, col); + } + + EIGEN_STRONG_INLINE Scalar& + coeffRefByOuterInner(Index outer, Index inner) + { + return coeffRef(rowIndexByOuterInner(outer, inner), + colIndexByOuterInner(outer, inner)); + } + + /** \returns a reference to the coefficient at given the given row and column. + * + * \sa operator[](Index) + */ + + EIGEN_STRONG_INLINE Scalar& + operator()(Index row, Index col) + { + eigen_assert(row >= 0 && row < rows() + && col >= 0 && col < cols()); + return derived().coeffRef(row, col); + } + + + /** Short version: don't use this function, use + * \link operator[](Index) \endlink instead. + * + * Long version: this function is similar to + * \link operator[](Index) \endlink, but without the assertion. + * Use this for limiting the performance cost of debugging code when doing + * repeated coefficient access. Only use this when it is guaranteed that the + * parameters \a row and \a col are in range. + * + * If EIGEN_INTERNAL_DEBUGGING is defined, an assertion will be made, making this + * function equivalent to \link operator[](Index) \endlink. + * + * \sa operator[](Index), coeff(Index) const, coeffRef(Index,Index) + */ + + EIGEN_STRONG_INLINE Scalar& + coeffRef(Index index) + { + eigen_internal_assert(index >= 0 && index < size()); + return derived().coeffRef(index); + } + + /** \returns a reference to the coefficient at given index. + * + * This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit. + * + * \sa operator[](Index) const, operator()(Index,Index), x(), y(), z(), w() + */ + + EIGEN_STRONG_INLINE Scalar& + operator[](Index index) + { + #ifndef EIGEN2_SUPPORT + EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime, + THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD) + #endif + eigen_assert(index >= 0 && index < size()); + return derived().coeffRef(index); + } + + /** \returns a reference to the coefficient at given index. + * + * This is synonymous to operator[](Index). + * + * This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit. + * + * \sa operator[](Index) const, operator()(Index,Index), x(), y(), z(), w() + */ + + EIGEN_STRONG_INLINE Scalar& + operator()(Index index) + { + eigen_assert(index >= 0 && index < size()); + return derived().coeffRef(index); + } + + /** equivalent to operator[](0). */ + + EIGEN_STRONG_INLINE Scalar& + x() { return (*this)[0]; } + + /** equivalent to operator[](1). */ + + EIGEN_STRONG_INLINE Scalar& + y() { return (*this)[1]; } + + /** equivalent to operator[](2). */ + + EIGEN_STRONG_INLINE Scalar& + z() { return (*this)[2]; } + + /** equivalent to operator[](3). */ + + EIGEN_STRONG_INLINE Scalar& + w() { return (*this)[3]; } + + /** \internal + * Stores the given packet of coefficients, at the given row and column of this expression. It is your responsibility + * to ensure that a packet really starts there. This method is only available on expressions having the + * PacketAccessBit. + * + * The \a LoadMode parameter may have the value \a #Aligned or \a #Unaligned. Its effect is to select + * the appropriate vectorization instruction. Aligned access is faster, but is only possible for packets + * starting at an address which is a multiple of the packet size. + */ + + template + EIGEN_STRONG_INLINE void writePacket + (Index row, Index col, const typename internal::packet_traits::type& x) + { + eigen_internal_assert(row >= 0 && row < rows() + && col >= 0 && col < cols()); + derived().template writePacket(row,col,x); + } + + + /** \internal */ + template + EIGEN_STRONG_INLINE void writePacketByOuterInner + (Index outer, Index inner, const typename internal::packet_traits::type& x) + { + writePacket(rowIndexByOuterInner(outer, inner), + colIndexByOuterInner(outer, inner), + x); + } + + /** \internal + * Stores the given packet of coefficients, at the given index in this expression. It is your responsibility + * to ensure that a packet really starts there. This method is only available on expressions having the + * PacketAccessBit and the LinearAccessBit. + * + * The \a LoadMode parameter may have the value \a Aligned or \a Unaligned. Its effect is to select + * the appropriate vectorization instruction. Aligned access is faster, but is only possible for packets + * starting at an address which is a multiple of the packet size. + */ + template + EIGEN_STRONG_INLINE void writePacket + (Index index, const typename internal::packet_traits::type& x) + { + eigen_internal_assert(index >= 0 && index < size()); + derived().template writePacket(index,x); + } + +#ifndef EIGEN_PARSED_BY_DOXYGEN + + /** \internal Copies the coefficient at position (row,col) of other into *this. + * + * This method is overridden in SwapWrapper, allowing swap() assignments to share 99% of their code + * with usual assignments. + * + * Outside of this internal usage, this method has probably no usefulness. It is hidden in the public API dox. + */ + + template + EIGEN_STRONG_INLINE void copyCoeff(Index row, Index col, const DenseBase& other) + { + eigen_internal_assert(row >= 0 && row < rows() + && col >= 0 && col < cols()); + derived().coeffRef(row, col) = other.derived().coeff(row, col); + } + + /** \internal Copies the coefficient at the given index of other into *this. + * + * This method is overridden in SwapWrapper, allowing swap() assignments to share 99% of their code + * with usual assignments. + * + * Outside of this internal usage, this method has probably no usefulness. It is hidden in the public API dox. + */ + + template + EIGEN_STRONG_INLINE void copyCoeff(Index index, const DenseBase& other) + { + eigen_internal_assert(index >= 0 && index < size()); + derived().coeffRef(index) = other.derived().coeff(index); + } + + + template + EIGEN_STRONG_INLINE void copyCoeffByOuterInner(Index outer, Index inner, const DenseBase& other) + { + const Index row = rowIndexByOuterInner(outer,inner); + const Index col = colIndexByOuterInner(outer,inner); + // derived() is important here: copyCoeff() may be reimplemented in Derived! + derived().copyCoeff(row, col, other); + } + + /** \internal Copies the packet at position (row,col) of other into *this. + * + * This method is overridden in SwapWrapper, allowing swap() assignments to share 99% of their code + * with usual assignments. + * + * Outside of this internal usage, this method has probably no usefulness. It is hidden in the public API dox. + */ + + template + EIGEN_STRONG_INLINE void copyPacket(Index row, Index col, const DenseBase& other) + { + eigen_internal_assert(row >= 0 && row < rows() + && col >= 0 && col < cols()); + derived().template writePacket(row, col, + other.derived().template packet(row, col)); + } + + /** \internal Copies the packet at the given index of other into *this. + * + * This method is overridden in SwapWrapper, allowing swap() assignments to share 99% of their code + * with usual assignments. + * + * Outside of this internal usage, this method has probably no usefulness. It is hidden in the public API dox. + */ + + template + EIGEN_STRONG_INLINE void copyPacket(Index index, const DenseBase& other) + { + eigen_internal_assert(index >= 0 && index < size()); + derived().template writePacket(index, + other.derived().template packet(index)); + } + + /** \internal */ + template + EIGEN_STRONG_INLINE void copyPacketByOuterInner(Index outer, Index inner, const DenseBase& other) + { + const Index row = rowIndexByOuterInner(outer,inner); + const Index col = colIndexByOuterInner(outer,inner); + // derived() is important here: copyCoeff() may be reimplemented in Derived! + derived().template copyPacket< OtherDerived, StoreMode, LoadMode>(row, col, other); + } +#endif + +}; + +/** \brief Base class providing direct read-only coefficient access to matrices and arrays. + * \ingroup Core_Module + * \tparam Derived Type of the derived class + * \tparam #DirectAccessors Constant indicating direct access + * + * This class defines functions to work with strides which can be used to access entries directly. This class + * inherits DenseCoeffsBase which defines functions to access entries read-only using + * \c operator() . + * + * \sa \ref TopicClassHierarchy + */ +template +class DenseCoeffsBase : public DenseCoeffsBase +{ + public: + + typedef DenseCoeffsBase Base; + typedef typename internal::traits::Index Index; + typedef typename internal::traits::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + + using Base::rows; + using Base::cols; + using Base::size; + using Base::derived; + + /** \returns the pointer increment between two consecutive elements within a slice in the inner direction. + * + * \sa outerStride(), rowStride(), colStride() + */ + inline Index innerStride() const + { + return derived().innerStride(); + } + + /** \returns the pointer increment between two consecutive inner slices (for example, between two consecutive columns + * in a column-major matrix). + * + * \sa innerStride(), rowStride(), colStride() + */ + inline Index outerStride() const + { + return derived().outerStride(); + } + + // FIXME shall we remove it ? + inline Index stride() const + { + return Derived::IsVectorAtCompileTime ? innerStride() : outerStride(); + } + + /** \returns the pointer increment between two consecutive rows. + * + * \sa innerStride(), outerStride(), colStride() + */ + inline Index rowStride() const + { + return Derived::IsRowMajor ? outerStride() : innerStride(); + } + + /** \returns the pointer increment between two consecutive columns. + * + * \sa innerStride(), outerStride(), rowStride() + */ + inline Index colStride() const + { + return Derived::IsRowMajor ? innerStride() : outerStride(); + } +}; + +/** \brief Base class providing direct read/write coefficient access to matrices and arrays. + * \ingroup Core_Module + * \tparam Derived Type of the derived class + * \tparam #DirectWriteAccessors Constant indicating direct access + * + * This class defines functions to work with strides which can be used to access entries directly. This class + * inherits DenseCoeffsBase which defines functions to access entries read/write using + * \c operator(). + * + * \sa \ref TopicClassHierarchy + */ +template +class DenseCoeffsBase + : public DenseCoeffsBase +{ + public: + + typedef DenseCoeffsBase Base; + typedef typename internal::traits::Index Index; + typedef typename internal::traits::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + + using Base::rows; + using Base::cols; + using Base::size; + using Base::derived; + + /** \returns the pointer increment between two consecutive elements within a slice in the inner direction. + * + * \sa outerStride(), rowStride(), colStride() + */ + inline Index innerStride() const + { + return derived().innerStride(); + } + + /** \returns the pointer increment between two consecutive inner slices (for example, between two consecutive columns + * in a column-major matrix). + * + * \sa innerStride(), rowStride(), colStride() + */ + inline Index outerStride() const + { + return derived().outerStride(); + } + + // FIXME shall we remove it ? + inline Index stride() const + { + return Derived::IsVectorAtCompileTime ? innerStride() : outerStride(); + } + + /** \returns the pointer increment between two consecutive rows. + * + * \sa innerStride(), outerStride(), colStride() + */ + inline Index rowStride() const + { + return Derived::IsRowMajor ? outerStride() : innerStride(); + } + + /** \returns the pointer increment between two consecutive columns. + * + * \sa innerStride(), outerStride(), rowStride() + */ + inline Index colStride() const + { + return Derived::IsRowMajor ? innerStride() : outerStride(); + } +}; + +namespace internal { + +template +struct first_aligned_impl +{ + inline static typename Derived::Index run(const Derived&) + { return 0; } +}; + +template +struct first_aligned_impl +{ + inline static typename Derived::Index run(const Derived& m) + { + return first_aligned(&m.const_cast_derived().coeffRef(0,0), m.size()); + } +}; + +/** \internal \returns the index of the first element of the array that is well aligned for vectorization. + * + * There is also the variant first_aligned(const Scalar*, Integer) defined in Memory.h. See it for more + * documentation. + */ +template +inline static typename Derived::Index first_aligned(const Derived& m) +{ + return first_aligned_impl + + ::run(m); +} + +template::ret> +struct inner_stride_at_compile_time +{ + enum { ret = traits::InnerStrideAtCompileTime }; +}; + +template +struct inner_stride_at_compile_time +{ + enum { ret = 0 }; +}; + +template::ret> +struct outer_stride_at_compile_time +{ + enum { ret = traits::OuterStrideAtCompileTime }; +}; + +template +struct outer_stride_at_compile_time +{ + enum { ret = 0 }; +}; + +} // end namespace internal + +#endif // EIGEN_DENSECOEFFSBASE_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/DenseStorage.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/DenseStorage.h new file mode 100644 index 000000000..813053b00 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/DenseStorage.h @@ -0,0 +1,304 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2006-2009 Benoit Jacob +// Copyright (C) 2010 Hauke Heibel +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_MATRIXSTORAGE_H +#define EIGEN_MATRIXSTORAGE_H + +#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + #define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN EIGEN_DENSE_STORAGE_CTOR_PLUGIN; +#else + #define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN +#endif + +namespace internal { + +struct constructor_without_unaligned_array_assert {}; + +/** \internal + * Static array. If the MatrixOrArrayOptions require auto-alignment, the array will be automatically aligned: + * to 16 bytes boundary if the total size is a multiple of 16 bytes. + */ +template +struct plain_array +{ + T array[Size]; + plain_array() {} + plain_array(constructor_without_unaligned_array_assert) {} +}; + +#ifdef EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT + #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) +#else + #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) \ + eigen_assert((reinterpret_cast(array) & sizemask) == 0 \ + && "this assertion is explained here: " \ + "http://eigen.tuxfamily.org/dox-devel/TopicUnalignedArrayAssert.html" \ + " **** READ THIS WEB PAGE !!! ****"); +#endif + +template +struct plain_array +{ + EIGEN_USER_ALIGN16 T array[Size]; + plain_array() { EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(0xf) } + plain_array(constructor_without_unaligned_array_assert) {} +}; + +template +struct plain_array +{ + EIGEN_USER_ALIGN16 T array[1]; + plain_array() {} + plain_array(constructor_without_unaligned_array_assert) {} +}; + +} // end namespace internal + +/** \internal + * + * \class DenseStorage + * \ingroup Core_Module + * + * \brief Stores the data of a matrix + * + * This class stores the data of fixed-size, dynamic-size or mixed matrices + * in a way as compact as possible. + * + * \sa Matrix + */ +template class DenseStorage; + +// purely fixed-size matrix +template class DenseStorage +{ + internal::plain_array m_data; + public: + inline explicit DenseStorage() {} + inline DenseStorage(internal::constructor_without_unaligned_array_assert) + : m_data(internal::constructor_without_unaligned_array_assert()) {} + inline DenseStorage(DenseIndex,DenseIndex,DenseIndex) {} + inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); } + inline static DenseIndex rows(void) {return _Rows;} + inline static DenseIndex cols(void) {return _Cols;} + inline void conservativeResize(DenseIndex,DenseIndex,DenseIndex) {} + inline void resize(DenseIndex,DenseIndex,DenseIndex) {} + inline const T *data() const { return m_data.array; } + inline T *data() { return m_data.array; } +}; + +// null matrix +template class DenseStorage +{ + public: + inline explicit DenseStorage() {} + inline DenseStorage(internal::constructor_without_unaligned_array_assert) {} + inline DenseStorage(DenseIndex,DenseIndex,DenseIndex) {} + inline void swap(DenseStorage& ) {} + inline static DenseIndex rows(void) {return _Rows;} + inline static DenseIndex cols(void) {return _Cols;} + inline void conservativeResize(DenseIndex,DenseIndex,DenseIndex) {} + inline void resize(DenseIndex,DenseIndex,DenseIndex) {} + inline const T *data() const { return 0; } + inline T *data() { return 0; } +}; + +// dynamic-size matrix with fixed-size storage +template class DenseStorage +{ + internal::plain_array m_data; + DenseIndex m_rows; + DenseIndex m_cols; + public: + inline explicit DenseStorage() : m_rows(0), m_cols(0) {} + inline DenseStorage(internal::constructor_without_unaligned_array_assert) + : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(0), m_cols(0) {} + inline DenseStorage(DenseIndex, DenseIndex rows, DenseIndex cols) : m_rows(rows), m_cols(cols) {} + inline void swap(DenseStorage& other) + { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); std::swap(m_cols,other.m_cols); } + inline DenseIndex rows(void) const {return m_rows;} + inline DenseIndex cols(void) const {return m_cols;} + inline void conservativeResize(DenseIndex, DenseIndex rows, DenseIndex cols) { m_rows = rows; m_cols = cols; } + inline void resize(DenseIndex, DenseIndex rows, DenseIndex cols) { m_rows = rows; m_cols = cols; } + inline const T *data() const { return m_data.array; } + inline T *data() { return m_data.array; } +}; + +// dynamic-size matrix with fixed-size storage and fixed width +template class DenseStorage +{ + internal::plain_array m_data; + DenseIndex m_rows; + public: + inline explicit DenseStorage() : m_rows(0) {} + inline DenseStorage(internal::constructor_without_unaligned_array_assert) + : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(0) {} + inline DenseStorage(DenseIndex, DenseIndex rows, DenseIndex) : m_rows(rows) {} + inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); } + inline DenseIndex rows(void) const {return m_rows;} + inline DenseIndex cols(void) const {return _Cols;} + inline void conservativeResize(DenseIndex, DenseIndex rows, DenseIndex) { m_rows = rows; } + inline void resize(DenseIndex, DenseIndex rows, DenseIndex) { m_rows = rows; } + inline const T *data() const { return m_data.array; } + inline T *data() { return m_data.array; } +}; + +// dynamic-size matrix with fixed-size storage and fixed height +template class DenseStorage +{ + internal::plain_array m_data; + DenseIndex m_cols; + public: + inline explicit DenseStorage() : m_cols(0) {} + inline DenseStorage(internal::constructor_without_unaligned_array_assert) + : m_data(internal::constructor_without_unaligned_array_assert()), m_cols(0) {} + inline DenseStorage(DenseIndex, DenseIndex, DenseIndex cols) : m_cols(cols) {} + inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_cols,other.m_cols); } + inline DenseIndex rows(void) const {return _Rows;} + inline DenseIndex cols(void) const {return m_cols;} + inline void conservativeResize(DenseIndex, DenseIndex, DenseIndex cols) { m_cols = cols; } + inline void resize(DenseIndex, DenseIndex, DenseIndex cols) { m_cols = cols; } + inline const T *data() const { return m_data.array; } + inline T *data() { return m_data.array; } +}; + +// purely dynamic matrix. +template class DenseStorage +{ + T *m_data; + DenseIndex m_rows; + DenseIndex m_cols; + public: + inline explicit DenseStorage() : m_data(0), m_rows(0), m_cols(0) {} + inline DenseStorage(internal::constructor_without_unaligned_array_assert) + : m_data(0), m_rows(0), m_cols(0) {} + inline DenseStorage(DenseIndex size, DenseIndex rows, DenseIndex cols) + : m_data(internal::conditional_aligned_new_auto(size)), m_rows(rows), m_cols(cols) + { EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN } + inline ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, m_rows*m_cols); } + inline void swap(DenseStorage& other) + { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); std::swap(m_cols,other.m_cols); } + inline DenseIndex rows(void) const {return m_rows;} + inline DenseIndex cols(void) const {return m_cols;} + inline void conservativeResize(DenseIndex size, DenseIndex rows, DenseIndex cols) + { + m_data = internal::conditional_aligned_realloc_new_auto(m_data, size, m_rows*m_cols); + m_rows = rows; + m_cols = cols; + } + void resize(DenseIndex size, DenseIndex rows, DenseIndex cols) + { + if(size != m_rows*m_cols) + { + internal::conditional_aligned_delete_auto(m_data, m_rows*m_cols); + if (size) + m_data = internal::conditional_aligned_new_auto(size); + else + m_data = 0; + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN + } + m_rows = rows; + m_cols = cols; + } + inline const T *data() const { return m_data; } + inline T *data() { return m_data; } +}; + +// matrix with dynamic width and fixed height (so that matrix has dynamic size). +template class DenseStorage +{ + T *m_data; + DenseIndex m_cols; + public: + inline explicit DenseStorage() : m_data(0), m_cols(0) {} + inline DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_cols(0) {} + inline DenseStorage(DenseIndex size, DenseIndex, DenseIndex cols) : m_data(internal::conditional_aligned_new_auto(size)), m_cols(cols) + { EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN } + inline ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, _Rows*m_cols); } + inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_cols,other.m_cols); } + inline static DenseIndex rows(void) {return _Rows;} + inline DenseIndex cols(void) const {return m_cols;} + inline void conservativeResize(DenseIndex size, DenseIndex, DenseIndex cols) + { + m_data = internal::conditional_aligned_realloc_new_auto(m_data, size, _Rows*m_cols); + m_cols = cols; + } + EIGEN_STRONG_INLINE void resize(DenseIndex size, DenseIndex, DenseIndex cols) + { + if(size != _Rows*m_cols) + { + internal::conditional_aligned_delete_auto(m_data, _Rows*m_cols); + if (size) + m_data = internal::conditional_aligned_new_auto(size); + else + m_data = 0; + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN + } + m_cols = cols; + } + inline const T *data() const { return m_data; } + inline T *data() { return m_data; } +}; + +// matrix with dynamic height and fixed width (so that matrix has dynamic size). +template class DenseStorage +{ + T *m_data; + DenseIndex m_rows; + public: + inline explicit DenseStorage() : m_data(0), m_rows(0) {} + inline DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_rows(0) {} + inline DenseStorage(DenseIndex size, DenseIndex rows, DenseIndex) : m_data(internal::conditional_aligned_new_auto(size)), m_rows(rows) + { EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN } + inline ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, _Cols*m_rows); } + inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); } + inline DenseIndex rows(void) const {return m_rows;} + inline static DenseIndex cols(void) {return _Cols;} + inline void conservativeResize(DenseIndex size, DenseIndex rows, DenseIndex) + { + m_data = internal::conditional_aligned_realloc_new_auto(m_data, size, m_rows*_Cols); + m_rows = rows; + } + EIGEN_STRONG_INLINE void resize(DenseIndex size, DenseIndex rows, DenseIndex) + { + if(size != m_rows*_Cols) + { + internal::conditional_aligned_delete_auto(m_data, _Cols*m_rows); + if (size) + m_data = internal::conditional_aligned_new_auto(size); + else + m_data = 0; + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN + } + m_rows = rows; + } + inline const T *data() const { return m_data; } + inline T *data() { return m_data; } +}; + +#endif // EIGEN_MATRIX_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/Diagonal.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/Diagonal.h new file mode 100644 index 000000000..e807a49e4 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/Diagonal.h @@ -0,0 +1,227 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2007-2009 Benoit Jacob +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_DIAGONAL_H +#define EIGEN_DIAGONAL_H + +/** \class Diagonal + * \ingroup Core_Module + * + * \brief Expression of a diagonal/subdiagonal/superdiagonal in a matrix + * + * \param MatrixType the type of the object in which we are taking a sub/main/super diagonal + * \param DiagIndex the index of the sub/super diagonal. The default is 0 and it means the main diagonal. + * A positive value means a superdiagonal, a negative value means a subdiagonal. + * You can also use Dynamic so the index can be set at runtime. + * + * The matrix is not required to be square. + * + * This class represents an expression of the main diagonal, or any sub/super diagonal + * of a square matrix. It is the return type of MatrixBase::diagonal() and MatrixBase::diagonal(Index) and most of the + * time this is the only way it is used. + * + * \sa MatrixBase::diagonal(), MatrixBase::diagonal(Index) + */ + +namespace internal { +template +struct traits > + : traits +{ + typedef typename nested::type MatrixTypeNested; + typedef typename remove_reference::type _MatrixTypeNested; + typedef typename MatrixType::StorageKind StorageKind; + enum { + AbsDiagIndex = DiagIndex<0 ? -DiagIndex : DiagIndex, // only used if DiagIndex != Dynamic + // FIXME these computations are broken in the case where the matrix is rectangular and DiagIndex!=0 + RowsAtCompileTime = (int(DiagIndex) == Dynamic || int(MatrixType::SizeAtCompileTime) == Dynamic) ? Dynamic + : (EIGEN_SIZE_MIN_PREFER_DYNAMIC(MatrixType::RowsAtCompileTime, + MatrixType::ColsAtCompileTime) - AbsDiagIndex), + ColsAtCompileTime = 1, + MaxRowsAtCompileTime = int(MatrixType::MaxSizeAtCompileTime) == Dynamic ? Dynamic + : DiagIndex == Dynamic ? EIGEN_SIZE_MIN_PREFER_FIXED(MatrixType::MaxRowsAtCompileTime, + MatrixType::MaxColsAtCompileTime) + : (EIGEN_SIZE_MIN_PREFER_FIXED(MatrixType::MaxRowsAtCompileTime, MatrixType::MaxColsAtCompileTime) - AbsDiagIndex), + MaxColsAtCompileTime = 1, + MaskLvalueBit = is_lvalue::value ? LvalueBit : 0, + Flags = (unsigned int)_MatrixTypeNested::Flags & (HereditaryBits | LinearAccessBit | MaskLvalueBit | DirectAccessBit) & ~RowMajorBit, + CoeffReadCost = _MatrixTypeNested::CoeffReadCost, + MatrixTypeOuterStride = outer_stride_at_compile_time::ret, + InnerStrideAtCompileTime = MatrixTypeOuterStride == Dynamic ? Dynamic : MatrixTypeOuterStride+1, + OuterStrideAtCompileTime = 0 + }; +}; +} + +template class Diagonal + : public internal::dense_xpr_base< Diagonal >::type +{ + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Diagonal) + + inline Diagonal(MatrixType& matrix, Index index = DiagIndex) : m_matrix(matrix), m_index(index) {} + + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Diagonal) + + inline Index rows() const + { return m_index.value()<0 ? std::min(m_matrix.cols(),m_matrix.rows()+m_index.value()) : std::min(m_matrix.rows(),m_matrix.cols()-m_index.value()); } + + inline Index cols() const { return 1; } + + inline Index innerStride() const + { + return m_matrix.outerStride() + 1; + } + + inline Index outerStride() const + { + return 0; + } + + inline Scalar& coeffRef(Index row, Index) + { + EIGEN_STATIC_ASSERT_LVALUE(MatrixType) + return m_matrix.const_cast_derived().coeffRef(row+rowOffset(), row+colOffset()); + } + + inline const Scalar& coeffRef(Index row, Index) const + { + return m_matrix.const_cast_derived().coeffRef(row+rowOffset(), row+colOffset()); + } + + inline CoeffReturnType coeff(Index row, Index) const + { + return m_matrix.coeff(row+rowOffset(), row+colOffset()); + } + + inline Scalar& coeffRef(Index index) + { + EIGEN_STATIC_ASSERT_LVALUE(MatrixType) + return m_matrix.const_cast_derived().coeffRef(index+rowOffset(), index+colOffset()); + } + + inline const Scalar& coeffRef(Index index) const + { + return m_matrix.const_cast_derived().coeffRef(index+rowOffset(), index+colOffset()); + } + + inline CoeffReturnType coeff(Index index) const + { + return m_matrix.coeff(index+rowOffset(), index+colOffset()); + } + + protected: + const typename MatrixType::Nested m_matrix; + const internal::variable_if_dynamic m_index; + + private: + // some compilers may fail to optimize std::max etc in case of compile-time constants... + EIGEN_STRONG_INLINE Index absDiagIndex() const { return m_index.value()>0 ? m_index.value() : -m_index.value(); } + EIGEN_STRONG_INLINE Index rowOffset() const { return m_index.value()>0 ? 0 : -m_index.value(); } + EIGEN_STRONG_INLINE Index colOffset() const { return m_index.value()>0 ? m_index.value() : 0; } + // triger a compile time error is someone try to call packet + template typename MatrixType::PacketReturnType packet(Index) const; + template typename MatrixType::PacketReturnType packet(Index,Index) const; +}; + +/** \returns an expression of the main diagonal of the matrix \c *this + * + * \c *this is not required to be square. + * + * Example: \include MatrixBase_diagonal.cpp + * Output: \verbinclude MatrixBase_diagonal.out + * + * \sa class Diagonal */ +template +inline typename MatrixBase::DiagonalReturnType +MatrixBase::diagonal() +{ + return derived(); +} + +/** This is the const version of diagonal(). */ +template +inline const typename MatrixBase::ConstDiagonalReturnType +MatrixBase::diagonal() const +{ + return ConstDiagonalReturnType(derived()); +} + +/** \returns an expression of the \a DiagIndex-th sub or super diagonal of the matrix \c *this + * + * \c *this is not required to be square. + * + * The template parameter \a DiagIndex represent a super diagonal if \a DiagIndex > 0 + * and a sub diagonal otherwise. \a DiagIndex == 0 is equivalent to the main diagonal. + * + * Example: \include MatrixBase_diagonal_int.cpp + * Output: \verbinclude MatrixBase_diagonal_int.out + * + * \sa MatrixBase::diagonal(), class Diagonal */ +template +inline typename MatrixBase::template DiagonalIndexReturnType::Type +MatrixBase::diagonal(Index index) +{ + return typename DiagonalIndexReturnType::Type(derived(), index); +} + +/** This is the const version of diagonal(Index). */ +template +inline typename MatrixBase::template ConstDiagonalIndexReturnType::Type +MatrixBase::diagonal(Index index) const +{ + return typename ConstDiagonalIndexReturnType::Type(derived(), index); +} + +/** \returns an expression of the \a DiagIndex-th sub or super diagonal of the matrix \c *this + * + * \c *this is not required to be square. + * + * The template parameter \a DiagIndex represent a super diagonal if \a DiagIndex > 0 + * and a sub diagonal otherwise. \a DiagIndex == 0 is equivalent to the main diagonal. + * + * Example: \include MatrixBase_diagonal_template_int.cpp + * Output: \verbinclude MatrixBase_diagonal_template_int.out + * + * \sa MatrixBase::diagonal(), class Diagonal */ +template +template +inline typename MatrixBase::template DiagonalIndexReturnType::Type +MatrixBase::diagonal() +{ + return derived(); +} + +/** This is the const version of diagonal(). */ +template +template +inline typename MatrixBase::template ConstDiagonalIndexReturnType::Type +MatrixBase::diagonal() const +{ + return derived(); +} + +#endif // EIGEN_DIAGONAL_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/DiagonalMatrix.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/DiagonalMatrix.h new file mode 100644 index 000000000..f41a74bfa --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/DiagonalMatrix.h @@ -0,0 +1,306 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// Copyright (C) 2007-2009 Benoit Jacob +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_DIAGONALMATRIX_H +#define EIGEN_DIAGONALMATRIX_H + +#ifndef EIGEN_PARSED_BY_DOXYGEN +template +class DiagonalBase : public EigenBase +{ + public: + typedef typename internal::traits::DiagonalVectorType DiagonalVectorType; + typedef typename DiagonalVectorType::Scalar Scalar; + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::Index Index; + + enum { + RowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, + ColsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, + MaxRowsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime, + MaxColsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime, + IsVectorAtCompileTime = 0, + Flags = 0 + }; + + typedef Matrix DenseMatrixType; + typedef DenseMatrixType DenseType; + typedef DiagonalMatrix PlainObject; + + inline const Derived& derived() const { return *static_cast(this); } + inline Derived& derived() { return *static_cast(this); } + + DenseMatrixType toDenseMatrix() const { return derived(); } + template + void evalTo(MatrixBase &other) const; + template + void addTo(MatrixBase &other) const + { other.diagonal() += diagonal(); } + template + void subTo(MatrixBase &other) const + { other.diagonal() -= diagonal(); } + + inline const DiagonalVectorType& diagonal() const { return derived().diagonal(); } + inline DiagonalVectorType& diagonal() { return derived().diagonal(); } + + inline Index rows() const { return diagonal().size(); } + inline Index cols() const { return diagonal().size(); } + + template + const DiagonalProduct + operator*(const MatrixBase &matrix) const; + + inline const DiagonalWrapper, const DiagonalVectorType> > + inverse() const + { + return diagonal().cwiseInverse(); + } + + #ifdef EIGEN2_SUPPORT + template + bool isApprox(const DiagonalBase& other, typename NumTraits::Real precision = NumTraits::dummy_precision()) const + { + return diagonal().isApprox(other.diagonal(), precision); + } + template + bool isApprox(const MatrixBase& other, typename NumTraits::Real precision = NumTraits::dummy_precision()) const + { + return toDenseMatrix().isApprox(other, precision); + } + #endif +}; + +template +template +void DiagonalBase::evalTo(MatrixBase &other) const +{ + other.setZero(); + other.diagonal() = diagonal(); +} +#endif + +/** \class DiagonalMatrix + * \ingroup Core_Module + * + * \brief Represents a diagonal matrix with its storage + * + * \param _Scalar the type of coefficients + * \param SizeAtCompileTime the dimension of the matrix, or Dynamic + * \param MaxSizeAtCompileTime the dimension of the matrix, or Dynamic. This parameter is optional and defaults + * to SizeAtCompileTime. Most of the time, you do not need to specify it. + * + * \sa class DiagonalWrapper + */ + +namespace internal { +template +struct traits > + : traits > +{ + typedef Matrix<_Scalar,SizeAtCompileTime,1,0,MaxSizeAtCompileTime,1> DiagonalVectorType; + typedef Dense StorageKind; + typedef DenseIndex Index; + enum { + Flags = LvalueBit + }; +}; +} +template +class DiagonalMatrix + : public DiagonalBase > +{ + public: + #ifndef EIGEN_PARSED_BY_DOXYGEN + typedef typename internal::traits::DiagonalVectorType DiagonalVectorType; + typedef const DiagonalMatrix& Nested; + typedef _Scalar Scalar; + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::Index Index; + #endif + + protected: + + DiagonalVectorType m_diagonal; + + public: + + /** const version of diagonal(). */ + inline const DiagonalVectorType& diagonal() const { return m_diagonal; } + /** \returns a reference to the stored vector of diagonal coefficients. */ + inline DiagonalVectorType& diagonal() { return m_diagonal; } + + /** Default constructor without initialization */ + inline DiagonalMatrix() {} + + /** Constructs a diagonal matrix with given dimension */ + inline DiagonalMatrix(Index dim) : m_diagonal(dim) {} + + /** 2D constructor. */ + inline DiagonalMatrix(const Scalar& x, const Scalar& y) : m_diagonal(x,y) {} + + /** 3D constructor. */ + inline DiagonalMatrix(const Scalar& x, const Scalar& y, const Scalar& z) : m_diagonal(x,y,z) {} + + /** Copy constructor. */ + template + inline DiagonalMatrix(const DiagonalBase& other) : m_diagonal(other.diagonal()) {} + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /** copy constructor. prevent a default copy constructor from hiding the other templated constructor */ + inline DiagonalMatrix(const DiagonalMatrix& other) : m_diagonal(other.diagonal()) {} + #endif + + /** generic constructor from expression of the diagonal coefficients */ + template + explicit inline DiagonalMatrix(const MatrixBase& other) : m_diagonal(other) + {} + + /** Copy operator. */ + template + DiagonalMatrix& operator=(const DiagonalBase& other) + { + m_diagonal = other.diagonal(); + return *this; + } + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /** This is a special case of the templated operator=. Its purpose is to + * prevent a default operator= from hiding the templated operator=. + */ + DiagonalMatrix& operator=(const DiagonalMatrix& other) + { + m_diagonal = other.diagonal(); + return *this; + } + #endif + + /** Resizes to given size. */ + inline void resize(Index size) { m_diagonal.resize(size); } + /** Sets all coefficients to zero. */ + inline void setZero() { m_diagonal.setZero(); } + /** Resizes and sets all coefficients to zero. */ + inline void setZero(Index size) { m_diagonal.setZero(size); } + /** Sets this matrix to be the identity matrix of the current size. */ + inline void setIdentity() { m_diagonal.setOnes(); } + /** Sets this matrix to be the identity matrix of the given size. */ + inline void setIdentity(Index size) { m_diagonal.setOnes(size); } +}; + +/** \class DiagonalWrapper + * \ingroup Core_Module + * + * \brief Expression of a diagonal matrix + * + * \param _DiagonalVectorType the type of the vector of diagonal coefficients + * + * This class is an expression of a diagonal matrix, but not storing its own vector of diagonal coefficients, + * instead wrapping an existing vector expression. It is the return type of MatrixBase::asDiagonal() + * and most of the time this is the only way that it is used. + * + * \sa class DiagonalMatrix, class DiagonalBase, MatrixBase::asDiagonal() + */ + +namespace internal { +template +struct traits > +{ + typedef _DiagonalVectorType DiagonalVectorType; + typedef typename DiagonalVectorType::Scalar Scalar; + typedef typename DiagonalVectorType::Index Index; + typedef typename DiagonalVectorType::StorageKind StorageKind; + enum { + RowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, + ColsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, + MaxRowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, + MaxColsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, + Flags = traits::Flags & LvalueBit + }; +}; +} + +template +class DiagonalWrapper + : public DiagonalBase >, internal::no_assignment_operator +{ + public: + #ifndef EIGEN_PARSED_BY_DOXYGEN + typedef _DiagonalVectorType DiagonalVectorType; + typedef DiagonalWrapper Nested; + #endif + + /** Constructor from expression of diagonal coefficients to wrap. */ + inline DiagonalWrapper(const DiagonalVectorType& diagonal) : m_diagonal(diagonal) {} + + /** \returns a const reference to the wrapped expression of diagonal coefficients. */ + const DiagonalVectorType& diagonal() const { return m_diagonal; } + + protected: + const typename DiagonalVectorType::Nested m_diagonal; +}; + +/** \returns a pseudo-expression of a diagonal matrix with *this as vector of diagonal coefficients + * + * \only_for_vectors + * + * Example: \include MatrixBase_asDiagonal.cpp + * Output: \verbinclude MatrixBase_asDiagonal.out + * + * \sa class DiagonalWrapper, class DiagonalMatrix, diagonal(), isDiagonal() + **/ +template +inline const DiagonalWrapper +MatrixBase::asDiagonal() const +{ + return derived(); +} + +/** \returns true if *this is approximately equal to a diagonal matrix, + * within the precision given by \a prec. + * + * Example: \include MatrixBase_isDiagonal.cpp + * Output: \verbinclude MatrixBase_isDiagonal.out + * + * \sa asDiagonal() + */ +template +bool MatrixBase::isDiagonal(RealScalar prec) const +{ + if(cols() != rows()) return false; + RealScalar maxAbsOnDiagonal = static_cast(-1); + for(Index j = 0; j < cols(); ++j) + { + RealScalar absOnDiagonal = internal::abs(coeff(j,j)); + if(absOnDiagonal > maxAbsOnDiagonal) maxAbsOnDiagonal = absOnDiagonal; + } + for(Index j = 0; j < cols(); ++j) + for(Index i = 0; i < j; ++i) + { + if(!internal::isMuchSmallerThan(coeff(i, j), maxAbsOnDiagonal, prec)) return false; + if(!internal::isMuchSmallerThan(coeff(j, i), maxAbsOnDiagonal, prec)) return false; + } + return true; +} + +#endif // EIGEN_DIAGONALMATRIX_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/DiagonalProduct.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/DiagonalProduct.h new file mode 100644 index 000000000..de0c6ed11 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/DiagonalProduct.h @@ -0,0 +1,135 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2007-2009 Benoit Jacob +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_DIAGONALPRODUCT_H +#define EIGEN_DIAGONALPRODUCT_H + +namespace internal { +template +struct traits > + : traits +{ + typedef typename scalar_product_traits::ReturnType Scalar; + enum { + RowsAtCompileTime = MatrixType::RowsAtCompileTime, + ColsAtCompileTime = MatrixType::ColsAtCompileTime, + MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, + MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, + + _StorageOrder = MatrixType::Flags & RowMajorBit ? RowMajor : ColMajor, + _PacketOnDiag = !((int(_StorageOrder) == RowMajor && int(ProductOrder) == OnTheLeft) + ||(int(_StorageOrder) == ColMajor && int(ProductOrder) == OnTheRight)), + _SameTypes = is_same::value, + // FIXME currently we need same types, but in the future the next rule should be the one + //_Vectorizable = bool(int(MatrixType::Flags)&PacketAccessBit) && ((!_PacketOnDiag) || (_SameTypes && bool(int(DiagonalType::Flags)&PacketAccessBit))), + _Vectorizable = bool(int(MatrixType::Flags)&PacketAccessBit) && _SameTypes && ((!_PacketOnDiag) || (bool(int(DiagonalType::Flags)&PacketAccessBit))), + + Flags = (HereditaryBits & (unsigned int)(MatrixType::Flags)) | (_Vectorizable ? PacketAccessBit : 0), + CoeffReadCost = NumTraits::MulCost + MatrixType::CoeffReadCost + DiagonalType::DiagonalVectorType::CoeffReadCost + }; +}; +} + +template +class DiagonalProduct : internal::no_assignment_operator, + public MatrixBase > +{ + public: + + typedef MatrixBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(DiagonalProduct) + + inline DiagonalProduct(const MatrixType& matrix, const DiagonalType& diagonal) + : m_matrix(matrix), m_diagonal(diagonal) + { + eigen_assert(diagonal.diagonal().size() == (ProductOrder == OnTheLeft ? matrix.rows() : matrix.cols())); + } + + inline Index rows() const { return m_matrix.rows(); } + inline Index cols() const { return m_matrix.cols(); } + + const Scalar coeff(Index row, Index col) const + { + return m_diagonal.diagonal().coeff(ProductOrder == OnTheLeft ? row : col) * m_matrix.coeff(row, col); + } + + template + EIGEN_STRONG_INLINE PacketScalar packet(Index row, Index col) const + { + enum { + StorageOrder = Flags & RowMajorBit ? RowMajor : ColMajor + }; + const Index indexInDiagonalVector = ProductOrder == OnTheLeft ? row : col; + + return packet_impl(row,col,indexInDiagonalVector,typename internal::conditional< + ((int(StorageOrder) == RowMajor && int(ProductOrder) == OnTheLeft) + ||(int(StorageOrder) == ColMajor && int(ProductOrder) == OnTheRight)), internal::true_type, internal::false_type>::type()); + } + + protected: + template + EIGEN_STRONG_INLINE PacketScalar packet_impl(Index row, Index col, Index id, internal::true_type) const + { + return internal::pmul(m_matrix.template packet(row, col), + internal::pset1(m_diagonal.diagonal().coeff(id))); + } + + template + EIGEN_STRONG_INLINE PacketScalar packet_impl(Index row, Index col, Index id, internal::false_type) const + { + enum { + InnerSize = (MatrixType::Flags & RowMajorBit) ? MatrixType::ColsAtCompileTime : MatrixType::RowsAtCompileTime, + DiagonalVectorPacketLoadMode = (LoadMode == Aligned && ((InnerSize%16) == 0)) ? Aligned : Unaligned + }; + return internal::pmul(m_matrix.template packet(row, col), + m_diagonal.diagonal().template packet(id)); + } + + const typename MatrixType::Nested m_matrix; + const typename DiagonalType::Nested m_diagonal; +}; + +/** \returns the diagonal matrix product of \c *this by the diagonal matrix \a diagonal. + */ +template +template +inline const DiagonalProduct +MatrixBase::operator*(const DiagonalBase &diagonal) const +{ + return DiagonalProduct(derived(), diagonal.derived()); +} + +/** \returns the diagonal matrix product of \c *this by the matrix \a matrix. + */ +template +template +inline const DiagonalProduct +DiagonalBase::operator*(const MatrixBase &matrix) const +{ + return DiagonalProduct(matrix.derived(), derived()); +} + + +#endif // EIGEN_DIAGONALPRODUCT_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/Dot.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/Dot.h new file mode 100644 index 000000000..6e83191c5 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/Dot.h @@ -0,0 +1,268 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008, 2010 Benoit Jacob +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_DOT_H +#define EIGEN_DOT_H + +namespace internal { + +// helper function for dot(). The problem is that if we put that in the body of dot(), then upon calling dot +// with mismatched types, the compiler emits errors about failing to instantiate cwiseProduct BEFORE +// looking at the static assertions. Thus this is a trick to get better compile errors. +template +struct dot_nocheck +{ + typedef typename scalar_product_traits::Scalar,typename traits::Scalar>::ReturnType ResScalar; + static inline ResScalar run(const MatrixBase& a, const MatrixBase& b) + { + return a.template binaryExpr::Scalar,typename traits::Scalar> >(b).sum(); + } +}; + +template +struct dot_nocheck +{ + typedef typename scalar_product_traits::Scalar,typename traits::Scalar>::ReturnType ResScalar; + static inline ResScalar run(const MatrixBase& a, const MatrixBase& b) + { + return a.transpose().template binaryExpr::Scalar,typename traits::Scalar> >(b).sum(); + } +}; + +} // end namespace internal + +/** \returns the dot product of *this with other. + * + * \only_for_vectors + * + * \note If the scalar type is complex numbers, then this function returns the hermitian + * (sesquilinear) dot product, conjugate-linear in the first variable and linear in the + * second variable. + * + * \sa squaredNorm(), norm() + */ +template +template +typename internal::scalar_product_traits::Scalar,typename internal::traits::Scalar>::ReturnType +MatrixBase::dot(const MatrixBase& other) const +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) + EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) + typedef internal::scalar_conj_product_op func; + EIGEN_CHECK_BINARY_COMPATIBILIY(func,Scalar,typename OtherDerived::Scalar); + + eigen_assert(size() == other.size()); + + return internal::dot_nocheck::run(*this, other); +} + +#ifdef EIGEN2_SUPPORT +/** \returns the dot product of *this with other, with the Eigen2 convention that the dot product is linear in the first variable + * (conjugating the second variable). Of course this only makes a difference in the complex case. + * + * This method is only available in EIGEN2_SUPPORT mode. + * + * \only_for_vectors + * + * \sa dot() + */ +template +template +typename internal::traits::Scalar +MatrixBase::eigen2_dot(const MatrixBase& other) const +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) + EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) + EIGEN_STATIC_ASSERT((internal::is_same::value), + YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) + + eigen_assert(size() == other.size()); + + return internal::dot_nocheck::run(other,*this); +} +#endif + + +//---------- implementation of L2 norm and related functions ---------- + +/** \returns the squared \em l2 norm of *this, i.e., for vectors, the dot product of *this with itself. + * + * \sa dot(), norm() + */ +template +EIGEN_STRONG_INLINE typename NumTraits::Scalar>::Real MatrixBase::squaredNorm() const +{ + return internal::real((*this).cwiseAbs2().sum()); +} + +/** \returns the \em l2 norm of *this, i.e., for vectors, the square root of the dot product of *this with itself. + * + * \sa dot(), squaredNorm() + */ +template +inline typename NumTraits::Scalar>::Real MatrixBase::norm() const +{ + return internal::sqrt(squaredNorm()); +} + +/** \returns an expression of the quotient of *this by its own norm. + * + * \only_for_vectors + * + * \sa norm(), normalize() + */ +template +inline const typename MatrixBase::PlainObject +MatrixBase::normalized() const +{ + typedef typename internal::nested::type Nested; + typedef typename internal::remove_reference::type _Nested; + _Nested n(derived()); + return n / n.norm(); +} + +/** Normalizes the vector, i.e. divides it by its own norm. + * + * \only_for_vectors + * + * \sa norm(), normalized() + */ +template +inline void MatrixBase::normalize() +{ + *this /= norm(); +} + +//---------- implementation of other norms ---------- + +namespace internal { + +template +struct lpNorm_selector +{ + typedef typename NumTraits::Scalar>::Real RealScalar; + inline static RealScalar run(const MatrixBase& m) + { + return pow(m.cwiseAbs().array().pow(p).sum(), RealScalar(1)/p); + } +}; + +template +struct lpNorm_selector +{ + inline static typename NumTraits::Scalar>::Real run(const MatrixBase& m) + { + return m.cwiseAbs().sum(); + } +}; + +template +struct lpNorm_selector +{ + inline static typename NumTraits::Scalar>::Real run(const MatrixBase& m) + { + return m.norm(); + } +}; + +template +struct lpNorm_selector +{ + inline static typename NumTraits::Scalar>::Real run(const MatrixBase& m) + { + return m.cwiseAbs().maxCoeff(); + } +}; + +} // end namespace internal + +/** \returns the \f$ \ell^p \f$ norm of *this, that is, returns the p-th root of the sum of the p-th powers of the absolute values + * of the coefficients of *this. If \a p is the special value \a Eigen::Infinity, this function returns the \f$ \ell^\infty \f$ + * norm, that is the maximum of the absolute values of the coefficients of *this. + * + * \sa norm() + */ +template +template +inline typename NumTraits::Scalar>::Real +MatrixBase::lpNorm() const +{ + return internal::lpNorm_selector::run(*this); +} + +//---------- implementation of isOrthogonal / isUnitary ---------- + +/** \returns true if *this is approximately orthogonal to \a other, + * within the precision given by \a prec. + * + * Example: \include MatrixBase_isOrthogonal.cpp + * Output: \verbinclude MatrixBase_isOrthogonal.out + */ +template +template +bool MatrixBase::isOrthogonal +(const MatrixBase& other, RealScalar prec) const +{ + typename internal::nested::type nested(derived()); + typename internal::nested::type otherNested(other.derived()); + return internal::abs2(nested.dot(otherNested)) <= prec * prec * nested.squaredNorm() * otherNested.squaredNorm(); +} + +/** \returns true if *this is approximately an unitary matrix, + * within the precision given by \a prec. In the case where the \a Scalar + * type is real numbers, a unitary matrix is an orthogonal matrix, whence the name. + * + * \note This can be used to check whether a family of vectors forms an orthonormal basis. + * Indeed, \c m.isUnitary() returns true if and only if the columns (equivalently, the rows) of m form an + * orthonormal basis. + * + * Example: \include MatrixBase_isUnitary.cpp + * Output: \verbinclude MatrixBase_isUnitary.out + */ +template +bool MatrixBase::isUnitary(RealScalar prec) const +{ + typename Derived::Nested nested(derived()); + for(Index i = 0; i < cols(); ++i) + { + if(!internal::isApprox(nested.col(i).squaredNorm(), static_cast(1), prec)) + return false; + for(Index j = 0; j < i; ++j) + if(!internal::isMuchSmallerThan(nested.col(i).dot(nested.col(j)), static_cast(1), prec)) + return false; + } + return true; +} + +#endif // EIGEN_DOT_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/EigenBase.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/EigenBase.h new file mode 100644 index 000000000..0472539af --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/EigenBase.h @@ -0,0 +1,172 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Benoit Jacob +// Copyright (C) 2009 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_EIGENBASE_H +#define EIGEN_EIGENBASE_H + + +/** Common base class for all classes T such that MatrixBase has an operator=(T) and a constructor MatrixBase(T). + * + * In other words, an EigenBase object is an object that can be copied into a MatrixBase. + * + * Besides MatrixBase-derived classes, this also includes special matrix classes such as diagonal matrices, etc. + * + * Notice that this class is trivial, it is only used to disambiguate overloaded functions. + * + * \sa \ref TopicClassHierarchy + */ +template struct EigenBase +{ +// typedef typename internal::plain_matrix_type::type PlainObject; + + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::Index Index; + + /** \returns a reference to the derived object */ + Derived& derived() { return *static_cast(this); } + /** \returns a const reference to the derived object */ + const Derived& derived() const { return *static_cast(this); } + + inline Derived& const_cast_derived() const + { return *static_cast(const_cast(this)); } + inline const Derived& const_derived() const + { return *static_cast(this); } + + /** \returns the number of rows. \sa cols(), RowsAtCompileTime */ + inline Index rows() const { return derived().rows(); } + /** \returns the number of columns. \sa rows(), ColsAtCompileTime*/ + inline Index cols() const { return derived().cols(); } + /** \returns the number of coefficients, which is rows()*cols(). + * \sa rows(), cols(), SizeAtCompileTime. */ + inline Index size() const { return rows() * cols(); } + + /** \internal Don't use it, but do the equivalent: \code dst = *this; \endcode */ + template inline void evalTo(Dest& dst) const + { derived().evalTo(dst); } + + /** \internal Don't use it, but do the equivalent: \code dst += *this; \endcode */ + template inline void addTo(Dest& dst) const + { + // This is the default implementation, + // derived class can reimplement it in a more optimized way. + typename Dest::PlainObject res(rows(),cols()); + evalTo(res); + dst += res; + } + + /** \internal Don't use it, but do the equivalent: \code dst -= *this; \endcode */ + template inline void subTo(Dest& dst) const + { + // This is the default implementation, + // derived class can reimplement it in a more optimized way. + typename Dest::PlainObject res(rows(),cols()); + evalTo(res); + dst -= res; + } + + /** \internal Don't use it, but do the equivalent: \code dst.applyOnTheRight(*this); \endcode */ + template inline void applyThisOnTheRight(Dest& dst) const + { + // This is the default implementation, + // derived class can reimplement it in a more optimized way. + dst = dst * this->derived(); + } + + /** \internal Don't use it, but do the equivalent: \code dst.applyOnTheLeft(*this); \endcode */ + template inline void applyThisOnTheLeft(Dest& dst) const + { + // This is the default implementation, + // derived class can reimplement it in a more optimized way. + dst = this->derived() * dst; + } + +}; + +/*************************************************************************** +* Implementation of matrix base methods +***************************************************************************/ + +/** \brief Copies the generic expression \a other into *this. + * + * \details The expression must provide a (templated) evalTo(Derived& dst) const + * function which does the actual job. In practice, this allows any user to write + * its own special matrix without having to modify MatrixBase + * + * \returns a reference to *this. + */ +template +template +Derived& DenseBase::operator=(const EigenBase &other) +{ + other.derived().evalTo(derived()); + return derived(); +} + +template +template +Derived& DenseBase::operator+=(const EigenBase &other) +{ + other.derived().addTo(derived()); + return derived(); +} + +template +template +Derived& DenseBase::operator-=(const EigenBase &other) +{ + other.derived().subTo(derived()); + return derived(); +} + +/** replaces \c *this by \c *this * \a other. + * + * \returns a reference to \c *this + */ +template +template +inline Derived& +MatrixBase::operator*=(const EigenBase &other) +{ + other.derived().applyThisOnTheRight(derived()); + return derived(); +} + +/** replaces \c *this by \c *this * \a other. It is equivalent to MatrixBase::operator*=() */ +template +template +inline void MatrixBase::applyOnTheRight(const EigenBase &other) +{ + other.derived().applyThisOnTheRight(derived()); +} + +/** replaces \c *this by \c *this * \a other. */ +template +template +inline void MatrixBase::applyOnTheLeft(const EigenBase &other) +{ + other.derived().applyThisOnTheLeft(derived()); +} + +#endif // EIGEN_EIGENBASE_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/Flagged.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/Flagged.h new file mode 100644 index 000000000..458213ab5 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/Flagged.h @@ -0,0 +1,151 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Benoit Jacob +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_FLAGGED_H +#define EIGEN_FLAGGED_H + +/** \class Flagged + * \ingroup Core_Module + * + * \brief Expression with modified flags + * + * \param ExpressionType the type of the object of which we are modifying the flags + * \param Added the flags added to the expression + * \param Removed the flags removed from the expression (has priority over Added). + * + * This class represents an expression whose flags have been modified. + * It is the return type of MatrixBase::flagged() + * and most of the time this is the only way it is used. + * + * \sa MatrixBase::flagged() + */ + +namespace internal { +template +struct traits > : traits +{ + enum { Flags = (ExpressionType::Flags | Added) & ~Removed }; +}; +} + +template class Flagged + : public MatrixBase > +{ + public: + + typedef MatrixBase Base; + + EIGEN_DENSE_PUBLIC_INTERFACE(Flagged) + typedef typename internal::conditional::ret, + ExpressionType, const ExpressionType&>::type ExpressionTypeNested; + typedef typename ExpressionType::InnerIterator InnerIterator; + + inline Flagged(const ExpressionType& matrix) : m_matrix(matrix) {} + + inline Index rows() const { return m_matrix.rows(); } + inline Index cols() const { return m_matrix.cols(); } + inline Index outerStride() const { return m_matrix.outerStride(); } + inline Index innerStride() const { return m_matrix.innerStride(); } + + inline CoeffReturnType coeff(Index row, Index col) const + { + return m_matrix.coeff(row, col); + } + + inline CoeffReturnType coeff(Index index) const + { + return m_matrix.coeff(index); + } + + inline const Scalar& coeffRef(Index row, Index col) const + { + return m_matrix.const_cast_derived().coeffRef(row, col); + } + + inline const Scalar& coeffRef(Index index) const + { + return m_matrix.const_cast_derived().coeffRef(index); + } + + inline Scalar& coeffRef(Index row, Index col) + { + return m_matrix.const_cast_derived().coeffRef(row, col); + } + + inline Scalar& coeffRef(Index index) + { + return m_matrix.const_cast_derived().coeffRef(index); + } + + template + inline const PacketScalar packet(Index row, Index col) const + { + return m_matrix.template packet(row, col); + } + + template + inline void writePacket(Index row, Index col, const PacketScalar& x) + { + m_matrix.const_cast_derived().template writePacket(row, col, x); + } + + template + inline const PacketScalar packet(Index index) const + { + return m_matrix.template packet(index); + } + + template + inline void writePacket(Index index, const PacketScalar& x) + { + m_matrix.const_cast_derived().template writePacket(index, x); + } + + const ExpressionType& _expression() const { return m_matrix; } + + template + typename ExpressionType::PlainObject solveTriangular(const MatrixBase& other) const; + + template + void solveTriangularInPlace(const MatrixBase& other) const; + + protected: + ExpressionTypeNested m_matrix; +}; + +/** \returns an expression of *this with added and removed flags + * + * This is mostly for internal use. + * + * \sa class Flagged + */ +template +template +inline const Flagged +DenseBase::flagged() const +{ + return derived(); +} + +#endif // EIGEN_FLAGGED_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/ForceAlignedAccess.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/ForceAlignedAccess.h new file mode 100644 index 000000000..11c1f8f70 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/ForceAlignedAccess.h @@ -0,0 +1,157 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009-2010 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_FORCEALIGNEDACCESS_H +#define EIGEN_FORCEALIGNEDACCESS_H + +/** \class ForceAlignedAccess + * \ingroup Core_Module + * + * \brief Enforce aligned packet loads and stores regardless of what is requested + * + * \param ExpressionType the type of the object of which we are forcing aligned packet access + * + * This class is the return type of MatrixBase::forceAlignedAccess() + * and most of the time this is the only way it is used. + * + * \sa MatrixBase::forceAlignedAccess() + */ + +namespace internal { +template +struct traits > : public traits +{}; +} + +template class ForceAlignedAccess + : public internal::dense_xpr_base< ForceAlignedAccess >::type +{ + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(ForceAlignedAccess) + + inline ForceAlignedAccess(const ExpressionType& matrix) : m_expression(matrix) {} + + inline Index rows() const { return m_expression.rows(); } + inline Index cols() const { return m_expression.cols(); } + inline Index outerStride() const { return m_expression.outerStride(); } + inline Index innerStride() const { return m_expression.innerStride(); } + + inline const CoeffReturnType coeff(Index row, Index col) const + { + return m_expression.coeff(row, col); + } + + inline Scalar& coeffRef(Index row, Index col) + { + return m_expression.const_cast_derived().coeffRef(row, col); + } + + inline const CoeffReturnType coeff(Index index) const + { + return m_expression.coeff(index); + } + + inline Scalar& coeffRef(Index index) + { + return m_expression.const_cast_derived().coeffRef(index); + } + + template + inline const PacketScalar packet(Index row, Index col) const + { + return m_expression.template packet(row, col); + } + + template + inline void writePacket(Index row, Index col, const PacketScalar& x) + { + m_expression.const_cast_derived().template writePacket(row, col, x); + } + + template + inline const PacketScalar packet(Index index) const + { + return m_expression.template packet(index); + } + + template + inline void writePacket(Index index, const PacketScalar& x) + { + m_expression.const_cast_derived().template writePacket(index, x); + } + + operator const ExpressionType&() const { return m_expression; } + + protected: + const ExpressionType& m_expression; + + private: + ForceAlignedAccess& operator=(const ForceAlignedAccess&); +}; + +/** \returns an expression of *this with forced aligned access + * \sa forceAlignedAccessIf(),class ForceAlignedAccess + */ +template +inline const ForceAlignedAccess +MatrixBase::forceAlignedAccess() const +{ + return ForceAlignedAccess(derived()); +} + +/** \returns an expression of *this with forced aligned access + * \sa forceAlignedAccessIf(), class ForceAlignedAccess + */ +template +inline ForceAlignedAccess +MatrixBase::forceAlignedAccess() +{ + return ForceAlignedAccess(derived()); +} + +/** \returns an expression of *this with forced aligned access if \a Enable is true. + * \sa forceAlignedAccess(), class ForceAlignedAccess + */ +template +template +inline typename internal::add_const_on_value_type,Derived&>::type>::type +MatrixBase::forceAlignedAccessIf() const +{ + return derived(); +} + +/** \returns an expression of *this with forced aligned access if \a Enable is true. + * \sa forceAlignedAccess(), class ForceAlignedAccess + */ +template +template +inline typename internal::conditional,Derived&>::type +MatrixBase::forceAlignedAccessIf() +{ + return derived(); +} + +#endif // EIGEN_FORCEALIGNEDACCESS_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/Functors.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/Functors.h new file mode 100644 index 000000000..e319c978e --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/Functors.h @@ -0,0 +1,942 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2010 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_FUNCTORS_H +#define EIGEN_FUNCTORS_H + +namespace internal { + +// associative functors: + +/** \internal + * \brief Template functor to compute the sum of two scalars + * + * \sa class CwiseBinaryOp, MatrixBase::operator+, class VectorwiseOp, MatrixBase::sum() + */ +template struct scalar_sum_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_sum_op) + EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { return a + b; } + template + EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const + { return internal::padd(a,b); } + template + EIGEN_STRONG_INLINE const Scalar predux(const Packet& a) const + { return internal::predux(a); } +}; +template +struct functor_traits > { + enum { + Cost = NumTraits::AddCost, + PacketAccess = packet_traits::HasAdd + }; +}; + +/** \internal + * \brief Template functor to compute the product of two scalars + * + * \sa class CwiseBinaryOp, Cwise::operator*(), class VectorwiseOp, MatrixBase::redux() + */ +template struct scalar_product_op { + enum { + // TODO vectorize mixed product + Vectorizable = is_same::value && packet_traits::HasMul && packet_traits::HasMul + }; + typedef typename scalar_product_traits::ReturnType result_type; + EIGEN_EMPTY_STRUCT_CTOR(scalar_product_op) + EIGEN_STRONG_INLINE const result_type operator() (const LhsScalar& a, const RhsScalar& b) const { return a * b; } + template + EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const + { return internal::pmul(a,b); } + template + EIGEN_STRONG_INLINE const result_type predux(const Packet& a) const + { return internal::predux_mul(a); } +}; +template +struct functor_traits > { + enum { + Cost = (NumTraits::MulCost + NumTraits::MulCost)/2, // rough estimate! + PacketAccess = scalar_product_op::Vectorizable + }; +}; + +/** \internal + * \brief Template functor to compute the conjugate product of two scalars + * + * This is a short cut for conj(x) * y which is needed for optimization purpose; in Eigen2 support mode, this becomes x * conj(y) + */ +template struct scalar_conj_product_op { + + enum { + Conj = NumTraits::IsComplex + }; + + typedef typename scalar_product_traits::ReturnType result_type; + + EIGEN_EMPTY_STRUCT_CTOR(scalar_conj_product_op) + EIGEN_STRONG_INLINE const result_type operator() (const LhsScalar& a, const RhsScalar& b) const + { return conj_helper().pmul(a,b); } + + template + EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const + { return conj_helper().pmul(a,b); } +}; +template +struct functor_traits > { + enum { + Cost = NumTraits::MulCost, + PacketAccess = internal::is_same::value && packet_traits::HasMul + }; +}; + +/** \internal + * \brief Template functor to compute the min of two scalars + * + * \sa class CwiseBinaryOp, MatrixBase::cwiseMin, class VectorwiseOp, MatrixBase::minCoeff() + */ +template struct scalar_min_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_min_op) + EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { using std::min; return min(a, b); } + template + EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const + { return internal::pmin(a,b); } + template + EIGEN_STRONG_INLINE const Scalar predux(const Packet& a) const + { return internal::predux_min(a); } +}; +template +struct functor_traits > { + enum { + Cost = NumTraits::AddCost, + PacketAccess = packet_traits::HasMin + }; +}; + +/** \internal + * \brief Template functor to compute the max of two scalars + * + * \sa class CwiseBinaryOp, MatrixBase::cwiseMax, class VectorwiseOp, MatrixBase::maxCoeff() + */ +template struct scalar_max_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_max_op) + EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { using std::max; return max(a, b); } + template + EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const + { return internal::pmax(a,b); } + template + EIGEN_STRONG_INLINE const Scalar predux(const Packet& a) const + { return internal::predux_max(a); } +}; +template +struct functor_traits > { + enum { + Cost = NumTraits::AddCost, + PacketAccess = packet_traits::HasMax + }; +}; + +/** \internal + * \brief Template functor to compute the hypot of two scalars + * + * \sa MatrixBase::stableNorm(), class Redux + */ +template struct scalar_hypot_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_hypot_op) +// typedef typename NumTraits::Real result_type; + EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& _x, const Scalar& _y) const + { + using std::max; + using std::min; + Scalar p = max(_x, _y); + Scalar q = min(_x, _y); + Scalar qp = q/p; + return p * sqrt(Scalar(1) + qp*qp); + } +}; +template +struct functor_traits > { + enum { Cost = 5 * NumTraits::MulCost, PacketAccess=0 }; +}; + +// other binary functors: + +/** \internal + * \brief Template functor to compute the difference of two scalars + * + * \sa class CwiseBinaryOp, MatrixBase::operator- + */ +template struct scalar_difference_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_difference_op) + EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { return a - b; } + template + EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const + { return internal::psub(a,b); } +}; +template +struct functor_traits > { + enum { + Cost = NumTraits::AddCost, + PacketAccess = packet_traits::HasSub + }; +}; + +/** \internal + * \brief Template functor to compute the quotient of two scalars + * + * \sa class CwiseBinaryOp, Cwise::operator/() + */ +template struct scalar_quotient_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_quotient_op) + EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { return a / b; } + template + EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const + { return internal::pdiv(a,b); } +}; +template +struct functor_traits > { + enum { + Cost = 2 * NumTraits::MulCost, + PacketAccess = packet_traits::HasDiv + }; +}; + +// unary functors: + +/** \internal + * \brief Template functor to compute the opposite of a scalar + * + * \sa class CwiseUnaryOp, MatrixBase::operator- + */ +template struct scalar_opposite_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_opposite_op) + EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { return -a; } + template + EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const + { return internal::pnegate(a); } +}; +template +struct functor_traits > +{ enum { + Cost = NumTraits::AddCost, + PacketAccess = packet_traits::HasNegate }; +}; + +/** \internal + * \brief Template functor to compute the absolute value of a scalar + * + * \sa class CwiseUnaryOp, Cwise::abs + */ +template struct scalar_abs_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_abs_op) + typedef typename NumTraits::Real result_type; + EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { return abs(a); } + template + EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const + { return internal::pabs(a); } +}; +template +struct functor_traits > +{ + enum { + Cost = NumTraits::AddCost, + PacketAccess = packet_traits::HasAbs + }; +}; + +/** \internal + * \brief Template functor to compute the squared absolute value of a scalar + * + * \sa class CwiseUnaryOp, Cwise::abs2 + */ +template struct scalar_abs2_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_abs2_op) + typedef typename NumTraits::Real result_type; + EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { return abs2(a); } + template + EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const + { return internal::pmul(a,a); } +}; +template +struct functor_traits > +{ enum { Cost = NumTraits::MulCost, PacketAccess = packet_traits::HasAbs2 }; }; + +/** \internal + * \brief Template functor to compute the conjugate of a complex value + * + * \sa class CwiseUnaryOp, MatrixBase::conjugate() + */ +template struct scalar_conjugate_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_conjugate_op) + EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { return conj(a); } + template + EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const { return internal::pconj(a); } +}; +template +struct functor_traits > +{ + enum { + Cost = NumTraits::IsComplex ? NumTraits::AddCost : 0, + PacketAccess = packet_traits::HasConj + }; +}; + +/** \internal + * \brief Template functor to cast a scalar to another type + * + * \sa class CwiseUnaryOp, MatrixBase::cast() + */ +template +struct scalar_cast_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_cast_op) + typedef NewType result_type; + EIGEN_STRONG_INLINE const NewType operator() (const Scalar& a) const { return cast(a); } +}; +template +struct functor_traits > +{ enum { Cost = is_same::value ? 0 : NumTraits::AddCost, PacketAccess = false }; }; + +/** \internal + * \brief Template functor to extract the real part of a complex + * + * \sa class CwiseUnaryOp, MatrixBase::real() + */ +template +struct scalar_real_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_real_op) + typedef typename NumTraits::Real result_type; + EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return real(a); } +}; +template +struct functor_traits > +{ enum { Cost = 0, PacketAccess = false }; }; + +/** \internal + * \brief Template functor to extract the imaginary part of a complex + * + * \sa class CwiseUnaryOp, MatrixBase::imag() + */ +template +struct scalar_imag_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_imag_op) + typedef typename NumTraits::Real result_type; + EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return imag(a); } +}; +template +struct functor_traits > +{ enum { Cost = 0, PacketAccess = false }; }; + +/** \internal + * \brief Template functor to extract the real part of a complex as a reference + * + * \sa class CwiseUnaryOp, MatrixBase::real() + */ +template +struct scalar_real_ref_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_real_ref_op) + typedef typename NumTraits::Real result_type; + EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return real_ref(*const_cast(&a)); } +}; +template +struct functor_traits > +{ enum { Cost = 0, PacketAccess = false }; }; + +/** \internal + * \brief Template functor to extract the imaginary part of a complex as a reference + * + * \sa class CwiseUnaryOp, MatrixBase::imag() + */ +template +struct scalar_imag_ref_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_imag_ref_op) + typedef typename NumTraits::Real result_type; + EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return imag_ref(*const_cast(&a)); } +}; +template +struct functor_traits > +{ enum { Cost = 0, PacketAccess = false }; }; + +/** \internal + * + * \brief Template functor to compute the exponential of a scalar + * + * \sa class CwiseUnaryOp, Cwise::exp() + */ +template struct scalar_exp_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_exp_op) + inline const Scalar operator() (const Scalar& a) const { return exp(a); } + typedef typename packet_traits::type Packet; + inline Packet packetOp(const Packet& a) const { return internal::pexp(a); } +}; +template +struct functor_traits > +{ enum { Cost = 5 * NumTraits::MulCost, PacketAccess = packet_traits::HasExp }; }; + +/** \internal + * + * \brief Template functor to compute the logarithm of a scalar + * + * \sa class CwiseUnaryOp, Cwise::log() + */ +template struct scalar_log_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_log_op) + inline const Scalar operator() (const Scalar& a) const { return log(a); } + typedef typename packet_traits::type Packet; + inline Packet packetOp(const Packet& a) const { return internal::plog(a); } +}; +template +struct functor_traits > +{ enum { Cost = 5 * NumTraits::MulCost, PacketAccess = packet_traits::HasLog }; }; + +/** \internal + * \brief Template functor to multiply a scalar by a fixed other one + * + * \sa class CwiseUnaryOp, MatrixBase::operator*, MatrixBase::operator/ + */ +/* NOTE why doing the pset1() in packetOp *is* an optimization ? + * indeed it seems better to declare m_other as a Packet and do the pset1() once + * in the constructor. However, in practice: + * - GCC does not like m_other as a Packet and generate a load every time it needs it + * - on the other hand GCC is able to moves the pset1() away the loop :) + * - simpler code ;) + * (ICC and gcc 4.4 seems to perform well in both cases, the issue is visible with y = a*x + b*y) + */ +template +struct scalar_multiple_op { + typedef typename packet_traits::type Packet; + // FIXME default copy constructors seems bugged with std::complex<> + EIGEN_STRONG_INLINE scalar_multiple_op(const scalar_multiple_op& other) : m_other(other.m_other) { } + EIGEN_STRONG_INLINE scalar_multiple_op(const Scalar& other) : m_other(other) { } + EIGEN_STRONG_INLINE Scalar operator() (const Scalar& a) const { return a * m_other; } + EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const + { return internal::pmul(a, pset1(m_other)); } + typename add_const_on_value_type::Nested>::type m_other; +}; +template +struct functor_traits > +{ enum { Cost = NumTraits::MulCost, PacketAccess = packet_traits::HasMul }; }; + +template +struct scalar_multiple2_op { + typedef typename scalar_product_traits::ReturnType result_type; + EIGEN_STRONG_INLINE scalar_multiple2_op(const scalar_multiple2_op& other) : m_other(other.m_other) { } + EIGEN_STRONG_INLINE scalar_multiple2_op(const Scalar2& other) : m_other(other) { } + EIGEN_STRONG_INLINE result_type operator() (const Scalar1& a) const { return a * m_other; } + typename add_const_on_value_type::Nested>::type m_other; +}; +template +struct functor_traits > +{ enum { Cost = NumTraits::MulCost, PacketAccess = false }; }; + +template +struct scalar_quotient1_impl { + typedef typename packet_traits::type Packet; + // FIXME default copy constructors seems bugged with std::complex<> + EIGEN_STRONG_INLINE scalar_quotient1_impl(const scalar_quotient1_impl& other) : m_other(other.m_other) { } + EIGEN_STRONG_INLINE scalar_quotient1_impl(const Scalar& other) : m_other(static_cast(1) / other) {} + EIGEN_STRONG_INLINE Scalar operator() (const Scalar& a) const { return a * m_other; } + EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const + { return internal::pmul(a, pset1(m_other)); } + const Scalar m_other; +}; +template +struct functor_traits > +{ enum { Cost = NumTraits::MulCost, PacketAccess = packet_traits::HasMul }; }; + +template +struct scalar_quotient1_impl { + // FIXME default copy constructors seems bugged with std::complex<> + EIGEN_STRONG_INLINE scalar_quotient1_impl(const scalar_quotient1_impl& other) : m_other(other.m_other) { } + EIGEN_STRONG_INLINE scalar_quotient1_impl(const Scalar& other) : m_other(other) {} + EIGEN_STRONG_INLINE Scalar operator() (const Scalar& a) const { return a / m_other; } + typename add_const_on_value_type::Nested>::type m_other; +}; +template +struct functor_traits > +{ enum { Cost = 2 * NumTraits::MulCost, PacketAccess = false }; }; + +/** \internal + * \brief Template functor to divide a scalar by a fixed other one + * + * This functor is used to implement the quotient of a matrix by + * a scalar where the scalar type is not necessarily a floating point type. + * + * \sa class CwiseUnaryOp, MatrixBase::operator/ + */ +template +struct scalar_quotient1_op : scalar_quotient1_impl::IsInteger > { + EIGEN_STRONG_INLINE scalar_quotient1_op(const Scalar& other) + : scalar_quotient1_impl::IsInteger >(other) {} +}; +template +struct functor_traits > +: functor_traits::IsInteger> > +{}; + +// nullary functors + +template +struct scalar_constant_op { + typedef typename packet_traits::type Packet; + EIGEN_STRONG_INLINE scalar_constant_op(const scalar_constant_op& other) : m_other(other.m_other) { } + EIGEN_STRONG_INLINE scalar_constant_op(const Scalar& other) : m_other(other) { } + template + EIGEN_STRONG_INLINE const Scalar operator() (Index, Index = 0) const { return m_other; } + template + EIGEN_STRONG_INLINE const Packet packetOp(Index, Index = 0) const { return internal::pset1(m_other); } + const Scalar m_other; +}; +template +struct functor_traits > +// FIXME replace this packet test by a safe one +{ enum { Cost = 1, PacketAccess = packet_traits::Vectorizable, IsRepeatable = true }; }; + +template struct scalar_identity_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_identity_op) + template + EIGEN_STRONG_INLINE const Scalar operator() (Index row, Index col) const { return row==col ? Scalar(1) : Scalar(0); } +}; +template +struct functor_traits > +{ enum { Cost = NumTraits::AddCost, PacketAccess = false, IsRepeatable = true }; }; + +template struct linspaced_op_impl; + +// linear access for packet ops: +// 1) initialization +// base = [low, ..., low] + ([step, ..., step] * [-size, ..., 0]) +// 2) each step +// base += [size*step, ..., size*step] +template +struct linspaced_op_impl +{ + typedef typename packet_traits::type Packet; + + linspaced_op_impl(Scalar low, Scalar step) : + m_low(low), m_step(step), + m_packetStep(pset1(packet_traits::size*step)), + m_base(padd(pset1(low),pmul(pset1(step),plset(-packet_traits::size)))) {} + + template + EIGEN_STRONG_INLINE const Scalar operator() (Index i) const { return m_low+i*m_step; } + template + EIGEN_STRONG_INLINE const Packet packetOp(Index) const { return m_base = padd(m_base,m_packetStep); } + + const Scalar m_low; + const Scalar m_step; + const Packet m_packetStep; + mutable Packet m_base; +}; + +// random access for packet ops: +// 1) each step +// [low, ..., low] + ( [step, ..., step] * ( [i, ..., i] + [0, ..., size] ) ) +template +struct linspaced_op_impl +{ + typedef typename packet_traits::type Packet; + + linspaced_op_impl(Scalar low, Scalar step) : + m_low(low), m_step(step), + m_lowPacket(pset1(m_low)), m_stepPacket(pset1(m_step)), m_interPacket(plset(0)) {} + + template + EIGEN_STRONG_INLINE const Scalar operator() (Index i) const { return m_low+i*m_step; } + + template + EIGEN_STRONG_INLINE const Packet packetOp(Index i) const + { return internal::padd(m_lowPacket, pmul(m_stepPacket, padd(pset1(i),m_interPacket))); } + + const Scalar m_low; + const Scalar m_step; + const Packet m_lowPacket; + const Packet m_stepPacket; + const Packet m_interPacket; +}; + +// ----- Linspace functor ---------------------------------------------------------------- + +// Forward declaration (we default to random access which does not really give +// us a speed gain when using packet access but it allows to use the functor in +// nested expressions). +template struct linspaced_op; +template struct functor_traits< linspaced_op > +{ enum { Cost = 1, PacketAccess = packet_traits::HasSetLinear, IsRepeatable = true }; }; +template struct linspaced_op +{ + typedef typename packet_traits::type Packet; + linspaced_op(Scalar low, Scalar high, int num_steps) : impl(low, (high-low)/(num_steps-1)) {} + + template + EIGEN_STRONG_INLINE const Scalar operator() (Index i) const { return impl(i); } + + // We need this function when assigning e.g. a RowVectorXd to a MatrixXd since + // there row==0 and col is used for the actual iteration. + template + EIGEN_STRONG_INLINE const Scalar operator() (Index row, Index col) const + { + eigen_assert(col==0 || row==0); + return impl(col + row); + } + + template + EIGEN_STRONG_INLINE const Packet packetOp(Index i) const { return impl.packetOp(i); } + + // We need this function when assigning e.g. a RowVectorXd to a MatrixXd since + // there row==0 and col is used for the actual iteration. + template + EIGEN_STRONG_INLINE const Packet packetOp(Index row, Index col) const + { + eigen_assert(col==0 || row==0); + return impl.packetOp(col + row); + } + + // This proxy object handles the actual required temporaries, the different + // implementations (random vs. sequential access) as well as the + // correct piping to size 2/4 packet operations. + const linspaced_op_impl impl; +}; + +// all functors allow linear access, except scalar_identity_op. So we fix here a quick meta +// to indicate whether a functor allows linear access, just always answering 'yes' except for +// scalar_identity_op. +// FIXME move this to functor_traits adding a functor_default +template struct functor_has_linear_access { enum { ret = 1 }; }; +template struct functor_has_linear_access > { enum { ret = 0 }; }; + +// in CwiseBinaryOp, we require the Lhs and Rhs to have the same scalar type, except for multiplication +// where we only require them to have the same _real_ scalar type so one may multiply, say, float by complex. +// FIXME move this to functor_traits adding a functor_default +template struct functor_allows_mixing_real_and_complex { enum { ret = 0 }; }; +template struct functor_allows_mixing_real_and_complex > { enum { ret = 1 }; }; +template struct functor_allows_mixing_real_and_complex > { enum { ret = 1 }; }; + + +/** \internal + * \brief Template functor to add a scalar to a fixed other one + * \sa class CwiseUnaryOp, Array::operator+ + */ +/* If you wonder why doing the pset1() in packetOp() is an optimization check scalar_multiple_op */ +template +struct scalar_add_op { + typedef typename packet_traits::type Packet; + // FIXME default copy constructors seems bugged with std::complex<> + inline scalar_add_op(const scalar_add_op& other) : m_other(other.m_other) { } + inline scalar_add_op(const Scalar& other) : m_other(other) { } + inline Scalar operator() (const Scalar& a) const { return a + m_other; } + inline const Packet packetOp(const Packet& a) const + { return internal::padd(a, pset1(m_other)); } + const Scalar m_other; +}; +template +struct functor_traits > +{ enum { Cost = NumTraits::AddCost, PacketAccess = packet_traits::HasAdd }; }; + +/** \internal + * \brief Template functor to compute the square root of a scalar + * \sa class CwiseUnaryOp, Cwise::sqrt() + */ +template struct scalar_sqrt_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_sqrt_op) + inline const Scalar operator() (const Scalar& a) const { return sqrt(a); } + typedef typename packet_traits::type Packet; + inline Packet packetOp(const Packet& a) const { return internal::psqrt(a); } +}; +template +struct functor_traits > +{ enum { + Cost = 5 * NumTraits::MulCost, + PacketAccess = packet_traits::HasSqrt + }; +}; + +/** \internal + * \brief Template functor to compute the cosine of a scalar + * \sa class CwiseUnaryOp, ArrayBase::cos() + */ +template struct scalar_cos_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_cos_op) + inline Scalar operator() (const Scalar& a) const { return cos(a); } + typedef typename packet_traits::type Packet; + inline Packet packetOp(const Packet& a) const { return internal::pcos(a); } +}; +template +struct functor_traits > +{ + enum { + Cost = 5 * NumTraits::MulCost, + PacketAccess = packet_traits::HasCos + }; +}; + +/** \internal + * \brief Template functor to compute the sine of a scalar + * \sa class CwiseUnaryOp, ArrayBase::sin() + */ +template struct scalar_sin_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_sin_op) + inline const Scalar operator() (const Scalar& a) const { return sin(a); } + typedef typename packet_traits::type Packet; + inline Packet packetOp(const Packet& a) const { return internal::psin(a); } +}; +template +struct functor_traits > +{ + enum { + Cost = 5 * NumTraits::MulCost, + PacketAccess = packet_traits::HasSin + }; +}; + + +/** \internal + * \brief Template functor to compute the tan of a scalar + * \sa class CwiseUnaryOp, ArrayBase::tan() + */ +template struct scalar_tan_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_tan_op) + inline const Scalar operator() (const Scalar& a) const { return tan(a); } + typedef typename packet_traits::type Packet; + inline Packet packetOp(const Packet& a) const { return internal::ptan(a); } +}; +template +struct functor_traits > +{ + enum { + Cost = 5 * NumTraits::MulCost, + PacketAccess = packet_traits::HasTan + }; +}; + +/** \internal + * \brief Template functor to compute the arc cosine of a scalar + * \sa class CwiseUnaryOp, ArrayBase::acos() + */ +template struct scalar_acos_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_acos_op) + inline const Scalar operator() (const Scalar& a) const { return acos(a); } + typedef typename packet_traits::type Packet; + inline Packet packetOp(const Packet& a) const { return internal::pacos(a); } +}; +template +struct functor_traits > +{ + enum { + Cost = 5 * NumTraits::MulCost, + PacketAccess = packet_traits::HasACos + }; +}; + +/** \internal + * \brief Template functor to compute the arc sine of a scalar + * \sa class CwiseUnaryOp, ArrayBase::asin() + */ +template struct scalar_asin_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_asin_op) + inline const Scalar operator() (const Scalar& a) const { return asin(a); } + typedef typename packet_traits::type Packet; + inline Packet packetOp(const Packet& a) const { return internal::pasin(a); } +}; +template +struct functor_traits > +{ + enum { + Cost = 5 * NumTraits::MulCost, + PacketAccess = packet_traits::HasASin + }; +}; + +/** \internal + * \brief Template functor to raise a scalar to a power + * \sa class CwiseUnaryOp, Cwise::pow + */ +template +struct scalar_pow_op { + // FIXME default copy constructors seems bugged with std::complex<> + inline scalar_pow_op(const scalar_pow_op& other) : m_exponent(other.m_exponent) { } + inline scalar_pow_op(const Scalar& exponent) : m_exponent(exponent) {} + inline Scalar operator() (const Scalar& a) const { return internal::pow(a, m_exponent); } + const Scalar m_exponent; +}; +template +struct functor_traits > +{ enum { Cost = 5 * NumTraits::MulCost, PacketAccess = false }; }; + +/** \internal + * \brief Template functor to compute the inverse of a scalar + * \sa class CwiseUnaryOp, Cwise::inverse() + */ +template +struct scalar_inverse_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_inverse_op) + inline Scalar operator() (const Scalar& a) const { return Scalar(1)/a; } + template + inline const Packet packetOp(const Packet& a) const + { return internal::pdiv(pset1(Scalar(1)),a); } +}; +template +struct functor_traits > +{ enum { Cost = NumTraits::MulCost, PacketAccess = packet_traits::HasDiv }; }; + +/** \internal + * \brief Template functor to compute the square of a scalar + * \sa class CwiseUnaryOp, Cwise::square() + */ +template +struct scalar_square_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_square_op) + inline Scalar operator() (const Scalar& a) const { return a*a; } + template + inline const Packet packetOp(const Packet& a) const + { return internal::pmul(a,a); } +}; +template +struct functor_traits > +{ enum { Cost = NumTraits::MulCost, PacketAccess = packet_traits::HasMul }; }; + +/** \internal + * \brief Template functor to compute the cube of a scalar + * \sa class CwiseUnaryOp, Cwise::cube() + */ +template +struct scalar_cube_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_cube_op) + inline Scalar operator() (const Scalar& a) const { return a*a*a; } + template + inline const Packet packetOp(const Packet& a) const + { return internal::pmul(a,pmul(a,a)); } +}; +template +struct functor_traits > +{ enum { Cost = 2*NumTraits::MulCost, PacketAccess = packet_traits::HasMul }; }; + +// default functor traits for STL functors: + +template +struct functor_traits > +{ enum { Cost = NumTraits::MulCost, PacketAccess = false }; }; + +template +struct functor_traits > +{ enum { Cost = NumTraits::MulCost, PacketAccess = false }; }; + +template +struct functor_traits > +{ enum { Cost = NumTraits::AddCost, PacketAccess = false }; }; + +template +struct functor_traits > +{ enum { Cost = NumTraits::AddCost, PacketAccess = false }; }; + +template +struct functor_traits > +{ enum { Cost = NumTraits::AddCost, PacketAccess = false }; }; + +template +struct functor_traits > +{ enum { Cost = 1, PacketAccess = false }; }; + +template +struct functor_traits > +{ enum { Cost = 1, PacketAccess = false }; }; + +template +struct functor_traits > +{ enum { Cost = 1, PacketAccess = false }; }; + +template +struct functor_traits > +{ enum { Cost = 1, PacketAccess = false }; }; + +template +struct functor_traits > +{ enum { Cost = 1, PacketAccess = false }; }; + +template +struct functor_traits > +{ enum { Cost = 1, PacketAccess = false }; }; + +template +struct functor_traits > +{ enum { Cost = 1, PacketAccess = false }; }; + +template +struct functor_traits > +{ enum { Cost = 1, PacketAccess = false }; }; + +template +struct functor_traits > +{ enum { Cost = 1, PacketAccess = false }; }; + +template +struct functor_traits > +{ enum { Cost = functor_traits::Cost, PacketAccess = false }; }; + +template +struct functor_traits > +{ enum { Cost = functor_traits::Cost, PacketAccess = false }; }; + +template +struct functor_traits > +{ enum { Cost = 1 + functor_traits::Cost, PacketAccess = false }; }; + +template +struct functor_traits > +{ enum { Cost = 1 + functor_traits::Cost, PacketAccess = false }; }; + +#ifdef EIGEN_STDEXT_SUPPORT + +template +struct functor_traits > +{ enum { Cost = 0, PacketAccess = false }; }; + +template +struct functor_traits > +{ enum { Cost = 0, PacketAccess = false }; }; + +template +struct functor_traits > > +{ enum { Cost = 0, PacketAccess = false }; }; + +template +struct functor_traits > > +{ enum { Cost = 0, PacketAccess = false }; }; + +template +struct functor_traits > +{ enum { Cost = functor_traits::Cost + functor_traits::Cost, PacketAccess = false }; }; + +template +struct functor_traits > +{ enum { Cost = functor_traits::Cost + functor_traits::Cost + functor_traits::Cost, PacketAccess = false }; }; + +#endif // EIGEN_STDEXT_SUPPORT + +// allow to add new functors and specializations of functor_traits from outside Eigen. +// this macro is really needed because functor_traits must be specialized after it is declared but before it is used... +#ifdef EIGEN_FUNCTORS_PLUGIN +#include EIGEN_FUNCTORS_PLUGIN +#endif + +} // end namespace internal + +#endif // EIGEN_FUNCTORS_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/Fuzzy.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/Fuzzy.h new file mode 100644 index 000000000..6eaa26be8 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/Fuzzy.h @@ -0,0 +1,161 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2008 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_FUZZY_H +#define EIGEN_FUZZY_H + +namespace internal +{ + +template::IsInteger> +struct isApprox_selector +{ + static bool run(const Derived& x, const OtherDerived& y, typename Derived::RealScalar prec) + { + using std::min; + const typename internal::nested::type nested(x); + const typename internal::nested::type otherNested(y); + return (nested - otherNested).cwiseAbs2().sum() <= prec * prec * min(nested.cwiseAbs2().sum(), otherNested.cwiseAbs2().sum()); + } +}; + +template +struct isApprox_selector +{ + static bool run(const Derived& x, const OtherDerived& y, typename Derived::RealScalar) + { + return x.matrix() == y.matrix(); + } +}; + +template::IsInteger> +struct isMuchSmallerThan_object_selector +{ + static bool run(const Derived& x, const OtherDerived& y, typename Derived::RealScalar prec) + { + return x.cwiseAbs2().sum() <= abs2(prec) * y.cwiseAbs2().sum(); + } +}; + +template +struct isMuchSmallerThan_object_selector +{ + static bool run(const Derived& x, const OtherDerived&, typename Derived::RealScalar) + { + return x.matrix() == Derived::Zero(x.rows(), x.cols()).matrix(); + } +}; + +template::IsInteger> +struct isMuchSmallerThan_scalar_selector +{ + static bool run(const Derived& x, const typename Derived::RealScalar& y, typename Derived::RealScalar prec) + { + return x.cwiseAbs2().sum() <= abs2(prec * y); + } +}; + +template +struct isMuchSmallerThan_scalar_selector +{ + static bool run(const Derived& x, const typename Derived::RealScalar&, typename Derived::RealScalar) + { + return x.matrix() == Derived::Zero(x.rows(), x.cols()).matrix(); + } +}; + +} // end namespace internal + + +/** \returns \c true if \c *this is approximately equal to \a other, within the precision + * determined by \a prec. + * + * \note The fuzzy compares are done multiplicatively. Two vectors \f$ v \f$ and \f$ w \f$ + * are considered to be approximately equal within precision \f$ p \f$ if + * \f[ \Vert v - w \Vert \leqslant p\,\min(\Vert v\Vert, \Vert w\Vert). \f] + * For matrices, the comparison is done using the Hilbert-Schmidt norm (aka Frobenius norm + * L2 norm). + * + * \note Because of the multiplicativeness of this comparison, one can't use this function + * to check whether \c *this is approximately equal to the zero matrix or vector. + * Indeed, \c isApprox(zero) returns false unless \c *this itself is exactly the zero matrix + * or vector. If you want to test whether \c *this is zero, use internal::isMuchSmallerThan(const + * RealScalar&, RealScalar) instead. + * + * \sa internal::isMuchSmallerThan(const RealScalar&, RealScalar) const + */ +template +template +bool DenseBase::isApprox( + const DenseBase& other, + RealScalar prec +) const +{ + return internal::isApprox_selector::run(derived(), other.derived(), prec); +} + +/** \returns \c true if the norm of \c *this is much smaller than \a other, + * within the precision determined by \a prec. + * + * \note The fuzzy compares are done multiplicatively. A vector \f$ v \f$ is + * considered to be much smaller than \f$ x \f$ within precision \f$ p \f$ if + * \f[ \Vert v \Vert \leqslant p\,\vert x\vert. \f] + * + * For matrices, the comparison is done using the Hilbert-Schmidt norm. For this reason, + * the value of the reference scalar \a other should come from the Hilbert-Schmidt norm + * of a reference matrix of same dimensions. + * + * \sa isApprox(), isMuchSmallerThan(const DenseBase&, RealScalar) const + */ +template +bool DenseBase::isMuchSmallerThan( + const typename NumTraits::Real& other, + RealScalar prec +) const +{ + return internal::isMuchSmallerThan_scalar_selector::run(derived(), other, prec); +} + +/** \returns \c true if the norm of \c *this is much smaller than the norm of \a other, + * within the precision determined by \a prec. + * + * \note The fuzzy compares are done multiplicatively. A vector \f$ v \f$ is + * considered to be much smaller than a vector \f$ w \f$ within precision \f$ p \f$ if + * \f[ \Vert v \Vert \leqslant p\,\Vert w\Vert. \f] + * For matrices, the comparison is done using the Hilbert-Schmidt norm. + * + * \sa isApprox(), isMuchSmallerThan(const RealScalar&, RealScalar) const + */ +template +template +bool DenseBase::isMuchSmallerThan( + const DenseBase& other, + RealScalar prec +) const +{ + return internal::isMuchSmallerThan_object_selector::run(derived(), other.derived(), prec); +} + +#endif // EIGEN_FUZZY_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/GenericPacketMath.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/GenericPacketMath.h new file mode 100644 index 000000000..1366a63c1 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/GenericPacketMath.h @@ -0,0 +1,339 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_GENERIC_PACKET_MATH_H +#define EIGEN_GENERIC_PACKET_MATH_H + +namespace internal { + +/** \internal + * \file GenericPacketMath.h + * + * Default implementation for types not supported by the vectorization. + * In practice these functions are provided to make easier the writing + * of generic vectorized code. + */ + +#ifndef EIGEN_DEBUG_ALIGNED_LOAD +#define EIGEN_DEBUG_ALIGNED_LOAD +#endif + +#ifndef EIGEN_DEBUG_UNALIGNED_LOAD +#define EIGEN_DEBUG_UNALIGNED_LOAD +#endif + +#ifndef EIGEN_DEBUG_ALIGNED_STORE +#define EIGEN_DEBUG_ALIGNED_STORE +#endif + +#ifndef EIGEN_DEBUG_UNALIGNED_STORE +#define EIGEN_DEBUG_UNALIGNED_STORE +#endif + +struct default_packet_traits +{ + enum { + HasAdd = 1, + HasSub = 1, + HasMul = 1, + HasNegate = 1, + HasAbs = 1, + HasAbs2 = 1, + HasMin = 1, + HasMax = 1, + HasConj = 1, + HasSetLinear = 1, + + HasDiv = 0, + HasSqrt = 0, + HasExp = 0, + HasLog = 0, + HasPow = 0, + + HasSin = 0, + HasCos = 0, + HasTan = 0, + HasASin = 0, + HasACos = 0, + HasATan = 0 + }; +}; + +template struct packet_traits : default_packet_traits +{ + typedef T type; + enum { + Vectorizable = 0, + size = 1, + AlignedOnScalar = 0 + }; + enum { + HasAdd = 0, + HasSub = 0, + HasMul = 0, + HasNegate = 0, + HasAbs = 0, + HasAbs2 = 0, + HasMin = 0, + HasMax = 0, + HasConj = 0, + HasSetLinear = 0 + }; +}; + +/** \internal \returns a + b (coeff-wise) */ +template inline Packet +padd(const Packet& a, + const Packet& b) { return a+b; } + +/** \internal \returns a - b (coeff-wise) */ +template inline Packet +psub(const Packet& a, + const Packet& b) { return a-b; } + +/** \internal \returns -a (coeff-wise) */ +template inline Packet +pnegate(const Packet& a) { return -a; } + +/** \internal \returns conj(a) (coeff-wise) */ +template inline Packet +pconj(const Packet& a) { return conj(a); } + +/** \internal \returns a * b (coeff-wise) */ +template inline Packet +pmul(const Packet& a, + const Packet& b) { return a*b; } + +/** \internal \returns a / b (coeff-wise) */ +template inline Packet +pdiv(const Packet& a, + const Packet& b) { return a/b; } + +/** \internal \returns the min of \a a and \a b (coeff-wise) */ +template inline Packet +pmin(const Packet& a, + const Packet& b) { using std::min; return min(a, b); } + +/** \internal \returns the max of \a a and \a b (coeff-wise) */ +template inline Packet +pmax(const Packet& a, + const Packet& b) { using std::max; return max(a, b); } + +/** \internal \returns the absolute value of \a a */ +template inline Packet +pabs(const Packet& a) { return abs(a); } + +/** \internal \returns the bitwise and of \a a and \a b */ +template inline Packet +pand(const Packet& a, const Packet& b) { return a & b; } + +/** \internal \returns the bitwise or of \a a and \a b */ +template inline Packet +por(const Packet& a, const Packet& b) { return a | b; } + +/** \internal \returns the bitwise xor of \a a and \a b */ +template inline Packet +pxor(const Packet& a, const Packet& b) { return a ^ b; } + +/** \internal \returns the bitwise andnot of \a a and \a b */ +template inline Packet +pandnot(const Packet& a, const Packet& b) { return a & (!b); } + +/** \internal \returns a packet version of \a *from, from must be 16 bytes aligned */ +template inline Packet +pload(const typename unpacket_traits::type* from) { return *from; } + +/** \internal \returns a packet version of \a *from, (un-aligned load) */ +template inline Packet +ploadu(const typename unpacket_traits::type* from) { return *from; } + +/** \internal \returns a packet with elements of \a *from duplicated, e.g.: (from[0],from[0],from[1],from[1]) */ +template inline Packet +ploaddup(const typename unpacket_traits::type* from) { return *from; } + +/** \internal \returns a packet with constant coefficients \a a, e.g.: (a,a,a,a) */ +template inline Packet +pset1(const typename unpacket_traits::type& a) { return a; } + +/** \internal \brief Returns a packet with coefficients (a,a+1,...,a+packet_size-1). */ +template inline typename packet_traits::type +plset(const Scalar& a) { return a; } + +/** \internal copy the packet \a from to \a *to, \a to must be 16 bytes aligned */ +template inline void pstore(Scalar* to, const Packet& from) +{ (*to) = from; } + +/** \internal copy the packet \a from to \a *to, (un-aligned store) */ +template inline void pstoreu(Scalar* to, const Packet& from) +{ (*to) = from; } + +/** \internal tries to do cache prefetching of \a addr */ +template inline void prefetch(const Scalar* addr) +{ +#if !defined(_MSC_VER) +__builtin_prefetch(addr); +#endif +} + +/** \internal \returns the first element of a packet */ +template inline typename unpacket_traits::type pfirst(const Packet& a) +{ return a; } + +/** \internal \returns a packet where the element i contains the sum of the packet of \a vec[i] */ +template inline Packet +preduxp(const Packet* vecs) { return vecs[0]; } + +/** \internal \returns the sum of the elements of \a a*/ +template inline typename unpacket_traits::type predux(const Packet& a) +{ return a; } + +/** \internal \returns the product of the elements of \a a*/ +template inline typename unpacket_traits::type predux_mul(const Packet& a) +{ return a; } + +/** \internal \returns the min of the elements of \a a*/ +template inline typename unpacket_traits::type predux_min(const Packet& a) +{ return a; } + +/** \internal \returns the max of the elements of \a a*/ +template inline typename unpacket_traits::type predux_max(const Packet& a) +{ return a; } + +/** \internal \returns the reversed elements of \a a*/ +template inline Packet preverse(const Packet& a) +{ return a; } + + +/** \internal \returns \a a with real and imaginary part flipped (for complex type only) */ +template inline Packet pcplxflip(const Packet& a) +{ return Packet(imag(a),real(a)); } + +/************************** +* Special math functions +***************************/ + +/** \internal \returns the sine of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet psin(const Packet& a) { return sin(a); } + +/** \internal \returns the cosine of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pcos(const Packet& a) { return cos(a); } + +/** \internal \returns the tan of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet ptan(const Packet& a) { return tan(a); } + +/** \internal \returns the arc sine of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pasin(const Packet& a) { return asin(a); } + +/** \internal \returns the arc cosine of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pacos(const Packet& a) { return acos(a); } + +/** \internal \returns the exp of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pexp(const Packet& a) { return exp(a); } + +/** \internal \returns the log of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet plog(const Packet& a) { return log(a); } + +/** \internal \returns the square-root of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet psqrt(const Packet& a) { return sqrt(a); } + +/*************************************************************************** +* The following functions might not have to be overwritten for vectorized types +***************************************************************************/ + +/** \internal copy a packet with constant coeficient \a a (e.g., [a,a,a,a]) to \a *to. \a to must be 16 bytes aligned */ +// NOTE: this function must really be templated on the packet type (think about different packet types for the same scalar type) +template +inline void pstore1(typename unpacket_traits::type* to, const typename unpacket_traits::type& a) +{ + pstore(to, pset1(a)); +} + +/** \internal \returns a * b + c (coeff-wise) */ +template inline Packet +pmadd(const Packet& a, + const Packet& b, + const Packet& c) +{ return padd(pmul(a, b),c); } + +/** \internal \returns a packet version of \a *from. + * If LoadMode equals #Aligned, \a from must be 16 bytes aligned */ +template +inline Packet ploadt(const typename unpacket_traits::type* from) +{ + if(LoadMode == Aligned) + return pload(from); + else + return ploadu(from); +} + +/** \internal copy the packet \a from to \a *to. + * If StoreMode equals #Aligned, \a to must be 16 bytes aligned */ +template +inline void pstoret(Scalar* to, const Packet& from) +{ + if(LoadMode == Aligned) + pstore(to, from); + else + pstoreu(to, from); +} + +/** \internal default implementation of palign() allowing partial specialization */ +template +struct palign_impl +{ + // by default data are aligned, so there is nothing to be done :) + inline static void run(PacketType&, const PacketType&) {} +}; + +/** \internal update \a first using the concatenation of the \a Offset last elements + * of \a first and packet_size minus \a Offset first elements of \a second */ +template +inline void palign(PacketType& first, const PacketType& second) +{ + palign_impl::run(first,second); +} + +/*************************************************************************** +* Fast complex products (GCC generates a function call which is very slow) +***************************************************************************/ + +template<> inline std::complex pmul(const std::complex& a, const std::complex& b) +{ return std::complex(real(a)*real(b) - imag(a)*imag(b), imag(a)*real(b) + real(a)*imag(b)); } + +template<> inline std::complex pmul(const std::complex& a, const std::complex& b) +{ return std::complex(real(a)*real(b) - imag(a)*imag(b), imag(a)*real(b) + real(a)*imag(b)); } + +} // end namespace internal + +#endif // EIGEN_GENERIC_PACKET_MATH_H + diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/GlobalFunctions.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/GlobalFunctions.h new file mode 100644 index 000000000..144145a95 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/GlobalFunctions.h @@ -0,0 +1,95 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2010 Gael Guennebaud +// Copyright (C) 2010 Benoit Jacob +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_GLOBAL_FUNCTIONS_H +#define EIGEN_GLOBAL_FUNCTIONS_H + +#define EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(NAME,FUNCTOR) \ + template \ + inline const Eigen::CwiseUnaryOp, const Derived> \ + NAME(const Eigen::ArrayBase& x) { \ + return x.derived(); \ + } + +#define EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(NAME,FUNCTOR) \ + \ + template \ + struct NAME##_retval > \ + { \ + typedef const Eigen::CwiseUnaryOp, const Derived> type; \ + }; \ + template \ + struct NAME##_impl > \ + { \ + static inline typename NAME##_retval >::type run(const Eigen::ArrayBase& x) \ + { \ + return x.derived(); \ + } \ + }; + + +namespace std +{ + EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(real,scalar_real_op) + EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(imag,scalar_imag_op) + EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(sin,scalar_sin_op) + EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(cos,scalar_cos_op) + EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(asin,scalar_asin_op) + EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(acos,scalar_acos_op) + EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(tan,scalar_tan_op) + EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(exp,scalar_exp_op) + EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(log,scalar_log_op) + EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(abs,scalar_abs_op) + EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(sqrt,scalar_sqrt_op) + + template + inline const Eigen::CwiseUnaryOp, const Derived> + pow(const Eigen::ArrayBase& x, const typename Derived::Scalar& exponent) { \ + return x.derived().pow(exponent); \ + } +} + +namespace Eigen +{ + namespace internal + { + EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(real,scalar_real_op) + EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(imag,scalar_imag_op) + EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(sin,scalar_sin_op) + EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(cos,scalar_cos_op) + EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(asin,scalar_asin_op) + EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(acos,scalar_acos_op) + EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(tan,scalar_tan_op) + EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(exp,scalar_exp_op) + EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(log,scalar_log_op) + EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(abs,scalar_abs_op) + EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(abs2,scalar_abs2_op) + EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(sqrt,scalar_sqrt_op) + } +} + +// TODO: cleanly disable those functions that are not supported on Array (internal::real_ref, internal::random, internal::isApprox...) + +#endif // EIGEN_GLOBAL_FUNCTIONS_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/IO.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/IO.h new file mode 100644 index 000000000..f3cfcdbf4 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/IO.h @@ -0,0 +1,260 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2008 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_IO_H +#define EIGEN_IO_H + +enum { DontAlignCols = 1 }; +enum { StreamPrecision = -1, + FullPrecision = -2 }; + +namespace internal { +template +std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat& fmt); +} + +/** \class IOFormat + * \ingroup Core_Module + * + * \brief Stores a set of parameters controlling the way matrices are printed + * + * List of available parameters: + * - \b precision number of digits for floating point values, or one of the special constants \c StreamPrecision and \c FullPrecision. + * The default is the special value \c StreamPrecision which means to use the + * stream's own precision setting, as set for instance using \c cout.precision(3). The other special value + * \c FullPrecision means that the number of digits will be computed to match the full precision of each floating-point + * type. + * - \b flags an OR-ed combination of flags, the default value is 0, the only currently available flag is \c DontAlignCols which + * allows to disable the alignment of columns, resulting in faster code. + * - \b coeffSeparator string printed between two coefficients of the same row + * - \b rowSeparator string printed between two rows + * - \b rowPrefix string printed at the beginning of each row + * - \b rowSuffix string printed at the end of each row + * - \b matPrefix string printed at the beginning of the matrix + * - \b matSuffix string printed at the end of the matrix + * + * Example: \include IOFormat.cpp + * Output: \verbinclude IOFormat.out + * + * \sa DenseBase::format(), class WithFormat + */ +struct IOFormat +{ + /** Default contructor, see class IOFormat for the meaning of the parameters */ + IOFormat(int _precision = StreamPrecision, int _flags = 0, + const std::string& _coeffSeparator = " ", + const std::string& _rowSeparator = "\n", const std::string& _rowPrefix="", const std::string& _rowSuffix="", + const std::string& _matPrefix="", const std::string& _matSuffix="") + : matPrefix(_matPrefix), matSuffix(_matSuffix), rowPrefix(_rowPrefix), rowSuffix(_rowSuffix), rowSeparator(_rowSeparator), + coeffSeparator(_coeffSeparator), precision(_precision), flags(_flags) + { + rowSpacer = ""; + int i = int(matSuffix.length())-1; + while (i>=0 && matSuffix[i]!='\n') + { + rowSpacer += ' '; + i--; + } + } + std::string matPrefix, matSuffix; + std::string rowPrefix, rowSuffix, rowSeparator, rowSpacer; + std::string coeffSeparator; + int precision; + int flags; +}; + +/** \class WithFormat + * \ingroup Core_Module + * + * \brief Pseudo expression providing matrix output with given format + * + * \param ExpressionType the type of the object on which IO stream operations are performed + * + * This class represents an expression with stream operators controlled by a given IOFormat. + * It is the return type of DenseBase::format() + * and most of the time this is the only way it is used. + * + * See class IOFormat for some examples. + * + * \sa DenseBase::format(), class IOFormat + */ +template +class WithFormat +{ + public: + + WithFormat(const ExpressionType& matrix, const IOFormat& format) + : m_matrix(matrix), m_format(format) + {} + + friend std::ostream & operator << (std::ostream & s, const WithFormat& wf) + { + return internal::print_matrix(s, wf.m_matrix.eval(), wf.m_format); + } + + protected: + const typename ExpressionType::Nested m_matrix; + IOFormat m_format; +}; + +/** \returns a WithFormat proxy object allowing to print a matrix the with given + * format \a fmt. + * + * See class IOFormat for some examples. + * + * \sa class IOFormat, class WithFormat + */ +template +inline const WithFormat +DenseBase::format(const IOFormat& fmt) const +{ + return WithFormat(derived(), fmt); +} + +namespace internal { + +template +struct significant_decimals_default_impl +{ + typedef typename NumTraits::Real RealScalar; + static inline int run() + { + using std::ceil; + return cast(ceil(-log(NumTraits::epsilon())/log(RealScalar(10)))); + } +}; + +template +struct significant_decimals_default_impl +{ + static inline int run() + { + return 0; + } +}; + +template +struct significant_decimals_impl + : significant_decimals_default_impl::IsInteger> +{}; + +/** \internal + * print the matrix \a _m to the output stream \a s using the output format \a fmt */ +template +std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat& fmt) +{ + if(_m.size() == 0) + { + s << fmt.matPrefix << fmt.matSuffix; + return s; + } + + const typename Derived::Nested m = _m; + typedef typename Derived::Scalar Scalar; + typedef typename Derived::Index Index; + + Index width = 0; + + std::streamsize explicit_precision; + if(fmt.precision == StreamPrecision) + { + explicit_precision = 0; + } + else if(fmt.precision == FullPrecision) + { + if (NumTraits::IsInteger) + { + explicit_precision = 0; + } + else + { + explicit_precision = significant_decimals_impl::run(); + } + } + else + { + explicit_precision = fmt.precision; + } + + bool align_cols = !(fmt.flags & DontAlignCols); + if(align_cols) + { + // compute the largest width + for(Index j = 1; j < m.cols(); ++j) + for(Index i = 0; i < m.rows(); ++i) + { + std::stringstream sstr; + if(explicit_precision) sstr.precision(explicit_precision); + sstr << m.coeff(i,j); + width = std::max(width, Index(sstr.str().length())); + } + } + std::streamsize old_precision = 0; + if(explicit_precision) old_precision = s.precision(explicit_precision); + s << fmt.matPrefix; + for(Index i = 0; i < m.rows(); ++i) + { + if (i) + s << fmt.rowSpacer; + s << fmt.rowPrefix; + if(width) s.width(width); + s << m.coeff(i, 0); + for(Index j = 1; j < m.cols(); ++j) + { + s << fmt.coeffSeparator; + if (width) s.width(width); + s << m.coeff(i, j); + } + s << fmt.rowSuffix; + if( i < m.rows() - 1) + s << fmt.rowSeparator; + } + s << fmt.matSuffix; + if(explicit_precision) s.precision(old_precision); + return s; +} + +} // end namespace internal + +/** \relates DenseBase + * + * Outputs the matrix, to the given stream. + * + * If you wish to print the matrix with a format different than the default, use DenseBase::format(). + * + * It is also possible to change the default format by defining EIGEN_DEFAULT_IO_FORMAT before including Eigen headers. + * If not defined, this will automatically be defined to Eigen::IOFormat(), that is the Eigen::IOFormat with default parameters. + * + * \sa DenseBase::format() + */ +template +std::ostream & operator << +(std::ostream & s, + const DenseBase & m) +{ + return internal::print_matrix(s, m.eval(), EIGEN_DEFAULT_IO_FORMAT); +} + +#endif // EIGEN_IO_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/Map.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/Map.h new file mode 100644 index 000000000..81e3979f3 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/Map.h @@ -0,0 +1,205 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2007-2010 Benoit Jacob +// Copyright (C) 2008 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_MAP_H +#define EIGEN_MAP_H + +/** \class Map + * \ingroup Core_Module + * + * \brief A matrix or vector expression mapping an existing array of data. + * + * \tparam PlainObjectType the equivalent matrix type of the mapped data + * \tparam MapOptions specifies whether the pointer is \c #Aligned, or \c #Unaligned. + * The default is \c #Unaligned. + * \tparam StrideType optionnally specifies strides. By default, Map assumes the memory layout + * of an ordinary, contiguous array. This can be overridden by specifying strides. + * The type passed here must be a specialization of the Stride template, see examples below. + * + * This class represents a matrix or vector expression mapping an existing array of data. + * It can be used to let Eigen interface without any overhead with non-Eigen data structures, + * such as plain C arrays or structures from other libraries. By default, it assumes that the + * data is laid out contiguously in memory. You can however override this by explicitly specifying + * inner and outer strides. + * + * Here's an example of simply mapping a contiguous array as a \ref TopicStorageOrders "column-major" matrix: + * \include Map_simple.cpp + * Output: \verbinclude Map_simple.out + * + * If you need to map non-contiguous arrays, you can do so by specifying strides: + * + * Here's an example of mapping an array as a vector, specifying an inner stride, that is, the pointer + * increment between two consecutive coefficients. Here, we're specifying the inner stride as a compile-time + * fixed value. + * \include Map_inner_stride.cpp + * Output: \verbinclude Map_inner_stride.out + * + * Here's an example of mapping an array while specifying an outer stride. Here, since we're mapping + * as a column-major matrix, 'outer stride' means the pointer increment between two consecutive columns. + * Here, we're specifying the outer stride as a runtime parameter. Note that here \c OuterStride<> is + * a short version of \c OuterStride because the default template parameter of OuterStride + * is \c Dynamic + * \include Map_outer_stride.cpp + * Output: \verbinclude Map_outer_stride.out + * + * For more details and for an example of specifying both an inner and an outer stride, see class Stride. + * + * \b Tip: to change the array of data mapped by a Map object, you can use the C++ + * placement new syntax: + * + * Example: \include Map_placement_new.cpp + * Output: \verbinclude Map_placement_new.out + * + * This class is the return type of Matrix::Map() but can also be used directly. + * + * \sa Matrix::Map(), \ref TopicStorageOrders + */ + +namespace internal { +template +struct traits > + : public traits +{ + typedef traits TraitsBase; + typedef typename PlainObjectType::Index Index; + typedef typename PlainObjectType::Scalar Scalar; + enum { + InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0 + ? int(PlainObjectType::InnerStrideAtCompileTime) + : int(StrideType::InnerStrideAtCompileTime), + OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0 + ? int(PlainObjectType::OuterStrideAtCompileTime) + : int(StrideType::OuterStrideAtCompileTime), + HasNoInnerStride = InnerStrideAtCompileTime == 1, + HasNoOuterStride = StrideType::OuterStrideAtCompileTime == 0, + HasNoStride = HasNoInnerStride && HasNoOuterStride, + IsAligned = bool(EIGEN_ALIGN) && ((int(MapOptions)&Aligned)==Aligned), + IsDynamicSize = PlainObjectType::SizeAtCompileTime==Dynamic, + KeepsPacketAccess = bool(HasNoInnerStride) + && ( bool(IsDynamicSize) + || HasNoOuterStride + || ( OuterStrideAtCompileTime!=Dynamic + && ((static_cast(sizeof(Scalar))*OuterStrideAtCompileTime)%16)==0 ) ), + Flags0 = TraitsBase::Flags, + Flags1 = IsAligned ? (int(Flags0) | AlignedBit) : (int(Flags0) & ~AlignedBit), + Flags2 = (bool(HasNoStride) || bool(PlainObjectType::IsVectorAtCompileTime)) + ? int(Flags1) : int(Flags1 & ~LinearAccessBit), + Flags3 = is_lvalue::value ? int(Flags2) : (int(Flags2) & ~LvalueBit), + Flags = KeepsPacketAccess ? int(Flags3) : (int(Flags3) & ~PacketAccessBit) + }; +private: + enum { Options }; // Expressions don't have Options +}; +} + +template class Map + : public MapBase > +{ + public: + + typedef MapBase Base; + + EIGEN_DENSE_PUBLIC_INTERFACE(Map) + + typedef typename Base::PointerType PointerType; +#if EIGEN2_SUPPORT_STAGE <= STAGE30_FULL_EIGEN3_API + typedef const Scalar* PointerArgType; + inline PointerType cast_to_pointer_type(PointerArgType ptr) { return const_cast(ptr); } +#else + typedef PointerType PointerArgType; + inline PointerType cast_to_pointer_type(PointerArgType ptr) { return ptr; } +#endif + + inline Index innerStride() const + { + return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1; + } + + inline Index outerStride() const + { + return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer() + : IsVectorAtCompileTime ? this->size() + : int(Flags)&RowMajorBit ? this->cols() + : this->rows(); + } + + /** Constructor in the fixed-size case. + * + * \param data pointer to the array to map + * \param stride optional Stride object, passing the strides. + */ + inline Map(PointerArgType data, const StrideType& stride = StrideType()) + : Base(cast_to_pointer_type(data)), m_stride(stride) + { + PlainObjectType::Base::_check_template_params(); + } + + /** Constructor in the dynamic-size vector case. + * + * \param data pointer to the array to map + * \param size the size of the vector expression + * \param stride optional Stride object, passing the strides. + */ + inline Map(PointerArgType data, Index size, const StrideType& stride = StrideType()) + : Base(cast_to_pointer_type(data), size), m_stride(stride) + { + PlainObjectType::Base::_check_template_params(); + } + + /** Constructor in the dynamic-size matrix case. + * + * \param data pointer to the array to map + * \param rows the number of rows of the matrix expression + * \param cols the number of columns of the matrix expression + * \param stride optional Stride object, passing the strides. + */ + inline Map(PointerArgType data, Index rows, Index cols, const StrideType& stride = StrideType()) + : Base(cast_to_pointer_type(data), rows, cols), m_stride(stride) + { + PlainObjectType::Base::_check_template_params(); + } + + + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map) + + protected: + StrideType m_stride; +}; + +template +inline Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> + ::Array(const Scalar *data) +{ + this->_set_noalias(Eigen::Map(data)); +} + +template +inline Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> + ::Matrix(const Scalar *data) +{ + this->_set_noalias(Eigen::Map(data)); +} + +#endif // EIGEN_MAP_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/MapBase.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/MapBase.h new file mode 100644 index 000000000..c23bcbfdc --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/MapBase.h @@ -0,0 +1,255 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2007-2010 Benoit Jacob +// Copyright (C) 2008 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_MAPBASE_H +#define EIGEN_MAPBASE_H + +#define EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) \ + EIGEN_STATIC_ASSERT((int(internal::traits::Flags) & LinearAccessBit) || Derived::IsVectorAtCompileTime, \ + YOU_ARE_TRYING_TO_USE_AN_INDEX_BASED_ACCESSOR_ON_AN_EXPRESSION_THAT_DOES_NOT_SUPPORT_THAT) + + +/** \class MapBase + * \ingroup Core_Module + * + * \brief Base class for Map and Block expression with direct access + * + * \sa class Map, class Block + */ +template class MapBase + : public internal::dense_xpr_base::type +{ + public: + + typedef typename internal::dense_xpr_base::type Base; + enum { + RowsAtCompileTime = internal::traits::RowsAtCompileTime, + ColsAtCompileTime = internal::traits::ColsAtCompileTime, + SizeAtCompileTime = Base::SizeAtCompileTime + }; + + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::Index Index; + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::packet_traits::type PacketScalar; + typedef typename NumTraits::Real RealScalar; + typedef typename internal::conditional< + bool(internal::is_lvalue::value), + Scalar *, + const Scalar *>::type + PointerType; + + using Base::derived; +// using Base::RowsAtCompileTime; +// using Base::ColsAtCompileTime; +// using Base::SizeAtCompileTime; + using Base::MaxRowsAtCompileTime; + using Base::MaxColsAtCompileTime; + using Base::MaxSizeAtCompileTime; + using Base::IsVectorAtCompileTime; + using Base::Flags; + using Base::IsRowMajor; + + using Base::rows; + using Base::cols; + using Base::size; + using Base::coeff; + using Base::coeffRef; + using Base::lazyAssign; + using Base::eval; + + using Base::innerStride; + using Base::outerStride; + using Base::rowStride; + using Base::colStride; + + // bug 217 - compile error on ICC 11.1 + using Base::operator=; + + typedef typename Base::CoeffReturnType CoeffReturnType; + + inline Index rows() const { return m_rows.value(); } + inline Index cols() const { return m_cols.value(); } + + /** Returns a pointer to the first coefficient of the matrix or vector. + * + * \note When addressing this data, make sure to honor the strides returned by innerStride() and outerStride(). + * + * \sa innerStride(), outerStride() + */ + inline const Scalar* data() const { return m_data; } + + inline const Scalar& coeff(Index row, Index col) const + { + return m_data[col * colStride() + row * rowStride()]; + } + + inline const Scalar& coeff(Index index) const + { + EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) + return m_data[index * innerStride()]; + } + + inline const Scalar& coeffRef(Index row, Index col) const + { + return this->m_data[col * colStride() + row * rowStride()]; + } + + inline const Scalar& coeffRef(Index index) const + { + EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) + return this->m_data[index * innerStride()]; + } + + template + inline PacketScalar packet(Index row, Index col) const + { + return internal::ploadt + (m_data + (col * colStride() + row * rowStride())); + } + + template + inline PacketScalar packet(Index index) const + { + EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) + return internal::ploadt(m_data + index * innerStride()); + } + + inline MapBase(PointerType data) : m_data(data), m_rows(RowsAtCompileTime), m_cols(ColsAtCompileTime) + { + EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) + checkSanity(); + } + + inline MapBase(PointerType data, Index size) + : m_data(data), + m_rows(RowsAtCompileTime == Dynamic ? size : Index(RowsAtCompileTime)), + m_cols(ColsAtCompileTime == Dynamic ? size : Index(ColsAtCompileTime)) + { + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + eigen_assert(size >= 0); + eigen_assert(data == 0 || SizeAtCompileTime == Dynamic || SizeAtCompileTime == size); + checkSanity(); + } + + inline MapBase(PointerType data, Index rows, Index cols) + : m_data(data), m_rows(rows), m_cols(cols) + { + eigen_assert( (data == 0) + || ( rows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) + && cols >= 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols))); + checkSanity(); + } + + protected: + + void checkSanity() const + { + EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(internal::traits::Flags&PacketAccessBit, + internal::inner_stride_at_compile_time::ret==1), + PACKET_ACCESS_REQUIRES_TO_HAVE_INNER_STRIDE_FIXED_TO_1); + eigen_assert(EIGEN_IMPLIES(internal::traits::Flags&AlignedBit, (size_t(m_data) % (sizeof(Scalar)*internal::packet_traits::size)) == 0) + && "data is not aligned"); + } + + PointerType m_data; + const internal::variable_if_dynamic m_rows; + const internal::variable_if_dynamic m_cols; +}; + +template class MapBase + : public MapBase +{ + public: + + typedef MapBase Base; + + typedef typename Base::Scalar Scalar; + typedef typename Base::PacketScalar PacketScalar; + typedef typename Base::Index Index; + typedef typename Base::PointerType PointerType; + + using Base::derived; + using Base::rows; + using Base::cols; + using Base::size; + using Base::coeff; + using Base::coeffRef; + + using Base::innerStride; + using Base::outerStride; + using Base::rowStride; + using Base::colStride; + + typedef typename internal::conditional< + internal::is_lvalue::value, + Scalar, + const Scalar + >::type ScalarWithConstIfNotLvalue; + + inline const Scalar* data() const { return this->m_data; } + inline ScalarWithConstIfNotLvalue* data() { return this->m_data; } // no const-cast here so non-const-correct code will give a compile error + + inline ScalarWithConstIfNotLvalue& coeffRef(Index row, Index col) + { + return this->m_data[col * colStride() + row * rowStride()]; + } + + inline ScalarWithConstIfNotLvalue& coeffRef(Index index) + { + EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) + return this->m_data[index * innerStride()]; + } + + template + inline void writePacket(Index row, Index col, const PacketScalar& x) + { + internal::pstoret + (this->m_data + (col * colStride() + row * rowStride()), x); + } + + template + inline void writePacket(Index index, const PacketScalar& x) + { + EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) + internal::pstoret + (this->m_data + index * innerStride(), x); + } + + explicit inline MapBase(PointerType data) : Base(data) {} + inline MapBase(PointerType data, Index size) : Base(data, size) {} + inline MapBase(PointerType data, Index rows, Index cols) : Base(data, rows, cols) {} + + Derived& operator=(const MapBase& other) + { + Base::Base::operator=(other); + return derived(); + } + + using Base::Base::operator=; +}; + + +#endif // EIGEN_MAPBASE_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/MathFunctions.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/MathFunctions.h new file mode 100644 index 000000000..c80d30e35 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/MathFunctions.h @@ -0,0 +1,843 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2010 Benoit Jacob +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_MATHFUNCTIONS_H +#define EIGEN_MATHFUNCTIONS_H + +namespace internal { + +/** \internal \struct global_math_functions_filtering_base + * + * What it does: + * Defines a typedef 'type' as follows: + * - if type T has a member typedef Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl, then + * global_math_functions_filtering_base::type is a typedef for it. + * - otherwise, global_math_functions_filtering_base::type is a typedef for T. + * + * How it's used: + * To allow to defined the global math functions (like sin...) in certain cases, like the Array expressions. + * When you do sin(array1+array2), the object array1+array2 has a complicated expression type, all what you want to know + * is that it inherits ArrayBase. So we implement a partial specialization of sin_impl for ArrayBase. + * So we must make sure to use sin_impl > and not sin_impl, otherwise our partial specialization + * won't be used. How does sin know that? That's exactly what global_math_functions_filtering_base tells it. + * + * How it's implemented: + * SFINAE in the style of enable_if. Highly susceptible of breaking compilers. With GCC, it sure does work, but if you replace + * the typename dummy by an integer template parameter, it doesn't work anymore! + */ + +template +struct global_math_functions_filtering_base +{ + typedef T type; +}; + +template struct always_void { typedef void type; }; + +template +struct global_math_functions_filtering_base + ::type + > +{ + typedef typename T::Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl type; +}; + +#define EIGEN_MATHFUNC_IMPL(func, scalar) func##_impl::type> +#define EIGEN_MATHFUNC_RETVAL(func, scalar) typename func##_retval::type>::type + + +/**************************************************************************** +* Implementation of real * +****************************************************************************/ + +template +struct real_impl +{ + typedef typename NumTraits::Real RealScalar; + static inline RealScalar run(const Scalar& x) + { + return x; + } +}; + +template +struct real_impl > +{ + static inline RealScalar run(const std::complex& x) + { + using std::real; + return real(x); + } +}; + +template +struct real_retval +{ + typedef typename NumTraits::Real type; +}; + +template +inline EIGEN_MATHFUNC_RETVAL(real, Scalar) real(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(real, Scalar)::run(x); +} + +/**************************************************************************** +* Implementation of imag * +****************************************************************************/ + +template +struct imag_impl +{ + typedef typename NumTraits::Real RealScalar; + static inline RealScalar run(const Scalar&) + { + return RealScalar(0); + } +}; + +template +struct imag_impl > +{ + static inline RealScalar run(const std::complex& x) + { + using std::imag; + return imag(x); + } +}; + +template +struct imag_retval +{ + typedef typename NumTraits::Real type; +}; + +template +inline EIGEN_MATHFUNC_RETVAL(imag, Scalar) imag(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(imag, Scalar)::run(x); +} + +/**************************************************************************** +* Implementation of real_ref * +****************************************************************************/ + +template +struct real_ref_impl +{ + typedef typename NumTraits::Real RealScalar; + static inline RealScalar& run(Scalar& x) + { + return reinterpret_cast(&x)[0]; + } + static inline const RealScalar& run(const Scalar& x) + { + return reinterpret_cast(&x)[0]; + } +}; + +template +struct real_ref_retval +{ + typedef typename NumTraits::Real & type; +}; + +template +inline typename add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) >::type real_ref(const Scalar& x) +{ + return real_ref_impl::run(x); +} + +template +inline EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) real_ref(Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(real_ref, Scalar)::run(x); +} + +/**************************************************************************** +* Implementation of imag_ref * +****************************************************************************/ + +template +struct imag_ref_default_impl +{ + typedef typename NumTraits::Real RealScalar; + static inline RealScalar& run(Scalar& x) + { + return reinterpret_cast(&x)[1]; + } + static inline const RealScalar& run(const Scalar& x) + { + return reinterpret_cast(&x)[1]; + } +}; + +template +struct imag_ref_default_impl +{ + static inline Scalar run(Scalar&) + { + return Scalar(0); + } + static inline const Scalar run(const Scalar&) + { + return Scalar(0); + } +}; + +template +struct imag_ref_impl : imag_ref_default_impl::IsComplex> {}; + +template +struct imag_ref_retval +{ + typedef typename NumTraits::Real & type; +}; + +template +inline typename add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) >::type imag_ref(const Scalar& x) +{ + return imag_ref_impl::run(x); +} + +template +inline EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) imag_ref(Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(imag_ref, Scalar)::run(x); +} + +/**************************************************************************** +* Implementation of conj * +****************************************************************************/ + +template +struct conj_impl +{ + static inline Scalar run(const Scalar& x) + { + return x; + } +}; + +template +struct conj_impl > +{ + static inline std::complex run(const std::complex& x) + { + using std::conj; + return conj(x); + } +}; + +template +struct conj_retval +{ + typedef Scalar type; +}; + +template +inline EIGEN_MATHFUNC_RETVAL(conj, Scalar) conj(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(conj, Scalar)::run(x); +} + +/**************************************************************************** +* Implementation of abs * +****************************************************************************/ + +template +struct abs_impl +{ + typedef typename NumTraits::Real RealScalar; + static inline RealScalar run(const Scalar& x) + { + using std::abs; + return abs(x); + } +}; + +template +struct abs_retval +{ + typedef typename NumTraits::Real type; +}; + +template +inline EIGEN_MATHFUNC_RETVAL(abs, Scalar) abs(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(abs, Scalar)::run(x); +} + +/**************************************************************************** +* Implementation of abs2 * +****************************************************************************/ + +template +struct abs2_impl +{ + typedef typename NumTraits::Real RealScalar; + static inline RealScalar run(const Scalar& x) + { + return x*x; + } +}; + +template +struct abs2_impl > +{ + static inline RealScalar run(const std::complex& x) + { + using std::norm; + return norm(x); + } +}; + +template +struct abs2_retval +{ + typedef typename NumTraits::Real type; +}; + +template +inline EIGEN_MATHFUNC_RETVAL(abs2, Scalar) abs2(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(abs2, Scalar)::run(x); +} + +/**************************************************************************** +* Implementation of norm1 * +****************************************************************************/ + +template +struct norm1_default_impl +{ + typedef typename NumTraits::Real RealScalar; + static inline RealScalar run(const Scalar& x) + { + return abs(real(x)) + abs(imag(x)); + } +}; + +template +struct norm1_default_impl +{ + static inline Scalar run(const Scalar& x) + { + return abs(x); + } +}; + +template +struct norm1_impl : norm1_default_impl::IsComplex> {}; + +template +struct norm1_retval +{ + typedef typename NumTraits::Real type; +}; + +template +inline EIGEN_MATHFUNC_RETVAL(norm1, Scalar) norm1(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(norm1, Scalar)::run(x); +} + +/**************************************************************************** +* Implementation of hypot * +****************************************************************************/ + +template +struct hypot_impl +{ + typedef typename NumTraits::Real RealScalar; + static inline RealScalar run(const Scalar& x, const Scalar& y) + { + using std::max; + using std::min; + RealScalar _x = abs(x); + RealScalar _y = abs(y); + RealScalar p = max(_x, _y); + RealScalar q = min(_x, _y); + RealScalar qp = q/p; + return p * sqrt(RealScalar(1) + qp*qp); + } +}; + +template +struct hypot_retval +{ + typedef typename NumTraits::Real type; +}; + +template +inline EIGEN_MATHFUNC_RETVAL(hypot, Scalar) hypot(const Scalar& x, const Scalar& y) +{ + return EIGEN_MATHFUNC_IMPL(hypot, Scalar)::run(x, y); +} + +/**************************************************************************** +* Implementation of cast * +****************************************************************************/ + +template +struct cast_impl +{ + static inline NewType run(const OldType& x) + { + return static_cast(x); + } +}; + +// here, for once, we're plainly returning NewType: we don't want cast to do weird things. + +template +inline NewType cast(const OldType& x) +{ + return cast_impl::run(x); +} + +/**************************************************************************** +* Implementation of sqrt * +****************************************************************************/ + +template +struct sqrt_default_impl +{ + static inline Scalar run(const Scalar& x) + { + using std::sqrt; + return sqrt(x); + } +}; + +template +struct sqrt_default_impl +{ + static inline Scalar run(const Scalar&) + { +#ifdef EIGEN2_SUPPORT + eigen_assert(!NumTraits::IsInteger); +#else + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) +#endif + return Scalar(0); + } +}; + +template +struct sqrt_impl : sqrt_default_impl::IsInteger> {}; + +template +struct sqrt_retval +{ + typedef Scalar type; +}; + +template +inline EIGEN_MATHFUNC_RETVAL(sqrt, Scalar) sqrt(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(sqrt, Scalar)::run(x); +} + +/**************************************************************************** +* Implementation of standard unary real functions (exp, log, sin, cos, ... * +****************************************************************************/ + +// This macro instanciate all the necessary template mechanism which is common to all unary real functions. +#define EIGEN_MATHFUNC_STANDARD_REAL_UNARY(NAME) \ + template struct NAME##_default_impl { \ + static inline Scalar run(const Scalar& x) { using std::NAME; return NAME(x); } \ + }; \ + template struct NAME##_default_impl { \ + static inline Scalar run(const Scalar&) { \ + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) \ + return Scalar(0); \ + } \ + }; \ + template struct NAME##_impl \ + : NAME##_default_impl::IsInteger> \ + {}; \ + template struct NAME##_retval { typedef Scalar type; }; \ + template \ + inline EIGEN_MATHFUNC_RETVAL(NAME, Scalar) NAME(const Scalar& x) { \ + return EIGEN_MATHFUNC_IMPL(NAME, Scalar)::run(x); \ + } + +EIGEN_MATHFUNC_STANDARD_REAL_UNARY(exp) +EIGEN_MATHFUNC_STANDARD_REAL_UNARY(log) +EIGEN_MATHFUNC_STANDARD_REAL_UNARY(sin) +EIGEN_MATHFUNC_STANDARD_REAL_UNARY(cos) +EIGEN_MATHFUNC_STANDARD_REAL_UNARY(tan) +EIGEN_MATHFUNC_STANDARD_REAL_UNARY(asin) +EIGEN_MATHFUNC_STANDARD_REAL_UNARY(acos) + +/**************************************************************************** +* Implementation of atan2 * +****************************************************************************/ + +template +struct atan2_default_impl +{ + typedef Scalar retval; + static inline Scalar run(const Scalar& x, const Scalar& y) + { + using std::atan2; + return atan2(x, y); + } +}; + +template +struct atan2_default_impl +{ + static inline Scalar run(const Scalar&, const Scalar&) + { + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) + return Scalar(0); + } +}; + +template +struct atan2_impl : atan2_default_impl::IsInteger> {}; + +template +struct atan2_retval +{ + typedef Scalar type; +}; + +template +inline EIGEN_MATHFUNC_RETVAL(atan2, Scalar) atan2(const Scalar& x, const Scalar& y) +{ + return EIGEN_MATHFUNC_IMPL(atan2, Scalar)::run(x, y); +} + +/**************************************************************************** +* Implementation of pow * +****************************************************************************/ + +template +struct pow_default_impl +{ + typedef Scalar retval; + static inline Scalar run(const Scalar& x, const Scalar& y) + { + using std::pow; + return pow(x, y); + } +}; + +template +struct pow_default_impl +{ + static inline Scalar run(Scalar x, Scalar y) + { + Scalar res = 1; + eigen_assert(!NumTraits::IsSigned || y >= 0); + if(y & 1) res *= x; + y >>= 1; + while(y) + { + x *= x; + if(y&1) res *= x; + y >>= 1; + } + return res; + } +}; + +template +struct pow_impl : pow_default_impl::IsInteger> {}; + +template +struct pow_retval +{ + typedef Scalar type; +}; + +template +inline EIGEN_MATHFUNC_RETVAL(pow, Scalar) pow(const Scalar& x, const Scalar& y) +{ + return EIGEN_MATHFUNC_IMPL(pow, Scalar)::run(x, y); +} + +/**************************************************************************** +* Implementation of random * +****************************************************************************/ + +template +struct random_default_impl {}; + +template +struct random_impl : random_default_impl::IsComplex, NumTraits::IsInteger> {}; + +template +struct random_retval +{ + typedef Scalar type; +}; + +template inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random(const Scalar& x, const Scalar& y); +template inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random(); + +template +struct random_default_impl +{ + static inline Scalar run(const Scalar& x, const Scalar& y) + { + return x + (y-x) * Scalar(std::rand()) / Scalar(RAND_MAX); + } + static inline Scalar run() + { + return run(Scalar(NumTraits::IsSigned ? -1 : 0), Scalar(1)); + } +}; + +enum { + floor_log2_terminate, + floor_log2_move_up, + floor_log2_move_down, + floor_log2_bogus +}; + +template struct floor_log2_selector +{ + enum { middle = (lower + upper) / 2, + value = (upper <= lower + 1) ? int(floor_log2_terminate) + : (n < (1 << middle)) ? int(floor_log2_move_down) + : (n==0) ? int(floor_log2_bogus) + : int(floor_log2_move_up) + }; +}; + +template::value> +struct floor_log2 {}; + +template +struct floor_log2 +{ + enum { value = floor_log2::middle>::value }; +}; + +template +struct floor_log2 +{ + enum { value = floor_log2::middle, upper>::value }; +}; + +template +struct floor_log2 +{ + enum { value = (n >= ((unsigned int)(1) << (lower+1))) ? lower+1 : lower }; +}; + +template +struct floor_log2 +{ + // no value, error at compile time +}; + +template +struct random_default_impl +{ + typedef typename NumTraits::NonInteger NonInteger; + + static inline Scalar run(const Scalar& x, const Scalar& y) + { + return x + Scalar((NonInteger(y)-x+1) * std::rand() / (RAND_MAX + NonInteger(1))); + } + + static inline Scalar run() + { +#ifdef EIGEN_MAKING_DOCS + return run(Scalar(NumTraits::IsSigned ? -10 : 0), Scalar(10)); +#else + enum { rand_bits = floor_log2<(unsigned int)(RAND_MAX)+1>::value, + scalar_bits = sizeof(Scalar) * CHAR_BIT, + shift = EIGEN_PLAIN_ENUM_MAX(0, int(rand_bits) - int(scalar_bits)) + }; + Scalar x = Scalar(std::rand() >> shift); + Scalar offset = NumTraits::IsSigned ? Scalar(1 << (rand_bits-1)) : Scalar(0); + return x - offset; +#endif + } +}; + +template +struct random_default_impl +{ + static inline Scalar run(const Scalar& x, const Scalar& y) + { + return Scalar(random(real(x), real(y)), + random(imag(x), imag(y))); + } + static inline Scalar run() + { + typedef typename NumTraits::Real RealScalar; + return Scalar(random(), random()); + } +}; + +template +inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random(const Scalar& x, const Scalar& y) +{ + return EIGEN_MATHFUNC_IMPL(random, Scalar)::run(x, y); +} + +template +inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random() +{ + return EIGEN_MATHFUNC_IMPL(random, Scalar)::run(); +} + +/**************************************************************************** +* Implementation of fuzzy comparisons * +****************************************************************************/ + +template +struct scalar_fuzzy_default_impl {}; + +template +struct scalar_fuzzy_default_impl +{ + typedef typename NumTraits::Real RealScalar; + template + static inline bool isMuchSmallerThan(const Scalar& x, const OtherScalar& y, const RealScalar& prec) + { + return abs(x) <= abs(y) * prec; + } + static inline bool isApprox(const Scalar& x, const Scalar& y, const RealScalar& prec) + { + using std::min; + return abs(x - y) <= min(abs(x), abs(y)) * prec; + } + static inline bool isApproxOrLessThan(const Scalar& x, const Scalar& y, const RealScalar& prec) + { + return x <= y || isApprox(x, y, prec); + } +}; + +template +struct scalar_fuzzy_default_impl +{ + typedef typename NumTraits::Real RealScalar; + template + static inline bool isMuchSmallerThan(const Scalar& x, const Scalar&, const RealScalar&) + { + return x == Scalar(0); + } + static inline bool isApprox(const Scalar& x, const Scalar& y, const RealScalar&) + { + return x == y; + } + static inline bool isApproxOrLessThan(const Scalar& x, const Scalar& y, const RealScalar&) + { + return x <= y; + } +}; + +template +struct scalar_fuzzy_default_impl +{ + typedef typename NumTraits::Real RealScalar; + template + static inline bool isMuchSmallerThan(const Scalar& x, const OtherScalar& y, const RealScalar& prec) + { + return abs2(x) <= abs2(y) * prec * prec; + } + static inline bool isApprox(const Scalar& x, const Scalar& y, const RealScalar& prec) + { + using std::min; + return abs2(x - y) <= min(abs2(x), abs2(y)) * prec * prec; + } +}; + +template +struct scalar_fuzzy_impl : scalar_fuzzy_default_impl::IsComplex, NumTraits::IsInteger> {}; + +template +inline bool isMuchSmallerThan(const Scalar& x, const OtherScalar& y, + typename NumTraits::Real precision = NumTraits::dummy_precision()) +{ + return scalar_fuzzy_impl::template isMuchSmallerThan(x, y, precision); +} + +template +inline bool isApprox(const Scalar& x, const Scalar& y, + typename NumTraits::Real precision = NumTraits::dummy_precision()) +{ + return scalar_fuzzy_impl::isApprox(x, y, precision); +} + +template +inline bool isApproxOrLessThan(const Scalar& x, const Scalar& y, + typename NumTraits::Real precision = NumTraits::dummy_precision()) +{ + return scalar_fuzzy_impl::isApproxOrLessThan(x, y, precision); +} + +/****************************************** +*** The special case of the bool type *** +******************************************/ + +template<> struct random_impl +{ + static inline bool run() + { + return random(0,1)==0 ? false : true; + } +}; + +template<> struct scalar_fuzzy_impl +{ + typedef bool RealScalar; + + template + static inline bool isMuchSmallerThan(const bool& x, const bool&, const bool&) + { + return !x; + } + + static inline bool isApprox(bool x, bool y, bool) + { + return x == y; + } + + static inline bool isApproxOrLessThan(const bool& x, const bool& y, const bool&) + { + return (!x) || y; + } + +}; + +} // end namespace internal + +#endif // EIGEN_MATHFUNCTIONS_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/Matrix.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/Matrix.h new file mode 100644 index 000000000..44de22cb4 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/Matrix.h @@ -0,0 +1,439 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2010 Benoit Jacob +// Copyright (C) 2008-2009 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_MATRIX_H +#define EIGEN_MATRIX_H + +/** \class Matrix + * \ingroup Core_Module + * + * \brief The matrix class, also used for vectors and row-vectors + * + * The %Matrix class is the work-horse for all \em dense (\ref dense "note") matrices and vectors within Eigen. + * Vectors are matrices with one column, and row-vectors are matrices with one row. + * + * The %Matrix class encompasses \em both fixed-size and dynamic-size objects (\ref fixedsize "note"). + * + * The first three template parameters are required: + * \tparam _Scalar \anchor matrix_tparam_scalar Numeric type, e.g. float, double, int or std::complex. + * User defined sclar types are supported as well (see \ref user_defined_scalars "here"). + * \tparam _Rows Number of rows, or \b Dynamic + * \tparam _Cols Number of columns, or \b Dynamic + * + * The remaining template parameters are optional -- in most cases you don't have to worry about them. + * \tparam _Options \anchor matrix_tparam_options A combination of either \b #RowMajor or \b #ColMajor, and of either + * \b #AutoAlign or \b #DontAlign. + * The former controls \ref TopicStorageOrders "storage order", and defaults to column-major. The latter controls alignment, which is required + * for vectorization. It defaults to aligning matrices except for fixed sizes that aren't a multiple of the packet size. + * \tparam _MaxRows Maximum number of rows. Defaults to \a _Rows (\ref maxrows "note"). + * \tparam _MaxCols Maximum number of columns. Defaults to \a _Cols (\ref maxrows "note"). + * + * Eigen provides a number of typedefs covering the usual cases. Here are some examples: + * + * \li \c Matrix2d is a 2x2 square matrix of doubles (\c Matrix) + * \li \c Vector4f is a vector of 4 floats (\c Matrix) + * \li \c RowVector3i is a row-vector of 3 ints (\c Matrix) + * + * \li \c MatrixXf is a dynamic-size matrix of floats (\c Matrix) + * \li \c VectorXf is a dynamic-size vector of floats (\c Matrix) + * + * \li \c Matrix2Xf is a partially fixed-size (dynamic-size) matrix of floats (\c Matrix) + * \li \c MatrixX3d is a partially dynamic-size (fixed-size) matrix of double (\c Matrix) + * + * See \link matrixtypedefs this page \endlink for a complete list of predefined \em %Matrix and \em Vector typedefs. + * + * You can access elements of vectors and matrices using normal subscripting: + * + * \code + * Eigen::VectorXd v(10); + * v[0] = 0.1; + * v[1] = 0.2; + * v(0) = 0.3; + * v(1) = 0.4; + * + * Eigen::MatrixXi m(10, 10); + * m(0, 1) = 1; + * m(0, 2) = 2; + * m(0, 3) = 3; + * \endcode + * + * This class can be extended with the help of the plugin mechanism described on the page + * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_MATRIX_PLUGIN. + * + * Some notes: + * + *

+ *
\anchor dense Dense versus sparse:
+ *
This %Matrix class handles dense, not sparse matrices and vectors. For sparse matrices and vectors, see the Sparse module. + * + * Dense matrices and vectors are plain usual arrays of coefficients. All the coefficients are stored, in an ordinary contiguous array. + * This is unlike Sparse matrices and vectors where the coefficients are stored as a list of nonzero coefficients.
+ * + *
\anchor fixedsize Fixed-size versus dynamic-size:
+ *
Fixed-size means that the numbers of rows and columns are known are compile-time. In this case, Eigen allocates the array + * of coefficients as a fixed-size array, as a class member. This makes sense for very small matrices, typically up to 4x4, sometimes up + * to 16x16. Larger matrices should be declared as dynamic-size even if one happens to know their size at compile-time. + * + * Dynamic-size means that the numbers of rows or columns are not necessarily known at compile-time. In this case they are runtime + * variables, and the array of coefficients is allocated dynamically on the heap. + * + * Note that \em dense matrices, be they Fixed-size or Dynamic-size, do not expand dynamically in the sense of a std::map. + * If you want this behavior, see the Sparse module.
+ * + *
\anchor maxrows _MaxRows and _MaxCols:
+ *
In most cases, one just leaves these parameters to the default values. + * These parameters mean the maximum size of rows and columns that the matrix may have. They are useful in cases + * when the exact numbers of rows and columns are not known are compile-time, but it is known at compile-time that they cannot + * exceed a certain value. This happens when taking dynamic-size blocks inside fixed-size matrices: in this case _MaxRows and _MaxCols + * are the dimensions of the original matrix, while _Rows and _Cols are Dynamic.
+ *
+ * + * \see MatrixBase for the majority of the API methods for matrices, \ref TopicClassHierarchy, + * \ref TopicStorageOrders + */ + +namespace internal { +template +struct traits > +{ + typedef _Scalar Scalar; + typedef Dense StorageKind; + typedef DenseIndex Index; + typedef MatrixXpr XprKind; + enum { + RowsAtCompileTime = _Rows, + ColsAtCompileTime = _Cols, + MaxRowsAtCompileTime = _MaxRows, + MaxColsAtCompileTime = _MaxCols, + Flags = compute_matrix_flags<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::ret, + CoeffReadCost = NumTraits::ReadCost, + Options = _Options, + InnerStrideAtCompileTime = 1, + OuterStrideAtCompileTime = (Options&RowMajor) ? ColsAtCompileTime : RowsAtCompileTime + }; +}; +} + +template +class Matrix + : public PlainObjectBase > +{ + public: + + /** \brief Base class typedef. + * \sa PlainObjectBase + */ + typedef PlainObjectBase Base; + + enum { Options = _Options }; + + EIGEN_DENSE_PUBLIC_INTERFACE(Matrix) + + typedef typename Base::PlainObject PlainObject; + + enum { NeedsToAlign = (!(Options&DontAlign)) + && SizeAtCompileTime!=Dynamic && ((static_cast(sizeof(Scalar))*SizeAtCompileTime)%16)==0 }; + EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) + + using Base::base; + using Base::coeffRef; + + /** + * \brief Assigns matrices to each other. + * + * \note This is a special case of the templated operator=. Its purpose is + * to prevent a default operator= from hiding the templated operator=. + * + * \callgraph + */ + EIGEN_STRONG_INLINE Matrix& operator=(const Matrix& other) + { + return Base::_set(other); + } + + /** \internal + * \brief Copies the value of the expression \a other into \c *this with automatic resizing. + * + * *this might be resized to match the dimensions of \a other. If *this was a null matrix (not already initialized), + * it will be initialized. + * + * Note that copying a row-vector into a vector (and conversely) is allowed. + * The resizing, if any, is then done in the appropriate way so that row-vectors + * remain row-vectors and vectors remain vectors. + */ + template + EIGEN_STRONG_INLINE Matrix& operator=(const MatrixBase& other) + { + return Base::_set(other); + } + + /* Here, doxygen failed to copy the brief information when using \copydoc */ + + /** + * \brief Copies the generic expression \a other into *this. + * \copydetails DenseBase::operator=(const EigenBase &other) + */ + template + EIGEN_STRONG_INLINE Matrix& operator=(const EigenBase &other) + { + return Base::operator=(other); + } + + template + EIGEN_STRONG_INLINE Matrix& operator=(const ReturnByValue& func) + { + return Base::operator=(func); + } + + /** \brief Default constructor. + * + * For fixed-size matrices, does nothing. + * + * For dynamic-size matrices, creates an empty matrix of size 0. Does not allocate any array. Such a matrix + * is called a null matrix. This constructor is the unique way to create null matrices: resizing + * a matrix to 0 is not supported. + * + * \sa resize(Index,Index) + */ + EIGEN_STRONG_INLINE explicit Matrix() : Base() + { + Base::_check_template_params(); + EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + } + + // FIXME is it still needed + Matrix(internal::constructor_without_unaligned_array_assert) + : Base(internal::constructor_without_unaligned_array_assert()) + { Base::_check_template_params(); EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED } + + /** \brief Constructs a vector or row-vector with given dimension. \only_for_vectors + * + * Note that this is only useful for dynamic-size vectors. For fixed-size vectors, + * it is redundant to pass the dimension here, so it makes more sense to use the default + * constructor Matrix() instead. + */ + EIGEN_STRONG_INLINE explicit Matrix(Index dim) + : Base(dim, RowsAtCompileTime == 1 ? 1 : dim, ColsAtCompileTime == 1 ? 1 : dim) + { + Base::_check_template_params(); + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Matrix) + eigen_assert(dim >= 0); + eigen_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == dim); + EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + } + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + EIGEN_STRONG_INLINE Matrix(const T0& x, const T1& y) + { + Base::_check_template_params(); + Base::template _init2(x, y); + } + #else + /** \brief Constructs an uninitialized matrix with \a rows rows and \a cols columns. + * + * This is useful for dynamic-size matrices. For fixed-size matrices, + * it is redundant to pass these parameters, so one should use the default constructor + * Matrix() instead. */ + Matrix(Index rows, Index cols); + /** \brief Constructs an initialized 2D vector with given coefficients */ + Matrix(const Scalar& x, const Scalar& y); + #endif + + /** \brief Constructs an initialized 3D vector with given coefficients */ + EIGEN_STRONG_INLINE Matrix(const Scalar& x, const Scalar& y, const Scalar& z) + { + Base::_check_template_params(); + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Matrix, 3) + m_storage.data()[0] = x; + m_storage.data()[1] = y; + m_storage.data()[2] = z; + } + /** \brief Constructs an initialized 4D vector with given coefficients */ + EIGEN_STRONG_INLINE Matrix(const Scalar& x, const Scalar& y, const Scalar& z, const Scalar& w) + { + Base::_check_template_params(); + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Matrix, 4) + m_storage.data()[0] = x; + m_storage.data()[1] = y; + m_storage.data()[2] = z; + m_storage.data()[3] = w; + } + + explicit Matrix(const Scalar *data); + + /** \brief Constructor copying the value of the expression \a other */ + template + EIGEN_STRONG_INLINE Matrix(const MatrixBase& other) + : Base(other.rows() * other.cols(), other.rows(), other.cols()) + { + // This test resides here, to bring the error messages closer to the user. Normally, these checks + // are performed deeply within the library, thus causing long and scary error traces. + EIGEN_STATIC_ASSERT((internal::is_same::value), + YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) + + Base::_check_template_params(); + Base::_set_noalias(other); + } + /** \brief Copy constructor */ + EIGEN_STRONG_INLINE Matrix(const Matrix& other) + : Base(other.rows() * other.cols(), other.rows(), other.cols()) + { + Base::_check_template_params(); + Base::_set_noalias(other); + } + /** \brief Copy constructor with in-place evaluation */ + template + EIGEN_STRONG_INLINE Matrix(const ReturnByValue& other) + { + Base::_check_template_params(); + Base::resize(other.rows(), other.cols()); + other.evalTo(*this); + } + + /** \brief Copy constructor for generic expressions. + * \sa MatrixBase::operator=(const EigenBase&) + */ + template + EIGEN_STRONG_INLINE Matrix(const EigenBase &other) + : Base(other.derived().rows() * other.derived().cols(), other.derived().rows(), other.derived().cols()) + { + Base::_check_template_params(); + Base::resize(other.rows(), other.cols()); + // FIXME/CHECK: isn't *this = other.derived() more efficient. it allows to + // go for pure _set() implementations, right? + *this = other; + } + + /** \internal + * \brief Override MatrixBase::swap() since for dynamic-sized matrices + * of same type it is enough to swap the data pointers. + */ + template + void swap(MatrixBase const & other) + { this->_swap(other.derived()); } + + inline Index innerStride() const { return 1; } + inline Index outerStride() const { return this->innerSize(); } + + /////////// Geometry module /////////// + + template + explicit Matrix(const RotationBase& r); + template + Matrix& operator=(const RotationBase& r); + + #ifdef EIGEN2_SUPPORT + template + explicit Matrix(const eigen2_RotationBase& r); + template + Matrix& operator=(const eigen2_RotationBase& r); + #endif + + // allow to extend Matrix outside Eigen + #ifdef EIGEN_MATRIX_PLUGIN + #include EIGEN_MATRIX_PLUGIN + #endif + + protected: + template + friend struct internal::conservative_resize_like_impl; + + using Base::m_storage; +}; + +/** \defgroup matrixtypedefs Global matrix typedefs + * + * \ingroup Core_Module + * + * Eigen defines several typedef shortcuts for most common matrix and vector types. + * + * The general patterns are the following: + * + * \c MatrixSizeType where \c Size can be \c 2,\c 3,\c 4 for fixed size square matrices or \c X for dynamic size, + * 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 + * for complex double. + * + * For example, \c Matrix3d is a fixed-size 3x3 matrix type of doubles, and \c MatrixXf is a dynamic-size matrix of floats. + * + * There are also \c VectorSizeType and \c RowVectorSizeType which are self-explanatory. For example, \c Vector4cf is + * a fixed-size vector of 4 complex floats. + * + * \sa class Matrix + */ + +#define EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \ +/** \ingroup matrixtypedefs */ \ +typedef Matrix Matrix##SizeSuffix##TypeSuffix; \ +/** \ingroup matrixtypedefs */ \ +typedef Matrix Vector##SizeSuffix##TypeSuffix; \ +/** \ingroup matrixtypedefs */ \ +typedef Matrix RowVector##SizeSuffix##TypeSuffix; + +#define EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, Size) \ +/** \ingroup matrixtypedefs */ \ +typedef Matrix Matrix##Size##X##TypeSuffix; \ +/** \ingroup matrixtypedefs */ \ +typedef Matrix Matrix##X##Size##TypeSuffix; + +#define EIGEN_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \ +EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \ +EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 3, 3) \ +EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 4, 4) \ +EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Dynamic, X) \ +EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 2) \ +EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 3) \ +EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 4) + +EIGEN_MAKE_TYPEDEFS_ALL_SIZES(int, i) +EIGEN_MAKE_TYPEDEFS_ALL_SIZES(float, f) +EIGEN_MAKE_TYPEDEFS_ALL_SIZES(double, d) +EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex, cf) +EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex, cd) + +#undef EIGEN_MAKE_TYPEDEFS_ALL_SIZES +#undef EIGEN_MAKE_TYPEDEFS + +#undef EIGEN_MAKE_TYPEDEFS_LARGE + +#define EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, SizeSuffix) \ +using Eigen::Matrix##SizeSuffix##TypeSuffix; \ +using Eigen::Vector##SizeSuffix##TypeSuffix; \ +using Eigen::RowVector##SizeSuffix##TypeSuffix; + +#define EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(TypeSuffix) \ +EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 2) \ +EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 3) \ +EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 4) \ +EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, X) \ + +#define EIGEN_USING_MATRIX_TYPEDEFS \ +EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(i) \ +EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(f) \ +EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(d) \ +EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(cf) \ +EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(cd) + +#endif // EIGEN_MATRIX_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/MatrixBase.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/MatrixBase.h new file mode 100644 index 000000000..f0c7fc7a1 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/MatrixBase.h @@ -0,0 +1,520 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2009 Benoit Jacob +// Copyright (C) 2008 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_MATRIXBASE_H +#define EIGEN_MATRIXBASE_H + +/** \class MatrixBase + * \ingroup Core_Module + * + * \brief Base class for all dense matrices, vectors, and expressions + * + * This class is the base that is inherited by all matrix, vector, and related expression + * types. Most of the Eigen API is contained in this class, and its base classes. Other important + * classes for the Eigen API are Matrix, and VectorwiseOp. + * + * Note that some methods are defined in other modules such as the \ref LU_Module LU module + * for all functions related to matrix inversions. + * + * \tparam Derived is the derived type, e.g. a matrix type, or an expression, etc. + * + * When writing a function taking Eigen objects as argument, if you want your function + * to take as argument any matrix, vector, or expression, just let it take a + * MatrixBase argument. As an example, here is a function printFirstRow which, given + * a matrix, vector, or expression \a x, prints the first row of \a x. + * + * \code + template + void printFirstRow(const Eigen::MatrixBase& x) + { + cout << x.row(0) << endl; + } + * \endcode + * + * This class can be extended with the help of the plugin mechanism described on the page + * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_MATRIXBASE_PLUGIN. + * + * \sa \ref TopicClassHierarchy + */ +template class MatrixBase + : public DenseBase +{ + public: +#ifndef EIGEN_PARSED_BY_DOXYGEN + typedef MatrixBase StorageBaseType; + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::Index Index; + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::packet_traits::type PacketScalar; + typedef typename NumTraits::Real RealScalar; + + typedef DenseBase Base; + using Base::RowsAtCompileTime; + using Base::ColsAtCompileTime; + using Base::SizeAtCompileTime; + using Base::MaxRowsAtCompileTime; + using Base::MaxColsAtCompileTime; + using Base::MaxSizeAtCompileTime; + using Base::IsVectorAtCompileTime; + using Base::Flags; + using Base::CoeffReadCost; + + using Base::derived; + using Base::const_cast_derived; + using Base::rows; + using Base::cols; + using Base::size; + using Base::coeff; + using Base::coeffRef; + using Base::lazyAssign; + using Base::eval; + using Base::operator+=; + using Base::operator-=; + using Base::operator*=; + using Base::operator/=; + + typedef typename Base::CoeffReturnType CoeffReturnType; + typedef typename Base::ConstTransposeReturnType ConstTransposeReturnType; + typedef typename Base::RowXpr RowXpr; + typedef typename Base::ColXpr ColXpr; +#endif // not EIGEN_PARSED_BY_DOXYGEN + + + +#ifndef EIGEN_PARSED_BY_DOXYGEN + /** type of the equivalent square matrix */ + typedef Matrix SquareMatrixType; +#endif // not EIGEN_PARSED_BY_DOXYGEN + + /** \returns the size of the main diagonal, which is min(rows(),cols()). + * \sa rows(), cols(), SizeAtCompileTime. */ + inline Index diagonalSize() const { return std::min(rows(),cols()); } + + /** \brief The plain matrix type corresponding to this expression. + * + * This is not necessarily exactly the return type of eval(). In the case of plain matrices, + * the return type of eval() is a const reference to a matrix, not a matrix! It is however guaranteed + * that the return type of eval() is either PlainObject or const PlainObject&. + */ + typedef Matrix::Scalar, + internal::traits::RowsAtCompileTime, + internal::traits::ColsAtCompileTime, + AutoAlign | (internal::traits::Flags&RowMajorBit ? RowMajor : ColMajor), + internal::traits::MaxRowsAtCompileTime, + internal::traits::MaxColsAtCompileTime + > PlainObject; + +#ifndef EIGEN_PARSED_BY_DOXYGEN + /** \internal Represents a matrix with all coefficients equal to one another*/ + typedef CwiseNullaryOp,Derived> ConstantReturnType; + /** \internal the return type of MatrixBase::adjoint() */ + typedef typename internal::conditional::IsComplex, + CwiseUnaryOp, ConstTransposeReturnType>, + ConstTransposeReturnType + >::type AdjointReturnType; + /** \internal Return type of eigenvalues() */ + typedef Matrix, internal::traits::ColsAtCompileTime, 1, ColMajor> EigenvaluesReturnType; + /** \internal the return type of identity */ + typedef CwiseNullaryOp,Derived> IdentityReturnType; + /** \internal the return type of unit vectors */ + typedef Block, SquareMatrixType>, + internal::traits::RowsAtCompileTime, + internal::traits::ColsAtCompileTime> BasisReturnType; +#endif // not EIGEN_PARSED_BY_DOXYGEN + +#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::MatrixBase +# include "../plugins/CommonCwiseUnaryOps.h" +# include "../plugins/CommonCwiseBinaryOps.h" +# include "../plugins/MatrixCwiseUnaryOps.h" +# include "../plugins/MatrixCwiseBinaryOps.h" +# ifdef EIGEN_MATRIXBASE_PLUGIN +# include EIGEN_MATRIXBASE_PLUGIN +# endif +#undef EIGEN_CURRENT_STORAGE_BASE_CLASS + + /** Special case of the template operator=, in order to prevent the compiler + * from generating a default operator= (issue hit with g++ 4.1) + */ + Derived& operator=(const MatrixBase& other); + + // We cannot inherit here via Base::operator= since it is causing + // trouble with MSVC. + + template + Derived& operator=(const DenseBase& other); + + template + Derived& operator=(const EigenBase& other); + + template + Derived& operator=(const ReturnByValue& other); + +#ifndef EIGEN_PARSED_BY_DOXYGEN + template + Derived& lazyAssign(const ProductBase& other); +#endif // not EIGEN_PARSED_BY_DOXYGEN + + template + Derived& operator+=(const MatrixBase& other); + template + Derived& operator-=(const MatrixBase& other); + + template + const typename ProductReturnType::Type + operator*(const MatrixBase &other) const; + + template + const typename LazyProductReturnType::Type + lazyProduct(const MatrixBase &other) const; + + template + Derived& operator*=(const EigenBase& other); + + template + void applyOnTheLeft(const EigenBase& other); + + template + void applyOnTheRight(const EigenBase& other); + + template + const DiagonalProduct + operator*(const DiagonalBase &diagonal) const; + + template + typename internal::scalar_product_traits::Scalar,typename internal::traits::Scalar>::ReturnType + dot(const MatrixBase& other) const; + + #ifdef EIGEN2_SUPPORT + template + Scalar eigen2_dot(const MatrixBase& other) const; + #endif + + RealScalar squaredNorm() const; + RealScalar norm() const; + RealScalar stableNorm() const; + RealScalar blueNorm() const; + RealScalar hypotNorm() const; + const PlainObject normalized() const; + void normalize(); + + const AdjointReturnType adjoint() const; + void adjointInPlace(); + + typedef Diagonal DiagonalReturnType; + DiagonalReturnType diagonal(); + typedef const Diagonal ConstDiagonalReturnType; + const ConstDiagonalReturnType diagonal() const; + + template struct DiagonalIndexReturnType { typedef Diagonal Type; }; + template struct ConstDiagonalIndexReturnType { typedef const Diagonal Type; }; + + template typename DiagonalIndexReturnType::Type diagonal(); + template typename ConstDiagonalIndexReturnType::Type diagonal() const; + + // Note: The "MatrixBase::" prefixes are added to help MSVC9 to match these declarations with the later implementations. + // On the other hand they confuse MSVC8... + #if (defined _MSC_VER) && (_MSC_VER >= 1500) // 2008 or later + typename MatrixBase::template DiagonalIndexReturnType::Type diagonal(Index index); + typename MatrixBase::template ConstDiagonalIndexReturnType::Type diagonal(Index index) const; + #else + typename DiagonalIndexReturnType::Type diagonal(Index index); + typename ConstDiagonalIndexReturnType::Type diagonal(Index index) const; + #endif + + #ifdef EIGEN2_SUPPORT + template typename internal::eigen2_part_return_type::type part(); + template const typename internal::eigen2_part_return_type::type part() const; + + // huuuge hack. make Eigen2's matrix.part() work in eigen3. Problem: Diagonal is now a class template instead + // of an integer constant. Solution: overload the part() method template wrt template parameters list. + template class U> + const DiagonalWrapper part() const + { return diagonal().asDiagonal(); } + #endif // EIGEN2_SUPPORT + + template struct TriangularViewReturnType { typedef TriangularView Type; }; + template struct ConstTriangularViewReturnType { typedef const TriangularView Type; }; + + template typename TriangularViewReturnType::Type triangularView(); + template typename ConstTriangularViewReturnType::Type triangularView() const; + + template struct SelfAdjointViewReturnType { typedef SelfAdjointView Type; }; + template struct ConstSelfAdjointViewReturnType { typedef const SelfAdjointView Type; }; + + template typename SelfAdjointViewReturnType::Type selfadjointView(); + template typename ConstSelfAdjointViewReturnType::Type selfadjointView() const; + + const SparseView sparseView(const Scalar& m_reference = Scalar(0), + typename NumTraits::Real m_epsilon = NumTraits::dummy_precision()) const; + static const IdentityReturnType Identity(); + static const IdentityReturnType Identity(Index rows, Index cols); + static const BasisReturnType Unit(Index size, Index i); + static const BasisReturnType Unit(Index i); + static const BasisReturnType UnitX(); + static const BasisReturnType UnitY(); + static const BasisReturnType UnitZ(); + static const BasisReturnType UnitW(); + + const DiagonalWrapper asDiagonal() const; + const PermutationWrapper asPermutation() const; + + Derived& setIdentity(); + Derived& setIdentity(Index rows, Index cols); + + bool isIdentity(RealScalar prec = NumTraits::dummy_precision()) const; + bool isDiagonal(RealScalar prec = NumTraits::dummy_precision()) const; + + bool isUpperTriangular(RealScalar prec = NumTraits::dummy_precision()) const; + bool isLowerTriangular(RealScalar prec = NumTraits::dummy_precision()) const; + + template + bool isOrthogonal(const MatrixBase& other, + RealScalar prec = NumTraits::dummy_precision()) const; + bool isUnitary(RealScalar prec = NumTraits::dummy_precision()) const; + + /** \returns true if each coefficients of \c *this and \a other are all exactly equal. + * \warning When using floating point scalar values you probably should rather use a + * fuzzy comparison such as isApprox() + * \sa isApprox(), operator!= */ + template + inline bool operator==(const MatrixBase& other) const + { return cwiseEqual(other).all(); } + + /** \returns true if at least one pair of coefficients of \c *this and \a other are not exactly equal to each other. + * \warning When using floating point scalar values you probably should rather use a + * fuzzy comparison such as isApprox() + * \sa isApprox(), operator== */ + template + inline bool operator!=(const MatrixBase& other) const + { return cwiseNotEqual(other).any(); } + + NoAlias noalias(); + + inline const ForceAlignedAccess forceAlignedAccess() const; + inline ForceAlignedAccess forceAlignedAccess(); + template inline typename internal::add_const_on_value_type,Derived&>::type>::type forceAlignedAccessIf() const; + template inline typename internal::conditional,Derived&>::type forceAlignedAccessIf(); + + Scalar trace() const; + +/////////// Array module /////////// + + template RealScalar lpNorm() const; + + MatrixBase& matrix() { return *this; } + const MatrixBase& matrix() const { return *this; } + + /** \returns an \link ArrayBase Array \endlink expression of this matrix + * \sa ArrayBase::matrix() */ + ArrayWrapper array() { return derived(); } + const ArrayWrapper array() const { return derived(); } + +/////////// LU module /////////// + + const FullPivLU fullPivLu() const; + const PartialPivLU partialPivLu() const; + + #if EIGEN2_SUPPORT_STAGE < STAGE20_RESOLVE_API_CONFLICTS + const LU lu() const; + #endif + + #ifdef EIGEN2_SUPPORT + const LU eigen2_lu() const; + #endif + + #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS + const PartialPivLU lu() const; + #endif + + #ifdef EIGEN2_SUPPORT + template + void computeInverse(MatrixBase *result) const { + *result = this->inverse(); + } + #endif + + const internal::inverse_impl inverse() const; + template + void computeInverseAndDetWithCheck( + ResultType& inverse, + typename ResultType::Scalar& determinant, + bool& invertible, + const RealScalar& absDeterminantThreshold = NumTraits::dummy_precision() + ) const; + template + void computeInverseWithCheck( + ResultType& inverse, + bool& invertible, + const RealScalar& absDeterminantThreshold = NumTraits::dummy_precision() + ) const; + Scalar determinant() const; + +/////////// Cholesky module /////////// + + const LLT llt() const; + const LDLT ldlt() const; + +/////////// QR module /////////// + + const HouseholderQR householderQr() const; + const ColPivHouseholderQR colPivHouseholderQr() const; + const FullPivHouseholderQR fullPivHouseholderQr() const; + + #ifdef EIGEN2_SUPPORT + const QR qr() const; + #endif + + EigenvaluesReturnType eigenvalues() const; + RealScalar operatorNorm() const; + +/////////// SVD module /////////// + + JacobiSVD jacobiSvd(unsigned int computationOptions = 0) const; + + #ifdef EIGEN2_SUPPORT + SVD svd() const; + #endif + +/////////// Geometry module /////////// + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /// \internal helper struct to form the return type of the cross product + template struct cross_product_return_type { + typedef typename internal::scalar_product_traits::Scalar,typename internal::traits::Scalar>::ReturnType Scalar; + typedef Matrix type; + }; + #endif // EIGEN_PARSED_BY_DOXYGEN + template + typename cross_product_return_type::type + cross(const MatrixBase& other) const; + template + PlainObject cross3(const MatrixBase& other) const; + PlainObject unitOrthogonal(void) const; + Matrix eulerAngles(Index a0, Index a1, Index a2) const; + + #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS + ScalarMultipleReturnType operator*(const UniformScaling& s) const; + // put this as separate enum value to work around possible GCC 4.3 bug (?) + enum { HomogeneousReturnTypeDirection = ColsAtCompileTime==1?Vertical:Horizontal }; + typedef Homogeneous HomogeneousReturnType; + HomogeneousReturnType homogeneous() const; + #endif + + enum { + SizeMinusOne = SizeAtCompileTime==Dynamic ? Dynamic : SizeAtCompileTime-1 + }; + typedef Block::ColsAtCompileTime==1 ? SizeMinusOne : 1, + internal::traits::ColsAtCompileTime==1 ? 1 : SizeMinusOne> ConstStartMinusOne; + typedef CwiseUnaryOp::Scalar>, + const ConstStartMinusOne > HNormalizedReturnType; + + const HNormalizedReturnType hnormalized() const; + +////////// Householder module /////////// + + void makeHouseholderInPlace(Scalar& tau, RealScalar& beta); + template + void makeHouseholder(EssentialPart& essential, + Scalar& tau, RealScalar& beta) const; + template + void applyHouseholderOnTheLeft(const EssentialPart& essential, + const Scalar& tau, + Scalar* workspace); + template + void applyHouseholderOnTheRight(const EssentialPart& essential, + const Scalar& tau, + Scalar* workspace); + +///////// Jacobi module ///////// + + template + void applyOnTheLeft(Index p, Index q, const JacobiRotation& j); + template + void applyOnTheRight(Index p, Index q, const JacobiRotation& j); + +///////// MatrixFunctions module ///////// + + typedef typename internal::stem_function::type StemFunction; + const MatrixExponentialReturnValue exp() const; + const MatrixFunctionReturnValue matrixFunction(StemFunction f) const; + const MatrixFunctionReturnValue cosh() const; + const MatrixFunctionReturnValue sinh() const; + const MatrixFunctionReturnValue cos() const; + const MatrixFunctionReturnValue sin() const; + +#ifdef EIGEN2_SUPPORT + template + Derived& operator+=(const Flagged, 0, + EvalBeforeAssigningBit>& other); + + template + Derived& operator-=(const Flagged, 0, + EvalBeforeAssigningBit>& other); + + /** \deprecated because .lazy() is deprecated + * Overloaded for cache friendly product evaluation */ + template + Derived& lazyAssign(const Flagged& other) + { return lazyAssign(other._expression()); } + + template + const Flagged marked() const; + const Flagged lazy() const; + + inline const Cwise cwise() const; + inline Cwise cwise(); + + VectorBlock start(Index size); + const VectorBlock start(Index size) const; + VectorBlock end(Index size); + const VectorBlock end(Index size) const; + template VectorBlock start(); + template const VectorBlock start() const; + template VectorBlock end(); + template const VectorBlock end() const; + + Minor minor(Index row, Index col); + const Minor minor(Index row, Index col) const; +#endif + + protected: + MatrixBase() : Base() {} + + private: + explicit MatrixBase(int); + MatrixBase(int,int); + template explicit MatrixBase(const MatrixBase&); + protected: + // mixing arrays and matrices is not legal + template Derived& operator+=(const ArrayBase& ) + {EIGEN_STATIC_ASSERT(sizeof(typename OtherDerived::Scalar)==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES);} + // mixing arrays and matrices is not legal + template Derived& operator-=(const ArrayBase& ) + {EIGEN_STATIC_ASSERT(sizeof(typename OtherDerived::Scalar)==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES);} +}; + +#endif // EIGEN_MATRIXBASE_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/NestByValue.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/NestByValue.h new file mode 100644 index 000000000..a6104d2a4 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/NestByValue.h @@ -0,0 +1,122 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_NESTBYVALUE_H +#define EIGEN_NESTBYVALUE_H + +/** \class NestByValue + * \ingroup Core_Module + * + * \brief Expression which must be nested by value + * + * \param ExpressionType the type of the object of which we are requiring nesting-by-value + * + * This class is the return type of MatrixBase::nestByValue() + * and most of the time this is the only way it is used. + * + * \sa MatrixBase::nestByValue() + */ + +namespace internal { +template +struct traits > : public traits +{}; +} + +template class NestByValue + : public internal::dense_xpr_base< NestByValue >::type +{ + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue) + + inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {} + + inline Index rows() const { return m_expression.rows(); } + inline Index cols() const { return m_expression.cols(); } + inline Index outerStride() const { return m_expression.outerStride(); } + inline Index innerStride() const { return m_expression.innerStride(); } + + inline const CoeffReturnType coeff(Index row, Index col) const + { + return m_expression.coeff(row, col); + } + + inline Scalar& coeffRef(Index row, Index col) + { + return m_expression.const_cast_derived().coeffRef(row, col); + } + + inline const CoeffReturnType coeff(Index index) const + { + return m_expression.coeff(index); + } + + inline Scalar& coeffRef(Index index) + { + return m_expression.const_cast_derived().coeffRef(index); + } + + template + inline const PacketScalar packet(Index row, Index col) const + { + return m_expression.template packet(row, col); + } + + template + inline void writePacket(Index row, Index col, const PacketScalar& x) + { + m_expression.const_cast_derived().template writePacket(row, col, x); + } + + template + inline const PacketScalar packet(Index index) const + { + return m_expression.template packet(index); + } + + template + inline void writePacket(Index index, const PacketScalar& x) + { + m_expression.const_cast_derived().template writePacket(index, x); + } + + operator const ExpressionType&() const { return m_expression; } + + protected: + const ExpressionType m_expression; +}; + +/** \returns an expression of the temporary version of *this. + */ +template +inline const NestByValue +DenseBase::nestByValue() const +{ + return NestByValue(derived()); +} + +#endif // EIGEN_NESTBYVALUE_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/NoAlias.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/NoAlias.h new file mode 100644 index 000000000..da64affcf --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/NoAlias.h @@ -0,0 +1,136 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_NOALIAS_H +#define EIGEN_NOALIAS_H + +/** \class NoAlias + * \ingroup Core_Module + * + * \brief Pseudo expression providing an operator = assuming no aliasing + * + * \param ExpressionType the type of the object on which to do the lazy assignment + * + * This class represents an expression with special assignment operators + * assuming no aliasing between the target expression and the source expression. + * More precisely it alloas to bypass the EvalBeforeAssignBit flag of the source expression. + * It is the return type of MatrixBase::noalias() + * and most of the time this is the only way it is used. + * + * \sa MatrixBase::noalias() + */ +template class StorageBase> +class NoAlias +{ + typedef typename ExpressionType::Scalar Scalar; + public: + NoAlias(ExpressionType& expression) : m_expression(expression) {} + + /** Behaves like MatrixBase::lazyAssign(other) + * \sa MatrixBase::lazyAssign() */ + template + EIGEN_STRONG_INLINE ExpressionType& operator=(const StorageBase& other) + { return internal::assign_selector::run(m_expression,other.derived()); } + + /** \sa MatrixBase::operator+= */ + template + EIGEN_STRONG_INLINE ExpressionType& operator+=(const StorageBase& other) + { + typedef SelfCwiseBinaryOp, ExpressionType, OtherDerived> SelfAdder; + SelfAdder tmp(m_expression); + typedef typename internal::nested::type OtherDerivedNested; + typedef typename internal::remove_all::type _OtherDerivedNested; + internal::assign_selector::run(tmp,OtherDerivedNested(other.derived())); + return m_expression; + } + + /** \sa MatrixBase::operator-= */ + template + EIGEN_STRONG_INLINE ExpressionType& operator-=(const StorageBase& other) + { + typedef SelfCwiseBinaryOp, ExpressionType, OtherDerived> SelfAdder; + SelfAdder tmp(m_expression); + typedef typename internal::nested::type OtherDerivedNested; + typedef typename internal::remove_all::type _OtherDerivedNested; + internal::assign_selector::run(tmp,OtherDerivedNested(other.derived())); + return m_expression; + } + +#ifndef EIGEN_PARSED_BY_DOXYGEN + template + EIGEN_STRONG_INLINE ExpressionType& operator+=(const ProductBase& other) + { other.derived().addTo(m_expression); return m_expression; } + + template + EIGEN_STRONG_INLINE ExpressionType& operator-=(const ProductBase& other) + { other.derived().subTo(m_expression); return m_expression; } + + template + EIGEN_STRONG_INLINE ExpressionType& operator+=(const CoeffBasedProduct& other) + { return m_expression.derived() += CoeffBasedProduct(other.lhs(), other.rhs()); } + + template + EIGEN_STRONG_INLINE ExpressionType& operator-=(const CoeffBasedProduct& other) + { return m_expression.derived() -= CoeffBasedProduct(other.lhs(), other.rhs()); } +#endif + + protected: + ExpressionType& m_expression; +}; + +/** \returns a pseudo expression of \c *this with an operator= assuming + * no aliasing between \c *this and the source expression. + * + * More precisely, noalias() allows to bypass the EvalBeforeAssignBit flag. + * Currently, even though several expressions may alias, only product + * expressions have this flag. Therefore, noalias() is only usefull when + * the source expression contains a matrix product. + * + * Here are some examples where noalias is usefull: + * \code + * D.noalias() = A * B; + * D.noalias() += A.transpose() * B; + * D.noalias() -= 2 * A * B.adjoint(); + * \endcode + * + * On the other hand the following example will lead to a \b wrong result: + * \code + * A.noalias() = A * B; + * \endcode + * because the result matrix A is also an operand of the matrix product. Therefore, + * there is no alternative than evaluating A * B in a temporary, that is the default + * behavior when you write: + * \code + * A = A * B; + * \endcode + * + * \sa class NoAlias + */ +template +NoAlias MatrixBase::noalias() +{ + return derived(); +} + +#endif // EIGEN_NOALIAS_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/NumTraits.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/NumTraits.h new file mode 100644 index 000000000..5c7762dae --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/NumTraits.h @@ -0,0 +1,160 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2010 Benoit Jacob +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_NUMTRAITS_H +#define EIGEN_NUMTRAITS_H + +/** \class NumTraits + * \ingroup Core_Module + * + * \brief Holds information about the various numeric (i.e. scalar) types allowed by Eigen. + * + * \param T the numeric type at hand + * + * This class stores enums, typedefs and static methods giving information about a numeric type. + * + * The provided data consists of: + * \li A typedef \a Real, giving the "real part" type of \a T. If \a T is already real, + * then \a Real is just a typedef to \a T. If \a T is \c std::complex then \a Real + * is a typedef to \a U. + * \li A typedef \a NonInteger, giving the type that should be used for operations producing non-integral values, + * such as quotients, square roots, etc. If \a T is a floating-point type, then this typedef just gives + * \a T again. Note however that many Eigen functions such as internal::sqrt simply refuse to + * take integers. Outside of a few cases, Eigen doesn't do automatic type promotion. Thus, this typedef is + * only intended as a helper for code that needs to explicitly promote types. + * \li A typedef \a Nested giving the type to use to nest a value inside of the expression tree. If you don't know what + * this means, just use \a T here. + * \li An enum value \a IsComplex. It is equal to 1 if \a T is a \c std::complex + * type, and to 0 otherwise. + * \li An enum value \a IsInteger. It is equal to \c 1 if \a T is an integer type such as \c int, + * and to \c 0 otherwise. + * \li Enum values ReadCost, AddCost and MulCost representing a rough estimate of the number of CPU cycles needed + * to by move / add / mul instructions respectively, assuming the data is already stored in CPU registers. + * Stay vague here. No need to do architecture-specific stuff. + * \li An enum value \a IsSigned. It is equal to \c 1 if \a T is a signed type and to 0 if \a T is unsigned. + * \li An enum value \a RequireInitialization. It is equal to \c 1 if the constructor of the numeric type \a T must + * be called, and to 0 if it is safe not to call it. Default is 0 if \a T is an arithmetic type, and 1 otherwise. + * \li An epsilon() function which, unlike std::numeric_limits::epsilon(), returns a \a Real instead of a \a T. + * \li A dummy_precision() function returning a weak epsilon value. It is mainly used as a default + * value by the fuzzy comparison operators. + * \li highest() and lowest() functions returning the highest and lowest possible values respectively. + */ + +template struct GenericNumTraits +{ + enum { + IsInteger = std::numeric_limits::is_integer, + IsSigned = std::numeric_limits::is_signed, + IsComplex = 0, + RequireInitialization = internal::is_arithmetic::value ? 0 : 1, + ReadCost = 1, + AddCost = 1, + MulCost = 1 + }; + + typedef T Real; + typedef typename internal::conditional< + IsInteger, + typename internal::conditional::type, + T + >::type NonInteger; + typedef T Nested; + + inline static Real epsilon() { return std::numeric_limits::epsilon(); } + inline static Real dummy_precision() + { + // make sure to override this for floating-point types + return Real(0); + } + inline static T highest() { return std::numeric_limits::max(); } + inline static T lowest() { return IsInteger ? std::numeric_limits::min() : (-std::numeric_limits::max()); } + +#ifdef EIGEN2_SUPPORT + enum { + HasFloatingPoint = !IsInteger + }; + typedef NonInteger FloatingPoint; +#endif +}; + +template struct NumTraits : GenericNumTraits +{}; + +template<> struct NumTraits + : GenericNumTraits +{ + inline static float dummy_precision() { return 1e-5f; } +}; + +template<> struct NumTraits : GenericNumTraits +{ + inline static double dummy_precision() { return 1e-12; } +}; + +template<> struct NumTraits + : GenericNumTraits +{ + static inline long double dummy_precision() { return 1e-15l; } +}; + +template struct NumTraits > + : GenericNumTraits > +{ + typedef _Real Real; + enum { + IsComplex = 1, + RequireInitialization = NumTraits<_Real>::RequireInitialization, + ReadCost = 2 * NumTraits<_Real>::ReadCost, + AddCost = 2 * NumTraits::AddCost, + MulCost = 4 * NumTraits::MulCost + 2 * NumTraits::AddCost + }; + + inline static Real epsilon() { return NumTraits::epsilon(); } + inline static Real dummy_precision() { return NumTraits::dummy_precision(); } +}; + +template +struct NumTraits > +{ + typedef Array ArrayType; + typedef typename NumTraits::Real RealScalar; + typedef Array Real; + typedef typename NumTraits::NonInteger NonIntegerScalar; + typedef Array NonInteger; + typedef ArrayType & Nested; + + enum { + IsComplex = NumTraits::IsComplex, + IsInteger = NumTraits::IsInteger, + IsSigned = NumTraits::IsSigned, + RequireInitialization = 1, + ReadCost = ArrayType::SizeAtCompileTime==Dynamic ? Dynamic : ArrayType::SizeAtCompileTime * NumTraits::ReadCost, + AddCost = ArrayType::SizeAtCompileTime==Dynamic ? Dynamic : ArrayType::SizeAtCompileTime * NumTraits::AddCost, + MulCost = ArrayType::SizeAtCompileTime==Dynamic ? Dynamic : ArrayType::SizeAtCompileTime * NumTraits::MulCost + }; +}; + + + +#endif // EIGEN_NUMTRAITS_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/PermutationMatrix.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/PermutationMatrix.h new file mode 100644 index 000000000..a064e053e --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/PermutationMatrix.h @@ -0,0 +1,696 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Benoit Jacob +// Copyright (C) 2009-2011 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_PERMUTATIONMATRIX_H +#define EIGEN_PERMUTATIONMATRIX_H + +template class PermutedImpl; + +/** \class PermutationBase + * \ingroup Core_Module + * + * \brief Base class for permutations + * + * \param Derived the derived class + * + * This class is the base class for all expressions representing a permutation matrix, + * internally stored as a vector of integers. + * The convention followed here is that if \f$ \sigma \f$ is a permutation, the corresponding permutation matrix + * \f$ P_\sigma \f$ is such that if \f$ (e_1,\ldots,e_p) \f$ is the canonical basis, we have: + * \f[ P_\sigma(e_i) = e_{\sigma(i)}. \f] + * This convention ensures that for any two permutations \f$ \sigma, \tau \f$, we have: + * \f[ P_{\sigma\circ\tau} = P_\sigma P_\tau. \f] + * + * Permutation matrices are square and invertible. + * + * Notice that in addition to the member functions and operators listed here, there also are non-member + * operator* to multiply any kind of permutation object with any kind of matrix expression (MatrixBase) + * on either side. + * + * \sa class PermutationMatrix, class PermutationWrapper + */ + +namespace internal { + +template +struct permut_matrix_product_retval; +enum PermPermProduct_t {PermPermProduct}; + +} // end namespace internal + +template +class PermutationBase : public EigenBase +{ + typedef internal::traits Traits; + typedef EigenBase Base; + public: + + #ifndef EIGEN_PARSED_BY_DOXYGEN + typedef typename Traits::IndicesType IndicesType; + enum { + Flags = Traits::Flags, + CoeffReadCost = Traits::CoeffReadCost, + RowsAtCompileTime = Traits::RowsAtCompileTime, + ColsAtCompileTime = Traits::ColsAtCompileTime, + MaxRowsAtCompileTime = Traits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = Traits::MaxColsAtCompileTime + }; + typedef typename Traits::Scalar Scalar; + typedef typename Traits::Index Index; + typedef Matrix + DenseMatrixType; + typedef PermutationMatrix + PlainPermutationType; + using Base::derived; + #endif + + /** Copies the other permutation into *this */ + template + Derived& operator=(const PermutationBase& other) + { + indices() = other.indices(); + return derived(); + } + + /** Assignment from the Transpositions \a tr */ + template + Derived& operator=(const TranspositionsBase& tr) + { + setIdentity(tr.size()); + for(Index k=size()-1; k>=0; --k) + applyTranspositionOnTheRight(k,tr.coeff(k)); + return derived(); + } + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /** This is a special case of the templated operator=. Its purpose is to + * prevent a default operator= from hiding the templated operator=. + */ + Derived& operator=(const PermutationBase& other) + { + indices() = other.indices(); + return derived(); + } + #endif + + /** \returns the number of rows */ + inline Index rows() const { return indices().size(); } + + /** \returns the number of columns */ + inline Index cols() const { return indices().size(); } + + /** \returns the size of a side of the respective square matrix, i.e., the number of indices */ + inline Index size() const { return indices().size(); } + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + void evalTo(MatrixBase& other) const + { + other.setZero(); + for (int i=0; i=0 && j>=0 && i=0 && j>=0 && i inverse() const + { return derived(); } + /** \returns the tranpose permutation matrix. + * + * \note \note_try_to_help_rvo + */ + inline Transpose transpose() const + { return derived(); } + + /**** multiplication helpers to hopefully get RVO ****/ + + +#ifndef EIGEN_PARSED_BY_DOXYGEN + protected: + template + void assignTranspose(const PermutationBase& other) + { + for (int i=0; i + void assignProduct(const Lhs& lhs, const Rhs& rhs) + { + eigen_assert(lhs.cols() == rhs.rows()); + for (int i=0; i + inline PlainPermutationType operator*(const PermutationBase& other) const + { return PlainPermutationType(internal::PermPermProduct, derived(), other.derived()); } + + /** \returns the product of a permutation with another inverse permutation. + * + * \note \note_try_to_help_rvo + */ + template + inline PlainPermutationType operator*(const Transpose >& other) const + { return PlainPermutationType(internal::PermPermProduct, *this, other.eval()); } + + /** \returns the product of an inverse permutation with another permutation. + * + * \note \note_try_to_help_rvo + */ + template friend + inline PlainPermutationType operator*(const Transpose >& other, const PermutationBase& perm) + { return PlainPermutationType(internal::PermPermProduct, other.eval(), perm); } + + protected: + +}; + +/** \class PermutationMatrix + * \ingroup Core_Module + * + * \brief Permutation matrix + * + * \param SizeAtCompileTime the number of rows/cols, or Dynamic + * \param MaxSizeAtCompileTime the maximum number of rows/cols, or Dynamic. This optional parameter defaults to SizeAtCompileTime. Most of the time, you should not have to specify it. + * \param IndexType the interger type of the indices + * + * This class represents a permutation matrix, internally stored as a vector of integers. + * + * \sa class PermutationBase, class PermutationWrapper, class DiagonalMatrix + */ + +namespace internal { +template +struct traits > + : traits > +{ + typedef IndexType Index; + typedef Matrix IndicesType; +}; +} + +template +class PermutationMatrix : public PermutationBase > +{ + typedef PermutationBase Base; + typedef internal::traits Traits; + public: + + #ifndef EIGEN_PARSED_BY_DOXYGEN + typedef typename Traits::IndicesType IndicesType; + #endif + + inline PermutationMatrix() + {} + + /** Constructs an uninitialized permutation matrix of given size. + */ + inline PermutationMatrix(int size) : m_indices(size) + {} + + /** Copy constructor. */ + template + inline PermutationMatrix(const PermutationBase& other) + : m_indices(other.indices()) {} + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /** Standard copy constructor. Defined only to prevent a default copy constructor + * from hiding the other templated constructor */ + inline PermutationMatrix(const PermutationMatrix& other) : m_indices(other.indices()) {} + #endif + + /** Generic constructor from expression of the indices. The indices + * array has the meaning that the permutations sends each integer i to indices[i]. + * + * \warning It is your responsibility to check that the indices array that you passes actually + * describes a permutation, i.e., each value between 0 and n-1 occurs exactly once, where n is the + * array's size. + */ + template + explicit inline PermutationMatrix(const MatrixBase& indices) : m_indices(indices) + {} + + /** Convert the Transpositions \a tr to a permutation matrix */ + template + explicit PermutationMatrix(const TranspositionsBase& tr) + : m_indices(tr.size()) + { + *this = tr; + } + + /** Copies the other permutation into *this */ + template + PermutationMatrix& operator=(const PermutationBase& other) + { + m_indices = other.indices(); + return *this; + } + + /** Assignment from the Transpositions \a tr */ + template + PermutationMatrix& operator=(const TranspositionsBase& tr) + { + return Base::operator=(tr.derived()); + } + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /** This is a special case of the templated operator=. Its purpose is to + * prevent a default operator= from hiding the templated operator=. + */ + PermutationMatrix& operator=(const PermutationMatrix& other) + { + m_indices = other.m_indices; + return *this; + } + #endif + + /** const version of indices(). */ + const IndicesType& indices() const { return m_indices; } + /** \returns a reference to the stored array representing the permutation. */ + IndicesType& indices() { return m_indices; } + + + /**** multiplication helpers to hopefully get RVO ****/ + +#ifndef EIGEN_PARSED_BY_DOXYGEN + template + PermutationMatrix(const Transpose >& other) + : m_indices(other.nestedPermutation().size()) + { + for (int i=0; i + PermutationMatrix(internal::PermPermProduct_t, const Lhs& lhs, const Rhs& rhs) + : m_indices(lhs.indices().size()) + { + Base::assignProduct(lhs,rhs); + } +#endif + + protected: + + IndicesType m_indices; +}; + + +namespace internal { +template +struct traits,_PacketAccess> > + : traits > +{ + typedef IndexType Index; + typedef Map, _PacketAccess> IndicesType; +}; +} + +template +class Map,_PacketAccess> + : public PermutationBase,_PacketAccess> > +{ + typedef PermutationBase Base; + typedef internal::traits Traits; + public: + + #ifndef EIGEN_PARSED_BY_DOXYGEN + typedef typename Traits::IndicesType IndicesType; + typedef typename IndicesType::Scalar Index; + #endif + + inline Map(const Index* indices) + : m_indices(indices) + {} + + inline Map(const Index* indices, Index size) + : m_indices(indices,size) + {} + + /** Copies the other permutation into *this */ + template + Map& operator=(const PermutationBase& other) + { return Base::operator=(other.derived()); } + + /** Assignment from the Transpositions \a tr */ + template + Map& operator=(const TranspositionsBase& tr) + { return Base::operator=(tr.derived()); } + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /** This is a special case of the templated operator=. Its purpose is to + * prevent a default operator= from hiding the templated operator=. + */ + Map& operator=(const Map& other) + { + m_indices = other.m_indices; + return *this; + } + #endif + + /** const version of indices(). */ + const IndicesType& indices() const { return m_indices; } + /** \returns a reference to the stored array representing the permutation. */ + IndicesType& indices() { return m_indices; } + + protected: + + IndicesType m_indices; +}; + +/** \class PermutationWrapper + * \ingroup Core_Module + * + * \brief Class to view a vector of integers as a permutation matrix + * + * \param _IndicesType the type of the vector of integer (can be any compatible expression) + * + * This class allows to view any vector expression of integers as a permutation matrix. + * + * \sa class PermutationBase, class PermutationMatrix + */ + +struct PermutationStorage {}; + +template class TranspositionsWrapper; +namespace internal { +template +struct traits > +{ + typedef PermutationStorage StorageKind; + typedef typename _IndicesType::Scalar Scalar; + typedef typename _IndicesType::Scalar Index; + typedef _IndicesType IndicesType; + enum { + RowsAtCompileTime = _IndicesType::SizeAtCompileTime, + ColsAtCompileTime = _IndicesType::SizeAtCompileTime, + MaxRowsAtCompileTime = IndicesType::MaxRowsAtCompileTime, + MaxColsAtCompileTime = IndicesType::MaxColsAtCompileTime, + Flags = 0, + CoeffReadCost = _IndicesType::CoeffReadCost + }; +}; +} + +template +class PermutationWrapper : public PermutationBase > +{ + typedef PermutationBase Base; + typedef internal::traits Traits; + public: + + #ifndef EIGEN_PARSED_BY_DOXYGEN + typedef typename Traits::IndicesType IndicesType; + #endif + + inline PermutationWrapper(const IndicesType& indices) + : m_indices(indices) + {} + + /** const version of indices(). */ + const typename internal::remove_all::type& + indices() const { return m_indices; } + + protected: + + const typename IndicesType::Nested m_indices; +}; + +/** \returns the matrix with the permutation applied to the columns. + */ +template +inline const internal::permut_matrix_product_retval +operator*(const MatrixBase& matrix, + const PermutationBase &permutation) +{ + return internal::permut_matrix_product_retval + + (permutation.derived(), matrix.derived()); +} + +/** \returns the matrix with the permutation applied to the rows. + */ +template +inline const internal::permut_matrix_product_retval + +operator*(const PermutationBase &permutation, + const MatrixBase& matrix) +{ + return internal::permut_matrix_product_retval + + (permutation.derived(), matrix.derived()); +} + +namespace internal { + +template +struct traits > +{ + typedef typename MatrixType::PlainObject ReturnType; +}; + +template +struct permut_matrix_product_retval + : public ReturnByValue > +{ + typedef typename remove_all::type MatrixTypeNestedCleaned; + + permut_matrix_product_retval(const PermutationType& perm, const MatrixType& matrix) + : m_permutation(perm), m_matrix(matrix) + {} + + inline int rows() const { return m_matrix.rows(); } + inline int cols() const { return m_matrix.cols(); } + + template inline void evalTo(Dest& dst) const + { + const int n = Side==OnTheLeft ? rows() : cols(); + + if(is_same::value && extract_data(dst) == extract_data(m_matrix)) + { + // apply the permutation inplace + Matrix mask(m_permutation.size()); + mask.fill(false); + int r = 0; + while(r < m_permutation.size()) + { + // search for the next seed + while(r=m_permutation.size()) + break; + // we got one, let's follow it until we are back to the seed + int k0 = r++; + int kPrev = k0; + mask.coeffRef(k0) = true; + for(int k=m_permutation.indices().coeff(k0); k!=k0; k=m_permutation.indices().coeff(k)) + { + Block(dst, k) + .swap(Block + (dst,((Side==OnTheLeft) ^ Transposed) ? k0 : kPrev)); + + mask.coeffRef(k) = true; + kPrev = k; + } + } + } + else + { + for(int i = 0; i < n; ++i) + { + Block + (dst, ((Side==OnTheLeft) ^ Transposed) ? m_permutation.indices().coeff(i) : i) + + = + + Block + (m_matrix, ((Side==OnTheRight) ^ Transposed) ? m_permutation.indices().coeff(i) : i); + } + } + } + + protected: + const PermutationType& m_permutation; + const typename MatrixType::Nested m_matrix; +}; + +/* Template partial specialization for transposed/inverse permutations */ + +template +struct traits > > + : traits +{}; + +} // end namespace internal + +template +class Transpose > + : public EigenBase > > +{ + typedef Derived PermutationType; + typedef typename PermutationType::IndicesType IndicesType; + typedef typename PermutationType::PlainPermutationType PlainPermutationType; + public: + + #ifndef EIGEN_PARSED_BY_DOXYGEN + typedef internal::traits Traits; + typedef typename Derived::DenseMatrixType DenseMatrixType; + enum { + Flags = Traits::Flags, + CoeffReadCost = Traits::CoeffReadCost, + RowsAtCompileTime = Traits::RowsAtCompileTime, + ColsAtCompileTime = Traits::ColsAtCompileTime, + MaxRowsAtCompileTime = Traits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = Traits::MaxColsAtCompileTime + }; + typedef typename Traits::Scalar Scalar; + #endif + + Transpose(const PermutationType& p) : m_permutation(p) {} + + inline int rows() const { return m_permutation.rows(); } + inline int cols() const { return m_permutation.cols(); } + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + void evalTo(MatrixBase& other) const + { + other.setZero(); + for (int i=0; i friend + inline const internal::permut_matrix_product_retval + operator*(const MatrixBase& matrix, const Transpose& trPerm) + { + return internal::permut_matrix_product_retval(trPerm.m_permutation, matrix.derived()); + } + + /** \returns the matrix with the inverse permutation applied to the rows. + */ + template + inline const internal::permut_matrix_product_retval + operator*(const MatrixBase& matrix) const + { + return internal::permut_matrix_product_retval(m_permutation, matrix.derived()); + } + + const PermutationType& nestedPermutation() const { return m_permutation; } + + protected: + const PermutationType& m_permutation; +}; + +template +const PermutationWrapper MatrixBase::asPermutation() const +{ + return derived(); +} + +#endif // EIGEN_PERMUTATIONMATRIX_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/PlainObjectBase.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/PlainObjectBase.h new file mode 100644 index 000000000..5358cb572 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/PlainObjectBase.h @@ -0,0 +1,740 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2009 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_DENSESTORAGEBASE_H +#define EIGEN_DENSESTORAGEBASE_H + +#ifdef EIGEN_INITIALIZE_MATRICES_BY_ZERO +# define EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED for(int i=0;i(Derived::IsVectorAtCompileTime)> struct conservative_resize_like_impl; + +template struct matrix_swap_impl; + +} // end namespace internal + +/** + * \brief %Dense storage base class for matrices and arrays. + * + * This class can be extended with the help of the plugin mechanism described on the page + * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_PLAINOBJECTBASE_PLUGIN. + * + * \sa \ref TopicClassHierarchy + */ +template +class PlainObjectBase : public internal::dense_xpr_base::type +{ + public: + enum { Options = internal::traits::Options }; + typedef typename internal::dense_xpr_base::type Base; + + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::Index Index; + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::packet_traits::type PacketScalar; + typedef typename NumTraits::Real RealScalar; + typedef Derived DenseType; + + using Base::RowsAtCompileTime; + using Base::ColsAtCompileTime; + using Base::SizeAtCompileTime; + using Base::MaxRowsAtCompileTime; + using Base::MaxColsAtCompileTime; + using Base::MaxSizeAtCompileTime; + using Base::IsVectorAtCompileTime; + using Base::Flags; + + template friend class Eigen::Map; + friend class Eigen::Map; + typedef Eigen::Map MapType; + friend class Eigen::Map; + typedef const Eigen::Map ConstMapType; + friend class Eigen::Map; + typedef Eigen::Map AlignedMapType; + friend class Eigen::Map; + typedef const Eigen::Map ConstAlignedMapType; + template struct StridedMapType { typedef Eigen::Map type; }; + template struct StridedConstMapType { typedef Eigen::Map type; }; + template struct StridedAlignedMapType { typedef Eigen::Map type; }; + template struct StridedConstAlignedMapType { typedef Eigen::Map type; }; + + + protected: + DenseStorage m_storage; + + public: + enum { NeedsToAlign = (!(Options&DontAlign)) + && SizeAtCompileTime!=Dynamic && ((static_cast(sizeof(Scalar))*SizeAtCompileTime)%16)==0 }; + EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) + + Base& base() { return *static_cast(this); } + const Base& base() const { return *static_cast(this); } + + EIGEN_STRONG_INLINE Index rows() const { return m_storage.rows(); } + EIGEN_STRONG_INLINE Index cols() const { return m_storage.cols(); } + + EIGEN_STRONG_INLINE const Scalar& coeff(Index row, Index col) const + { + if(Flags & RowMajorBit) + return m_storage.data()[col + row * m_storage.cols()]; + else // column-major + return m_storage.data()[row + col * m_storage.rows()]; + } + + EIGEN_STRONG_INLINE const Scalar& coeff(Index index) const + { + return m_storage.data()[index]; + } + + EIGEN_STRONG_INLINE Scalar& coeffRef(Index row, Index col) + { + if(Flags & RowMajorBit) + return m_storage.data()[col + row * m_storage.cols()]; + else // column-major + return m_storage.data()[row + col * m_storage.rows()]; + } + + EIGEN_STRONG_INLINE Scalar& coeffRef(Index index) + { + return m_storage.data()[index]; + } + + EIGEN_STRONG_INLINE const Scalar& coeffRef(Index row, Index col) const + { + if(Flags & RowMajorBit) + return m_storage.data()[col + row * m_storage.cols()]; + else // column-major + return m_storage.data()[row + col * m_storage.rows()]; + } + + EIGEN_STRONG_INLINE const Scalar& coeffRef(Index index) const + { + return m_storage.data()[index]; + } + + /** \internal */ + template + EIGEN_STRONG_INLINE PacketScalar packet(Index row, Index col) const + { + return internal::ploadt + (m_storage.data() + (Flags & RowMajorBit + ? col + row * m_storage.cols() + : row + col * m_storage.rows())); + } + + /** \internal */ + template + EIGEN_STRONG_INLINE PacketScalar packet(Index index) const + { + return internal::ploadt(m_storage.data() + index); + } + + /** \internal */ + template + EIGEN_STRONG_INLINE void writePacket(Index row, Index col, const PacketScalar& x) + { + internal::pstoret + (m_storage.data() + (Flags & RowMajorBit + ? col + row * m_storage.cols() + : row + col * m_storage.rows()), x); + } + + /** \internal */ + template + EIGEN_STRONG_INLINE void writePacket(Index index, const PacketScalar& x) + { + internal::pstoret(m_storage.data() + index, x); + } + + /** \returns a const pointer to the data array of this matrix */ + EIGEN_STRONG_INLINE const Scalar *data() const + { return m_storage.data(); } + + /** \returns a pointer to the data array of this matrix */ + EIGEN_STRONG_INLINE Scalar *data() + { return m_storage.data(); } + + /** Resizes \c *this to a \a rows x \a cols matrix. + * + * This method is intended for dynamic-size matrices, although it is legal to call it on any + * matrix as long as fixed dimensions are left unchanged. If you only want to change the number + * of rows and/or of columns, you can use resize(NoChange_t, Index), resize(Index, NoChange_t). + * + * If the current number of coefficients of \c *this exactly matches the + * product \a rows * \a cols, then no memory allocation is performed and + * the current values are left unchanged. In all other cases, including + * shrinking, the data is reallocated and all previous values are lost. + * + * Example: \include Matrix_resize_int_int.cpp + * Output: \verbinclude Matrix_resize_int_int.out + * + * \sa resize(Index) for vectors, resize(NoChange_t, Index), resize(Index, NoChange_t) + */ + EIGEN_STRONG_INLINE void resize(Index rows, Index cols) + { + #ifdef EIGEN_INITIALIZE_MATRICES_BY_ZERO + Index size = rows*cols; + bool size_changed = size != this->size(); + m_storage.resize(size, rows, cols); + if(size_changed) EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + #else + m_storage.resize(rows*cols, rows, cols); + #endif + } + + /** Resizes \c *this to a vector of length \a size + * + * \only_for_vectors. This method does not work for + * partially dynamic matrices when the static dimension is anything other + * than 1. For example it will not work with Matrix. + * + * Example: \include Matrix_resize_int.cpp + * Output: \verbinclude Matrix_resize_int.out + * + * \sa resize(Index,Index), resize(NoChange_t, Index), resize(Index, NoChange_t) + */ + inline void resize(Index size) + { + EIGEN_STATIC_ASSERT_VECTOR_ONLY(PlainObjectBase) + eigen_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == size); + #ifdef EIGEN_INITIALIZE_MATRICES_BY_ZERO + bool size_changed = size != this->size(); + #endif + if(RowsAtCompileTime == 1) + m_storage.resize(size, 1, size); + else + m_storage.resize(size, size, 1); + #ifdef EIGEN_INITIALIZE_MATRICES_BY_ZERO + if(size_changed) EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + #endif + } + + /** Resizes the matrix, changing only the number of columns. For the parameter of type NoChange_t, just pass the special value \c NoChange + * as in the example below. + * + * Example: \include Matrix_resize_NoChange_int.cpp + * Output: \verbinclude Matrix_resize_NoChange_int.out + * + * \sa resize(Index,Index) + */ + inline void resize(NoChange_t, Index cols) + { + resize(rows(), cols); + } + + /** Resizes the matrix, changing only the number of rows. For the parameter of type NoChange_t, just pass the special value \c NoChange + * as in the example below. + * + * Example: \include Matrix_resize_int_NoChange.cpp + * Output: \verbinclude Matrix_resize_int_NoChange.out + * + * \sa resize(Index,Index) + */ + inline void resize(Index rows, NoChange_t) + { + resize(rows, cols()); + } + + /** Resizes \c *this to have the same dimensions as \a other. + * Takes care of doing all the checking that's needed. + * + * Note that copying a row-vector into a vector (and conversely) is allowed. + * The resizing, if any, is then done in the appropriate way so that row-vectors + * remain row-vectors and vectors remain vectors. + */ + template + EIGEN_STRONG_INLINE void resizeLike(const EigenBase& _other) + { + const OtherDerived& other = _other.derived(); + const Index othersize = other.rows()*other.cols(); + if(RowsAtCompileTime == 1) + { + eigen_assert(other.rows() == 1 || other.cols() == 1); + resize(1, othersize); + } + else if(ColsAtCompileTime == 1) + { + eigen_assert(other.rows() == 1 || other.cols() == 1); + resize(othersize, 1); + } + else resize(other.rows(), other.cols()); + } + + /** Resizes the matrix to \a rows x \a cols while leaving old values untouched. + * + * The method is intended for matrices of dynamic size. If you only want to change the number + * of rows and/or of columns, you can use conservativeResize(NoChange_t, Index) or + * conservativeResize(Index, NoChange_t). + * + * Matrices are resized relative to the top-left element. In case values need to be + * appended to the matrix they will be uninitialized. + */ + EIGEN_STRONG_INLINE void conservativeResize(Index rows, Index cols) + { + internal::conservative_resize_like_impl::run(*this, rows, cols); + } + + /** Resizes the matrix to \a rows x \a cols while leaving old values untouched. + * + * As opposed to conservativeResize(Index rows, Index cols), this version leaves + * the number of columns unchanged. + * + * In case the matrix is growing, new rows will be uninitialized. + */ + EIGEN_STRONG_INLINE void conservativeResize(Index rows, NoChange_t) + { + // Note: see the comment in conservativeResize(Index,Index) + conservativeResize(rows, cols()); + } + + /** Resizes the matrix to \a rows x \a cols while leaving old values untouched. + * + * As opposed to conservativeResize(Index rows, Index cols), this version leaves + * the number of rows unchanged. + * + * In case the matrix is growing, new columns will be uninitialized. + */ + EIGEN_STRONG_INLINE void conservativeResize(NoChange_t, Index cols) + { + // Note: see the comment in conservativeResize(Index,Index) + conservativeResize(rows(), cols); + } + + /** Resizes the vector to \a size while retaining old values. + * + * \only_for_vectors. This method does not work for + * partially dynamic matrices when the static dimension is anything other + * than 1. For example it will not work with Matrix. + * + * When values are appended, they will be uninitialized. + */ + EIGEN_STRONG_INLINE void conservativeResize(Index size) + { + internal::conservative_resize_like_impl::run(*this, size); + } + + /** Resizes the matrix to \a rows x \a cols of \c other, while leaving old values untouched. + * + * The method is intended for matrices of dynamic size. If you only want to change the number + * of rows and/or of columns, you can use conservativeResize(NoChange_t, Index) or + * conservativeResize(Index, NoChange_t). + * + * Matrices are resized relative to the top-left element. In case values need to be + * appended to the matrix they will copied from \c other. + */ + template + EIGEN_STRONG_INLINE void conservativeResizeLike(const DenseBase& other) + { + internal::conservative_resize_like_impl::run(*this, other); + } + + /** This is a special case of the templated operator=. Its purpose is to + * prevent a default operator= from hiding the templated operator=. + */ + EIGEN_STRONG_INLINE Derived& operator=(const PlainObjectBase& other) + { + return _set(other); + } + + /** \sa MatrixBase::lazyAssign() */ + template + EIGEN_STRONG_INLINE Derived& lazyAssign(const DenseBase& other) + { + _resize_to_match(other); + return Base::lazyAssign(other.derived()); + } + + template + EIGEN_STRONG_INLINE Derived& operator=(const ReturnByValue& func) + { + resize(func.rows(), func.cols()); + return Base::operator=(func); + } + + EIGEN_STRONG_INLINE explicit PlainObjectBase() : m_storage() + { +// _check_template_params(); +// EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + } + +#ifndef EIGEN_PARSED_BY_DOXYGEN + // FIXME is it still needed ? + /** \internal */ + PlainObjectBase(internal::constructor_without_unaligned_array_assert) + : m_storage(internal::constructor_without_unaligned_array_assert()) + { +// _check_template_params(); EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + } +#endif + + EIGEN_STRONG_INLINE PlainObjectBase(Index size, Index rows, Index cols) + : m_storage(size, rows, cols) + { +// _check_template_params(); +// EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + } + + /** \copydoc MatrixBase::operator=(const EigenBase&) + */ + template + EIGEN_STRONG_INLINE Derived& operator=(const EigenBase &other) + { + _resize_to_match(other); + Base::operator=(other.derived()); + return this->derived(); + } + + /** \sa MatrixBase::operator=(const EigenBase&) */ + template + EIGEN_STRONG_INLINE PlainObjectBase(const EigenBase &other) + : m_storage(other.derived().rows() * other.derived().cols(), other.derived().rows(), other.derived().cols()) + { + _check_template_params(); + Base::operator=(other.derived()); + } + + /** \name Map + * These are convenience functions returning Map objects. The Map() static functions return unaligned Map objects, + * while the AlignedMap() functions return aligned Map objects and thus should be called only with 16-byte-aligned + * \a data pointers. + * + * These methods do not allow to specify strides. If you need to specify strides, you have to + * use the Map class directly. + * + * \see class Map + */ + //@{ + inline static ConstMapType Map(const Scalar* data) + { return ConstMapType(data); } + inline static MapType Map(Scalar* data) + { return MapType(data); } + inline static ConstMapType Map(const Scalar* data, Index size) + { return ConstMapType(data, size); } + inline static MapType Map(Scalar* data, Index size) + { return MapType(data, size); } + inline static ConstMapType Map(const Scalar* data, Index rows, Index cols) + { return ConstMapType(data, rows, cols); } + inline static MapType Map(Scalar* data, Index rows, Index cols) + { return MapType(data, rows, cols); } + + inline static ConstAlignedMapType MapAligned(const Scalar* data) + { return ConstAlignedMapType(data); } + inline static AlignedMapType MapAligned(Scalar* data) + { return AlignedMapType(data); } + inline static ConstAlignedMapType MapAligned(const Scalar* data, Index size) + { return ConstAlignedMapType(data, size); } + inline static AlignedMapType MapAligned(Scalar* data, Index size) + { return AlignedMapType(data, size); } + inline static ConstAlignedMapType MapAligned(const Scalar* data, Index rows, Index cols) + { return ConstAlignedMapType(data, rows, cols); } + inline static AlignedMapType MapAligned(Scalar* data, Index rows, Index cols) + { return AlignedMapType(data, rows, cols); } + + template + inline static typename StridedConstMapType >::type Map(const Scalar* data, const Stride& stride) + { return typename StridedConstMapType >::type(data, stride); } + template + inline static typename StridedMapType >::type Map(Scalar* data, const Stride& stride) + { return typename StridedMapType >::type(data, stride); } + template + inline static typename StridedConstMapType >::type Map(const Scalar* data, Index size, const Stride& stride) + { return typename StridedConstMapType >::type(data, size, stride); } + template + inline static typename StridedMapType >::type Map(Scalar* data, Index size, const Stride& stride) + { return typename StridedMapType >::type(data, size, stride); } + template + inline static typename StridedConstMapType >::type Map(const Scalar* data, Index rows, Index cols, const Stride& stride) + { return typename StridedConstMapType >::type(data, rows, cols, stride); } + template + inline static typename StridedMapType >::type Map(Scalar* data, Index rows, Index cols, const Stride& stride) + { return typename StridedMapType >::type(data, rows, cols, stride); } + + template + inline static typename StridedConstAlignedMapType >::type MapAligned(const Scalar* data, const Stride& stride) + { return typename StridedConstAlignedMapType >::type(data, stride); } + template + inline static typename StridedAlignedMapType >::type MapAligned(Scalar* data, const Stride& stride) + { return typename StridedAlignedMapType >::type(data, stride); } + template + inline static typename StridedConstAlignedMapType >::type MapAligned(const Scalar* data, Index size, const Stride& stride) + { return typename StridedConstAlignedMapType >::type(data, size, stride); } + template + inline static typename StridedAlignedMapType >::type MapAligned(Scalar* data, Index size, const Stride& stride) + { return typename StridedAlignedMapType >::type(data, size, stride); } + template + inline static typename StridedConstAlignedMapType >::type MapAligned(const Scalar* data, Index rows, Index cols, const Stride& stride) + { return typename StridedConstAlignedMapType >::type(data, rows, cols, stride); } + template + inline static typename StridedAlignedMapType >::type MapAligned(Scalar* data, Index rows, Index cols, const Stride& stride) + { return typename StridedAlignedMapType >::type(data, rows, cols, stride); } + //@} + + using Base::setConstant; + Derived& setConstant(Index size, const Scalar& value); + Derived& setConstant(Index rows, Index cols, const Scalar& value); + + using Base::setZero; + Derived& setZero(Index size); + Derived& setZero(Index rows, Index cols); + + using Base::setOnes; + Derived& setOnes(Index size); + Derived& setOnes(Index rows, Index cols); + + using Base::setRandom; + Derived& setRandom(Index size); + Derived& setRandom(Index rows, Index cols); + + #ifdef EIGEN_PLAINOBJECTBASE_PLUGIN + #include EIGEN_PLAINOBJECTBASE_PLUGIN + #endif + + protected: + /** \internal Resizes *this in preparation for assigning \a other to it. + * Takes care of doing all the checking that's needed. + * + * Note that copying a row-vector into a vector (and conversely) is allowed. + * The resizing, if any, is then done in the appropriate way so that row-vectors + * remain row-vectors and vectors remain vectors. + */ + template + EIGEN_STRONG_INLINE void _resize_to_match(const EigenBase& other) + { + #ifdef EIGEN_NO_AUTOMATIC_RESIZING + eigen_assert((this->size()==0 || (IsVectorAtCompileTime ? (this->size() == other.size()) + : (rows() == other.rows() && cols() == other.cols()))) + && "Size mismatch. Automatic resizing is disabled because EIGEN_NO_AUTOMATIC_RESIZING is defined"); + #else + resizeLike(other); + #endif + } + + /** + * \brief Copies the value of the expression \a other into \c *this with automatic resizing. + * + * *this might be resized to match the dimensions of \a other. If *this was a null matrix (not already initialized), + * it will be initialized. + * + * Note that copying a row-vector into a vector (and conversely) is allowed. + * The resizing, if any, is then done in the appropriate way so that row-vectors + * remain row-vectors and vectors remain vectors. + * + * \sa operator=(const MatrixBase&), _set_noalias() + * + * \internal + */ + template + EIGEN_STRONG_INLINE Derived& _set(const DenseBase& other) + { + _set_selector(other.derived(), typename internal::conditional(int(OtherDerived::Flags) & EvalBeforeAssigningBit), internal::true_type, internal::false_type>::type()); + return this->derived(); + } + + template + EIGEN_STRONG_INLINE void _set_selector(const OtherDerived& other, const internal::true_type&) { _set_noalias(other.eval()); } + + template + EIGEN_STRONG_INLINE void _set_selector(const OtherDerived& other, const internal::false_type&) { _set_noalias(other); } + + /** \internal Like _set() but additionally makes the assumption that no aliasing effect can happen (which + * is the case when creating a new matrix) so one can enforce lazy evaluation. + * + * \sa operator=(const MatrixBase&), _set() + */ + template + EIGEN_STRONG_INLINE Derived& _set_noalias(const DenseBase& other) + { + // I don't think we need this resize call since the lazyAssign will anyways resize + // and lazyAssign will be called by the assign selector. + //_resize_to_match(other); + // the 'false' below means to enforce lazy evaluation. We don't use lazyAssign() because + // it wouldn't allow to copy a row-vector into a column-vector. + return internal::assign_selector::run(this->derived(), other.derived()); + } + + template + EIGEN_STRONG_INLINE void _init2(Index rows, Index cols, typename internal::enable_if::type* = 0) + { + eigen_assert(rows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) + && cols >= 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)); + m_storage.resize(rows*cols,rows,cols); + EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED + } + template + EIGEN_STRONG_INLINE void _init2(const Scalar& x, const Scalar& y, typename internal::enable_if::type* = 0) + { + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2) + m_storage.data()[0] = x; + m_storage.data()[1] = y; + } + + template + friend struct internal::matrix_swap_impl; + + /** \internal generic implementation of swap for dense storage since for dynamic-sized matrices of same type it is enough to swap the + * data pointers. + */ + template + void _swap(DenseBase const & other) + { + enum { SwapPointers = internal::is_same::value && Base::SizeAtCompileTime==Dynamic }; + internal::matrix_swap_impl::run(this->derived(), other.const_cast_derived()); + } + + public: +#ifndef EIGEN_PARSED_BY_DOXYGEN + EIGEN_STRONG_INLINE static void _check_template_params() + { + EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, (Options&RowMajor)==RowMajor) + && EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, (Options&RowMajor)==0) + && ((RowsAtCompileTime == Dynamic) || (RowsAtCompileTime >= 0)) + && ((ColsAtCompileTime == Dynamic) || (ColsAtCompileTime >= 0)) + && ((MaxRowsAtCompileTime == Dynamic) || (MaxRowsAtCompileTime >= 0)) + && ((MaxColsAtCompileTime == Dynamic) || (MaxColsAtCompileTime >= 0)) + && (MaxRowsAtCompileTime == RowsAtCompileTime || RowsAtCompileTime==Dynamic) + && (MaxColsAtCompileTime == ColsAtCompileTime || ColsAtCompileTime==Dynamic) + && (Options & (DontAlign|RowMajor)) == Options), + INVALID_MATRIX_TEMPLATE_PARAMETERS) + } +#endif + +private: + enum { ThisConstantIsPrivateInPlainObjectBase }; +}; + +template +struct internal::conservative_resize_like_impl +{ + typedef typename Derived::Index Index; + static void run(DenseBase& _this, Index rows, Index cols) + { + if (_this.rows() == rows && _this.cols() == cols) return; + EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(Derived) + + if ( ( Derived::IsRowMajor && _this.cols() == cols) || // row-major and we change only the number of rows + (!Derived::IsRowMajor && _this.rows() == rows) ) // column-major and we change only the number of columns + { + _this.derived().m_storage.conservativeResize(rows*cols,rows,cols); + } + else + { + // The storage order does not allow us to use reallocation. + typename Derived::PlainObject tmp(rows,cols); + const Index common_rows = std::min(rows, _this.rows()); + const Index common_cols = std::min(cols, _this.cols()); + tmp.block(0,0,common_rows,common_cols) = _this.block(0,0,common_rows,common_cols); + _this.derived().swap(tmp); + } + } + + static void run(DenseBase& _this, const DenseBase& other) + { + if (_this.rows() == other.rows() && _this.cols() == other.cols()) return; + + // Note: Here is space for improvement. Basically, for conservativeResize(Index,Index), + // neither RowsAtCompileTime or ColsAtCompileTime must be Dynamic. If only one of the + // dimensions is dynamic, one could use either conservativeResize(Index rows, NoChange_t) or + // conservativeResize(NoChange_t, Index cols). For these methods new static asserts like + // EIGEN_STATIC_ASSERT_DYNAMIC_ROWS and EIGEN_STATIC_ASSERT_DYNAMIC_COLS would be good. + EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(Derived) + EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(OtherDerived) + + if ( ( Derived::IsRowMajor && _this.cols() == other.cols()) || // row-major and we change only the number of rows + (!Derived::IsRowMajor && _this.rows() == other.rows()) ) // column-major and we change only the number of columns + { + const Index new_rows = other.rows() - _this.rows(); + const Index new_cols = other.cols() - _this.cols(); + _this.derived().m_storage.conservativeResize(other.size(),other.rows(),other.cols()); + if (new_rows>0) + _this.bottomRightCorner(new_rows, other.cols()) = other.bottomRows(new_rows); + else if (new_cols>0) + _this.bottomRightCorner(other.rows(), new_cols) = other.rightCols(new_cols); + } + else + { + // The storage order does not allow us to use reallocation. + typename Derived::PlainObject tmp(other); + const Index common_rows = std::min(tmp.rows(), _this.rows()); + const Index common_cols = std::min(tmp.cols(), _this.cols()); + tmp.block(0,0,common_rows,common_cols) = _this.block(0,0,common_rows,common_cols); + _this.derived().swap(tmp); + } + } +}; + +namespace internal { + +template +struct conservative_resize_like_impl +{ + typedef typename Derived::Index Index; + static void run(DenseBase& _this, Index size) + { + const Index new_rows = Derived::RowsAtCompileTime==1 ? 1 : size; + const Index new_cols = Derived::RowsAtCompileTime==1 ? size : 1; + _this.derived().m_storage.conservativeResize(size,new_rows,new_cols); + } + + static void run(DenseBase& _this, const DenseBase& other) + { + if (_this.rows() == other.rows() && _this.cols() == other.cols()) return; + + const Index num_new_elements = other.size() - _this.size(); + + const Index new_rows = Derived::RowsAtCompileTime==1 ? 1 : other.rows(); + const Index new_cols = Derived::RowsAtCompileTime==1 ? other.cols() : 1; + _this.derived().m_storage.conservativeResize(other.size(),new_rows,new_cols); + + if (num_new_elements > 0) + _this.tail(num_new_elements) = other.tail(num_new_elements); + } +}; + +template +struct matrix_swap_impl +{ + static inline void run(MatrixTypeA& a, MatrixTypeB& b) + { + a.base().swap(b); + } +}; + +template +struct matrix_swap_impl +{ + static inline void run(MatrixTypeA& a, MatrixTypeB& b) + { + static_cast(a).m_storage.swap(static_cast(b).m_storage); + } +}; + +} // end namespace internal + +#endif // EIGEN_DENSESTORAGEBASE_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/Product.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/Product.h new file mode 100644 index 000000000..e2035b242 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/Product.h @@ -0,0 +1,625 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2008 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_PRODUCT_H +#define EIGEN_PRODUCT_H + +/** \class GeneralProduct + * \ingroup Core_Module + * + * \brief Expression of the product of two general matrices or vectors + * + * \param LhsNested the type used to store the left-hand side + * \param RhsNested the type used to store the right-hand side + * \param ProductMode the type of the product + * + * This class represents an expression of the product of two general matrices. + * We call a general matrix, a dense matrix with full storage. For instance, + * This excludes triangular, selfadjoint, and sparse matrices. + * It is the return type of the operator* between general matrices. Its template + * arguments are determined automatically by ProductReturnType. Therefore, + * GeneralProduct should never be used direclty. To determine the result type of a + * function which involves a matrix product, use ProductReturnType::Type. + * + * \sa ProductReturnType, MatrixBase::operator*(const MatrixBase&) + */ +template::value> +class GeneralProduct; + +enum { + Large = 2, + Small = 3 +}; + +namespace internal { + +template struct product_type_selector; + +template struct product_size_category +{ + enum { is_large = MaxSize == Dynamic || + Size >= EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD, + value = is_large ? Large + : Size == 1 ? 1 + : Small + }; +}; + +template struct product_type +{ + typedef typename remove_all::type _Lhs; + typedef typename remove_all::type _Rhs; + enum { + MaxRows = _Lhs::MaxRowsAtCompileTime, + Rows = _Lhs::RowsAtCompileTime, + MaxCols = _Rhs::MaxColsAtCompileTime, + Cols = _Rhs::ColsAtCompileTime, + MaxDepth = EIGEN_SIZE_MIN_PREFER_FIXED(_Lhs::MaxColsAtCompileTime, + _Rhs::MaxRowsAtCompileTime), + Depth = EIGEN_SIZE_MIN_PREFER_FIXED(_Lhs::ColsAtCompileTime, + _Rhs::RowsAtCompileTime), + LargeThreshold = EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD + }; + + // the splitting into different lines of code here, introducing the _select enums and the typedef below, + // is to work around an internal compiler error with gcc 4.1 and 4.2. +private: + enum { + rows_select = product_size_category::value, + cols_select = product_size_category::value, + depth_select = product_size_category::value + }; + typedef product_type_selector selector; + +public: + enum { + value = selector::ret + }; +#ifdef EIGEN_DEBUG_PRODUCT + static void debug() + { + EIGEN_DEBUG_VAR(Rows); + EIGEN_DEBUG_VAR(Cols); + EIGEN_DEBUG_VAR(Depth); + EIGEN_DEBUG_VAR(rows_select); + EIGEN_DEBUG_VAR(cols_select); + EIGEN_DEBUG_VAR(depth_select); + EIGEN_DEBUG_VAR(value); + } +#endif +}; + + +/* The following allows to select the kind of product at compile time + * based on the three dimensions of the product. + * This is a compile time mapping from {1,Small,Large}^3 -> {product types} */ +// FIXME I'm not sure the current mapping is the ideal one. +template struct product_type_selector { enum { ret = OuterProduct }; }; +template struct product_type_selector<1, 1, Depth> { enum { ret = InnerProduct }; }; +template<> struct product_type_selector<1, 1, 1> { enum { ret = InnerProduct }; }; +template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector<1, Small,Small> { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = LazyCoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = LazyCoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = LazyCoeffBasedProductMode }; }; +template<> struct product_type_selector<1, Large,Small> { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector<1, Large,Large> { enum { ret = GemvProduct }; }; +template<> struct product_type_selector<1, Small,Large> { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = GemvProduct }; }; +template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = GemmProduct }; }; +template<> struct product_type_selector { enum { ret = GemmProduct }; }; +template<> struct product_type_selector { enum { ret = GemmProduct }; }; +template<> struct product_type_selector { enum { ret = GemmProduct }; }; +template<> struct product_type_selector { enum { ret = GemmProduct }; }; +template<> struct product_type_selector { enum { ret = GemmProduct }; }; +template<> struct product_type_selector { enum { ret = GemmProduct }; }; + +} // end namespace internal + +/** \class ProductReturnType + * \ingroup Core_Module + * + * \brief Helper class to get the correct and optimized returned type of operator* + * + * \param Lhs the type of the left-hand side + * \param Rhs the type of the right-hand side + * \param ProductMode the type of the product (determined automatically by internal::product_mode) + * + * This class defines the typename Type representing the optimized product expression + * between two matrix expressions. In practice, using ProductReturnType::Type + * is the recommended way to define the result type of a function returning an expression + * which involve a matrix product. The class Product should never be + * used directly. + * + * \sa class Product, MatrixBase::operator*(const MatrixBase&) + */ +template +struct ProductReturnType +{ + // TODO use the nested type to reduce instanciations ???? +// typedef typename internal::nested::type LhsNested; +// typedef typename internal::nested::type RhsNested; + + typedef GeneralProduct Type; +}; + +template +struct ProductReturnType +{ + typedef typename internal::nested::type >::type LhsNested; + typedef typename internal::nested::type >::type RhsNested; + typedef CoeffBasedProduct Type; +}; + +template +struct ProductReturnType +{ + typedef typename internal::nested::type >::type LhsNested; + typedef typename internal::nested::type >::type RhsNested; + typedef CoeffBasedProduct Type; +}; + +// this is a workaround for sun CC +template +struct LazyProductReturnType : public ProductReturnType +{}; + +/*********************************************************************** +* Implementation of Inner Vector Vector Product +***********************************************************************/ + +// FIXME : maybe the "inner product" could return a Scalar +// instead of a 1x1 matrix ?? +// Pro: more natural for the user +// Cons: this could be a problem if in a meta unrolled algorithm a matrix-matrix +// product ends up to a row-vector times col-vector product... To tackle this use +// case, we could have a specialization for Block with: operator=(Scalar x); + +namespace internal { + +template +struct traits > + : traits::ReturnType,1,1> > +{}; + +} + +template +class GeneralProduct + : internal::no_assignment_operator, + public Matrix::ReturnType,1,1> +{ + typedef Matrix::ReturnType,1,1> Base; + public: + GeneralProduct(const Lhs& lhs, const Rhs& rhs) + { + EIGEN_STATIC_ASSERT((internal::is_same::value), + YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) + + Base::coeffRef(0,0) = (lhs.transpose().cwiseProduct(rhs)).sum(); + } + + /** Convertion to scalar */ + operator const typename Base::Scalar() const { + return Base::coeff(0,0); + } +}; + +/*********************************************************************** +* Implementation of Outer Vector Vector Product +***********************************************************************/ + +namespace internal { +template struct outer_product_selector; + +template +struct traits > + : traits, Lhs, Rhs> > +{}; + +} + +template +class GeneralProduct + : public ProductBase, Lhs, Rhs> +{ + public: + EIGEN_PRODUCT_PUBLIC_INTERFACE(GeneralProduct) + + GeneralProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs) + { + EIGEN_STATIC_ASSERT((internal::is_same::value), + YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) + } + + template void scaleAndAddTo(Dest& dest, Scalar alpha) const + { + internal::outer_product_selector<(int(Dest::Flags)&RowMajorBit) ? RowMajor : ColMajor>::run(*this, dest, alpha); + } +}; + +namespace internal { + +template<> struct outer_product_selector { + template + static EIGEN_DONT_INLINE void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) { + typedef typename Dest::Index Index; + // FIXME make sure lhs is sequentially stored + // FIXME not very good if rhs is real and lhs complex while alpha is real too + const Index cols = dest.cols(); + for (Index j=0; j struct outer_product_selector { + template + static EIGEN_DONT_INLINE void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) { + typedef typename Dest::Index Index; + // FIXME make sure rhs is sequentially stored + // FIXME not very good if lhs is real and rhs complex while alpha is real too + const Index rows = dest.rows(); + for (Index i=0; i call fast BLAS-like colmajor routine + * 2 - the matrix is row-major, BLAS compatible and N is large => call fast BLAS-like rowmajor routine + * 3 - all other cases are handled using a simple loop along the outer-storage direction. + * Therefore we need a lower level meta selector. + * Furthermore, if the matrix is the rhs, then the product has to be transposed. + */ +namespace internal { + +template +struct traits > + : traits, Lhs, Rhs> > +{}; + +template +struct gemv_selector; + +} // end namespace internal + +template +class GeneralProduct + : public ProductBase, Lhs, Rhs> +{ + public: + EIGEN_PRODUCT_PUBLIC_INTERFACE(GeneralProduct) + + typedef typename Lhs::Scalar LhsScalar; + typedef typename Rhs::Scalar RhsScalar; + + GeneralProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs) + { +// EIGEN_STATIC_ASSERT((internal::is_same::value), +// YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) + } + + enum { Side = Lhs::IsVectorAtCompileTime ? OnTheLeft : OnTheRight }; + typedef typename internal::conditional::type MatrixType; + + template void scaleAndAddTo(Dest& dst, Scalar alpha) const + { + eigen_assert(m_lhs.rows() == dst.rows() && m_rhs.cols() == dst.cols()); + internal::gemv_selector::HasUsableDirectAccess)>::run(*this, dst, alpha); + } +}; + +namespace internal { + +// The vector is on the left => transposition +template +struct gemv_selector +{ + template + static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) + { + Transpose destT(dest); + enum { OtherStorageOrder = StorageOrder == RowMajor ? ColMajor : RowMajor }; + gemv_selector + ::run(GeneralProduct,Transpose, GemvProduct> + (prod.rhs().transpose(), prod.lhs().transpose()), destT, alpha); + } +}; + +template struct gemv_static_vector_if; + +template +struct gemv_static_vector_if +{ + EIGEN_STRONG_INLINE Scalar* data() { eigen_internal_assert(false && "should never be called"); return 0; } +}; + +template +struct gemv_static_vector_if +{ + EIGEN_STRONG_INLINE Scalar* data() { return 0; } +}; + +template +struct gemv_static_vector_if +{ + #if EIGEN_ALIGN_STATICALLY + internal::plain_array m_data; + EIGEN_STRONG_INLINE Scalar* data() { return m_data.array; } + #else + // Some architectures cannot align on the stack, + // => let's manually enforce alignment by allocating more data and return the address of the first aligned element. + enum { + ForceAlignment = internal::packet_traits::Vectorizable, + PacketSize = internal::packet_traits::size + }; + internal::plain_array m_data; + EIGEN_STRONG_INLINE Scalar* data() { + return ForceAlignment + ? reinterpret_cast((reinterpret_cast(m_data.array) & ~(size_t(15))) + 16) + : m_data.array; + } + #endif +}; + +template<> struct gemv_selector +{ + template + static inline void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) + { + typedef typename ProductType::Index Index; + typedef typename ProductType::LhsScalar LhsScalar; + typedef typename ProductType::RhsScalar RhsScalar; + typedef typename ProductType::Scalar ResScalar; + typedef typename ProductType::RealScalar RealScalar; + typedef typename ProductType::ActualLhsType ActualLhsType; + typedef typename ProductType::ActualRhsType ActualRhsType; + typedef typename ProductType::LhsBlasTraits LhsBlasTraits; + typedef typename ProductType::RhsBlasTraits RhsBlasTraits; + typedef Map, Aligned> MappedDest; + + const ActualLhsType actualLhs = LhsBlasTraits::extract(prod.lhs()); + const ActualRhsType actualRhs = RhsBlasTraits::extract(prod.rhs()); + + ResScalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs()) + * RhsBlasTraits::extractScalarFactor(prod.rhs()); + + enum { + // FIXME find a way to allow an inner stride on the result if packet_traits::size==1 + // on, the other hand it is good for the cache to pack the vector anyways... + EvalToDestAtCompileTime = Dest::InnerStrideAtCompileTime==1, + ComplexByReal = (NumTraits::IsComplex) && (!NumTraits::IsComplex), + MightCannotUseDest = (Dest::InnerStrideAtCompileTime!=1) || ComplexByReal + }; + + gemv_static_vector_if static_dest; + + // this is written like this (i.e., with a ?:) to workaround an ICE with ICC 12 + bool alphaIsCompatible = (!ComplexByReal) ? true : (imag(actualAlpha)==RealScalar(0)); + bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible; + + RhsScalar compatibleAlpha = get_factor::run(actualAlpha); + + ei_declare_aligned_stack_constructed_variable(ResScalar,actualDestPtr,dest.size(), + evalToDest ? dest.data() : static_dest.data()); + + if(!evalToDest) + { + #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + int size = dest.size(); + EIGEN_DENSE_STORAGE_CTOR_PLUGIN + #endif + if(!alphaIsCompatible) + { + MappedDest(actualDestPtr, dest.size()).setZero(); + compatibleAlpha = RhsScalar(1); + } + else + MappedDest(actualDestPtr, dest.size()) = dest; + } + + general_matrix_vector_product + ::run( + actualLhs.rows(), actualLhs.cols(), + &actualLhs.coeffRef(0,0), actualLhs.outerStride(), + actualRhs.data(), actualRhs.innerStride(), + actualDestPtr, 1, + compatibleAlpha); + + if (!evalToDest) + { + if(!alphaIsCompatible) + dest += actualAlpha * MappedDest(actualDestPtr, dest.size()); + else + dest = MappedDest(actualDestPtr, dest.size()); + } + } +}; + +template<> struct gemv_selector +{ + template + static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) + { + typedef typename ProductType::LhsScalar LhsScalar; + typedef typename ProductType::RhsScalar RhsScalar; + typedef typename ProductType::Scalar ResScalar; + typedef typename ProductType::Index Index; + typedef typename ProductType::ActualLhsType ActualLhsType; + typedef typename ProductType::ActualRhsType ActualRhsType; + typedef typename ProductType::_ActualRhsType _ActualRhsType; + typedef typename ProductType::LhsBlasTraits LhsBlasTraits; + typedef typename ProductType::RhsBlasTraits RhsBlasTraits; + + typename add_const::type actualLhs = LhsBlasTraits::extract(prod.lhs()); + typename add_const::type actualRhs = RhsBlasTraits::extract(prod.rhs()); + + ResScalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs()) + * RhsBlasTraits::extractScalarFactor(prod.rhs()); + + enum { + // FIXME find a way to allow an inner stride on the result if packet_traits::size==1 + // on, the other hand it is good for the cache to pack the vector anyways... + DirectlyUseRhs = _ActualRhsType::InnerStrideAtCompileTime==1 + }; + + gemv_static_vector_if static_rhs; + + ei_declare_aligned_stack_constructed_variable(RhsScalar,actualRhsPtr,actualRhs.size(), + DirectlyUseRhs ? const_cast(actualRhs.data()) : static_rhs.data()); + + if(!DirectlyUseRhs) + { + #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + int size = actualRhs.size(); + EIGEN_DENSE_STORAGE_CTOR_PLUGIN + #endif + Map(actualRhsPtr, actualRhs.size()) = actualRhs; + } + + general_matrix_vector_product + ::run( + actualLhs.rows(), actualLhs.cols(), + &actualLhs.coeffRef(0,0), actualLhs.outerStride(), + actualRhsPtr, 1, + &dest.coeffRef(0,0), dest.innerStride(), + actualAlpha); + } +}; + +template<> struct gemv_selector +{ + template + static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) + { + typedef typename Dest::Index Index; + // TODO makes sure dest is sequentially stored in memory, otherwise use a temp + const Index size = prod.rhs().rows(); + for(Index k=0; k struct gemv_selector +{ + template + static void run(const ProductType& prod, Dest& dest, typename ProductType::Scalar alpha) + { + typedef typename Dest::Index Index; + // TODO makes sure rhs is sequentially stored in memory, otherwise use a temp + const Index rows = prod.rows(); + for(Index i=0; i +template +inline const typename ProductReturnType::Type +MatrixBase::operator*(const MatrixBase &other) const +{ + // A note regarding the function declaration: In MSVC, this function will sometimes + // not be inlined since DenseStorage is an unwindable object for dynamic + // matrices and product types are holding a member to store the result. + // Thus it does not help tagging this function with EIGEN_STRONG_INLINE. + enum { + ProductIsValid = Derived::ColsAtCompileTime==Dynamic + || OtherDerived::RowsAtCompileTime==Dynamic + || int(Derived::ColsAtCompileTime)==int(OtherDerived::RowsAtCompileTime), + AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime, + SameSizes = EIGEN_PREDICATE_SAME_MATRIX_SIZE(Derived,OtherDerived) + }; + // note to the lost user: + // * for a dot product use: v1.dot(v2) + // * for a coeff-wise product use: v1.cwiseProduct(v2) + EIGEN_STATIC_ASSERT(ProductIsValid || !(AreVectors && SameSizes), + INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS) + EIGEN_STATIC_ASSERT(ProductIsValid || !(SameSizes && !AreVectors), + INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION) + EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT) +#ifdef EIGEN_DEBUG_PRODUCT + internal::product_type::debug(); +#endif + return typename ProductReturnType::Type(derived(), other.derived()); +} + +/** \returns an expression of the matrix product of \c *this and \a other without implicit evaluation. + * + * The returned product will behave like any other expressions: the coefficients of the product will be + * computed once at a time as requested. This might be useful in some extremely rare cases when only + * a small and no coherent fraction of the result's coefficients have to be computed. + * + * \warning This version of the matrix product can be much much slower. So use it only if you know + * what you are doing and that you measured a true speed improvement. + * + * \sa operator*(const MatrixBase&) + */ +template +template +const typename LazyProductReturnType::Type +MatrixBase::lazyProduct(const MatrixBase &other) const +{ + enum { + ProductIsValid = Derived::ColsAtCompileTime==Dynamic + || OtherDerived::RowsAtCompileTime==Dynamic + || int(Derived::ColsAtCompileTime)==int(OtherDerived::RowsAtCompileTime), + AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime, + SameSizes = EIGEN_PREDICATE_SAME_MATRIX_SIZE(Derived,OtherDerived) + }; + // note to the lost user: + // * for a dot product use: v1.dot(v2) + // * for a coeff-wise product use: v1.cwiseProduct(v2) + EIGEN_STATIC_ASSERT(ProductIsValid || !(AreVectors && SameSizes), + INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS) + EIGEN_STATIC_ASSERT(ProductIsValid || !(SameSizes && !AreVectors), + INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION) + EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT) + + return typename LazyProductReturnType::Type(derived(), other.derived()); +} + +#endif // EIGEN_PRODUCT_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/ProductBase.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/ProductBase.h new file mode 100644 index 000000000..3bd3487d6 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/ProductBase.h @@ -0,0 +1,288 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009-2010 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_PRODUCTBASE_H +#define EIGEN_PRODUCTBASE_H + +/** \class ProductBase + * \ingroup Core_Module + * + */ + +namespace internal { +template +struct traits > +{ + typedef MatrixXpr XprKind; + typedef typename remove_all<_Lhs>::type Lhs; + typedef typename remove_all<_Rhs>::type Rhs; + typedef typename scalar_product_traits::ReturnType Scalar; + typedef typename promote_storage_type::StorageKind, + typename traits::StorageKind>::ret StorageKind; + typedef typename promote_index_type::Index, + typename traits::Index>::type Index; + enum { + RowsAtCompileTime = traits::RowsAtCompileTime, + ColsAtCompileTime = traits::ColsAtCompileTime, + MaxRowsAtCompileTime = traits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = traits::MaxColsAtCompileTime, + Flags = (MaxRowsAtCompileTime==1 ? RowMajorBit : 0) + | EvalBeforeNestingBit | EvalBeforeAssigningBit | NestByRefBit, + // Note that EvalBeforeNestingBit and NestByRefBit + // are not used in practice because nested is overloaded for products + CoeffReadCost = 0 // FIXME why is it needed ? + }; +}; +} + +#define EIGEN_PRODUCT_PUBLIC_INTERFACE(Derived) \ + typedef ProductBase Base; \ + EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \ + typedef typename Base::LhsNested LhsNested; \ + typedef typename Base::_LhsNested _LhsNested; \ + typedef typename Base::LhsBlasTraits LhsBlasTraits; \ + typedef typename Base::ActualLhsType ActualLhsType; \ + typedef typename Base::_ActualLhsType _ActualLhsType; \ + typedef typename Base::RhsNested RhsNested; \ + typedef typename Base::_RhsNested _RhsNested; \ + typedef typename Base::RhsBlasTraits RhsBlasTraits; \ + typedef typename Base::ActualRhsType ActualRhsType; \ + typedef typename Base::_ActualRhsType _ActualRhsType; \ + using Base::m_lhs; \ + using Base::m_rhs; + +template +class ProductBase : public MatrixBase +{ + public: + typedef MatrixBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(ProductBase) + + typedef typename Lhs::Nested LhsNested; + typedef typename internal::remove_all::type _LhsNested; + typedef internal::blas_traits<_LhsNested> LhsBlasTraits; + typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType; + typedef typename internal::remove_all::type _ActualLhsType; + typedef typename internal::traits::Scalar LhsScalar; + + typedef typename Rhs::Nested RhsNested; + typedef typename internal::remove_all::type _RhsNested; + typedef internal::blas_traits<_RhsNested> RhsBlasTraits; + typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType; + typedef typename internal::remove_all::type _ActualRhsType; + typedef typename internal::traits::Scalar RhsScalar; + + // Diagonal of a product: no need to evaluate the arguments because they are going to be evaluated only once + typedef CoeffBasedProduct FullyLazyCoeffBaseProductType; + + public: + + typedef typename Base::PlainObject PlainObject; + + ProductBase(const Lhs& lhs, const Rhs& rhs) + : m_lhs(lhs), m_rhs(rhs) + { + eigen_assert(lhs.cols() == rhs.rows() + && "invalid matrix product" + && "if you wanted a coeff-wise or a dot product use the respective explicit functions"); + } + + inline Index rows() const { return m_lhs.rows(); } + inline Index cols() const { return m_rhs.cols(); } + + template + inline void evalTo(Dest& dst) const { dst.setZero(); scaleAndAddTo(dst,Scalar(1)); } + + template + inline void addTo(Dest& dst) const { scaleAndAddTo(dst,1); } + + template + inline void subTo(Dest& dst) const { scaleAndAddTo(dst,-1); } + + template + inline void scaleAndAddTo(Dest& dst,Scalar alpha) const { derived().scaleAndAddTo(dst,alpha); } + + const _LhsNested& lhs() const { return m_lhs; } + const _RhsNested& rhs() const { return m_rhs; } + + // Implicit conversion to the nested type (trigger the evaluation of the product) + operator const PlainObject& () const + { + m_result.resize(m_lhs.rows(), m_rhs.cols()); + derived().evalTo(m_result); + return m_result; + } + + const Diagonal diagonal() const + { return FullyLazyCoeffBaseProductType(m_lhs, m_rhs); } + + template + const Diagonal diagonal() const + { return FullyLazyCoeffBaseProductType(m_lhs, m_rhs); } + + const Diagonal diagonal(Index index) const + { return FullyLazyCoeffBaseProductType(m_lhs, m_rhs).diagonal(index); } + + // restrict coeff accessors to 1x1 expressions. No need to care about mutators here since this isnt a Lvalue expression + typename Base::CoeffReturnType coeff(Index row, Index col) const + { +#ifdef EIGEN2_SUPPORT + return lhs().row(row).cwiseProduct(rhs().col(col).transpose()).sum(); +#else + EIGEN_STATIC_ASSERT_SIZE_1x1(Derived) + eigen_assert(this->rows() == 1 && this->cols() == 1); + return derived().coeff(row,col); +#endif + } + + typename Base::CoeffReturnType coeff(Index i) const + { + EIGEN_STATIC_ASSERT_SIZE_1x1(Derived) + eigen_assert(this->rows() == 1 && this->cols() == 1); + return derived().coeff(i); + } + + const Scalar& coeffRef(Index row, Index col) const + { + EIGEN_STATIC_ASSERT_SIZE_1x1(Derived) + eigen_assert(this->rows() == 1 && this->cols() == 1); + return derived().coeffRef(row,col); + } + + const Scalar& coeffRef(Index i) const + { + EIGEN_STATIC_ASSERT_SIZE_1x1(Derived) + eigen_assert(this->rows() == 1 && this->cols() == 1); + return derived().coeffRef(i); + } + + protected: + + const LhsNested m_lhs; + const RhsNested m_rhs; + + mutable PlainObject m_result; +}; + +// here we need to overload the nested rule for products +// such that the nested type is a const reference to a plain matrix +namespace internal { +template +struct nested, N, PlainObject> +{ + typedef PlainObject const& type; +}; +} + +template +class ScaledProduct; + +// Note that these two operator* functions are not defined as member +// functions of ProductBase, because, otherwise we would have to +// define all overloads defined in MatrixBase. Furthermore, Using +// "using Base::operator*" would not work with MSVC. +// +// Also note that here we accept any compatible scalar types +template +const ScaledProduct +operator*(const ProductBase& prod, typename Derived::Scalar x) +{ return ScaledProduct(prod.derived(), x); } + +template +typename internal::enable_if::value, + const ScaledProduct >::type +operator*(const ProductBase& prod, typename Derived::RealScalar x) +{ return ScaledProduct(prod.derived(), x); } + + +template +const ScaledProduct +operator*(typename Derived::Scalar x,const ProductBase& prod) +{ return ScaledProduct(prod.derived(), x); } + +template +typename internal::enable_if::value, + const ScaledProduct >::type +operator*(typename Derived::RealScalar x,const ProductBase& prod) +{ return ScaledProduct(prod.derived(), x); } + +namespace internal { +template +struct traits > + : traits, + typename NestedProduct::_LhsNested, + typename NestedProduct::_RhsNested> > +{ + typedef typename traits::StorageKind StorageKind; +}; +} + +template +class ScaledProduct + : public ProductBase, + typename NestedProduct::_LhsNested, + typename NestedProduct::_RhsNested> +{ + public: + typedef ProductBase, + typename NestedProduct::_LhsNested, + typename NestedProduct::_RhsNested> Base; + typedef typename Base::Scalar Scalar; + typedef typename Base::PlainObject PlainObject; +// EIGEN_PRODUCT_PUBLIC_INTERFACE(ScaledProduct) + + ScaledProduct(const NestedProduct& prod, Scalar x) + : Base(prod.lhs(),prod.rhs()), m_prod(prod), m_alpha(x) {} + + template + inline void evalTo(Dest& dst) const { dst.setZero(); scaleAndAddTo(dst,m_alpha); } + + template + inline void addTo(Dest& dst) const { scaleAndAddTo(dst,m_alpha); } + + template + inline void subTo(Dest& dst) const { scaleAndAddTo(dst,-m_alpha); } + + template + inline void scaleAndAddTo(Dest& dst,Scalar alpha) const { m_prod.derived().scaleAndAddTo(dst,alpha); } + + const Scalar& alpha() const { return m_alpha; } + + protected: + const NestedProduct& m_prod; + Scalar m_alpha; +}; + +/** \internal + * Overloaded to perform an efficient C = (A*B).lazy() */ +template +template +Derived& MatrixBase::lazyAssign(const ProductBase& other) +{ + other.derived().evalTo(derived()); + return derived(); +} + + +#endif // EIGEN_PRODUCTBASE_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/Random.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/Random.h new file mode 100644 index 000000000..b7d90103a --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/Random.h @@ -0,0 +1,163 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_RANDOM_H +#define EIGEN_RANDOM_H + +namespace internal { + +template struct scalar_random_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_random_op) + template + inline const Scalar operator() (Index, Index = 0) const { return random(); } +}; + +template +struct functor_traits > +{ enum { Cost = 5 * NumTraits::MulCost, PacketAccess = false, IsRepeatable = false }; }; + +} // end namespace internal + +/** \returns a random matrix expression + * + * The parameters \a rows and \a cols are the number of rows and of columns of + * the returned matrix. Must be compatible with this MatrixBase type. + * + * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, + * it is redundant to pass \a rows and \a cols as arguments, so Random() should be used + * instead. + * + * Example: \include MatrixBase_random_int_int.cpp + * Output: \verbinclude MatrixBase_random_int_int.out + * + * This expression has the "evaluate before nesting" flag so that it will be evaluated into + * a temporary matrix whenever it is nested in a larger expression. This prevents unexpected + * behavior with expressions involving random matrices. + * + * \sa MatrixBase::setRandom(), MatrixBase::Random(Index), MatrixBase::Random() + */ +template +inline const CwiseNullaryOp::Scalar>, Derived> +DenseBase::Random(Index rows, Index cols) +{ + return NullaryExpr(rows, cols, internal::scalar_random_op()); +} + +/** \returns a random vector expression + * + * The parameter \a size is the size of the returned vector. + * Must be compatible with this MatrixBase type. + * + * \only_for_vectors + * + * This variant is meant to be used for dynamic-size vector types. For fixed-size types, + * it is redundant to pass \a size as argument, so Random() should be used + * instead. + * + * Example: \include MatrixBase_random_int.cpp + * Output: \verbinclude MatrixBase_random_int.out + * + * This expression has the "evaluate before nesting" flag so that it will be evaluated into + * a temporary vector whenever it is nested in a larger expression. This prevents unexpected + * behavior with expressions involving random matrices. + * + * \sa MatrixBase::setRandom(), MatrixBase::Random(Index,Index), MatrixBase::Random() + */ +template +inline const CwiseNullaryOp::Scalar>, Derived> +DenseBase::Random(Index size) +{ + return NullaryExpr(size, internal::scalar_random_op()); +} + +/** \returns a fixed-size random matrix or vector expression + * + * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you + * need to use the variants taking size arguments. + * + * Example: \include MatrixBase_random.cpp + * Output: \verbinclude MatrixBase_random.out + * + * This expression has the "evaluate before nesting" flag so that it will be evaluated into + * a temporary matrix whenever it is nested in a larger expression. This prevents unexpected + * behavior with expressions involving random matrices. + * + * \sa MatrixBase::setRandom(), MatrixBase::Random(Index,Index), MatrixBase::Random(Index) + */ +template +inline const CwiseNullaryOp::Scalar>, Derived> +DenseBase::Random() +{ + return NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_random_op()); +} + +/** Sets all coefficients in this expression to random values. + * + * Example: \include MatrixBase_setRandom.cpp + * Output: \verbinclude MatrixBase_setRandom.out + * + * \sa class CwiseNullaryOp, setRandom(Index), setRandom(Index,Index) + */ +template +inline Derived& DenseBase::setRandom() +{ + return *this = Random(rows(), cols()); +} + +/** Resizes to the given \a size, and sets all coefficients in this expression to random values. + * + * \only_for_vectors + * + * Example: \include Matrix_setRandom_int.cpp + * Output: \verbinclude Matrix_setRandom_int.out + * + * \sa MatrixBase::setRandom(), setRandom(Index,Index), class CwiseNullaryOp, MatrixBase::Random() + */ +template +EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setRandom(Index size) +{ + resize(size); + return setRandom(); +} + +/** Resizes to the given size, and sets all coefficients in this expression to random values. + * + * \param rows the new number of rows + * \param cols the new number of columns + * + * Example: \include Matrix_setRandom_int_int.cpp + * Output: \verbinclude Matrix_setRandom_int_int.out + * + * \sa MatrixBase::setRandom(), setRandom(Index), class CwiseNullaryOp, MatrixBase::Random() + */ +template +EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setRandom(Index rows, Index cols) +{ + resize(rows, cols); + return setRandom(); +} + +#endif // EIGEN_RANDOM_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/Redux.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/Redux.h new file mode 100644 index 000000000..f9f5a95d5 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/Redux.h @@ -0,0 +1,404 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_REDUX_H +#define EIGEN_REDUX_H + +namespace internal { + +// TODO +// * implement other kind of vectorization +// * factorize code + +/*************************************************************************** +* Part 1 : the logic deciding a strategy for vectorization and unrolling +***************************************************************************/ + +template +struct redux_traits +{ +public: + enum { + PacketSize = packet_traits::size, + InnerMaxSize = int(Derived::IsRowMajor) + ? Derived::MaxColsAtCompileTime + : Derived::MaxRowsAtCompileTime + }; + + enum { + MightVectorize = (int(Derived::Flags)&ActualPacketAccessBit) + && (functor_traits::PacketAccess), + MayLinearVectorize = MightVectorize && (int(Derived::Flags)&LinearAccessBit), + MaySliceVectorize = MightVectorize && int(InnerMaxSize)>=3*PacketSize + }; + +public: + enum { + Traversal = int(MayLinearVectorize) ? int(LinearVectorizedTraversal) + : int(MaySliceVectorize) ? int(SliceVectorizedTraversal) + : int(DefaultTraversal) + }; + +public: + enum { + Cost = ( Derived::SizeAtCompileTime == Dynamic + || Derived::CoeffReadCost == Dynamic + || (Derived::SizeAtCompileTime!=1 && functor_traits::Cost == Dynamic) + ) ? Dynamic + : Derived::SizeAtCompileTime * Derived::CoeffReadCost + + (Derived::SizeAtCompileTime-1) * functor_traits::Cost, + UnrollingLimit = EIGEN_UNROLLING_LIMIT * (int(Traversal) == int(DefaultTraversal) ? 1 : int(PacketSize)) + }; + +public: + enum { + Unrolling = Cost != Dynamic && Cost <= UnrollingLimit + ? CompleteUnrolling + : NoUnrolling + }; +}; + +/*************************************************************************** +* Part 2 : unrollers +***************************************************************************/ + +/*** no vectorization ***/ + +template +struct redux_novec_unroller +{ + enum { + HalfLength = Length/2 + }; + + typedef typename Derived::Scalar Scalar; + + EIGEN_STRONG_INLINE static Scalar run(const Derived &mat, const Func& func) + { + return func(redux_novec_unroller::run(mat,func), + redux_novec_unroller::run(mat,func)); + } +}; + +template +struct redux_novec_unroller +{ + enum { + outer = Start / Derived::InnerSizeAtCompileTime, + inner = Start % Derived::InnerSizeAtCompileTime + }; + + typedef typename Derived::Scalar Scalar; + + EIGEN_STRONG_INLINE static Scalar run(const Derived &mat, const Func&) + { + return mat.coeffByOuterInner(outer, inner); + } +}; + +// This is actually dead code and will never be called. It is required +// to prevent false warnings regarding failed inlining though +// for 0 length run() will never be called at all. +template +struct redux_novec_unroller +{ + typedef typename Derived::Scalar Scalar; + EIGEN_STRONG_INLINE static Scalar run(const Derived&, const Func&) { return Scalar(); } +}; + +/*** vectorization ***/ + +template +struct redux_vec_unroller +{ + enum { + PacketSize = packet_traits::size, + HalfLength = Length/2 + }; + + typedef typename Derived::Scalar Scalar; + typedef typename packet_traits::type PacketScalar; + + EIGEN_STRONG_INLINE static PacketScalar run(const Derived &mat, const Func& func) + { + return func.packetOp( + redux_vec_unroller::run(mat,func), + redux_vec_unroller::run(mat,func) ); + } +}; + +template +struct redux_vec_unroller +{ + enum { + index = Start * packet_traits::size, + outer = index / int(Derived::InnerSizeAtCompileTime), + inner = index % int(Derived::InnerSizeAtCompileTime), + alignment = (Derived::Flags & AlignedBit) ? Aligned : Unaligned + }; + + typedef typename Derived::Scalar Scalar; + typedef typename packet_traits::type PacketScalar; + + EIGEN_STRONG_INLINE static PacketScalar run(const Derived &mat, const Func&) + { + return mat.template packetByOuterInner(outer, inner); + } +}; + +/*************************************************************************** +* Part 3 : implementation of all cases +***************************************************************************/ + +template::Traversal, + int Unrolling = redux_traits::Unrolling +> +struct redux_impl; + +template +struct redux_impl +{ + typedef typename Derived::Scalar Scalar; + typedef typename Derived::Index Index; + static EIGEN_STRONG_INLINE Scalar run(const Derived& mat, const Func& func) + { + eigen_assert(mat.rows()>0 && mat.cols()>0 && "you are using an empty matrix"); + Scalar res; + res = mat.coeffByOuterInner(0, 0); + for(Index i = 1; i < mat.innerSize(); ++i) + res = func(res, mat.coeffByOuterInner(0, i)); + for(Index i = 1; i < mat.outerSize(); ++i) + for(Index j = 0; j < mat.innerSize(); ++j) + res = func(res, mat.coeffByOuterInner(i, j)); + return res; + } +}; + +template +struct redux_impl + : public redux_novec_unroller +{}; + +template +struct redux_impl +{ + typedef typename Derived::Scalar Scalar; + typedef typename packet_traits::type PacketScalar; + typedef typename Derived::Index Index; + + static Scalar run(const Derived& mat, const Func& func) + { + const Index size = mat.size(); + eigen_assert(size && "you are using an empty matrix"); + const Index packetSize = packet_traits::size; + const Index alignedStart = first_aligned(mat); + enum { + alignment = bool(Derived::Flags & DirectAccessBit) || bool(Derived::Flags & AlignedBit) + ? Aligned : Unaligned + }; + const Index alignedSize = ((size-alignedStart)/packetSize)*packetSize; + const Index alignedEnd = alignedStart + alignedSize; + Scalar res; + if(alignedSize) + { + PacketScalar packet_res = mat.template packet(alignedStart); + for(Index index = alignedStart + packetSize; index < alignedEnd; index += packetSize) + packet_res = func.packetOp(packet_res, mat.template packet(index)); + res = func.predux(packet_res); + + for(Index index = 0; index < alignedStart; ++index) + res = func(res,mat.coeff(index)); + + for(Index index = alignedEnd; index < size; ++index) + res = func(res,mat.coeff(index)); + } + else // too small to vectorize anything. + // since this is dynamic-size hence inefficient anyway for such small sizes, don't try to optimize. + { + res = mat.coeff(0); + for(Index index = 1; index < size; ++index) + res = func(res,mat.coeff(index)); + } + + return res; + } +}; + +template +struct redux_impl +{ + typedef typename Derived::Scalar Scalar; + typedef typename packet_traits::type PacketScalar; + typedef typename Derived::Index Index; + + static Scalar run(const Derived& mat, const Func& func) + { + eigen_assert(mat.rows()>0 && mat.cols()>0 && "you are using an empty matrix"); + const Index innerSize = mat.innerSize(); + const Index outerSize = mat.outerSize(); + enum { + packetSize = packet_traits::size + }; + const Index packetedInnerSize = ((innerSize)/packetSize)*packetSize; + Scalar res; + if(packetedInnerSize) + { + PacketScalar packet_res = mat.template packet(0,0); + for(Index j=0; j(j,i)); + + res = func.predux(packet_res); + for(Index j=0; j::run(mat, func); + } + + return res; + } +}; + +template +struct redux_impl +{ + typedef typename Derived::Scalar Scalar; + typedef typename packet_traits::type PacketScalar; + enum { + PacketSize = packet_traits::size, + Size = Derived::SizeAtCompileTime, + VectorizedSize = (Size / PacketSize) * PacketSize + }; + EIGEN_STRONG_INLINE static Scalar run(const Derived& mat, const Func& func) + { + eigen_assert(mat.rows()>0 && mat.cols()>0 && "you are using an empty matrix"); + Scalar res = func.predux(redux_vec_unroller::run(mat,func)); + if (VectorizedSize != Size) + res = func(res,redux_novec_unroller::run(mat,func)); + return res; + } +}; + +} // end namespace internal + +/*************************************************************************** +* Part 4 : public API +***************************************************************************/ + + +/** \returns the result of a full redux operation on the whole matrix or vector using \a func + * + * The template parameter \a BinaryOp is the type of the functor \a func which must be + * an associative operator. Both current STL and TR1 functor styles are handled. + * + * \sa DenseBase::sum(), DenseBase::minCoeff(), DenseBase::maxCoeff(), MatrixBase::colwise(), MatrixBase::rowwise() + */ +template +template +EIGEN_STRONG_INLINE typename internal::result_of::Scalar)>::type +DenseBase::redux(const Func& func) const +{ + typedef typename internal::remove_all::type ThisNested; + return internal::redux_impl + ::run(derived(), func); +} + +/** \returns the minimum of all coefficients of *this + */ +template +EIGEN_STRONG_INLINE typename internal::traits::Scalar +DenseBase::minCoeff() const +{ + return this->redux(Eigen::internal::scalar_min_op()); +} + +/** \returns the maximum of all coefficients of *this + */ +template +EIGEN_STRONG_INLINE typename internal::traits::Scalar +DenseBase::maxCoeff() const +{ + return this->redux(Eigen::internal::scalar_max_op()); +} + +/** \returns the sum of all coefficients of *this + * + * \sa trace(), prod(), mean() + */ +template +EIGEN_STRONG_INLINE typename internal::traits::Scalar +DenseBase::sum() const +{ + if(SizeAtCompileTime==0 || (SizeAtCompileTime==Dynamic && size()==0)) + return Scalar(0); + return this->redux(Eigen::internal::scalar_sum_op()); +} + +/** \returns the mean of all coefficients of *this +* +* \sa trace(), prod(), sum() +*/ +template +EIGEN_STRONG_INLINE typename internal::traits::Scalar +DenseBase::mean() const +{ + return Scalar(this->redux(Eigen::internal::scalar_sum_op())) / Scalar(this->size()); +} + +/** \returns the product of all coefficients of *this + * + * Example: \include MatrixBase_prod.cpp + * Output: \verbinclude MatrixBase_prod.out + * + * \sa sum(), mean(), trace() + */ +template +EIGEN_STRONG_INLINE typename internal::traits::Scalar +DenseBase::prod() const +{ + if(SizeAtCompileTime==0 || (SizeAtCompileTime==Dynamic && size()==0)) + return Scalar(1); + return this->redux(Eigen::internal::scalar_product_op()); +} + +/** \returns the trace of \c *this, i.e. the sum of the coefficients on the main diagonal. + * + * \c *this can be any matrix, not necessarily square. + * + * \sa diagonal(), sum() + */ +template +EIGEN_STRONG_INLINE typename internal::traits::Scalar +MatrixBase::trace() const +{ + return derived().diagonal().sum(); +} + +#endif // EIGEN_REDUX_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/Replicate.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/Replicate.h new file mode 100644 index 000000000..d2f9712db --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/Replicate.h @@ -0,0 +1,179 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009-2010 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_REPLICATE_H +#define EIGEN_REPLICATE_H + +/** + * \class Replicate + * \ingroup Core_Module + * + * \brief Expression of the multiple replication of a matrix or vector + * + * \param MatrixType the type of the object we are replicating + * + * This class represents an expression of the multiple replication of a matrix or vector. + * It is the return type of DenseBase::replicate() and most of the time + * this is the only way it is used. + * + * \sa DenseBase::replicate() + */ + +namespace internal { +template +struct traits > + : traits +{ + typedef typename MatrixType::Scalar Scalar; + typedef typename traits::StorageKind StorageKind; + typedef typename traits::XprKind XprKind; + typedef typename nested::type MatrixTypeNested; + typedef typename remove_reference::type _MatrixTypeNested; + enum { + RowsAtCompileTime = RowFactor==Dynamic || int(MatrixType::RowsAtCompileTime)==Dynamic + ? Dynamic + : RowFactor * MatrixType::RowsAtCompileTime, + ColsAtCompileTime = ColFactor==Dynamic || int(MatrixType::ColsAtCompileTime)==Dynamic + ? Dynamic + : ColFactor * MatrixType::ColsAtCompileTime, + //FIXME we don't propagate the max sizes !!! + MaxRowsAtCompileTime = RowsAtCompileTime, + MaxColsAtCompileTime = ColsAtCompileTime, + IsRowMajor = MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1 ? 1 + : MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1 ? 0 + : (MatrixType::Flags & RowMajorBit) ? 1 : 0, + Flags = (_MatrixTypeNested::Flags & HereditaryBits & ~RowMajorBit) | (IsRowMajor ? RowMajorBit : 0), + CoeffReadCost = _MatrixTypeNested::CoeffReadCost + }; +}; +} + +template class Replicate + : public internal::dense_xpr_base< Replicate >::type +{ + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Replicate) + + template + inline explicit Replicate(const OriginalMatrixType& matrix) + : m_matrix(matrix), m_rowFactor(RowFactor), m_colFactor(ColFactor) + { + EIGEN_STATIC_ASSERT((internal::is_same::type,OriginalMatrixType>::value), + THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE) + eigen_assert(RowFactor!=Dynamic && ColFactor!=Dynamic); + } + + template + inline Replicate(const OriginalMatrixType& matrix, int rowFactor, int colFactor) + : m_matrix(matrix), m_rowFactor(rowFactor), m_colFactor(colFactor) + { + EIGEN_STATIC_ASSERT((internal::is_same::type,OriginalMatrixType>::value), + THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE) + } + + inline Index rows() const { return m_matrix.rows() * m_rowFactor.value(); } + inline Index cols() const { return m_matrix.cols() * m_colFactor.value(); } + + inline Scalar coeff(Index row, Index col) const + { + // try to avoid using modulo; this is a pure optimization strategy + const Index actual_row = internal::traits::RowsAtCompileTime==1 ? 0 + : RowFactor==1 ? row + : row%m_matrix.rows(); + const Index actual_col = internal::traits::ColsAtCompileTime==1 ? 0 + : ColFactor==1 ? col + : col%m_matrix.cols(); + + return m_matrix.coeff(actual_row, actual_col); + } + template + inline PacketScalar packet(Index row, Index col) const + { + const Index actual_row = internal::traits::RowsAtCompileTime==1 ? 0 + : RowFactor==1 ? row + : row%m_matrix.rows(); + const Index actual_col = internal::traits::ColsAtCompileTime==1 ? 0 + : ColFactor==1 ? col + : col%m_matrix.cols(); + + return m_matrix.template packet(actual_row, actual_col); + } + + + protected: + const typename MatrixType::Nested m_matrix; + const internal::variable_if_dynamic m_rowFactor; + const internal::variable_if_dynamic m_colFactor; +}; + +/** + * \return an expression of the replication of \c *this + * + * Example: \include MatrixBase_replicate.cpp + * Output: \verbinclude MatrixBase_replicate.out + * + * \sa VectorwiseOp::replicate(), DenseBase::replicate(Index,Index), class Replicate + */ +template +template +inline const Replicate +DenseBase::replicate() const +{ + return Replicate(derived()); +} + +/** + * \return an expression of the replication of \c *this + * + * Example: \include MatrixBase_replicate_int_int.cpp + * Output: \verbinclude MatrixBase_replicate_int_int.out + * + * \sa VectorwiseOp::replicate(), DenseBase::replicate(), class Replicate + */ +template +inline const Replicate +DenseBase::replicate(Index rowFactor,Index colFactor) const +{ + return Replicate(derived(),rowFactor,colFactor); +} + +/** + * \return an expression of the replication of each column (or row) of \c *this + * + * Example: \include DirectionWise_replicate_int.cpp + * Output: \verbinclude DirectionWise_replicate_int.out + * + * \sa VectorwiseOp::replicate(), DenseBase::replicate(), class Replicate + */ +template +const typename VectorwiseOp::ReplicateReturnType +VectorwiseOp::replicate(Index factor) const +{ + return typename VectorwiseOp::ReplicateReturnType + (_expression(),Direction==Vertical?factor:1,Direction==Horizontal?factor:1); +} + +#endif // EIGEN_REPLICATE_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/ReturnByValue.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/ReturnByValue.h new file mode 100644 index 000000000..24c5a4e21 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/ReturnByValue.h @@ -0,0 +1,99 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009-2010 Gael Guennebaud +// Copyright (C) 2009-2010 Benoit Jacob +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_RETURNBYVALUE_H +#define EIGEN_RETURNBYVALUE_H + +/** \class ReturnByValue + * \ingroup Core_Module + * + */ + +namespace internal { + +template +struct traits > + : public traits::ReturnType> +{ + enum { + // We're disabling the DirectAccess because e.g. the constructor of + // the Block-with-DirectAccess expression requires to have a coeffRef method. + // Also, we don't want to have to implement the stride stuff. + Flags = (traits::ReturnType>::Flags + | EvalBeforeNestingBit) & ~DirectAccessBit + }; +}; + +/* The ReturnByValue object doesn't even have a coeff() method. + * So the only way that nesting it in an expression can work, is by evaluating it into a plain matrix. + * So internal::nested always gives the plain return matrix type. + * + * FIXME: I don't understand why we need this specialization: isn't this taken care of by the EvalBeforeNestingBit ?? + */ +template +struct nested, n, PlainObject> +{ + typedef typename traits::ReturnType type; +}; + +} // end namespace internal + +template class ReturnByValue + : public internal::dense_xpr_base< ReturnByValue >::type +{ + public: + typedef typename internal::traits::ReturnType ReturnType; + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(ReturnByValue) + + template + inline void evalTo(Dest& dst) const + { static_cast(this)->evalTo(dst); } + inline Index rows() const { return static_cast(this)->rows(); } + inline Index cols() const { return static_cast(this)->cols(); } + +#ifndef EIGEN_PARSED_BY_DOXYGEN +#define Unusable YOU_ARE_TRYING_TO_ACCESS_A_SINGLE_COEFFICIENT_IN_A_SPECIAL_EXPRESSION_WHERE_THAT_IS_NOT_ALLOWED_BECAUSE_THAT_WOULD_BE_INEFFICIENT + class Unusable{ + Unusable(const Unusable&) {} + Unusable& operator=(const Unusable&) {return *this;} + }; + const Unusable& coeff(Index) const { return *reinterpret_cast(this); } + const Unusable& coeff(Index,Index) const { return *reinterpret_cast(this); } + Unusable& coeffRef(Index) { return *reinterpret_cast(this); } + Unusable& coeffRef(Index,Index) { return *reinterpret_cast(this); } +#endif +}; + +template +template +Derived& DenseBase::operator=(const ReturnByValue& other) +{ + other.evalTo(derived()); + return derived(); +} + +#endif // EIGEN_RETURNBYVALUE_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/Reverse.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/Reverse.h new file mode 100644 index 000000000..600744ae7 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/Reverse.h @@ -0,0 +1,230 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2009 Ricard Marxer +// Copyright (C) 2009-2010 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_REVERSE_H +#define EIGEN_REVERSE_H + +/** \class Reverse + * \ingroup Core_Module + * + * \brief Expression of the reverse of a vector or matrix + * + * \param MatrixType the type of the object of which we are taking the reverse + * + * This class represents an expression of the reverse of a vector. + * It is the return type of MatrixBase::reverse() and VectorwiseOp::reverse() + * and most of the time this is the only way it is used. + * + * \sa MatrixBase::reverse(), VectorwiseOp::reverse() + */ + +namespace internal { + +template +struct traits > + : traits +{ + typedef typename MatrixType::Scalar Scalar; + typedef typename traits::StorageKind StorageKind; + typedef typename traits::XprKind XprKind; + typedef typename nested::type MatrixTypeNested; + typedef typename remove_reference::type _MatrixTypeNested; + enum { + RowsAtCompileTime = MatrixType::RowsAtCompileTime, + ColsAtCompileTime = MatrixType::ColsAtCompileTime, + MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, + MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, + + // let's enable LinearAccess only with vectorization because of the product overhead + LinearAccess = ( (Direction==BothDirections) && (int(_MatrixTypeNested::Flags)&PacketAccessBit) ) + ? LinearAccessBit : 0, + + Flags = int(_MatrixTypeNested::Flags) & (HereditaryBits | LvalueBit | PacketAccessBit | LinearAccess), + + CoeffReadCost = _MatrixTypeNested::CoeffReadCost + }; +}; + +template struct reverse_packet_cond +{ + static inline PacketScalar run(const PacketScalar& x) { return preverse(x); } +}; + +template struct reverse_packet_cond +{ + static inline PacketScalar run(const PacketScalar& x) { return x; } +}; + +} // end namespace internal + +template class Reverse + : public internal::dense_xpr_base< Reverse >::type +{ + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Reverse) + using Base::IsRowMajor; + + // next line is necessary because otherwise const version of operator() + // is hidden by non-const version defined in this file + using Base::operator(); + + protected: + enum { + PacketSize = internal::packet_traits::size, + IsColMajor = !IsRowMajor, + ReverseRow = (Direction == Vertical) || (Direction == BothDirections), + ReverseCol = (Direction == Horizontal) || (Direction == BothDirections), + OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1, + OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1, + ReversePacket = (Direction == BothDirections) + || ((Direction == Vertical) && IsColMajor) + || ((Direction == Horizontal) && IsRowMajor) + }; + typedef internal::reverse_packet_cond reverse_packet; + public: + + inline Reverse(const MatrixType& matrix) : m_matrix(matrix) { } + + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Reverse) + + inline Index rows() const { return m_matrix.rows(); } + inline Index cols() const { return m_matrix.cols(); } + + inline Index innerStride() const + { + return -m_matrix.innerStride(); + } + + inline Scalar& operator()(Index row, Index col) + { + eigen_assert(row >= 0 && row < rows() && col >= 0 && col < cols()); + return coeffRef(row, col); + } + + inline Scalar& coeffRef(Index row, Index col) + { + return m_matrix.const_cast_derived().coeffRef(ReverseRow ? m_matrix.rows() - row - 1 : row, + ReverseCol ? m_matrix.cols() - col - 1 : col); + } + + inline CoeffReturnType coeff(Index row, Index col) const + { + return m_matrix.coeff(ReverseRow ? m_matrix.rows() - row - 1 : row, + ReverseCol ? m_matrix.cols() - col - 1 : col); + } + + inline CoeffReturnType coeff(Index index) const + { + return m_matrix.coeff(m_matrix.size() - index - 1); + } + + inline Scalar& coeffRef(Index index) + { + return m_matrix.const_cast_derived().coeffRef(m_matrix.size() - index - 1); + } + + inline Scalar& operator()(Index index) + { + eigen_assert(index >= 0 && index < m_matrix.size()); + return coeffRef(index); + } + + template + inline const PacketScalar packet(Index row, Index col) const + { + return reverse_packet::run(m_matrix.template packet( + ReverseRow ? m_matrix.rows() - row - OffsetRow : row, + ReverseCol ? m_matrix.cols() - col - OffsetCol : col)); + } + + template + inline void writePacket(Index row, Index col, const PacketScalar& x) + { + m_matrix.const_cast_derived().template writePacket( + ReverseRow ? m_matrix.rows() - row - OffsetRow : row, + ReverseCol ? m_matrix.cols() - col - OffsetCol : col, + reverse_packet::run(x)); + } + + template + inline const PacketScalar packet(Index index) const + { + return internal::preverse(m_matrix.template packet( m_matrix.size() - index - PacketSize )); + } + + template + inline void writePacket(Index index, const PacketScalar& x) + { + m_matrix.const_cast_derived().template writePacket(m_matrix.size() - index - PacketSize, internal::preverse(x)); + } + + protected: + const typename MatrixType::Nested m_matrix; +}; + +/** \returns an expression of the reverse of *this. + * + * Example: \include MatrixBase_reverse.cpp + * Output: \verbinclude MatrixBase_reverse.out + * + */ +template +inline typename DenseBase::ReverseReturnType +DenseBase::reverse() +{ + return derived(); +} + +/** This is the const version of reverse(). */ +template +inline const typename DenseBase::ConstReverseReturnType +DenseBase::reverse() const +{ + return derived(); +} + +/** This is the "in place" version of reverse: it reverses \c *this. + * + * In most cases it is probably better to simply use the reversed expression + * of a matrix. However, when reversing the matrix data itself is really needed, + * then this "in-place" version is probably the right choice because it provides + * the following additional features: + * - less error prone: doing the same operation with .reverse() requires special care: + * \code m = m.reverse().eval(); \endcode + * - this API allows to avoid creating a temporary (the current implementation creates a temporary, but that could be avoided using swap) + * - it allows future optimizations (cache friendliness, etc.) + * + * \sa reverse() */ +template +inline void DenseBase::reverseInPlace() +{ + derived() = derived().reverse().eval(); +} + + +#endif // EIGEN_REVERSE_H diff --git a/gtsam/3rdparty/Eigen/Eigen/src/Core/Select.h b/gtsam/3rdparty/Eigen/Eigen/src/Core/Select.h new file mode 100644 index 000000000..d0cd66a26 --- /dev/null +++ b/gtsam/3rdparty/Eigen/Eigen/src/Core/Select.h @@ -0,0 +1,158 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2010 Gael Guennebaud +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see . + +#ifndef EIGEN_SELECT_H +#define EIGEN_SELECT_H + +/** \class Select + * \ingroup Core_Module + * + * \brief Expression of a coefficient wise version of the C++ ternary operator ?: + * + * \param ConditionMatrixType the type of the \em condition expression which must be a boolean matrix + * \param ThenMatrixType the type of the \em then expression + * \param ElseMatrixType the type of the \em else expression + * + * This class represents an expression of a coefficient wise version of the C++ ternary operator ?:. + * It is the return type of DenseBase::select() and most of the time this is the only way it is used. + * + * \sa DenseBase::select(const DenseBase&, const DenseBase&) const + */ + +namespace internal { +template +struct traits > + : traits +{ + typedef typename traits::Scalar Scalar; + typedef Dense StorageKind; + typedef typename traits::XprKind XprKind; + typedef typename ConditionMatrixType::Nested ConditionMatrixNested; + typedef typename ThenMatrixType::Nested ThenMatrixNested; + typedef typename ElseMatrixType::Nested ElseMatrixNested; + enum { + RowsAtCompileTime = ConditionMatrixType::RowsAtCompileTime, + ColsAtCompileTime = ConditionMatrixType::ColsAtCompileTime, + MaxRowsAtCompileTime = ConditionMatrixType::MaxRowsAtCompileTime, + MaxColsAtCompileTime = ConditionMatrixType::MaxColsAtCompileTime, + Flags = (unsigned int)ThenMatrixType::Flags & ElseMatrixType::Flags & HereditaryBits, + CoeffReadCost = traits::type>::CoeffReadCost + + EIGEN_SIZE_MAX(traits::type>::CoeffReadCost, + traits::type>::CoeffReadCost) + }; +}; +} + +template +class Select : internal::no_assignment_operator, + public internal::dense_xpr_base< Select >::type +{ + public: + + typedef typename internal::dense_xpr_base