Repository: zju3dv/PVO Branch: main Commit: c67a15f4e095 Files: 3988 Total size: 27.7 MB Directory structure: gitextract_fb98d_ml/ ├── .gitignore ├── README.md ├── VO_Module/ │ ├── README.md │ ├── calib/ │ │ ├── barn.txt │ │ ├── eth.txt │ │ ├── euroc.txt │ │ ├── kitti.txt │ │ ├── replica.txt │ │ ├── tartan.txt │ │ └── tum3.txt │ ├── demo.py │ ├── droid_slam/ │ │ ├── data_readers/ │ │ │ ├── __init__.py │ │ │ ├── augmentation.py │ │ │ ├── base.py │ │ │ ├── factory.py │ │ │ ├── replica.py │ │ │ ├── replica_test.txt │ │ │ ├── replica_utils.py │ │ │ ├── rgbd_utils.py │ │ │ ├── stream.py │ │ │ ├── tartan.py │ │ │ ├── tartan_test.txt │ │ │ └── vkitti2.py │ │ ├── depth_video.py │ │ ├── droid.py │ │ ├── droid_backend.py │ │ ├── droid_frontend.py │ │ ├── droid_net.py │ │ ├── factor_graph.py │ │ ├── geom/ │ │ │ ├── __init__.py │ │ │ ├── ba.py │ │ │ ├── chol.py │ │ │ ├── graph_utils.py │ │ │ ├── losses.py │ │ │ └── projective_ops.py │ │ ├── logger.py │ │ ├── modules/ │ │ │ ├── __init__.py │ │ │ ├── clipping.py │ │ │ ├── corr.py │ │ │ ├── extractor.py │ │ │ └── gru.py │ │ ├── motion_filter.py │ │ ├── trajectory_filler.py │ │ └── visualization.py │ ├── environment.yaml │ ├── environment_novis.yaml │ ├── evaluation_scripts/ │ │ ├── flow_vis_utils.py │ │ ├── test_vo.py │ │ └── test_vo2.py │ ├── setup.py │ ├── src/ │ │ ├── altcorr_kernel.cu │ │ ├── correlation_kernels.cu │ │ ├── droid.cpp │ │ └── droid_kernels.cu │ ├── thirdparty/ │ │ ├── eigen/ │ │ │ ├── .gitignore │ │ │ ├── .gitlab/ │ │ │ │ ├── issue_templates/ │ │ │ │ │ ├── Bug Report.md │ │ │ │ │ └── Feature Request.md │ │ │ │ └── merge_request_templates/ │ │ │ │ └── Merge Request Template.md │ │ │ ├── .gitlab-ci.yml │ │ │ ├── .hgeol │ │ │ ├── CMakeLists.txt │ │ │ ├── COPYING.APACHE │ │ │ ├── COPYING.BSD │ │ │ ├── COPYING.GPL │ │ │ ├── COPYING.LGPL │ │ │ ├── COPYING.MINPACK │ │ │ ├── COPYING.MPL2 │ │ │ ├── COPYING.README │ │ │ ├── CTestConfig.cmake │ │ │ ├── CTestCustom.cmake.in │ │ │ ├── Eigen/ │ │ │ │ ├── Cholesky │ │ │ │ ├── CholmodSupport │ │ │ │ ├── Dense │ │ │ │ ├── Eigen │ │ │ │ ├── Eigenvalues │ │ │ │ ├── Geometry │ │ │ │ ├── Householder │ │ │ │ ├── IterativeLinearSolvers │ │ │ │ ├── Jacobi │ │ │ │ ├── KLUSupport │ │ │ │ ├── LU │ │ │ │ ├── MetisSupport │ │ │ │ ├── OrderingMethods │ │ │ │ ├── PaStiXSupport │ │ │ │ ├── PardisoSupport │ │ │ │ ├── QR │ │ │ │ ├── QtAlignedMalloc │ │ │ │ ├── SPQRSupport │ │ │ │ ├── SVD │ │ │ │ ├── Sparse │ │ │ │ ├── SparseCholesky │ │ │ │ ├── SparseCore │ │ │ │ ├── SparseLU │ │ │ │ ├── SparseQR │ │ │ │ ├── StdDeque │ │ │ │ ├── StdList │ │ │ │ ├── StdVector │ │ │ │ ├── SuperLUSupport │ │ │ │ ├── UmfPackSupport │ │ │ │ └── src/ │ │ │ │ ├── Cholesky/ │ │ │ │ │ ├── LDLT.h │ │ │ │ │ ├── LLT.h │ │ │ │ │ └── LLT_LAPACKE.h │ │ │ │ ├── CholmodSupport/ │ │ │ │ │ └── CholmodSupport.h │ │ │ │ ├── Eigenvalues/ │ │ │ │ │ ├── ComplexEigenSolver.h │ │ │ │ │ ├── ComplexSchur.h │ │ │ │ │ ├── ComplexSchur_LAPACKE.h │ │ │ │ │ ├── EigenSolver.h │ │ │ │ │ ├── GeneralizedEigenSolver.h │ │ │ │ │ ├── GeneralizedSelfAdjointEigenSolver.h │ │ │ │ │ ├── HessenbergDecomposition.h │ │ │ │ │ ├── MatrixBaseEigenvalues.h │ │ │ │ │ ├── RealQZ.h │ │ │ │ │ ├── RealSchur.h │ │ │ │ │ ├── RealSchur_LAPACKE.h │ │ │ │ │ ├── SelfAdjointEigenSolver.h │ │ │ │ │ ├── SelfAdjointEigenSolver_LAPACKE.h │ │ │ │ │ └── Tridiagonalization.h │ │ │ │ ├── Geometry/ │ │ │ │ │ ├── AlignedBox.h │ │ │ │ │ ├── AngleAxis.h │ │ │ │ │ ├── EulerAngles.h │ │ │ │ │ ├── Homogeneous.h │ │ │ │ │ ├── Hyperplane.h │ │ │ │ │ ├── OrthoMethods.h │ │ │ │ │ ├── ParametrizedLine.h │ │ │ │ │ ├── Quaternion.h │ │ │ │ │ ├── Rotation2D.h │ │ │ │ │ ├── RotationBase.h │ │ │ │ │ ├── Scaling.h │ │ │ │ │ ├── Transform.h │ │ │ │ │ ├── Translation.h │ │ │ │ │ ├── Umeyama.h │ │ │ │ │ └── arch/ │ │ │ │ │ └── Geometry_SIMD.h │ │ │ │ ├── Householder/ │ │ │ │ │ ├── BlockHouseholder.h │ │ │ │ │ ├── Householder.h │ │ │ │ │ └── HouseholderSequence.h │ │ │ │ ├── IterativeLinearSolvers/ │ │ │ │ │ ├── BasicPreconditioners.h │ │ │ │ │ ├── BiCGSTAB.h │ │ │ │ │ ├── ConjugateGradient.h │ │ │ │ │ ├── IncompleteCholesky.h │ │ │ │ │ ├── IncompleteLUT.h │ │ │ │ │ ├── IterativeSolverBase.h │ │ │ │ │ ├── LeastSquareConjugateGradient.h │ │ │ │ │ └── SolveWithGuess.h │ │ │ │ ├── Jacobi/ │ │ │ │ │ └── Jacobi.h │ │ │ │ ├── KLUSupport/ │ │ │ │ │ └── KLUSupport.h │ │ │ │ ├── LU/ │ │ │ │ │ ├── Determinant.h │ │ │ │ │ ├── FullPivLU.h │ │ │ │ │ ├── InverseImpl.h │ │ │ │ │ ├── PartialPivLU.h │ │ │ │ │ ├── PartialPivLU_LAPACKE.h │ │ │ │ │ └── arch/ │ │ │ │ │ └── InverseSize4.h │ │ │ │ ├── MetisSupport/ │ │ │ │ │ └── MetisSupport.h │ │ │ │ ├── OrderingMethods/ │ │ │ │ │ ├── Amd.h │ │ │ │ │ ├── Eigen_Colamd.h │ │ │ │ │ └── Ordering.h │ │ │ │ ├── PaStiXSupport/ │ │ │ │ │ └── PaStiXSupport.h │ │ │ │ ├── PardisoSupport/ │ │ │ │ │ └── PardisoSupport.h │ │ │ │ ├── QR/ │ │ │ │ │ ├── ColPivHouseholderQR.h │ │ │ │ │ ├── ColPivHouseholderQR_LAPACKE.h │ │ │ │ │ ├── CompleteOrthogonalDecomposition.h │ │ │ │ │ ├── FullPivHouseholderQR.h │ │ │ │ │ ├── HouseholderQR.h │ │ │ │ │ └── HouseholderQR_LAPACKE.h │ │ │ │ ├── SPQRSupport/ │ │ │ │ │ └── SuiteSparseQRSupport.h │ │ │ │ ├── SVD/ │ │ │ │ │ ├── BDCSVD.h │ │ │ │ │ ├── JacobiSVD.h │ │ │ │ │ ├── JacobiSVD_LAPACKE.h │ │ │ │ │ ├── SVDBase.h │ │ │ │ │ └── UpperBidiagonalization.h │ │ │ │ ├── SparseCholesky/ │ │ │ │ │ ├── SimplicialCholesky.h │ │ │ │ │ └── SimplicialCholesky_impl.h │ │ │ │ ├── SparseCore/ │ │ │ │ │ ├── AmbiVector.h │ │ │ │ │ ├── CompressedStorage.h │ │ │ │ │ ├── ConservativeSparseSparseProduct.h │ │ │ │ │ ├── MappedSparseMatrix.h │ │ │ │ │ ├── SparseAssign.h │ │ │ │ │ ├── SparseBlock.h │ │ │ │ │ ├── SparseColEtree.h │ │ │ │ │ ├── SparseCompressedBase.h │ │ │ │ │ ├── SparseCwiseBinaryOp.h │ │ │ │ │ ├── SparseCwiseUnaryOp.h │ │ │ │ │ ├── SparseDenseProduct.h │ │ │ │ │ ├── SparseDiagonalProduct.h │ │ │ │ │ ├── SparseDot.h │ │ │ │ │ ├── SparseFuzzy.h │ │ │ │ │ ├── SparseMap.h │ │ │ │ │ ├── SparseMatrix.h │ │ │ │ │ ├── SparseMatrixBase.h │ │ │ │ │ ├── SparsePermutation.h │ │ │ │ │ ├── SparseProduct.h │ │ │ │ │ ├── SparseRedux.h │ │ │ │ │ ├── SparseRef.h │ │ │ │ │ ├── SparseSelfAdjointView.h │ │ │ │ │ ├── SparseSolverBase.h │ │ │ │ │ ├── SparseSparseProductWithPruning.h │ │ │ │ │ ├── SparseTranspose.h │ │ │ │ │ ├── SparseTriangularView.h │ │ │ │ │ ├── SparseUtil.h │ │ │ │ │ ├── SparseVector.h │ │ │ │ │ ├── SparseView.h │ │ │ │ │ └── TriangularSolver.h │ │ │ │ ├── SparseLU/ │ │ │ │ │ ├── SparseLU.h │ │ │ │ │ ├── SparseLUImpl.h │ │ │ │ │ ├── SparseLU_Memory.h │ │ │ │ │ ├── SparseLU_Structs.h │ │ │ │ │ ├── SparseLU_SupernodalMatrix.h │ │ │ │ │ ├── SparseLU_Utils.h │ │ │ │ │ ├── SparseLU_column_bmod.h │ │ │ │ │ ├── SparseLU_column_dfs.h │ │ │ │ │ ├── SparseLU_copy_to_ucol.h │ │ │ │ │ ├── SparseLU_gemm_kernel.h │ │ │ │ │ ├── SparseLU_heap_relax_snode.h │ │ │ │ │ ├── SparseLU_kernel_bmod.h │ │ │ │ │ ├── SparseLU_panel_bmod.h │ │ │ │ │ ├── SparseLU_panel_dfs.h │ │ │ │ │ ├── SparseLU_pivotL.h │ │ │ │ │ ├── SparseLU_pruneL.h │ │ │ │ │ └── SparseLU_relax_snode.h │ │ │ │ ├── SparseQR/ │ │ │ │ │ └── SparseQR.h │ │ │ │ ├── StlSupport/ │ │ │ │ │ ├── StdDeque.h │ │ │ │ │ ├── StdList.h │ │ │ │ │ ├── StdVector.h │ │ │ │ │ └── details.h │ │ │ │ ├── SuperLUSupport/ │ │ │ │ │ └── SuperLUSupport.h │ │ │ │ ├── UmfPackSupport/ │ │ │ │ │ └── UmfPackSupport.h │ │ │ │ ├── misc/ │ │ │ │ │ ├── Image.h │ │ │ │ │ ├── Kernel.h │ │ │ │ │ ├── RealSvd2x2.h │ │ │ │ │ ├── blas.h │ │ │ │ │ ├── lapack.h │ │ │ │ │ ├── lapacke.h │ │ │ │ │ └── lapacke_mangling.h │ │ │ │ └── plugins/ │ │ │ │ ├── ArrayCwiseBinaryOps.h │ │ │ │ ├── ArrayCwiseUnaryOps.h │ │ │ │ ├── BlockMethods.h │ │ │ │ ├── CommonCwiseBinaryOps.h │ │ │ │ ├── CommonCwiseUnaryOps.h │ │ │ │ ├── IndexedViewMethods.h │ │ │ │ ├── MatrixCwiseBinaryOps.h │ │ │ │ ├── MatrixCwiseUnaryOps.h │ │ │ │ └── ReshapedMethods.h │ │ │ ├── INSTALL │ │ │ ├── README.md │ │ │ ├── bench/ │ │ │ │ ├── BenchSparseUtil.h │ │ │ │ ├── BenchTimer.h │ │ │ │ ├── BenchUtil.h │ │ │ │ ├── README.txt │ │ │ │ ├── analyze-blocking-sizes.cpp │ │ │ │ ├── basicbench.cxxlist │ │ │ │ ├── basicbenchmark.cpp │ │ │ │ ├── basicbenchmark.h │ │ │ │ ├── benchBlasGemm.cpp │ │ │ │ ├── benchCholesky.cpp │ │ │ │ ├── benchEigenSolver.cpp │ │ │ │ ├── benchFFT.cpp │ │ │ │ ├── benchGeometry.cpp │ │ │ │ ├── benchVecAdd.cpp │ │ │ │ ├── bench_gemm.cpp │ │ │ │ ├── bench_move_semantics.cpp │ │ │ │ ├── bench_multi_compilers.sh │ │ │ │ ├── bench_norm.cpp │ │ │ │ ├── bench_reverse.cpp │ │ │ │ ├── bench_sum.cpp │ │ │ │ ├── bench_unrolling │ │ │ │ ├── benchmark-blocking-sizes.cpp │ │ │ │ ├── benchmark.cpp │ │ │ │ ├── benchmarkSlice.cpp │ │ │ │ ├── benchmarkX.cpp │ │ │ │ ├── benchmarkXcwise.cpp │ │ │ │ ├── benchmark_suite │ │ │ │ ├── btl/ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── COPYING │ │ │ │ │ ├── README │ │ │ │ │ ├── actions/ │ │ │ │ │ │ ├── action_aat_product.hh │ │ │ │ │ │ ├── action_ata_product.hh │ │ │ │ │ │ ├── action_atv_product.hh │ │ │ │ │ │ ├── action_axpby.hh │ │ │ │ │ │ ├── action_axpy.hh │ │ │ │ │ │ ├── action_cholesky.hh │ │ │ │ │ │ ├── action_ger.hh │ │ │ │ │ │ ├── action_hessenberg.hh │ │ │ │ │ │ ├── action_lu_decomp.hh │ │ │ │ │ │ ├── action_lu_solve.hh │ │ │ │ │ │ ├── action_matrix_matrix_product.hh │ │ │ │ │ │ ├── action_matrix_matrix_product_bis.hh │ │ │ │ │ │ ├── action_matrix_vector_product.hh │ │ │ │ │ │ ├── action_partial_lu.hh │ │ │ │ │ │ ├── action_rot.hh │ │ │ │ │ │ ├── action_symv.hh │ │ │ │ │ │ ├── action_syr2.hh │ │ │ │ │ │ ├── action_trisolve.hh │ │ │ │ │ │ ├── action_trisolve_matrix.hh │ │ │ │ │ │ ├── action_trmm.hh │ │ │ │ │ │ └── basic_actions.hh │ │ │ │ │ ├── cmake/ │ │ │ │ │ │ ├── FindACML.cmake │ │ │ │ │ │ ├── FindATLAS.cmake │ │ │ │ │ │ ├── FindBLAZE.cmake │ │ │ │ │ │ ├── FindBlitz.cmake │ │ │ │ │ │ ├── FindCBLAS.cmake │ │ │ │ │ │ ├── FindGMM.cmake │ │ │ │ │ │ ├── FindMKL.cmake │ │ │ │ │ │ ├── FindMTL4.cmake │ │ │ │ │ │ ├── FindOPENBLAS.cmake │ │ │ │ │ │ ├── FindPackageHandleStandardArgs.cmake │ │ │ │ │ │ ├── FindTvmet.cmake │ │ │ │ │ │ └── MacroOptionalAddSubdirectory.cmake │ │ │ │ │ ├── generic_bench/ │ │ │ │ │ │ ├── bench.hh │ │ │ │ │ │ ├── bench_parameter.hh │ │ │ │ │ │ ├── btl.hh │ │ │ │ │ │ ├── init/ │ │ │ │ │ │ │ ├── init_function.hh │ │ │ │ │ │ │ ├── init_matrix.hh │ │ │ │ │ │ │ └── init_vector.hh │ │ │ │ │ │ ├── static/ │ │ │ │ │ │ │ ├── bench_static.hh │ │ │ │ │ │ │ ├── intel_bench_fixed_size.hh │ │ │ │ │ │ │ └── static_size_generator.hh │ │ │ │ │ │ ├── timers/ │ │ │ │ │ │ │ ├── STL_perf_analyzer.hh │ │ │ │ │ │ │ ├── STL_timer.hh │ │ │ │ │ │ │ ├── mixed_perf_analyzer.hh │ │ │ │ │ │ │ ├── portable_perf_analyzer.hh │ │ │ │ │ │ │ ├── portable_perf_analyzer_old.hh │ │ │ │ │ │ │ ├── portable_timer.hh │ │ │ │ │ │ │ ├── x86_perf_analyzer.hh │ │ │ │ │ │ │ └── x86_timer.hh │ │ │ │ │ │ └── utils/ │ │ │ │ │ │ ├── size_lin_log.hh │ │ │ │ │ │ ├── size_log.hh │ │ │ │ │ │ ├── utilities.h │ │ │ │ │ │ └── xy_file.hh │ │ │ │ │ └── libs/ │ │ │ │ │ ├── BLAS/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── blas.h │ │ │ │ │ │ ├── blas_interface.hh │ │ │ │ │ │ ├── blas_interface_impl.hh │ │ │ │ │ │ ├── c_interface_base.h │ │ │ │ │ │ └── main.cpp │ │ │ │ │ ├── STL/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── STL_interface.hh │ │ │ │ │ │ └── main.cpp │ │ │ │ │ ├── blaze/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── blaze_interface.hh │ │ │ │ │ │ └── main.cpp │ │ │ │ │ ├── blitz/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── blitz_LU_solve_interface.hh │ │ │ │ │ │ ├── blitz_interface.hh │ │ │ │ │ │ ├── btl_blitz.cpp │ │ │ │ │ │ ├── btl_tiny_blitz.cpp │ │ │ │ │ │ └── tiny_blitz_interface.hh │ │ │ │ │ ├── eigen2/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── btl_tiny_eigen2.cpp │ │ │ │ │ │ ├── eigen2_interface.hh │ │ │ │ │ │ ├── main_adv.cpp │ │ │ │ │ │ ├── main_linear.cpp │ │ │ │ │ │ ├── main_matmat.cpp │ │ │ │ │ │ └── main_vecmat.cpp │ │ │ │ │ ├── eigen3/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── btl_tiny_eigen3.cpp │ │ │ │ │ │ ├── eigen3_interface.hh │ │ │ │ │ │ ├── main_adv.cpp │ │ │ │ │ │ ├── main_linear.cpp │ │ │ │ │ │ ├── main_matmat.cpp │ │ │ │ │ │ └── main_vecmat.cpp │ │ │ │ │ ├── gmm/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── gmm_LU_solve_interface.hh │ │ │ │ │ │ ├── gmm_interface.hh │ │ │ │ │ │ └── main.cpp │ │ │ │ │ ├── mtl4/ │ │ │ │ │ │ ├── .kdbgrc.main │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── main.cpp │ │ │ │ │ │ ├── mtl4_LU_solve_interface.hh │ │ │ │ │ │ └── mtl4_interface.hh │ │ │ │ │ ├── tensors/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── main_linear.cpp │ │ │ │ │ │ ├── main_matmat.cpp │ │ │ │ │ │ ├── main_vecmat.cpp │ │ │ │ │ │ └── tensor_interface.hh │ │ │ │ │ ├── tvmet/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── main.cpp │ │ │ │ │ │ └── tvmet_interface.hh │ │ │ │ │ └── ublas/ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── main.cpp │ │ │ │ │ └── ublas_interface.hh │ │ │ │ ├── check_cache_queries.cpp │ │ │ │ ├── dense_solvers.cpp │ │ │ │ ├── eig33.cpp │ │ │ │ ├── geometry.cpp │ │ │ │ ├── perf_monitoring/ │ │ │ │ │ ├── changesets.txt │ │ │ │ │ ├── gemm.cpp │ │ │ │ │ ├── gemm_common.h │ │ │ │ │ ├── gemm_settings.txt │ │ │ │ │ ├── gemm_square_settings.txt │ │ │ │ │ ├── gemv.cpp │ │ │ │ │ ├── gemv_common.h │ │ │ │ │ ├── gemv_settings.txt │ │ │ │ │ ├── gemv_square_settings.txt │ │ │ │ │ ├── gemvt.cpp │ │ │ │ │ ├── lazy_gemm.cpp │ │ │ │ │ ├── lazy_gemm_settings.txt │ │ │ │ │ ├── llt.cpp │ │ │ │ │ ├── make_plot.sh │ │ │ │ │ ├── resources/ │ │ │ │ │ │ ├── chart_footer.html │ │ │ │ │ │ ├── chart_header.html │ │ │ │ │ │ ├── footer.html │ │ │ │ │ │ ├── header.html │ │ │ │ │ │ ├── s1.js │ │ │ │ │ │ └── s2.js │ │ │ │ │ ├── run.sh │ │ │ │ │ ├── runall.sh │ │ │ │ │ ├── trmv_lo.cpp │ │ │ │ │ ├── trmv_lot.cpp │ │ │ │ │ ├── trmv_up.cpp │ │ │ │ │ └── trmv_upt.cpp │ │ │ │ ├── product_threshold.cpp │ │ │ │ ├── quat_slerp.cpp │ │ │ │ ├── quatmul.cpp │ │ │ │ ├── sparse_cholesky.cpp │ │ │ │ ├── sparse_dense_product.cpp │ │ │ │ ├── sparse_lu.cpp │ │ │ │ ├── sparse_product.cpp │ │ │ │ ├── sparse_randomsetter.cpp │ │ │ │ ├── sparse_setter.cpp │ │ │ │ ├── sparse_transpose.cpp │ │ │ │ ├── sparse_trisolver.cpp │ │ │ │ ├── spbench/ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── sp_solver.cpp │ │ │ │ │ ├── spbench.dtd │ │ │ │ │ ├── spbenchsolver.cpp │ │ │ │ │ ├── spbenchsolver.h │ │ │ │ │ ├── spbenchstyle.h │ │ │ │ │ └── test_sparseLU.cpp │ │ │ │ ├── spmv.cpp │ │ │ │ ├── tensors/ │ │ │ │ │ ├── README │ │ │ │ │ ├── benchmark.h │ │ │ │ │ ├── benchmark_main.cc │ │ │ │ │ ├── contraction_benchmarks_cpu.cc │ │ │ │ │ ├── eigen_sycl_bench.sh │ │ │ │ │ ├── eigen_sycl_bench_contract.sh │ │ │ │ │ ├── tensor_benchmarks.h │ │ │ │ │ ├── tensor_benchmarks_cpu.cc │ │ │ │ │ ├── tensor_benchmarks_fp16_gpu.cu │ │ │ │ │ ├── tensor_benchmarks_gpu.cu │ │ │ │ │ ├── tensor_benchmarks_sycl.cc │ │ │ │ │ └── tensor_contract_sycl_bench.cc │ │ │ │ └── vdw_new.cpp │ │ │ ├── blas/ │ │ │ │ ├── BandTriangularSolver.h │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── GeneralRank1Update.h │ │ │ │ ├── PackedSelfadjointProduct.h │ │ │ │ ├── PackedTriangularMatrixVector.h │ │ │ │ ├── PackedTriangularSolverVector.h │ │ │ │ ├── README.txt │ │ │ │ ├── Rank2Update.h │ │ │ │ ├── common.h │ │ │ │ ├── complex_double.cpp │ │ │ │ ├── complex_single.cpp │ │ │ │ ├── double.cpp │ │ │ │ ├── f2c/ │ │ │ │ │ ├── chbmv.c │ │ │ │ │ ├── chpmv.c │ │ │ │ │ ├── complexdots.c │ │ │ │ │ ├── ctbmv.c │ │ │ │ │ ├── d_cnjg.c │ │ │ │ │ ├── datatypes.h │ │ │ │ │ ├── drotm.c │ │ │ │ │ ├── drotmg.c │ │ │ │ │ ├── dsbmv.c │ │ │ │ │ ├── dspmv.c │ │ │ │ │ ├── dtbmv.c │ │ │ │ │ ├── lsame.c │ │ │ │ │ ├── r_cnjg.c │ │ │ │ │ ├── srotm.c │ │ │ │ │ ├── srotmg.c │ │ │ │ │ ├── ssbmv.c │ │ │ │ │ ├── sspmv.c │ │ │ │ │ ├── stbmv.c │ │ │ │ │ ├── zhbmv.c │ │ │ │ │ ├── zhpmv.c │ │ │ │ │ └── ztbmv.c │ │ │ │ ├── fortran/ │ │ │ │ │ └── complexdots.f │ │ │ │ ├── level1_cplx_impl.h │ │ │ │ ├── level1_impl.h │ │ │ │ ├── level1_real_impl.h │ │ │ │ ├── level2_cplx_impl.h │ │ │ │ ├── level2_impl.h │ │ │ │ ├── level2_real_impl.h │ │ │ │ ├── level3_impl.h │ │ │ │ ├── single.cpp │ │ │ │ ├── testing/ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── cblat1.f │ │ │ │ │ ├── cblat2.f │ │ │ │ │ ├── cblat3.f │ │ │ │ │ ├── dblat1.f │ │ │ │ │ ├── dblat2.f │ │ │ │ │ ├── dblat3.f │ │ │ │ │ ├── runblastest.sh │ │ │ │ │ ├── sblat1.f │ │ │ │ │ ├── sblat2.f │ │ │ │ │ ├── sblat3.f │ │ │ │ │ ├── zblat1.f │ │ │ │ │ ├── zblat2.f │ │ │ │ │ └── zblat3.f │ │ │ │ └── xerbla.cpp │ │ │ ├── ci/ │ │ │ │ ├── CTest2JUnit.xsl │ │ │ │ ├── README.md │ │ │ │ ├── smoketests.gitlab-ci.yml │ │ │ │ └── test.gitlab-ci.yml │ │ │ ├── cmake/ │ │ │ │ ├── ComputeCppCompilerChecks.cmake │ │ │ │ ├── ComputeCppIRMap.cmake │ │ │ │ ├── Eigen3Config.cmake.in │ │ │ │ ├── EigenConfigureTesting.cmake │ │ │ │ ├── EigenDetermineOSVersion.cmake │ │ │ │ ├── EigenDetermineVSServicePack.cmake │ │ │ │ ├── EigenSmokeTestList.cmake │ │ │ │ ├── EigenTesting.cmake │ │ │ │ ├── EigenUninstall.cmake │ │ │ │ ├── FindAdolc.cmake │ │ │ │ ├── FindBLAS.cmake │ │ │ │ ├── FindBLASEXT.cmake │ │ │ │ ├── FindCHOLMOD.cmake │ │ │ │ ├── FindComputeCpp.cmake │ │ │ │ ├── FindFFTW.cmake │ │ │ │ ├── FindGLEW.cmake │ │ │ │ ├── FindGMP.cmake │ │ │ │ ├── FindGSL.cmake │ │ │ │ ├── FindGoogleHash.cmake │ │ │ │ ├── FindHWLOC.cmake │ │ │ │ ├── FindKLU.cmake │ │ │ │ ├── FindLAPACK.cmake │ │ │ │ ├── FindMPFR.cmake │ │ │ │ ├── FindMPREAL.cmake │ │ │ │ ├── FindMetis.cmake │ │ │ │ ├── FindPASTIX.cmake │ │ │ │ ├── FindPTSCOTCH.cmake │ │ │ │ ├── FindSCOTCH.cmake │ │ │ │ ├── FindSPQR.cmake │ │ │ │ ├── FindStandardMathLibrary.cmake │ │ │ │ ├── FindSuperLU.cmake │ │ │ │ ├── FindTriSYCL.cmake │ │ │ │ ├── FindUMFPACK.cmake │ │ │ │ └── RegexUtils.cmake │ │ │ ├── debug/ │ │ │ │ ├── gdb/ │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── printers.py │ │ │ │ └── msvc/ │ │ │ │ └── eigen.natvis │ │ │ ├── demos/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── mandelbrot/ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── README │ │ │ │ │ ├── mandelbrot.cpp │ │ │ │ │ └── mandelbrot.h │ │ │ │ ├── mix_eigen_and_c/ │ │ │ │ │ ├── README │ │ │ │ │ ├── binary_library.cpp │ │ │ │ │ ├── binary_library.h │ │ │ │ │ └── example.c │ │ │ │ └── opengl/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── README │ │ │ │ ├── camera.cpp │ │ │ │ ├── camera.h │ │ │ │ ├── gpuhelper.cpp │ │ │ │ ├── gpuhelper.h │ │ │ │ ├── icosphere.cpp │ │ │ │ ├── icosphere.h │ │ │ │ ├── quaternion_demo.cpp │ │ │ │ ├── quaternion_demo.h │ │ │ │ ├── trackball.cpp │ │ │ │ └── trackball.h │ │ │ ├── doc/ │ │ │ │ ├── AsciiQuickReference.txt │ │ │ │ ├── B01_Experimental.dox │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── ClassHierarchy.dox │ │ │ │ ├── CoeffwiseMathFunctionsTable.dox │ │ │ │ ├── CustomizingEigen_CustomScalar.dox │ │ │ │ ├── CustomizingEigen_InheritingMatrix.dox │ │ │ │ ├── CustomizingEigen_NullaryExpr.dox │ │ │ │ ├── CustomizingEigen_Plugins.dox │ │ │ │ ├── DenseDecompositionBenchmark.dox │ │ │ │ ├── Doxyfile.in │ │ │ │ ├── FixedSizeVectorizable.dox │ │ │ │ ├── FunctionsTakingEigenTypes.dox │ │ │ │ ├── HiPerformance.dox │ │ │ │ ├── InplaceDecomposition.dox │ │ │ │ ├── InsideEigenExample.dox │ │ │ │ ├── LeastSquares.dox │ │ │ │ ├── Manual.dox │ │ │ │ ├── MatrixfreeSolverExample.dox │ │ │ │ ├── NewExpressionType.dox │ │ │ │ ├── Overview.dox │ │ │ │ ├── PassingByValue.dox │ │ │ │ ├── Pitfalls.dox │ │ │ │ ├── PreprocessorDirectives.dox │ │ │ │ ├── QuickReference.dox │ │ │ │ ├── QuickStartGuide.dox │ │ │ │ ├── SparseLinearSystems.dox │ │ │ │ ├── SparseQuickReference.dox │ │ │ │ ├── StlContainers.dox │ │ │ │ ├── StorageOrders.dox │ │ │ │ ├── StructHavingEigenMembers.dox │ │ │ │ ├── TemplateKeyword.dox │ │ │ │ ├── TopicAliasing.dox │ │ │ │ ├── TopicAssertions.dox │ │ │ │ ├── TopicCMakeGuide.dox │ │ │ │ ├── TopicEigenExpressionTemplates.dox │ │ │ │ ├── TopicLazyEvaluation.dox │ │ │ │ ├── TopicLinearAlgebraDecompositions.dox │ │ │ │ ├── TopicMultithreading.dox │ │ │ │ ├── TopicResizing.dox │ │ │ │ ├── TopicScalarTypes.dox │ │ │ │ ├── TopicVectorization.dox │ │ │ │ ├── TutorialAdvancedInitialization.dox │ │ │ │ ├── TutorialArrayClass.dox │ │ │ │ ├── TutorialBlockOperations.dox │ │ │ │ ├── TutorialGeometry.dox │ │ │ │ ├── TutorialLinearAlgebra.dox │ │ │ │ ├── TutorialMapClass.dox │ │ │ │ ├── TutorialMatrixArithmetic.dox │ │ │ │ ├── TutorialMatrixClass.dox │ │ │ │ ├── TutorialReductionsVisitorsBroadcasting.dox │ │ │ │ ├── TutorialReshape.dox │ │ │ │ ├── TutorialSTL.dox │ │ │ │ ├── TutorialSlicingIndexing.dox │ │ │ │ ├── TutorialSparse.dox │ │ │ │ ├── TutorialSparse_example_details.dox │ │ │ │ ├── UnalignedArrayAssert.dox │ │ │ │ ├── UsingBlasLapackBackends.dox │ │ │ │ ├── UsingIntelMKL.dox │ │ │ │ ├── UsingNVCC.dox │ │ │ │ ├── WrongStackAlignment.dox │ │ │ │ ├── eigen_navtree_hacks.js │ │ │ │ ├── eigendoxy.css │ │ │ │ ├── eigendoxy_footer.html.in │ │ │ │ ├── eigendoxy_header.html.in │ │ │ │ ├── eigendoxy_layout.xml.in │ │ │ │ ├── eigendoxy_tabs.css │ │ │ │ ├── examples/ │ │ │ │ │ ├── .krazy │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── CustomizingEigen_Inheritance.cpp │ │ │ │ │ ├── Cwise_erf.cpp │ │ │ │ │ ├── Cwise_erfc.cpp │ │ │ │ │ ├── Cwise_lgamma.cpp │ │ │ │ │ ├── DenseBase_middleCols_int.cpp │ │ │ │ │ ├── DenseBase_middleRows_int.cpp │ │ │ │ │ ├── DenseBase_template_int_middleCols.cpp │ │ │ │ │ ├── DenseBase_template_int_middleRows.cpp │ │ │ │ │ ├── QuickStart_example.cpp │ │ │ │ │ ├── QuickStart_example2_dynamic.cpp │ │ │ │ │ ├── QuickStart_example2_fixed.cpp │ │ │ │ │ ├── TemplateKeyword_flexible.cpp │ │ │ │ │ ├── TemplateKeyword_simple.cpp │ │ │ │ │ ├── TutorialInplaceLU.cpp │ │ │ │ │ ├── TutorialLinAlgComputeTwice.cpp │ │ │ │ │ ├── TutorialLinAlgExComputeSolveError.cpp │ │ │ │ │ ├── TutorialLinAlgExSolveColPivHouseholderQR.cpp │ │ │ │ │ ├── TutorialLinAlgExSolveLDLT.cpp │ │ │ │ │ ├── TutorialLinAlgInverseDeterminant.cpp │ │ │ │ │ ├── TutorialLinAlgRankRevealing.cpp │ │ │ │ │ ├── TutorialLinAlgSVDSolve.cpp │ │ │ │ │ ├── TutorialLinAlgSelfAdjointEigenSolver.cpp │ │ │ │ │ ├── TutorialLinAlgSetThreshold.cpp │ │ │ │ │ ├── Tutorial_ArrayClass_accessors.cpp │ │ │ │ │ ├── Tutorial_ArrayClass_addition.cpp │ │ │ │ │ ├── Tutorial_ArrayClass_cwise_other.cpp │ │ │ │ │ ├── Tutorial_ArrayClass_interop.cpp │ │ │ │ │ ├── Tutorial_ArrayClass_interop_matrix.cpp │ │ │ │ │ ├── Tutorial_ArrayClass_mult.cpp │ │ │ │ │ ├── Tutorial_BlockOperations_block_assignment.cpp │ │ │ │ │ ├── Tutorial_BlockOperations_colrow.cpp │ │ │ │ │ ├── Tutorial_BlockOperations_corner.cpp │ │ │ │ │ ├── Tutorial_BlockOperations_print_block.cpp │ │ │ │ │ ├── Tutorial_BlockOperations_vector.cpp │ │ │ │ │ ├── Tutorial_PartialLU_solve.cpp │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.cpp │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_reductions_operatornorm.cpp │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_rowwise.cpp │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp │ │ │ │ │ ├── Tutorial_simple_example_dynamic_size.cpp │ │ │ │ │ ├── Tutorial_simple_example_fixed_size.cpp │ │ │ │ │ ├── class_Block.cpp │ │ │ │ │ ├── class_CwiseBinaryOp.cpp │ │ │ │ │ ├── class_CwiseUnaryOp.cpp │ │ │ │ │ ├── class_CwiseUnaryOp_ptrfun.cpp │ │ │ │ │ ├── class_FixedBlock.cpp │ │ │ │ │ ├── class_FixedReshaped.cpp │ │ │ │ │ ├── class_FixedVectorBlock.cpp │ │ │ │ │ ├── class_Reshaped.cpp │ │ │ │ │ ├── class_VectorBlock.cpp │ │ │ │ │ ├── function_taking_eigenbase.cpp │ │ │ │ │ ├── function_taking_ref.cpp │ │ │ │ │ ├── make_circulant.cpp │ │ │ │ │ ├── make_circulant.cpp.entry │ │ │ │ │ ├── make_circulant.cpp.evaluator │ │ │ │ │ ├── make_circulant.cpp.expression │ │ │ │ │ ├── make_circulant.cpp.main │ │ │ │ │ ├── make_circulant.cpp.preamble │ │ │ │ │ ├── make_circulant.cpp.traits │ │ │ │ │ ├── make_circulant2.cpp │ │ │ │ │ ├── matrixfree_cg.cpp │ │ │ │ │ ├── nullary_indexing.cpp │ │ │ │ │ ├── tut_arithmetic_add_sub.cpp │ │ │ │ │ ├── tut_arithmetic_dot_cross.cpp │ │ │ │ │ ├── tut_arithmetic_matrix_mul.cpp │ │ │ │ │ ├── tut_arithmetic_redux_basic.cpp │ │ │ │ │ ├── tut_arithmetic_scalar_mul_div.cpp │ │ │ │ │ ├── tut_matrix_coefficient_accessors.cpp │ │ │ │ │ ├── tut_matrix_resize.cpp │ │ │ │ │ └── tut_matrix_resize_fixed_size.cpp │ │ │ │ ├── snippets/ │ │ │ │ │ ├── .krazy │ │ │ │ │ ├── AngleAxis_mimic_euler.cpp │ │ │ │ │ ├── Array_initializer_list_23_cxx11.cpp │ │ │ │ │ ├── Array_initializer_list_vector_cxx11.cpp │ │ │ │ │ ├── Array_variadic_ctor_cxx11.cpp │ │ │ │ │ ├── BiCGSTAB_simple.cpp │ │ │ │ │ ├── BiCGSTAB_step_by_step.cpp │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── ColPivHouseholderQR_solve.cpp │ │ │ │ │ ├── ComplexEigenSolver_compute.cpp │ │ │ │ │ ├── ComplexEigenSolver_eigenvalues.cpp │ │ │ │ │ ├── ComplexEigenSolver_eigenvectors.cpp │ │ │ │ │ ├── ComplexSchur_compute.cpp │ │ │ │ │ ├── ComplexSchur_matrixT.cpp │ │ │ │ │ ├── ComplexSchur_matrixU.cpp │ │ │ │ │ ├── Cwise_abs.cpp │ │ │ │ │ ├── Cwise_abs2.cpp │ │ │ │ │ ├── Cwise_acos.cpp │ │ │ │ │ ├── Cwise_arg.cpp │ │ │ │ │ ├── Cwise_array_power_array.cpp │ │ │ │ │ ├── Cwise_asin.cpp │ │ │ │ │ ├── Cwise_atan.cpp │ │ │ │ │ ├── Cwise_boolean_and.cpp │ │ │ │ │ ├── Cwise_boolean_not.cpp │ │ │ │ │ ├── Cwise_boolean_or.cpp │ │ │ │ │ ├── Cwise_boolean_xor.cpp │ │ │ │ │ ├── Cwise_ceil.cpp │ │ │ │ │ ├── Cwise_cos.cpp │ │ │ │ │ ├── Cwise_cosh.cpp │ │ │ │ │ ├── Cwise_cube.cpp │ │ │ │ │ ├── Cwise_equal_equal.cpp │ │ │ │ │ ├── Cwise_exp.cpp │ │ │ │ │ ├── Cwise_floor.cpp │ │ │ │ │ ├── Cwise_greater.cpp │ │ │ │ │ ├── Cwise_greater_equal.cpp │ │ │ │ │ ├── Cwise_inverse.cpp │ │ │ │ │ ├── Cwise_isFinite.cpp │ │ │ │ │ ├── Cwise_isInf.cpp │ │ │ │ │ ├── Cwise_isNaN.cpp │ │ │ │ │ ├── Cwise_less.cpp │ │ │ │ │ ├── Cwise_less_equal.cpp │ │ │ │ │ ├── Cwise_log.cpp │ │ │ │ │ ├── Cwise_log10.cpp │ │ │ │ │ ├── Cwise_max.cpp │ │ │ │ │ ├── Cwise_min.cpp │ │ │ │ │ ├── Cwise_minus.cpp │ │ │ │ │ ├── Cwise_minus_equal.cpp │ │ │ │ │ ├── Cwise_not_equal.cpp │ │ │ │ │ ├── Cwise_plus.cpp │ │ │ │ │ ├── Cwise_plus_equal.cpp │ │ │ │ │ ├── Cwise_pow.cpp │ │ │ │ │ ├── Cwise_product.cpp │ │ │ │ │ ├── Cwise_quotient.cpp │ │ │ │ │ ├── Cwise_rint.cpp │ │ │ │ │ ├── Cwise_round.cpp │ │ │ │ │ ├── Cwise_scalar_power_array.cpp │ │ │ │ │ ├── Cwise_sign.cpp │ │ │ │ │ ├── Cwise_sin.cpp │ │ │ │ │ ├── Cwise_sinh.cpp │ │ │ │ │ ├── Cwise_slash_equal.cpp │ │ │ │ │ ├── Cwise_sqrt.cpp │ │ │ │ │ ├── Cwise_square.cpp │ │ │ │ │ ├── Cwise_tan.cpp │ │ │ │ │ ├── Cwise_tanh.cpp │ │ │ │ │ ├── Cwise_times_equal.cpp │ │ │ │ │ ├── DenseBase_LinSpaced.cpp │ │ │ │ │ ├── DenseBase_LinSpacedInt.cpp │ │ │ │ │ ├── DenseBase_LinSpaced_seq_deprecated.cpp │ │ │ │ │ ├── DenseBase_setLinSpaced.cpp │ │ │ │ │ ├── DirectionWise_hnormalized.cpp │ │ │ │ │ ├── DirectionWise_replicate.cpp │ │ │ │ │ ├── DirectionWise_replicate_int.cpp │ │ │ │ │ ├── EigenSolver_EigenSolver_MatrixType.cpp │ │ │ │ │ ├── EigenSolver_compute.cpp │ │ │ │ │ ├── EigenSolver_eigenvalues.cpp │ │ │ │ │ ├── EigenSolver_eigenvectors.cpp │ │ │ │ │ ├── EigenSolver_pseudoEigenvectors.cpp │ │ │ │ │ ├── FullPivHouseholderQR_solve.cpp │ │ │ │ │ ├── FullPivLU_image.cpp │ │ │ │ │ ├── FullPivLU_kernel.cpp │ │ │ │ │ ├── FullPivLU_solve.cpp │ │ │ │ │ ├── GeneralizedEigenSolver.cpp │ │ │ │ │ ├── HessenbergDecomposition_compute.cpp │ │ │ │ │ ├── HessenbergDecomposition_matrixH.cpp │ │ │ │ │ ├── HessenbergDecomposition_packedMatrix.cpp │ │ │ │ │ ├── HouseholderQR_householderQ.cpp │ │ │ │ │ ├── HouseholderQR_solve.cpp │ │ │ │ │ ├── HouseholderSequence_HouseholderSequence.cpp │ │ │ │ │ ├── IOFormat.cpp │ │ │ │ │ ├── JacobiSVD_basic.cpp │ │ │ │ │ ├── Jacobi_makeGivens.cpp │ │ │ │ │ ├── Jacobi_makeJacobi.cpp │ │ │ │ │ ├── LLT_example.cpp │ │ │ │ │ ├── LLT_solve.cpp │ │ │ │ │ ├── LeastSquaresNormalEquations.cpp │ │ │ │ │ ├── LeastSquaresQR.cpp │ │ │ │ │ ├── Map_general_stride.cpp │ │ │ │ │ ├── Map_inner_stride.cpp │ │ │ │ │ ├── Map_outer_stride.cpp │ │ │ │ │ ├── Map_placement_new.cpp │ │ │ │ │ ├── Map_simple.cpp │ │ │ │ │ ├── MatrixBase_adjoint.cpp │ │ │ │ │ ├── MatrixBase_all.cpp │ │ │ │ │ ├── MatrixBase_applyOnTheLeft.cpp │ │ │ │ │ ├── MatrixBase_applyOnTheRight.cpp │ │ │ │ │ ├── MatrixBase_array.cpp │ │ │ │ │ ├── MatrixBase_array_const.cpp │ │ │ │ │ ├── MatrixBase_asDiagonal.cpp │ │ │ │ │ ├── MatrixBase_block_int_int.cpp │ │ │ │ │ ├── MatrixBase_block_int_int_int_int.cpp │ │ │ │ │ ├── MatrixBase_bottomLeftCorner_int_int.cpp │ │ │ │ │ ├── MatrixBase_bottomRightCorner_int_int.cpp │ │ │ │ │ ├── MatrixBase_bottomRows_int.cpp │ │ │ │ │ ├── MatrixBase_cast.cpp │ │ │ │ │ ├── MatrixBase_col.cpp │ │ │ │ │ ├── MatrixBase_colwise.cpp │ │ │ │ │ ├── MatrixBase_colwise_iterator_cxx11.cpp │ │ │ │ │ ├── MatrixBase_computeInverseAndDetWithCheck.cpp │ │ │ │ │ ├── MatrixBase_computeInverseWithCheck.cpp │ │ │ │ │ ├── MatrixBase_cwiseAbs.cpp │ │ │ │ │ ├── MatrixBase_cwiseAbs2.cpp │ │ │ │ │ ├── MatrixBase_cwiseArg.cpp │ │ │ │ │ ├── MatrixBase_cwiseEqual.cpp │ │ │ │ │ ├── MatrixBase_cwiseInverse.cpp │ │ │ │ │ ├── MatrixBase_cwiseMax.cpp │ │ │ │ │ ├── MatrixBase_cwiseMin.cpp │ │ │ │ │ ├── MatrixBase_cwiseNotEqual.cpp │ │ │ │ │ ├── MatrixBase_cwiseProduct.cpp │ │ │ │ │ ├── MatrixBase_cwiseQuotient.cpp │ │ │ │ │ ├── MatrixBase_cwiseSign.cpp │ │ │ │ │ ├── MatrixBase_cwiseSqrt.cpp │ │ │ │ │ ├── MatrixBase_diagonal.cpp │ │ │ │ │ ├── MatrixBase_diagonal_int.cpp │ │ │ │ │ ├── MatrixBase_diagonal_template_int.cpp │ │ │ │ │ ├── MatrixBase_eigenvalues.cpp │ │ │ │ │ ├── MatrixBase_end_int.cpp │ │ │ │ │ ├── MatrixBase_eval.cpp │ │ │ │ │ ├── MatrixBase_fixedBlock_int_int.cpp │ │ │ │ │ ├── MatrixBase_hnormalized.cpp │ │ │ │ │ ├── MatrixBase_homogeneous.cpp │ │ │ │ │ ├── MatrixBase_identity.cpp │ │ │ │ │ ├── MatrixBase_identity_int_int.cpp │ │ │ │ │ ├── MatrixBase_inverse.cpp │ │ │ │ │ ├── MatrixBase_isDiagonal.cpp │ │ │ │ │ ├── MatrixBase_isIdentity.cpp │ │ │ │ │ ├── MatrixBase_isOnes.cpp │ │ │ │ │ ├── MatrixBase_isOrthogonal.cpp │ │ │ │ │ ├── MatrixBase_isUnitary.cpp │ │ │ │ │ ├── MatrixBase_isZero.cpp │ │ │ │ │ ├── MatrixBase_leftCols_int.cpp │ │ │ │ │ ├── MatrixBase_noalias.cpp │ │ │ │ │ ├── MatrixBase_ones.cpp │ │ │ │ │ ├── MatrixBase_ones_int.cpp │ │ │ │ │ ├── MatrixBase_ones_int_int.cpp │ │ │ │ │ ├── MatrixBase_operatorNorm.cpp │ │ │ │ │ ├── MatrixBase_prod.cpp │ │ │ │ │ ├── MatrixBase_random.cpp │ │ │ │ │ ├── MatrixBase_random_int.cpp │ │ │ │ │ ├── MatrixBase_random_int_int.cpp │ │ │ │ │ ├── MatrixBase_replicate.cpp │ │ │ │ │ ├── MatrixBase_replicate_int_int.cpp │ │ │ │ │ ├── MatrixBase_reshaped_auto.cpp │ │ │ │ │ ├── MatrixBase_reshaped_fixed.cpp │ │ │ │ │ ├── MatrixBase_reshaped_int_int.cpp │ │ │ │ │ ├── MatrixBase_reshaped_to_vector.cpp │ │ │ │ │ ├── MatrixBase_reverse.cpp │ │ │ │ │ ├── MatrixBase_rightCols_int.cpp │ │ │ │ │ ├── MatrixBase_row.cpp │ │ │ │ │ ├── MatrixBase_rowwise.cpp │ │ │ │ │ ├── MatrixBase_segment_int_int.cpp │ │ │ │ │ ├── MatrixBase_select.cpp │ │ │ │ │ ├── MatrixBase_selfadjointView.cpp │ │ │ │ │ ├── MatrixBase_set.cpp │ │ │ │ │ ├── MatrixBase_setIdentity.cpp │ │ │ │ │ ├── MatrixBase_setOnes.cpp │ │ │ │ │ ├── MatrixBase_setRandom.cpp │ │ │ │ │ ├── MatrixBase_setZero.cpp │ │ │ │ │ ├── MatrixBase_start_int.cpp │ │ │ │ │ ├── MatrixBase_template_int_bottomRows.cpp │ │ │ │ │ ├── MatrixBase_template_int_end.cpp │ │ │ │ │ ├── MatrixBase_template_int_int_block_int_int_int_int.cpp │ │ │ │ │ ├── MatrixBase_template_int_int_bottomLeftCorner.cpp │ │ │ │ │ ├── MatrixBase_template_int_int_bottomLeftCorner_int_int.cpp │ │ │ │ │ ├── MatrixBase_template_int_int_bottomRightCorner.cpp │ │ │ │ │ ├── MatrixBase_template_int_int_bottomRightCorner_int_int.cpp │ │ │ │ │ ├── MatrixBase_template_int_int_topLeftCorner.cpp │ │ │ │ │ ├── MatrixBase_template_int_int_topLeftCorner_int_int.cpp │ │ │ │ │ ├── MatrixBase_template_int_int_topRightCorner.cpp │ │ │ │ │ ├── MatrixBase_template_int_int_topRightCorner_int_int.cpp │ │ │ │ │ ├── MatrixBase_template_int_leftCols.cpp │ │ │ │ │ ├── MatrixBase_template_int_rightCols.cpp │ │ │ │ │ ├── MatrixBase_template_int_segment.cpp │ │ │ │ │ ├── MatrixBase_template_int_start.cpp │ │ │ │ │ ├── MatrixBase_template_int_topRows.cpp │ │ │ │ │ ├── MatrixBase_topLeftCorner_int_int.cpp │ │ │ │ │ ├── MatrixBase_topRightCorner_int_int.cpp │ │ │ │ │ ├── MatrixBase_topRows_int.cpp │ │ │ │ │ ├── MatrixBase_transpose.cpp │ │ │ │ │ ├── MatrixBase_triangularView.cpp │ │ │ │ │ ├── MatrixBase_zero.cpp │ │ │ │ │ ├── MatrixBase_zero_int.cpp │ │ │ │ │ ├── MatrixBase_zero_int_int.cpp │ │ │ │ │ ├── Matrix_Map_stride.cpp │ │ │ │ │ ├── Matrix_initializer_list_23_cxx11.cpp │ │ │ │ │ ├── Matrix_initializer_list_vector_cxx11.cpp │ │ │ │ │ ├── Matrix_resize_NoChange_int.cpp │ │ │ │ │ ├── Matrix_resize_int.cpp │ │ │ │ │ ├── Matrix_resize_int_NoChange.cpp │ │ │ │ │ ├── Matrix_resize_int_int.cpp │ │ │ │ │ ├── Matrix_setConstant_int.cpp │ │ │ │ │ ├── Matrix_setConstant_int_int.cpp │ │ │ │ │ ├── Matrix_setIdentity_int_int.cpp │ │ │ │ │ ├── Matrix_setOnes_int.cpp │ │ │ │ │ ├── Matrix_setOnes_int_int.cpp │ │ │ │ │ ├── Matrix_setRandom_int.cpp │ │ │ │ │ ├── Matrix_setRandom_int_int.cpp │ │ │ │ │ ├── Matrix_setZero_int.cpp │ │ │ │ │ ├── Matrix_setZero_int_int.cpp │ │ │ │ │ ├── Matrix_variadic_ctor_cxx11.cpp │ │ │ │ │ ├── PartialPivLU_solve.cpp │ │ │ │ │ ├── PartialRedux_count.cpp │ │ │ │ │ ├── PartialRedux_maxCoeff.cpp │ │ │ │ │ ├── PartialRedux_minCoeff.cpp │ │ │ │ │ ├── PartialRedux_norm.cpp │ │ │ │ │ ├── PartialRedux_prod.cpp │ │ │ │ │ ├── PartialRedux_squaredNorm.cpp │ │ │ │ │ ├── PartialRedux_sum.cpp │ │ │ │ │ ├── RealQZ_compute.cpp │ │ │ │ │ ├── RealSchur_RealSchur_MatrixType.cpp │ │ │ │ │ ├── RealSchur_compute.cpp │ │ │ │ │ ├── SelfAdjointEigenSolver_SelfAdjointEigenSolver.cpp │ │ │ │ │ ├── SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp │ │ │ │ │ ├── SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType2.cpp │ │ │ │ │ ├── SelfAdjointEigenSolver_compute_MatrixType.cpp │ │ │ │ │ ├── SelfAdjointEigenSolver_compute_MatrixType2.cpp │ │ │ │ │ ├── SelfAdjointEigenSolver_eigenvalues.cpp │ │ │ │ │ ├── SelfAdjointEigenSolver_eigenvectors.cpp │ │ │ │ │ ├── SelfAdjointEigenSolver_operatorInverseSqrt.cpp │ │ │ │ │ ├── SelfAdjointEigenSolver_operatorSqrt.cpp │ │ │ │ │ ├── SelfAdjointView_eigenvalues.cpp │ │ │ │ │ ├── SelfAdjointView_operatorNorm.cpp │ │ │ │ │ ├── Slicing_arrayexpr.cpp │ │ │ │ │ ├── Slicing_custom_padding_cxx11.cpp │ │ │ │ │ ├── Slicing_rawarray_cxx11.cpp │ │ │ │ │ ├── Slicing_stdvector_cxx11.cpp │ │ │ │ │ ├── SparseMatrix_coeffs.cpp │ │ │ │ │ ├── TopicAliasing_block.cpp │ │ │ │ │ ├── TopicAliasing_block_correct.cpp │ │ │ │ │ ├── TopicAliasing_cwise.cpp │ │ │ │ │ ├── TopicAliasing_mult1.cpp │ │ │ │ │ ├── TopicAliasing_mult2.cpp │ │ │ │ │ ├── TopicAliasing_mult3.cpp │ │ │ │ │ ├── TopicAliasing_mult4.cpp │ │ │ │ │ ├── TopicAliasing_mult5.cpp │ │ │ │ │ ├── TopicStorageOrders_example.cpp │ │ │ │ │ ├── Triangular_solve.cpp │ │ │ │ │ ├── Tridiagonalization_Tridiagonalization_MatrixType.cpp │ │ │ │ │ ├── Tridiagonalization_compute.cpp │ │ │ │ │ ├── Tridiagonalization_decomposeInPlace.cpp │ │ │ │ │ ├── Tridiagonalization_diagonal.cpp │ │ │ │ │ ├── Tridiagonalization_householderCoefficients.cpp │ │ │ │ │ ├── Tridiagonalization_packedMatrix.cpp │ │ │ │ │ ├── Tutorial_AdvancedInitialization_Block.cpp │ │ │ │ │ ├── Tutorial_AdvancedInitialization_CommaTemporary.cpp │ │ │ │ │ ├── Tutorial_AdvancedInitialization_Join.cpp │ │ │ │ │ ├── Tutorial_AdvancedInitialization_LinSpaced.cpp │ │ │ │ │ ├── Tutorial_AdvancedInitialization_ThreeWays.cpp │ │ │ │ │ ├── Tutorial_AdvancedInitialization_Zero.cpp │ │ │ │ │ ├── Tutorial_Map_rowmajor.cpp │ │ │ │ │ ├── Tutorial_Map_using.cpp │ │ │ │ │ ├── Tutorial_ReshapeMat2Mat.cpp │ │ │ │ │ ├── Tutorial_ReshapeMat2Vec.cpp │ │ │ │ │ ├── Tutorial_SlicingCol.cpp │ │ │ │ │ ├── Tutorial_SlicingVec.cpp │ │ │ │ │ ├── Tutorial_commainit_01.cpp │ │ │ │ │ ├── Tutorial_commainit_01b.cpp │ │ │ │ │ ├── Tutorial_commainit_02.cpp │ │ │ │ │ ├── Tutorial_range_for_loop_1d_cxx11.cpp │ │ │ │ │ ├── Tutorial_range_for_loop_2d_cxx11.cpp │ │ │ │ │ ├── Tutorial_reshaped_vs_resize_1.cpp │ │ │ │ │ ├── Tutorial_reshaped_vs_resize_2.cpp │ │ │ │ │ ├── Tutorial_solve_matrix_inverse.cpp │ │ │ │ │ ├── Tutorial_solve_multiple_rhs.cpp │ │ │ │ │ ├── Tutorial_solve_reuse_decomposition.cpp │ │ │ │ │ ├── Tutorial_solve_singular.cpp │ │ │ │ │ ├── Tutorial_solve_triangular.cpp │ │ │ │ │ ├── Tutorial_solve_triangular_inplace.cpp │ │ │ │ │ ├── Tutorial_std_sort.cpp │ │ │ │ │ ├── Tutorial_std_sort_rows_cxx11.cpp │ │ │ │ │ ├── VectorwiseOp_homogeneous.cpp │ │ │ │ │ ├── Vectorwise_reverse.cpp │ │ │ │ │ ├── class_FullPivLU.cpp │ │ │ │ │ ├── compile_snippet.cpp.in │ │ │ │ │ ├── tut_arithmetic_redux_minmax.cpp │ │ │ │ │ ├── tut_arithmetic_transpose_aliasing.cpp │ │ │ │ │ ├── tut_arithmetic_transpose_conjugate.cpp │ │ │ │ │ ├── tut_arithmetic_transpose_inplace.cpp │ │ │ │ │ └── tut_matrix_assignment_resizing.cpp │ │ │ │ ├── special_examples/ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── Tutorial_sparse_example.cpp │ │ │ │ │ ├── Tutorial_sparse_example_details.cpp │ │ │ │ │ └── random_cpp11.cpp │ │ │ │ └── tutorial.cpp │ │ │ ├── eigen3.pc.in │ │ │ ├── failtest/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── bdcsvd_int.cpp │ │ │ │ ├── block_nonconst_ctor_on_const_xpr_0.cpp │ │ │ │ ├── block_nonconst_ctor_on_const_xpr_1.cpp │ │ │ │ ├── block_nonconst_ctor_on_const_xpr_2.cpp │ │ │ │ ├── block_on_const_type_actually_const_0.cpp │ │ │ │ ├── block_on_const_type_actually_const_1.cpp │ │ │ │ ├── colpivqr_int.cpp │ │ │ │ ├── const_qualified_block_method_retval_0.cpp │ │ │ │ ├── const_qualified_block_method_retval_1.cpp │ │ │ │ ├── const_qualified_diagonal_method_retval.cpp │ │ │ │ ├── const_qualified_transpose_method_retval.cpp │ │ │ │ ├── cwiseunaryview_nonconst_ctor_on_const_xpr.cpp │ │ │ │ ├── cwiseunaryview_on_const_type_actually_const.cpp │ │ │ │ ├── diagonal_nonconst_ctor_on_const_xpr.cpp │ │ │ │ ├── diagonal_on_const_type_actually_const.cpp │ │ │ │ ├── eigensolver_cplx.cpp │ │ │ │ ├── eigensolver_int.cpp │ │ │ │ ├── failtest_sanity_check.cpp │ │ │ │ ├── fullpivlu_int.cpp │ │ │ │ ├── fullpivqr_int.cpp │ │ │ │ ├── initializer_list_1.cpp │ │ │ │ ├── initializer_list_2.cpp │ │ │ │ ├── jacobisvd_int.cpp │ │ │ │ ├── ldlt_int.cpp │ │ │ │ ├── llt_int.cpp │ │ │ │ ├── map_nonconst_ctor_on_const_ptr_0.cpp │ │ │ │ ├── map_nonconst_ctor_on_const_ptr_1.cpp │ │ │ │ ├── map_nonconst_ctor_on_const_ptr_2.cpp │ │ │ │ ├── map_nonconst_ctor_on_const_ptr_3.cpp │ │ │ │ ├── map_nonconst_ctor_on_const_ptr_4.cpp │ │ │ │ ├── map_on_const_type_actually_const_0.cpp │ │ │ │ ├── map_on_const_type_actually_const_1.cpp │ │ │ │ ├── partialpivlu_int.cpp │ │ │ │ ├── qr_int.cpp │ │ │ │ ├── ref_1.cpp │ │ │ │ ├── ref_2.cpp │ │ │ │ ├── ref_3.cpp │ │ │ │ ├── ref_4.cpp │ │ │ │ ├── ref_5.cpp │ │ │ │ ├── selfadjointview_nonconst_ctor_on_const_xpr.cpp │ │ │ │ ├── selfadjointview_on_const_type_actually_const.cpp │ │ │ │ ├── sparse_ref_1.cpp │ │ │ │ ├── sparse_ref_2.cpp │ │ │ │ ├── sparse_ref_3.cpp │ │ │ │ ├── sparse_ref_4.cpp │ │ │ │ ├── sparse_ref_5.cpp │ │ │ │ ├── sparse_storage_mismatch.cpp │ │ │ │ ├── swap_1.cpp │ │ │ │ ├── swap_2.cpp │ │ │ │ ├── ternary_1.cpp │ │ │ │ ├── ternary_2.cpp │ │ │ │ ├── transpose_nonconst_ctor_on_const_xpr.cpp │ │ │ │ ├── transpose_on_const_type_actually_const.cpp │ │ │ │ ├── triangularview_nonconst_ctor_on_const_xpr.cpp │ │ │ │ └── triangularview_on_const_type_actually_const.cpp │ │ │ ├── lapack/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── cholesky.cpp │ │ │ │ ├── clacgv.f │ │ │ │ ├── cladiv.f │ │ │ │ ├── clarf.f │ │ │ │ ├── clarfb.f │ │ │ │ ├── clarfg.f │ │ │ │ ├── clarft.f │ │ │ │ ├── complex_double.cpp │ │ │ │ ├── complex_single.cpp │ │ │ │ ├── dladiv.f │ │ │ │ ├── dlamch.f │ │ │ │ ├── dlapy2.f │ │ │ │ ├── dlapy3.f │ │ │ │ ├── dlarf.f │ │ │ │ ├── dlarfb.f │ │ │ │ ├── dlarfg.f │ │ │ │ ├── dlarft.f │ │ │ │ ├── double.cpp │ │ │ │ ├── dsecnd_NONE.f │ │ │ │ ├── eigenvalues.cpp │ │ │ │ ├── ilaclc.f │ │ │ │ ├── ilaclr.f │ │ │ │ ├── iladlc.f │ │ │ │ ├── iladlr.f │ │ │ │ ├── ilaslc.f │ │ │ │ ├── ilaslr.f │ │ │ │ ├── ilazlc.f │ │ │ │ ├── ilazlr.f │ │ │ │ ├── lapack_common.h │ │ │ │ ├── lu.cpp │ │ │ │ ├── second_NONE.f │ │ │ │ ├── single.cpp │ │ │ │ ├── sladiv.f │ │ │ │ ├── slamch.f │ │ │ │ ├── slapy2.f │ │ │ │ ├── slapy3.f │ │ │ │ ├── slarf.f │ │ │ │ ├── slarfb.f │ │ │ │ ├── slarfg.f │ │ │ │ ├── slarft.f │ │ │ │ ├── svd.cpp │ │ │ │ ├── zlacgv.f │ │ │ │ ├── zladiv.f │ │ │ │ ├── zlarf.f │ │ │ │ ├── zlarfb.f │ │ │ │ ├── zlarfg.f │ │ │ │ └── zlarft.f │ │ │ ├── scripts/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── cdashtesting.cmake.in │ │ │ │ ├── check.in │ │ │ │ ├── debug.in │ │ │ │ ├── eigen_gen_credits.cpp │ │ │ │ ├── eigen_gen_docs │ │ │ │ ├── eigen_gen_split_test_help.cmake │ │ │ │ ├── eigen_monitor_perf.sh │ │ │ │ ├── release.in │ │ │ │ └── relicense.py │ │ │ ├── signature_of_eigen3_matrix_library │ │ │ ├── test/ │ │ │ │ ├── AnnoyingScalar.h │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── MovableScalar.h │ │ │ │ ├── OffByOneScalar.h │ │ │ │ ├── SafeScalar.h │ │ │ │ ├── adjoint.cpp │ │ │ │ ├── array_cwise.cpp │ │ │ │ ├── array_for_matrix.cpp │ │ │ │ ├── array_of_string.cpp │ │ │ │ ├── array_replicate.cpp │ │ │ │ ├── array_reverse.cpp │ │ │ │ ├── bandmatrix.cpp │ │ │ │ ├── basicstuff.cpp │ │ │ │ ├── bdcsvd.cpp │ │ │ │ ├── bfloat16_float.cpp │ │ │ │ ├── bicgstab.cpp │ │ │ │ ├── blasutil.cpp │ │ │ │ ├── block.cpp │ │ │ │ ├── boostmultiprec.cpp │ │ │ │ ├── bug1213.cpp │ │ │ │ ├── bug1213.h │ │ │ │ ├── bug1213_main.cpp │ │ │ │ ├── cholesky.cpp │ │ │ │ ├── cholmod_support.cpp │ │ │ │ ├── commainitializer.cpp │ │ │ │ ├── conjugate_gradient.cpp │ │ │ │ ├── conservative_resize.cpp │ │ │ │ ├── constructor.cpp │ │ │ │ ├── corners.cpp │ │ │ │ ├── ctorleak.cpp │ │ │ │ ├── denseLM.cpp │ │ │ │ ├── dense_storage.cpp │ │ │ │ ├── determinant.cpp │ │ │ │ ├── diagonal.cpp │ │ │ │ ├── diagonal_matrix_variadic_ctor.cpp │ │ │ │ ├── diagonalmatrices.cpp │ │ │ │ ├── dontalign.cpp │ │ │ │ ├── dynalloc.cpp │ │ │ │ ├── eigen2support.cpp │ │ │ │ ├── eigensolver_complex.cpp │ │ │ │ ├── eigensolver_generalized_real.cpp │ │ │ │ ├── eigensolver_generic.cpp │ │ │ │ ├── eigensolver_selfadjoint.cpp │ │ │ │ ├── evaluator_common.h │ │ │ │ ├── evaluators.cpp │ │ │ │ ├── exceptions.cpp │ │ │ │ ├── fastmath.cpp │ │ │ │ ├── first_aligned.cpp │ │ │ │ ├── geo_alignedbox.cpp │ │ │ │ ├── geo_eulerangles.cpp │ │ │ │ ├── geo_homogeneous.cpp │ │ │ │ ├── geo_hyperplane.cpp │ │ │ │ ├── geo_orthomethods.cpp │ │ │ │ ├── geo_parametrizedline.cpp │ │ │ │ ├── geo_quaternion.cpp │ │ │ │ ├── geo_transformations.cpp │ │ │ │ ├── gpu_basic.cu │ │ │ │ ├── gpu_common.h │ │ │ │ ├── half_float.cpp │ │ │ │ ├── hessenberg.cpp │ │ │ │ ├── householder.cpp │ │ │ │ ├── incomplete_cholesky.cpp │ │ │ │ ├── indexed_view.cpp │ │ │ │ ├── initializer_list_construction.cpp │ │ │ │ ├── inplace_decomposition.cpp │ │ │ │ ├── integer_types.cpp │ │ │ │ ├── inverse.cpp │ │ │ │ ├── io.cpp │ │ │ │ ├── is_same_dense.cpp │ │ │ │ ├── jacobi.cpp │ │ │ │ ├── jacobisvd.cpp │ │ │ │ ├── klu_support.cpp │ │ │ │ ├── linearstructure.cpp │ │ │ │ ├── lscg.cpp │ │ │ │ ├── lu.cpp │ │ │ │ ├── main.h │ │ │ │ ├── mapped_matrix.cpp │ │ │ │ ├── mapstaticmethods.cpp │ │ │ │ ├── mapstride.cpp │ │ │ │ ├── meta.cpp │ │ │ │ ├── metis_support.cpp │ │ │ │ ├── miscmatrices.cpp │ │ │ │ ├── mixingtypes.cpp │ │ │ │ ├── mpl2only.cpp │ │ │ │ ├── nestbyvalue.cpp │ │ │ │ ├── nesting_ops.cpp │ │ │ │ ├── nomalloc.cpp │ │ │ │ ├── nullary.cpp │ │ │ │ ├── num_dimensions.cpp │ │ │ │ ├── numext.cpp │ │ │ │ ├── packetmath.cpp │ │ │ │ ├── packetmath_test_shared.h │ │ │ │ ├── pardiso_support.cpp │ │ │ │ ├── pastix_support.cpp │ │ │ │ ├── permutationmatrices.cpp │ │ │ │ ├── prec_inverse_4x4.cpp │ │ │ │ ├── product.h │ │ │ │ ├── product_extra.cpp │ │ │ │ ├── product_large.cpp │ │ │ │ ├── product_mmtr.cpp │ │ │ │ ├── product_notemporary.cpp │ │ │ │ ├── product_selfadjoint.cpp │ │ │ │ ├── product_small.cpp │ │ │ │ ├── product_symm.cpp │ │ │ │ ├── product_syrk.cpp │ │ │ │ ├── product_trmm.cpp │ │ │ │ ├── product_trmv.cpp │ │ │ │ ├── product_trsolve.cpp │ │ │ │ ├── qr.cpp │ │ │ │ ├── qr_colpivoting.cpp │ │ │ │ ├── qr_fullpivoting.cpp │ │ │ │ ├── qtvector.cpp │ │ │ │ ├── rand.cpp │ │ │ │ ├── random_matrix.cpp │ │ │ │ ├── random_without_cast_overflow.h │ │ │ │ ├── real_qz.cpp │ │ │ │ ├── redux.cpp │ │ │ │ ├── ref.cpp │ │ │ │ ├── reshape.cpp │ │ │ │ ├── resize.cpp │ │ │ │ ├── rvalue_types.cpp │ │ │ │ ├── schur_complex.cpp │ │ │ │ ├── schur_real.cpp │ │ │ │ ├── selfadjoint.cpp │ │ │ │ ├── simplicial_cholesky.cpp │ │ │ │ ├── sizeof.cpp │ │ │ │ ├── sizeoverflow.cpp │ │ │ │ ├── smallvectors.cpp │ │ │ │ ├── solverbase.h │ │ │ │ ├── sparse.h │ │ │ │ ├── sparseLM.cpp │ │ │ │ ├── sparse_basic.cpp │ │ │ │ ├── sparse_block.cpp │ │ │ │ ├── sparse_permutations.cpp │ │ │ │ ├── sparse_product.cpp │ │ │ │ ├── sparse_ref.cpp │ │ │ │ ├── sparse_solver.h │ │ │ │ ├── sparse_solvers.cpp │ │ │ │ ├── sparse_vector.cpp │ │ │ │ ├── sparselu.cpp │ │ │ │ ├── sparseqr.cpp │ │ │ │ ├── special_numbers.cpp │ │ │ │ ├── split_test_helper.h │ │ │ │ ├── spqr_support.cpp │ │ │ │ ├── stable_norm.cpp │ │ │ │ ├── stddeque.cpp │ │ │ │ ├── stddeque_overload.cpp │ │ │ │ ├── stdlist.cpp │ │ │ │ ├── stdlist_overload.cpp │ │ │ │ ├── stdvector.cpp │ │ │ │ ├── stdvector_overload.cpp │ │ │ │ ├── stl_iterators.cpp │ │ │ │ ├── superlu_support.cpp │ │ │ │ ├── svd_common.h │ │ │ │ ├── svd_fill.h │ │ │ │ ├── swap.cpp │ │ │ │ ├── symbolic_index.cpp │ │ │ │ ├── triangular.cpp │ │ │ │ ├── type_alias.cpp │ │ │ │ ├── umeyama.cpp │ │ │ │ ├── umfpack_support.cpp │ │ │ │ ├── unalignedcount.cpp │ │ │ │ ├── upperbidiagonalization.cpp │ │ │ │ ├── vectorization_logic.cpp │ │ │ │ ├── vectorwiseop.cpp │ │ │ │ ├── visitor.cpp │ │ │ │ └── zerosized.cpp │ │ │ └── unsupported/ │ │ │ ├── CMakeLists.txt │ │ │ ├── Eigen/ │ │ │ │ ├── AdolcForward │ │ │ │ ├── AlignedVector3 │ │ │ │ ├── ArpackSupport │ │ │ │ ├── AutoDiff │ │ │ │ ├── BVH │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── CXX11/ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── Tensor │ │ │ │ │ ├── TensorSymmetry │ │ │ │ │ ├── ThreadPool │ │ │ │ │ └── src/ │ │ │ │ │ ├── Tensor/ │ │ │ │ │ │ ├── README.md │ │ │ │ │ │ ├── Tensor.h │ │ │ │ │ │ ├── TensorArgMax.h │ │ │ │ │ │ ├── TensorAssign.h │ │ │ │ │ │ ├── TensorBase.h │ │ │ │ │ │ ├── TensorBlock.h │ │ │ │ │ │ ├── TensorBroadcasting.h │ │ │ │ │ │ ├── TensorChipping.h │ │ │ │ │ │ ├── TensorConcatenation.h │ │ │ │ │ │ ├── TensorContraction.h │ │ │ │ │ │ ├── TensorContractionBlocking.h │ │ │ │ │ │ ├── TensorContractionCuda.h │ │ │ │ │ │ ├── TensorContractionGpu.h │ │ │ │ │ │ ├── TensorContractionMapper.h │ │ │ │ │ │ ├── TensorContractionSycl.h │ │ │ │ │ │ ├── TensorContractionThreadPool.h │ │ │ │ │ │ ├── TensorConversion.h │ │ │ │ │ │ ├── TensorConvolution.h │ │ │ │ │ │ ├── TensorConvolutionSycl.h │ │ │ │ │ │ ├── TensorCostModel.h │ │ │ │ │ │ ├── TensorCustomOp.h │ │ │ │ │ │ ├── TensorDevice.h │ │ │ │ │ │ ├── TensorDeviceCuda.h │ │ │ │ │ │ ├── TensorDeviceDefault.h │ │ │ │ │ │ ├── TensorDeviceGpu.h │ │ │ │ │ │ ├── TensorDeviceSycl.h │ │ │ │ │ │ ├── TensorDeviceThreadPool.h │ │ │ │ │ │ ├── TensorDimensionList.h │ │ │ │ │ │ ├── TensorDimensions.h │ │ │ │ │ │ ├── TensorEvalTo.h │ │ │ │ │ │ ├── TensorEvaluator.h │ │ │ │ │ │ ├── TensorExecutor.h │ │ │ │ │ │ ├── TensorExpr.h │ │ │ │ │ │ ├── TensorFFT.h │ │ │ │ │ │ ├── TensorFixedSize.h │ │ │ │ │ │ ├── TensorForcedEval.h │ │ │ │ │ │ ├── TensorForwardDeclarations.h │ │ │ │ │ │ ├── TensorFunctors.h │ │ │ │ │ │ ├── TensorGenerator.h │ │ │ │ │ │ ├── TensorGlobalFunctions.h │ │ │ │ │ │ ├── TensorGpuHipCudaDefines.h │ │ │ │ │ │ ├── TensorGpuHipCudaUndefines.h │ │ │ │ │ │ ├── TensorIO.h │ │ │ │ │ │ ├── TensorImagePatch.h │ │ │ │ │ │ ├── TensorIndexList.h │ │ │ │ │ │ ├── TensorInflation.h │ │ │ │ │ │ ├── TensorInitializer.h │ │ │ │ │ │ ├── TensorIntDiv.h │ │ │ │ │ │ ├── TensorLayoutSwap.h │ │ │ │ │ │ ├── TensorMacros.h │ │ │ │ │ │ ├── TensorMap.h │ │ │ │ │ │ ├── TensorMeta.h │ │ │ │ │ │ ├── TensorMorphing.h │ │ │ │ │ │ ├── TensorPadding.h │ │ │ │ │ │ ├── TensorPatch.h │ │ │ │ │ │ ├── TensorRandom.h │ │ │ │ │ │ ├── TensorReduction.h │ │ │ │ │ │ ├── TensorReductionCuda.h │ │ │ │ │ │ ├── TensorReductionGpu.h │ │ │ │ │ │ ├── TensorReductionSycl.h │ │ │ │ │ │ ├── TensorRef.h │ │ │ │ │ │ ├── TensorReverse.h │ │ │ │ │ │ ├── TensorScan.h │ │ │ │ │ │ ├── TensorScanSycl.h │ │ │ │ │ │ ├── TensorShuffling.h │ │ │ │ │ │ ├── TensorStorage.h │ │ │ │ │ │ ├── TensorStriding.h │ │ │ │ │ │ ├── TensorTrace.h │ │ │ │ │ │ ├── TensorTraits.h │ │ │ │ │ │ ├── TensorUInt128.h │ │ │ │ │ │ └── TensorVolumePatch.h │ │ │ │ │ ├── TensorSymmetry/ │ │ │ │ │ │ ├── DynamicSymmetry.h │ │ │ │ │ │ ├── StaticSymmetry.h │ │ │ │ │ │ ├── Symmetry.h │ │ │ │ │ │ └── util/ │ │ │ │ │ │ └── TemplateGroupTheory.h │ │ │ │ │ ├── ThreadPool/ │ │ │ │ │ │ ├── Barrier.h │ │ │ │ │ │ ├── EventCount.h │ │ │ │ │ │ ├── NonBlockingThreadPool.h │ │ │ │ │ │ ├── RunQueue.h │ │ │ │ │ │ ├── ThreadCancel.h │ │ │ │ │ │ ├── ThreadEnvironment.h │ │ │ │ │ │ ├── ThreadLocal.h │ │ │ │ │ │ ├── ThreadPoolInterface.h │ │ │ │ │ │ └── ThreadYield.h │ │ │ │ │ └── util/ │ │ │ │ │ ├── CXX11Meta.h │ │ │ │ │ ├── CXX11Workarounds.h │ │ │ │ │ ├── EmulateArray.h │ │ │ │ │ └── MaxSizeVector.h │ │ │ │ ├── EulerAngles │ │ │ │ ├── FFT │ │ │ │ ├── IterativeSolvers │ │ │ │ ├── KroneckerProduct │ │ │ │ ├── LevenbergMarquardt │ │ │ │ ├── MPRealSupport │ │ │ │ ├── MatrixFunctions │ │ │ │ ├── MoreVectorization │ │ │ │ ├── NonLinearOptimization │ │ │ │ ├── NumericalDiff │ │ │ │ ├── OpenGLSupport │ │ │ │ ├── Polynomials │ │ │ │ ├── Skyline │ │ │ │ ├── SparseExtra │ │ │ │ ├── SpecialFunctions │ │ │ │ ├── Splines │ │ │ │ └── src/ │ │ │ │ ├── AutoDiff/ │ │ │ │ │ ├── AutoDiffJacobian.h │ │ │ │ │ ├── AutoDiffScalar.h │ │ │ │ │ └── AutoDiffVector.h │ │ │ │ ├── BVH/ │ │ │ │ │ ├── BVAlgorithms.h │ │ │ │ │ └── KdBVH.h │ │ │ │ ├── Eigenvalues/ │ │ │ │ │ └── ArpackSelfAdjointEigenSolver.h │ │ │ │ ├── EulerAngles/ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── EulerAngles.h │ │ │ │ │ └── EulerSystem.h │ │ │ │ ├── FFT/ │ │ │ │ │ ├── ei_fftw_impl.h │ │ │ │ │ └── ei_kissfft_impl.h │ │ │ │ ├── IterativeSolvers/ │ │ │ │ │ ├── ConstrainedConjGrad.h │ │ │ │ │ ├── DGMRES.h │ │ │ │ │ ├── GMRES.h │ │ │ │ │ ├── IDRS.h │ │ │ │ │ ├── IncompleteLU.h │ │ │ │ │ ├── IterationController.h │ │ │ │ │ ├── MINRES.h │ │ │ │ │ └── Scaling.h │ │ │ │ ├── KroneckerProduct/ │ │ │ │ │ └── KroneckerTensorProduct.h │ │ │ │ ├── LevenbergMarquardt/ │ │ │ │ │ ├── CopyrightMINPACK.txt │ │ │ │ │ ├── LMcovar.h │ │ │ │ │ ├── LMonestep.h │ │ │ │ │ ├── LMpar.h │ │ │ │ │ ├── LMqrsolv.h │ │ │ │ │ └── LevenbergMarquardt.h │ │ │ │ ├── MatrixFunctions/ │ │ │ │ │ ├── MatrixExponential.h │ │ │ │ │ ├── MatrixFunction.h │ │ │ │ │ ├── MatrixLogarithm.h │ │ │ │ │ ├── MatrixPower.h │ │ │ │ │ ├── MatrixSquareRoot.h │ │ │ │ │ └── StemFunction.h │ │ │ │ ├── MoreVectorization/ │ │ │ │ │ └── MathFunctions.h │ │ │ │ ├── NonLinearOptimization/ │ │ │ │ │ ├── HybridNonLinearSolver.h │ │ │ │ │ ├── LevenbergMarquardt.h │ │ │ │ │ ├── chkder.h │ │ │ │ │ ├── covar.h │ │ │ │ │ ├── dogleg.h │ │ │ │ │ ├── fdjac1.h │ │ │ │ │ ├── lmpar.h │ │ │ │ │ ├── qrsolv.h │ │ │ │ │ ├── r1mpyq.h │ │ │ │ │ ├── r1updt.h │ │ │ │ │ └── rwupdt.h │ │ │ │ ├── NumericalDiff/ │ │ │ │ │ └── NumericalDiff.h │ │ │ │ ├── Polynomials/ │ │ │ │ │ ├── Companion.h │ │ │ │ │ ├── PolynomialSolver.h │ │ │ │ │ └── PolynomialUtils.h │ │ │ │ ├── Skyline/ │ │ │ │ │ ├── SkylineInplaceLU.h │ │ │ │ │ ├── SkylineMatrix.h │ │ │ │ │ ├── SkylineMatrixBase.h │ │ │ │ │ ├── SkylineProduct.h │ │ │ │ │ ├── SkylineStorage.h │ │ │ │ │ └── SkylineUtil.h │ │ │ │ ├── SparseExtra/ │ │ │ │ │ ├── BlockSparseMatrix.h │ │ │ │ │ ├── MarketIO.h │ │ │ │ │ ├── MatrixMarketIterator.h │ │ │ │ │ └── RandomSetter.h │ │ │ │ ├── SpecialFunctions/ │ │ │ │ │ ├── BesselFunctionsArrayAPI.h │ │ │ │ │ ├── BesselFunctionsBFloat16.h │ │ │ │ │ ├── BesselFunctionsFunctors.h │ │ │ │ │ ├── BesselFunctionsHalf.h │ │ │ │ │ ├── BesselFunctionsImpl.h │ │ │ │ │ ├── BesselFunctionsPacketMath.h │ │ │ │ │ ├── HipVectorCompatibility.h │ │ │ │ │ ├── SpecialFunctionsArrayAPI.h │ │ │ │ │ ├── SpecialFunctionsBFloat16.h │ │ │ │ │ ├── SpecialFunctionsFunctors.h │ │ │ │ │ ├── SpecialFunctionsHalf.h │ │ │ │ │ ├── SpecialFunctionsImpl.h │ │ │ │ │ ├── SpecialFunctionsPacketMath.h │ │ │ │ │ └── arch/ │ │ │ │ │ ├── AVX/ │ │ │ │ │ │ ├── BesselFunctions.h │ │ │ │ │ │ └── SpecialFunctions.h │ │ │ │ │ ├── AVX512/ │ │ │ │ │ │ ├── BesselFunctions.h │ │ │ │ │ │ └── SpecialFunctions.h │ │ │ │ │ ├── GPU/ │ │ │ │ │ │ └── SpecialFunctions.h │ │ │ │ │ └── NEON/ │ │ │ │ │ ├── BesselFunctions.h │ │ │ │ │ └── SpecialFunctions.h │ │ │ │ └── Splines/ │ │ │ │ ├── Spline.h │ │ │ │ ├── SplineFitting.h │ │ │ │ └── SplineFwd.h │ │ │ ├── README.txt │ │ │ ├── bench/ │ │ │ │ └── bench_svd.cpp │ │ │ ├── doc/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── Overview.dox │ │ │ │ ├── SYCL.dox │ │ │ │ ├── eigendoxy_layout.xml.in │ │ │ │ ├── examples/ │ │ │ │ │ ├── BVH_Example.cpp │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── EulerAngles.cpp │ │ │ │ │ ├── FFT.cpp │ │ │ │ │ ├── MatrixExponential.cpp │ │ │ │ │ ├── MatrixFunction.cpp │ │ │ │ │ ├── MatrixLogarithm.cpp │ │ │ │ │ ├── MatrixPower.cpp │ │ │ │ │ ├── MatrixPower_optimal.cpp │ │ │ │ │ ├── MatrixSine.cpp │ │ │ │ │ ├── MatrixSinh.cpp │ │ │ │ │ ├── MatrixSquareRoot.cpp │ │ │ │ │ ├── PolynomialSolver1.cpp │ │ │ │ │ ├── PolynomialUtils1.cpp │ │ │ │ │ └── SYCL/ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ └── CwiseMul.cpp │ │ │ │ └── snippets/ │ │ │ │ └── CMakeLists.txt │ │ │ └── test/ │ │ │ ├── BVH.cpp │ │ │ ├── CMakeLists.txt │ │ │ ├── EulerAngles.cpp │ │ │ ├── FFT.cpp │ │ │ ├── FFTW.cpp │ │ │ ├── NonLinearOptimization.cpp │ │ │ ├── NumericalDiff.cpp │ │ │ ├── alignedvector3.cpp │ │ │ ├── autodiff.cpp │ │ │ ├── autodiff_scalar.cpp │ │ │ ├── bessel_functions.cpp │ │ │ ├── cxx11_eventcount.cpp │ │ │ ├── cxx11_maxsizevector.cpp │ │ │ ├── cxx11_meta.cpp │ │ │ ├── cxx11_non_blocking_thread_pool.cpp │ │ │ ├── cxx11_runqueue.cpp │ │ │ ├── cxx11_tensor_argmax.cpp │ │ │ ├── cxx11_tensor_argmax_gpu.cu │ │ │ ├── cxx11_tensor_argmax_sycl.cpp │ │ │ ├── cxx11_tensor_assign.cpp │ │ │ ├── cxx11_tensor_block_access.cpp │ │ │ ├── cxx11_tensor_block_eval.cpp │ │ │ ├── cxx11_tensor_block_io.cpp │ │ │ ├── cxx11_tensor_broadcast_sycl.cpp │ │ │ ├── cxx11_tensor_broadcasting.cpp │ │ │ ├── cxx11_tensor_builtins_sycl.cpp │ │ │ ├── cxx11_tensor_cast_float16_gpu.cu │ │ │ ├── cxx11_tensor_casts.cpp │ │ │ ├── cxx11_tensor_chipping.cpp │ │ │ ├── cxx11_tensor_chipping_sycl.cpp │ │ │ ├── cxx11_tensor_comparisons.cpp │ │ │ ├── cxx11_tensor_complex_cwise_ops_gpu.cu │ │ │ ├── cxx11_tensor_complex_gpu.cu │ │ │ ├── cxx11_tensor_concatenation.cpp │ │ │ ├── cxx11_tensor_concatenation_sycl.cpp │ │ │ ├── cxx11_tensor_const.cpp │ │ │ ├── cxx11_tensor_contract_gpu.cu │ │ │ ├── cxx11_tensor_contract_sycl.cpp │ │ │ ├── cxx11_tensor_contraction.cpp │ │ │ ├── cxx11_tensor_convolution.cpp │ │ │ ├── cxx11_tensor_convolution_sycl.cpp │ │ │ ├── cxx11_tensor_custom_index.cpp │ │ │ ├── cxx11_tensor_custom_op.cpp │ │ │ ├── cxx11_tensor_custom_op_sycl.cpp │ │ │ ├── cxx11_tensor_device.cu │ │ │ ├── cxx11_tensor_device_sycl.cpp │ │ │ ├── cxx11_tensor_dimension.cpp │ │ │ ├── cxx11_tensor_empty.cpp │ │ │ ├── cxx11_tensor_executor.cpp │ │ │ ├── cxx11_tensor_expr.cpp │ │ │ ├── cxx11_tensor_fft.cpp │ │ │ ├── cxx11_tensor_fixed_size.cpp │ │ │ ├── cxx11_tensor_forced_eval.cpp │ │ │ ├── cxx11_tensor_forced_eval_sycl.cpp │ │ │ ├── cxx11_tensor_generator.cpp │ │ │ ├── cxx11_tensor_generator_sycl.cpp │ │ │ ├── cxx11_tensor_gpu.cu │ │ │ ├── cxx11_tensor_ifft.cpp │ │ │ ├── cxx11_tensor_image_op_sycl.cpp │ │ │ ├── cxx11_tensor_image_patch.cpp │ │ │ ├── cxx11_tensor_image_patch_sycl.cpp │ │ │ ├── cxx11_tensor_index_list.cpp │ │ │ ├── cxx11_tensor_inflation.cpp │ │ │ ├── cxx11_tensor_inflation_sycl.cpp │ │ │ ├── cxx11_tensor_intdiv.cpp │ │ │ ├── cxx11_tensor_io.cpp │ │ │ ├── cxx11_tensor_layout_swap.cpp │ │ │ ├── cxx11_tensor_layout_swap_sycl.cpp │ │ │ ├── cxx11_tensor_lvalue.cpp │ │ │ ├── cxx11_tensor_map.cpp │ │ │ ├── cxx11_tensor_math.cpp │ │ │ ├── cxx11_tensor_math_sycl.cpp │ │ │ ├── cxx11_tensor_mixed_indices.cpp │ │ │ ├── cxx11_tensor_morphing.cpp │ │ │ ├── cxx11_tensor_morphing_sycl.cpp │ │ │ ├── cxx11_tensor_move.cpp │ │ │ ├── cxx11_tensor_notification.cpp │ │ │ ├── cxx11_tensor_of_complex.cpp │ │ │ ├── cxx11_tensor_of_const_values.cpp │ │ │ ├── cxx11_tensor_of_float16_gpu.cu │ │ │ ├── cxx11_tensor_of_strings.cpp │ │ │ ├── cxx11_tensor_padding.cpp │ │ │ ├── cxx11_tensor_padding_sycl.cpp │ │ │ ├── cxx11_tensor_patch.cpp │ │ │ ├── cxx11_tensor_patch_sycl.cpp │ │ │ ├── cxx11_tensor_random.cpp │ │ │ ├── cxx11_tensor_random_gpu.cu │ │ │ ├── cxx11_tensor_random_sycl.cpp │ │ │ ├── cxx11_tensor_reduction.cpp │ │ │ ├── cxx11_tensor_reduction_gpu.cu │ │ │ ├── cxx11_tensor_reduction_sycl.cpp │ │ │ ├── cxx11_tensor_ref.cpp │ │ │ ├── cxx11_tensor_reverse.cpp │ │ │ ├── cxx11_tensor_reverse_sycl.cpp │ │ │ ├── cxx11_tensor_roundings.cpp │ │ │ ├── cxx11_tensor_scan.cpp │ │ │ ├── cxx11_tensor_scan_gpu.cu │ │ │ ├── cxx11_tensor_scan_sycl.cpp │ │ │ ├── cxx11_tensor_shuffling.cpp │ │ │ ├── cxx11_tensor_shuffling_sycl.cpp │ │ │ ├── cxx11_tensor_simple.cpp │ │ │ ├── cxx11_tensor_striding.cpp │ │ │ ├── cxx11_tensor_striding_sycl.cpp │ │ │ ├── cxx11_tensor_sugar.cpp │ │ │ ├── cxx11_tensor_sycl.cpp │ │ │ ├── cxx11_tensor_symmetry.cpp │ │ │ ├── cxx11_tensor_thread_local.cpp │ │ │ ├── cxx11_tensor_thread_pool.cpp │ │ │ ├── cxx11_tensor_trace.cpp │ │ │ ├── cxx11_tensor_uint128.cpp │ │ │ ├── cxx11_tensor_volume_patch.cpp │ │ │ ├── cxx11_tensor_volume_patch_sycl.cpp │ │ │ ├── dgmres.cpp │ │ │ ├── forward_adolc.cpp │ │ │ ├── gmres.cpp │ │ │ ├── idrs.cpp │ │ │ ├── kronecker_product.cpp │ │ │ ├── levenberg_marquardt.cpp │ │ │ ├── matrix_exponential.cpp │ │ │ ├── matrix_function.cpp │ │ │ ├── matrix_functions.h │ │ │ ├── matrix_power.cpp │ │ │ ├── matrix_square_root.cpp │ │ │ ├── minres.cpp │ │ │ ├── mpreal_support.cpp │ │ │ ├── openglsupport.cpp │ │ │ ├── polynomialsolver.cpp │ │ │ ├── polynomialutils.cpp │ │ │ ├── sparse_extra.cpp │ │ │ ├── special_functions.cpp │ │ │ ├── special_packetmath.cpp │ │ │ └── splines.cpp │ │ ├── lietorch/ │ │ │ ├── .gitignore │ │ │ ├── .gitmodules │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── eigen/ │ │ │ │ ├── .gitignore │ │ │ │ ├── .gitlab-ci.yml │ │ │ │ ├── .hgeol │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── COPYING.APACHE │ │ │ │ ├── COPYING.BSD │ │ │ │ ├── COPYING.GPL │ │ │ │ ├── COPYING.LGPL │ │ │ │ ├── COPYING.MINPACK │ │ │ │ ├── COPYING.MPL2 │ │ │ │ ├── COPYING.README │ │ │ │ ├── CTestConfig.cmake │ │ │ │ ├── CTestCustom.cmake.in │ │ │ │ ├── Eigen/ │ │ │ │ │ ├── Cholesky │ │ │ │ │ ├── CholmodSupport │ │ │ │ │ ├── Dense │ │ │ │ │ ├── Eigen │ │ │ │ │ ├── Eigenvalues │ │ │ │ │ ├── Geometry │ │ │ │ │ ├── Householder │ │ │ │ │ ├── IterativeLinearSolvers │ │ │ │ │ ├── Jacobi │ │ │ │ │ ├── KLUSupport │ │ │ │ │ ├── LU │ │ │ │ │ ├── MetisSupport │ │ │ │ │ ├── OrderingMethods │ │ │ │ │ ├── PaStiXSupport │ │ │ │ │ ├── PardisoSupport │ │ │ │ │ ├── QR │ │ │ │ │ ├── QtAlignedMalloc │ │ │ │ │ ├── SPQRSupport │ │ │ │ │ ├── SVD │ │ │ │ │ ├── Sparse │ │ │ │ │ ├── SparseCholesky │ │ │ │ │ ├── SparseCore │ │ │ │ │ ├── SparseLU │ │ │ │ │ ├── SparseQR │ │ │ │ │ ├── StdDeque │ │ │ │ │ ├── StdList │ │ │ │ │ ├── StdVector │ │ │ │ │ ├── SuperLUSupport │ │ │ │ │ ├── UmfPackSupport │ │ │ │ │ └── src/ │ │ │ │ │ ├── Cholesky/ │ │ │ │ │ │ ├── LDLT.h │ │ │ │ │ │ ├── LLT.h │ │ │ │ │ │ └── LLT_LAPACKE.h │ │ │ │ │ ├── CholmodSupport/ │ │ │ │ │ │ └── CholmodSupport.h │ │ │ │ │ ├── Eigenvalues/ │ │ │ │ │ │ ├── ComplexEigenSolver.h │ │ │ │ │ │ ├── ComplexSchur.h │ │ │ │ │ │ ├── ComplexSchur_LAPACKE.h │ │ │ │ │ │ ├── EigenSolver.h │ │ │ │ │ │ ├── GeneralizedEigenSolver.h │ │ │ │ │ │ ├── GeneralizedSelfAdjointEigenSolver.h │ │ │ │ │ │ ├── HessenbergDecomposition.h │ │ │ │ │ │ ├── MatrixBaseEigenvalues.h │ │ │ │ │ │ ├── RealQZ.h │ │ │ │ │ │ ├── RealSchur.h │ │ │ │ │ │ ├── RealSchur_LAPACKE.h │ │ │ │ │ │ ├── SelfAdjointEigenSolver.h │ │ │ │ │ │ ├── SelfAdjointEigenSolver_LAPACKE.h │ │ │ │ │ │ └── Tridiagonalization.h │ │ │ │ │ ├── Geometry/ │ │ │ │ │ │ ├── AlignedBox.h │ │ │ │ │ │ ├── AngleAxis.h │ │ │ │ │ │ ├── EulerAngles.h │ │ │ │ │ │ ├── Homogeneous.h │ │ │ │ │ │ ├── Hyperplane.h │ │ │ │ │ │ ├── OrthoMethods.h │ │ │ │ │ │ ├── ParametrizedLine.h │ │ │ │ │ │ ├── Quaternion.h │ │ │ │ │ │ ├── Rotation2D.h │ │ │ │ │ │ ├── RotationBase.h │ │ │ │ │ │ ├── Scaling.h │ │ │ │ │ │ ├── Transform.h │ │ │ │ │ │ ├── Translation.h │ │ │ │ │ │ ├── Umeyama.h │ │ │ │ │ │ └── arch/ │ │ │ │ │ │ └── Geometry_SIMD.h │ │ │ │ │ ├── Householder/ │ │ │ │ │ │ ├── BlockHouseholder.h │ │ │ │ │ │ ├── Householder.h │ │ │ │ │ │ └── HouseholderSequence.h │ │ │ │ │ ├── IterativeLinearSolvers/ │ │ │ │ │ │ ├── BasicPreconditioners.h │ │ │ │ │ │ ├── BiCGSTAB.h │ │ │ │ │ │ ├── ConjugateGradient.h │ │ │ │ │ │ ├── IncompleteCholesky.h │ │ │ │ │ │ ├── IncompleteLUT.h │ │ │ │ │ │ ├── IterativeSolverBase.h │ │ │ │ │ │ ├── LeastSquareConjugateGradient.h │ │ │ │ │ │ └── SolveWithGuess.h │ │ │ │ │ ├── Jacobi/ │ │ │ │ │ │ └── Jacobi.h │ │ │ │ │ ├── KLUSupport/ │ │ │ │ │ │ └── KLUSupport.h │ │ │ │ │ ├── LU/ │ │ │ │ │ │ ├── Determinant.h │ │ │ │ │ │ ├── FullPivLU.h │ │ │ │ │ │ ├── InverseImpl.h │ │ │ │ │ │ ├── PartialPivLU.h │ │ │ │ │ │ ├── PartialPivLU_LAPACKE.h │ │ │ │ │ │ └── arch/ │ │ │ │ │ │ └── InverseSize4.h │ │ │ │ │ ├── MetisSupport/ │ │ │ │ │ │ └── MetisSupport.h │ │ │ │ │ ├── OrderingMethods/ │ │ │ │ │ │ ├── Amd.h │ │ │ │ │ │ ├── Eigen_Colamd.h │ │ │ │ │ │ └── Ordering.h │ │ │ │ │ ├── PaStiXSupport/ │ │ │ │ │ │ └── PaStiXSupport.h │ │ │ │ │ ├── PardisoSupport/ │ │ │ │ │ │ └── PardisoSupport.h │ │ │ │ │ ├── QR/ │ │ │ │ │ │ ├── ColPivHouseholderQR.h │ │ │ │ │ │ ├── ColPivHouseholderQR_LAPACKE.h │ │ │ │ │ │ ├── CompleteOrthogonalDecomposition.h │ │ │ │ │ │ ├── FullPivHouseholderQR.h │ │ │ │ │ │ ├── HouseholderQR.h │ │ │ │ │ │ └── HouseholderQR_LAPACKE.h │ │ │ │ │ ├── SPQRSupport/ │ │ │ │ │ │ └── SuiteSparseQRSupport.h │ │ │ │ │ ├── SVD/ │ │ │ │ │ │ ├── BDCSVD.h │ │ │ │ │ │ ├── JacobiSVD.h │ │ │ │ │ │ ├── JacobiSVD_LAPACKE.h │ │ │ │ │ │ ├── SVDBase.h │ │ │ │ │ │ └── UpperBidiagonalization.h │ │ │ │ │ ├── SparseCholesky/ │ │ │ │ │ │ ├── SimplicialCholesky.h │ │ │ │ │ │ └── SimplicialCholesky_impl.h │ │ │ │ │ ├── SparseCore/ │ │ │ │ │ │ ├── AmbiVector.h │ │ │ │ │ │ ├── CompressedStorage.h │ │ │ │ │ │ ├── ConservativeSparseSparseProduct.h │ │ │ │ │ │ ├── MappedSparseMatrix.h │ │ │ │ │ │ ├── SparseAssign.h │ │ │ │ │ │ ├── SparseBlock.h │ │ │ │ │ │ ├── SparseColEtree.h │ │ │ │ │ │ ├── SparseCompressedBase.h │ │ │ │ │ │ ├── SparseCwiseBinaryOp.h │ │ │ │ │ │ ├── SparseCwiseUnaryOp.h │ │ │ │ │ │ ├── SparseDenseProduct.h │ │ │ │ │ │ ├── SparseDiagonalProduct.h │ │ │ │ │ │ ├── SparseDot.h │ │ │ │ │ │ ├── SparseFuzzy.h │ │ │ │ │ │ ├── SparseMap.h │ │ │ │ │ │ ├── SparseMatrix.h │ │ │ │ │ │ ├── SparseMatrixBase.h │ │ │ │ │ │ ├── SparsePermutation.h │ │ │ │ │ │ ├── SparseProduct.h │ │ │ │ │ │ ├── SparseRedux.h │ │ │ │ │ │ ├── SparseRef.h │ │ │ │ │ │ ├── SparseSelfAdjointView.h │ │ │ │ │ │ ├── SparseSolverBase.h │ │ │ │ │ │ ├── SparseSparseProductWithPruning.h │ │ │ │ │ │ ├── SparseTranspose.h │ │ │ │ │ │ ├── SparseTriangularView.h │ │ │ │ │ │ ├── SparseUtil.h │ │ │ │ │ │ ├── SparseVector.h │ │ │ │ │ │ ├── SparseView.h │ │ │ │ │ │ └── TriangularSolver.h │ │ │ │ │ ├── SparseLU/ │ │ │ │ │ │ ├── SparseLU.h │ │ │ │ │ │ ├── SparseLUImpl.h │ │ │ │ │ │ ├── SparseLU_Memory.h │ │ │ │ │ │ ├── SparseLU_Structs.h │ │ │ │ │ │ ├── SparseLU_SupernodalMatrix.h │ │ │ │ │ │ ├── SparseLU_Utils.h │ │ │ │ │ │ ├── SparseLU_column_bmod.h │ │ │ │ │ │ ├── SparseLU_column_dfs.h │ │ │ │ │ │ ├── SparseLU_copy_to_ucol.h │ │ │ │ │ │ ├── SparseLU_gemm_kernel.h │ │ │ │ │ │ ├── SparseLU_heap_relax_snode.h │ │ │ │ │ │ ├── SparseLU_kernel_bmod.h │ │ │ │ │ │ ├── SparseLU_panel_bmod.h │ │ │ │ │ │ ├── SparseLU_panel_dfs.h │ │ │ │ │ │ ├── SparseLU_pivotL.h │ │ │ │ │ │ ├── SparseLU_pruneL.h │ │ │ │ │ │ └── SparseLU_relax_snode.h │ │ │ │ │ ├── SparseQR/ │ │ │ │ │ │ └── SparseQR.h │ │ │ │ │ ├── StlSupport/ │ │ │ │ │ │ ├── StdDeque.h │ │ │ │ │ │ ├── StdList.h │ │ │ │ │ │ ├── StdVector.h │ │ │ │ │ │ └── details.h │ │ │ │ │ ├── SuperLUSupport/ │ │ │ │ │ │ └── SuperLUSupport.h │ │ │ │ │ ├── UmfPackSupport/ │ │ │ │ │ │ └── UmfPackSupport.h │ │ │ │ │ ├── misc/ │ │ │ │ │ │ ├── Image.h │ │ │ │ │ │ ├── Kernel.h │ │ │ │ │ │ ├── RealSvd2x2.h │ │ │ │ │ │ ├── blas.h │ │ │ │ │ │ ├── lapack.h │ │ │ │ │ │ ├── lapacke.h │ │ │ │ │ │ └── lapacke_mangling.h │ │ │ │ │ └── plugins/ │ │ │ │ │ ├── ArrayCwiseBinaryOps.h │ │ │ │ │ ├── ArrayCwiseUnaryOps.h │ │ │ │ │ ├── BlockMethods.h │ │ │ │ │ ├── CommonCwiseBinaryOps.h │ │ │ │ │ ├── CommonCwiseUnaryOps.h │ │ │ │ │ ├── IndexedViewMethods.h │ │ │ │ │ ├── MatrixCwiseBinaryOps.h │ │ │ │ │ ├── MatrixCwiseUnaryOps.h │ │ │ │ │ └── ReshapedMethods.h │ │ │ │ ├── INSTALL │ │ │ │ ├── README.md │ │ │ │ ├── bench/ │ │ │ │ │ ├── BenchSparseUtil.h │ │ │ │ │ ├── BenchTimer.h │ │ │ │ │ ├── BenchUtil.h │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── analyze-blocking-sizes.cpp │ │ │ │ │ ├── basicbench.cxxlist │ │ │ │ │ ├── basicbenchmark.cpp │ │ │ │ │ ├── basicbenchmark.h │ │ │ │ │ ├── benchBlasGemm.cpp │ │ │ │ │ ├── benchCholesky.cpp │ │ │ │ │ ├── benchEigenSolver.cpp │ │ │ │ │ ├── benchFFT.cpp │ │ │ │ │ ├── benchGeometry.cpp │ │ │ │ │ ├── benchVecAdd.cpp │ │ │ │ │ ├── bench_gemm.cpp │ │ │ │ │ ├── bench_move_semantics.cpp │ │ │ │ │ ├── bench_multi_compilers.sh │ │ │ │ │ ├── bench_norm.cpp │ │ │ │ │ ├── bench_reverse.cpp │ │ │ │ │ ├── bench_sum.cpp │ │ │ │ │ ├── bench_unrolling │ │ │ │ │ ├── benchmark-blocking-sizes.cpp │ │ │ │ │ ├── benchmark.cpp │ │ │ │ │ ├── benchmarkSlice.cpp │ │ │ │ │ ├── benchmarkX.cpp │ │ │ │ │ ├── benchmarkXcwise.cpp │ │ │ │ │ ├── benchmark_suite │ │ │ │ │ ├── btl/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── COPYING │ │ │ │ │ │ ├── README │ │ │ │ │ │ ├── actions/ │ │ │ │ │ │ │ ├── action_aat_product.hh │ │ │ │ │ │ │ ├── action_ata_product.hh │ │ │ │ │ │ │ ├── action_atv_product.hh │ │ │ │ │ │ │ ├── action_axpby.hh │ │ │ │ │ │ │ ├── action_axpy.hh │ │ │ │ │ │ │ ├── action_cholesky.hh │ │ │ │ │ │ │ ├── action_ger.hh │ │ │ │ │ │ │ ├── action_hessenberg.hh │ │ │ │ │ │ │ ├── action_lu_decomp.hh │ │ │ │ │ │ │ ├── action_lu_solve.hh │ │ │ │ │ │ │ ├── action_matrix_matrix_product.hh │ │ │ │ │ │ │ ├── action_matrix_matrix_product_bis.hh │ │ │ │ │ │ │ ├── action_matrix_vector_product.hh │ │ │ │ │ │ │ ├── action_partial_lu.hh │ │ │ │ │ │ │ ├── action_rot.hh │ │ │ │ │ │ │ ├── action_symv.hh │ │ │ │ │ │ │ ├── action_syr2.hh │ │ │ │ │ │ │ ├── action_trisolve.hh │ │ │ │ │ │ │ ├── action_trisolve_matrix.hh │ │ │ │ │ │ │ ├── action_trmm.hh │ │ │ │ │ │ │ └── basic_actions.hh │ │ │ │ │ │ ├── cmake/ │ │ │ │ │ │ │ ├── FindACML.cmake │ │ │ │ │ │ │ ├── FindATLAS.cmake │ │ │ │ │ │ │ ├── FindBLAZE.cmake │ │ │ │ │ │ │ ├── FindBlitz.cmake │ │ │ │ │ │ │ ├── FindCBLAS.cmake │ │ │ │ │ │ │ ├── FindGMM.cmake │ │ │ │ │ │ │ ├── FindMKL.cmake │ │ │ │ │ │ │ ├── FindMTL4.cmake │ │ │ │ │ │ │ ├── FindOPENBLAS.cmake │ │ │ │ │ │ │ ├── FindPackageHandleStandardArgs.cmake │ │ │ │ │ │ │ ├── FindTvmet.cmake │ │ │ │ │ │ │ └── MacroOptionalAddSubdirectory.cmake │ │ │ │ │ │ ├── generic_bench/ │ │ │ │ │ │ │ ├── bench.hh │ │ │ │ │ │ │ ├── bench_parameter.hh │ │ │ │ │ │ │ ├── btl.hh │ │ │ │ │ │ │ ├── init/ │ │ │ │ │ │ │ │ ├── init_function.hh │ │ │ │ │ │ │ │ ├── init_matrix.hh │ │ │ │ │ │ │ │ └── init_vector.hh │ │ │ │ │ │ │ ├── static/ │ │ │ │ │ │ │ │ ├── bench_static.hh │ │ │ │ │ │ │ │ ├── intel_bench_fixed_size.hh │ │ │ │ │ │ │ │ └── static_size_generator.hh │ │ │ │ │ │ │ ├── timers/ │ │ │ │ │ │ │ │ ├── STL_perf_analyzer.hh │ │ │ │ │ │ │ │ ├── STL_timer.hh │ │ │ │ │ │ │ │ ├── mixed_perf_analyzer.hh │ │ │ │ │ │ │ │ ├── portable_perf_analyzer.hh │ │ │ │ │ │ │ │ ├── portable_perf_analyzer_old.hh │ │ │ │ │ │ │ │ ├── portable_timer.hh │ │ │ │ │ │ │ │ ├── x86_perf_analyzer.hh │ │ │ │ │ │ │ │ └── x86_timer.hh │ │ │ │ │ │ │ └── utils/ │ │ │ │ │ │ │ ├── size_lin_log.hh │ │ │ │ │ │ │ ├── size_log.hh │ │ │ │ │ │ │ ├── utilities.h │ │ │ │ │ │ │ └── xy_file.hh │ │ │ │ │ │ └── libs/ │ │ │ │ │ │ ├── BLAS/ │ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ │ ├── blas.h │ │ │ │ │ │ │ ├── blas_interface.hh │ │ │ │ │ │ │ ├── blas_interface_impl.hh │ │ │ │ │ │ │ ├── c_interface_base.h │ │ │ │ │ │ │ └── main.cpp │ │ │ │ │ │ ├── STL/ │ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ │ ├── STL_interface.hh │ │ │ │ │ │ │ └── main.cpp │ │ │ │ │ │ ├── blaze/ │ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ │ ├── blaze_interface.hh │ │ │ │ │ │ │ └── main.cpp │ │ │ │ │ │ ├── blitz/ │ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ │ ├── blitz_LU_solve_interface.hh │ │ │ │ │ │ │ ├── blitz_interface.hh │ │ │ │ │ │ │ ├── btl_blitz.cpp │ │ │ │ │ │ │ ├── btl_tiny_blitz.cpp │ │ │ │ │ │ │ └── tiny_blitz_interface.hh │ │ │ │ │ │ ├── eigen2/ │ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ │ ├── btl_tiny_eigen2.cpp │ │ │ │ │ │ │ ├── eigen2_interface.hh │ │ │ │ │ │ │ ├── main_adv.cpp │ │ │ │ │ │ │ ├── main_linear.cpp │ │ │ │ │ │ │ ├── main_matmat.cpp │ │ │ │ │ │ │ └── main_vecmat.cpp │ │ │ │ │ │ ├── eigen3/ │ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ │ ├── btl_tiny_eigen3.cpp │ │ │ │ │ │ │ ├── eigen3_interface.hh │ │ │ │ │ │ │ ├── main_adv.cpp │ │ │ │ │ │ │ ├── main_linear.cpp │ │ │ │ │ │ │ ├── main_matmat.cpp │ │ │ │ │ │ │ └── main_vecmat.cpp │ │ │ │ │ │ ├── gmm/ │ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ │ ├── gmm_LU_solve_interface.hh │ │ │ │ │ │ │ ├── gmm_interface.hh │ │ │ │ │ │ │ └── main.cpp │ │ │ │ │ │ ├── mtl4/ │ │ │ │ │ │ │ ├── .kdbgrc.main │ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ │ ├── main.cpp │ │ │ │ │ │ │ ├── mtl4_LU_solve_interface.hh │ │ │ │ │ │ │ └── mtl4_interface.hh │ │ │ │ │ │ ├── tensors/ │ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ │ ├── main_linear.cpp │ │ │ │ │ │ │ ├── main_matmat.cpp │ │ │ │ │ │ │ ├── main_vecmat.cpp │ │ │ │ │ │ │ └── tensor_interface.hh │ │ │ │ │ │ ├── tvmet/ │ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ │ ├── main.cpp │ │ │ │ │ │ │ └── tvmet_interface.hh │ │ │ │ │ │ └── ublas/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── main.cpp │ │ │ │ │ │ └── ublas_interface.hh │ │ │ │ │ ├── check_cache_queries.cpp │ │ │ │ │ ├── dense_solvers.cpp │ │ │ │ │ ├── eig33.cpp │ │ │ │ │ ├── geometry.cpp │ │ │ │ │ ├── perf_monitoring/ │ │ │ │ │ │ ├── changesets.txt │ │ │ │ │ │ ├── gemm.cpp │ │ │ │ │ │ ├── gemm_common.h │ │ │ │ │ │ ├── gemm_settings.txt │ │ │ │ │ │ ├── gemm_square_settings.txt │ │ │ │ │ │ ├── gemv.cpp │ │ │ │ │ │ ├── gemv_common.h │ │ │ │ │ │ ├── gemv_settings.txt │ │ │ │ │ │ ├── gemv_square_settings.txt │ │ │ │ │ │ ├── gemvt.cpp │ │ │ │ │ │ ├── lazy_gemm.cpp │ │ │ │ │ │ ├── lazy_gemm_settings.txt │ │ │ │ │ │ ├── llt.cpp │ │ │ │ │ │ ├── make_plot.sh │ │ │ │ │ │ ├── resources/ │ │ │ │ │ │ │ ├── chart_footer.html │ │ │ │ │ │ │ ├── chart_header.html │ │ │ │ │ │ │ ├── footer.html │ │ │ │ │ │ │ ├── header.html │ │ │ │ │ │ │ ├── s1.js │ │ │ │ │ │ │ └── s2.js │ │ │ │ │ │ ├── run.sh │ │ │ │ │ │ ├── runall.sh │ │ │ │ │ │ ├── trmv_lo.cpp │ │ │ │ │ │ ├── trmv_lot.cpp │ │ │ │ │ │ ├── trmv_up.cpp │ │ │ │ │ │ └── trmv_upt.cpp │ │ │ │ │ ├── product_threshold.cpp │ │ │ │ │ ├── quat_slerp.cpp │ │ │ │ │ ├── quatmul.cpp │ │ │ │ │ ├── sparse_cholesky.cpp │ │ │ │ │ ├── sparse_dense_product.cpp │ │ │ │ │ ├── sparse_lu.cpp │ │ │ │ │ ├── sparse_product.cpp │ │ │ │ │ ├── sparse_randomsetter.cpp │ │ │ │ │ ├── sparse_setter.cpp │ │ │ │ │ ├── sparse_transpose.cpp │ │ │ │ │ ├── sparse_trisolver.cpp │ │ │ │ │ ├── spbench/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── sp_solver.cpp │ │ │ │ │ │ ├── spbench.dtd │ │ │ │ │ │ ├── spbenchsolver.cpp │ │ │ │ │ │ ├── spbenchsolver.h │ │ │ │ │ │ ├── spbenchstyle.h │ │ │ │ │ │ └── test_sparseLU.cpp │ │ │ │ │ ├── spmv.cpp │ │ │ │ │ ├── tensors/ │ │ │ │ │ │ ├── README │ │ │ │ │ │ ├── benchmark.h │ │ │ │ │ │ ├── benchmark_main.cc │ │ │ │ │ │ ├── contraction_benchmarks_cpu.cc │ │ │ │ │ │ ├── eigen_sycl_bench.sh │ │ │ │ │ │ ├── eigen_sycl_bench_contract.sh │ │ │ │ │ │ ├── tensor_benchmarks.h │ │ │ │ │ │ ├── tensor_benchmarks_cpu.cc │ │ │ │ │ │ ├── tensor_benchmarks_fp16_gpu.cu │ │ │ │ │ │ ├── tensor_benchmarks_gpu.cu │ │ │ │ │ │ ├── tensor_benchmarks_sycl.cc │ │ │ │ │ │ └── tensor_contract_sycl_bench.cc │ │ │ │ │ └── vdw_new.cpp │ │ │ │ ├── blas/ │ │ │ │ │ ├── BandTriangularSolver.h │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── GeneralRank1Update.h │ │ │ │ │ ├── PackedSelfadjointProduct.h │ │ │ │ │ ├── PackedTriangularMatrixVector.h │ │ │ │ │ ├── PackedTriangularSolverVector.h │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── Rank2Update.h │ │ │ │ │ ├── common.h │ │ │ │ │ ├── complex_double.cpp │ │ │ │ │ ├── complex_single.cpp │ │ │ │ │ ├── double.cpp │ │ │ │ │ ├── f2c/ │ │ │ │ │ │ ├── chbmv.c │ │ │ │ │ │ ├── chpmv.c │ │ │ │ │ │ ├── complexdots.c │ │ │ │ │ │ ├── ctbmv.c │ │ │ │ │ │ ├── d_cnjg.c │ │ │ │ │ │ ├── datatypes.h │ │ │ │ │ │ ├── drotm.c │ │ │ │ │ │ ├── drotmg.c │ │ │ │ │ │ ├── dsbmv.c │ │ │ │ │ │ ├── dspmv.c │ │ │ │ │ │ ├── dtbmv.c │ │ │ │ │ │ ├── lsame.c │ │ │ │ │ │ ├── r_cnjg.c │ │ │ │ │ │ ├── srotm.c │ │ │ │ │ │ ├── srotmg.c │ │ │ │ │ │ ├── ssbmv.c │ │ │ │ │ │ ├── sspmv.c │ │ │ │ │ │ ├── stbmv.c │ │ │ │ │ │ ├── zhbmv.c │ │ │ │ │ │ ├── zhpmv.c │ │ │ │ │ │ └── ztbmv.c │ │ │ │ │ ├── fortran/ │ │ │ │ │ │ └── complexdots.f │ │ │ │ │ ├── level1_cplx_impl.h │ │ │ │ │ ├── level1_impl.h │ │ │ │ │ ├── level1_real_impl.h │ │ │ │ │ ├── level2_cplx_impl.h │ │ │ │ │ ├── level2_impl.h │ │ │ │ │ ├── level2_real_impl.h │ │ │ │ │ ├── level3_impl.h │ │ │ │ │ ├── single.cpp │ │ │ │ │ ├── testing/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── cblat1.f │ │ │ │ │ │ ├── cblat2.f │ │ │ │ │ │ ├── cblat3.f │ │ │ │ │ │ ├── dblat1.f │ │ │ │ │ │ ├── dblat2.f │ │ │ │ │ │ ├── dblat3.f │ │ │ │ │ │ ├── runblastest.sh │ │ │ │ │ │ ├── sblat1.f │ │ │ │ │ │ ├── sblat2.f │ │ │ │ │ │ ├── sblat3.f │ │ │ │ │ │ ├── zblat1.f │ │ │ │ │ │ ├── zblat2.f │ │ │ │ │ │ └── zblat3.f │ │ │ │ │ └── xerbla.cpp │ │ │ │ ├── ci/ │ │ │ │ │ ├── CTest2JUnit.xsl │ │ │ │ │ ├── README.md │ │ │ │ │ └── test.gitlab-ci.yml │ │ │ │ ├── cmake/ │ │ │ │ │ ├── ComputeCppCompilerChecks.cmake │ │ │ │ │ ├── ComputeCppIRMap.cmake │ │ │ │ │ ├── Eigen3Config.cmake.in │ │ │ │ │ ├── Eigen3ConfigLegacy.cmake.in │ │ │ │ │ ├── EigenConfigureTesting.cmake │ │ │ │ │ ├── EigenDetermineOSVersion.cmake │ │ │ │ │ ├── EigenDetermineVSServicePack.cmake │ │ │ │ │ ├── EigenTesting.cmake │ │ │ │ │ ├── EigenUninstall.cmake │ │ │ │ │ ├── FindAdolc.cmake │ │ │ │ │ ├── FindBLAS.cmake │ │ │ │ │ ├── FindBLASEXT.cmake │ │ │ │ │ ├── FindCHOLMOD.cmake │ │ │ │ │ ├── FindComputeCpp.cmake │ │ │ │ │ ├── FindEigen2.cmake │ │ │ │ │ ├── FindEigen3.cmake │ │ │ │ │ ├── FindFFTW.cmake │ │ │ │ │ ├── FindGLEW.cmake │ │ │ │ │ ├── FindGMP.cmake │ │ │ │ │ ├── FindGSL.cmake │ │ │ │ │ ├── FindGoogleHash.cmake │ │ │ │ │ ├── FindHWLOC.cmake │ │ │ │ │ ├── FindKLU.cmake │ │ │ │ │ ├── FindLAPACK.cmake │ │ │ │ │ ├── FindMPFR.cmake │ │ │ │ │ ├── FindMetis.cmake │ │ │ │ │ ├── FindPTSCOTCH.cmake │ │ │ │ │ ├── FindPastix.cmake │ │ │ │ │ ├── FindSPQR.cmake │ │ │ │ │ ├── FindScotch.cmake │ │ │ │ │ ├── FindStandardMathLibrary.cmake │ │ │ │ │ ├── FindSuperLU.cmake │ │ │ │ │ ├── FindTriSYCL.cmake │ │ │ │ │ ├── FindUMFPACK.cmake │ │ │ │ │ ├── RegexUtils.cmake │ │ │ │ │ └── UseEigen3.cmake │ │ │ │ ├── debug/ │ │ │ │ │ ├── gdb/ │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ └── printers.py │ │ │ │ │ └── msvc/ │ │ │ │ │ └── eigen.natvis │ │ │ │ ├── demos/ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── mandelbrot/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── README │ │ │ │ │ │ ├── mandelbrot.cpp │ │ │ │ │ │ └── mandelbrot.h │ │ │ │ │ ├── mix_eigen_and_c/ │ │ │ │ │ │ ├── README │ │ │ │ │ │ ├── binary_library.cpp │ │ │ │ │ │ ├── binary_library.h │ │ │ │ │ │ └── example.c │ │ │ │ │ └── opengl/ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── README │ │ │ │ │ ├── camera.cpp │ │ │ │ │ ├── camera.h │ │ │ │ │ ├── gpuhelper.cpp │ │ │ │ │ ├── gpuhelper.h │ │ │ │ │ ├── icosphere.cpp │ │ │ │ │ ├── icosphere.h │ │ │ │ │ ├── quaternion_demo.cpp │ │ │ │ │ ├── quaternion_demo.h │ │ │ │ │ ├── trackball.cpp │ │ │ │ │ └── trackball.h │ │ │ │ ├── doc/ │ │ │ │ │ ├── AsciiQuickReference.txt │ │ │ │ │ ├── B01_Experimental.dox │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── ClassHierarchy.dox │ │ │ │ │ ├── CoeffwiseMathFunctionsTable.dox │ │ │ │ │ ├── CustomizingEigen_CustomScalar.dox │ │ │ │ │ ├── CustomizingEigen_InheritingMatrix.dox │ │ │ │ │ ├── CustomizingEigen_NullaryExpr.dox │ │ │ │ │ ├── CustomizingEigen_Plugins.dox │ │ │ │ │ ├── DenseDecompositionBenchmark.dox │ │ │ │ │ ├── Doxyfile.in │ │ │ │ │ ├── FixedSizeVectorizable.dox │ │ │ │ │ ├── FunctionsTakingEigenTypes.dox │ │ │ │ │ ├── HiPerformance.dox │ │ │ │ │ ├── InplaceDecomposition.dox │ │ │ │ │ ├── InsideEigenExample.dox │ │ │ │ │ ├── LeastSquares.dox │ │ │ │ │ ├── Manual.dox │ │ │ │ │ ├── MatrixfreeSolverExample.dox │ │ │ │ │ ├── NewExpressionType.dox │ │ │ │ │ ├── Overview.dox │ │ │ │ │ ├── PassingByValue.dox │ │ │ │ │ ├── Pitfalls.dox │ │ │ │ │ ├── PreprocessorDirectives.dox │ │ │ │ │ ├── QuickReference.dox │ │ │ │ │ ├── QuickStartGuide.dox │ │ │ │ │ ├── SparseLinearSystems.dox │ │ │ │ │ ├── SparseQuickReference.dox │ │ │ │ │ ├── StlContainers.dox │ │ │ │ │ ├── StorageOrders.dox │ │ │ │ │ ├── StructHavingEigenMembers.dox │ │ │ │ │ ├── TemplateKeyword.dox │ │ │ │ │ ├── TopicAliasing.dox │ │ │ │ │ ├── TopicAssertions.dox │ │ │ │ │ ├── TopicCMakeGuide.dox │ │ │ │ │ ├── TopicEigenExpressionTemplates.dox │ │ │ │ │ ├── TopicLazyEvaluation.dox │ │ │ │ │ ├── TopicLinearAlgebraDecompositions.dox │ │ │ │ │ ├── TopicMultithreading.dox │ │ │ │ │ ├── TopicResizing.dox │ │ │ │ │ ├── TopicScalarTypes.dox │ │ │ │ │ ├── TopicVectorization.dox │ │ │ │ │ ├── TutorialAdvancedInitialization.dox │ │ │ │ │ ├── TutorialArrayClass.dox │ │ │ │ │ ├── TutorialBlockOperations.dox │ │ │ │ │ ├── TutorialGeometry.dox │ │ │ │ │ ├── TutorialLinearAlgebra.dox │ │ │ │ │ ├── TutorialMapClass.dox │ │ │ │ │ ├── TutorialMatrixArithmetic.dox │ │ │ │ │ ├── TutorialMatrixClass.dox │ │ │ │ │ ├── TutorialReductionsVisitorsBroadcasting.dox │ │ │ │ │ ├── TutorialReshape.dox │ │ │ │ │ ├── TutorialSTL.dox │ │ │ │ │ ├── TutorialSlicingIndexing.dox │ │ │ │ │ ├── TutorialSparse.dox │ │ │ │ │ ├── TutorialSparse_example_details.dox │ │ │ │ │ ├── UnalignedArrayAssert.dox │ │ │ │ │ ├── UsingBlasLapackBackends.dox │ │ │ │ │ ├── UsingIntelMKL.dox │ │ │ │ │ ├── UsingNVCC.dox │ │ │ │ │ ├── WrongStackAlignment.dox │ │ │ │ │ ├── eigen_navtree_hacks.js │ │ │ │ │ ├── eigendoxy.css │ │ │ │ │ ├── eigendoxy_footer.html.in │ │ │ │ │ ├── eigendoxy_header.html.in │ │ │ │ │ ├── eigendoxy_layout.xml.in │ │ │ │ │ ├── eigendoxy_tabs.css │ │ │ │ │ ├── examples/ │ │ │ │ │ │ ├── .krazy │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── CustomizingEigen_Inheritance.cpp │ │ │ │ │ │ ├── Cwise_erf.cpp │ │ │ │ │ │ ├── Cwise_erfc.cpp │ │ │ │ │ │ ├── Cwise_lgamma.cpp │ │ │ │ │ │ ├── DenseBase_middleCols_int.cpp │ │ │ │ │ │ ├── DenseBase_middleRows_int.cpp │ │ │ │ │ │ ├── DenseBase_template_int_middleCols.cpp │ │ │ │ │ │ ├── DenseBase_template_int_middleRows.cpp │ │ │ │ │ │ ├── QuickStart_example.cpp │ │ │ │ │ │ ├── QuickStart_example2_dynamic.cpp │ │ │ │ │ │ ├── QuickStart_example2_fixed.cpp │ │ │ │ │ │ ├── TemplateKeyword_flexible.cpp │ │ │ │ │ │ ├── TemplateKeyword_simple.cpp │ │ │ │ │ │ ├── TutorialInplaceLU.cpp │ │ │ │ │ │ ├── TutorialLinAlgComputeTwice.cpp │ │ │ │ │ │ ├── TutorialLinAlgExComputeSolveError.cpp │ │ │ │ │ │ ├── TutorialLinAlgExSolveColPivHouseholderQR.cpp │ │ │ │ │ │ ├── TutorialLinAlgExSolveLDLT.cpp │ │ │ │ │ │ ├── TutorialLinAlgInverseDeterminant.cpp │ │ │ │ │ │ ├── TutorialLinAlgRankRevealing.cpp │ │ │ │ │ │ ├── TutorialLinAlgSVDSolve.cpp │ │ │ │ │ │ ├── TutorialLinAlgSelfAdjointEigenSolver.cpp │ │ │ │ │ │ ├── TutorialLinAlgSetThreshold.cpp │ │ │ │ │ │ ├── Tutorial_ArrayClass_accessors.cpp │ │ │ │ │ │ ├── Tutorial_ArrayClass_addition.cpp │ │ │ │ │ │ ├── Tutorial_ArrayClass_cwise_other.cpp │ │ │ │ │ │ ├── Tutorial_ArrayClass_interop.cpp │ │ │ │ │ │ ├── Tutorial_ArrayClass_interop_matrix.cpp │ │ │ │ │ │ ├── Tutorial_ArrayClass_mult.cpp │ │ │ │ │ │ ├── Tutorial_BlockOperations_block_assignment.cpp │ │ │ │ │ │ ├── Tutorial_BlockOperations_colrow.cpp │ │ │ │ │ │ ├── Tutorial_BlockOperations_corner.cpp │ │ │ │ │ │ ├── Tutorial_BlockOperations_print_block.cpp │ │ │ │ │ │ ├── Tutorial_BlockOperations_vector.cpp │ │ │ │ │ │ ├── Tutorial_PartialLU_solve.cpp │ │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.cpp │ │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp │ │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp │ │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp │ │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp │ │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp │ │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp │ │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_reductions_operatornorm.cpp │ │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_rowwise.cpp │ │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp │ │ │ │ │ │ ├── Tutorial_simple_example_dynamic_size.cpp │ │ │ │ │ │ ├── Tutorial_simple_example_fixed_size.cpp │ │ │ │ │ │ ├── class_Block.cpp │ │ │ │ │ │ ├── class_CwiseBinaryOp.cpp │ │ │ │ │ │ ├── class_CwiseUnaryOp.cpp │ │ │ │ │ │ ├── class_CwiseUnaryOp_ptrfun.cpp │ │ │ │ │ │ ├── class_FixedBlock.cpp │ │ │ │ │ │ ├── class_FixedReshaped.cpp │ │ │ │ │ │ ├── class_FixedVectorBlock.cpp │ │ │ │ │ │ ├── class_Reshaped.cpp │ │ │ │ │ │ ├── class_VectorBlock.cpp │ │ │ │ │ │ ├── function_taking_eigenbase.cpp │ │ │ │ │ │ ├── function_taking_ref.cpp │ │ │ │ │ │ ├── make_circulant.cpp │ │ │ │ │ │ ├── make_circulant.cpp.entry │ │ │ │ │ │ ├── make_circulant.cpp.evaluator │ │ │ │ │ │ ├── make_circulant.cpp.expression │ │ │ │ │ │ ├── make_circulant.cpp.main │ │ │ │ │ │ ├── make_circulant.cpp.preamble │ │ │ │ │ │ ├── make_circulant.cpp.traits │ │ │ │ │ │ ├── make_circulant2.cpp │ │ │ │ │ │ ├── matrixfree_cg.cpp │ │ │ │ │ │ ├── nullary_indexing.cpp │ │ │ │ │ │ ├── tut_arithmetic_add_sub.cpp │ │ │ │ │ │ ├── tut_arithmetic_dot_cross.cpp │ │ │ │ │ │ ├── tut_arithmetic_matrix_mul.cpp │ │ │ │ │ │ ├── tut_arithmetic_redux_basic.cpp │ │ │ │ │ │ ├── tut_arithmetic_scalar_mul_div.cpp │ │ │ │ │ │ ├── tut_matrix_coefficient_accessors.cpp │ │ │ │ │ │ ├── tut_matrix_resize.cpp │ │ │ │ │ │ └── tut_matrix_resize_fixed_size.cpp │ │ │ │ │ ├── snippets/ │ │ │ │ │ │ ├── .krazy │ │ │ │ │ │ ├── AngleAxis_mimic_euler.cpp │ │ │ │ │ │ ├── Array_initializer_list_23_cxx11.cpp │ │ │ │ │ │ ├── Array_initializer_list_vector_cxx11.cpp │ │ │ │ │ │ ├── Array_variadic_ctor_cxx11.cpp │ │ │ │ │ │ ├── BiCGSTAB_simple.cpp │ │ │ │ │ │ ├── BiCGSTAB_step_by_step.cpp │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── ColPivHouseholderQR_solve.cpp │ │ │ │ │ │ ├── ComplexEigenSolver_compute.cpp │ │ │ │ │ │ ├── ComplexEigenSolver_eigenvalues.cpp │ │ │ │ │ │ ├── ComplexEigenSolver_eigenvectors.cpp │ │ │ │ │ │ ├── ComplexSchur_compute.cpp │ │ │ │ │ │ ├── ComplexSchur_matrixT.cpp │ │ │ │ │ │ ├── ComplexSchur_matrixU.cpp │ │ │ │ │ │ ├── Cwise_abs.cpp │ │ │ │ │ │ ├── Cwise_abs2.cpp │ │ │ │ │ │ ├── Cwise_acos.cpp │ │ │ │ │ │ ├── Cwise_arg.cpp │ │ │ │ │ │ ├── Cwise_array_power_array.cpp │ │ │ │ │ │ ├── Cwise_asin.cpp │ │ │ │ │ │ ├── Cwise_atan.cpp │ │ │ │ │ │ ├── Cwise_boolean_and.cpp │ │ │ │ │ │ ├── Cwise_boolean_not.cpp │ │ │ │ │ │ ├── Cwise_boolean_or.cpp │ │ │ │ │ │ ├── Cwise_boolean_xor.cpp │ │ │ │ │ │ ├── Cwise_ceil.cpp │ │ │ │ │ │ ├── Cwise_cos.cpp │ │ │ │ │ │ ├── Cwise_cosh.cpp │ │ │ │ │ │ ├── Cwise_cube.cpp │ │ │ │ │ │ ├── Cwise_equal_equal.cpp │ │ │ │ │ │ ├── Cwise_exp.cpp │ │ │ │ │ │ ├── Cwise_floor.cpp │ │ │ │ │ │ ├── Cwise_greater.cpp │ │ │ │ │ │ ├── Cwise_greater_equal.cpp │ │ │ │ │ │ ├── Cwise_inverse.cpp │ │ │ │ │ │ ├── Cwise_isFinite.cpp │ │ │ │ │ │ ├── Cwise_isInf.cpp │ │ │ │ │ │ ├── Cwise_isNaN.cpp │ │ │ │ │ │ ├── Cwise_less.cpp │ │ │ │ │ │ ├── Cwise_less_equal.cpp │ │ │ │ │ │ ├── Cwise_log.cpp │ │ │ │ │ │ ├── Cwise_log10.cpp │ │ │ │ │ │ ├── Cwise_max.cpp │ │ │ │ │ │ ├── Cwise_min.cpp │ │ │ │ │ │ ├── Cwise_minus.cpp │ │ │ │ │ │ ├── Cwise_minus_equal.cpp │ │ │ │ │ │ ├── Cwise_not_equal.cpp │ │ │ │ │ │ ├── Cwise_plus.cpp │ │ │ │ │ │ ├── Cwise_plus_equal.cpp │ │ │ │ │ │ ├── Cwise_pow.cpp │ │ │ │ │ │ ├── Cwise_product.cpp │ │ │ │ │ │ ├── Cwise_quotient.cpp │ │ │ │ │ │ ├── Cwise_rint.cpp │ │ │ │ │ │ ├── Cwise_round.cpp │ │ │ │ │ │ ├── Cwise_scalar_power_array.cpp │ │ │ │ │ │ ├── Cwise_sign.cpp │ │ │ │ │ │ ├── Cwise_sin.cpp │ │ │ │ │ │ ├── Cwise_sinh.cpp │ │ │ │ │ │ ├── Cwise_slash_equal.cpp │ │ │ │ │ │ ├── Cwise_sqrt.cpp │ │ │ │ │ │ ├── Cwise_square.cpp │ │ │ │ │ │ ├── Cwise_tan.cpp │ │ │ │ │ │ ├── Cwise_tanh.cpp │ │ │ │ │ │ ├── Cwise_times_equal.cpp │ │ │ │ │ │ ├── DenseBase_LinSpaced.cpp │ │ │ │ │ │ ├── DenseBase_LinSpacedInt.cpp │ │ │ │ │ │ ├── DenseBase_LinSpaced_seq_deprecated.cpp │ │ │ │ │ │ ├── DenseBase_setLinSpaced.cpp │ │ │ │ │ │ ├── DirectionWise_hnormalized.cpp │ │ │ │ │ │ ├── DirectionWise_replicate.cpp │ │ │ │ │ │ ├── DirectionWise_replicate_int.cpp │ │ │ │ │ │ ├── EigenSolver_EigenSolver_MatrixType.cpp │ │ │ │ │ │ ├── EigenSolver_compute.cpp │ │ │ │ │ │ ├── EigenSolver_eigenvalues.cpp │ │ │ │ │ │ ├── EigenSolver_eigenvectors.cpp │ │ │ │ │ │ ├── EigenSolver_pseudoEigenvectors.cpp │ │ │ │ │ │ ├── FullPivHouseholderQR_solve.cpp │ │ │ │ │ │ ├── FullPivLU_image.cpp │ │ │ │ │ │ ├── FullPivLU_kernel.cpp │ │ │ │ │ │ ├── FullPivLU_solve.cpp │ │ │ │ │ │ ├── GeneralizedEigenSolver.cpp │ │ │ │ │ │ ├── HessenbergDecomposition_compute.cpp │ │ │ │ │ │ ├── HessenbergDecomposition_matrixH.cpp │ │ │ │ │ │ ├── HessenbergDecomposition_packedMatrix.cpp │ │ │ │ │ │ ├── HouseholderQR_householderQ.cpp │ │ │ │ │ │ ├── HouseholderQR_solve.cpp │ │ │ │ │ │ ├── HouseholderSequence_HouseholderSequence.cpp │ │ │ │ │ │ ├── IOFormat.cpp │ │ │ │ │ │ ├── JacobiSVD_basic.cpp │ │ │ │ │ │ ├── Jacobi_makeGivens.cpp │ │ │ │ │ │ ├── Jacobi_makeJacobi.cpp │ │ │ │ │ │ ├── LLT_example.cpp │ │ │ │ │ │ ├── LLT_solve.cpp │ │ │ │ │ │ ├── LeastSquaresNormalEquations.cpp │ │ │ │ │ │ ├── LeastSquaresQR.cpp │ │ │ │ │ │ ├── Map_general_stride.cpp │ │ │ │ │ │ ├── Map_inner_stride.cpp │ │ │ │ │ │ ├── Map_outer_stride.cpp │ │ │ │ │ │ ├── Map_placement_new.cpp │ │ │ │ │ │ ├── Map_simple.cpp │ │ │ │ │ │ ├── MatrixBase_adjoint.cpp │ │ │ │ │ │ ├── MatrixBase_all.cpp │ │ │ │ │ │ ├── MatrixBase_applyOnTheLeft.cpp │ │ │ │ │ │ ├── MatrixBase_applyOnTheRight.cpp │ │ │ │ │ │ ├── MatrixBase_array.cpp │ │ │ │ │ │ ├── MatrixBase_array_const.cpp │ │ │ │ │ │ ├── MatrixBase_asDiagonal.cpp │ │ │ │ │ │ ├── MatrixBase_block_int_int.cpp │ │ │ │ │ │ ├── MatrixBase_block_int_int_int_int.cpp │ │ │ │ │ │ ├── MatrixBase_bottomLeftCorner_int_int.cpp │ │ │ │ │ │ ├── MatrixBase_bottomRightCorner_int_int.cpp │ │ │ │ │ │ ├── MatrixBase_bottomRows_int.cpp │ │ │ │ │ │ ├── MatrixBase_cast.cpp │ │ │ │ │ │ ├── MatrixBase_col.cpp │ │ │ │ │ │ ├── MatrixBase_colwise.cpp │ │ │ │ │ │ ├── MatrixBase_colwise_iterator_cxx11.cpp │ │ │ │ │ │ ├── MatrixBase_computeInverseAndDetWithCheck.cpp │ │ │ │ │ │ ├── MatrixBase_computeInverseWithCheck.cpp │ │ │ │ │ │ ├── MatrixBase_cwiseAbs.cpp │ │ │ │ │ │ ├── MatrixBase_cwiseAbs2.cpp │ │ │ │ │ │ ├── MatrixBase_cwiseArg.cpp │ │ │ │ │ │ ├── MatrixBase_cwiseEqual.cpp │ │ │ │ │ │ ├── MatrixBase_cwiseInverse.cpp │ │ │ │ │ │ ├── MatrixBase_cwiseMax.cpp │ │ │ │ │ │ ├── MatrixBase_cwiseMin.cpp │ │ │ │ │ │ ├── MatrixBase_cwiseNotEqual.cpp │ │ │ │ │ │ ├── MatrixBase_cwiseProduct.cpp │ │ │ │ │ │ ├── MatrixBase_cwiseQuotient.cpp │ │ │ │ │ │ ├── MatrixBase_cwiseSign.cpp │ │ │ │ │ │ ├── MatrixBase_cwiseSqrt.cpp │ │ │ │ │ │ ├── MatrixBase_diagonal.cpp │ │ │ │ │ │ ├── MatrixBase_diagonal_int.cpp │ │ │ │ │ │ ├── MatrixBase_diagonal_template_int.cpp │ │ │ │ │ │ ├── MatrixBase_eigenvalues.cpp │ │ │ │ │ │ ├── MatrixBase_end_int.cpp │ │ │ │ │ │ ├── MatrixBase_eval.cpp │ │ │ │ │ │ ├── MatrixBase_fixedBlock_int_int.cpp │ │ │ │ │ │ ├── MatrixBase_hnormalized.cpp │ │ │ │ │ │ ├── MatrixBase_homogeneous.cpp │ │ │ │ │ │ ├── MatrixBase_identity.cpp │ │ │ │ │ │ ├── MatrixBase_identity_int_int.cpp │ │ │ │ │ │ ├── MatrixBase_inverse.cpp │ │ │ │ │ │ ├── MatrixBase_isDiagonal.cpp │ │ │ │ │ │ ├── MatrixBase_isIdentity.cpp │ │ │ │ │ │ ├── MatrixBase_isOnes.cpp │ │ │ │ │ │ ├── MatrixBase_isOrthogonal.cpp │ │ │ │ │ │ ├── MatrixBase_isUnitary.cpp │ │ │ │ │ │ ├── MatrixBase_isZero.cpp │ │ │ │ │ │ ├── MatrixBase_leftCols_int.cpp │ │ │ │ │ │ ├── MatrixBase_noalias.cpp │ │ │ │ │ │ ├── MatrixBase_ones.cpp │ │ │ │ │ │ ├── MatrixBase_ones_int.cpp │ │ │ │ │ │ ├── MatrixBase_ones_int_int.cpp │ │ │ │ │ │ ├── MatrixBase_operatorNorm.cpp │ │ │ │ │ │ ├── MatrixBase_prod.cpp │ │ │ │ │ │ ├── MatrixBase_random.cpp │ │ │ │ │ │ ├── MatrixBase_random_int.cpp │ │ │ │ │ │ ├── MatrixBase_random_int_int.cpp │ │ │ │ │ │ ├── MatrixBase_replicate.cpp │ │ │ │ │ │ ├── MatrixBase_replicate_int_int.cpp │ │ │ │ │ │ ├── MatrixBase_reshaped_auto.cpp │ │ │ │ │ │ ├── MatrixBase_reshaped_fixed.cpp │ │ │ │ │ │ ├── MatrixBase_reshaped_int_int.cpp │ │ │ │ │ │ ├── MatrixBase_reshaped_to_vector.cpp │ │ │ │ │ │ ├── MatrixBase_reverse.cpp │ │ │ │ │ │ ├── MatrixBase_rightCols_int.cpp │ │ │ │ │ │ ├── MatrixBase_row.cpp │ │ │ │ │ │ ├── MatrixBase_rowwise.cpp │ │ │ │ │ │ ├── MatrixBase_segment_int_int.cpp │ │ │ │ │ │ ├── MatrixBase_select.cpp │ │ │ │ │ │ ├── MatrixBase_selfadjointView.cpp │ │ │ │ │ │ ├── MatrixBase_set.cpp │ │ │ │ │ │ ├── MatrixBase_setIdentity.cpp │ │ │ │ │ │ ├── MatrixBase_setOnes.cpp │ │ │ │ │ │ ├── MatrixBase_setRandom.cpp │ │ │ │ │ │ ├── MatrixBase_setZero.cpp │ │ │ │ │ │ ├── MatrixBase_start_int.cpp │ │ │ │ │ │ ├── MatrixBase_template_int_bottomRows.cpp │ │ │ │ │ │ ├── MatrixBase_template_int_end.cpp │ │ │ │ │ │ ├── MatrixBase_template_int_int_block_int_int_int_int.cpp │ │ │ │ │ │ ├── MatrixBase_template_int_int_bottomLeftCorner.cpp │ │ │ │ │ │ ├── MatrixBase_template_int_int_bottomLeftCorner_int_int.cpp │ │ │ │ │ │ ├── MatrixBase_template_int_int_bottomRightCorner.cpp │ │ │ │ │ │ ├── MatrixBase_template_int_int_bottomRightCorner_int_int.cpp │ │ │ │ │ │ ├── MatrixBase_template_int_int_topLeftCorner.cpp │ │ │ │ │ │ ├── MatrixBase_template_int_int_topLeftCorner_int_int.cpp │ │ │ │ │ │ ├── MatrixBase_template_int_int_topRightCorner.cpp │ │ │ │ │ │ ├── MatrixBase_template_int_int_topRightCorner_int_int.cpp │ │ │ │ │ │ ├── MatrixBase_template_int_leftCols.cpp │ │ │ │ │ │ ├── MatrixBase_template_int_rightCols.cpp │ │ │ │ │ │ ├── MatrixBase_template_int_segment.cpp │ │ │ │ │ │ ├── MatrixBase_template_int_start.cpp │ │ │ │ │ │ ├── MatrixBase_template_int_topRows.cpp │ │ │ │ │ │ ├── MatrixBase_topLeftCorner_int_int.cpp │ │ │ │ │ │ ├── MatrixBase_topRightCorner_int_int.cpp │ │ │ │ │ │ ├── MatrixBase_topRows_int.cpp │ │ │ │ │ │ ├── MatrixBase_transpose.cpp │ │ │ │ │ │ ├── MatrixBase_triangularView.cpp │ │ │ │ │ │ ├── MatrixBase_zero.cpp │ │ │ │ │ │ ├── MatrixBase_zero_int.cpp │ │ │ │ │ │ ├── MatrixBase_zero_int_int.cpp │ │ │ │ │ │ ├── Matrix_Map_stride.cpp │ │ │ │ │ │ ├── Matrix_initializer_list_23_cxx11.cpp │ │ │ │ │ │ ├── Matrix_initializer_list_vector_cxx11.cpp │ │ │ │ │ │ ├── Matrix_resize_NoChange_int.cpp │ │ │ │ │ │ ├── Matrix_resize_int.cpp │ │ │ │ │ │ ├── Matrix_resize_int_NoChange.cpp │ │ │ │ │ │ ├── Matrix_resize_int_int.cpp │ │ │ │ │ │ ├── Matrix_setConstant_int.cpp │ │ │ │ │ │ ├── Matrix_setConstant_int_int.cpp │ │ │ │ │ │ ├── Matrix_setIdentity_int_int.cpp │ │ │ │ │ │ ├── Matrix_setOnes_int.cpp │ │ │ │ │ │ ├── Matrix_setOnes_int_int.cpp │ │ │ │ │ │ ├── Matrix_setRandom_int.cpp │ │ │ │ │ │ ├── Matrix_setRandom_int_int.cpp │ │ │ │ │ │ ├── Matrix_setZero_int.cpp │ │ │ │ │ │ ├── Matrix_setZero_int_int.cpp │ │ │ │ │ │ ├── Matrix_variadic_ctor_cxx11.cpp │ │ │ │ │ │ ├── PartialPivLU_solve.cpp │ │ │ │ │ │ ├── PartialRedux_count.cpp │ │ │ │ │ │ ├── PartialRedux_maxCoeff.cpp │ │ │ │ │ │ ├── PartialRedux_minCoeff.cpp │ │ │ │ │ │ ├── PartialRedux_norm.cpp │ │ │ │ │ │ ├── PartialRedux_prod.cpp │ │ │ │ │ │ ├── PartialRedux_squaredNorm.cpp │ │ │ │ │ │ ├── PartialRedux_sum.cpp │ │ │ │ │ │ ├── RealQZ_compute.cpp │ │ │ │ │ │ ├── RealSchur_RealSchur_MatrixType.cpp │ │ │ │ │ │ ├── RealSchur_compute.cpp │ │ │ │ │ │ ├── SelfAdjointEigenSolver_SelfAdjointEigenSolver.cpp │ │ │ │ │ │ ├── SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp │ │ │ │ │ │ ├── SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType2.cpp │ │ │ │ │ │ ├── SelfAdjointEigenSolver_compute_MatrixType.cpp │ │ │ │ │ │ ├── SelfAdjointEigenSolver_compute_MatrixType2.cpp │ │ │ │ │ │ ├── SelfAdjointEigenSolver_eigenvalues.cpp │ │ │ │ │ │ ├── SelfAdjointEigenSolver_eigenvectors.cpp │ │ │ │ │ │ ├── SelfAdjointEigenSolver_operatorInverseSqrt.cpp │ │ │ │ │ │ ├── SelfAdjointEigenSolver_operatorSqrt.cpp │ │ │ │ │ │ ├── SelfAdjointView_eigenvalues.cpp │ │ │ │ │ │ ├── SelfAdjointView_operatorNorm.cpp │ │ │ │ │ │ ├── Slicing_arrayexpr.cpp │ │ │ │ │ │ ├── Slicing_custom_padding_cxx11.cpp │ │ │ │ │ │ ├── Slicing_rawarray_cxx11.cpp │ │ │ │ │ │ ├── Slicing_stdvector_cxx11.cpp │ │ │ │ │ │ ├── SparseMatrix_coeffs.cpp │ │ │ │ │ │ ├── TopicAliasing_block.cpp │ │ │ │ │ │ ├── TopicAliasing_block_correct.cpp │ │ │ │ │ │ ├── TopicAliasing_cwise.cpp │ │ │ │ │ │ ├── TopicAliasing_mult1.cpp │ │ │ │ │ │ ├── TopicAliasing_mult2.cpp │ │ │ │ │ │ ├── TopicAliasing_mult3.cpp │ │ │ │ │ │ ├── TopicAliasing_mult4.cpp │ │ │ │ │ │ ├── TopicAliasing_mult5.cpp │ │ │ │ │ │ ├── TopicStorageOrders_example.cpp │ │ │ │ │ │ ├── Triangular_solve.cpp │ │ │ │ │ │ ├── Tridiagonalization_Tridiagonalization_MatrixType.cpp │ │ │ │ │ │ ├── Tridiagonalization_compute.cpp │ │ │ │ │ │ ├── Tridiagonalization_decomposeInPlace.cpp │ │ │ │ │ │ ├── Tridiagonalization_diagonal.cpp │ │ │ │ │ │ ├── Tridiagonalization_householderCoefficients.cpp │ │ │ │ │ │ ├── Tridiagonalization_packedMatrix.cpp │ │ │ │ │ │ ├── Tutorial_AdvancedInitialization_Block.cpp │ │ │ │ │ │ ├── Tutorial_AdvancedInitialization_CommaTemporary.cpp │ │ │ │ │ │ ├── Tutorial_AdvancedInitialization_Join.cpp │ │ │ │ │ │ ├── Tutorial_AdvancedInitialization_LinSpaced.cpp │ │ │ │ │ │ ├── Tutorial_AdvancedInitialization_ThreeWays.cpp │ │ │ │ │ │ ├── Tutorial_AdvancedInitialization_Zero.cpp │ │ │ │ │ │ ├── Tutorial_Map_rowmajor.cpp │ │ │ │ │ │ ├── Tutorial_Map_using.cpp │ │ │ │ │ │ ├── Tutorial_ReshapeMat2Mat.cpp │ │ │ │ │ │ ├── Tutorial_ReshapeMat2Vec.cpp │ │ │ │ │ │ ├── Tutorial_SlicingCol.cpp │ │ │ │ │ │ ├── Tutorial_SlicingVec.cpp │ │ │ │ │ │ ├── Tutorial_commainit_01.cpp │ │ │ │ │ │ ├── Tutorial_commainit_01b.cpp │ │ │ │ │ │ ├── Tutorial_commainit_02.cpp │ │ │ │ │ │ ├── Tutorial_range_for_loop_1d_cxx11.cpp │ │ │ │ │ │ ├── Tutorial_range_for_loop_2d_cxx11.cpp │ │ │ │ │ │ ├── Tutorial_reshaped_vs_resize_1.cpp │ │ │ │ │ │ ├── Tutorial_reshaped_vs_resize_2.cpp │ │ │ │ │ │ ├── Tutorial_solve_matrix_inverse.cpp │ │ │ │ │ │ ├── Tutorial_solve_multiple_rhs.cpp │ │ │ │ │ │ ├── Tutorial_solve_reuse_decomposition.cpp │ │ │ │ │ │ ├── Tutorial_solve_singular.cpp │ │ │ │ │ │ ├── Tutorial_solve_triangular.cpp │ │ │ │ │ │ ├── Tutorial_solve_triangular_inplace.cpp │ │ │ │ │ │ ├── Tutorial_std_sort.cpp │ │ │ │ │ │ ├── Tutorial_std_sort_rows_cxx11.cpp │ │ │ │ │ │ ├── VectorwiseOp_homogeneous.cpp │ │ │ │ │ │ ├── Vectorwise_reverse.cpp │ │ │ │ │ │ ├── class_FullPivLU.cpp │ │ │ │ │ │ ├── compile_snippet.cpp.in │ │ │ │ │ │ ├── tut_arithmetic_redux_minmax.cpp │ │ │ │ │ │ ├── tut_arithmetic_transpose_aliasing.cpp │ │ │ │ │ │ ├── tut_arithmetic_transpose_conjugate.cpp │ │ │ │ │ │ ├── tut_arithmetic_transpose_inplace.cpp │ │ │ │ │ │ └── tut_matrix_assignment_resizing.cpp │ │ │ │ │ ├── special_examples/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── Tutorial_sparse_example.cpp │ │ │ │ │ │ ├── Tutorial_sparse_example_details.cpp │ │ │ │ │ │ └── random_cpp11.cpp │ │ │ │ │ └── tutorial.cpp │ │ │ │ ├── eigen3.pc.in │ │ │ │ ├── failtest/ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── bdcsvd_int.cpp │ │ │ │ │ ├── block_nonconst_ctor_on_const_xpr_0.cpp │ │ │ │ │ ├── block_nonconst_ctor_on_const_xpr_1.cpp │ │ │ │ │ ├── block_nonconst_ctor_on_const_xpr_2.cpp │ │ │ │ │ ├── block_on_const_type_actually_const_0.cpp │ │ │ │ │ ├── block_on_const_type_actually_const_1.cpp │ │ │ │ │ ├── colpivqr_int.cpp │ │ │ │ │ ├── const_qualified_block_method_retval_0.cpp │ │ │ │ │ ├── const_qualified_block_method_retval_1.cpp │ │ │ │ │ ├── const_qualified_diagonal_method_retval.cpp │ │ │ │ │ ├── const_qualified_transpose_method_retval.cpp │ │ │ │ │ ├── cwiseunaryview_nonconst_ctor_on_const_xpr.cpp │ │ │ │ │ ├── cwiseunaryview_on_const_type_actually_const.cpp │ │ │ │ │ ├── diagonal_nonconst_ctor_on_const_xpr.cpp │ │ │ │ │ ├── diagonal_on_const_type_actually_const.cpp │ │ │ │ │ ├── eigensolver_cplx.cpp │ │ │ │ │ ├── eigensolver_int.cpp │ │ │ │ │ ├── failtest_sanity_check.cpp │ │ │ │ │ ├── fullpivlu_int.cpp │ │ │ │ │ ├── fullpivqr_int.cpp │ │ │ │ │ ├── initializer_list_1.cpp │ │ │ │ │ ├── initializer_list_2.cpp │ │ │ │ │ ├── jacobisvd_int.cpp │ │ │ │ │ ├── ldlt_int.cpp │ │ │ │ │ ├── llt_int.cpp │ │ │ │ │ ├── map_nonconst_ctor_on_const_ptr_0.cpp │ │ │ │ │ ├── map_nonconst_ctor_on_const_ptr_1.cpp │ │ │ │ │ ├── map_nonconst_ctor_on_const_ptr_2.cpp │ │ │ │ │ ├── map_nonconst_ctor_on_const_ptr_3.cpp │ │ │ │ │ ├── map_nonconst_ctor_on_const_ptr_4.cpp │ │ │ │ │ ├── map_on_const_type_actually_const_0.cpp │ │ │ │ │ ├── map_on_const_type_actually_const_1.cpp │ │ │ │ │ ├── partialpivlu_int.cpp │ │ │ │ │ ├── qr_int.cpp │ │ │ │ │ ├── ref_1.cpp │ │ │ │ │ ├── ref_2.cpp │ │ │ │ │ ├── ref_3.cpp │ │ │ │ │ ├── ref_4.cpp │ │ │ │ │ ├── ref_5.cpp │ │ │ │ │ ├── selfadjointview_nonconst_ctor_on_const_xpr.cpp │ │ │ │ │ ├── selfadjointview_on_const_type_actually_const.cpp │ │ │ │ │ ├── sparse_ref_1.cpp │ │ │ │ │ ├── sparse_ref_2.cpp │ │ │ │ │ ├── sparse_ref_3.cpp │ │ │ │ │ ├── sparse_ref_4.cpp │ │ │ │ │ ├── sparse_ref_5.cpp │ │ │ │ │ ├── sparse_storage_mismatch.cpp │ │ │ │ │ ├── swap_1.cpp │ │ │ │ │ ├── swap_2.cpp │ │ │ │ │ ├── ternary_1.cpp │ │ │ │ │ ├── ternary_2.cpp │ │ │ │ │ ├── transpose_nonconst_ctor_on_const_xpr.cpp │ │ │ │ │ ├── transpose_on_const_type_actually_const.cpp │ │ │ │ │ ├── triangularview_nonconst_ctor_on_const_xpr.cpp │ │ │ │ │ └── triangularview_on_const_type_actually_const.cpp │ │ │ │ ├── lapack/ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── cholesky.cpp │ │ │ │ │ ├── clacgv.f │ │ │ │ │ ├── cladiv.f │ │ │ │ │ ├── clarf.f │ │ │ │ │ ├── clarfb.f │ │ │ │ │ ├── clarfg.f │ │ │ │ │ ├── clarft.f │ │ │ │ │ ├── complex_double.cpp │ │ │ │ │ ├── complex_single.cpp │ │ │ │ │ ├── dladiv.f │ │ │ │ │ ├── dlamch.f │ │ │ │ │ ├── dlapy2.f │ │ │ │ │ ├── dlapy3.f │ │ │ │ │ ├── dlarf.f │ │ │ │ │ ├── dlarfb.f │ │ │ │ │ ├── dlarfg.f │ │ │ │ │ ├── dlarft.f │ │ │ │ │ ├── double.cpp │ │ │ │ │ ├── dsecnd_NONE.f │ │ │ │ │ ├── eigenvalues.cpp │ │ │ │ │ ├── ilaclc.f │ │ │ │ │ ├── ilaclr.f │ │ │ │ │ ├── iladlc.f │ │ │ │ │ ├── iladlr.f │ │ │ │ │ ├── ilaslc.f │ │ │ │ │ ├── ilaslr.f │ │ │ │ │ ├── ilazlc.f │ │ │ │ │ ├── ilazlr.f │ │ │ │ │ ├── lapack_common.h │ │ │ │ │ ├── lu.cpp │ │ │ │ │ ├── second_NONE.f │ │ │ │ │ ├── single.cpp │ │ │ │ │ ├── sladiv.f │ │ │ │ │ ├── slamch.f │ │ │ │ │ ├── slapy2.f │ │ │ │ │ ├── slapy3.f │ │ │ │ │ ├── slarf.f │ │ │ │ │ ├── slarfb.f │ │ │ │ │ ├── slarfg.f │ │ │ │ │ ├── slarft.f │ │ │ │ │ ├── svd.cpp │ │ │ │ │ ├── zlacgv.f │ │ │ │ │ ├── zladiv.f │ │ │ │ │ ├── zlarf.f │ │ │ │ │ ├── zlarfb.f │ │ │ │ │ ├── zlarfg.f │ │ │ │ │ └── zlarft.f │ │ │ │ ├── scripts/ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── cdashtesting.cmake.in │ │ │ │ │ ├── check.in │ │ │ │ │ ├── debug.in │ │ │ │ │ ├── eigen_gen_credits.cpp │ │ │ │ │ ├── eigen_gen_docs │ │ │ │ │ ├── eigen_gen_split_test_help.cmake │ │ │ │ │ ├── eigen_monitor_perf.sh │ │ │ │ │ ├── release.in │ │ │ │ │ └── relicense.py │ │ │ │ ├── signature_of_eigen3_matrix_library │ │ │ │ ├── test/ │ │ │ │ │ ├── AnnoyingScalar.h │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── MovableScalar.h │ │ │ │ │ ├── adjoint.cpp │ │ │ │ │ ├── array_cwise.cpp │ │ │ │ │ ├── array_for_matrix.cpp │ │ │ │ │ ├── array_of_string.cpp │ │ │ │ │ ├── array_replicate.cpp │ │ │ │ │ ├── array_reverse.cpp │ │ │ │ │ ├── bandmatrix.cpp │ │ │ │ │ ├── basicstuff.cpp │ │ │ │ │ ├── bdcsvd.cpp │ │ │ │ │ ├── bfloat16_float.cpp │ │ │ │ │ ├── bicgstab.cpp │ │ │ │ │ ├── blasutil.cpp │ │ │ │ │ ├── block.cpp │ │ │ │ │ ├── boostmultiprec.cpp │ │ │ │ │ ├── bug1213.cpp │ │ │ │ │ ├── bug1213.h │ │ │ │ │ ├── bug1213_main.cpp │ │ │ │ │ ├── cholesky.cpp │ │ │ │ │ ├── cholmod_support.cpp │ │ │ │ │ ├── commainitializer.cpp │ │ │ │ │ ├── conjugate_gradient.cpp │ │ │ │ │ ├── conservative_resize.cpp │ │ │ │ │ ├── constructor.cpp │ │ │ │ │ ├── corners.cpp │ │ │ │ │ ├── ctorleak.cpp │ │ │ │ │ ├── denseLM.cpp │ │ │ │ │ ├── dense_storage.cpp │ │ │ │ │ ├── determinant.cpp │ │ │ │ │ ├── diagonal.cpp │ │ │ │ │ ├── diagonal_matrix_variadic_ctor.cpp │ │ │ │ │ ├── diagonalmatrices.cpp │ │ │ │ │ ├── dontalign.cpp │ │ │ │ │ ├── dynalloc.cpp │ │ │ │ │ ├── eigen2support.cpp │ │ │ │ │ ├── eigensolver_complex.cpp │ │ │ │ │ ├── eigensolver_generalized_real.cpp │ │ │ │ │ ├── eigensolver_generic.cpp │ │ │ │ │ ├── eigensolver_selfadjoint.cpp │ │ │ │ │ ├── evaluator_common.h │ │ │ │ │ ├── evaluators.cpp │ │ │ │ │ ├── exceptions.cpp │ │ │ │ │ ├── fastmath.cpp │ │ │ │ │ ├── first_aligned.cpp │ │ │ │ │ ├── geo_alignedbox.cpp │ │ │ │ │ ├── geo_eulerangles.cpp │ │ │ │ │ ├── geo_homogeneous.cpp │ │ │ │ │ ├── geo_hyperplane.cpp │ │ │ │ │ ├── geo_orthomethods.cpp │ │ │ │ │ ├── geo_parametrizedline.cpp │ │ │ │ │ ├── geo_quaternion.cpp │ │ │ │ │ ├── geo_transformations.cpp │ │ │ │ │ ├── gpu_basic.cu │ │ │ │ │ ├── gpu_common.h │ │ │ │ │ ├── half_float.cpp │ │ │ │ │ ├── hessenberg.cpp │ │ │ │ │ ├── householder.cpp │ │ │ │ │ ├── incomplete_cholesky.cpp │ │ │ │ │ ├── indexed_view.cpp │ │ │ │ │ ├── initializer_list_construction.cpp │ │ │ │ │ ├── inplace_decomposition.cpp │ │ │ │ │ ├── integer_types.cpp │ │ │ │ │ ├── inverse.cpp │ │ │ │ │ ├── io.cpp │ │ │ │ │ ├── is_same_dense.cpp │ │ │ │ │ ├── jacobi.cpp │ │ │ │ │ ├── jacobisvd.cpp │ │ │ │ │ ├── klu_support.cpp │ │ │ │ │ ├── linearstructure.cpp │ │ │ │ │ ├── lscg.cpp │ │ │ │ │ ├── lu.cpp │ │ │ │ │ ├── main.h │ │ │ │ │ ├── mapped_matrix.cpp │ │ │ │ │ ├── mapstaticmethods.cpp │ │ │ │ │ ├── mapstride.cpp │ │ │ │ │ ├── meta.cpp │ │ │ │ │ ├── metis_support.cpp │ │ │ │ │ ├── miscmatrices.cpp │ │ │ │ │ ├── mixingtypes.cpp │ │ │ │ │ ├── mpl2only.cpp │ │ │ │ │ ├── nestbyvalue.cpp │ │ │ │ │ ├── nesting_ops.cpp │ │ │ │ │ ├── nomalloc.cpp │ │ │ │ │ ├── nullary.cpp │ │ │ │ │ ├── num_dimensions.cpp │ │ │ │ │ ├── numext.cpp │ │ │ │ │ ├── packetmath.cpp │ │ │ │ │ ├── packetmath_test_shared.h │ │ │ │ │ ├── pardiso_support.cpp │ │ │ │ │ ├── pastix_support.cpp │ │ │ │ │ ├── permutationmatrices.cpp │ │ │ │ │ ├── prec_inverse_4x4.cpp │ │ │ │ │ ├── product.h │ │ │ │ │ ├── product_extra.cpp │ │ │ │ │ ├── product_large.cpp │ │ │ │ │ ├── product_mmtr.cpp │ │ │ │ │ ├── product_notemporary.cpp │ │ │ │ │ ├── product_selfadjoint.cpp │ │ │ │ │ ├── product_small.cpp │ │ │ │ │ ├── product_symm.cpp │ │ │ │ │ ├── product_syrk.cpp │ │ │ │ │ ├── product_trmm.cpp │ │ │ │ │ ├── product_trmv.cpp │ │ │ │ │ ├── product_trsolve.cpp │ │ │ │ │ ├── qr.cpp │ │ │ │ │ ├── qr_colpivoting.cpp │ │ │ │ │ ├── qr_fullpivoting.cpp │ │ │ │ │ ├── qtvector.cpp │ │ │ │ │ ├── rand.cpp │ │ │ │ │ ├── random_without_cast_overflow.h │ │ │ │ │ ├── real_qz.cpp │ │ │ │ │ ├── redux.cpp │ │ │ │ │ ├── ref.cpp │ │ │ │ │ ├── reshape.cpp │ │ │ │ │ ├── resize.cpp │ │ │ │ │ ├── rvalue_types.cpp │ │ │ │ │ ├── schur_complex.cpp │ │ │ │ │ ├── schur_real.cpp │ │ │ │ │ ├── selfadjoint.cpp │ │ │ │ │ ├── simplicial_cholesky.cpp │ │ │ │ │ ├── sizeof.cpp │ │ │ │ │ ├── sizeoverflow.cpp │ │ │ │ │ ├── smallvectors.cpp │ │ │ │ │ ├── solverbase.h │ │ │ │ │ ├── sparse.h │ │ │ │ │ ├── sparseLM.cpp │ │ │ │ │ ├── sparse_basic.cpp │ │ │ │ │ ├── sparse_block.cpp │ │ │ │ │ ├── sparse_permutations.cpp │ │ │ │ │ ├── sparse_product.cpp │ │ │ │ │ ├── sparse_ref.cpp │ │ │ │ │ ├── sparse_solver.h │ │ │ │ │ ├── sparse_solvers.cpp │ │ │ │ │ ├── sparse_vector.cpp │ │ │ │ │ ├── sparselu.cpp │ │ │ │ │ ├── sparseqr.cpp │ │ │ │ │ ├── special_numbers.cpp │ │ │ │ │ ├── split_test_helper.h │ │ │ │ │ ├── spqr_support.cpp │ │ │ │ │ ├── stable_norm.cpp │ │ │ │ │ ├── stddeque.cpp │ │ │ │ │ ├── stddeque_overload.cpp │ │ │ │ │ ├── stdlist.cpp │ │ │ │ │ ├── stdlist_overload.cpp │ │ │ │ │ ├── stdvector.cpp │ │ │ │ │ ├── stdvector_overload.cpp │ │ │ │ │ ├── stl_iterators.cpp │ │ │ │ │ ├── superlu_support.cpp │ │ │ │ │ ├── svd_common.h │ │ │ │ │ ├── svd_fill.h │ │ │ │ │ ├── swap.cpp │ │ │ │ │ ├── symbolic_index.cpp │ │ │ │ │ ├── triangular.cpp │ │ │ │ │ ├── type_alias.cpp │ │ │ │ │ ├── umeyama.cpp │ │ │ │ │ ├── umfpack_support.cpp │ │ │ │ │ ├── unalignedassert.cpp │ │ │ │ │ ├── unalignedcount.cpp │ │ │ │ │ ├── upperbidiagonalization.cpp │ │ │ │ │ ├── vectorization_logic.cpp │ │ │ │ │ ├── vectorwiseop.cpp │ │ │ │ │ ├── visitor.cpp │ │ │ │ │ └── zerosized.cpp │ │ │ │ └── unsupported/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── Eigen/ │ │ │ │ │ ├── AdolcForward │ │ │ │ │ ├── AlignedVector3 │ │ │ │ │ ├── ArpackSupport │ │ │ │ │ ├── AutoDiff │ │ │ │ │ ├── BVH │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── CXX11/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── Tensor │ │ │ │ │ │ ├── TensorSymmetry │ │ │ │ │ │ ├── ThreadPool │ │ │ │ │ │ └── src/ │ │ │ │ │ │ ├── Tensor/ │ │ │ │ │ │ │ ├── README.md │ │ │ │ │ │ │ ├── Tensor.h │ │ │ │ │ │ │ ├── TensorArgMax.h │ │ │ │ │ │ │ ├── TensorAssign.h │ │ │ │ │ │ │ ├── TensorBase.h │ │ │ │ │ │ │ ├── TensorBlock.h │ │ │ │ │ │ │ ├── TensorBroadcasting.h │ │ │ │ │ │ │ ├── TensorChipping.h │ │ │ │ │ │ │ ├── TensorConcatenation.h │ │ │ │ │ │ │ ├── TensorContraction.h │ │ │ │ │ │ │ ├── TensorContractionBlocking.h │ │ │ │ │ │ │ ├── TensorContractionCuda.h │ │ │ │ │ │ │ ├── TensorContractionGpu.h │ │ │ │ │ │ │ ├── TensorContractionMapper.h │ │ │ │ │ │ │ ├── TensorContractionSycl.h │ │ │ │ │ │ │ ├── TensorContractionThreadPool.h │ │ │ │ │ │ │ ├── TensorConversion.h │ │ │ │ │ │ │ ├── TensorConvolution.h │ │ │ │ │ │ │ ├── TensorConvolutionSycl.h │ │ │ │ │ │ │ ├── TensorCostModel.h │ │ │ │ │ │ │ ├── TensorCustomOp.h │ │ │ │ │ │ │ ├── TensorDevice.h │ │ │ │ │ │ │ ├── TensorDeviceCuda.h │ │ │ │ │ │ │ ├── TensorDeviceDefault.h │ │ │ │ │ │ │ ├── TensorDeviceGpu.h │ │ │ │ │ │ │ ├── TensorDeviceSycl.h │ │ │ │ │ │ │ ├── TensorDeviceThreadPool.h │ │ │ │ │ │ │ ├── TensorDimensionList.h │ │ │ │ │ │ │ ├── TensorDimensions.h │ │ │ │ │ │ │ ├── TensorEvalTo.h │ │ │ │ │ │ │ ├── TensorEvaluator.h │ │ │ │ │ │ │ ├── TensorExecutor.h │ │ │ │ │ │ │ ├── TensorExpr.h │ │ │ │ │ │ │ ├── TensorFFT.h │ │ │ │ │ │ │ ├── TensorFixedSize.h │ │ │ │ │ │ │ ├── TensorForcedEval.h │ │ │ │ │ │ │ ├── TensorForwardDeclarations.h │ │ │ │ │ │ │ ├── TensorFunctors.h │ │ │ │ │ │ │ ├── TensorGenerator.h │ │ │ │ │ │ │ ├── TensorGlobalFunctions.h │ │ │ │ │ │ │ ├── TensorGpuHipCudaDefines.h │ │ │ │ │ │ │ ├── TensorGpuHipCudaUndefines.h │ │ │ │ │ │ │ ├── TensorIO.h │ │ │ │ │ │ │ ├── TensorImagePatch.h │ │ │ │ │ │ │ ├── TensorIndexList.h │ │ │ │ │ │ │ ├── TensorInflation.h │ │ │ │ │ │ │ ├── TensorInitializer.h │ │ │ │ │ │ │ ├── TensorIntDiv.h │ │ │ │ │ │ │ ├── TensorLayoutSwap.h │ │ │ │ │ │ │ ├── TensorMacros.h │ │ │ │ │ │ │ ├── TensorMap.h │ │ │ │ │ │ │ ├── TensorMeta.h │ │ │ │ │ │ │ ├── TensorMorphing.h │ │ │ │ │ │ │ ├── TensorPadding.h │ │ │ │ │ │ │ ├── TensorPatch.h │ │ │ │ │ │ │ ├── TensorRandom.h │ │ │ │ │ │ │ ├── TensorReduction.h │ │ │ │ │ │ │ ├── TensorReductionCuda.h │ │ │ │ │ │ │ ├── TensorReductionGpu.h │ │ │ │ │ │ │ ├── TensorReductionSycl.h │ │ │ │ │ │ │ ├── TensorRef.h │ │ │ │ │ │ │ ├── TensorReverse.h │ │ │ │ │ │ │ ├── TensorScan.h │ │ │ │ │ │ │ ├── TensorScanSycl.h │ │ │ │ │ │ │ ├── TensorShuffling.h │ │ │ │ │ │ │ ├── TensorStorage.h │ │ │ │ │ │ │ ├── TensorStriding.h │ │ │ │ │ │ │ ├── TensorTrace.h │ │ │ │ │ │ │ ├── TensorTraits.h │ │ │ │ │ │ │ ├── TensorUInt128.h │ │ │ │ │ │ │ └── TensorVolumePatch.h │ │ │ │ │ │ ├── TensorSymmetry/ │ │ │ │ │ │ │ ├── DynamicSymmetry.h │ │ │ │ │ │ │ ├── StaticSymmetry.h │ │ │ │ │ │ │ ├── Symmetry.h │ │ │ │ │ │ │ └── util/ │ │ │ │ │ │ │ └── TemplateGroupTheory.h │ │ │ │ │ │ ├── ThreadPool/ │ │ │ │ │ │ │ ├── Barrier.h │ │ │ │ │ │ │ ├── EventCount.h │ │ │ │ │ │ │ ├── NonBlockingThreadPool.h │ │ │ │ │ │ │ ├── RunQueue.h │ │ │ │ │ │ │ ├── ThreadCancel.h │ │ │ │ │ │ │ ├── ThreadEnvironment.h │ │ │ │ │ │ │ ├── ThreadLocal.h │ │ │ │ │ │ │ ├── ThreadPoolInterface.h │ │ │ │ │ │ │ └── ThreadYield.h │ │ │ │ │ │ └── util/ │ │ │ │ │ │ ├── CXX11Meta.h │ │ │ │ │ │ ├── CXX11Workarounds.h │ │ │ │ │ │ ├── EmulateArray.h │ │ │ │ │ │ └── MaxSizeVector.h │ │ │ │ │ ├── EulerAngles │ │ │ │ │ ├── FFT │ │ │ │ │ ├── IterativeSolvers │ │ │ │ │ ├── KroneckerProduct │ │ │ │ │ ├── LevenbergMarquardt │ │ │ │ │ ├── MPRealSupport │ │ │ │ │ ├── MatrixFunctions │ │ │ │ │ ├── MoreVectorization │ │ │ │ │ ├── NonLinearOptimization │ │ │ │ │ ├── NumericalDiff │ │ │ │ │ ├── OpenGLSupport │ │ │ │ │ ├── Polynomials │ │ │ │ │ ├── Skyline │ │ │ │ │ ├── SparseExtra │ │ │ │ │ ├── SpecialFunctions │ │ │ │ │ ├── Splines │ │ │ │ │ └── src/ │ │ │ │ │ ├── AutoDiff/ │ │ │ │ │ │ ├── AutoDiffJacobian.h │ │ │ │ │ │ ├── AutoDiffScalar.h │ │ │ │ │ │ └── AutoDiffVector.h │ │ │ │ │ ├── BVH/ │ │ │ │ │ │ ├── BVAlgorithms.h │ │ │ │ │ │ └── KdBVH.h │ │ │ │ │ ├── Eigenvalues/ │ │ │ │ │ │ └── ArpackSelfAdjointEigenSolver.h │ │ │ │ │ ├── EulerAngles/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── EulerAngles.h │ │ │ │ │ │ └── EulerSystem.h │ │ │ │ │ ├── FFT/ │ │ │ │ │ │ ├── ei_fftw_impl.h │ │ │ │ │ │ └── ei_kissfft_impl.h │ │ │ │ │ ├── IterativeSolvers/ │ │ │ │ │ │ ├── ConstrainedConjGrad.h │ │ │ │ │ │ ├── DGMRES.h │ │ │ │ │ │ ├── GMRES.h │ │ │ │ │ │ ├── IDRS.h │ │ │ │ │ │ ├── IncompleteLU.h │ │ │ │ │ │ ├── IterationController.h │ │ │ │ │ │ ├── MINRES.h │ │ │ │ │ │ └── Scaling.h │ │ │ │ │ ├── KroneckerProduct/ │ │ │ │ │ │ └── KroneckerTensorProduct.h │ │ │ │ │ ├── LevenbergMarquardt/ │ │ │ │ │ │ ├── CopyrightMINPACK.txt │ │ │ │ │ │ ├── LMcovar.h │ │ │ │ │ │ ├── LMonestep.h │ │ │ │ │ │ ├── LMpar.h │ │ │ │ │ │ ├── LMqrsolv.h │ │ │ │ │ │ └── LevenbergMarquardt.h │ │ │ │ │ ├── MatrixFunctions/ │ │ │ │ │ │ ├── MatrixExponential.h │ │ │ │ │ │ ├── MatrixFunction.h │ │ │ │ │ │ ├── MatrixLogarithm.h │ │ │ │ │ │ ├── MatrixPower.h │ │ │ │ │ │ ├── MatrixSquareRoot.h │ │ │ │ │ │ └── StemFunction.h │ │ │ │ │ ├── MoreVectorization/ │ │ │ │ │ │ └── MathFunctions.h │ │ │ │ │ ├── NonLinearOptimization/ │ │ │ │ │ │ ├── HybridNonLinearSolver.h │ │ │ │ │ │ ├── LevenbergMarquardt.h │ │ │ │ │ │ ├── chkder.h │ │ │ │ │ │ ├── covar.h │ │ │ │ │ │ ├── dogleg.h │ │ │ │ │ │ ├── fdjac1.h │ │ │ │ │ │ ├── lmpar.h │ │ │ │ │ │ ├── qrsolv.h │ │ │ │ │ │ ├── r1mpyq.h │ │ │ │ │ │ ├── r1updt.h │ │ │ │ │ │ └── rwupdt.h │ │ │ │ │ ├── NumericalDiff/ │ │ │ │ │ │ └── NumericalDiff.h │ │ │ │ │ ├── Polynomials/ │ │ │ │ │ │ ├── Companion.h │ │ │ │ │ │ ├── PolynomialSolver.h │ │ │ │ │ │ └── PolynomialUtils.h │ │ │ │ │ ├── Skyline/ │ │ │ │ │ │ ├── SkylineInplaceLU.h │ │ │ │ │ │ ├── SkylineMatrix.h │ │ │ │ │ │ ├── SkylineMatrixBase.h │ │ │ │ │ │ ├── SkylineProduct.h │ │ │ │ │ │ ├── SkylineStorage.h │ │ │ │ │ │ └── SkylineUtil.h │ │ │ │ │ ├── SparseExtra/ │ │ │ │ │ │ ├── BlockOfDynamicSparseMatrix.h │ │ │ │ │ │ ├── BlockSparseMatrix.h │ │ │ │ │ │ ├── DynamicSparseMatrix.h │ │ │ │ │ │ ├── MarketIO.h │ │ │ │ │ │ ├── MatrixMarketIterator.h │ │ │ │ │ │ └── RandomSetter.h │ │ │ │ │ ├── SpecialFunctions/ │ │ │ │ │ │ ├── BesselFunctionsArrayAPI.h │ │ │ │ │ │ ├── BesselFunctionsBFloat16.h │ │ │ │ │ │ ├── BesselFunctionsFunctors.h │ │ │ │ │ │ ├── BesselFunctionsHalf.h │ │ │ │ │ │ ├── BesselFunctionsImpl.h │ │ │ │ │ │ ├── BesselFunctionsPacketMath.h │ │ │ │ │ │ ├── HipVectorCompatibility.h │ │ │ │ │ │ ├── SpecialFunctionsArrayAPI.h │ │ │ │ │ │ ├── SpecialFunctionsBFloat16.h │ │ │ │ │ │ ├── SpecialFunctionsFunctors.h │ │ │ │ │ │ ├── SpecialFunctionsHalf.h │ │ │ │ │ │ ├── SpecialFunctionsImpl.h │ │ │ │ │ │ ├── SpecialFunctionsPacketMath.h │ │ │ │ │ │ └── arch/ │ │ │ │ │ │ ├── AVX/ │ │ │ │ │ │ │ ├── BesselFunctions.h │ │ │ │ │ │ │ └── SpecialFunctions.h │ │ │ │ │ │ ├── AVX512/ │ │ │ │ │ │ │ ├── BesselFunctions.h │ │ │ │ │ │ │ └── SpecialFunctions.h │ │ │ │ │ │ ├── GPU/ │ │ │ │ │ │ │ └── SpecialFunctions.h │ │ │ │ │ │ └── NEON/ │ │ │ │ │ │ ├── BesselFunctions.h │ │ │ │ │ │ └── SpecialFunctions.h │ │ │ │ │ └── Splines/ │ │ │ │ │ ├── Spline.h │ │ │ │ │ ├── SplineFitting.h │ │ │ │ │ └── SplineFwd.h │ │ │ │ ├── README.txt │ │ │ │ ├── bench/ │ │ │ │ │ └── bench_svd.cpp │ │ │ │ ├── doc/ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── Overview.dox │ │ │ │ │ ├── SYCL.dox │ │ │ │ │ ├── eigendoxy_layout.xml.in │ │ │ │ │ ├── examples/ │ │ │ │ │ │ ├── BVH_Example.cpp │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── EulerAngles.cpp │ │ │ │ │ │ ├── FFT.cpp │ │ │ │ │ │ ├── MatrixExponential.cpp │ │ │ │ │ │ ├── MatrixFunction.cpp │ │ │ │ │ │ ├── MatrixLogarithm.cpp │ │ │ │ │ │ ├── MatrixPower.cpp │ │ │ │ │ │ ├── MatrixPower_optimal.cpp │ │ │ │ │ │ ├── MatrixSine.cpp │ │ │ │ │ │ ├── MatrixSinh.cpp │ │ │ │ │ │ ├── MatrixSquareRoot.cpp │ │ │ │ │ │ ├── PolynomialSolver1.cpp │ │ │ │ │ │ ├── PolynomialUtils1.cpp │ │ │ │ │ │ └── SYCL/ │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ └── CwiseMul.cpp │ │ │ │ │ └── snippets/ │ │ │ │ │ └── CMakeLists.txt │ │ │ │ └── test/ │ │ │ │ ├── BVH.cpp │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── EulerAngles.cpp │ │ │ │ ├── FFT.cpp │ │ │ │ ├── FFTW.cpp │ │ │ │ ├── NonLinearOptimization.cpp │ │ │ │ ├── NumericalDiff.cpp │ │ │ │ ├── alignedvector3.cpp │ │ │ │ ├── autodiff.cpp │ │ │ │ ├── autodiff_scalar.cpp │ │ │ │ ├── bessel_functions.cpp │ │ │ │ ├── cxx11_eventcount.cpp │ │ │ │ ├── cxx11_maxsizevector.cpp │ │ │ │ ├── cxx11_meta.cpp │ │ │ │ ├── cxx11_non_blocking_thread_pool.cpp │ │ │ │ ├── cxx11_runqueue.cpp │ │ │ │ ├── cxx11_tensor_argmax.cpp │ │ │ │ ├── cxx11_tensor_argmax_gpu.cu │ │ │ │ ├── cxx11_tensor_argmax_sycl.cpp │ │ │ │ ├── cxx11_tensor_assign.cpp │ │ │ │ ├── cxx11_tensor_block_access.cpp │ │ │ │ ├── cxx11_tensor_block_eval.cpp │ │ │ │ ├── cxx11_tensor_block_io.cpp │ │ │ │ ├── cxx11_tensor_broadcast_sycl.cpp │ │ │ │ ├── cxx11_tensor_broadcasting.cpp │ │ │ │ ├── cxx11_tensor_builtins_sycl.cpp │ │ │ │ ├── cxx11_tensor_cast_float16_gpu.cu │ │ │ │ ├── cxx11_tensor_casts.cpp │ │ │ │ ├── cxx11_tensor_chipping.cpp │ │ │ │ ├── cxx11_tensor_chipping_sycl.cpp │ │ │ │ ├── cxx11_tensor_comparisons.cpp │ │ │ │ ├── cxx11_tensor_complex_cwise_ops_gpu.cu │ │ │ │ ├── cxx11_tensor_complex_gpu.cu │ │ │ │ ├── cxx11_tensor_concatenation.cpp │ │ │ │ ├── cxx11_tensor_concatenation_sycl.cpp │ │ │ │ ├── cxx11_tensor_const.cpp │ │ │ │ ├── cxx11_tensor_contract_gpu.cu │ │ │ │ ├── cxx11_tensor_contract_sycl.cpp │ │ │ │ ├── cxx11_tensor_contraction.cpp │ │ │ │ ├── cxx11_tensor_convolution.cpp │ │ │ │ ├── cxx11_tensor_convolution_sycl.cpp │ │ │ │ ├── cxx11_tensor_custom_index.cpp │ │ │ │ ├── cxx11_tensor_custom_op.cpp │ │ │ │ ├── cxx11_tensor_custom_op_sycl.cpp │ │ │ │ ├── cxx11_tensor_device.cu │ │ │ │ ├── cxx11_tensor_device_sycl.cpp │ │ │ │ ├── cxx11_tensor_dimension.cpp │ │ │ │ ├── cxx11_tensor_empty.cpp │ │ │ │ ├── cxx11_tensor_executor.cpp │ │ │ │ ├── cxx11_tensor_expr.cpp │ │ │ │ ├── cxx11_tensor_fft.cpp │ │ │ │ ├── cxx11_tensor_fixed_size.cpp │ │ │ │ ├── cxx11_tensor_forced_eval.cpp │ │ │ │ ├── cxx11_tensor_forced_eval_sycl.cpp │ │ │ │ ├── cxx11_tensor_generator.cpp │ │ │ │ ├── cxx11_tensor_generator_sycl.cpp │ │ │ │ ├── cxx11_tensor_gpu.cu │ │ │ │ ├── cxx11_tensor_ifft.cpp │ │ │ │ ├── cxx11_tensor_image_op_sycl.cpp │ │ │ │ ├── cxx11_tensor_image_patch.cpp │ │ │ │ ├── cxx11_tensor_image_patch_sycl.cpp │ │ │ │ ├── cxx11_tensor_index_list.cpp │ │ │ │ ├── cxx11_tensor_inflation.cpp │ │ │ │ ├── cxx11_tensor_inflation_sycl.cpp │ │ │ │ ├── cxx11_tensor_intdiv.cpp │ │ │ │ ├── cxx11_tensor_io.cpp │ │ │ │ ├── cxx11_tensor_layout_swap.cpp │ │ │ │ ├── cxx11_tensor_layout_swap_sycl.cpp │ │ │ │ ├── cxx11_tensor_lvalue.cpp │ │ │ │ ├── cxx11_tensor_map.cpp │ │ │ │ ├── cxx11_tensor_math.cpp │ │ │ │ ├── cxx11_tensor_math_sycl.cpp │ │ │ │ ├── cxx11_tensor_mixed_indices.cpp │ │ │ │ ├── cxx11_tensor_morphing.cpp │ │ │ │ ├── cxx11_tensor_morphing_sycl.cpp │ │ │ │ ├── cxx11_tensor_move.cpp │ │ │ │ ├── cxx11_tensor_notification.cpp │ │ │ │ ├── cxx11_tensor_of_complex.cpp │ │ │ │ ├── cxx11_tensor_of_const_values.cpp │ │ │ │ ├── cxx11_tensor_of_float16_gpu.cu │ │ │ │ ├── cxx11_tensor_of_strings.cpp │ │ │ │ ├── cxx11_tensor_padding.cpp │ │ │ │ ├── cxx11_tensor_padding_sycl.cpp │ │ │ │ ├── cxx11_tensor_patch.cpp │ │ │ │ ├── cxx11_tensor_patch_sycl.cpp │ │ │ │ ├── cxx11_tensor_random.cpp │ │ │ │ ├── cxx11_tensor_random_gpu.cu │ │ │ │ ├── cxx11_tensor_random_sycl.cpp │ │ │ │ ├── cxx11_tensor_reduction.cpp │ │ │ │ ├── cxx11_tensor_reduction_gpu.cu │ │ │ │ ├── cxx11_tensor_reduction_sycl.cpp │ │ │ │ ├── cxx11_tensor_ref.cpp │ │ │ │ ├── cxx11_tensor_reverse.cpp │ │ │ │ ├── cxx11_tensor_reverse_sycl.cpp │ │ │ │ ├── cxx11_tensor_roundings.cpp │ │ │ │ ├── cxx11_tensor_scan.cpp │ │ │ │ ├── cxx11_tensor_scan_gpu.cu │ │ │ │ ├── cxx11_tensor_scan_sycl.cpp │ │ │ │ ├── cxx11_tensor_shuffling.cpp │ │ │ │ ├── cxx11_tensor_shuffling_sycl.cpp │ │ │ │ ├── cxx11_tensor_simple.cpp │ │ │ │ ├── cxx11_tensor_striding.cpp │ │ │ │ ├── cxx11_tensor_striding_sycl.cpp │ │ │ │ ├── cxx11_tensor_sugar.cpp │ │ │ │ ├── cxx11_tensor_sycl.cpp │ │ │ │ ├── cxx11_tensor_symmetry.cpp │ │ │ │ ├── cxx11_tensor_thread_local.cpp │ │ │ │ ├── cxx11_tensor_thread_pool.cpp │ │ │ │ ├── cxx11_tensor_trace.cpp │ │ │ │ ├── cxx11_tensor_uint128.cpp │ │ │ │ ├── cxx11_tensor_volume_patch.cpp │ │ │ │ ├── cxx11_tensor_volume_patch_sycl.cpp │ │ │ │ ├── dgmres.cpp │ │ │ │ ├── forward_adolc.cpp │ │ │ │ ├── gmres.cpp │ │ │ │ ├── idrs.cpp │ │ │ │ ├── kronecker_product.cpp │ │ │ │ ├── levenberg_marquardt.cpp │ │ │ │ ├── matrix_exponential.cpp │ │ │ │ ├── matrix_function.cpp │ │ │ │ ├── matrix_functions.h │ │ │ │ ├── matrix_power.cpp │ │ │ │ ├── matrix_square_root.cpp │ │ │ │ ├── minres.cpp │ │ │ │ ├── mpreal/ │ │ │ │ │ └── mpreal.h │ │ │ │ ├── mpreal_support.cpp │ │ │ │ ├── openglsupport.cpp │ │ │ │ ├── polynomialsolver.cpp │ │ │ │ ├── polynomialutils.cpp │ │ │ │ ├── sparse_extra.cpp │ │ │ │ ├── special_functions.cpp │ │ │ │ ├── special_packetmath.cpp │ │ │ │ └── splines.cpp │ │ │ ├── examples/ │ │ │ │ ├── __init__.py │ │ │ │ ├── core/ │ │ │ │ │ ├── data_readers/ │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ ├── augmentation.py │ │ │ │ │ │ ├── base.py │ │ │ │ │ │ ├── eth3d.py │ │ │ │ │ │ ├── factory.py │ │ │ │ │ │ ├── nyu2.py │ │ │ │ │ │ ├── rgbd_utils.py │ │ │ │ │ │ ├── scannet.py │ │ │ │ │ │ ├── stream.py │ │ │ │ │ │ ├── tartan.py │ │ │ │ │ │ └── tum.py │ │ │ │ │ ├── geom/ │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ ├── ba.py │ │ │ │ │ │ ├── chol.py │ │ │ │ │ │ ├── graph_utils.py │ │ │ │ │ │ ├── losses.py │ │ │ │ │ │ ├── projective_ops.py │ │ │ │ │ │ └── sampler_utils.py │ │ │ │ │ ├── logger.py │ │ │ │ │ └── networks/ │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── modules/ │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ ├── clipping.py │ │ │ │ │ │ ├── corr.py │ │ │ │ │ │ ├── extractor.py │ │ │ │ │ │ ├── gru.py │ │ │ │ │ │ └── unet.py │ │ │ │ │ ├── rslam.py │ │ │ │ │ ├── sim3_net.py │ │ │ │ │ └── slam_system.py │ │ │ │ ├── pgo/ │ │ │ │ │ ├── main.py │ │ │ │ │ └── readme.md │ │ │ │ ├── readme.md │ │ │ │ ├── registration/ │ │ │ │ │ ├── assets/ │ │ │ │ │ │ ├── depth1.npy │ │ │ │ │ │ ├── depth2.npy │ │ │ │ │ │ ├── depth3.npy │ │ │ │ │ │ ├── depth4.npy │ │ │ │ │ │ ├── renderoption.json │ │ │ │ │ │ └── tartan_test.txt │ │ │ │ │ ├── demo.py │ │ │ │ │ ├── main.py │ │ │ │ │ ├── readme.md │ │ │ │ │ └── viz.py │ │ │ │ └── rgbdslam/ │ │ │ │ ├── assets/ │ │ │ │ │ └── renderoption.json │ │ │ │ ├── demo.py │ │ │ │ ├── evaluate.py │ │ │ │ ├── readme.md │ │ │ │ ├── reprojection_test.py │ │ │ │ ├── rgbd_benchmark/ │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── associate.py │ │ │ │ │ ├── evaluate_ate.py │ │ │ │ │ └── evaluate_rpe.py │ │ │ │ ├── train.py │ │ │ │ └── viz.py │ │ │ ├── lietorch/ │ │ │ │ ├── __init__.py │ │ │ │ ├── broadcasting.py │ │ │ │ ├── extras/ │ │ │ │ │ ├── altcorr_kernel.cu │ │ │ │ │ ├── corr_index_kernel.cu │ │ │ │ │ ├── extras.cpp │ │ │ │ │ ├── se3_builder.cu │ │ │ │ │ ├── se3_inplace_builder.cu │ │ │ │ │ └── se3_solver.cu │ │ │ │ ├── gradcheck.py │ │ │ │ ├── group_ops.py │ │ │ │ ├── groups.py │ │ │ │ ├── include/ │ │ │ │ │ ├── common.h │ │ │ │ │ ├── dispatch.h │ │ │ │ │ ├── lietorch_cpu.h │ │ │ │ │ ├── lietorch_gpu.h │ │ │ │ │ ├── rxso3.h │ │ │ │ │ ├── se3.h │ │ │ │ │ ├── sim3.h │ │ │ │ │ └── so3.h │ │ │ │ ├── run_tests.py │ │ │ │ └── src/ │ │ │ │ ├── lietorch.cpp │ │ │ │ ├── lietorch_cpu.cpp │ │ │ │ └── lietorch_gpu.cu │ │ │ ├── run_tests.sh │ │ │ └── setup.py │ │ └── tartanair_tools/ │ │ ├── LICENSE │ │ ├── README.md │ │ ├── TartanAir_Sample.ipynb │ │ ├── data_type.md │ │ ├── download_cvpr_slam_test.txt │ │ ├── download_training.py │ │ ├── download_training_zipfiles.txt │ │ ├── evaluation/ │ │ │ ├── __init__.py │ │ │ ├── evaluate_ate_scale.py │ │ │ ├── evaluate_kitti.py │ │ │ ├── evaluate_rpe.py │ │ │ ├── evaluator_base.py │ │ │ ├── pose_est.txt │ │ │ ├── pose_gt.txt │ │ │ ├── tartanair_evaluator.py │ │ │ ├── trajectory_transform.py │ │ │ └── transformation.py │ │ └── seg_rgbs.txt │ ├── tools/ │ │ ├── generate_demo.py │ │ ├── vis.py │ │ ├── vis_2.py │ │ └── vis_ori.py │ └── train.py ├── VPS_Module/ │ ├── .circleci/ │ │ └── config.yml │ ├── .clang-format │ ├── .flake8 │ ├── README.md │ ├── configs/ │ │ ├── Base-RCNN-C4.yaml │ │ ├── Base-RCNN-DilatedC5.yaml │ │ ├── Base-RCNN-FPN.yaml │ │ ├── Base-RetinaNet.yaml │ │ ├── COCO-Detection/ │ │ │ ├── fast_rcnn_R_50_FPN_1x.yaml │ │ │ ├── faster_rcnn_R_101_C4_3x.yaml │ │ │ ├── faster_rcnn_R_101_DC5_3x.yaml │ │ │ ├── faster_rcnn_R_101_FPN_3x.yaml │ │ │ ├── faster_rcnn_R_50_C4_1x.yaml │ │ │ ├── faster_rcnn_R_50_C4_3x.yaml │ │ │ ├── faster_rcnn_R_50_DC5_1x.yaml │ │ │ ├── faster_rcnn_R_50_DC5_3x.yaml │ │ │ ├── faster_rcnn_R_50_FPN_1x.yaml │ │ │ ├── faster_rcnn_R_50_FPN_3x.yaml │ │ │ ├── faster_rcnn_X_101_32x8d_FPN_3x.yaml │ │ │ ├── fcos_R_50_FPN_1x.py │ │ │ ├── retinanet_R_101_FPN_3x.yaml │ │ │ ├── retinanet_R_50_FPN_1x.py │ │ │ ├── retinanet_R_50_FPN_1x.yaml │ │ │ ├── retinanet_R_50_FPN_3x.yaml │ │ │ ├── rpn_R_50_C4_1x.yaml │ │ │ └── rpn_R_50_FPN_1x.yaml │ │ ├── COCO-InstanceSegmentation/ │ │ │ ├── mask_rcnn_R_101_C4_3x.yaml │ │ │ ├── mask_rcnn_R_101_DC5_3x.yaml │ │ │ ├── mask_rcnn_R_101_FPN_3x.yaml │ │ │ ├── mask_rcnn_R_50_C4_1x.py │ │ │ ├── mask_rcnn_R_50_C4_1x.yaml │ │ │ ├── mask_rcnn_R_50_C4_3x.yaml │ │ │ ├── mask_rcnn_R_50_DC5_1x.yaml │ │ │ ├── mask_rcnn_R_50_DC5_3x.yaml │ │ │ ├── mask_rcnn_R_50_FPN_1x.py │ │ │ ├── mask_rcnn_R_50_FPN_1x.yaml │ │ │ ├── mask_rcnn_R_50_FPN_1x_giou.yaml │ │ │ ├── mask_rcnn_R_50_FPN_3x.yaml │ │ │ ├── mask_rcnn_X_101_32x8d_FPN_3x.yaml │ │ │ ├── mask_rcnn_regnetx_4gf_dds_fpn_1x.py │ │ │ └── mask_rcnn_regnety_4gf_dds_fpn_1x.py │ │ ├── COCO-Keypoints/ │ │ │ ├── Base-Keypoint-RCNN-FPN.yaml │ │ │ ├── keypoint_rcnn_R_101_FPN_3x.yaml │ │ │ ├── keypoint_rcnn_R_50_FPN_1x.py │ │ │ ├── keypoint_rcnn_R_50_FPN_1x.yaml │ │ │ ├── keypoint_rcnn_R_50_FPN_3x.yaml │ │ │ └── keypoint_rcnn_X_101_32x8d_FPN_3x.yaml │ │ ├── COCO-PanopticSegmentation/ │ │ │ ├── Base-Panoptic-FPN.yaml │ │ │ ├── panoptic_fpn_R_101_3x.yaml │ │ │ ├── panoptic_fpn_R_50_1x.py │ │ │ ├── panoptic_fpn_R_50_1x.yaml │ │ │ ├── panoptic_fpn_R_50_3x.yaml │ │ │ ├── panoptic_fpn_R_50_3x_vkitti_511.yaml │ │ │ ├── panoptic_fpn_R_50_3x_vkitti_init_clone.yaml │ │ │ └── panoptic_fpn_R_50_3x_vkitti_init_test.yaml │ │ ├── Cityscapes/ │ │ │ └── mask_rcnn_R_50_FPN.yaml │ │ ├── Detectron1-Comparisons/ │ │ │ ├── README.md │ │ │ ├── faster_rcnn_R_50_FPN_noaug_1x.yaml │ │ │ ├── keypoint_rcnn_R_50_FPN_1x.yaml │ │ │ └── mask_rcnn_R_50_FPN_noaug_1x.yaml │ │ ├── LVISv0.5-InstanceSegmentation/ │ │ │ ├── mask_rcnn_R_101_FPN_1x.yaml │ │ │ ├── mask_rcnn_R_50_FPN_1x.yaml │ │ │ └── mask_rcnn_X_101_32x8d_FPN_1x.yaml │ │ ├── LVISv1-InstanceSegmentation/ │ │ │ ├── mask_rcnn_R_101_FPN_1x.yaml │ │ │ ├── mask_rcnn_R_50_FPN_1x.yaml │ │ │ └── mask_rcnn_X_101_32x8d_FPN_1x.yaml │ │ ├── Misc/ │ │ │ ├── cascade_mask_rcnn_R_50_FPN_1x.yaml │ │ │ ├── cascade_mask_rcnn_R_50_FPN_3x.yaml │ │ │ ├── cascade_mask_rcnn_X_152_32x8d_FPN_IN5k_gn_dconv.yaml │ │ │ ├── mask_rcnn_R_50_FPN_1x_cls_agnostic.yaml │ │ │ ├── mask_rcnn_R_50_FPN_1x_dconv_c3-c5.yaml │ │ │ ├── mask_rcnn_R_50_FPN_3x_dconv_c3-c5.yaml │ │ │ ├── mask_rcnn_R_50_FPN_3x_gn.yaml │ │ │ ├── mask_rcnn_R_50_FPN_3x_syncbn.yaml │ │ │ ├── mmdet_mask_rcnn_R_50_FPN_1x.py │ │ │ ├── panoptic_fpn_R_101_dconv_cascade_gn_3x.yaml │ │ │ ├── scratch_mask_rcnn_R_50_FPN_3x_gn.yaml │ │ │ ├── scratch_mask_rcnn_R_50_FPN_9x_gn.yaml │ │ │ ├── scratch_mask_rcnn_R_50_FPN_9x_syncbn.yaml │ │ │ ├── semantic_R_50_FPN_1x.yaml │ │ │ └── torchvision_imagenet_R_50.py │ │ ├── PascalVOC-Detection/ │ │ │ ├── faster_rcnn_R_50_C4.yaml │ │ │ └── faster_rcnn_R_50_FPN.yaml │ │ ├── common/ │ │ │ ├── README.md │ │ │ ├── coco_schedule.py │ │ │ ├── models/ │ │ │ │ ├── cascade_rcnn.py │ │ │ │ ├── fcos.py │ │ │ │ ├── keypoint_rcnn_fpn.py │ │ │ │ ├── mask_rcnn_c4.py │ │ │ │ ├── mask_rcnn_fpn.py │ │ │ │ ├── panoptic_fpn.py │ │ │ │ └── retinanet.py │ │ │ ├── optim.py │ │ │ └── train.py │ │ ├── new_baselines/ │ │ │ ├── mask_rcnn_R_101_FPN_100ep_LSJ.py │ │ │ ├── mask_rcnn_R_101_FPN_200ep_LSJ.py │ │ │ ├── mask_rcnn_R_101_FPN_400ep_LSJ.py │ │ │ ├── mask_rcnn_R_50_FPN_100ep_LSJ.py │ │ │ ├── mask_rcnn_R_50_FPN_200ep_LSJ.py │ │ │ ├── mask_rcnn_R_50_FPN_400ep_LSJ.py │ │ │ ├── mask_rcnn_R_50_FPN_50ep_LSJ.py │ │ │ ├── mask_rcnn_regnetx_4gf_dds_FPN_100ep_LSJ.py │ │ │ ├── mask_rcnn_regnetx_4gf_dds_FPN_200ep_LSJ.py │ │ │ ├── mask_rcnn_regnetx_4gf_dds_FPN_400ep_LSJ.py │ │ │ ├── mask_rcnn_regnety_4gf_dds_FPN_100ep_LSJ.py │ │ │ ├── mask_rcnn_regnety_4gf_dds_FPN_200ep_LSJ.py │ │ │ └── mask_rcnn_regnety_4gf_dds_FPN_400ep_LSJ.py │ │ └── quick_schedules/ │ │ ├── README.md │ │ ├── cascade_mask_rcnn_R_50_FPN_inference_acc_test.yaml │ │ ├── cascade_mask_rcnn_R_50_FPN_instant_test.yaml │ │ ├── fast_rcnn_R_50_FPN_inference_acc_test.yaml │ │ ├── fast_rcnn_R_50_FPN_instant_test.yaml │ │ ├── keypoint_rcnn_R_50_FPN_inference_acc_test.yaml │ │ ├── keypoint_rcnn_R_50_FPN_instant_test.yaml │ │ ├── keypoint_rcnn_R_50_FPN_normalized_training_acc_test.yaml │ │ ├── keypoint_rcnn_R_50_FPN_training_acc_test.yaml │ │ ├── mask_rcnn_R_50_C4_GCV_instant_test.yaml │ │ ├── mask_rcnn_R_50_C4_inference_acc_test.yaml │ │ ├── mask_rcnn_R_50_C4_instant_test.yaml │ │ ├── mask_rcnn_R_50_C4_training_acc_test.yaml │ │ ├── mask_rcnn_R_50_DC5_inference_acc_test.yaml │ │ ├── mask_rcnn_R_50_FPN_inference_acc_test.yaml │ │ ├── mask_rcnn_R_50_FPN_instant_test.yaml │ │ ├── mask_rcnn_R_50_FPN_pred_boxes_training_acc_test.yaml │ │ ├── mask_rcnn_R_50_FPN_training_acc_test.yaml │ │ ├── panoptic_fpn_R_50_inference_acc_test.yaml │ │ ├── panoptic_fpn_R_50_instant_test.yaml │ │ ├── panoptic_fpn_R_50_training_acc_test.yaml │ │ ├── retinanet_R_50_FPN_inference_acc_test.yaml │ │ ├── retinanet_R_50_FPN_instant_test.yaml │ │ ├── rpn_R_50_FPN_inference_acc_test.yaml │ │ ├── rpn_R_50_FPN_instant_test.yaml │ │ ├── semantic_R_50_FPN_inference_acc_test.yaml │ │ ├── semantic_R_50_FPN_instant_test.yaml │ │ └── semantic_R_50_FPN_training_acc_test.yaml │ ├── demo/ │ │ ├── README.md │ │ ├── demo.py │ │ └── predictor.py │ ├── detectron2/ │ │ ├── __init__.py │ │ ├── aot_modules/ │ │ │ ├── __init__.py │ │ │ ├── aot_config.py │ │ │ ├── decoders/ │ │ │ │ ├── __init__.py │ │ │ │ └── fpn.py │ │ │ ├── encoders/ │ │ │ │ ├── __init__.py │ │ │ │ ├── mobilenetv2.py │ │ │ │ ├── mobilenetv3.py │ │ │ │ ├── resnest/ │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── resnest.py │ │ │ │ │ ├── resnet.py │ │ │ │ │ └── splat.py │ │ │ │ ├── resnet.py │ │ │ │ └── swin/ │ │ │ │ ├── __init__.py │ │ │ │ ├── build.py │ │ │ │ └── swin_transformer.py │ │ │ ├── engines/ │ │ │ │ ├── __init__.py │ │ │ │ └── aot_engine.py │ │ │ ├── layers/ │ │ │ │ ├── __init__.py │ │ │ │ ├── attention.py │ │ │ │ ├── basic.py │ │ │ │ ├── loss.py │ │ │ │ ├── normalization.py │ │ │ │ ├── position.py │ │ │ │ └── transformer.py │ │ │ ├── models/ │ │ │ │ ├── __init__.py │ │ │ │ └── aot.py │ │ │ └── utils/ │ │ │ ├── __init__.py │ │ │ ├── checkpoint.py │ │ │ ├── ema.py │ │ │ ├── eval.py │ │ │ ├── image.py │ │ │ ├── learning.py │ │ │ ├── math.py │ │ │ ├── meters.py │ │ │ └── metric.py │ │ ├── checkpoint/ │ │ │ ├── __init__.py │ │ │ ├── c2_model_loading.py │ │ │ ├── catalog.py │ │ │ └── detection_checkpoint.py │ │ ├── config/ │ │ │ ├── __init__.py │ │ │ ├── compat.py │ │ │ ├── config.py │ │ │ ├── defaults.py │ │ │ ├── instantiate.py │ │ │ └── lazy.py │ │ ├── engine/ │ │ │ ├── __init__.py │ │ │ ├── defaults.py │ │ │ ├── hooks.py │ │ │ ├── launch.py │ │ │ └── train_loop.py │ │ ├── evaluation/ │ │ │ ├── __init__.py │ │ │ ├── cityscapes_evaluation.py │ │ │ ├── coco_evaluation.py │ │ │ ├── evaluator.py │ │ │ ├── fast_eval_api.py │ │ │ ├── lvis_evaluation.py │ │ │ ├── panoptic_evaluation.py │ │ │ ├── pascal_voc_evaluation.py │ │ │ ├── pq_compute.py │ │ │ ├── rotated_coco_evaluation.py │ │ │ ├── sem_seg_evaluation.py │ │ │ └── testing.py │ │ ├── export/ │ │ │ ├── README.md │ │ │ ├── __init__.py │ │ │ ├── api.py │ │ │ ├── c10.py │ │ │ ├── caffe2_export.py │ │ │ ├── caffe2_inference.py │ │ │ ├── caffe2_modeling.py │ │ │ ├── caffe2_patch.py │ │ │ ├── flatten.py │ │ │ ├── shared.py │ │ │ ├── torchscript.py │ │ │ └── torchscript_patch.py │ │ ├── layers/ │ │ │ ├── __init__.py │ │ │ ├── aspp.py │ │ │ ├── batch_norm.py │ │ │ ├── blocks.py │ │ │ ├── csrc/ │ │ │ │ ├── README.md │ │ │ │ ├── ROIAlignRotated/ │ │ │ │ │ ├── ROIAlignRotated.h │ │ │ │ │ ├── ROIAlignRotated_cpu.cpp │ │ │ │ │ └── ROIAlignRotated_cuda.cu │ │ │ │ ├── box_iou_rotated/ │ │ │ │ │ ├── box_iou_rotated.h │ │ │ │ │ ├── box_iou_rotated_cpu.cpp │ │ │ │ │ ├── box_iou_rotated_cuda.cu │ │ │ │ │ └── box_iou_rotated_utils.h │ │ │ │ ├── cocoeval/ │ │ │ │ │ ├── cocoeval.cpp │ │ │ │ │ └── cocoeval.h │ │ │ │ ├── cuda_version.cu │ │ │ │ ├── deformable/ │ │ │ │ │ ├── deform_conv.h │ │ │ │ │ ├── deform_conv_cuda.cu │ │ │ │ │ └── deform_conv_cuda_kernel.cu │ │ │ │ ├── nms_rotated/ │ │ │ │ │ ├── nms_rotated.h │ │ │ │ │ ├── nms_rotated_cpu.cpp │ │ │ │ │ └── nms_rotated_cuda.cu │ │ │ │ └── vision.cpp │ │ │ ├── deform_conv.py │ │ │ ├── losses.py │ │ │ ├── mask_ops.py │ │ │ ├── nms.py │ │ │ ├── roi_align.py │ │ │ ├── roi_align_rotated.py │ │ │ ├── rotated_boxes.py │ │ │ ├── shape_spec.py │ │ │ └── wrappers.py │ │ ├── model_zoo/ │ │ │ ├── __init__.py │ │ │ ├── configs │ │ │ └── model_zoo.py │ │ ├── modeling/ │ │ │ ├── __init__.py │ │ │ ├── anchor_generator.py │ │ │ ├── backbone/ │ │ │ │ ├── __init__.py │ │ │ │ ├── backbone.py │ │ │ │ ├── build.py │ │ │ │ ├── fpn.py │ │ │ │ ├── regnet.py │ │ │ │ └── resnet.py │ │ │ ├── box_regression.py │ │ │ ├── matcher.py │ │ │ ├── meta_arch/ │ │ │ │ ├── __init__.py │ │ │ │ ├── build.py │ │ │ │ ├── dense_detector.py │ │ │ │ ├── fcos.py │ │ │ │ ├── panoptic_fpn.py │ │ │ │ ├── panoptic_fpn_train.py │ │ │ │ ├── rcnn.py │ │ │ │ ├── retinanet.py │ │ │ │ └── semantic_seg.py │ │ │ ├── mmdet_wrapper.py │ │ │ ├── poolers.py │ │ │ ├── postprocessing.py │ │ │ ├── proposal_generator/ │ │ │ │ ├── __init__.py │ │ │ │ ├── build.py │ │ │ │ ├── proposal_utils.py │ │ │ │ ├── rpn.py │ │ │ │ └── rrpn.py │ │ │ ├── roi_heads/ │ │ │ │ ├── __init__.py │ │ │ │ ├── box_head.py │ │ │ │ ├── cascade_rcnn.py │ │ │ │ ├── fast_rcnn.py │ │ │ │ ├── keypoint_head.py │ │ │ │ ├── mask_head.py │ │ │ │ ├── roi_heads.py │ │ │ │ └── rotated_fast_rcnn.py │ │ │ ├── sampling.py │ │ │ └── test_time_augmentation.py │ │ ├── projects/ │ │ │ ├── README.md │ │ │ └── __init__.py │ │ ├── solver/ │ │ │ ├── __init__.py │ │ │ ├── build.py │ │ │ └── lr_scheduler.py │ │ ├── structures/ │ │ │ ├── __init__.py │ │ │ ├── boxes.py │ │ │ ├── image_list.py │ │ │ ├── instances.py │ │ │ ├── keypoints.py │ │ │ ├── masks.py │ │ │ └── rotated_boxes.py │ │ └── utils/ │ │ ├── README.md │ │ ├── __init__.py │ │ ├── analysis.py │ │ ├── collect_env.py │ │ ├── colormap.py │ │ ├── comm.py │ │ ├── env.py │ │ ├── events.py │ │ ├── file_io.py │ │ ├── logger.py │ │ ├── memory.py │ │ ├── registry.py │ │ ├── serialize.py │ │ ├── testing.py │ │ ├── video_visualizer.py │ │ └── visualizer.py │ ├── dev/ │ │ ├── README.md │ │ ├── linter.sh │ │ ├── packaging/ │ │ │ ├── README.md │ │ │ ├── build_all_wheels.sh │ │ │ ├── build_wheel.sh │ │ │ ├── gen_install_table.py │ │ │ ├── gen_wheel_index.sh │ │ │ └── pkg_helpers.bash │ │ ├── parse_results.sh │ │ ├── run_inference_tests.sh │ │ └── run_instant_tests.sh │ ├── docker/ │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── deploy.Dockerfile │ │ └── docker-compose.yml │ ├── docs/ │ │ ├── .gitignore │ │ ├── Makefile │ │ ├── README.md │ │ ├── _static/ │ │ │ └── css/ │ │ │ └── custom.css │ │ ├── conf.py │ │ ├── index.rst │ │ ├── modules/ │ │ │ ├── checkpoint.rst │ │ │ ├── config.rst │ │ │ ├── data.rst │ │ │ ├── data_transforms.rst │ │ │ ├── engine.rst │ │ │ ├── evaluation.rst │ │ │ ├── export.rst │ │ │ ├── fvcore.rst │ │ │ ├── index.rst │ │ │ ├── layers.rst │ │ │ ├── model_zoo.rst │ │ │ ├── modeling.rst │ │ │ ├── solver.rst │ │ │ ├── structures.rst │ │ │ └── utils.rst │ │ ├── notes/ │ │ │ ├── benchmarks.md │ │ │ ├── changelog.md │ │ │ ├── compatibility.md │ │ │ ├── contributing.md │ │ │ └── index.rst │ │ ├── requirements.txt │ │ └── tutorials/ │ │ ├── README.md │ │ ├── augmentation.md │ │ ├── builtin_datasets.md │ │ ├── configs.md │ │ ├── data_loading.md │ │ ├── datasets.md │ │ ├── deployment.md │ │ ├── evaluation.md │ │ ├── extend.md │ │ ├── getting_started.md │ │ ├── index.rst │ │ ├── install.md │ │ ├── lazyconfigs.md │ │ ├── models.md │ │ ├── training.md │ │ └── write-models.md │ ├── projects/ │ │ ├── DeepLab/ │ │ │ ├── README.md │ │ │ ├── configs/ │ │ │ │ └── Cityscapes-SemanticSegmentation/ │ │ │ │ ├── Base-DeepLabV3-OS16-Semantic.yaml │ │ │ │ ├── deeplab_v3_R_103_os16_mg124_poly_90k_bs16.yaml │ │ │ │ └── deeplab_v3_plus_R_103_os16_mg124_poly_90k_bs16.yaml │ │ │ ├── deeplab/ │ │ │ │ ├── __init__.py │ │ │ │ ├── build_solver.py │ │ │ │ ├── config.py │ │ │ │ ├── loss.py │ │ │ │ ├── lr_scheduler.py │ │ │ │ ├── resnet.py │ │ │ │ └── semantic_seg.py │ │ │ └── train_net.py │ │ ├── DensePose/ │ │ │ ├── README.md │ │ │ ├── apply_net.py │ │ │ ├── configs/ │ │ │ │ ├── Base-DensePose-RCNN-FPN.yaml │ │ │ │ ├── HRNet/ │ │ │ │ │ ├── densepose_rcnn_HRFPN_HRNet_w32_s1x.yaml │ │ │ │ │ ├── densepose_rcnn_HRFPN_HRNet_w40_s1x.yaml │ │ │ │ │ └── densepose_rcnn_HRFPN_HRNet_w48_s1x.yaml │ │ │ │ ├── cse/ │ │ │ │ │ ├── Base-DensePose-RCNN-FPN-Human.yaml │ │ │ │ │ ├── Base-DensePose-RCNN-FPN.yaml │ │ │ │ │ ├── densepose_rcnn_R_101_FPN_DL_s1x.yaml │ │ │ │ │ ├── densepose_rcnn_R_101_FPN_DL_soft_s1x.yaml │ │ │ │ │ ├── densepose_rcnn_R_101_FPN_s1x.yaml │ │ │ │ │ ├── densepose_rcnn_R_101_FPN_soft_s1x.yaml │ │ │ │ │ ├── densepose_rcnn_R_50_FPN_DL_s1x.yaml │ │ │ │ │ ├── densepose_rcnn_R_50_FPN_DL_soft_s1x.yaml │ │ │ │ │ ├── densepose_rcnn_R_50_FPN_s1x.yaml │ │ │ │ │ ├── densepose_rcnn_R_50_FPN_soft_animals_CA_finetune_16k.yaml │ │ │ │ │ ├── densepose_rcnn_R_50_FPN_soft_animals_CA_finetune_4k.yaml │ │ │ │ │ ├── densepose_rcnn_R_50_FPN_soft_animals_I0_finetune_16k.yaml │ │ │ │ │ ├── densepose_rcnn_R_50_FPN_soft_animals_I0_finetune_i2m_16k.yaml │ │ │ │ │ ├── densepose_rcnn_R_50_FPN_soft_animals_I0_finetune_m2m_16k.yaml │ │ │ │ │ ├── densepose_rcnn_R_50_FPN_soft_animals_finetune_16k.yaml │ │ │ │ │ ├── densepose_rcnn_R_50_FPN_soft_animals_finetune_4k.yaml │ │ │ │ │ ├── densepose_rcnn_R_50_FPN_soft_animals_finetune_maskonly_24k.yaml │ │ │ │ │ ├── densepose_rcnn_R_50_FPN_soft_chimps_finetune_4k.yaml │ │ │ │ │ └── densepose_rcnn_R_50_FPN_soft_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_101_FPN_DL_WC1M_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_101_FPN_DL_WC1_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_101_FPN_DL_WC2M_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_101_FPN_DL_WC2_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_101_FPN_DL_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_101_FPN_WC1M_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_101_FPN_WC1_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_101_FPN_WC2M_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_101_FPN_WC2_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_101_FPN_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_101_FPN_s1x_legacy.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_DL_WC1M_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_DL_WC1_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_DL_WC2M_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_DL_WC2_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_DL_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_WC1M_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_WC1_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_WC2M_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_WC2_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_s1x_legacy.yaml │ │ │ │ ├── evolution/ │ │ │ │ │ ├── Base-RCNN-FPN-Atop10P_CA.yaml │ │ │ │ │ ├── densepose_R_50_FPN_DL_WC1M_3x_Atop10P_CA.yaml │ │ │ │ │ ├── densepose_R_50_FPN_DL_WC1M_3x_Atop10P_CA_B_coarsesegm.yaml │ │ │ │ │ ├── densepose_R_50_FPN_DL_WC1M_3x_Atop10P_CA_B_finesegm.yaml │ │ │ │ │ ├── densepose_R_50_FPN_DL_WC1M_3x_Atop10P_CA_B_uniform.yaml │ │ │ │ │ └── densepose_R_50_FPN_DL_WC1M_3x_Atop10P_CA_B_uv.yaml │ │ │ │ └── quick_schedules/ │ │ │ │ ├── cse/ │ │ │ │ │ ├── densepose_rcnn_R_50_FPN_DL_instant_test.yaml │ │ │ │ │ └── densepose_rcnn_R_50_FPN_soft_animals_finetune_instant_test.yaml │ │ │ │ ├── densepose_rcnn_HRFPN_HRNet_w32_instant_test.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_DL_instant_test.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_TTA_inference_acc_test.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_WC1_instant_test.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_WC2_instant_test.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_inference_acc_test.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_instant_test.yaml │ │ │ │ └── densepose_rcnn_R_50_FPN_training_acc_test.yaml │ │ │ ├── densepose/ │ │ │ │ ├── __init__.py │ │ │ │ ├── config.py │ │ │ │ ├── converters/ │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── base.py │ │ │ │ │ ├── builtin.py │ │ │ │ │ ├── chart_output_hflip.py │ │ │ │ │ ├── chart_output_to_chart_result.py │ │ │ │ │ ├── hflip.py │ │ │ │ │ ├── segm_to_mask.py │ │ │ │ │ ├── to_chart_result.py │ │ │ │ │ └── to_mask.py │ │ │ │ ├── engine/ │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── trainer.py │ │ │ │ ├── evaluation/ │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── d2_evaluator_adapter.py │ │ │ │ │ ├── densepose_coco_evaluation.py │ │ │ │ │ ├── evaluator.py │ │ │ │ │ ├── mesh_alignment_evaluator.py │ │ │ │ │ └── tensor_storage.py │ │ │ │ ├── modeling/ │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── build.py │ │ │ │ │ ├── confidence.py │ │ │ │ │ ├── cse/ │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ ├── embedder.py │ │ │ │ │ │ ├── utils.py │ │ │ │ │ │ ├── vertex_direct_embedder.py │ │ │ │ │ │ └── vertex_feature_embedder.py │ │ │ │ │ ├── densepose_checkpoint.py │ │ │ │ │ ├── filter.py │ │ │ │ │ ├── hrfpn.py │ │ │ │ │ ├── hrnet.py │ │ │ │ │ ├── inference.py │ │ │ │ │ ├── losses/ │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ ├── chart.py │ │ │ │ │ │ ├── chart_with_confidences.py │ │ │ │ │ │ ├── cse.py │ │ │ │ │ │ ├── cycle_pix2shape.py │ │ │ │ │ │ ├── cycle_shape2shape.py │ │ │ │ │ │ ├── embed.py │ │ │ │ │ │ ├── embed_utils.py │ │ │ │ │ │ ├── mask.py │ │ │ │ │ │ ├── mask_or_segm.py │ │ │ │ │ │ ├── registry.py │ │ │ │ │ │ ├── segm.py │ │ │ │ │ │ ├── soft_embed.py │ │ │ │ │ │ └── utils.py │ │ │ │ │ ├── predictors/ │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ ├── chart.py │ │ │ │ │ │ ├── chart_confidence.py │ │ │ │ │ │ ├── chart_with_confidence.py │ │ │ │ │ │ ├── cse.py │ │ │ │ │ │ ├── cse_confidence.py │ │ │ │ │ │ ├── cse_with_confidence.py │ │ │ │ │ │ └── registry.py │ │ │ │ │ ├── roi_heads/ │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ ├── deeplab.py │ │ │ │ │ │ ├── registry.py │ │ │ │ │ │ ├── roi_head.py │ │ │ │ │ │ └── v1convx.py │ │ │ │ │ ├── test_time_augmentation.py │ │ │ │ │ └── utils.py │ │ │ │ ├── structures/ │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── chart.py │ │ │ │ │ ├── chart_confidence.py │ │ │ │ │ ├── chart_result.py │ │ │ │ │ ├── cse.py │ │ │ │ │ ├── cse_confidence.py │ │ │ │ │ ├── data_relative.py │ │ │ │ │ ├── list.py │ │ │ │ │ ├── mesh.py │ │ │ │ │ └── transform_data.py │ │ │ │ ├── utils/ │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── dbhelper.py │ │ │ │ │ ├── logger.py │ │ │ │ │ └── transform.py │ │ │ │ └── vis/ │ │ │ │ ├── __init__.py │ │ │ │ ├── base.py │ │ │ │ ├── bounding_box.py │ │ │ │ ├── densepose_data_points.py │ │ │ │ ├── densepose_outputs_iuv.py │ │ │ │ ├── densepose_outputs_vertex.py │ │ │ │ ├── densepose_results.py │ │ │ │ ├── densepose_results_textures.py │ │ │ │ └── extractor.py │ │ │ ├── dev/ │ │ │ │ ├── README.md │ │ │ │ ├── run_inference_tests.sh │ │ │ │ └── run_instant_tests.sh │ │ │ ├── doc/ │ │ │ │ ├── BOOTSTRAPPING_PIPELINE.md │ │ │ │ ├── DENSEPOSE_CSE.md │ │ │ │ ├── DENSEPOSE_DATASETS.md │ │ │ │ ├── DENSEPOSE_IUV.md │ │ │ │ ├── GETTING_STARTED.md │ │ │ │ ├── RELEASE_2020_04.md │ │ │ │ ├── RELEASE_2021_03.md │ │ │ │ ├── RELEASE_2021_06.md │ │ │ │ ├── TOOL_APPLY_NET.md │ │ │ │ └── TOOL_QUERY_DB.md │ │ │ ├── query_db.py │ │ │ ├── setup.py │ │ │ └── train_net.py │ │ ├── Panoptic-DeepLab/ │ │ │ ├── README.md │ │ │ ├── configs/ │ │ │ │ ├── COCO-PanopticSegmentation/ │ │ │ │ │ └── panoptic_deeplab_R_52_os16_mg124_poly_200k_bs64_crop_640_640_coco_dsconv.yaml │ │ │ │ └── Cityscapes-PanopticSegmentation/ │ │ │ │ ├── Base-PanopticDeepLab-OS16.yaml │ │ │ │ ├── panoptic_deeplab_R_52_os16_mg124_poly_90k_bs32_crop_512_1024.yaml │ │ │ │ └── panoptic_deeplab_R_52_os16_mg124_poly_90k_bs32_crop_512_1024_dsconv.yaml │ │ │ ├── panoptic_deeplab/ │ │ │ │ ├── __init__.py │ │ │ │ ├── config.py │ │ │ │ ├── dataset_mapper.py │ │ │ │ ├── panoptic_seg.py │ │ │ │ ├── post_processing.py │ │ │ │ └── target_generator.py │ │ │ └── train_net.py │ │ ├── PointRend/ │ │ │ ├── README.md │ │ │ ├── configs/ │ │ │ │ ├── InstanceSegmentation/ │ │ │ │ │ ├── Base-Implicit-PointRend.yaml │ │ │ │ │ ├── Base-PointRend-RCNN-FPN.yaml │ │ │ │ │ ├── implicit_pointrend_R_50_FPN_1x_coco.yaml │ │ │ │ │ ├── implicit_pointrend_R_50_FPN_3x_coco.yaml │ │ │ │ │ ├── pointrend_rcnn_R_101_FPN_3x_coco.yaml │ │ │ │ │ ├── pointrend_rcnn_R_50_FPN_1x_cityscapes.yaml │ │ │ │ │ ├── pointrend_rcnn_R_50_FPN_1x_coco.yaml │ │ │ │ │ ├── pointrend_rcnn_R_50_FPN_3x_coco.yaml │ │ │ │ │ └── pointrend_rcnn_X_101_32x8d_FPN_3x_coco.yaml │ │ │ │ └── SemanticSegmentation/ │ │ │ │ ├── Base-PointRend-Semantic-FPN.yaml │ │ │ │ └── pointrend_semantic_R_101_FPN_1x_cityscapes.yaml │ │ │ ├── point_rend/ │ │ │ │ ├── __init__.py │ │ │ │ ├── color_augmentation.py │ │ │ │ ├── config.py │ │ │ │ ├── mask_head.py │ │ │ │ ├── point_features.py │ │ │ │ ├── point_head.py │ │ │ │ ├── roi_heads.py │ │ │ │ └── semantic_seg.py │ │ │ └── train_net.py │ │ ├── PointSup/ │ │ │ ├── README.md │ │ │ ├── configs/ │ │ │ │ ├── implicit_pointrend_R_50_FPN_3x_point_sup_point_aug_coco.yaml │ │ │ │ ├── mask_rcnn_R_50_FPN_3x_point_sup_coco.yaml │ │ │ │ └── mask_rcnn_R_50_FPN_3x_point_sup_point_aug_coco.yaml │ │ │ ├── point_sup/ │ │ │ │ ├── __init__.py │ │ │ │ ├── config.py │ │ │ │ ├── dataset_mapper.py │ │ │ │ ├── detection_utils.py │ │ │ │ ├── mask_head.py │ │ │ │ ├── point_utils.py │ │ │ │ └── register_point_annotations.py │ │ │ ├── tools/ │ │ │ │ └── prepare_coco_point_annotations_without_masks.py │ │ │ └── train_net.py │ │ ├── README.md │ │ ├── Rethinking-BatchNorm/ │ │ │ ├── README.md │ │ │ ├── configs/ │ │ │ │ ├── mask_rcnn_BNhead.py │ │ │ │ ├── mask_rcnn_BNhead_batch_stats.py │ │ │ │ ├── mask_rcnn_BNhead_shuffle.py │ │ │ │ ├── mask_rcnn_SyncBNhead.py │ │ │ │ ├── retinanet_SyncBNhead.py │ │ │ │ └── retinanet_SyncBNhead_SharedTraining.py │ │ │ └── retinanet-eval-domain-specific.py │ │ ├── TensorMask/ │ │ │ ├── README.md │ │ │ ├── configs/ │ │ │ │ ├── Base-TensorMask.yaml │ │ │ │ ├── tensormask_R_50_FPN_1x.yaml │ │ │ │ └── tensormask_R_50_FPN_6x.yaml │ │ │ ├── setup.py │ │ │ ├── tensormask/ │ │ │ │ ├── __init__.py │ │ │ │ ├── arch.py │ │ │ │ ├── config.py │ │ │ │ └── layers/ │ │ │ │ ├── __init__.py │ │ │ │ ├── csrc/ │ │ │ │ │ ├── SwapAlign2Nat/ │ │ │ │ │ │ ├── SwapAlign2Nat.h │ │ │ │ │ │ └── SwapAlign2Nat_cuda.cu │ │ │ │ │ └── vision.cpp │ │ │ │ └── swap_align2nat.py │ │ │ └── train_net.py │ │ └── TridentNet/ │ │ ├── README.md │ │ ├── configs/ │ │ │ ├── Base-TridentNet-Fast-C4.yaml │ │ │ ├── tridentnet_fast_R_101_C4_3x.yaml │ │ │ ├── tridentnet_fast_R_50_C4_1x.yaml │ │ │ └── tridentnet_fast_R_50_C4_3x.yaml │ │ ├── train_net.py │ │ └── tridentnet/ │ │ ├── __init__.py │ │ ├── config.py │ │ ├── trident_backbone.py │ │ ├── trident_conv.py │ │ ├── trident_rcnn.py │ │ └── trident_rpn.py │ ├── setup.cfg │ ├── setup.py │ └── tools/ │ ├── 1_tracking.py │ ├── 2_matching.py │ ├── 3_preparing.py │ ├── 4_eval_vpq.py │ ├── README.md │ ├── __init__.py │ ├── analyze_model.py │ ├── benchmark.py │ ├── convert-torchvision-to-d2.py │ ├── default.py │ ├── deploy/ │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ ├── export_model.py │ │ └── torchscript_mask_rcnn.cpp │ ├── lazyconfig_train_net.py │ ├── lightning_train_net.py │ ├── plain_train_net.py │ ├── train_net.py │ ├── visualize_data.py │ └── visualize_json_results.py ├── prepare.md └── tools/ ├── initial_segmentation.sh ├── split_init_segm.py ├── test_vo_scene.sh └── test_vps.sh ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ a# Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so checkpoints/ datasets/ shared_data/ # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder .pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: # .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # PEP 582; used by e.g. github.com/David-OConnor/pyflow __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ __pycache__ build dist *.egg-info *.vscode/ *.pth tests checkpoints datasets runs cache *.out *.o data figures/*.pdf test_codes/ tensorboard.sh visualize/results/ visualize/traj_results ================================================ FILE: README.md ================================================ # PVO: Panoptic Visual Odometry ### [Project Page](https://zju3dv.github.io/pvo/) | [Paper](https://arxiv.org/abs/2207.01610)
> PVO: Panoptic Visual Odometry > [[Weicai Ye](https://ywcmaike.github.io/), [Xinyue Lan](https://github.com/siyisan)]Co-Authors, [Shuo Chen](https://github.com/Eric3778), [Yuhang Ming](https://github.com/YuhangMing), [Xinyuan Yu](https://github.com/RickyYXY), [Hujun Bao](http://www.cad.zju.edu.cn/home/bao/), [Zhaopeng Cui](https://zhpcui.github.io/), [Guofeng Zhang](http://www.cad.zju.edu.cn/home/gfzhang) > CVPR 2023 ![demo_vid](assets/pvo_teaser.gif) ## Test on vkitti 15-deg-left datasets. 0) prepare. follow [prepare.md](prepare.md) ``` conda activate droidenv ``` 1) generate inital panoptic segmentation. ``` sh tools/initial_segmentation.sh ``` 2) vps->vo,vo Module generate pose, flow and depth. ``` sh tools/test_vo_scene.sh ``` 3) vo->vps, vps Module use flow and depth from vo Module and generate final video panoptic segmentation results and vpq. ``` sh tools/test_vps.sh ``` ## Metrics on Virtual_KITTI2 |Scene|RMSE|vpq_all/vpq_thing/vpq_stuff| |-----|----|---------------------------| |Scene01|0.371|40.39/26.43/44.57| |Scene02|0.058|68.84/88.83/62.18| |Scene06|0.113|66.38/79.99/62.97| |Scene18|0.951|68.35/83.86/63.92| |Scene20|3.503|35.11/16.83/40.59| You can get the results in the paper by iterating multiple times. ## Train on vkitti 15-deg-left datasets. 1) To train VPS_Module, you can refer to [Detectron2](https://detectron2.readthedocs.io/en/latest/tutorials/getting_started.html) for more training details. Here for example, you can train vkitti 15-deg-left on 4 GPUs, and training results are saved on `output/vps_training/`. You can modify the config-file according to the hardware conditions. ``` python3 -W ignore VPS_Module/tools/train_net.py \ --config-file VPS_Module/configs/COCO-PanopticSegmentation/panoptic_fpn_R_50_3x_vkitti_511.yaml --num-gpu 4 \ MODEL.WEIGHTS checkpoints/panFPN.pth \ OUTPUT_DIR output/vps_training/ ``` 2) To train VO_Module, you can refer to [DROID-SLAM](https://github.com/princeton-vl/DROID-SLAM) for more training details. Here for example, you can train vkitti on 4 GPUs. ``` python VO_Module/train.py --gpus=4 --lr=0.00025 ``` ## Visualization You can refer to [DROID-SLAM](https://github.com/princeton-vl/DROID-SLAM) for visualization. All demos can be run on a GPU with 11G of memory. While running, press the "s" key to increase the filtering threshold (= more points) and "a" to decrease the filtering threshold (= fewer points). ``` python VO_Module/evaluation_scripts/test_vo.py --datapath=datasets/Virtual_KITTI2/Scene01 --segm_filter True ``` ## Citation If you find this code useful for your research, please use the following BibTeX entry. ```bibtex @inproceedings{Ye2023PVO, title={{PVO: Panoptic visual odometry}}, author={Ye, Weicai and Lan, Xinyue and Chen, Shuo and Ming, Yuhang and Yu, Xingyuan and Bao, Hujun and Cui, Zhaopeng and Zhang, Guofeng}, booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition}, pages={9579--9589}, year={2023} } ``` ## Acknowledgement Some code snippets are borrowed from [DROID-SLAM](https://github.com/princeton-vl/DROID-SLAM) and [Detectron2](https://github.com/facebookresearch/detectron2). Thanks for these great projects. ================================================ FILE: VO_Module/README.md ================================================ ## Requirements To run the code you will need ... * **Inference:** Running the demos will require a GPU with at least 11G of memory. * **Training:** Training requires a GPU with at least 24G of memory. We train on 4 x RTX-3090 GPUs. ## Getting Started 1. Creating a new anaconda environment using the provided .yaml file. Use `environment_novis.yaml` to if you do not want to use the visualization ```Bash conda env create -f environment.yml pip install evo --upgrade --no-binary evo pip install gdown ``` 2. Compile the extensions (takes about 10 minutes) ```Bash python setup.py install ``` ## Acknowledgements We additionally use evaluation tools from [evo](https://github.com/MichaelGrupp/evo) and [tartanair_tools](https://github.com/castacks/tartanair_tools). Our code is based on the code provided by [DROID-SLAM](https://github.com/princeton-vl/DROID-SLAM).
[DROID-SLAM: Deep Visual SLAM for Monocular, Stereo, and RGB-D Cameras](https://arxiv.org/abs/2108.10869) Zachary Teed and Jia Deng ``` @article{teed2021droid, title={{DROID-SLAM: Deep Visual SLAM for Monocular, Stereo, and RGB-D Cameras}}, author={Teed, Zachary and Deng, Jia}, journal={arXiv preprint arXiv:2108.10869}, year={2021} } ``` ================================================ FILE: VO_Module/calib/barn.txt ================================================ 1161.545689 1161.545689 960.000000 540.000000 -0.025158 0.0 0.0 0.0 ================================================ FILE: VO_Module/calib/eth.txt ================================================ 726.21081542969 726.21081542969 359.2048034668 202.47247314453 ================================================ FILE: VO_Module/calib/euroc.txt ================================================ 458.654 457.296 367.215 248.375 -0.28340811 0.07395907 0.00019359 1.76187114e-05 ================================================ FILE: VO_Module/calib/kitti.txt ================================================ 7.070912000000e+02 7.070912000000e+02 6.018873000000e+02 1.831104000000e+02 ================================================ FILE: VO_Module/calib/replica.txt ================================================ 600.0 600.0 599.5 339.5 ================================================ FILE: VO_Module/calib/tartan.txt ================================================ 320.0 320.0 320.0 240.0 ================================================ FILE: VO_Module/calib/tum3.txt ================================================ 535.4 539.2 320.1 247.6 ================================================ FILE: VO_Module/demo.py ================================================ import sys sys.path.append('droid_slam') from tqdm import tqdm import numpy as np import torch import lietorch import cv2 import os import glob import time import argparse from torch.multiprocessing import Process from droid import Droid import torch.nn.functional as F def show_image(image): image = image.permute(1, 2, 0).cpu().numpy() cv2.imshow('image', image / 255.0) cv2.waitKey(1) def image_stream(imagedir, calib, stride): """ image generator """ calib = np.loadtxt(calib, delimiter=" ") fx, fy, cx, cy = calib[:4] K = np.eye(3) K[0,0] = fx K[0,2] = cx K[1,1] = fy K[1,2] = cy image_list = sorted(os.listdir(imagedir))[::stride] for t, imfile in enumerate(image_list): image = cv2.imread(os.path.join(imagedir, imfile)) if len(calib) > 4: image = cv2.undistort(image, K, calib[4:]) h0, w0, _ = image.shape h1 = int(h0 * np.sqrt((384 * 512) / (h0 * w0))) w1 = int(w0 * np.sqrt((384 * 512) / (h0 * w0))) image = cv2.resize(image, (w1, h1)) image = image[:h1-h1%8, :w1-w1%8] image = torch.as_tensor(image).permute(2, 0, 1) intrinsics = torch.as_tensor([fx, fy, cx, cy]) intrinsics[0:2] *= (w1 / w0) intrinsics[2:4] *= (h1 / h0) yield t, image, intrinsics if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument("--imagedir", type=str, help="path to image directory") parser.add_argument("--calib", type=str, help="path to calibration file") parser.add_argument("--t0", default=0, type=int, help="starting frame") parser.add_argument("--stride", default=3, type=int, help="frame stride") parser.add_argument("--weights", default="droid.pth") parser.add_argument("--buffer", type=int, default=512) parser.add_argument("--image_size", default=[240, 320]) parser.add_argument("--disable_vis", action="store_true") parser.add_argument("--beta", type=float, default=0.3, help="weight for translation / rotation components of flow") parser.add_argument("--filter_thresh", type=float, default=2.4, help="how much motion before considering new keyframe") parser.add_argument("--warmup", type=int, default=8, help="number of warmup frames") parser.add_argument("--keyframe_thresh", type=float, default=4.0, help="threshold to create a new keyframe") parser.add_argument("--frontend_thresh", type=float, default=16.0, help="add edges between frames whithin this distance") parser.add_argument("--frontend_window", type=int, default=25, help="frontend optimization window") parser.add_argument("--frontend_radius", type=int, default=2, help="force edges between frames within radius") parser.add_argument("--frontend_nms", type=int, default=1, help="non-maximal supression of edges") parser.add_argument("--backend_thresh", type=float, default=22.0) parser.add_argument("--backend_radius", type=int, default=2) parser.add_argument("--backend_nms", type=int, default=3) args = parser.parse_args() torch.multiprocessing.set_start_method('spawn') droid = None tstamps = [] for (t, image, intrinsics) in tqdm(image_stream(args.imagedir, args.calib, args.stride)): if t < args.t0: continue if not args.disable_vis: show_image(image) if droid is None: args.image_size = [image.shape[1], image.shape[2]] droid = Droid(args) droid.track(t, image, intrinsics=intrinsics) traj_est = droid.terminate(image_stream(args.imagedir, args.calib, args.stride)) ================================================ FILE: VO_Module/droid_slam/data_readers/__init__.py ================================================ ================================================ FILE: VO_Module/droid_slam/data_readers/augmentation.py ================================================ import torch import torchvision.transforms as transforms import numpy as np import torch.nn.functional as F class RGBDAugmentor: """ perform augmentation on RGB-D video """ def __init__(self, crop_size): self.crop_size = crop_size self.augcolor = transforms.Compose([ transforms.ToPILImage(), transforms.ColorJitter( brightness=0.25, contrast=0.25, saturation=0.25, hue=0.4/3.14), transforms.RandomGrayscale(p=0.1), transforms.ToTensor()]) self.max_scale = 0.25 def resize_sparse_flow_map(self, flow, valid, fx=1.0, fy=1.0): """from RAFT""" N, ht, wd = flow.shape[:3] coords = np.meshgrid(np.arange(wd), np.arange(ht)) coords = np.stack(coords, axis=-1) coords = torch.from_numpy(coords).expand_as(flow) coords = coords.reshape(N, -1, 2).float() flow = flow.reshape(N, -1, 2).float() valid = valid.reshape(N, -1).float() coords0 = coords[valid >= 1] flow0 = flow[valid >= 1] ht1 = int(round(ht * fy)) wd1 = int(round(wd * fx)) coords1 = coords0 * torch.tensor([fx, fy]) flow1 = flow0 * torch.tensor([fx, fy]) xx = torch.round(coords1[..., 0]).long() yy = torch.round(coords1[..., 1]).long() v = (xx > 0) & (xx < wd1) & (yy > 0) & (yy < ht1) xx = xx[v] yy = yy[v] flow1 = flow1[v] flow_img = torch.zeros([N, ht1, wd1, 2], dtype=torch.float) valid_img = torch.zeros([N, ht1, wd1], dtype=torch.int) flow_img[:, yy, xx] = flow1 valid_img[:, yy, xx] = 1 return flow_img, valid_img def spatial_transform(self, images, depths, poses, intrinsics, fo_flows=None, fo_vals=None, ba_flows=None, ba_vals=None, fo_masks=None, ba_masks=None, gt_masks=None, gt_vals=None, segments=None): """ cropping and resizing """ ht, wd = images.shape[2:] max_scale = self.max_scale min_scale = np.log2(np.maximum( (self.crop_size[0] + 1) / float(ht), (self.crop_size[1] + 1) / float(wd))) scale = 2 ** np.random.uniform(min_scale, max_scale) intrinsics = scale * intrinsics depths = depths.unsqueeze(dim=1) images = F.interpolate(images, scale_factor=scale, mode='bilinear', align_corners=False, recompute_scale_factor=True) depths = F.interpolate(depths, scale_factor=scale, recompute_scale_factor=True) if fo_flows != None: fo_flows, fo_vals = self.resize_sparse_flow_map( fo_flows, fo_vals, fx=scale, fy=scale) fo_flows = torch.cat([fo_flows, fo_vals.unsqueeze(-1)], dim=-1) ba_flows, ba_vals = self.resize_sparse_flow_map( ba_flows, ba_vals, fx=scale, fy=scale) ba_flows = torch.cat([ba_flows, ba_vals.unsqueeze(-1)], dim=-1) fo_masks = fo_masks.unsqueeze(1) ba_masks = ba_masks.unsqueeze(1) fo_masks = F.interpolate(fo_masks, scale_factor=scale, recompute_scale_factor=True) ba_masks = F.interpolate(ba_masks, scale_factor=scale, recompute_scale_factor=True) else: gt_masks = gt_masks.unsqueeze(1) gt_vals = gt_vals.unsqueeze(1) segments = segments.unsqueeze(1) gt_masks = F.interpolate(gt_masks, scale_factor=scale, recompute_scale_factor=True) gt_vals = F.interpolate(gt_vals, scale_factor=scale, recompute_scale_factor=True) segments = F.interpolate(segments, scale_factor=scale, recompute_scale_factor=True) # always perform center crop (TODO: try non-center crops) y0 = (images.shape[2] - self.crop_size[0]) // 2 x0 = (images.shape[3] - self.crop_size[1]) // 2 intrinsics = intrinsics - torch.tensor([0.0, 0.0, x0, y0]) images = images[:, :, y0:y0+self.crop_size[0], x0:x0+self.crop_size[1]] depths = depths[:, :, y0:y0+self.crop_size[0], x0:x0+self.crop_size[1]] if fo_flows != None: fo_flows = fo_flows[:, y0:y0 + self.crop_size[0], x0:x0+self.crop_size[1], :] ba_flows = ba_flows[:, y0:y0 + self.crop_size[0], x0:x0+self.crop_size[1], :] fo_masks = fo_masks[:, :, y0:y0 + self.crop_size[0], x0:x0+self.crop_size[1]] ba_masks = ba_masks[:, :, y0:y0 + self.crop_size[0], x0:x0+self.crop_size[1]] else: gt_masks = gt_masks[:, :, y0:y0 + self.crop_size[0], x0:x0+self.crop_size[1]] gt_vals = gt_vals[:, :, y0:y0 + self.crop_size[0], x0:x0+self.crop_size[1]] segments = segments[:, :, y0:y0 + self.crop_size[0], x0:x0+self.crop_size[1]] depths = depths.squeeze(dim=1) if fo_flows != None: fo_masks = fo_masks.squeeze(1) ba_masks = ba_masks.squeeze(1) return images, poses, depths, intrinsics, fo_flows, ba_flows, fo_masks, ba_masks else: gt_masks = gt_masks.squeeze(1) gt_vals = gt_vals.squeeze(1) segments = F.interpolate(segments, scale_factor=1/8, recompute_scale_factor=True) segments = segments.squeeze(1).int() return images, poses, depths, intrinsics, gt_masks, gt_vals, segments def spatial_transform_only_pose(self, images, poses, intrinsics): """ cropping and resizing """ ht, wd = images.shape[2:] max_scale = self.max_scale min_scale = np.log2(np.maximum( (self.crop_size[0] + 1) / float(ht), (self.crop_size[1] + 1) / float(wd))) scale = 2 ** np.random.uniform(min_scale, max_scale) intrinsics = scale * intrinsics images = F.interpolate(images, scale_factor=scale, mode='bilinear', align_corners=False, recompute_scale_factor=True) # always perform center crop (TODO: try non-center crops) y0 = (images.shape[2] - self.crop_size[0]) // 2 x0 = (images.shape[3] - self.crop_size[1]) // 2 intrinsics = intrinsics - torch.tensor([0.0, 0.0, x0, y0]) images = images[:, :, y0:y0+self.crop_size[0], x0:x0+self.crop_size[1]] return images, poses, intrinsics def color_transform(self, images): """ color jittering """ num, ch, ht, wd = images.shape images = images.permute(1, 2, 3, 0).reshape(ch, ht, wd*num) images = 255 * self.augcolor(images[[2, 1, 0]] / 255.0) return images[[2, 1, 0]].reshape(ch, ht, wd, num).permute(3, 0, 1, 2).contiguous() def __call__(self, images, poses, depths, intrinsics, fo_flows=None, fo_vals=None, ba_flows=None, ba_vals=None, fo_masks=None, ba_masks=None, gt_masks=None, gt_vals=None, segments=None): if depths == None: images = self.color_transform(images) return self.spatial_transform_only_pose(images, poses, intrinsics) else: images = self.color_transform(images) return self.spatial_transform(images, depths, poses, intrinsics, fo_flows, fo_vals, ba_flows, ba_vals, fo_masks, ba_masks, gt_masks, gt_vals, segments) ================================================ FILE: VO_Module/droid_slam/data_readers/base.py ================================================ import numpy as np import torch import torch.utils.data as data import torch.nn.functional as F import sys import csv import os import cv2 import math import random import json import pickle import os.path as osp from collections import OrderedDict from lietorch import SE3 from .augmentation import RGBDAugmentor from .rgbd_utils import * from geom.projective_ops import projective_transform, coords_grid from geom.graph_utils import graph_to_edge_list class RGBDDataset(data.Dataset): def __init__(self, name, datapath, n_frames=4, crop_size=[384, 512], fmin=8.0, fmax=75.0, do_aug=True, flow_label=False, aug_graph=False, need_inv=True, build_mask=False, mode='sup', rebuild=False): """ Base class for RGBD dataset """ self.aug = None self.root = datapath self.name = name self.mode = mode self.n_frames = n_frames self.fmin = fmin # exclude very easy examples self.fmax = fmax # exclude very hard examples self.flow_label = flow_label self.aug_graph = aug_graph self.need_inv = need_inv self.build_mask = build_mask self.only_pose = False if do_aug: self.aug = RGBDAugmentor(crop_size=crop_size) # building dataset is expensive, cache so only needs to be performed once cur_path = osp.dirname(osp.abspath(__file__)) if not os.path.isdir(osp.join(cur_path, 'cache')): os.mkdir(osp.join(cur_path, 'cache')) cache_path = osp.join(cur_path, 'cache', '{}.pickle'.format(self.name)) print("cache_path: ",cache_path) if osp.isfile(cache_path) and rebuild==False: scene_info = pickle.load(open(cache_path, 'rb'))[0] else: scene_info = self._build_dataset() with open(cache_path, 'wb') as cachefile: pickle.dump((scene_info,), cachefile) self.scene_info = scene_info self._build_dataset_index() self.has_segm = False def _build_dataset_index(self): self.dataset_index = [] for scene in self.scene_info: # if not self.__class__.is_test_scene(scene): if not self.is_test_scene(scene): if self.aug_graph: graph = self.scene_info[scene]['graph'] for i in graph: if len(graph[i][0]) > self.n_frames: self.dataset_index.append((scene, i)) else: for i in range(len(self.scene_info[scene]['images'])-self.n_frames+1): self.dataset_index.append((scene, i)) else: print("Reserving {} for validation".format(scene)) @staticmethod def image_read(image_file): return cv2.imread(image_file) @staticmethod def depth_read(depth_file): return np.load(depth_file) def build_frame_graph(self, poses, depths, intrinsics, f=16, max_flow=256): """ compute optical flow distance between all pairs of frames """ def read_disp(fn): depth = self.__class__.depth_read(fn)[f//2::f, f//2::f] depth[depth < 0.01] = np.mean(depth) return 1.0 / depth poses = np.array(poses) intrinsics = np.array(intrinsics) / f disps = np.stack(list(map(read_disp, depths)), 0) # need_inv = False for vkitti2 d = f * \ compute_distance_matrix_flow( poses, disps, intrinsics, need_inv=self.need_inv) graph = {} for i in range(d.shape[0]): j, = np.where(d[i] < max_flow) graph[i] = (j, d[i, j]) return graph def __getitem__(self, index): """ return training video """ index = index % len(self.dataset_index) scene_id, ix = self.dataset_index[index] if self.aug_graph: frame_graph = self.scene_info[scene_id]['graph'] if self.flow_label: fo_flow_list = self.scene_info[scene_id]['fo_flows'] ba_flow_list = self.scene_info[scene_id]['ba_flows'] if 'segments' in self.scene_info[scene_id]: self.has_segm = True segments_list = self.scene_info[scene_id]['segments'] else: if not self.only_pose: dymask_list = self.scene_info[scene_id]['dymasks'] segments_list = self.scene_info[scene_id]['segments'] self.has_segm = True images_list = self.scene_info[scene_id]['images'] if not self.only_pose: depths_list = self.scene_info[scene_id]['depths'] poses_list = self.scene_info[scene_id]['poses'] intrinsics_list = self.scene_info[scene_id]['intrinsics'] if self.aug_graph: inds = [ix] while len(inds) < self.n_frames: # get other frames within flow threshold k = (frame_graph[ix][1] > self.fmin) & ( frame_graph[ix][1] < self.fmax) frames = frame_graph[ix][0][k] # prefer frames forward in time if np.count_nonzero(frames[frames > ix]): ix = np.random.choice(frames[frames > ix]) elif np.count_nonzero(frames): ix = np.random.choice(frames) inds += [ix] else: inds = [] for i in range(self.n_frames): inds.append(ix + i) images, depths, poses, intrinsics = [], [], [], [] fo_flows, ba_flows = [], [] fo_vals, ba_vals = [], [] gt_masks, gt_vals = [], [] segments = [] filename_list = [] for num, i in enumerate(inds): images.append(self.__class__.image_read(images_list[i])) if not self.only_pose: depths.append(self.__class__.depth_read(depths_list[i])) poses.append(poses_list[i]) intrinsics.append(intrinsics_list[i]) filename_list.append(images_list[i].rsplit('/')[-1]) if self.flow_label and num < len(inds)-1: # 每组flow比图片少一项 f, v = self.__class__.flow_read(fo_flow_list[i]) fo_flows.append(f) fo_vals.append(v) f, v = self.__class__.flow_read(ba_flow_list[i]) ba_flows.append(f) ba_vals.append(v) if self.has_segm: seg = self.__class__.segment_read(segments_list[i]) segments.append(seg) if not self.flow_label : if not self.only_pose: mask, v = self.__class__.dymask_read(dymask_list[i]) gt_masks.append(mask) gt_vals.append(v) seg = self.__class__.segment_read(segments_list[i]) segments.append(seg) images = np.stack(images).astype(np.float32) if not self.only_pose: depths = np.stack(depths).astype(np.float32) poses = np.stack(poses).astype(np.float32) intrinsics = np.stack(intrinsics).astype(np.float32) if self.flow_label: fo_flows = np.stack(fo_flows).astype(np.float32) ba_flows = np.stack(ba_flows).astype(np.float32) fo_flows = torch.from_numpy(fo_flows) ba_flows = torch.from_numpy(ba_flows) fo_vals = np.stack(fo_vals).astype(np.float32) ba_vals = np.stack(ba_vals).astype(np.float32) fo_vals = torch.from_numpy(fo_vals) ba_vals = torch.from_numpy(ba_vals) if self.has_segm: segments = np.stack(segments).astype(np.float32) segments = torch.from_numpy(segments) else: if not self.only_pose: gt_masks = np.stack(gt_masks).astype(np.float32) gt_masks = torch.from_numpy(gt_masks) gt_vals = np.stack(gt_vals).astype(np.float32) gt_vals = torch.from_numpy(gt_vals) segments = np.stack(segments).astype(np.float32) segments = torch.from_numpy(segments) images = torch.from_numpy(images).float() images = images.permute(0, 3, 1, 2) if not self.only_pose: disps = torch.from_numpy(1.0 / depths) poses = torch.from_numpy(poses) intrinsics = torch.from_numpy(intrinsics) if self.only_pose: return filename_list, images, poses, intrinsics if self.aug is not None: if self.flow_label: fo_masks, ba_masks = self.build_motion_masks(poses, disps, intrinsics, fo_flows, ba_flows) # Only use when build dymasks' labels if self.build_mask: return fo_masks.unsqueeze(-1), ba_masks.unsqueeze(-1), \ fo_vals.unsqueeze(-1), ba_vals.unsqueeze(-1) images, poses, disps, intrinsics, \ fo_flows, ba_flows, fo_masks, ba_masks = self.aug(images, poses, disps, intrinsics, fo_flows, fo_vals, ba_flows, ba_vals, fo_masks, ba_masks) else: images, poses, disps, intrinsics, \ gt_masks, gt_vals, segments = self.aug(images, poses, disps, intrinsics, gt_masks=gt_masks, gt_vals=gt_vals, segments=segments) if len(disps[disps > 0.01]) > 0: s = disps[disps > 0.01].mean() disps = disps / s poses[..., :3] *= s if self.flow_label: if self.has_segm: return images, poses, disps, intrinsics, fo_flows, ba_flows, segments else: return images, poses, disps, intrinsics, fo_flows, ba_flows else: gt_masks, gt_vals = gt_masks.unsqueeze(-1), gt_vals.unsqueeze(-1) if self.mode == 'sup': return images, poses, disps, intrinsics, gt_masks, gt_vals elif self.mode == 'semisup': return filename_list, images, poses, disps, intrinsics, gt_masks, gt_vals, segments elif self.mode == 'unsup': return images, poses, disps, intrinsics else: raise Exception('ERROR: Unknown mode!') def __len__(self): return len(self.dataset_index) def __imul__(self, x): self.dataset_index *= x return self def build_motion_masks(self, poses, disps, intrinsics, fo_flows, ba_flows, thresh=0.5): N, ht, wd = poses.shape[0], fo_flows.shape[1], fo_flows.shape[2] graph = OrderedDict() for i in range(N): graph[i] = [j for j in range(N) if abs(i-j) == 1] ii, jj, _ = graph_to_edge_list(graph) poses, disps = poses.unsqueeze(0), disps.unsqueeze(0) intrinsics = intrinsics.unsqueeze(0) fo_flows, ba_flows = fo_flows.unsqueeze(0), ba_flows.unsqueeze(0) # use w2c for vkitti2 poses = SE3(poses) coords_cam, _ = projective_transform(poses, disps, intrinsics, ii, jj) cam_flows = coords_cam - coords_grid(ht, wd, device=poses.device) fo_masks = ((cam_flows[:, 0::2, ...] - fo_flows[..., 0:2]).norm(dim=-1) <= thresh).float() ba_masks = ((cam_flows[:, 1::2, ...] - ba_flows[..., 0:2]).norm(dim=-1) <= thresh).float() return fo_masks.squeeze(0), ba_masks.squeeze(0) ================================================ FILE: VO_Module/droid_slam/data_readers/factory.py ================================================ import pickle import os import os.path as osp # RGBD-Dataset from .tartan import TartanAir from .replica import Replica from .vkitti2 import VKitti2 from .stream import ImageStream from .stream import StereoStream from .stream import RGBDStream # streaming datasets for inference from .tartan import TartanAirStream from .tartan import TartanAirTestStream def dataset_factory(dataset_list, **kwargs): """ create a combined dataset """ from torch.utils.data import ConcatDataset dataset_map = {'tartan': (TartanAir, ), 'replica': (Replica, ), 'vkitti2': (VKitti2, ), } db_list = [] for key in dataset_list: # cache datasets for faster future loading db = dataset_map[key][0](**kwargs) print("Dataset {} has {} images".format(key, len(db))) db_list.append(db) return ConcatDataset(db_list) def create_datastream(dataset_path, **kwargs): """ create data_loader to stream images 1 by 1 """ from torch.utils.data import DataLoader if osp.isfile(osp.join(dataset_path, 'calibration.txt')): db = ETH3DStream(dataset_path, **kwargs) elif osp.isdir(osp.join(dataset_path, 'image_left')): db = TartanAirStream(dataset_path, **kwargs) elif osp.isfile(osp.join(dataset_path, 'rgb.txt')): db = TUMStream(dataset_path, **kwargs) elif osp.isdir(osp.join(dataset_path, 'mav0')): db = EurocStream(dataset_path, **kwargs) elif osp.isfile(osp.join(dataset_path, 'calib.txt')): db = KITTIStream(dataset_path, **kwargs) else: # db = TartanAirStream(dataset_path, **kwargs) db = TartanAirTestStream(dataset_path, **kwargs) stream = DataLoader(db, shuffle=False, batch_size=1, num_workers=4) return stream def create_imagestream(dataset_path, **kwargs): """ create data_loader to stream images 1 by 1 """ from torch.utils.data import DataLoader db = ImageStream(dataset_path, **kwargs) return DataLoader(db, shuffle=False, batch_size=1, num_workers=4) def create_stereostream(dataset_path, **kwargs): """ create data_loader to stream images 1 by 1 """ from torch.utils.data import DataLoader db = StereoStream(dataset_path, **kwargs) return DataLoader(db, shuffle=False, batch_size=1, num_workers=4) def create_rgbdstream(dataset_path, **kwargs): """ create data_loader to stream images 1 by 1 """ from torch.utils.data import DataLoader db = RGBDStream(dataset_path, **kwargs) return DataLoader(db, shuffle=False, batch_size=1, num_workers=4) ================================================ FILE: VO_Module/droid_slam/data_readers/replica.py ================================================ import numpy as np import torch import glob import cv2 import os import os.path as osp from lietorch import SE3 from .base import RGBDDataset from .stream import RGBDStream cur_path = osp.dirname(osp.abspath(__file__)) test_split = osp.join(cur_path, 'replica_test.txt') test_split = open(test_split).read().split() class Replica(RGBDDataset): # scale depths to balance rot & trans # Replica: 1.0 or even smaller? DEPTH_SCALE = 1.0 def __init__(self, mode='training', **kwargs): self.mode = mode self.n_frames = 2 super(Replica, self).__init__(name='Replica', **kwargs) @staticmethod def is_test_scene(scene): # print(scene, any(x in scene for x in test_split)) return any(x in scene for x in test_split) def _build_dataset(self): from tqdm import tqdm print("Building Replica dataset") scene_info = {} scenes = glob.glob(osp.join(self.root, '*')) for scene in tqdm(sorted(scenes)): images = sorted(glob.glob(osp.join(scene, 'image_left/*.jpg'))) depths = sorted(glob.glob(osp.join(scene, 'depth_left/*.npy'))) poses = np.loadtxt(osp.join(scene, 'pose_left.txt'), delimiter=' ') # tx,ty,tz,qx,qy,qz,qw # poses = poses[:, [1, 2, 0, 4, 5, 3, 6]] # 交换是因为NED frame, 修改坐标轴 poses[:,:3] /= Replica.DEPTH_SCALE intrinsics = [Replica.calib_read()] * len(images) # graph of co-visible frames based on flow graph = self.build_frame_graph(poses, depths, intrinsics) scene = '/'.join(scene.split('/')) scene_info[scene] = {'images': images, 'depths': depths, 'poses': poses, 'intrinsics': intrinsics, 'graph': graph} return scene_info @staticmethod def calib_read(): return np.array([600.0, 600.0, 599.5, 339.5]) @staticmethod def image_read(image_file): return cv2.imread(image_file) @staticmethod def depth_read(depth_file): depth = np.load(depth_file) / Replica.DEPTH_SCALE depth[depth==np.nan] = 1.0 depth[depth==np.inf] = 1.0 return depth class ReplicaStream(RGBDStream): def __init__(self, datapath, **kwargs): super(ReplicaStream, self).__init__(datapath=datapath, **kwargs) def _build_dataset_index(self): """ build list of images, poses, depths, and intrinsics """ self.root = 'datasets/Replica' scene = osp.join(self.root, self.datapath) image_glob = osp.join(scene, 'image_left/*.jpg') images = sorted(glob.glob(image_glob)) poses = np.loadtxt(osp.join(scene, 'pose_left.txt'), delimiter=' ') poses = poses[:, [1, 2, 0, 4, 5, 3, 6]] poses = SE3(torch.as_tensor(poses)) poses = poses[[0]].inv() * poses poses = poses.data.cpu().numpy() intrinsic = self.calib_read(self.datapath) intrinsics = np.tile(intrinsic[None], (len(images), 1)) self.images = images[::int(self.frame_rate)] self.poses = poses[::int(self.frame_rate)] self.intrinsics = intrinsics[::int(self.frame_rate)] @staticmethod def calib_read(datapath): return np.array([600.0, 600.0, 599.5, 339.5]) @staticmethod def image_read(image_file): return cv2.imread(image_file) class ReplicaTestStream(RGBDStream): def __init__(self, datapath, **kwargs): super(ReplicaStream, self).__init__(datapath=datapath, **kwargs) def _build_dataset_index(self): """ build list of images, poses, depths, and intrinsics """ self.root = 'datasets/mono' image_glob = osp.join(self.root, self.datapath, '*.jpg') images = sorted(glob.glob(image_glob)) poses = np.loadtxt(osp.join(self.root, 'mono_gt', self.datapath + '.txt'), delimiter=' ') poses = poses[:, [1, 2, 0, 4, 5, 3, 6]] poses = SE3(torch.as_tensor(poses)) poses = poses[[0]].inv() * poses poses = poses.data.cpu().numpy() intrinsic = self.calib_read(self.datapath) intrinsics = np.tile(intrinsic[None], (len(images), 1)) self.images = images[::int(self.frame_rate)] self.poses = poses[::int(self.frame_rate)] self.intrinsics = intrinsics[::int(self.frame_rate)] @staticmethod def calib_read(datapath): return np.array([600.0, 600.0, 599.5, 339.5]) @staticmethod def image_read(image_file): return cv2.imread(image_file) ================================================ FILE: VO_Module/droid_slam/data_readers/replica_test.txt ================================================ room1 office1 room2 office2 office3 office4 ================================================ FILE: VO_Module/droid_slam/data_readers/replica_utils.py ================================================ from scipy.spatial.transform import Rotation as R import numpy as np import glob import imageio import os.path as osp def get_replica_cam_list(cam_list_dir, base_dir): """ direactly get cam matrix """ cam_list = [] with open(osp.join(base_dir, cam_list_dir), 'r') as f: for line in f.readlines(): if line[0] == '#': continue data = line.strip('\n').split(' ') cam_mat = np.array([float(x) for x in data[:-4]]).reshape(3, 4) cam_list.append(cam_mat) return cam_list def quat_to_rmat(quat): """ input: quat 四元数 list/numpy output: rot matrix 旋转矩阵 numpy mat using numpy """ r = R.from_quat(quat) mat = r.as_matrix() return mat def rmat_to_quad(mat): r = R.from_matrix(mat) quat = r.as_quat() return quat def get_trajectories_quad(cam_list, norm_val=1): trajectories = [] for cam in cam_list: if not isinstance(cam, np.ndarray): np_cam = cam.detach().cpu().numpy() else: np_cam = cam np_cam[:3] /= norm_val trajectories.append(np_cam) return trajectories def get_trajectories_mat(cam_list, norm_val=1): trajectories = [] for cam in cam_list: if not isinstance(cam, np.ndarray): np_cam = cam.detach().cpu().numpy() else: np_cam = cam rot_mat = np_cam[:, 0:3] t_vec = np_cam[:, 3]/norm_val quad = rmat_to_quad(rot_mat) trajectories.append(np.append(t_vec, quad)) return trajectories def build_track_pred_file(gt_time_dir, pred_dir, trajectories, keyframe_freq=1): time_stamp = [] with open(gt_time_dir, 'r') as f: for line in f.readlines(): if line[0] == '#': continue time_stamp.append(line.strip('\n').split(' ')[0]) # time_stamp = time_stamp[::keyframe_freq] trajectories = trajectories[::keyframe_freq] cnt = min(len(trajectories), len(time_stamp)) with open(pred_dir, 'w') as f: for i in range(cnt): data = '' for j in range(7): data += (' '+str(trajectories[i][j])) data = time_stamp[i]+data+'\n' f.write(data) def build_track_pred_file_notime(pred_dir, trajectories, keyframe_freq=1): trajectories = trajectories[::keyframe_freq] cnt = len(trajectories) with open(pred_dir, 'w') as f: for i in range(cnt): s = [] for j in range(7): s.append(str(trajectories[i][j])) data = ' '.join(s) data = data+'\n' f.write(data) def build_timestamps(file_dir, time_num, interval=0.05): cur_time = 0. with open(file_dir, 'w') as f: for _ in range(time_num): s = str(cur_time)+'\n' cur_time += interval f.write(s) def build_depth_npy(root_dir, scene_dir, dep_scale): depths = glob.glob(osp.join(root_dir, scene_dir, 'depth_left/*.png')) for dep in depths: dep_np = imageio.imread(dep) dep_np = dep_np.astype(np.float32) dep_np /= dep_scale dep_np[dep_np == 0] = 1 npy_dir = dep.split('.')[0]+'.npy' np.save(npy_dir, dep_np) if __name__ == '__main__': root_dir = 'datasets/Replica' scene_dir = 'office4' # cam_list = get_replica_cam_list('traj.txt', osp.join(root_dir, scene_dir)) # gt_traj = get_trajectories_mat(cam_list) # build_track_pred_file_notime(osp.join(root_dir, scene_dir, 'pose_left.txt'), # gt_traj, 1) # timestamps_dir = osp.join(root_dir, scene_dir, 'timestamp.txt') # build_timestamps(timestamps_dir, 2000, 0.025) # build_track_pred_file(timestamps_dir, osp.join(root_dir, scene_dir, 'pose_left_tum.txt'), # gt_traj, 1) # dep_scale = 6553.5 # build_depth_npy(root_dir, scene_dir, dep_scale) mat = np.array([-3.205696220032456800e-01, 4.480551946958012954e-01, -8.345547674986967257e-01, 3.452987416406734678e+00, 9.472249560947475500e-01, 1.516354520391845484e-01, - 2.824386167580063001e-01, 4.546110134135947223e-01, 1.078977932490423164e-16, -8.810523436158487209e-01, - 4.730187816662466682e-01, 5.936285447159415085e-01, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 1.000000000000000000e+00, ]).reshape(4, 4) mat2 = mat.copy() mats = np.stack([mat, mat2], axis=0) quads = rmat_to_quad(mats[:, 0:3, 0:3]) print(quads.shape) ================================================ FILE: VO_Module/droid_slam/data_readers/rgbd_utils.py ================================================ import numpy as np import os.path as osp import torch from lietorch import SE3 import geom.projective_ops as pops from scipy.spatial.transform import Rotation def parse_list(filepath, skiprows=0): """ read list data """ data = np.loadtxt(filepath, delimiter=' ', dtype=np.unicode_, skiprows=skiprows) return data def associate_frames(tstamp_image, tstamp_depth, tstamp_pose, max_dt=1.0): """ pair images, depths, and poses """ associations = [] for i, t in enumerate(tstamp_image): if tstamp_pose is None: j = np.argmin(np.abs(tstamp_depth - t)) if (np.abs(tstamp_depth[j] - t) < max_dt): associations.append((i, j)) else: j = np.argmin(np.abs(tstamp_depth - t)) k = np.argmin(np.abs(tstamp_pose - t)) if (np.abs(tstamp_depth[j] - t) < max_dt) and \ (np.abs(tstamp_pose[k] - t) < max_dt): associations.append((i, j, k)) return associations def loadtum(datapath, frame_rate=-1): """ read video data in tum-rgbd format """ if osp.isfile(osp.join(datapath, 'groundtruth.txt')): pose_list = osp.join(datapath, 'groundtruth.txt') elif osp.isfile(osp.join(datapath, 'pose.txt')): pose_list = osp.join(datapath, 'pose.txt') else: return None, None, None, None image_list = osp.join(datapath, 'rgb.txt') depth_list = osp.join(datapath, 'depth.txt') calib_path = osp.join(datapath, 'calibration.txt') intrinsic = None if osp.isfile(calib_path): intrinsic = np.loadtxt(calib_path, delimiter=' ') intrinsic = intrinsic.astype(np.float64) image_data = parse_list(image_list) depth_data = parse_list(depth_list) pose_data = parse_list(pose_list, skiprows=1) pose_vecs = pose_data[:, 1:].astype(np.float64) tstamp_image = image_data[:, 0].astype(np.float64) tstamp_depth = depth_data[:, 0].astype(np.float64) tstamp_pose = pose_data[:, 0].astype(np.float64) associations = associate_frames(tstamp_image, tstamp_depth, tstamp_pose) # print(len(tstamp_image)) # print(len(associations)) indicies = range(len(associations))[::5] # indicies = [ 0 ] # for i in range(1, len(associations)): # t0 = tstamp_image[associations[indicies[-1]][0]] # t1 = tstamp_image[associations[i][0]] # if t1 - t0 > 1.0 / frame_rate: # indicies += [ i ] images, poses, depths, intrinsics, tstamps = [], [], [], [], [] for ix in indicies: (i, j, k) = associations[ix] images += [osp.join(datapath, image_data[i, 1])] depths += [osp.join(datapath, depth_data[j, 1])] poses += [pose_vecs[k]] tstamps += [tstamp_image[i]] if intrinsic is not None: intrinsics += [intrinsic] return images, depths, poses, intrinsics, tstamps def all_pairs_distance_matrix(poses, beta=2.5): """ compute distance matrix between all pairs of poses """ poses = np.array(poses, dtype=np.float32) poses[:, :3] *= beta # scale to balence rot + trans poses = SE3(torch.from_numpy(poses)) r = (poses[:, None].inv() * poses[None, :]).log() return r.norm(dim=-1).cpu().numpy() def pose_matrix_to_quaternion(pose): """ convert 4x4 pose matrix to (t, q) """ q = Rotation.from_matrix(pose[:3, :3]).as_quat() return np.concatenate([pose[:3, 3], q], axis=0) def compute_distance_matrix_flow(poses, disps, intrinsics, need_inv=True): """ compute flow magnitude between all pairs of frames """ if not isinstance(poses, SE3): poses = torch.from_numpy(poses).float().cuda()[None] if need_inv: poses = SE3(poses).inv() else: poses = SE3(poses) disps = torch.from_numpy(disps).float().cuda()[None] intrinsics = torch.from_numpy(intrinsics).float().cuda()[None] N = poses.shape[1] ii, jj = torch.meshgrid(torch.arange(N), torch.arange(N)) ii = ii.reshape(-1).cuda() jj = jj.reshape(-1).cuda() MAX_FLOW = 100.0 matrix = np.zeros((N, N), dtype=np.float32) s = 2048 for i in range(0, ii.shape[0], s): flow1, val1 = pops.induced_flow( poses, disps, intrinsics, ii[i:i+s], jj[i:i+s]) flow2, val2 = pops.induced_flow( poses, disps, intrinsics, jj[i:i+s], ii[i:i+s]) flow = torch.stack([flow1, flow2], dim=2) val = torch.stack([val1, val2], dim=2) mag = flow.norm(dim=-1).clamp(max=MAX_FLOW) mag = mag.view(mag.shape[1], -1) val = val.view(val.shape[1], -1) mag = (mag * val).mean(-1) / val.mean(-1) mag[val.mean(-1) < 0.7] = np.inf i1 = ii[i:i+s].cpu().numpy() j1 = jj[i:i+s].cpu().numpy() matrix[i1, j1] = mag.cpu().numpy() return matrix def compute_distance_matrix_flow2(poses, disps, intrinsics, beta=0.4): """ compute flow magnitude between all pairs of frames """ # if not isinstance(poses, SE3): # poses = torch.from_numpy(poses).float().cuda()[None] # poses = SE3(poses).inv() # disps = torch.from_numpy(disps).float().cuda()[None] # intrinsics = torch.from_numpy(intrinsics).float().cuda()[None] N = poses.shape[1] ii, jj = torch.meshgrid(torch.arange(N), torch.arange(N)) ii = ii.reshape(-1) jj = jj.reshape(-1) MAX_FLOW = 128.0 matrix = np.zeros((N, N), dtype=np.float32) s = 2048 for i in range(0, ii.shape[0], s): flow1a, val1a = pops.induced_flow( poses, disps, intrinsics, ii[i:i+s], jj[i:i+s], tonly=True) flow1b, val1b = pops.induced_flow( poses, disps, intrinsics, ii[i:i+s], jj[i:i+s]) flow2a, val2a = pops.induced_flow( poses, disps, intrinsics, jj[i:i+s], ii[i:i+s], tonly=True) flow2b, val2b = pops.induced_flow( poses, disps, intrinsics, ii[i:i+s], jj[i:i+s]) flow1 = flow1a + beta * flow1b val1 = val1a * val2b flow2 = flow2a + beta * flow2b val2 = val2a * val2b flow = torch.stack([flow1, flow2], dim=2) val = torch.stack([val1, val2], dim=2) mag = flow.norm(dim=-1).clamp(max=MAX_FLOW) mag = mag.view(mag.shape[1], -1) val = val.view(val.shape[1], -1) mag = (mag * val).mean(-1) / val.mean(-1) mag[val.mean(-1) < 0.8] = np.inf i1 = ii[i:i+s].cpu().numpy() j1 = jj[i:i+s].cpu().numpy() matrix[i1, j1] = mag.cpu().numpy() return matrix ================================================ FILE: VO_Module/droid_slam/data_readers/stream.py ================================================ import numpy as np import torch import torch.utils.data as data import torch.nn.functional as F import csv import os import cv2 import math import random import json import pickle import os.path as osp from .rgbd_utils import * class RGBDStream(data.Dataset): def __init__(self, datapath, frame_rate=-1, image_size=[384,512], crop_size=[0,0]): self.datapath = datapath self.frame_rate = frame_rate self.image_size = image_size self.crop_size = crop_size self._build_dataset_index() @staticmethod def image_read(image_file): return cv2.imread(image_file) @staticmethod def depth_read(depth_file): return np.load(depth_file) def __len__(self): return len(self.images) def __getitem__(self, index): """ return training video """ image = self.__class__.image_read(self.images[index]) image = torch.from_numpy(image).float() image = image.permute(2, 0, 1) try: tstamp = self.tstamps[index] except: tstamp = index pose = torch.from_numpy(self.poses[index]).float() intrinsic = torch.from_numpy(self.intrinsics[index]).float() # resize image sx = self.image_size[1] / image.shape[2] sy = self.image_size[0] / image.shape[1] image = F.interpolate(image[None], self.image_size, mode='bilinear', align_corners=False)[0] fx, fy, cx, cy = intrinsic.unbind(dim=0) fx, cx = sx * fx, sx * cx fy, cy = sy * fy, sy * cy # crop image if self.crop_size[0] > 0: cy = cy - self.crop_size[0] image = image[:,self.crop_size[0]:-self.crop_size[0],:] if self.crop_size[1] > 0: cx = cx - self.crop_size[1] image = image[:,:,self.crop_size[1]:-self.crop_size[1]] intrinsic = torch.stack([fx, fy, cx, cy]) return tstamp, image, pose, intrinsic class ImageStream(data.Dataset): def __init__(self, datapath, intrinsics, rate=1, image_size=[384,512]): rgb_list = osp.join(datapath, 'rgb.txt') if os.path.isfile(rgb_list): rgb_list = np.loadtxt(rgb_list, delimiter=' ', dtype=np.unicode_) self.timestamps = rgb_list[:,0].astype(np.float) self.images = [os.path.join(datapath, x) for x in rgb_list[:,1]] self.images = self.images[::rate] self.timestamps = self.timestamps[::rate] else: import glob self.images = sorted(glob.glob(osp.join(datapath, '*.jpg'))) + sorted(glob.glob(osp.join(datapath, '*.png'))) self.images = self.images[::rate] self.intrinsics = intrinsics self.image_size = image_size def __len__(self): return len(self.images) @staticmethod def image_read(imfile): return cv2.imread(imfile) def __getitem__(self, index): """ return training video """ image = self.__class__.image_read(self.images[index]) try: tstamp = self.timestamps[index] except: tstamp = index ht0, wd0 = image.shape[:2] ht1, wd1 = self.image_size intrinsics = torch.as_tensor(self.intrinsics) intrinsics[0] *= wd1 / wd0 intrinsics[1] *= ht1 / ht0 intrinsics[2] *= wd1 / wd0 intrinsics[3] *= ht1 / ht0 # resize image ikwargs = {'mode': 'bilinear', 'align_corners': True} image = torch.from_numpy(image).float().permute(2, 0, 1) image = F.interpolate(image[None], self.image_size, **ikwargs)[0] return tstamp, image, intrinsics class StereoStream(data.Dataset): def __init__(self, datapath, intrinsics, rate=1, image_size=[384,512], map_left=None, map_right=None, left_root='image_left', right_root='image_right'): import glob self.intrinsics = intrinsics self.image_size = image_size imgs = sorted(glob.glob(osp.join(datapath, left_root, '*.png')))[::rate] self.images_l = [] self.images_r = [] self.tstamps = [] for img_l in imgs: img_r = img_l.replace(left_root, right_root) if os.path.isfile(img_r): t = np.float(img_l.split('/')[-1].replace('.png', '')) self.tstamps.append(t) self.images_l += [ img_l ] self.images_r += [ img_r ] self.map_left = map_left self.map_right = map_right def __len__(self): return len(self.images_l) @staticmethod def image_read(imfile, imap=None): image = cv2.imread(imfile) if imap is not None: image = cv2.remap(image, imap[0], imap[1], interpolation=cv2.INTER_LINEAR) return image def __getitem__(self, index): """ return training video """ tstamp = self.tstamps[index] image_l = self.__class__.image_read(self.images_l[index], self.map_left) image_r = self.__class__.image_read(self.images_r[index], self.map_right) ht0, wd0 = image_l.shape[:2] ht1, wd1 = self.image_size intrinsics = torch.as_tensor(self.intrinsics) intrinsics[0] *= wd1 / wd0 intrinsics[1] *= ht1 / ht0 intrinsics[2] *= wd1 / wd0 intrinsics[3] *= ht1 / ht0 image_l = torch.from_numpy(image_l).float().permute(2, 0, 1) image_r = torch.from_numpy(image_r).float().permute(2, 0, 1) # resize image ikwargs = {'mode': 'bilinear', 'align_corners': True} image_l = F.interpolate(image_l[None], self.image_size, **ikwargs)[0] image_r = F.interpolate(image_r[None], self.image_size, **ikwargs)[0] return tstamp, image_l, image_r, intrinsics # class RGBDStream(data.Dataset): # def __init__(self, datapath, intrinsics=None, rate=1, image_size=[384,512]): # assoc_file = osp.join(datapath, 'associated.txt') # assoc_list = np.loadtxt(assoc_file, delimiter=' ', dtype=np.unicode_) # self.intrinsics = intrinsics # self.image_size = image_size # self.timestamps = assoc_list[:,0].astype(np.float)[::rate] # self.images = [os.path.join(datapath, x) for x in assoc_list[:,1]][::rate] # self.depths = [os.path.join(datapath, x) for x in assoc_list[:,3]][::rate] # def __len__(self): # return len(self.images) # @staticmethod # def image_read(imfile): # return cv2.imread(imfile) # @staticmethod # def depth_read(depth_file): # depth = cv2.imread(depth_file, cv2.IMREAD_ANYDEPTH) # return depth.astype(np.float32) / 5000.0 # def __getitem__(self, index): # """ return training video """ # tstamp = self.timestamps[index] # image = self.__class__.image_read(self.images[index]) # depth = self.__class__.depth_read(self.depths[index]) # ht0, wd0 = image.shape[:2] # ht1, wd1 = self.image_size # intrinsics = torch.as_tensor(self.intrinsics) # intrinsics[0] *= wd1 / wd0 # intrinsics[1] *= ht1 / ht0 # intrinsics[2] *= wd1 / wd0 # intrinsics[3] *= ht1 / ht0 # # resize image # ikwargs = {'mode': 'bilinear', 'align_corners': True} # image = torch.from_numpy(image).float().permute(2, 0, 1) # image = F.interpolate(image[None], self.image_size, **ikwargs)[0] # depth = torch.from_numpy(depth).float()[None,None] # depth = F.interpolate(depth, self.image_size, mode='nearest').squeeze() # return tstamp, image, depth, intrinsics ================================================ FILE: VO_Module/droid_slam/data_readers/tartan.py ================================================ import numpy as np import torch import glob import cv2 import os import os.path as osp from lietorch import SE3 from .base import RGBDDataset from .stream import RGBDStream cur_path = osp.dirname(osp.abspath(__file__)) test_split = osp.join(cur_path, 'tartan_test.txt') test_split = open(test_split).read().split() class TartanAir(RGBDDataset): # scale depths to balance rot & trans DEPTH_SCALE = 5.0 def __init__(self, mode='training', **kwargs): self.mode = mode self.n_frames = 2 super(TartanAir, self).__init__(name='TartanAir', **kwargs) @staticmethod def is_test_scene(scene): # print(scene, any(x in scene for x in test_split)) return any(x in scene for x in test_split) def _build_dataset(self): from tqdm import tqdm print("Building TartanAir dataset") scene_info = {} scenes = glob.glob(osp.join(self.root, '*/*/*/*')) for scene in tqdm(sorted(scenes)): # [:-1]为了与mask对齐 images = sorted( glob.glob(osp.join(scene, 'image_left/*.png')))[:-1] depths = sorted( glob.glob(osp.join(scene, 'depth_left/*.npy')))[:-1] poses = np.loadtxt( osp.join(scene, 'pose_left.txt'), delimiter=' ') poses = poses[:-1, [1, 2, 0, 4, 5, 3, 6]] poses[:, :3] /= TartanAir.DEPTH_SCALE intrinsics = [TartanAir.calib_read()] * len(images) # graph of co-visible frames based on flow graph = self.build_frame_graph(poses, depths, intrinsics) masks = sorted(glob.glob(osp.join(scene, 'flow/*mask.npy'))) scene = '/'.join(scene.split('/')) scene_info[scene] = {'images': images, 'depths': depths, 'dymasks': masks, 'poses': poses, 'intrinsics': intrinsics, 'graph': graph} return scene_info @staticmethod def calib_read(): return np.array([320.0, 320.0, 320.0, 240.0]) @staticmethod def image_read(image_file): return cv2.imread(image_file) @staticmethod def depth_read(depth_file): depth = np.load(depth_file) / TartanAir.DEPTH_SCALE depth[depth == np.nan] = 1.0 depth[depth == np.inf] = 1.0 return depth @staticmethod def dymask_read(mask_file): content1 = (np.load(mask_file) <= 0).astype(np.float32) content2 = np.ones_like(content1) return content1, content2 class TartanAirStream(RGBDStream): def __init__(self, datapath, **kwargs): super(TartanAirStream, self).__init__(datapath=datapath, **kwargs) def _build_dataset_index(self): """ build list of images, poses, depths, and intrinsics """ self.root = 'datasets/TartanAir' scene = osp.join(self.root, self.datapath) image_glob = osp.join(scene, 'image_left/*.png') images = sorted(glob.glob(image_glob)) poses = np.loadtxt(osp.join(scene, 'pose_left.txt'), delimiter=' ') poses = poses[:, [1, 2, 0, 4, 5, 3, 6]] poses = SE3(torch.as_tensor(poses)) poses = poses[[0]].inv() * poses poses = poses.data.cpu().numpy() intrinsic = self.calib_read(self.datapath) intrinsics = np.tile(intrinsic[None], (len(images), 1)) self.images = images[::int(self.frame_rate)] self.poses = poses[::int(self.frame_rate)] self.intrinsics = intrinsics[::int(self.frame_rate)] @staticmethod def calib_read(datapath): return np.array([320.0, 320.0, 320.0, 240.0]) @staticmethod def image_read(image_file): return cv2.imread(image_file) class TartanAirTestStream(RGBDStream): def __init__(self, datapath, **kwargs): super(TartanAirTestStream, self).__init__(datapath=datapath, **kwargs) def _build_dataset_index(self): """ build list of images, poses, depths, and intrinsics """ self.root = 'datasets/mono' image_glob = osp.join(self.root, self.datapath, '*.png') images = sorted(glob.glob(image_glob)) poses = np.loadtxt(osp.join(self.root, 'mono_gt', self.datapath + '.txt'), delimiter=' ') poses = poses[:, [1, 2, 0, 4, 5, 3, 6]] poses = SE3(torch.as_tensor(poses)) poses = poses[[0]].inv() * poses poses = poses.data.cpu().numpy() intrinsic = self.calib_read(self.datapath) intrinsics = np.tile(intrinsic[None], (len(images), 1)) self.images = images[::int(self.frame_rate)] self.poses = poses[::int(self.frame_rate)] self.intrinsics = intrinsics[::int(self.frame_rate)] @staticmethod def calib_read(datapath): return np.array([320.0, 320.0, 320.0, 240.0]) @staticmethod def image_read(image_file): return cv2.imread(image_file) ================================================ FILE: VO_Module/droid_slam/data_readers/tartan_test.txt ================================================ abandonedfactory/abandonedfactory/Easy/P011 abandonedfactory/abandonedfactory/Hard/P011 abandonedfactory_night/abandonedfactory_night/Easy/P013 abandonedfactory_night/abandonedfactory_night/Hard/P014 amusement/amusement/Easy/P008 amusement/amusement/Hard/P007 carwelding/carwelding/Easy/P007 endofworld/endofworld/Easy/P009 gascola/gascola/Easy/P008 gascola/gascola/Hard/P009 hospital/hospital/Easy/P036 hospital/hospital/Hard/P049 japanesealley/japanesealley/Easy/P007 japanesealley/japanesealley/Hard/P005 neighborhood/neighborhood/Easy/P021 neighborhood/neighborhood/Hard/P017 ocean/ocean/Easy/P013 ocean/ocean/Hard/P009 office2/office2/Easy/P011 office2/office2/Hard/P010 office/office/Hard/P007 oldtown/oldtown/Easy/P007 oldtown/oldtown/Hard/P008 seasidetown/seasidetown/Easy/P009 seasonsforest/seasonsforest/Easy/P011 seasonsforest/seasonsforest/Hard/P006 seasonsforest_winter/seasonsforest_winter/Easy/P009 seasonsforest_winter/seasonsforest_winter/Hard/P018 soulcity/soulcity/Easy/P012 soulcity/soulcity/Hard/P009 westerndesert/westerndesert/Easy/P013 westerndesert/westerndesert/Hard/P007 ================================================ FILE: VO_Module/droid_slam/data_readers/vkitti2.py ================================================ import numpy as np import torch import glob import cv2 import os import os.path as osp from scipy.spatial.transform import Rotation as R from lietorch import SE3 from torch.functional import split from .base import RGBDDataset from .stream import RGBDStream from panopticapi.utils import rgb2id import PIL.Image as Image def rmat_to_quad(mat): r = R.from_matrix(mat) quat = r.as_quat() return quat class VKitti2(RGBDDataset): # scale depths to balance rot & trans DEPTH_SCALE = 5.0 split = { 'train': 'clone', 'val': '15-deg-left', 'test': '30-deg-right' } scenes = ['Scene18', 'Scene20' , 'Scene06', 'Scene02', 'Scene01'] print(scenes) def __init__(self, split_mode='train', foo=False, scene_id='Scene01', **kwargs): self.split_mode = split_mode self.n_frames = 2 self.foo = foo self.test_split = [x for x in VKitti2.scenes if x != scene_id] super(VKitti2, self).__init__(name='VKitti2', **kwargs) # @staticmethod def is_test_scene(self, scene): return any(x in scene for x in self.test_split) def _build_dataset(self): from tqdm import tqdm print("Building VKitti2 dataset") scenes = VKitti2.scenes scene_info = {} for scene in tqdm(sorted(scenes)): scene = osp.join(self.root, scene) images = sorted( glob.glob(osp.join(scene, VKitti2.split[self.split_mode], 'frames/rgb/Camera_0/*.jpg'))) depths = sorted( glob.glob(osp.join( scene, VKitti2.split[self.split_mode], 'frames/depth/Camera_0/*.png'))) poses = np.loadtxt( osp.join(scene, VKitti2.split[self.split_mode], 'extrinsic.txt'), delimiter=' ', skiprows=1)[::2, 2:] if self.foo: images = np.array(images) depths = np.array(depths) val_num = images.shape[0] // 7 train_num = images.shape[0] - val_num - val_num print(val_num,'\n',images[train_num], "\n", images[train_num+val_num-1]) images = images[train_num:train_num + val_num] depths = depths[train_num:train_num + val_num] poses = poses[train_num:train_num + val_num] print(poses.shape) images.tolist() depths.tolist() poses = poses.reshape(-1, 4, 4) r = rmat_to_quad(poses[:, 0:3, 0:3]) t = poses[:, :3, 3] / VKitti2.DEPTH_SCALE poses = np.concatenate((t, r), axis=1) intrinsics = [VKitti2.calib_read()] * len(images) scene = '/'.join(scene.split('/')) # graph of co-visible frames based on flow graph = None if self.aug_graph: graph = self.build_frame_graph(poses, depths, intrinsics) if self.flow_label: fo_flows = sorted( glob.glob(osp.join(scene, VKitti2.split[self.split_mode], 'frames/forwardFlow/Camera_0/*.png'))) ba_flows = sorted( glob.glob(osp.join(scene, VKitti2.split[self.split_mode], 'frames/backwardFlow/Camera_0/*.png'))) segments = sorted( glob.glob(osp.join(scene, VKitti2.split[self.split_mode], 'panoptic_gt_id/*.png'))) scene_info[scene] = {'images': images, 'depths': depths, 'fo_flows': fo_flows, 'ba_flows': ba_flows, 'poses': poses, 'intrinsics': intrinsics, 'segments' : segments} else: masks = sorted( glob.glob(osp.join(scene, VKitti2.split[self.split_mode], 'frames/dynamicMask/Camera_0/*.npy'))) segments = sorted( glob.glob(osp.join(scene, VKitti2.split[self.split_mode], 'panFPN_segm/*.png'))) scene_info[scene] = {'images': images, 'depths': depths, 'dymasks': masks, 'poses': poses, 'intrinsics': intrinsics, 'graph': graph, 'segments': segments, } print('segments' in scene_info[scene]) return scene_info @staticmethod def calib_read(): return np.array([725.0087, 725.0087, 620.5, 187]) @staticmethod def image_read(image_file): return cv2.imread(image_file) @staticmethod def depth_read(depth_file): depth = cv2.imread(depth_file, cv2.IMREAD_ANYCOLOR | cv2.IMREAD_ANYDEPTH) / (VKitti2.DEPTH_SCALE*100) depth[depth == np.nan] = 1.0 depth[depth == np.inf] = 1.0 depth[depth == 0] = 1.0 return depth @staticmethod def flow_read(flow_file): bgr = cv2.imread(flow_file, cv2.IMREAD_ANYCOLOR | cv2.IMREAD_ANYDEPTH) h, w, _c = bgr.shape out_flow = 2.0 / (2**16 - 1.0) * bgr[..., 2:0:-1].astype('f4') - 1 out_flow[..., 0] *= w - 1 out_flow[..., 1] *= h - 1 val = (bgr[..., 0] > 0).astype(np.float32) return out_flow, val @staticmethod def dymask_read(mask_file): content = np.load(mask_file) return content[..., 0], content[..., 1] @staticmethod def segment_read(segment_file): segment = rgb2id(np.array(Image.open(segment_file))) return segment class VKitti2Stream(RGBDStream): def __init__(self, datapath, **kwargs): super(VKitti2Stream, self).__init__(datapath=datapath, **kwargs) def _build_dataset_index(self): """ build list of images, poses, depths, and intrinsics """ self.root = 'datasets/VKitti2' scene = osp.join(self.root, self.datapath) image_glob = osp.join(scene, 'image_left/*.png') images = sorted(glob.glob(image_glob)) poses = np.loadtxt(osp.join(scene, 'pose_left.txt'), delimiter=' ') poses = poses[:, [1, 2, 0, 4, 5, 3, 6]] poses = SE3(torch.as_tensor(poses)) poses = poses[[0]].inv() * poses poses = poses.data.cpu().numpy() intrinsic = self.calib_read(self.datapath) intrinsics = np.tile(intrinsic[None], (len(images), 1)) self.images = images[::int(self.frame_rate)] self.poses = poses[::int(self.frame_rate)] self.intrinsics = intrinsics[::int(self.frame_rate)] @staticmethod def calib_read(datapath): return np.array([320.0, 320.0, 320.0, 240.0]) @staticmethod def image_read(image_file): return cv2.imread(image_file) class VKitti2TestStream(RGBDStream): def __init__(self, datapath, **kwargs): super(VKitti2TestStream, self).__init__(datapath=datapath, **kwargs) def _build_dataset_index(self): """ build list of images, poses, depths, and intrinsics """ self.root = 'datasets/mono' image_glob = osp.join(self.root, self.datapath, '*.png') images = sorted(glob.glob(image_glob)) poses = np.loadtxt(osp.join(self.root, 'mono_gt', self.datapath + '.txt'), delimiter=' ') poses = poses[:, [1, 2, 0, 4, 5, 3, 6]] poses = SE3(torch.as_tensor(poses)) poses = poses[[0]].inv() * poses poses = poses.data.cpu().numpy() intrinsic = self.calib_read(self.datapath) intrinsics = np.tile(intrinsic[None], (len(images), 1)) self.images = images[::int(self.frame_rate)] self.poses = poses[::int(self.frame_rate)] self.intrinsics = intrinsics[::int(self.frame_rate)] @staticmethod def calib_read(datapath): return np.array([320.0, 320.0, 320.0, 240.0]) @staticmethod def image_read(image_file): return cv2.imread(image_file) ================================================ FILE: VO_Module/droid_slam/depth_video.py ================================================ import numpy as np import torch import lietorch import droid_backends from torch.multiprocessing import Process, Queue, Lock, Value from collections import OrderedDict from droid_net import cvx_upsample import geom.projective_ops as pops from geom.ba import BA from lietorch import SO3, SE3, Sim3 class DepthVideo: def __init__(self, image_size=[480, 640], buffer=1024, device="cuda:0", segm_filter=False, thresh=0.8): # current keyframe count self.counter = Value('i', 0) self.ready = Value('i', 0) self.ht = ht = image_size[0] self.wd = wd = image_size[1] self.device = device ### state attributes ### self.tstamp = torch.zeros( buffer, device=device, dtype=torch.float).share_memory_() self.images = torch.zeros( buffer, 3, ht, wd, device=device, dtype=torch.uint8) self.dirty = torch.zeros( buffer, device=device, dtype=torch.bool).share_memory_() self.red = torch.zeros(buffer, device=device, dtype=torch.bool).share_memory_() self.poses = torch.zeros( buffer, 7, device=device, dtype=torch.float).share_memory_() self.disps = torch.ones( buffer, ht//8, wd//8, device=device, dtype=torch.float).share_memory_() self.disps_up = torch.zeros( buffer, ht, wd, device=device, dtype=torch.float).share_memory_() self.intrinsics = torch.zeros( buffer, 4, device=device, dtype=torch.float).share_memory_() ### feature attributes ### self.fmaps = torch.zeros( buffer, 128, ht//8, wd//8, dtype=torch.half, device=device).share_memory_() self.nets = torch.zeros( buffer, 128, ht//8, wd//8, dtype=torch.half, device=device).share_memory_() self.inps = torch.zeros( buffer, 128, ht//8, wd//8,dtype=torch.half, device=device).share_memory_() # initialize poses to identity transformation self.poses[:] = torch.as_tensor( [0, 0, 0, 0, 0, 0, 1], dtype=torch.float, device=device) # new adding self.segms = torch.zeros( buffer, 1, ht//8, wd//8,dtype=torch.int, device=device).share_memory_() self.full_flow = torch.ones( buffer, ht//8, wd//8, 2,device=device, dtype=torch.float).share_memory_() self.segm_filter = segm_filter self.thresh = thresh def get_lock(self): return self.counter.get_lock() def __item_setter(self, index, item): if isinstance(index, int) and index >= self.counter.value: self.counter.value = index + 1 elif isinstance(index, torch.Tensor) and index.max().item() > self.counter.value: self.counter.value = index.max().item() + 1 # self.dirty[index] = True self.tstamp[index] = item[0] self.images[index] = item[1] if item[2] is not None: self.poses[index] = item[2] if item[3] is not None: self.disps[index] = item[3] if item[4] is not None: self.intrinsics[index] = item[4] if len(item) > 5: self.fmaps[index] = item[5] if len(item) > 6: self.nets[index] = item[6] if len(item) > 7: self.inps[index] = item[7] if self.segm_filter and len(item) > 8: self.segms[index] = item[8] def __setitem__(self, index, item): with self.get_lock(): self.__item_setter(index, item) def __getitem__(self, index): """ index the depth video """ with self.get_lock(): # support negative indexing if isinstance(index, int) and index < 0: index = self.counter.value + index item = ( self.poses[index], self.disps[index], self.intrinsics[index], self.fmaps[index], self.nets[index], self.inps[index]) return item def append(self, *item): with self.get_lock(): self.__item_setter(self.counter.value, item) ### geometric operations ### @staticmethod def format_indicies(ii, jj, device): """ to device, long, {-1} """ if not isinstance(ii, torch.Tensor): ii = torch.as_tensor(ii) if not isinstance(jj, torch.Tensor): jj = torch.as_tensor(jj) ii = ii.to(device=device, dtype=torch.long).reshape(-1) jj = jj.to(device=device, dtype=torch.long).reshape(-1) return ii, jj def upsample(self, ix, mask): """ upsample disparity """ disps_up = cvx_upsample(self.disps[ix].unsqueeze(-1), mask) self.disps_up[ix] = disps_up.squeeze() def normalize(self): """ normalize depth and poses """ with self.get_lock(): s = self.disps[:self.counter.value].mean() self.disps[:self.counter.value] /= s self.poses[:self.counter.value, :3] *= s self.dirty[:self.counter.value] = True def reproject(self, ii, jj): """ project points from ii -> jj """ ii, jj = DepthVideo.format_indicies(ii, jj, self.device) Gs = lietorch.SE3(self.poses[None]) coords, valid_mask = \ pops.projective_transform( Gs, self.disps[None], self.intrinsics[None], ii, jj) return coords, valid_mask def distance(self, ii=None, jj=None, beta=0.3, bidirectional=True): """ frame distance metric """ return_matrix = False if ii is None: return_matrix = True N = self.counter.value ii, jj = torch.meshgrid(torch.arange(N), torch.arange(N)) ii, jj = DepthVideo.format_indicies(ii, jj, self.device) if bidirectional: poses = self.poses[:self.counter.value].clone() d1 = droid_backends.frame_distance( poses, self.disps, self.intrinsics[0], ii, jj, beta) d2 = droid_backends.frame_distance( poses, self.disps, self.intrinsics[0], jj, ii, beta) d = .5 * (d1 + d2) else: d = droid_backends.frame_distance( self.poses, self.disps, self.intrinsics[0], ii, jj, beta) if return_matrix: return d.reshape(N, N) return d def ba(self, target, weight, eta, ii, jj, t0=1, t1=None, itrs=2, lm=1e-4, ep=0.1, motion_only=False): """ dense bundle adjustment (DBA) """ with self.get_lock(): # [t0, t1] window of bundle adjustment optimization if t1 is None: t1 = max(ii.max().item(), jj.max().item()) + 1 if eta is None: k = torch.unique(torch.cat([ii, jj], 0)).shape[0] eta = 1e-7 * \ torch.ones([k, self.ht//8, self.wd//8], device=self.device) droid_backends.ba(self.poses, self.disps, self.intrinsics[0], target, weight, eta, ii, jj, t0, t1, itrs, lm, ep, motion_only) self.disps.clamp_(min=0.001) ================================================ FILE: VO_Module/droid_slam/droid.py ================================================ import torch import torch.nn.functional as F import lietorch import numpy as np from droid_net import DroidNet from depth_video import DepthVideo from motion_filter import MotionFilter from droid_frontend import DroidFrontend from droid_backend import DroidBackend from trajectory_filler import PoseTrajectoryFiller from collections import OrderedDict from torch.multiprocessing import Process import lietorch from lietorch import SE3 class Droid: def __init__(self, args): super(Droid, self).__init__() self.args = args self.load_weights(args.weights, args.use_aff_bri) self.disable_vis = args.disable_vis # store images, depth, poses, intrinsics (shared between processes) print( "use segment filter:",args.segm_filter) self.video = DepthVideo(args.image_size, args.buffer, args.device, args.segm_filter, args.thresh) # filter incoming frames so that there is enough motion self.filterx = MotionFilter( self.net, self.video, thresh=args.filter_thresh, device=args.device) # frontend process self.frontend = DroidFrontend(self.net, self.video, self.args) # backend process self.backend = DroidBackend(self.net, self.video, self.args) # visualizer if not self.disable_vis: from visualization import droid_visualization self.visualizer = Process( target=droid_visualization, args=(self.video, args.device)) self.visualizer.start() # post processor - fill in poses for non-keyframes self.traj_filler = PoseTrajectoryFiller( self.net, self.video, args.device) def load_weights(self, weights, use_aff_bri=False): """ load trained model weights """ self.net = DroidNet(use_aff_bri) state_dict = OrderedDict([ (k.replace("module.", ""), v) for (k, v) in torch.load(weights, self.args.device).items()]) self.net.load_state_dict(state_dict) self.net.to(self.args.device).eval() def track(self, tstamp, image, depth=None, intrinsics=None, segments=None): """ main thread - update map """ with torch.no_grad(): # check there is enough motion self.filterx.track(tstamp, image, depth, intrinsics, segments) # local bundle adjustment self.frontend() # global bundle adjustment # self.backend() def terminate(self, stream=None, need_inv=True): """ terminate the visualization process, return poses [t, q] """ del self.frontend torch.cuda.empty_cache() print("#" * 32) self.backend(7) torch.cuda.empty_cache() print("#" * 32) self.backend(12) camera_trajectory = self.traj_filler(stream) if need_inv: return camera_trajectory.inv().data.cpu().numpy() else: # for vkitti2(already w2c) return camera_trajectory.data.cpu().numpy() def get_traj(self): Gs = SE3(self.video.poses[:self.video.counter.value]) return lietorch.cat([Gs], 0).data.cpu().numpy() def get_depth(self): depth = upsample_inter(self.video.disps[:self.video.counter.value].unsqueeze(0).unsqueeze(4)).squeeze(4).squeeze(0) return depth def get_flow(self): flow = upsample_inter(self.video.full_flow[:self.video.counter.value].unsqueeze(0)*8) return flow def upsample_inter(mask): batch, num, ht, wd, dim = mask.shape mask = mask.permute(0, 1, 4, 2, 3).contiguous() mask = mask.view(batch*num, dim, ht, wd) mask = F.interpolate(mask, scale_factor=8, mode='bilinear', align_corners=True, recompute_scale_factor=True) mask = mask.permute(0, 2, 3, 1).contiguous() return mask.view(batch, num, 8*ht, 8*wd, dim) ================================================ FILE: VO_Module/droid_slam/droid_backend.py ================================================ import torch import lietorch import numpy as np from lietorch import SE3 from factor_graph import FactorGraph class DroidBackend: def __init__(self, net, video, args): self.video = video self.update_op = net.update self.device = args.device # global optimization window self.t0 = 0 self.t1 = 0 self.beta = args.beta self.backend_thresh = args.backend_thresh self.backend_radius = args.backend_radius self.backend_nms = args.backend_nms @torch.no_grad() def __call__(self, steps=12): """ main update """ t = self.video.counter.value self.video.normalize() graph = FactorGraph(self.video, self.update_op, self.device, corr_impl="alt", max_factors=100000) graph.add_proximity_factors(rad=self.backend_radius, nms=self.backend_nms, thresh=self.backend_thresh, beta=self.beta) graph.update_lowmem(steps=steps) graph.clear_edges() self.video.dirty[:t] = True ================================================ FILE: VO_Module/droid_slam/droid_frontend.py ================================================ import torch import lietorch import numpy as np from lietorch import SE3 from factor_graph import FactorGraph class DroidFrontend: def __init__(self, net, video, args): self.video = video self.update_op = net.update self.graph = FactorGraph( video, net.update, args.device, max_factors=48) # local optimization window self.t0 = 0 self.t1 = 0 # frontent variables self.is_initialized = False self.count = 0 self.max_age = 25 self.iters1 = 4 self.iters2 = 2 self.warmup = args.warmup self.beta = args.beta self.frontend_nms = args.frontend_nms self.keyframe_thresh = args.keyframe_thresh self.frontend_window = args.frontend_window self.frontend_thresh = args.frontend_thresh self.frontend_radius = args.frontend_radius def __update(self): """ add edges, perform update """ self.count += 1 self.t1 += 1 if self.graph.corr is not None: self.graph.rm_factors(self.graph.age > self.max_age, store=True) self.graph.add_proximity_factors(self.t1-5, max(self.t1-self.frontend_window, 0), rad=self.frontend_radius, nms=self.frontend_nms, thresh=self.frontend_thresh, beta=self.beta, remove=True) for itr in range(self.iters1): self.graph.update(None, None, use_inactive=True) # set initial pose for next frame ------------ 删除 帧 ----------------- poses = SE3(self.video.poses) d = self.video.distance( [self.t1-3], [self.t1-2], beta=self.beta, bidirectional=True) if d.item() < self.keyframe_thresh: self.graph.rm_keyframe(self.t1 - 2) with self.video.get_lock(): self.video.counter.value -= 1 self.t1 -= 1 else: for itr in range(self.iters2): self.graph.update(None, None, use_inactive=True) # set pose for next itration self.video.poses[self.t1] = self.video.poses[self.t1-1] self.video.disps[self.t1] = self.video.disps[self.t1-1].mean() # self.video.full_flow[self.graph.ii] = self.graph.full_flow # update visualization self.video.dirty[self.graph.ii.min():self.t1] = True def __initialize(self): """ initialize the SLAM system """ self.t0 = 0 self.t1 = self.video.counter.value self.graph.add_neighborhood_factors(self.t0, self.t1, r=3) for itr in range(8): self.graph.update(1, use_inactive=True) self.graph.add_proximity_factors( 0, 0, rad=2, nms=2, thresh=self.frontend_thresh) for itr in range(12): self.graph.update(1, use_inactive=True) # self.video.normalize() self.video.poses[self.t1] = self.video.poses[self.t1-1].clone() self.video.disps[self.t1] = self.video.disps[self.t1-4:self.t1].mean() # initialization complete self.is_initialized = True self.last_pose = self.video.poses[self.t1-1].clone() self.last_disp = self.video.disps[self.t1-1].clone() self.last_time = self.video.tstamp[self.t1-1].clone() with self.video.get_lock(): self.video.ready.value = 1 self.video.dirty[:self.t1] = True def __call__(self): """ main update """ # do initialization if not self.is_initialized and self.video.counter.value == self.warmup: self.__initialize() # do update elif self.is_initialized and self.t1 < self.video.counter.value: self.__update() ================================================ FILE: VO_Module/droid_slam/droid_net.py ================================================ import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict from torch.nn.modules.activation import Sigmoid from modules.extractor import BasicEncoder from modules.corr import CorrBlock from modules.gru import ConvGRU from modules.clipping import GradientClip from lietorch import SE3 from geom.ba import BA import geom.projective_ops as pops from geom.graph_utils import graph_to_edge_list, keyframe_indicies from torch_scatter import scatter_mean def cvx_upsample(data, mask): """ upsample pixel-wise transformation field """ batch, ht, wd, dim = data.shape data = data.permute(0, 3, 1, 2) mask = mask.view(batch, 1, 9, 8, 8, ht, wd) mask = torch.softmax(mask, dim=2) up_data = F.unfold(data, [3, 3], padding=1) up_data = up_data.view(batch, dim, 9, 1, 1, ht, wd) up_data = torch.sum(mask * up_data, dim=2) up_data = up_data.permute(0, 4, 2, 5, 3, 1) up_data = up_data.reshape(batch, 8*ht, 8*wd, dim) return up_data def upsample_dim_1(disp, mask): batch, num, ht, wd = disp.shape disp = disp.view(batch*num, ht, wd, 1) mask = mask.view(batch*num, -1, ht, wd) return cvx_upsample(disp, mask).view(batch, num, 8*ht, 8*wd) def upsample_dim_x(flow, mask): batch, num, ht, wd, dim = flow.shape flow = flow.view(batch*num, ht, wd, dim) mask = mask.view(batch*num, -1, ht, wd) return cvx_upsample(flow, mask).view(batch, num, 8*ht, 8*wd, dim) def upsample_inter(mask): batch, num, ht, wd, dim = mask.shape mask = mask.permute(0, 1, 4, 2, 3).contiguous() mask = mask.view(batch*num, dim, ht, wd) mask = F.interpolate(mask, scale_factor=8, mode='bilinear', align_corners=True, recompute_scale_factor=True) mask = mask.permute(0, 2, 3, 1).contiguous() return mask.view(batch, num, 8*ht, 8*wd, dim) class GraphAgg(nn.Module): def __init__(self): super(GraphAgg, self).__init__() self.conv1 = nn.Conv2d(128, 128, 3, padding=1) self.conv2 = nn.Conv2d(128, 128, 3, padding=1) self.relu = nn.ReLU(inplace=True) self.eta = nn.Sequential( nn.Conv2d(128, 1, 3, padding=1), GradientClip(), nn.Softplus()) self.upmask_disp = nn.Sequential( nn.Conv2d(128, 8*8*9, 1, padding=0)) def forward(self, net, ii): batch, num, ch, ht, wd = net.shape net = net.view(batch*num, ch, ht, wd) _, ix = torch.unique(ii, return_inverse=True) net = self.relu(self.conv1(net)) net = net.view(batch, num, 128, ht, wd) net_less = scatter_mean(net, ix, dim=1) net_less = net_less.view(-1, 128, ht, wd) net_less = self.relu(self.conv2(net_less)) eta = self.eta(net_less).view(batch, -1, ht, wd) upmask_disp = self.upmask_disp(net_less).view(batch, -1, 8*8*9, ht, wd) return .01 * eta, upmask_disp, None, None class UpdateModule(nn.Module): def __init__(self): super(UpdateModule, self).__init__() cor_planes = 4 * (2*3 + 1)**2 self.corr_encoder = nn.Sequential( nn.Conv2d(cor_planes, 128, 1, padding=0), nn.ReLU(inplace=True), nn.Conv2d(128, 128, 3, padding=1), nn.ReLU(inplace=True)) self.flow_encoder = nn.Sequential( nn.Conv2d(4, 128, 7, padding=3), nn.ReLU(inplace=True), nn.Conv2d(128, 64, 3, padding=1), nn.ReLU(inplace=True)) self.weight = nn.Sequential( nn.Conv2d(128, 128, 3, padding=1), nn.ReLU(inplace=True), nn.Conv2d(128, 2, 3, padding=1), GradientClip(), nn.Sigmoid()) self.delta = nn.Sequential( nn.Conv2d(128, 128, 3, padding=1), nn.ReLU(inplace=True), nn.Conv2d(128, 2, 3, padding=1), GradientClip()) self.gru = ConvGRU(128, 128+128+64) self.agg = GraphAgg() def forward(self, net, inp, corr, flow=None, ii=None, jj=None): """ RaftSLAM update operator """ batch, num, ch, ht, wd = net.shape if flow is None: flow = torch.zeros(batch, num, 4, ht, wd, device=net.device) output_dim = (batch, num, -1, ht, wd) net = net.view(batch*num, -1, ht, wd) inp = inp.view(batch*num, -1, ht, wd) corr = corr.view(batch*num, -1, ht, wd) flow = flow.view(batch*num, -1, ht, wd) corr = self.corr_encoder(corr) flow = self.flow_encoder(flow) net = self.gru(net, inp, corr, flow) ### update variables ### delta = self.delta(net).view(*output_dim) weight = self.weight(net).view(*output_dim) delta = delta.permute(0, 1, 3, 4, 2)[..., :2].contiguous() weight = weight.permute(0, 1, 3, 4, 2)[..., :2].contiguous() net = net.view(*output_dim) if ii is not None: eta, upmask = self.agg(net, ii.to(net.device)) return net, delta, weight, eta, upmask else: return net, delta, weight class DynamicUpdateModule(nn.Module): def __init__(self, use_aff_bri=False): super(DynamicUpdateModule, self).__init__() cor_planes = 4 * (2*3 + 1)**2 self.mask_num = 2 self.corr_encoder = nn.Sequential( nn.Conv2d(cor_planes, 128, 1, padding=0), nn.ReLU(inplace=True), nn.Conv2d(128, 128, 3, padding=1), nn.ReLU(inplace=True)) self.flow_encoder = nn.Sequential( nn.Conv2d(4+self.mask_num+2, 128, 7, padding=3), nn.ReLU(inplace=True), nn.Conv2d(128, 64, 3, padding=1), nn.ReLU(inplace=True)) self.weight = nn.Sequential( nn.Conv2d(128, 128, 3, padding=1), nn.ReLU(inplace=True), nn.Conv2d(128, 2, 3, padding=1), GradientClip(), ) self.delta = nn.Sequential( nn.Conv2d(128, 128, 3, padding=1), nn.ReLU(inplace=True), nn.Conv2d(128, 2, 3, padding=1), GradientClip()) self.delta_dy = nn.Sequential( nn.Conv2d(128, 128, 3, padding=1), nn.ReLU(inplace=True), nn.Conv2d(128, 2, 3, padding=1), GradientClip()) # 动静mask: 1->static, 0->dynamic # this is a delta mask self.delta_mask = nn.Sequential( nn.Conv2d(128, 128, 3, padding=1), nn.ReLU(inplace=True), nn.Conv2d(128, self.mask_num, 3, padding=1), GradientClip(), ) if use_aff_bri: self.global_avg_pool = nn.Sequential( nn.Conv2d(128, 128, 3, padding=1), nn.ReLU(inplace=True), nn.AdaptiveAvgPool2d((1, 1)), GradientClip(), ) self.param_linear = nn.Sequential( nn.Linear(128, 2), nn.Sigmoid() ) self.gru = ConvGRU(128, 128+128+64) self.agg = GraphAgg() def do_filter(self, lay, weight, delta_dy, delta_m, segments): segments = lay * 1e4 + segments encode = segments * 1e4 + ((delta_dy[...,0] + delta_dy[...,1]) > 0.5).int() ky, cnt = torch.unique(encode, return_counts=True) cat = ky // 1e4 sig = ky % 1e4 cat0 = cat[sig==0].detach().cpu().numpy.tolist() cat1 = cat[sig==1].detach().cpu().numpy.tolist() cnt0 = cnt[sig==0] cnt1 = cnt[sig==1] ori_cls = torch.unique(cat) for i in ori_cls: if i not in cat0: prob = 0 elif i not in cat1: prob = 1 else: n0 = cnt0[cat0.index(i)] n1 = cnt1[cat1.index(i)] prob = n0 / (n0 + n1) if prob > 0.5: fil = segments[0, i//1e4,...] == i lay[0, i//1e4 ,...] = lay[0, i//1e4 ,...] * (1-fil*1) weight[...,0] = weight[...,0] * lay weight[...,1] = weight[...,1] * lay return weight def forward(self, net, inp, corr, flow=None, ii=None, jj=None, use_aff_bri=False, raw_mask=None, segments=None): """ RaftSLAM update operator """ batch, num, ch, ht, wd = net.shape if flow is None: # add mask channel flow = torch.zeros(batch, num, 4+self.mask_num+2, ht, wd, device=net.device) if raw_mask is None: raw_mask = torch.zeros( batch, num, self.mask_num, ht, wd, device=net.device) output_dim = (batch, num, -1, ht, wd) net = net.view(batch*num, -1, ht, wd) inp = inp.view(batch*num, -1, ht, wd) corr = corr.view(batch*num, -1, ht, wd) flow = flow.view(batch*num, -1, ht, wd) corr = self.corr_encoder(corr) flow = self.flow_encoder(flow) net = self.gru(net, inp, corr, flow) ### update variables ### delta = self.delta(net).view(*output_dim) delta_dy = self.delta_dy(net).view(*output_dim) weight = self.weight(net).view(*output_dim) delta_m = self.delta_mask(net).view(*output_dim) if use_aff_bri: tmp = self.global_avg_pool(net).view(batch*num, -1) aff_params = self.param_linear(tmp).view(batch, num, -1) delta = delta.permute(0, 1, 3, 4, 2).contiguous() delta_dy = delta_dy.permute(0, 1, 3, 4, 2).contiguous() weight = weight.permute(0, 1, 3, 4, 2).contiguous() delta_m = delta_m.permute(0, 1, 3, 4, 2).contiguous() lay = torch.as_tensor(np.range(1, num+1).repeat(ht*wd).reshape(num,ht,wd)).unsqueeze(0) # weight = self.do_filter(lay, weight, delta_dy, delta_m, segments) net = net.view(*output_dim) delta = torch.cat([delta, delta_dy], dim=-1) if ii is not None: eta, upmask_disp, \ upmask_flow, upmask_dymask = self.agg(net, ii.to(net.device)) upmask = { 'disp': upmask_disp, 'flow': upmask_flow, 'dy_mask': upmask_dymask, } if use_aff_bri: return net, delta, weight, eta, upmask, delta_m, aff_params else: return net, delta, weight, eta, upmask, delta_m else: return net, delta, weight, delta_m class DroidNet(nn.Module): def __init__(self, use_aff_bri=False): super(DroidNet, self).__init__() self.fnet = BasicEncoder(output_dim=128, norm_fn='instance') self.cnet = BasicEncoder(output_dim=256, norm_fn='none') self.update = DynamicUpdateModule(use_aff_bri) self.use_aff_bri = use_aff_bri def extract_features(self, images): """ run feeature extraction networks """ # normalize images images = images[:, :, [2, 1, 0]] / 255.0 mean = torch.as_tensor([0.485, 0.456, 0.406], device=images.device) std = torch.as_tensor([0.229, 0.224, 0.225], device=images.device) images = images.sub_(mean[:, None, None]).div_(std[:, None, None]) fmaps = self.fnet(images) net = self.cnet(images) net, inp = net.split([128, 128], dim=2) net = torch.tanh(net) inp = torch.relu(inp) return fmaps, net, inp def forward(self, Gs, images, disps, intrinsics, graph=None, num_steps=12, fixedp=2, ret_flow=False, downsample=False, segments=None): """ Estimates SE3 or Sim3 between pair of frames """ u = keyframe_indicies(graph) ii, jj, kk = graph_to_edge_list(graph) ii = ii.to(device=images.device, dtype=torch.long) jj = jj.to(device=images.device, dtype=torch.long) dy_thresh = 0.5 mask_num = 2 fmaps, net, inp = self.extract_features(images) segm_all = None if segments != None: segm_all = segments[:,ii] net, inp = net[:, ii], inp[:, ii] corr_fn = CorrBlock(fmaps[:, ii], fmaps[:, jj], num_levels=4, radius=3) ht, wd = images.shape[-2:] coords0 = pops.coords_grid(ht//8, wd//8, device=images.device) coords1, _ = pops.projective_transform(Gs, disps, intrinsics, ii, jj) target_cam = coords1.clone() delta_dy = torch.zeros_like(coords1) raw_mask = torch.zeros_like(coords1)[..., 0:mask_num] Gs_list, disp_list, residual_list = [], [], [] full_flow_list, mask_list = [], [] if self.use_aff_bri: aff_params_list = [] for step in range(num_steps): Gs = Gs.detach() disps = disps.detach() coords1 = coords1.detach() target_cam = target_cam.detach() delta_dy = delta_dy.detach() raw_mask = raw_mask.detach() corr = corr_fn(coords1) resd = (target_cam - coords1) cam_flow = coords1 - coords0 flow = cam_flow + delta_dy motion = torch.cat([cam_flow, flow, resd, raw_mask], dim=-1) motion = motion.permute(0, 1, 4, 2, 3).clamp(-64.0, 64.0) if self.use_aff_bri: net, delta, weight, eta, upmask, \ delta_m, aff_params = \ self.update(net, inp, corr, motion, ii, jj, self.use_aff_bri) else: net, delta, weight, eta, upmask, delta_m = \ self.update(net, inp, corr, motion, ii, jj) # (1:static 0:dynamic) raw_mask = raw_mask + delta_m mask = torch.sigmoid(raw_mask) bin_mask = (mask >= dy_thresh).float() target_cam = coords1 + delta[..., 0:2] weight = torch.sigmoid(weight + (1-bin_mask)*10) for i in range(2): Gs, disps = BA(target_cam, weight, eta, Gs, disps, intrinsics, ii, jj, fixedp=2) coords1, valid_mask = pops.projective_transform( Gs, disps, intrinsics, ii, jj) residual = (target_cam - coords1) * valid_mask delta_dy = delta[..., 2:4] * (1-bin_mask) target_all = coords1 + delta_dy Gs_list.append(Gs) disp_list.append(upsample_dim_1(disps, upmask['disp'])) residual_list.append(residual) mask_list.append(upsample_inter(mask)) if ret_flow: if downsample: full_flow_list.append(target_all - coords0) else: full_flow_list.append( upsample_inter((target_all - coords0)*8)) if self.use_aff_bri: aff_params_list.append(aff_params) if ret_flow: if self.use_aff_bri: return Gs_list, disp_list, residual_list, full_flow_list, mask_list, aff_params_list else: return Gs_list, disp_list, residual_list, full_flow_list, mask_list else: return Gs_list, disp_list, residual_list, mask_list ================================================ FILE: VO_Module/droid_slam/factor_graph.py ================================================ import torch import lietorch import numpy as np import matplotlib.pyplot as plt import torch.nn.functional as F from lietorch import SE3 from modules.corr import CorrBlock, AltCorrBlock import geom.projective_ops as pops class FactorGraph: def __init__(self, video, update_op, device="cuda:0", corr_impl="volume", max_factors=-1): self.video = video self.update_op = update_op self.device = device self.max_factors = max_factors self.corr_impl = corr_impl # operator at 1/8 resolution self.ht = ht = video.ht // 8 self.wd = wd = video.wd // 8 self.dy_thresh = 0.5 self.mask_num = 2 self.coords0 = pops.coords_grid(ht, wd, device=device) self.ii = torch.as_tensor([], dtype=torch.long, device=device) self.jj = torch.as_tensor([], dtype=torch.long, device=device) self.age = torch.as_tensor([], dtype=torch.long, device=device) self.corr, self.net, self.inp = None, None, None self.segm = None self.damping = 1e-6 * torch.ones_like(self.video.disps) self.target_cam = torch.zeros( [1, 0, ht, wd, 2], device=device, dtype=torch.float) self.weight = torch.zeros( [1, 0, ht, wd, 2], device=device, dtype=torch.float) self.raw_mask = torch.zeros( [1, 0, ht, wd, self.mask_num], device=device, dtype=torch.float) self.delta_dy = torch.zeros( [1, 0, ht, wd, 2], device=device, dtype=torch.float) self.full_flow = torch.zeros( [1, 0, ht, wd, 2], device=device, dtype=torch.float) # inactive factors self.ii_inac = torch.as_tensor([], dtype=torch.long, device=device) self.jj_inac = torch.as_tensor([], dtype=torch.long, device=device) self.ii_bad = torch.as_tensor([], dtype=torch.long, device=device) self.jj_bad = torch.as_tensor([], dtype=torch.long, device=device) self.target_cam_inac = torch.zeros( [1, 0, ht, wd, 2], device=device, dtype=torch.float) self.weight_inac = torch.zeros( [1, 0, ht, wd, 2], device=device, dtype=torch.float) self.raw_mask_inac = torch.zeros( [1, 0, ht, wd, self.mask_num], device=device, dtype=torch.float) self.delta_dy_inac = torch.zeros( [1, 0, ht, wd, 2], device=device, dtype=torch.float) self.full_flow_inac = torch.zeros( [1, 0, ht, wd, 2], device=device, dtype=torch.float) def __filter_repeated_edges(self, ii, jj): """ remove duplicate edges """ keep = torch.zeros(ii.shape[0], dtype=torch.bool, device=ii.device) eset = set( [(i.item(), j.item()) for i, j in zip(self.ii, self.jj)] + [(i.item(), j.item()) for i, j in zip(self.ii_inac, self.jj_inac)]) for k, (i, j) in enumerate(zip(ii, jj)): keep[k] = (i.item(), j.item()) not in eset return ii[keep], jj[keep] def print_edges(self): ii = self.ii.cpu().numpy() jj = self.jj.cpu().numpy() ix = np.argsort(ii) ii = ii[ix] jj = jj[ix] w = torch.mean(self.weight, dim=[0, 2, 3, 4]).cpu().numpy() w = w[ix] for e in zip(ii, jj, w): print(e) print() def filter_edges(self): """ remove bad edges """ conf = torch.mean(self.weight, dim=[0, 2, 3, 4]) mask = (torch.abs(self.ii-self.jj) > 2) & (conf < 0.001) self.ii_bad = torch.cat([self.ii_bad, self.ii[mask]]) self.jj_bad = torch.cat([self.jj_bad, self.jj[mask]]) self.rm_factors(mask, store=False) def clear_edges(self): self.rm_factors(self.ii >= 0) self.net = None self.inp = None @torch.cuda.amp.autocast(enabled=True) def add_factors(self, ii, jj, remove=False): """ add edges to factor graph """ if not isinstance(ii, torch.Tensor): ii = torch.as_tensor(ii, dtype=torch.long, device=self.device) if not isinstance(jj, torch.Tensor): jj = torch.as_tensor(jj, dtype=torch.long, device=self.device) # remove duplicate edges ii, jj = self.__filter_repeated_edges(ii, jj) if ii.shape[0] == 0: return # place limit on number of factors if self.max_factors > 0 and self.ii.shape[0] + ii.shape[0] > self.max_factors \ and self.corr is not None and remove: ix = torch.arange(len(self.age))[torch.argsort(self.age).cpu()] self.rm_factors(ix >= self.max_factors - ii.shape[0], store=True) net = self.video.nets[ii].to(self.device).unsqueeze(0) # correlation volume for new edges if self.corr_impl == "volume": fmap1 = self.video.fmaps[ii].to(self.device).unsqueeze(0) fmap2 = self.video.fmaps[jj].to(self.device).unsqueeze(0) corr = CorrBlock(fmap1, fmap2) self.corr = corr if self.corr is None else self.corr.cat(corr) inp = self.video.inps[ii].to(self.device).unsqueeze(0) self.inp = inp if self.inp is None else torch.cat([self.inp, inp], 1) with torch.cuda.amp.autocast(enabled=False): target, _ = self.video.reproject(ii, jj) weight = torch.zeros_like(target) raw_mask = torch.zeros_like(target)[..., 0:self.mask_num] delta_dy = torch.zeros_like(target) self.ii = torch.cat([self.ii, ii], 0) self.jj = torch.cat([self.jj, jj], 0) self.age = torch.cat([self.age, torch.zeros_like(ii)], 0) # reprojection factors self.net = net if self.net is None else torch.cat([self.net, net], 1) self.target_cam = torch.cat([self.target_cam, target], 1) self.weight = torch.cat([self.weight, weight], 1) self.raw_mask = torch.cat([self.raw_mask, raw_mask], 1) self.delta_dy = torch.cat([self.delta_dy, delta_dy], 1) # segmentations segm = self.video.segms[ii].to(self.device).unsqueeze(0) self.segm = segm if self.segm is None else torch.cat([self.segm, segm], 1) @torch.cuda.amp.autocast(enabled=True) def rm_factors(self, mask, store=False): """ drop edges from factor graph """ # store estimated factors if store: self.ii_inac = torch.cat([self.ii_inac, self.ii[mask]], 0) self.jj_inac = torch.cat([self.jj_inac, self.jj[mask]], 0) self.target_cam_inac = torch.cat( [self.target_cam_inac, self.target_cam[:, mask]], 1) self.weight_inac = torch.cat( [self.weight_inac, self.weight[:, mask]], 1) self.raw_mask_inac = torch.cat( [self.raw_mask_inac, self.raw_mask[:, mask]], 1) self.delta_dy_inac = torch.cat( [self.delta_dy_inac, self.delta_dy[:, mask]], 1) self.ii = self.ii[~mask] self.jj = self.jj[~mask] self.age = self.age[~mask] if self.corr_impl == "volume": self.corr = self.corr[~mask] if self.net is not None: self.net = self.net[:, ~mask] if self.inp is not None: self.inp = self.inp[:, ~mask] if self.segm is not None: self.segm = self.segm[:, ~mask] self.target_cam = self.target_cam[:, ~mask] self.weight = self.weight[:, ~mask] self.raw_mask = self.raw_mask[:, ~mask] self.delta_dy = self.delta_dy[:, ~mask] @torch.cuda.amp.autocast(enabled=True) def rm_keyframe(self, ix): """ drop edges from factor graph """ with self.video.get_lock(): self.video.poses[ix] = self.video.poses[ix+1] self.video.disps[ix] = self.video.disps[ix+1] self.video.intrinsics[ix] = self.video.intrinsics[ix+1] self.video.nets[ix] = self.video.nets[ix+1] self.video.inps[ix] = self.video.inps[ix+1] self.video.fmaps[ix] = self.video.fmaps[ix+1] if self.video.segm_filter: self.video.segms[ix] = self.video.segms[ix+1] m = (self.ii == ix) | (self.jj == ix) self.ii[self.ii >= ix] -= 1 self.jj[self.jj >= ix] -= 1 self.ii_inac[self.ii_inac >= ix] -= 1 self.jj_inac[self.jj_inac >= ix] -= 1 self.rm_factors(m, store=False) @torch.cuda.amp.autocast(enabled=True) def update(self, t0=None, t1=None, itrs=2, use_inactive=False, EP=1e-7, motion_only=False): """ run update operator on factor graph """ # motion features with torch.cuda.amp.autocast(enabled=False): coords1, mask = self.video.reproject(self.ii, self.jj) motn = torch.cat( [self.target_cam - self.coords0, self.target_cam - self.coords0 + self.delta_dy, self.target_cam - coords1, self.raw_mask*torch.ones_like(coords1)[..., 0:self.mask_num]], dim=-1) motn = motn.permute(0, 1, 4, 2, 3).clamp(-64.0, 64.0) # correlation features corr = self.corr(coords1) self.net, delta, weight, damping, upmask, delta_m = \ self.update_op(self.net, self.inp, corr, motn, self.ii, self.jj, False) if t0 is None: t0 = max(1, self.ii.min().item()+1) with torch.cuda.amp.autocast(enabled=False): self.target_cam = coords1 + delta[..., 0:2].to(dtype=torch.float) self.weight = weight.to(dtype=torch.float) self.raw_mask = self.raw_mask + delta_m bin_mask = ( torch.sigmoid(self.raw_mask) >= self.dy_thresh) # filter with segm if self.video.segm_filter: ht = weight.shape[2] wd = weight.shape[3] lay = np.arange(1, weight.shape[1]+1).repeat(ht*wd).reshape(1,-1,ht,wd) segments = (lay * 1e6 + self.segm.squeeze(2).detach().cpu().numpy()).astype(np.int32) dynamic_m = ( (bin_mask[...,0] == 0).__or__(bin_mask[...,1] == 0) ).detach().cpu().numpy() ori_ky, ori_cnt = np.unique(segments, return_counts=True) ori_dic = dict(zip(ori_ky, ori_cnt)) dy_fields = segments * dynamic_m dy_ky, dy_cnt = np.unique(dy_fields, return_counts=True) for (label, dy_n) in zip(dy_ky, dy_cnt): if label % 1e6 == 0: continue if (dy_n / ori_dic[label]) > self.video.thresh: # 0.8 dim = int(label // 1e6) -1 fil = segments[0,dim,...] == label lay[0,dim,...] = lay[0,dim,...] * (1-fil*1) lay = torch.as_tensor(lay).to(self.device) bin_mask[...,0] = bin_mask[...,0] * (lay > 0) bin_mask[...,1] = bin_mask[...,1] * (lay > 0) bin_mask = bin_mask.float() self.delta_dy = delta[..., 2:4] * (1-bin_mask) self.weight = torch.sigmoid(self.weight + (1-bin_mask)*10) ht, wd = self.coords0.shape[0:2] self.damping[torch.unique(self.ii)] = damping if use_inactive: m = (self.ii_inac >= t0 - 3) & (self.jj_inac >= t0 - 3) ii = torch.cat([self.ii_inac[m], self.ii], 0) jj = torch.cat([self.jj_inac[m], self.jj], 0) target_cam = torch.cat( [self.target_cam_inac[:, m], self.target_cam], 1) weight = torch.cat([self.weight_inac[:, m], self.weight], 1) else: ii, jj, target_cam, weight = self.ii, self.jj, self.target_cam, self.weight damping = .2 * self.damping[torch.unique(ii)].contiguous() + EP target_cam = target_cam.view(-1, ht, wd, 2).permute(0, 3, 1, 2).contiguous() weight = weight.view(-1, ht, wd, 2).permute(0, 3, 1, 2).contiguous() # dense bundle adjustment self.video.ba(target_cam, weight, damping, ii, jj, t0, t1, itrs=itrs, lm=1e-4, ep=0.1, motion_only=motion_only) target_all = coords1 + self.delta_dy self.full_flow = target_all - self.coords0 self.age += 1 @torch.cuda.amp.autocast(enabled=False) def update_lowmem(self, t0=None, t1=None, itrs=2, use_inactive=False, EP=1e-7, steps=8): """ run update operator on factor graph - reduced memory implementation """ # alternate corr implementation t = self.video.counter.value corr_op = AltCorrBlock(self.video.fmaps[None, :t]) for step in range(steps): print("Global BA Iteration #{}".format(step+1)) with torch.cuda.amp.autocast(enabled=False): coords1, mask = self.video.reproject(self.ii, self.jj) motn = torch.cat( [self.target_cam - self.coords0, self.target_cam - self.coords0 + self.delta_dy, self.target_cam - coords1, self.raw_mask*torch.ones_like(coords1)[..., 0:self.mask_num]], dim=-1) motn = motn.permute(0, 1, 4, 2, 3).clamp(-64.0, 64.0) s = 8 for i in range(0, self.jj.max()+1, s): v = (self.ii >= i) & (self.ii < i + s) iis = self.ii[v] jjs = self.jj[v] ht, wd = self.coords0.shape[0:2] corr1 = corr_op(coords1[:, v], iis, jjs) with torch.cuda.amp.autocast(enabled=True): net, delta, weight, damping, _, delta_m = self.update_op( self.net[:, v], self.video.inps[None, iis], corr1, motn[:, v], iis, jjs, False) self.net[:, v] = net self.target_cam[:, v] = coords1[:, v] + delta[..., 0:2].float() self.weight[:, v] = weight.float() self.damping[torch.unique(iis)] = damping self.raw_mask[:, v] = self.raw_mask[:, v] + delta_m.float() bin_mask = (torch.sigmoid( self.raw_mask[:, v]) >= self.dy_thresh).float() self.delta_dy[:, v] = delta[..., 2:4] * (1-bin_mask) self.weight[:, v] = torch.sigmoid( self.weight[:, v] + (1-bin_mask)*10) damping = self.damping[torch.unique(self.ii)].contiguous() + EP target_cam = self.target_cam.view(-1, ht, wd, 2).permute(0, 3, 1, 2).contiguous() weight = self.weight.view(-1, ht, wd, 2).permute(0, 3, 1, 2).contiguous() # dense bundle adjustment self.video.ba(target_cam, weight, damping, self.ii, self.jj, 1, t, itrs=itrs, lm=1e-5, ep=1e-2, motion_only=False) self.video.dirty[:t] = True def add_neighborhood_factors(self, t0, t1, r=3): """ add edges between neighboring frames within radius r """ ii, jj = torch.meshgrid(torch.arange(t0, t1), torch.arange(t0, t1)) ii = ii.reshape(-1).to(dtype=torch.long, device=self.device) jj = jj.reshape(-1).to(dtype=torch.long, device=self.device) keep = ((ii - jj).abs() > 0) & ((ii - jj).abs() <= r) self.add_factors(ii[keep], jj[keep]) def add_proximity_factors(self, t0=0, t1=0, rad=2, nms=2, beta=0.25, thresh=16.0, remove=False): """ add edges to the factor graph based on distance """ t = self.video.counter.value ix = torch.arange(t0, t) jx = torch.arange(t1, t) ii, jj = torch.meshgrid(ix, jx) ii = ii.reshape(-1) jj = jj.reshape(-1) d = self.video.distance(ii, jj, beta=beta) d[ii - rad < jj] = np.inf d[d > 100] = np.inf ii1 = torch.cat([self.ii, self.ii_bad, self.ii_inac], 0) jj1 = torch.cat([self.jj, self.jj_bad, self.jj_inac], 0) for i, j in zip(ii1.cpu().numpy(), jj1.cpu().numpy()): if abs(i - j) <= 2: continue for di in range(-nms, nms+1): for dj in range(-nms, nms+1): if abs(di) + abs(dj) <= max(min(abs(i-j)-2, nms), 0): i1 = i + di j1 = j + dj if (t0 <= i1 < t) and (t1 <= j1 < t): d[(i1-t0)*(t-t1) + (j1-t1)] = np.inf es = [] for i in range(t0, t): for j in range(i+1, min(i+rad+1, t)): es.append((i, j)) es.append((j, i)) ix = torch.argsort(d) for k in ix: if d[k].item() > thresh: continue i = ii[k] j = jj[k] # bidirectional es.append((i, j)) es.append((j, i)) for di in range(-nms, nms+1): for dj in range(-nms, nms+1): if abs(di) + abs(dj) <= max(min(abs(i-j)-2, nms), 0): i1 = i + di j1 = j + dj if (t0 <= i1 < t) and (t1 <= j1 < t): d[(i1-t0)*(t-t1) + (j1-t1)] = np.inf ii, jj = torch.as_tensor(es, device=self.device).unbind(dim=-1) self.add_factors(ii, jj, remove) def upsample_inter(mask): batch, num, ht, wd, dim = mask.shape mask = mask.permute(0, 1, 4, 2, 3).contiguous() mask = mask.view(batch*num, dim, ht, wd) mask = F.interpolate(mask, scale_factor=8, mode='bilinear', align_corners=True, recompute_scale_factor=True) mask = mask.permute(0, 2, 3, 1).contiguous() return mask.view(batch, num, 8*ht, 8*wd, dim) ================================================ FILE: VO_Module/droid_slam/geom/__init__.py ================================================ ================================================ FILE: VO_Module/droid_slam/geom/ba.py ================================================ import lietorch import torch import torch.nn.functional as F from .chol import block_solve, schur_solve import geom.projective_ops as pops from torch_scatter import scatter_sum # utility functions for scattering ops def safe_scatter_add_mat(A, ii, jj, n, m): v = (ii >= 0) & (jj >= 0) & (ii < n) & (jj < m) return scatter_sum(A[:,v], ii[v]*m + jj[v], dim=1, dim_size=n*m) def safe_scatter_add_vec(b, ii, n): v = (ii >= 0) & (ii < n) return scatter_sum(b[:,v], ii[v], dim=1, dim_size=n) # apply retraction operator to inv-depth maps def disp_retr(disps, dz, ii): ii = ii.to(device=dz.device) return disps + scatter_sum(dz, ii, dim=1, dim_size=disps.shape[1]) # apply retraction operator to poses def pose_retr(poses, dx, ii): ii = ii.to(device=dx.device) return poses.retr(scatter_sum(dx, ii, dim=1, dim_size=poses.shape[1])) def BA(target, weight, eta, poses, disps, intrinsics, ii, jj, fixedp=1, rig=1): """ Full Bundle Adjustment """ B, P, ht, wd = disps.shape N = ii.shape[0] D = poses.manifold_dim ### 1: commpute jacobians and residuals ### coords, valid, (Ji, Jj, Jz) = pops.projective_transform( poses, disps, intrinsics, ii, jj, jacobian=True) r = (target - coords).view(B, N, -1, 1) w = .001 * (valid * weight).view(B, N, -1, 1) ### 2: construct linear system ### Ji = Ji.reshape(B, N, -1, D) Jj = Jj.reshape(B, N, -1, D) wJiT = (w * Ji).transpose(2,3) wJjT = (w * Jj).transpose(2,3) Jz = Jz.reshape(B, N, ht*wd, -1) Hii = torch.matmul(wJiT, Ji) Hij = torch.matmul(wJiT, Jj) Hji = torch.matmul(wJjT, Ji) Hjj = torch.matmul(wJjT, Jj) vi = torch.matmul(wJiT, r).squeeze(-1) vj = torch.matmul(wJjT, r).squeeze(-1) Ei = (wJiT.view(B,N,D,ht*wd,-1) * Jz[:,:,None]).sum(dim=-1) Ej = (wJjT.view(B,N,D,ht*wd,-1) * Jz[:,:,None]).sum(dim=-1) w = w.view(B, N, ht*wd, -1) r = r.view(B, N, ht*wd, -1) wk = torch.sum(w*r*Jz, dim=-1) Ck = torch.sum(w*Jz*Jz, dim=-1) kx, kk = torch.unique(ii, return_inverse=True) M = kx.shape[0] # only optimize keyframe poses P = P // rig - fixedp ii = ii // rig - fixedp jj = jj // rig - fixedp H = safe_scatter_add_mat(Hii, ii, ii, P, P) + \ safe_scatter_add_mat(Hij, ii, jj, P, P) + \ safe_scatter_add_mat(Hji, jj, ii, P, P) + \ safe_scatter_add_mat(Hjj, jj, jj, P, P) E = safe_scatter_add_mat(Ei, ii, kk, P, M) + \ safe_scatter_add_mat(Ej, jj, kk, P, M) v = safe_scatter_add_vec(vi, ii, P) + \ safe_scatter_add_vec(vj, jj, P) C = safe_scatter_add_vec(Ck, kk, M) w = safe_scatter_add_vec(wk, kk, M) C = C + eta.view(*C.shape) + 1e-7 H = H.view(B, P, P, D, D) E = E.view(B, P, M, D, ht*wd) ### 3: solve the system ### dx, dz = schur_solve(H, E, C, v, w) ### 4: apply retraction ### poses = pose_retr(poses, dx, torch.arange(P) + fixedp) disps = disp_retr(disps, dz.view(B,-1,ht,wd), kx) disps = torch.where(disps > 10, torch.zeros_like(disps), disps) disps = disps.clamp(min=0.0) return poses, disps def MoBA(target, weight, eta, poses, disps, intrinsics, ii, jj, fixedp=1, rig=1): """ Motion only bundle adjustment """ B, P, ht, wd = disps.shape N = ii.shape[0] D = poses.manifold_dim ### 1: commpute jacobians and residuals ### coords, valid, (Ji, Jj, Jz) = pops.projective_transform( poses, disps, intrinsics, ii, jj, jacobian=True) r = (target - coords).view(B, N, -1, 1) w = .001 * (valid * weight).view(B, N, -1, 1) ### 2: construct linear system ### Ji = Ji.reshape(B, N, -1, D) Jj = Jj.reshape(B, N, -1, D) wJiT = (w * Ji).transpose(2,3) wJjT = (w * Jj).transpose(2,3) Hii = torch.matmul(wJiT, Ji) Hij = torch.matmul(wJiT, Jj) Hji = torch.matmul(wJjT, Ji) Hjj = torch.matmul(wJjT, Jj) vi = torch.matmul(wJiT, r).squeeze(-1) vj = torch.matmul(wJjT, r).squeeze(-1) # only optimize keyframe poses P = P // rig - fixedp ii = ii // rig - fixedp jj = jj // rig - fixedp H = safe_scatter_add_mat(Hii, ii, ii, P, P) + \ safe_scatter_add_mat(Hij, ii, jj, P, P) + \ safe_scatter_add_mat(Hji, jj, ii, P, P) + \ safe_scatter_add_mat(Hjj, jj, jj, P, P) v = safe_scatter_add_vec(vi, ii, P) + \ safe_scatter_add_vec(vj, jj, P) H = H.view(B, P, P, D, D) ### 3: solve the system ### dx = block_solve(H, v) ### 4: apply retraction ### poses = pose_retr(poses, dx, torch.arange(P) + fixedp) return poses ================================================ FILE: VO_Module/droid_slam/geom/chol.py ================================================ import torch import torch.nn.functional as F import geom.projective_ops as pops class CholeskySolver(torch.autograd.Function): @staticmethod def forward(ctx, H, b): # don't crash training if cholesky decomp fails try: U = torch.linalg.cholesky(H) xs = torch.cholesky_solve(b, U) ctx.save_for_backward(U, xs) ctx.failed = False except Exception as e: print(e) ctx.failed = True xs = torch.zeros_like(b) return xs @staticmethod def backward(ctx, grad_x): if ctx.failed: return None, None U, xs = ctx.saved_tensors dz = torch.cholesky_solve(grad_x, U) dH = -torch.matmul(xs, dz.transpose(-1,-2)) return dH, dz def block_solve(H, b, ep=0.1, lm=0.0001): """ solve normal equations """ B, N, _, D, _ = H.shape I = torch.eye(D).to(H.device) H = H + (ep + lm*H) * I H = H.permute(0,1,3,2,4) H = H.reshape(B, N*D, N*D) b = b.reshape(B, N*D, 1) x = CholeskySolver.apply(H,b) return x.reshape(B, N, D) def schur_solve(H, E, C, v, w, ep=0.1, lm=0.0001, sless=False): """ solve using shur complement """ B, P, M, D, HW = E.shape H = H.permute(0,1,3,2,4).reshape(B, P*D, P*D) E = E.permute(0,1,3,2,4).reshape(B, P*D, M*HW) Q = (1.0 / C).view(B, M*HW, 1) # damping I = torch.eye(P*D).to(H.device) H = H + (ep + lm*H) * I v = v.reshape(B, P*D, 1) w = w.reshape(B, M*HW, 1) Et = E.transpose(1,2) S = H - torch.matmul(E, Q*Et) v = v - torch.matmul(E, Q*w) dx = CholeskySolver.apply(S, v) if sless: return dx.reshape(B, P, D) dz = Q * (w - Et @ dx) dx = dx.reshape(B, P, D) dz = dz.reshape(B, M, HW) return dx, dz ================================================ FILE: VO_Module/droid_slam/geom/graph_utils.py ================================================ import torch import numpy as np from collections import OrderedDict import lietorch from data_readers.rgbd_utils import compute_distance_matrix_flow, compute_distance_matrix_flow2 def graph_to_edge_list(graph): ii, jj, kk = [], [], [] for s, u in enumerate(graph): for v in graph[u]: ii.append(u) jj.append(v) kk.append(s) ii = torch.as_tensor(ii) jj = torch.as_tensor(jj) kk = torch.as_tensor(kk) return ii, jj, kk def keyframe_indicies(graph): return torch.as_tensor([u for u in graph]) def meshgrid(m, n, device='cuda'): ii, jj = torch.meshgrid(torch.arange(m), torch.arange(n)) return ii.reshape(-1).to(device), jj.reshape(-1).to(device) def neighbourhood_graph(n, r): ii, jj = meshgrid(n, n) d = (ii - jj).abs() keep = (d >= 1) & (d <= r) return ii[keep], jj[keep] def build_frame_graph(poses, disps, intrinsics, num=16, thresh=24.0, r=2, need_inv=True): """ construct a frame graph between co-visible frames """ N = poses.shape[1] poses = poses[0].cpu().numpy() disps = disps[0][:,3::8,3::8].cpu().numpy() intrinsics = intrinsics[0].cpu().numpy() / 8.0 d = compute_distance_matrix_flow(poses, disps, intrinsics, need_inv) count = 0 graph = OrderedDict() for i in range(N): graph[i] = [] d[i,i] = np.inf for j in range(i-r, i+r+1): if 0 <= j < N and i != j: graph[i].append(j) d[i,j] = np.inf count += 1 while count < num: ix = np.argmin(d) i, j = ix // N, ix % N if d[i,j] < thresh: graph[i].append(j) d[i,j] = np.inf count += 1 else: break return graph def build_frame_graph_v2(poses, disps, intrinsics, num=16, thresh=24.0, r=2): """ construct a frame graph between co-visible frames """ N = poses.shape[1] # poses = poses[0].cpu().numpy() # disps = disps[0].cpu().numpy() # intrinsics = intrinsics[0].cpu().numpy() d = compute_distance_matrix_flow2(poses, disps, intrinsics) # import matplotlib.pyplot as plt # plt.imshow(d) # plt.show() count = 0 graph = OrderedDict() for i in range(N): graph[i] = [] d[i,i] = np.inf for j in range(i-r, i+r+1): if 0 <= j < N and i != j: graph[i].append(j) d[i,j] = np.inf count += 1 while 1: ix = np.argmin(d) i, j = ix // N, ix % N if d[i,j] < thresh: graph[i].append(j) for i1 in range(i-1, i+2): for j1 in range(j-1, j+2): if 0 <= i1 < N and 0 <= j1 < N: d[i1, j1] = np.inf count += 1 else: break return graph ================================================ FILE: VO_Module/droid_slam/geom/losses.py ================================================ from collections import OrderedDict import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from lietorch import SO3, SE3, Sim3 from .graph_utils import graph_to_edge_list from .projective_ops import projective_transform, coords_valid, coords_grid, projective_transform_unsup def pose_metrics(dE): """ Translation/Rotation/Scaling metrics from Sim3 """ t, q, s = dE.data.split([3, 4, 1], -1) ang = SO3(q).log().norm(dim=-1) # convert radians to degrees r_err = (180 / np.pi) * ang t_err = t.norm(dim=-1) s_err = (s - 1.0).abs() return r_err, t_err, s_err def fit_scale(Ps, Gs): b = Ps.shape[0] t1 = Ps.data[..., :3].detach().reshape(b, -1) t2 = Gs.data[..., :3].detach().reshape(b, -1) s = (t1*t2).sum(-1) / ((t2*t2).sum(-1) + 1e-8) return s def geodesic_loss(Ps, Gs, graph, gamma=0.9, do_scale=True): """ Loss function for training network """ # relative pose ii, jj, kk = graph_to_edge_list(graph) dP = Ps[:, jj] * Ps[:, ii].inv() n = len(Gs) geodesic_loss = 0.0 for i in range(n): w = gamma ** (n - i - 1) dG = Gs[i][:, jj] * Gs[i][:, ii].inv() if do_scale: s = fit_scale(dP, dG) dG = dG.scale(s[:, None]) # pose error d = (dG * dP.inv()).log() if isinstance(dG, SE3): tau, phi = d.split([3, 3], dim=-1) geodesic_loss += w * ( tau.norm(dim=-1).mean() + phi.norm(dim=-1).mean()) elif isinstance(dG, Sim3): tau, phi, sig = d.split([3, 3, 1], dim=-1) geodesic_loss += w * ( tau.norm(dim=-1).mean() + phi.norm(dim=-1).mean() + 0.05 * sig.norm(dim=-1).mean()) dE = Sim3(dG * dP.inv()).detach() r_err, t_err, s_err = pose_metrics(dE) metrics = { 'rot_error': r_err.mean().item(), 'tr_error': t_err.mean().item(), 'bad_rot': (r_err < .1).float().mean().item(), 'bad_tr': (t_err < .01).float().mean().item(), } return geodesic_loss, metrics def residual_loss(residuals, gamma=0.9): """ loss on system residuals """ residual_loss = 0.0 n = len(residuals) for i in range(n): w = gamma ** (n - i - 1) residual_loss += w * residuals[i].abs().mean() return residual_loss, {'residual': residual_loss.item()} def cam_flow_loss(Ps, disps, poses_est, disps_est, intrinsics, graph, gamma=0.9): """ optical flow loss """ N = Ps.shape[1] graph = OrderedDict() for i in range(N): graph[i] = [j for j in range(N) if abs(i-j) == 1] ii, jj, kk = graph_to_edge_list(graph) coords0, val0 = projective_transform(Ps, disps, intrinsics, ii, jj) val0 = val0 * (disps[:, ii] > 0).float().unsqueeze(dim=-1) n = len(poses_est) cam_flow_loss = 0.0 for i in range(n): w = gamma ** (n - i - 1) coords1, val1 = projective_transform( poses_est[i], disps_est[i], intrinsics, ii, jj) v = (val0 * val1).squeeze(dim=-1) epe = v * (coords1 - coords0).norm(dim=-1) cam_flow_loss += w * epe.mean() epe = epe.reshape(-1)[v.reshape(-1) > 0.5] metrics = { 'f_error': epe.mean().item(), '1px': (epe < 1.0).float().mean().item(), } return cam_flow_loss, metrics def flow_loss(fo_flows, ba_flows, full_flows, graph, gamma=0.9): """flow loss""" fo_vals = fo_flows[..., 2] ba_vals = ba_flows[..., 2] n = len(full_flows) flow_loss = 0 for i in range(n): w = gamma ** (n - i - 1) fo_e = ((full_flows[i][:, 0::2, ...] - fo_flows[..., 0:2]).norm(dim=-1) * fo_vals).mean() ba_e = ((full_flows[i][:, 1::2, ...] - ba_flows[..., 0:2]).norm(dim=-1) * ba_vals).mean() f_e = (fo_e + ba_e) / 2 flow_loss += w * f_e metrics = { 'pure_f_error': f_e.item() } return flow_loss, metrics def photo_loss(images, full_flows, vals, graph, mode, gamma=0.9, ssim=None, mean_mask=False, aff_params=None, downsample=False): """direct photometric loss""" N, C, L = images.shape[1], images.shape[2], full_flows[0].shape[1] ii, jj, kk = graph_to_edge_list(graph) if downsample: images = images[..., 3::8, 3::8] ht, wd = images.shape[-2:] if mode != 'unsup': vals = vals[..., 3::8, 3::8, :] # vals = torch.ones_like(images)[:, :, 0, ..., None] vals_all = vals[:, ii].view(-1, ht, wd) images0 = images[:, ii].reshape(-1, C, ht, wd) / 255.0 images1 = images[:, jj].reshape(-1, C, ht, wd) / 255.0 coords0 = coords_grid(ht, wd, device=images.device) n = len(full_flows) ph_loss = 0.0 for i in range(n): w = gamma ** (n - i - 1) coords_flow = coords0 + full_flows[i] grid_x = coords_flow[..., 0]/(wd-1) grid_y = coords_flow[..., 1]/(ht-1) grid = torch.stack([grid_x, grid_y], dim=-1).view(-1, ht, wd, 2) grid = grid * 2 - 1 # valid if mode == 'unsup': vals_all = vals[i].cuda().view(-1, ht, wd) val_pix = (grid.abs().max(-1)[0] <= 1).float() * vals_all # val_pix = (grid.abs().max(-1)[0] <= 1).float() warped_image0 = F.grid_sample( images1, grid, padding_mode="border", align_corners=True) # warped_image0 = F.grid_sample( # images1, grid, padding_mode="zeros", align_corners=False) if aff_params is not None: aff_a = aff_params[i][..., 0].view(-1, 1, 1, 1) aff_b = (aff_params[i][..., 1] - 0.5).view(-1, 1, 1, 1) warped_image0 = warped_image0*aff_a + aff_b diff = compute_reprojection_loss(images0, warped_image0, ssim) if mean_mask: p_e = mean_on_mask(diff, val_pix) else: p_e = (diff*val_pix).mean() ph_loss += w * p_e metrics = { 'ph_error': p_e.item(), '0.01color': mean_on_mask((diff < 0.01).float(), val_pix).item(), } return ph_loss, metrics def photo_loss_cam(images, poses_est, disps_est, intrinsics, graph, mode, masks, gamma=0.9, ssim=None): """supervise cam flow in ph_loss""" N, C = images.shape[1], images.shape[2] ht, wd = images.shape[-2:] graph = OrderedDict() for i in range(N): graph[i] = [j for j in range(N) if abs(i-j) == 1] ii, jj, kk = graph_to_edge_list(graph) images0 = images[:, ii].reshape(-1, C, ht, wd)/255.0 images1 = images[:, jj].reshape(-1, C, ht, wd)/255.0 if mode != "unsup": masks_all = masks[:, ii].view(-1, ht, wd) n = len(poses_est) ph_loss = 0 for i in range(n): w = gamma ** (n - i - 1) coords_cam, val0 = projective_transform( poses_est[i], disps_est[i], intrinsics, ii, jj) grid_x = coords_cam[..., 0]/(wd-1) grid_y = coords_cam[..., 1]/(ht-1) grid = torch.stack([grid_x, grid_y], dim=-1).view(-1, ht, wd, 2) grid = grid * 2 - 1 val_pix = (grid.abs().max(-1)[0] <= 1).float() val_pix = val_pix * val0.view(-1, ht, wd) if mode == 'unsup': masks_all = masks[i].cuda().view(-1, ht, wd) val_pix = val_pix * masks_all warped_image0 = F.grid_sample( images1, grid, padding_mode="border", align_corners=True) diff = compute_reprojection_loss(images0, warped_image0, ssim) p_e = (diff*val_pix).mean() ph_loss += w * p_e metrics = { 'ph_cam_error': p_e.item(), '0.01color_cam': mean_on_mask((diff < 0.01).float(), val_pix).item(), } return ph_loss, metrics def unsup_occ_vals(poses_est, disps_est, intrinsics, downsample, graph, loss, use_one=False): """occlusion and dynamic obj valid masks in unsup""" N = disps_est[0].shape[1] n = len(poses_est) if graph == None: graph = OrderedDict() for i in range(N): graph[i] = [j for j in range(N) if abs(i-j) == 1] ii, jj, kk = graph_to_edge_list(graph) intrinsics = intrinsics.cpu() if downsample: intrinsics /= 8 val_list = [] for i in range(n): disp_est = disps_est[i].detach().cpu() pose_est = poses_est[i].detach().cpu() if downsample: disp_est = disp_est[:, :, 3::8, 3::8] ht, wd = disp_est.shape[2], disp_est.shape[3] if use_one: val = torch.ones_like(disp_est[:, jj].view(-1, 1, ht, wd)) val_list.append(val) continue coords_cam, disp0, _ = projective_transform_unsup( pose_est, disp_est, intrinsics, ii, jj) disp0 = disp0.view(-1, 1, ht, wd) disp1 = disp_est[:, jj].view(-1, 1, ht, wd) grid_x = coords_cam[..., 0]/(wd-1) grid_y = coords_cam[..., 1]/(ht-1) grid = torch.stack([grid_x, grid_y], dim=-1).view(-1, ht, wd, 2) grid = grid * 2 - 1 warped_disp0 = F.grid_sample( disp1, grid, padding_mode="border", align_corners=True) if loss == 'ph_loss': val = ((1/warped_disp0 - 1/disp0) > -0.005).float() else: val = ((1/disp0 - 1/warped_disp0).abs() <= 0.005).float() val_list.append(val) return val_list def unsup_dy_vals(vals, dy_masks, graph): ii, jj, kk = graph_to_edge_list(graph) if not isinstance(dy_masks, list): dy_masks = dy_masks.detach().cpu() dy_masks = dy_masks[:, :, 3::8, 3::8] ht, wd = dy_masks.shape[2], dy_masks.shape[3] dy_val = dy_masks[:, ii].view(-1, 1, ht, wd) n = len(vals) val_list = [] for i in range(n): if isinstance(dy_masks, list): dy_val = dy_masks[i] ht, wd = dy_val.shape[2], dy_val.shape[3] dy_val = dy_val.view(-1, 1, ht, wd) dy_val = 1 - dy_val val = torch.clamp(vals[i]+dy_val, min=0, max=1) val_list.append(val) return val_list def compute_reprojection_loss(pred, target, ssim): """ From many-depth Computes reprojection loss between a batch of predicted and target images """ abs_diff = torch.abs(target - pred) l1_loss = abs_diff.mean(1) if ssim is None: reprojection_loss = l1_loss else: ssim_loss = ssim(pred, target).mean(1) reprojection_loss = 0.85 * ssim_loss + 0.15 * l1_loss return reprojection_loss class SSIM(nn.Module): """Layer to compute the SSIM loss between a pair of images """ def __init__(self): super(SSIM, self).__init__() self.mu_x_pool = nn.AvgPool2d(3, 1) self.mu_y_pool = nn.AvgPool2d(3, 1) self.sig_x_pool = nn.AvgPool2d(3, 1) self.sig_y_pool = nn.AvgPool2d(3, 1) self.sig_xy_pool = nn.AvgPool2d(3, 1) self.refl = nn.ReflectionPad2d(1) self.C1 = 0.01 ** 2 self.C2 = 0.03 ** 2 def forward(self, x, y): x = self.refl(x) y = self.refl(y) mu_x = self.mu_x_pool(x) mu_y = self.mu_y_pool(y) sigma_x = self.sig_x_pool(x ** 2) - mu_x ** 2 sigma_y = self.sig_y_pool(y ** 2) - mu_y ** 2 sigma_xy = self.sig_xy_pool(x * y) - mu_x * mu_y SSIM_n = (2 * mu_x * mu_y + self.C1) * (2 * sigma_xy + self.C2) SSIM_d = (mu_x ** 2 + mu_y ** 2 + self.C1) * \ (sigma_x + sigma_y + self.C2) return torch.clamp((1 - SSIM_n / SSIM_d) / 2, 0, 1) def mean_on_mask(diff, val_pix): mask = val_pix.expand_as(diff) if mask.sum() > 10000: mean_value = (diff * mask).sum() / mask.sum() else: print('warning - most pixels are masked.') mean_value = torch.tensor(0).float().type_as(mask) return mean_value def ce_reg_loss(preds, gamma=0.9): n = len(preds) entry_loss = 0 for i in range(n): w = gamma ** (n - i - 1) e_e = -preds[i] * torch.log(preds[i] + 1e-10) e_e = e_e.sum(-1).mean() entry_loss += w*e_e metrics = { 'mask_entro_error': e_e.item(), } return entry_loss, metrics def unsup_art_label(poses_est, disps_est, intrinsics, full_flows, graph, thresh=0.5, downsample=True): ht, wd = full_flows[0].shape[2], full_flows[0].shape[3] ii, jj, kk = graph_to_edge_list(graph) intrinsics = intrinsics.cpu() if downsample: intrinsics /= 8 coords0 = coords_grid(ht, wd) n = len(full_flows) art_list = [] for i in range(n): full_flow = full_flows[i].detach().cpu() pose_est = poses_est[i].detach().cpu() disp_est = disps_est[i].detach().cpu() if downsample: disp_est = disp_est[:, :, 3::8, 3::8] coords_flow = coords0 + full_flow coords_cam, _ = projective_transform( pose_est, disp_est, intrinsics, ii, jj) delta = (coords_flow - coords_cam).norm(dim=-1) art_mask = (delta <= thresh).float().unsqueeze(-1) art_list.append(art_mask) return art_list def upsample_inter(mask): batch, num, ht, wd, dim = mask.shape mask = mask.permute(0, 1, 4, 2, 3).contiguous() mask = mask.view(batch*num, dim, ht, wd) mask = F.interpolate(mask, scale_factor=8, mode='bilinear', align_corners=True, recompute_scale_factor=True) mask = mask.permute(0, 2, 3, 1).contiguous() return mask.view(batch, num, 8*ht, 8*wd, dim) def art_label_loss(art_masks, masks, gamma=0.9, downsample=True): """Artificial Labels Loss""" # ht, wd = masks[0].shape[2], masks[0].shape[3] # ii, jj, kk = graph_to_edge_list(graph) # gt_vals_all = gt_vals[:, ii] n = len(masks) al_loss = 0.0 for i in range(n): w = gamma ** (n - i - 1) if downsample: art_mask = upsample_inter(art_masks[i]).cuda() else: art_mask = art_masks[i].cuda() diff = ce_func(art_mask, masks[i]) # al_e = (diff*gt_vals_all).mean() al_e = diff.mean() al_loss += w * al_e metrics = { 'art_mask_error': al_e.item(), 'static_px_rate': art_mask.mean().item(), 'dynamic_px_rate': (1 - art_mask).mean().item() } return al_loss, metrics def gt_label_loss(gt_masks, gt_vals, masks, graph, gamma=0.9, mean_mask=False): """gt static/dynamic mask loss""" ii, jj, kk = graph_to_edge_list(graph) gt_masks_all = gt_masks[:, ii] gt_vals_all = gt_vals[:, ii] n = len(masks) gt_l_loss = 0.0 for i in range(n): w = gamma ** (n - i - 1) diff = ce_func(gt_masks_all, masks[i]) if mean_mask: gt_l_e = mean_on_mask(diff, gt_vals_all) else: gt_l_e = (diff*gt_vals_all).mean() gt_l_loss += w * gt_l_e metrics = { 'gt_mask_error': gt_l_e.item(), 'static_px_rate': (gt_masks_all*gt_vals_all).mean().item(), 'dynamic_px_rate': ((1-gt_masks_all)*gt_vals_all).mean().item(), } return gt_l_loss, metrics def ce_func(labels, inputs): pos = labels * torch.log(inputs+1e-10) neg = (1-labels) * torch.log(1-inputs+1e-10) return -(pos + neg) def consistency_loss(masks, n_frames, graph, gamma=0.9): """consistency loss to help mask be the same""" ii, jj, kk = graph_to_edge_list(graph) edge_cnt = [0]*(n_frames+1) for i in ii: edge_cnt[i+1] += 1 for i in ii: edge_cnt[i+1] += edge_cnt[i] n = len(masks) con_loss = 0 for i in range(n): w = gamma ** (n - i - 1) con_e = 0 for j in range(n_frames): tmp_mask = masks[i][:, edge_cnt[j]:edge_cnt[j+1]] tmp_mask_m = tmp_mask.mean(1, keepdim=True) con_e += (tmp_mask-tmp_mask_m).mean() con_e /= n_frames con_loss += con_e*w metrics = { 'con_error': con_e.item() } return con_loss, metrics ================================================ FILE: VO_Module/droid_slam/geom/projective_ops.py ================================================ import torch import torch.nn.functional as F from lietorch import SE3, Sim3 MIN_DEPTH = 0.2 def extract_intrinsics(intrinsics): return intrinsics[..., None, None, :].unbind(dim=-1) def coords_grid(ht, wd, **kwargs): y, x = torch.meshgrid( torch.arange(ht).to(**kwargs).float(), torch.arange(wd).to(**kwargs).float()) return torch.stack([x, y], dim=-1) def iproj(disps, intrinsics, jacobian=False): """ pinhole camera inverse projection """ ht, wd = disps.shape[2:] fx, fy, cx, cy = extract_intrinsics(intrinsics) y, x = torch.meshgrid( torch.arange(ht).to(disps.device).float(), torch.arange(wd).to(disps.device).float()) i = torch.ones_like(disps) X = (x - cx) / fx Y = (y - cy) / fy pts = torch.stack([X, Y, i, disps], dim=-1) if jacobian: J = torch.zeros_like(pts) J[..., -1] = 1.0 return pts, J return pts, None def proj(Xs, intrinsics, jacobian=False, return_depth=False): """ pinhole camera projection """ fx, fy, cx, cy = extract_intrinsics(intrinsics) X, Y, Z, D = Xs.unbind(dim=-1) Z = torch.where(Z < 0.5*MIN_DEPTH, torch.ones_like(Z), Z) d = 1.0 / Z x = fx * (X * d) + cx y = fy * (Y * d) + cy if return_depth: coords = torch.stack([x, y, D*d], dim=-1) else: coords = torch.stack([x, y], dim=-1) if jacobian: B, N, H, W = d.shape o = torch.zeros_like(d) proj_jac = torch.stack([ fx*d, o, -fx*X*d*d, o, o, fy*d, -fy*Y*d*d, o, # o, o, -D*d*d, d, ], dim=-1).view(B, N, H, W, 2, 4) return coords, proj_jac return coords, None def actp(Gij, X0, jacobian=False): """ action on point cloud """ X1 = Gij[:, :, None, None] * X0 if jacobian: X, Y, Z, d = X1.unbind(dim=-1) o = torch.zeros_like(d) B, N, H, W = d.shape if isinstance(Gij, SE3): Ja = torch.stack([ d, o, o, o, Z, -Y, o, d, o, -Z, o, X, o, o, d, Y, -X, o, o, o, o, o, o, o, ], dim=-1).view(B, N, H, W, 4, 6) elif isinstance(Gij, Sim3): Ja = torch.stack([ d, o, o, o, Z, -Y, X, o, d, o, -Z, o, X, Y, o, o, d, Y, -X, o, Z, o, o, o, o, o, o, o ], dim=-1).view(B, N, H, W, 4, 7) return X1, Ja return X1, None def projective_transform(poses, depths, intrinsics, ii, jj, jacobian=False, return_depth=False): """ map points from ii->jj """ # inverse project (pinhole) X0, Jz = iproj(depths[:, ii], intrinsics[:, ii], jacobian=jacobian) # transform: both pose i and j are w2c Gij = poses[:, jj] * poses[:, ii].inv() X1, Ja = actp(Gij, X0, jacobian=jacobian) # project (pinhole) x1, Jp = proj(X1, intrinsics[:, jj], jacobian=jacobian, return_depth=return_depth) # exclude points too close to camera valid = ((X1[..., 2] > MIN_DEPTH) & (X0[..., 2] > MIN_DEPTH)).float() valid = valid.unsqueeze(-1) if jacobian: # Ji transforms according to dual adjoint Jj = torch.matmul(Jp, Ja) Ji = -Gij[:, :, None, None, None].adjT(Jj) Jz = Gij[:, :, None, None] * Jz Jz = torch.matmul(Jp, Jz.unsqueeze(-1)) return x1, valid, (Ji, Jj, Jz) return x1, valid def projective_transform_unsup(poses, depths, intrinsics, ii, jj, jacobian=False, return_depth=True): """ map points from ii->jj """ # inverse project (pinhole) X0, Jz = iproj(depths[:, ii], intrinsics[:, ii], jacobian=jacobian) # transform: both pose i and j are w2c Gij = poses[:, jj] * poses[:, ii].inv() X1, Ja = actp(Gij, X0, jacobian=jacobian) # project (pinhole) # 返回的深度是逆深度 coords_disp, Jp = proj(X1, intrinsics[:, jj], jacobian=jacobian, return_depth=return_depth) x1, disp0 = coords_disp[..., 0:2], coords_disp[..., 2:3] # exclude points too close to camera valid = ((X1[..., 2] > MIN_DEPTH) & (X0[..., 2] > MIN_DEPTH)).float() valid = valid.unsqueeze(-1) if jacobian: # Ji transforms according to dual adjoint Jj = torch.matmul(Jp, Ja) Ji = -Gij[:, :, None, None, None].adjT(Jj) Jz = Gij[:, :, None, None] * Jz Jz = torch.matmul(Jp, Jz.unsqueeze(-1)) return x1, disp0, valid, (Ji, Jj, Jz) return x1, disp0, valid def induced_flow(poses, disps, intrinsics, ii, jj): """ optical flow induced by camera motion """ ht, wd = disps.shape[2:] y, x = torch.meshgrid( torch.arange(ht).to(disps.device).float(), torch.arange(wd).to(disps.device).float()) coords0 = torch.stack([x, y], dim=-1) coords1, valid = projective_transform( poses, disps, intrinsics, ii, jj, False) return coords1[..., :2] - coords0, valid def coords_clamp(coords, h_max, w_max, h_min=0, w_min=0): x_clamp = torch.clamp(coords[..., 0], w_min, w_max) y_clamp = torch.clamp(coords[..., 1], h_min, h_max) return torch.stack([x_clamp, y_clamp], dim=-1) def coords_valid(coords, h_max, w_max, h_min=0, w_min=0, neg_fac=0.1): val_p = ((coords[..., 0] < w_max) & (coords[..., 0] >= w_min) & (coords[..., 1] < h_max) & (coords[..., 1] >= h_min)).float().unsqueeze(-1) val_n = ((coords[..., 0] >= w_max) | (coords[..., 0] < w_min) | (coords[..., 1] >= h_max) | (coords[..., 1] < h_min)).float().unsqueeze(-1)*neg_fac val = val_p+val_n return val ================================================ FILE: VO_Module/droid_slam/logger.py ================================================ import torch from torch.utils.tensorboard import SummaryWriter SUM_FREQ = 100 class Logger: def __init__(self, name, scheduler): self.total_steps = 0 self.running_loss = {} self.writer = None self.name = name self.scheduler = scheduler def _print_training_status(self): if self.writer is None: self.writer = SummaryWriter('runs/%s' % self.name) print([k for k in self.running_loss]) lr = self.scheduler.get_lr().pop() metrics_data = [self.running_loss[k]/SUM_FREQ for k in self.running_loss.keys()] training_str = "[{:6d}, {:10.7f}] ".format(self.total_steps+1, lr) metrics_str = ("{:10.4f}, "*len(metrics_data)).format(*metrics_data) # print the training status print(training_str + metrics_str) for key in self.running_loss: val = self.running_loss[key] / SUM_FREQ self.writer.add_scalar(key, val, self.total_steps) self.running_loss[key] = 0.0 def push(self, metrics): for key in metrics: if key not in self.running_loss: self.running_loss[key] = 0.0 self.running_loss[key] += metrics[key] if self.total_steps % SUM_FREQ == SUM_FREQ-1: self._print_training_status() self.running_loss = {} self.total_steps += 1 def write_dict(self, results): for key in results: self.writer.add_scalar(key, results[key], self.total_steps) def close(self): self.writer.close() ================================================ FILE: VO_Module/droid_slam/modules/__init__.py ================================================ ================================================ FILE: VO_Module/droid_slam/modules/clipping.py ================================================ import torch import torch.nn as nn import torch.nn.functional as F GRAD_CLIP = .01 class GradClip(torch.autograd.Function): @staticmethod def forward(ctx, x): return x @staticmethod def backward(ctx, grad_x): o = torch.zeros_like(grad_x) grad_x = torch.where(grad_x.abs()>GRAD_CLIP, o, grad_x) grad_x = torch.where(torch.isnan(grad_x), o, grad_x) return grad_x class GradientClip(nn.Module): def __init__(self): super(GradientClip, self).__init__() def forward(self, x): return GradClip.apply(x) ================================================ FILE: VO_Module/droid_slam/modules/corr.py ================================================ import torch import torch.nn.functional as F import droid_backends class CorrSampler(torch.autograd.Function): @staticmethod def forward(ctx, volume, coords, radius): ctx.save_for_backward(volume,coords) ctx.radius = radius corr, = droid_backends.corr_index_forward(volume, coords, radius) return corr @staticmethod def backward(ctx, grad_output): volume, coords = ctx.saved_tensors grad_output = grad_output.contiguous() grad_volume, = droid_backends.corr_index_backward(volume, coords, grad_output, ctx.radius) return grad_volume, None, None class CorrBlock: def __init__(self, fmap1, fmap2, num_levels=4, radius=3): self.num_levels = num_levels self.radius = radius self.corr_pyramid = [] # all pairs correlation corr = CorrBlock.corr(fmap1, fmap2) batch, num, h1, w1, h2, w2 = corr.shape corr = corr.reshape(batch*num*h1*w1, 1, h2, w2) for i in range(self.num_levels): self.corr_pyramid.append( corr.view(batch*num, h1, w1, h2//2**i, w2//2**i)) corr = F.avg_pool2d(corr, 2, stride=2) def __call__(self, coords): out_pyramid = [] batch, num, ht, wd, _ = coords.shape coords = coords.permute(0,1,4,2,3) coords = coords.contiguous().view(batch*num, 2, ht, wd) for i in range(self.num_levels): corr = CorrSampler.apply(self.corr_pyramid[i], coords/2**i, self.radius) out_pyramid.append(corr.view(batch, num, -1, ht, wd)) return torch.cat(out_pyramid, dim=2) def cat(self, other): for i in range(self.num_levels): self.corr_pyramid[i] = torch.cat([self.corr_pyramid[i], other.corr_pyramid[i]], 0) return self def __getitem__(self, index): for i in range(self.num_levels): self.corr_pyramid[i] = self.corr_pyramid[i][index] return self @staticmethod def corr(fmap1, fmap2): """ all-pairs correlation """ batch, num, dim, ht, wd = fmap1.shape fmap1 = fmap1.reshape(batch*num, dim, ht*wd) / 4.0 fmap2 = fmap2.reshape(batch*num, dim, ht*wd) / 4.0 corr = torch.matmul(fmap1.transpose(1,2), fmap2) return corr.view(batch, num, ht, wd, ht, wd) class CorrLayer(torch.autograd.Function): @staticmethod def forward(ctx, fmap1, fmap2, coords, r): ctx.r = r ctx.save_for_backward(fmap1, fmap2, coords) corr, = droid_backends.altcorr_forward(fmap1, fmap2, coords, ctx.r) return corr @staticmethod def backward(ctx, grad_corr): fmap1, fmap2, coords = ctx.saved_tensors grad_corr = grad_corr.contiguous() fmap1_grad, fmap2_grad, coords_grad = \ droid_backends.altcorr_backward(fmap1, fmap2, coords, grad_corr, ctx.r) return fmap1_grad, fmap2_grad, coords_grad, None class AltCorrBlock: def __init__(self, fmaps, num_levels=4, radius=3): self.num_levels = num_levels self.radius = radius B, N, C, H, W = fmaps.shape fmaps = fmaps.view(B*N, C, H, W) / 4.0 self.pyramid = [] for i in range(self.num_levels): sz = (B, N, H//2**i, W//2**i, C) fmap_lvl = fmaps.permute(0, 2, 3, 1).contiguous() self.pyramid.append(fmap_lvl.view(*sz)) fmaps = F.avg_pool2d(fmaps, 2, stride=2) def corr_fn(self, coords, ii, jj): B, N, H, W, S, _ = coords.shape coords = coords.permute(0, 1, 4, 2, 3, 5) corr_list = [] for i in range(self.num_levels): r = self.radius fmap1_i = self.pyramid[0][:, ii] fmap2_i = self.pyramid[i][:, jj] coords_i = (coords / 2**i).reshape(B*N, S, H, W, 2).contiguous() fmap1_i = fmap1_i.reshape((B*N,) + fmap1_i.shape[2:]) fmap2_i = fmap2_i.reshape((B*N,) + fmap2_i.shape[2:]) corr = CorrLayer.apply(fmap1_i.float(), fmap2_i.float(), coords_i, self.radius) corr = corr.view(B, N, S, -1, H, W).permute(0, 1, 3, 4, 5, 2) corr_list.append(corr) corr = torch.cat(corr_list, dim=2) return corr def __call__(self, coords, ii, jj): squeeze_output = False if len(coords.shape) == 5: coords = coords.unsqueeze(dim=-2) squeeze_output = True corr = self.corr_fn(coords, ii, jj) if squeeze_output: corr = corr.squeeze(dim=-1) return corr.contiguous() ================================================ FILE: VO_Module/droid_slam/modules/extractor.py ================================================ import torch import torch.nn as nn import torch.nn.functional as F class ResidualBlock(nn.Module): def __init__(self, in_planes, planes, norm_fn='group', stride=1): super(ResidualBlock, self).__init__() self.conv1 = nn.Conv2d(in_planes, planes, kernel_size=3, padding=1, stride=stride) self.conv2 = nn.Conv2d(planes, planes, kernel_size=3, padding=1) self.relu = nn.ReLU(inplace=True) num_groups = planes // 8 if norm_fn == 'group': self.norm1 = nn.GroupNorm(num_groups=num_groups, num_channels=planes) self.norm2 = nn.GroupNorm(num_groups=num_groups, num_channels=planes) if not stride == 1: self.norm3 = nn.GroupNorm(num_groups=num_groups, num_channels=planes) elif norm_fn == 'batch': self.norm1 = nn.BatchNorm2d(planes) self.norm2 = nn.BatchNorm2d(planes) if not stride == 1: self.norm3 = nn.BatchNorm2d(planes) elif norm_fn == 'instance': self.norm1 = nn.InstanceNorm2d(planes) self.norm2 = nn.InstanceNorm2d(planes) if not stride == 1: self.norm3 = nn.InstanceNorm2d(planes) elif norm_fn == 'none': self.norm1 = nn.Sequential() self.norm2 = nn.Sequential() if not stride == 1: self.norm3 = nn.Sequential() if stride == 1: self.downsample = None else: self.downsample = nn.Sequential( nn.Conv2d(in_planes, planes, kernel_size=1, stride=stride), self.norm3) def forward(self, x): y = x y = self.relu(self.norm1(self.conv1(y))) y = self.relu(self.norm2(self.conv2(y))) if self.downsample is not None: x = self.downsample(x) return self.relu(x+y) class BottleneckBlock(nn.Module): def __init__(self, in_planes, planes, norm_fn='group', stride=1): super(BottleneckBlock, self).__init__() self.conv1 = nn.Conv2d(in_planes, planes//4, kernel_size=1, padding=0) self.conv2 = nn.Conv2d(planes//4, planes//4, kernel_size=3, padding=1, stride=stride) self.conv3 = nn.Conv2d(planes//4, planes, kernel_size=1, padding=0) self.relu = nn.ReLU(inplace=True) num_groups = planes // 8 if norm_fn == 'group': self.norm1 = nn.GroupNorm(num_groups=num_groups, num_channels=planes//4) self.norm2 = nn.GroupNorm(num_groups=num_groups, num_channels=planes//4) self.norm3 = nn.GroupNorm(num_groups=num_groups, num_channels=planes) if not stride == 1: self.norm4 = nn.GroupNorm(num_groups=num_groups, num_channels=planes) elif norm_fn == 'batch': self.norm1 = nn.BatchNorm2d(planes//4) self.norm2 = nn.BatchNorm2d(planes//4) self.norm3 = nn.BatchNorm2d(planes) if not stride == 1: self.norm4 = nn.BatchNorm2d(planes) elif norm_fn == 'instance': self.norm1 = nn.InstanceNorm2d(planes//4) self.norm2 = nn.InstanceNorm2d(planes//4) self.norm3 = nn.InstanceNorm2d(planes) if not stride == 1: self.norm4 = nn.InstanceNorm2d(planes) elif norm_fn == 'none': self.norm1 = nn.Sequential() self.norm2 = nn.Sequential() self.norm3 = nn.Sequential() if not stride == 1: self.norm4 = nn.Sequential() if stride == 1: self.downsample = None else: self.downsample = nn.Sequential( nn.Conv2d(in_planes, planes, kernel_size=1, stride=stride), self.norm4) def forward(self, x): y = x y = self.relu(self.norm1(self.conv1(y))) y = self.relu(self.norm2(self.conv2(y))) y = self.relu(self.norm3(self.conv3(y))) if self.downsample is not None: x = self.downsample(x) return self.relu(x+y) DIM=32 class BasicEncoder(nn.Module): def __init__(self, output_dim=128, norm_fn='batch', dropout=0.0, multidim=False): super(BasicEncoder, self).__init__() self.norm_fn = norm_fn self.multidim = multidim if self.norm_fn == 'group': self.norm1 = nn.GroupNorm(num_groups=8, num_channels=DIM) elif self.norm_fn == 'batch': self.norm1 = nn.BatchNorm2d(DIM) elif self.norm_fn == 'instance': self.norm1 = nn.InstanceNorm2d(DIM) elif self.norm_fn == 'none': self.norm1 = nn.Sequential() self.conv1 = nn.Conv2d(3, DIM, kernel_size=7, stride=2, padding=3) self.relu1 = nn.ReLU(inplace=True) self.in_planes = DIM self.layer1 = self._make_layer(DIM, stride=1) self.layer2 = self._make_layer(2*DIM, stride=2) self.layer3 = self._make_layer(4*DIM, stride=2) # output convolution self.conv2 = nn.Conv2d(4*DIM, output_dim, kernel_size=1) if self.multidim: self.layer4 = self._make_layer(256, stride=2) self.layer5 = self._make_layer(512, stride=2) self.in_planes = 256 self.layer6 = self._make_layer(256, stride=1) self.in_planes = 128 self.layer7 = self._make_layer(128, stride=1) self.up1 = nn.Conv2d(512, 256, 1) self.up2 = nn.Conv2d(256, 128, 1) self.conv3 = nn.Conv2d(128, output_dim, kernel_size=1) if dropout > 0: self.dropout = nn.Dropout2d(p=dropout) else: self.dropout = None for m in self.modules(): if isinstance(m, nn.Conv2d): nn.init.kaiming_normal_(m.weight, mode='fan_out', nonlinearity='relu') elif isinstance(m, (nn.BatchNorm2d, nn.InstanceNorm2d, nn.GroupNorm)): if m.weight is not None: nn.init.constant_(m.weight, 1) if m.bias is not None: nn.init.constant_(m.bias, 0) def _make_layer(self, dim, stride=1): layer1 = ResidualBlock(self.in_planes, dim, self.norm_fn, stride=stride) layer2 = ResidualBlock(dim, dim, self.norm_fn, stride=1) layers = (layer1, layer2) self.in_planes = dim return nn.Sequential(*layers) def forward(self, x): b, n, c1, h1, w1 = x.shape x = x.view(b*n, c1, h1, w1) x = self.conv1(x) x = self.norm1(x) x = self.relu1(x) x = self.layer1(x) x = self.layer2(x) x = self.layer3(x) x = self.conv2(x) _, c2, h2, w2 = x.shape return x.view(b, n, c2, h2, w2) ================================================ FILE: VO_Module/droid_slam/modules/gru.py ================================================ import torch import torch.nn as nn class ConvGRU(nn.Module): def __init__(self, h_planes=128, i_planes=128): super(ConvGRU, self).__init__() self.do_checkpoint = False self.convz = nn.Conv2d(h_planes+i_planes, h_planes, 3, padding=1) self.convr = nn.Conv2d(h_planes+i_planes, h_planes, 3, padding=1) self.convq = nn.Conv2d(h_planes+i_planes, h_planes, 3, padding=1) self.w = nn.Conv2d(h_planes, h_planes, 1, padding=0) self.convz_glo = nn.Conv2d(h_planes, h_planes, 1, padding=0) self.convr_glo = nn.Conv2d(h_planes, h_planes, 1, padding=0) self.convq_glo = nn.Conv2d(h_planes, h_planes, 1, padding=0) def forward(self, net, *inputs): inp = torch.cat(inputs, dim=1) net_inp = torch.cat([net, inp], dim=1) b, c, h, w = net.shape glo = torch.sigmoid(self.w(net)) * net glo = glo.view(b, c, h*w).mean(-1).view(b, c, 1, 1) z = torch.sigmoid(self.convz(net_inp) + self.convz_glo(glo)) r = torch.sigmoid(self.convr(net_inp) + self.convr_glo(glo)) q = torch.tanh(self.convq(torch.cat([r*net, inp], dim=1)) + self.convq_glo(glo)) net = (1-z) * net + z * q return net ================================================ FILE: VO_Module/droid_slam/motion_filter.py ================================================ import cv2 import torch import lietorch from collections import OrderedDict from droid_net import DroidNet import geom.projective_ops as pops from modules.corr import CorrBlock import time class MotionFilter: """ This class is used to filter incoming frames and extract features """ def __init__(self, net, video, thresh=2.5, device="cuda:0"): # split net modules self.cnet = net.cnet self.fnet = net.fnet self.update = net.update self.video = video self.thresh = thresh self.device = device self.count = 0 # mean, std for image normalization self.MEAN = torch.as_tensor([0.485, 0.456, 0.406], device=self.device)[ :, None, None] self.STDV = torch.as_tensor([0.229, 0.224, 0.225], device=self.device)[ :, None, None] @torch.cuda.amp.autocast(enabled=True) def __context_encoder(self, image): """ context features """ x = self.cnet(image) net, inp = self.cnet(image).split([128, 128], dim=2) return net.tanh().squeeze(0), inp.relu().squeeze(0) @torch.cuda.amp.autocast(enabled=True) def __feature_encoder(self, image): """ features for correlation volume """ return self.fnet(image).squeeze(0) @torch.cuda.amp.autocast(enabled=True) @torch.no_grad() def track(self, tstamp, image, depth=None, intrinsics=None, segments=None): """ main update operation - run on every frame in video """ Id = lietorch.SE3.Identity(1,).data.squeeze() ht = image.shape[-2] // 8 wd = image.shape[-1] // 8 # normalize images inputs = image[None, None, [2, 1, 0]].to(self.device) / 255.0 inputs = inputs.sub_(self.MEAN).div_(self.STDV) # extract features gmap = self.__feature_encoder(inputs) ### always add first frame to the depth video ### if self.video.counter.value == 0: net, inp = self.__context_encoder(inputs) self.net, self.inp, self.fmap = net, inp, gmap self.video.append(tstamp, image, Id, 1.0, intrinsics / 8.0, gmap[0], net[0], inp[0], segments) ### only add new frame if there is enough motion ### else: # index correlation volume coords0 = pops.coords_grid(ht, wd, device=self.device)[None, None] corr = CorrBlock(self.fmap[None], gmap[None])(coords0) # approximate flow magnitude using 1 update iteration _, delta, weight, _ = self.update( self.net[None], self.inp[None], corr, segments=None) # check motion magnitue / add new frame to video if delta[..., 0:2].norm(dim=-1).mean().item() > self.thresh: self.count = 0 net, inp = self.__context_encoder(inputs) self.net, self.inp, self.fmap = net, inp, gmap self.video.append(tstamp, image, None, None, intrinsics / 8.0, gmap[0], net[0], inp[0], segments) else: self.count += 1 @torch.cuda.amp.autocast(enabled=True) @torch.no_grad() def track_vo(self, tstamp, image, depth=None, intrinsics=None, segments=None): """ main update operation - run on every frame in video """ Id = lietorch.SE3.Identity(1,).data.squeeze() ht = image.shape[-2] // 8 wd = image.shape[-1] // 8 inputs = image[None, None, [2, 1, 0]].to(self.device) / 255.0 inputs = inputs.sub_(self.MEAN).div_(self.STDV) gmap = self.__feature_encoder(inputs) net, inp = self.__context_encoder(inputs) if self.video.counter.value == 0: self.video.append(tstamp, image, Id, 1.0, intrinsics / 8.0, gmap[0], net[0], inp[0], segments) else: self.video.append(tstamp, image, None, None, intrinsics / 8.0, gmap[0], net[0], inp[0], segments) ================================================ FILE: VO_Module/droid_slam/trajectory_filler.py ================================================ import cv2 import torch import lietorch from lietorch import SE3 from collections import OrderedDict from factor_graph import FactorGraph from droid_net import DroidNet import geom.projective_ops as pops class PoseTrajectoryFiller: """ This class is used to fill in non-keyframe poses """ def __init__(self, net, video, device="cuda:0"): # split net modules self.cnet = net.cnet self.fnet = net.fnet self.update = net.update self.count = 0 self.video = video self.device = device # mean, std for image normalization self.MEAN = torch.as_tensor([0.485, 0.456, 0.406], device=self.device)[:, None, None] self.STDV = torch.as_tensor([0.229, 0.224, 0.225], device=self.device)[:, None, None] @torch.cuda.amp.autocast(enabled=True) def __feature_encoder(self, image): """ features for correlation volume """ return self.fnet(image).squeeze(0) def __fill(self, tstamps, images, intrinsics): """ fill operator """ tt = torch.as_tensor(tstamps, device=self.device) images = torch.stack(images, 0) intrinsics = torch.stack(intrinsics, 0) inputs = images[None,:,[2,1,0]].to(self.device) / 255.0 ### linear pose interpolation ### N = self.video.counter.value M = len(tstamps) ts = self.video.tstamp[:N] Ps = SE3(self.video.poses[:N]) t0 = torch.as_tensor([ts[ts<=t].shape[0] - 1 for t in tstamps]) t1 = torch.where(t0 0: pose_list += self.__fill(tstamps, images, intrinsics) # stitch pose segments together return lietorch.cat(pose_list, 0) ================================================ FILE: VO_Module/droid_slam/visualization.py ================================================ import torch import cv2 import lietorch import droid_backends import time import argparse import numpy as np import open3d as o3d from lietorch import SE3 import geom.projective_ops as pops CAM_POINTS = np.array([ [ 0, 0, 0], [-1, -1, 1.5], [ 1, -1, 1.5], [ 1, 1, 1.5], [-1, 1, 1.5], [-0.5, 1, 1.5], [ 0.5, 1, 1.5], [ 0, 1.2, 1.5]]) CAM_LINES = np.array([ [1,2], [2,3], [3,4], [4,1], [1,0], [0,2], [3,0], [0,4], [5,7], [7,6]]) def white_balance(img): # from https://stackoverflow.com/questions/46390779/automatic-white-balancing-with-grayworld-assumption result = cv2.cvtColor(img, cv2.COLOR_BGR2LAB) avg_a = np.average(result[:, :, 1]) avg_b = np.average(result[:, :, 2]) result[:, :, 1] = result[:, :, 1] - ((avg_a - 128) * (result[:, :, 0] / 255.0) * 1.1) result[:, :, 2] = result[:, :, 2] - ((avg_b - 128) * (result[:, :, 0] / 255.0) * 1.1) result = cv2.cvtColor(result, cv2.COLOR_LAB2BGR) return result def create_camera_actor(g, scale=0.05): """ build open3d camera polydata """ camera_actor = o3d.geometry.LineSet( points=o3d.utility.Vector3dVector(scale * CAM_POINTS), lines=o3d.utility.Vector2iVector(CAM_LINES)) color = (g * 1.0, 0.5 * (1-g), 0.9 * (1-g)) camera_actor.paint_uniform_color(color) return camera_actor def create_point_actor(points, colors): """ open3d point cloud from numpy array """ point_cloud = o3d.geometry.PointCloud() point_cloud.points = o3d.utility.Vector3dVector(points) point_cloud.colors = o3d.utility.Vector3dVector(colors) return point_cloud def droid_visualization(video, device="cuda:0"): """ DROID visualization frontend """ torch.cuda.set_device(device) droid_visualization.video = video droid_visualization.cameras = {} droid_visualization.points = {} droid_visualization.warmup = 8 droid_visualization.scale = 1.0 droid_visualization.ix = 0 droid_visualization.filter_thresh = 0.005 def increase_filter(vis): droid_visualization.filter_thresh *= 2 with droid_visualization.video.get_lock(): droid_visualization.video.dirty[:droid_visualization.video.counter.value] = True def decrease_filter(vis): droid_visualization.filter_thresh *= 0.5 with droid_visualization.video.get_lock(): droid_visualization.video.dirty[:droid_visualization.video.counter.value] = True def animation_callback(vis): cam = vis.get_view_control().convert_to_pinhole_camera_parameters() with torch.no_grad(): with video.get_lock(): t = video.counter.value dirty_index, = torch.where(video.dirty.clone()) dirty_index = dirty_index if len(dirty_index) == 0: return video.dirty[dirty_index] = False # convert poses to 4x4 matrix poses = torch.index_select(video.poses, 0, dirty_index) disps = torch.index_select(video.disps, 0, dirty_index) Ps = SE3(poses).inv().matrix().cpu().numpy() images = torch.index_select(video.images, 0, dirty_index) images = images.cpu()[:,[2,1,0],3::8,3::8].permute(0,2,3,1) / 255.0 points = droid_backends.iproj(SE3(poses).inv().data, disps, video.intrinsics[0]).cpu() thresh = droid_visualization.filter_thresh * torch.ones_like(disps.mean(dim=[1,2])) count = droid_backends.depth_filter( video.poses, video.disps, video.intrinsics[0], dirty_index, thresh) count = count.cpu() disps = disps.cpu() masks = ((count >= 2) & (disps > .5*disps.mean(dim=[1,2], keepdim=True))) for i in range(len(dirty_index)): pose = Ps[i] ix = dirty_index[i].item() if ix in droid_visualization.cameras: vis.remove_geometry(droid_visualization.cameras[ix]) del droid_visualization.cameras[ix] if ix in droid_visualization.points: vis.remove_geometry(droid_visualization.points[ix]) del droid_visualization.points[ix] ### add camera actor ### cam_actor = create_camera_actor(True) cam_actor.transform(pose) vis.add_geometry(cam_actor) droid_visualization.cameras[ix] = cam_actor mask = masks[i].reshape(-1) pts = points[i].reshape(-1, 3)[mask].cpu().numpy() clr = images[i].reshape(-1, 3)[mask].cpu().numpy() ## add point actor ### point_actor = create_point_actor(pts, clr) vis.add_geometry(point_actor) droid_visualization.points[ix] = point_actor # hack to allow interacting with vizualization during inference if len(droid_visualization.cameras) >= droid_visualization.warmup: cam = vis.get_view_control().convert_from_pinhole_camera_parameters(cam) droid_visualization.ix += 1 vis.poll_events() vis.update_renderer() ### create Open3D visualization ### vis = o3d.visualization.VisualizerWithKeyCallback() vis.register_animation_callback(animation_callback) vis.register_key_callback(ord("S"), increase_filter) vis.register_key_callback(ord("A"), decrease_filter) vis.create_window(height=540, width=960) vis.get_render_option().load_from_json("misc/renderoption.json") vis.run() vis.destroy_window() ================================================ FILE: VO_Module/environment.yaml ================================================ name: droidenv channels: - rusty1s - pytorch - open3d-admin - nvidia - conda-forge - defaults dependencies: - pytorch-scatter - torchaudio - torchvision - open3d - pytorch - cudatoolkit - tensorboard - scipy - opencv - tqdm - suitesparse - matplotlib - pyyaml ================================================ FILE: VO_Module/environment_novis.yaml ================================================ name: droidenv channels: - rusty1s - pytorch - nvidia - conda-forge - defaults dependencies: - pytorch-scatter - torchaudio - torchvision - pytorch - cudatoolkit=11.1 - tensorboard - scipy - opencv - tqdm - suitesparse - matplotlib - pyyaml ================================================ FILE: VO_Module/evaluation_scripts/flow_vis_utils.py ================================================ # Flow visualization code used from https://github.com/tomrunia/OpticalFlow_Visualization # MIT License # # Copyright (c) 2018 Tom Runia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to conditions. # # Author: Tom Runia # Date Created: 2018-08-03 import numpy as np def make_colorwheel(): """ Generates a color wheel for optical flow visualization as presented in: Baker et al. "A Database and Evaluation Methodology for Optical Flow" (ICCV, 2007) URL: http://vision.middlebury.edu/flow/flowEval-iccv07.pdf Code follows the original C++ source code of Daniel Scharstein. Code follows the the Matlab source code of Deqing Sun. Returns: np.ndarray: Color wheel """ RY = 15 YG = 6 GC = 4 CB = 11 BM = 13 MR = 6 ncols = RY + YG + GC + CB + BM + MR colorwheel = np.zeros((ncols, 3)) col = 0 # RY colorwheel[0:RY, 0] = 255 colorwheel[0:RY, 1] = np.floor(255*np.arange(0,RY)/RY) col = col+RY # YG colorwheel[col:col+YG, 0] = 255 - np.floor(255*np.arange(0,YG)/YG) colorwheel[col:col+YG, 1] = 255 col = col+YG # GC colorwheel[col:col+GC, 1] = 255 colorwheel[col:col+GC, 2] = np.floor(255*np.arange(0,GC)/GC) col = col+GC # CB colorwheel[col:col+CB, 1] = 255 - np.floor(255*np.arange(CB)/CB) colorwheel[col:col+CB, 2] = 255 col = col+CB # BM colorwheel[col:col+BM, 2] = 255 colorwheel[col:col+BM, 0] = np.floor(255*np.arange(0,BM)/BM) col = col+BM # MR colorwheel[col:col+MR, 2] = 255 - np.floor(255*np.arange(MR)/MR) colorwheel[col:col+MR, 0] = 255 return colorwheel def flow_uv_to_colors(u, v, convert_to_bgr=False): """ Applies the flow color wheel to (possibly clipped) flow components u and v. According to the C++ source code of Daniel Scharstein According to the Matlab source code of Deqing Sun Args: u (np.ndarray): Input horizontal flow of shape [H,W] v (np.ndarray): Input vertical flow of shape [H,W] convert_to_bgr (bool, optional): Convert output image to BGR. Defaults to False. Returns: np.ndarray: Flow visualization image of shape [H,W,3] """ flow_image = np.zeros((u.shape[0], u.shape[1], 3), np.uint8) colorwheel = make_colorwheel() # shape [55x3] ncols = colorwheel.shape[0] rad = np.sqrt(np.square(u) + np.square(v)) a = np.arctan2(-v, -u)/np.pi fk = (a+1) / 2*(ncols-1) k0 = np.floor(fk).astype(np.int32) k1 = k0 + 1 k1[k1 == ncols] = 0 f = fk - k0 for i in range(colorwheel.shape[1]): tmp = colorwheel[:,i] col0 = tmp[k0] / 255.0 col1 = tmp[k1] / 255.0 col = (1-f)*col0 + f*col1 idx = (rad <= 1) col[idx] = 1 - rad[idx] * (1-col[idx]) col[~idx] = col[~idx] * 0.75 # out of range # Note the 2-i => BGR instead of RGB ch_idx = 2-i if convert_to_bgr else i flow_image[:,:,ch_idx] = np.floor(255 * col) return flow_image def flow_to_image(flow_uv, clip_flow=None, convert_to_bgr=False): """ Expects a two dimensional flow image of shape. Args: flow_uv (np.ndarray): Flow UV image of shape [H,W,2] clip_flow (float, optional): Clip maximum of flow values. Defaults to None. convert_to_bgr (bool, optional): Convert output image to BGR. Defaults to False. Returns: np.ndarray: Flow visualization image of shape [H,W,3] """ assert flow_uv.ndim == 3, 'input flow must have three dimensions' assert flow_uv.shape[2] == 2, 'input flow must have shape [H,W,2]' if clip_flow is not None: flow_uv = np.clip(flow_uv, 0, clip_flow) u = flow_uv[:,:,0] v = flow_uv[:,:,1] rad = np.sqrt(np.square(u) + np.square(v)) rad_max = np.max(rad) epsilon = 1e-5 u = u / (rad_max + epsilon) v = v / (rad_max + epsilon) # print(np.unique(u)) return flow_uv_to_colors(u, v, convert_to_bgr) def writeFlow(filename,uv,v=None): """ Write optical flow to file. If v is None, uv is assumed to contain both u and v channels, stacked in depth. Original code by Deqing Sun, adapted from Daniel Scharstein. """ nBands = 2 if v is None: assert(uv.ndim == 3) assert(uv.shape[2] == 2) u = uv[:,:,0] v = uv[:,:,1] else: u = uv assert(u.shape == v.shape) height,width = u.shape f = open(filename,'wb') # write the header f.write(TAG_CHAR) np.array(width).astype(np.int32).tofile(f) np.array(height).astype(np.int32).tofile(f) # arrange into matrix form tmp = np.zeros((height, width*nBands)) tmp[:,np.arange(width)*2] = u tmp[:,np.arange(width)*2 + 1] = v tmp.astype(np.float32).tofile(f) f.close() ================================================ FILE: VO_Module/evaluation_scripts/test_vo.py ================================================ import sys sys.path.append('VO_Module/droid_slam') from droid import Droid import glob import torch.nn.functional as F import argparse import time import os import cv2 import lietorch import torch import numpy as np from tqdm import tqdm from panopticapi.utils import rgb2id, id2rgb import PIL.Image as Image def image_stream(datapath, image_size=[240, 808], mode='train', args=None): # ------------------------------------------- """ image generator """ fx, fy, cx, cy = 725.0087, 725.0087, 620.5, 187 split = { 'train': 'clone', 'val': '15-deg-left', 'test': '30-deg-right' } images = np.array(sorted(glob.glob(os.path.join(datapath, split[mode], 'frames/rgb/Camera_0/*.jpg')))) segments_list = sorted(glob.glob(os.path.join(datapath, split[mode], 'panFPN_segm/*.png'))) images_list = images.tolist() print("-----test images :", len(images_list)) segm = None for t, imfile in enumerate(images_list): image = cv2.imread(imfile) h0, w0, _ = image.shape h1, w1 = image_size[0], image_size[1] image = cv2.resize(image, (w1, h1)) image = image[:h1-h1 % 8, :w1-w1 % 8] image = torch.as_tensor(image).int().permute(2, 0, 1) if args.segm_filter: segm = rgb2id(np.array(Image.open(segments_list[t]))) segm = torch.as_tensor(segm).unsqueeze(0).unsqueeze(0).float() segm = F.interpolate(segm, size=(h1,w1)) segm = segm[:h1-h1 % 8, :w1-w1 % 8] segm = F.interpolate(segm, scale_factor=1/8, recompute_scale_factor=True).int() intrinsics = torch.as_tensor([fx, fy, cx, cy]) intrinsics[0:2] *= (w1 / w0) intrinsics[2:4] *= (h1 / h0) yield t, image, intrinsics , segm def init(): parser = argparse.ArgumentParser() parser.add_argument('--datapath') parser.add_argument("--device", default="cuda:0") parser.add_argument("--weights", default="checkpoints/vkitti2_dy_train_semiv4_080000.pth") parser.add_argument("--buffer", type=int, default=1024) parser.add_argument("--image_size", default=[240, 808]) parser.add_argument("--disable_vis", action="store_true") parser.add_argument("--use_aff_bri", type=bool, default=False) parser.add_argument("--beta", type=float, default=0.6) parser.add_argument("--filter_thresh", type=float, default=1.75) parser.add_argument("--warmup", type=int, default=12) parser.add_argument("--keyframe_thresh", type=float, default=2.25) parser.add_argument("--frontend_thresh", type=float, default=12.0) parser.add_argument("--frontend_window", type=int, default=25) # 2 parser.add_argument("--frontend_radius", type=int, default=2) parser.add_argument("--frontend_nms", type=int, default=1) parser.add_argument("--backend_thresh", type=float, default=15.0) parser.add_argument("--backend_radius", type=int, default=2) parser.add_argument("--backend_nms", type=int, default=3) parser.add_argument("--segm_filter", type=bool, default=False, help="if filter weight with segmentaion in factory graph") parser.add_argument("--thresh", type=float, default=0.8) args = parser.parse_args() return args if __name__ == '__main__': args = init() # os.environ["CUDA_VISIBLE_DEVICES"] = args.device.split(':')[-1] torch.multiprocessing.set_start_method('spawn') print("Running evaluation on {}".format(args.datapath)) print(args) if args.datapath[-2:] == "20": args.thresh = 0.9 droid = Droid(args) time.sleep(5) print("segm_filter: ",args.segm_filter) for (t, image, intrinsics, segm) in tqdm(image_stream(args.datapath, mode='val', args=args)): droid.track(t, image, intrinsics=intrinsics, segments=segm) print("video frames: ", droid.video.counter.value) traj_est = droid.terminate(image_stream(args.datapath, mode='val', args=args), need_inv=True) ### run evaluation ### print("#"*20 + " Results...") import evo from evo.core.trajectory import PoseTrajectory3D from evo.core.trajectory import PosePath3D from evo.tools import file_interface from evo.core import sync import evo.main_ape as main_ape from evo.core.metrics import PoseRelation def read_vkitti2_poses_file(file_path, args) -> PosePath3D: """ parses pose file in Virtual KITTI 2 format (first 3 rows of SE(3) matrix per line) :param file_path: the trajectory file path (or file handle) :return: trajectory.PosePath3D """ raw_mat = np.loadtxt(file_path, delimiter=' ', skiprows=1)[::2, 2:] error_msg = ("Virtual KITTI 2 pose files must have 16 entries per row " "and no trailing delimiter at the end of the rows (space)") if raw_mat is None or (len(raw_mat) > 0 and len(raw_mat[0]) != 16): raise file_interface.FileInterfaceException(error_msg) try: mat = np.array(raw_mat).astype(float) except ValueError: raise file_interface.FileInterfaceException(error_msg) poses = [np.linalg.inv(np.array([[r[0], r[1], r[2], r[3]], [r[4], r[5], r[6], r[7]], [r[8], r[9], r[10], r[11]], [r[12], r[13], r[14], r[15]]])) for r in mat] # yapf: enable if not hasattr(file_path, 'read'): # if not file handle print("Loaded {} poses from: {}".format(len(poses), file_path)) return PosePath3D(poses_se3=poses) gt_file = os.path.join(args.datapath, '15-deg-left/extrinsic.txt') traj_ref = read_vkitti2_poses_file(gt_file, args) traj_est = PosePath3D( positions_xyz=traj_est[:, :3], orientations_quat_wxyz=traj_est[:, 3:]) root = 'shared_data/traj/' root = os.path.join(root, args.datapath.rsplit('/')[-1]) root = os.path.join(root, '15-deg-left') if not os.path.isdir(root): os.makedirs(root) est_file = os.path.join(root, 'pvo_traj.txt') print(est_file) file_interface.write_kitti_poses_file(est_file, traj_est) result = main_ape.ape(traj_ref, traj_est, est_name='traj', pose_relation=PoseRelation.translation_part, align=True, correct_scale=True) print(result) ================================================ FILE: VO_Module/evaluation_scripts/test_vo2.py ================================================ import sys sys.path.append('VO_Module/droid_slam') import torch from torch.utils.data import DataLoader import glob import os import os.path as osp import cv2 import numpy as np import torch.nn.functional as F from scipy.spatial.transform import Rotation as R from collections import OrderedDict from lietorch import SE3 from flow_vis_utils import flow_to_image from geom.projective_ops import projective_transform, coords_grid from geom.graph_utils import graph_to_edge_list from droid_net import DroidNet, upsample_inter from data_readers.factory import dataset_factory import data_readers.vkitti2 import argparse def resize(mask, size, need_permute): if need_permute: mask = mask.permute(0, 1, 4, 2, 3).contiguous() batch, num, dim, ht, wd = mask.shape mask = mask.view(batch*num, dim, ht, wd) mask = F.interpolate(mask, size=size, mode='bilinear', align_corners=True) if need_permute: mask = mask.permute(0, 2, 3, 1).contiguous() return mask.view(batch, num, size[0], size[1], dim) else: return mask.view(batch, num, dim, size[0], size[1]) dic = { "Scene01":"0001", "Scene02":"0002", "Scene06":"0006", "Scene18":"0018", "Scene20":"0020",} def init(): parser = argparse.ArgumentParser() parser.add_argument("--n_frames", type=int, default=2) parser.add_argument("--save_npy", type=bool, default=True, help="save flow and depth") parser.add_argument("--image_size", default=[376, 1248]) parser.add_argument("--scene", default="Scene02") parser.add_argument("--full_flow_dir", default="shared_data/full_flow") parser.add_argument("--depth_dir", default="shared_data/depth") parser.add_argument("--weights_file", default="checkpoints/vkitti2_dy_train_semiv4_080000.pth") args = parser.parse_args() return args if __name__ == '__main__': args = init() full_flow_dir = args.full_flow_dir depth_dir = args.depth_dir img_size = args.image_size n_frames = args.n_frames scene_id = args.scene save_npy = args.save_npy if not osp.exists(full_flow_dir): os.makedirs(full_flow_dir) if not osp.exists(depth_dir): os.makedirs(depth_dir) db = dataset_factory(['vkitti2'], datapath='datasets/Virtual_KITTI2', do_aug=False, n_frames=n_frames, flow_label=False, aug_graph=False, split_mode='train', foo=True, scene_id = scene_id, need_inv=False, build_mask=False, crop_size=img_size, mode='semisup', rebuild=True, ) train_loader = DataLoader(db, batch_size=1, num_workers=2) device = 'cuda:0' torch.cuda.set_device(int(device.split(':')[-1])) graph = OrderedDict() for i in range(n_frames): graph[i] = [j for j in range(n_frames) if abs(i-j) == 1] ii, jj, _ = graph_to_edge_list(graph) model = DroidNet() state_dict = OrderedDict([(k.replace("module.", ""), v) for (k, v) in torch.load(args.weights_file, device).items()]) model.load_state_dict(state_dict) model.to(device).eval() coords0 = coords_grid(img_size[0], img_size[1], device=device) Gs = None disps_est = None for i_batch, item in enumerate(train_loader): images, poses, disps, intrinsics, gt_masks, gt_vals, segments = [ x.to('cuda') for x in item if type(x) != list] file1, file2 = item[0] hr, wr = img_size[0]/images.shape[3], img_size[1]/images.shape[4] intrinsics[:, :, 0] *= wr intrinsics[:, :, 2] *= wr intrinsics[:, :, 1] *= hr intrinsics[:, :, 3] *= hr images = resize(images, img_size, False) disps = resize(disps.unsqueeze(2), img_size, False).squeeze(2) gt_masks = resize(gt_masks, img_size, True) gt_vals = resize(gt_vals, img_size, True) Gs = SE3(poses) disp0 = torch.ones_like(disps[:, :, 3::8, 3::8]) # 1x2x48x156 for _ in range(1): poses_est, disps_est, residuals, full_flows, masks = \ model(Gs, images, disp0, intrinsics/8, graph, num_steps=15, fixedp=2, ret_flow=True, downsample=True) Gs = poses_est[-1] disp0 = disps_est[-1][:, :, 3::8, 3::8] coords1, val0 = projective_transform( poses_est[-1], disps_est[-1], intrinsics, ii, jj) cam_flow = (coords1-coords0)[0, 0] full_flow = (upsample_inter(full_flows[-1]*8))[0, 0] resd = full_flow-cam_flow mask = (masks[-1][0, 0].mean(-1, keepdim=True) >= 0.5).float() img_id = dic[scene_id] + '_' + file1[0].rsplit('_')[-1][:-4] print(img_id) full_flow_np = full_flow.detach().cpu().numpy() full_flow_1 = full_flow_np*gt_vals[0,0].cpu().numpy() if save_npy: full_flow_1 = cv2.resize(full_flow_1, (375, 1242)) np.save(osp.join(full_flow_dir, img_id +'.npy'), full_flow_1) depth = disps_est[-1][0, 0].detach().cpu().numpy() np.save(osp.join(depth_dir, img_id +'.npy'), depth) print('Finished building %d img with flows' % i_batch) depth = disps_est[-1][0, 1].detach().cpu().numpy() int_id = int(img_id[-2]) * 10 + int(img_id[-1]) + 1 img_id = img_id[:-2] + str(int_id) np.save(osp.join(depth_dir, img_id +'.npy'), depth) print(img_id) ================================================ FILE: VO_Module/setup.py ================================================ from setuptools import setup from torch.utils.cpp_extension import BuildExtension, CUDAExtension import os.path as osp ROOT = osp.dirname(osp.abspath(__file__)) setup( name='droid_backends', ext_modules=[ CUDAExtension('droid_backends', include_dirs=[osp.join(ROOT, 'thirdparty/eigen')], sources=[ 'src/droid.cpp', 'src/droid_kernels.cu', 'src/correlation_kernels.cu', 'src/altcorr_kernel.cu', ], extra_compile_args={ 'cxx': ['-O3'], 'nvcc': ['-O3', '-gencode=arch=compute_60,code=sm_60', '-gencode=arch=compute_61,code=sm_61', '-gencode=arch=compute_70,code=sm_70', '-gencode=arch=compute_75,code=sm_75', # if wrong please comment out following # This depends on your device's Computing Power '-gencode=arch=compute_80,code=sm_80', '-gencode=arch=compute_86,code=sm_86', ] }), ], cmdclass={ 'build_ext' : BuildExtension } ) setup( name='lietorch', version='0.2', description='Lie Groups for PyTorch', packages=['lietorch'], package_dir={'': 'thirdparty/lietorch'}, ext_modules=[ CUDAExtension('lietorch_backends', include_dirs=[ osp.join(ROOT, 'thirdparty/lietorch/lietorch/include'), osp.join(ROOT, 'thirdparty/eigen')], sources=[ 'thirdparty/lietorch/lietorch/src/lietorch.cpp', 'thirdparty/lietorch/lietorch/src/lietorch_gpu.cu', 'thirdparty/lietorch/lietorch/src/lietorch_cpu.cpp'], extra_compile_args={ 'cxx': ['-O2'], 'nvcc': ['-O2', '-gencode=arch=compute_60,code=sm_60', '-gencode=arch=compute_61,code=sm_61', '-gencode=arch=compute_70,code=sm_70', '-gencode=arch=compute_75,code=sm_75', # if wrong please comment out following # This depends on your device's Computing Power '-gencode=arch=compute_80,code=sm_80', '-gencode=arch=compute_86,code=sm_86', ] }), ], cmdclass={ 'build_ext' : BuildExtension } ) ================================================ FILE: VO_Module/src/altcorr_kernel.cu ================================================ #include #include #include #include #include #include #include #include #include #include #define BLOCK_H 4 #define BLOCK_W 8 #define BLOCK_HW BLOCK_H * BLOCK_W #define CHANNEL_STRIDE 32 __forceinline__ __device__ bool within_bounds(int h, int w, int H, int W) { return h >= 0 && h < H && w >= 0 && w < W; } template __global__ void altcorr_forward_kernel( const torch::PackedTensorAccessor32 fmap1, const torch::PackedTensorAccessor32 fmap2, const torch::PackedTensorAccessor32 coords, torch::PackedTensorAccessor32 corr, int r) { const int b = blockIdx.x; const int h0 = blockIdx.y * blockDim.x; const int w0 = blockIdx.z * blockDim.y; const int tid = threadIdx.x * blockDim.y + threadIdx.y; const int H1 = fmap1.size(1); const int W1 = fmap1.size(2); const int H2 = fmap2.size(1); const int W2 = fmap2.size(2); const int N = coords.size(1); const int C = fmap1.size(3); __shared__ scalar_t f1[CHANNEL_STRIDE][BLOCK_HW]; __shared__ scalar_t f2[CHANNEL_STRIDE][BLOCK_HW]; __shared__ float x2s[BLOCK_HW]; __shared__ float y2s[BLOCK_HW]; for (int c=0; c(floor(y2s[k1])) - r + iy; int w2 = static_cast(floor(x2s[k1])) - r + ix; int c2 = tid % CHANNEL_STRIDE; if (within_bounds(h2, w2, H2, W2)) f2[c2][k1] = fmap2[b][h2][w2][c+c2]; else f2[c2][k1] = static_cast(0.0); } __syncthreads(); scalar_t s = 0.0; for (int k=0; k((dy) * (dx)); scalar_t ne = s * static_cast((dy) * (1-dx)); scalar_t sw = s * static_cast((1-dy) * (dx)); scalar_t se = s * static_cast((1-dy) * (1-dx)); // if (iy > 0 && ix > 0 && within_bounds(h1, w1, H1, W1)) // corr[b][n][ix_nw][h1][w1] += nw; // if (iy > 0 && ix < rd && within_bounds(h1, w1, H1, W1)) // corr[b][n][ix_ne][h1][w1] += ne; // if (iy < rd && ix > 0 && within_bounds(h1, w1, H1, W1)) // corr[b][n][ix_sw][h1][w1] += sw; // if (iy < rd && ix < rd && within_bounds(h1, w1, H1, W1)) // corr[b][n][ix_se][h1][w1] += se; scalar_t* corr_ptr = &corr[b][n][0][h1][w1]; if (iy > 0 && ix > 0 && within_bounds(h1, w1, H1, W1)) *(corr_ptr + ix_nw) += nw; if (iy > 0 && ix < rd && within_bounds(h1, w1, H1, W1)) *(corr_ptr + ix_ne) += ne; if (iy < rd && ix > 0 && within_bounds(h1, w1, H1, W1)) *(corr_ptr + ix_sw) += sw; if (iy < rd && ix < rd && within_bounds(h1, w1, H1, W1)) *(corr_ptr + ix_se) += se; } } } } } template __global__ void altcorr_backward_kernel( const torch::PackedTensorAccessor32 fmap1, const torch::PackedTensorAccessor32 fmap2, const torch::PackedTensorAccessor32 coords, const torch::PackedTensorAccessor32 corr_grad, torch::PackedTensorAccessor32 fmap1_grad, torch::PackedTensorAccessor32 fmap2_grad, torch::PackedTensorAccessor32 coords_grad, int r) { const int b = blockIdx.x; const int h0 = blockIdx.y * blockDim.x; const int w0 = blockIdx.z * blockDim.y; const int tid = threadIdx.x * blockDim.y + threadIdx.y; const int H1 = fmap1.size(1); const int W1 = fmap1.size(2); const int H2 = fmap2.size(1); const int W2 = fmap2.size(2); const int N = coords.size(1); const int C = fmap1.size(3); __shared__ scalar_t f1[CHANNEL_STRIDE][BLOCK_HW+1]; __shared__ scalar_t f2[CHANNEL_STRIDE][BLOCK_HW+1]; __shared__ scalar_t f1_grad[CHANNEL_STRIDE][BLOCK_HW+1]; __shared__ scalar_t f2_grad[CHANNEL_STRIDE][BLOCK_HW+1]; __shared__ scalar_t x2s[BLOCK_HW]; __shared__ scalar_t y2s[BLOCK_HW]; for (int c=0; c(floor(y2s[k1]))-r+iy; int w2 = static_cast(floor(x2s[k1]))-r+ix; int c2 = tid % CHANNEL_STRIDE; auto fptr = fmap2[b][h2][w2]; if (within_bounds(h2, w2, H2, W2)) f2[c2][k1] = fptr[c+c2]; else f2[c2][k1] = 0.0; f2_grad[c2][k1] = 0.0; } __syncthreads(); const scalar_t* grad_ptr = &corr_grad[b][n][0][h1][w1]; scalar_t g = 0.0; int ix_nw = H1*W1*((iy-1) + rd*(ix-1)); int ix_ne = H1*W1*((iy-1) + rd*ix); int ix_sw = H1*W1*(iy + rd*(ix-1)); int ix_se = H1*W1*(iy + rd*ix); if (iy > 0 && ix > 0 && within_bounds(h1, w1, H1, W1)) g += *(grad_ptr + ix_nw) * dy * dx; if (iy > 0 && ix < rd && within_bounds(h1, w1, H1, W1)) g += *(grad_ptr + ix_ne) * dy * (1-dx); if (iy < rd && ix > 0 && within_bounds(h1, w1, H1, W1)) g += *(grad_ptr + ix_sw) * (1-dy) * dx; if (iy < rd && ix < rd && within_bounds(h1, w1, H1, W1)) g += *(grad_ptr + ix_se) * (1-dy) * (1-dx); for (int k=0; k(floor(y2s[k1]))-r+iy; int w2 = static_cast(floor(x2s[k1]))-r+ix; int c2 = tid % CHANNEL_STRIDE; scalar_t* fptr = &fmap2_grad[b][h2][w2][0]; if (within_bounds(h2, w2, H2, W2)) atomicAdd(fptr+c+c2, f2_grad[c2][k1]); } } } } __syncthreads(); for (int k=0; k altcorr_cuda_forward( torch::Tensor fmap1, torch::Tensor fmap2, torch::Tensor coords, int radius) { const auto B = coords.size(0); const auto N = coords.size(1); const auto H = coords.size(2); const auto W = coords.size(3); const auto rd = 2 * radius + 1; auto opts = fmap1.options(); auto corr = torch::zeros({B, N, rd*rd, H, W}, opts); const dim3 blocks(B, (H+BLOCK_H-1)/BLOCK_H, (W+BLOCK_W-1)/BLOCK_W); const dim3 threads(BLOCK_H, BLOCK_W); AT_DISPATCH_FLOATING_TYPES_AND_HALF(fmap1.type(), "altcorr_forward_kernel", ([&] { altcorr_forward_kernel<<>>( fmap1.packed_accessor32(), fmap2.packed_accessor32(), coords.packed_accessor32(), corr.packed_accessor32(), radius); })); return {corr}; } std::vector altcorr_cuda_backward( torch::Tensor fmap1, torch::Tensor fmap2, torch::Tensor coords, torch::Tensor corr_grad, int radius) { const auto B = coords.size(0); const auto N = coords.size(1); const auto H1 = fmap1.size(1); const auto W1 = fmap1.size(2); const auto H2 = fmap2.size(1); const auto W2 = fmap2.size(2); const auto C = fmap1.size(3); auto opts = fmap1.options(); auto fmap1_grad = torch::zeros({B, H1, W1, C}, opts); auto fmap2_grad = torch::zeros({B, H2, W2, C}, opts); auto coords_grad = torch::zeros({B, N, H1, W1, 2}, opts); const dim3 blocks(B, (H1+BLOCK_H-1)/BLOCK_H, (W1+BLOCK_W-1)/BLOCK_W); const dim3 threads(BLOCK_H, BLOCK_W); altcorr_backward_kernel<<>>( fmap1.packed_accessor32(), fmap2.packed_accessor32(), coords.packed_accessor32(), corr_grad.packed_accessor32(), fmap1_grad.packed_accessor32(), fmap2_grad.packed_accessor32(), coords_grad.packed_accessor32(), radius); return {fmap1_grad, fmap2_grad, coords_grad}; } ================================================ FILE: VO_Module/src/correlation_kernels.cu ================================================ #include #include #include #include #include #include #include #include #include #define BLOCK 16 __forceinline__ __device__ bool within_bounds(int h, int w, int H, int W) { return h >= 0 && h < H && w >= 0 && w < W; } template __global__ void corr_index_forward_kernel( const torch::PackedTensorAccessor32 volume, const torch::PackedTensorAccessor32 coords, torch::PackedTensorAccessor32 corr, int r) { // batch index const int x = blockIdx.x * blockDim.x + threadIdx.x; const int y = blockIdx.y * blockDim.y + threadIdx.y; const int n = blockIdx.z; const int h1 = volume.size(1); const int w1 = volume.size(2); const int h2 = volume.size(3); const int w2 = volume.size(4); if (!within_bounds(y, x, h1, w1)) { return; } float x0 = coords[n][0][y][x]; float y0 = coords[n][1][y][x]; float dx = x0 - floor(x0); float dy = y0 - floor(y0); int rd = 2*r + 1; for (int i=0; i(floor(x0)) - r + i; int y1 = static_cast(floor(y0)) - r + j; if (within_bounds(y1, x1, h2, w2)) { scalar_t s = volume[n][y][x][y1][x1]; if (i > 0 && j > 0) corr[n][i-1][j-1][y][x] += s * scalar_t(dx * dy); if (i > 0 && j < rd) corr[n][i-1][j][y][x] += s * scalar_t(dx * (1.0f-dy)); if (i < rd && j > 0) corr[n][i][j-1][y][x] += s * scalar_t((1.0f-dx) * dy); if (i < rd && j < rd) corr[n][i][j][y][x] += s * scalar_t((1.0f-dx) * (1.0f-dy)); } } } } template __global__ void corr_index_backward_kernel( const torch::PackedTensorAccessor32 coords, const torch::PackedTensorAccessor32 corr_grad, torch::PackedTensorAccessor32 volume_grad, int r) { // batch index const int x = blockIdx.x * blockDim.x + threadIdx.x; const int y = blockIdx.y * blockDim.y + threadIdx.y; const int n = blockIdx.z; const int h1 = volume_grad.size(1); const int w1 = volume_grad.size(2); const int h2 = volume_grad.size(3); const int w2 = volume_grad.size(4); if (!within_bounds(y, x, h1, w1)) { return; } float x0 = coords[n][0][y][x]; float y0 = coords[n][1][y][x]; float dx = x0 - floor(x0); float dy = y0 - floor(y0); int rd = 2*r + 1; for (int i=0; i(floor(x0)) - r + i; int y1 = static_cast(floor(y0)) - r + j; if (within_bounds(y1, x1, h2, w2)) { scalar_t g = 0.0; if (i > 0 && j > 0) g += corr_grad[n][i-1][j-1][y][x] * scalar_t(dx * dy); if (i > 0 && j < rd) g += corr_grad[n][i-1][j][y][x] * scalar_t(dx * (1.0f-dy)); if (i < rd && j > 0) g += corr_grad[n][i][j-1][y][x] * scalar_t((1.0f-dx) * dy); if (i < rd && j < rd) g += corr_grad[n][i][j][y][x] * scalar_t((1.0f-dx) * (1.0f-dy)); volume_grad[n][y][x][y1][x1] += g; } } } } std::vector corr_index_cuda_forward( torch::Tensor volume, torch::Tensor coords, int radius) { const auto batch_size = volume.size(0); const auto ht = volume.size(1); const auto wd = volume.size(2); const dim3 blocks((wd + BLOCK - 1) / BLOCK, (ht + BLOCK - 1) / BLOCK, batch_size); const dim3 threads(BLOCK, BLOCK); auto opts = volume.options(); torch::Tensor corr = torch::zeros( {batch_size, 2*radius+1, 2*radius+1, ht, wd}, opts); AT_DISPATCH_FLOATING_TYPES_AND_HALF(volume.type(), "sampler_forward_kernel", ([&] { corr_index_forward_kernel<<>>( volume.packed_accessor32(), coords.packed_accessor32(), corr.packed_accessor32(), radius); })); return {corr}; } std::vector corr_index_cuda_backward( torch::Tensor volume, torch::Tensor coords, torch::Tensor corr_grad, int radius) { const auto batch_size = volume.size(0); const auto ht = volume.size(1); const auto wd = volume.size(2); auto volume_grad = torch::zeros_like(volume); const dim3 blocks((wd + BLOCK - 1) / BLOCK, (ht + BLOCK - 1) / BLOCK, batch_size); const dim3 threads(BLOCK, BLOCK); AT_DISPATCH_FLOATING_TYPES_AND_HALF(volume.type(), "sampler_backward_kernel", ([&] { corr_index_backward_kernel<<>>( coords.packed_accessor32(), corr_grad.packed_accessor32(), volume_grad.packed_accessor32(), radius); })); return {volume_grad}; } ================================================ FILE: VO_Module/src/droid.cpp ================================================ #include #include // CUDA forward declarations std::vector projective_transform_cuda( torch::Tensor poses, torch::Tensor disps, torch::Tensor intrinsics, torch::Tensor ii, torch::Tensor jj); torch::Tensor depth_filter_cuda( torch::Tensor poses, torch::Tensor disps, torch::Tensor intrinsics, torch::Tensor ix, torch::Tensor thresh); torch::Tensor frame_distance_cuda( torch::Tensor poses, torch::Tensor disps, torch::Tensor intrinsics, torch::Tensor ii, torch::Tensor jj, const float beta); std::vector projmap_cuda( torch::Tensor poses, torch::Tensor disps, torch::Tensor intrinsics, torch::Tensor ii, torch::Tensor jj); torch::Tensor iproj_cuda( torch::Tensor poses, torch::Tensor disps, torch::Tensor intrinsics); std::vector ba_cuda( torch::Tensor poses, torch::Tensor disps, torch::Tensor intrinsics, torch::Tensor targets, torch::Tensor weights, torch::Tensor eta, torch::Tensor ii, torch::Tensor jj, const int t0, const int t1, const int iterations, const float lm, const float ep, const bool motion_only); std::vector corr_index_cuda_forward( torch::Tensor volume, torch::Tensor coords, int radius); std::vector corr_index_cuda_backward( torch::Tensor volume, torch::Tensor coords, torch::Tensor corr_grad, int radius); std::vector altcorr_cuda_forward( torch::Tensor fmap1, torch::Tensor fmap2, torch::Tensor coords, int radius); std::vector altcorr_cuda_backward( torch::Tensor fmap1, torch::Tensor fmap2, torch::Tensor coords, torch::Tensor corr_grad, int radius); #define CHECK_CONTIGUOUS(x) TORCH_CHECK(x.is_contiguous(), #x " must be contiguous") #define CHECK_INPUT(x) CHECK_CONTIGUOUS(x) std::vector ba( torch::Tensor poses, torch::Tensor disps, torch::Tensor intrinsics, torch::Tensor targets, torch::Tensor weights, torch::Tensor eta, torch::Tensor ii, torch::Tensor jj, const int t0, const int t1, const int iterations, const float lm, const float ep, const bool motion_only) { CHECK_INPUT(targets); CHECK_INPUT(weights); CHECK_INPUT(poses); CHECK_INPUT(disps); CHECK_INPUT(intrinsics); CHECK_INPUT(ii); CHECK_INPUT(jj); return ba_cuda(poses, disps, intrinsics, targets, weights, eta, ii, jj, t0, t1, iterations, lm, ep, motion_only); } torch::Tensor frame_distance( torch::Tensor poses, torch::Tensor disps, torch::Tensor intrinsics, torch::Tensor ii, torch::Tensor jj, const float beta) { CHECK_INPUT(poses); CHECK_INPUT(disps); CHECK_INPUT(intrinsics); CHECK_INPUT(ii); CHECK_INPUT(jj); return frame_distance_cuda(poses, disps, intrinsics, ii, jj, beta); } std::vector projmap( torch::Tensor poses, torch::Tensor disps, torch::Tensor intrinsics, torch::Tensor ii, torch::Tensor jj) { CHECK_INPUT(poses); CHECK_INPUT(disps); CHECK_INPUT(intrinsics); CHECK_INPUT(ii); CHECK_INPUT(jj); return projmap_cuda(poses, disps, intrinsics, ii, jj); } torch::Tensor iproj( torch::Tensor poses, torch::Tensor disps, torch::Tensor intrinsics) { CHECK_INPUT(poses); CHECK_INPUT(disps); CHECK_INPUT(intrinsics); return iproj_cuda(poses, disps, intrinsics); } // c++ python binding std::vector corr_index_forward( torch::Tensor volume, torch::Tensor coords, int radius) { CHECK_INPUT(volume); CHECK_INPUT(coords); return corr_index_cuda_forward(volume, coords, radius); } std::vector corr_index_backward( torch::Tensor volume, torch::Tensor coords, torch::Tensor corr_grad, int radius) { CHECK_INPUT(volume); CHECK_INPUT(coords); CHECK_INPUT(corr_grad); auto volume_grad = corr_index_cuda_backward(volume, coords, corr_grad, radius); return {volume_grad}; } std::vector altcorr_forward( torch::Tensor fmap1, torch::Tensor fmap2, torch::Tensor coords, int radius) { CHECK_INPUT(fmap1); CHECK_INPUT(fmap2); CHECK_INPUT(coords); return altcorr_cuda_forward(fmap1, fmap2, coords, radius); } std::vector altcorr_backward( torch::Tensor fmap1, torch::Tensor fmap2, torch::Tensor coords, torch::Tensor corr_grad, int radius) { CHECK_INPUT(fmap1); CHECK_INPUT(fmap2); CHECK_INPUT(coords); CHECK_INPUT(corr_grad); return altcorr_cuda_backward(fmap1, fmap2, coords, corr_grad, radius); } torch::Tensor depth_filter( torch::Tensor poses, torch::Tensor disps, torch::Tensor intrinsics, torch::Tensor ix, torch::Tensor thresh) { CHECK_INPUT(poses); CHECK_INPUT(disps); CHECK_INPUT(intrinsics); CHECK_INPUT(ix); CHECK_INPUT(thresh); return depth_filter_cuda(poses, disps, intrinsics, ix, thresh); } PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { // bundle adjustment kernels m.def("ba", &ba, "bundle adjustment"); m.def("frame_distance", &frame_distance, "frame_distance"); m.def("projmap", &projmap, "projmap"); m.def("depth_filter", &depth_filter, "depth_filter"); m.def("iproj", &iproj, "back projection"); // correlation volume kernels m.def("altcorr_forward", &altcorr_forward, "ALTCORR forward"); m.def("altcorr_backward", &altcorr_backward, "ALTCORR backward"); m.def("corr_index_forward", &corr_index_forward, "INDEX forward"); m.def("corr_index_backward", &corr_index_backward, "INDEX backward"); } ================================================ FILE: VO_Module/src/droid_kernels.cu ================================================ #include #include #include #include #include #include #include #include #include // #include "utils.cuh" #include #include #include typedef Eigen::SparseMatrix SpMat; typedef Eigen::Triplet T; typedef std::vector> graph_t; typedef std::vector tensor_list_t; #define MIN_DEPTH 0.25 #define THREADS 256 #define NUM_BLOCKS(batch_size) ((batch_size + THREADS - 1) / THREADS) #define GPU_1D_KERNEL_LOOP(k, n) \ for (size_t k = threadIdx.x; k 1e-4) { float a = (1 - cosf(theta)) / theta_sq; crossInplace(phi, tau); t[0] += a * tau[0]; t[1] += a * tau[1]; t[2] += a * tau[2]; float b = (theta - sinf(theta)) / (theta * theta_sq); crossInplace(phi, tau); t[0] += b * tau[0]; t[1] += b * tau[1]; t[2] += b * tau[2]; } } __global__ void projective_transform_kernel( const torch::PackedTensorAccessor32 target, const torch::PackedTensorAccessor32 weight, const torch::PackedTensorAccessor32 poses, const torch::PackedTensorAccessor32 disps, const torch::PackedTensorAccessor32 intrinsics, const torch::PackedTensorAccessor32 ii, const torch::PackedTensorAccessor32 jj, torch::PackedTensorAccessor32 Hs, torch::PackedTensorAccessor32 vs, torch::PackedTensorAccessor32 Eii, torch::PackedTensorAccessor32 Eij, torch::PackedTensorAccessor32 Cii, torch::PackedTensorAccessor32 bz) { const int block_id = blockIdx.x; const int thread_id = threadIdx.x; const int ht = disps.size(1); const int wd = disps.size(2); __shared__ int ix; __shared__ int jx; __shared__ float fx; __shared__ float fy; __shared__ float cx; __shared__ float cy; __shared__ float ti[3], tj[3], tij[3]; __shared__ float qi[4], qj[4], qij[4]; // load intrinsics from global memory if (thread_id == 0) { ix = static_cast(ii[block_id]); jx = static_cast(jj[block_id]); fx = intrinsics[0]; fy = intrinsics[1]; cx = intrinsics[2]; cy = intrinsics[3]; } __syncthreads(); // load poses from global memory if (thread_id < 3) { ti[thread_id] = poses[ix][thread_id]; tj[thread_id] = poses[jx][thread_id]; } if (thread_id < 4) { qi[thread_id] = poses[ix][thread_id+3]; qj[thread_id] = poses[jx][thread_id+3]; } __syncthreads(); if (thread_id == 0) { relSE3(ti, qi, tj, qj, tij, qij); } //points float Xi[4]; float Xj[4]; // jacobians float Jx[12]; float Jz; float* Ji = &Jx[0]; float* Jj = &Jx[6]; // hessians float hij[12*(12+1)/2]; float vi[6], vj[6]; int l; for (l=0; l<12*(12+1)/2; l++) { hij[l] = 0; } for (int n=0; n<6; n++) { vi[n] = 0; vj[n] = 0; } __syncthreads(); GPU_1D_KERNEL_LOOP(k, ht*wd) { const int i = k / wd; const int j = k % wd; const float u = static_cast(j); const float v = static_cast(i); // homogenous coordinates Xi[0] = (u - cx) / fx; Xi[1] = (v - cy) / fy; Xi[2] = 1; Xi[3] = disps[ix][i][j]; // transform homogenous point actSE3(tij, qij, Xi, Xj); const float x = Xj[0]; const float y = Xj[1]; const float h = Xj[3]; const float d = (Xj[2] < MIN_DEPTH) ? 0.0 : 1.0 / Xj[2]; const float d2 = d * d; const float wu = (Xj[2] < MIN_DEPTH) ? 0.0 : .001 * weight[block_id][0][i][j]; const float wv = (Xj[2] < MIN_DEPTH) ? 0.0 : .001 * weight[block_id][1][i][j]; const float ru = target[block_id][0][i][j] - (fx * d * x + cx); const float rv = target[block_id][1][i][j] - (fy * d * y + cy); // x - coordinate Jj[0] = fx * (h*d); Jj[1] = fx * 0; Jj[2] = fx * (-x*h*d2); Jj[3] = fx * (-x*y*d2); Jj[4] = fx * (1 + x*x*d2); Jj[5] = fx * (-y*d); Jz = fx * (tij[0] * d - tij[2] * (x * d2)); adjSE3(tij, qij, Jj, Ji); for (int n=0; n<6; n++) Ji[n] *= -1; l=0; for (int n=0; n<12; n++) { for (int m=0; m<=n; m++) { hij[l] += wu * Jx[n] * Jx[m]; l++; } } for (int n=0; n<6; n++) { vi[n] += wu * ru * Ji[n]; vj[n] += wu * ru * Jj[n]; Eii[block_id][n][k] = wu * Jz * Ji[n]; Eij[block_id][n][k] = wu * Jz * Jj[n]; } Cii[block_id][k] = wu * Jz * Jz; bz[block_id][k] = wu * ru * Jz; Jj[0] = fy * 0; Jj[1] = fy * (h*d); Jj[2] = fy * (-y*h*d2); Jj[3] = fy * (-1 - y*y*d2); Jj[4] = fy * (x*y*d2); Jj[5] = fy * (x*d); Jz = fy * (tij[1] * d - tij[2] * (y * d2)); adjSE3(tij, qij, Jj, Ji); for (int n=0; n<6; n++) Ji[n] *= -1; l=0; for (int n=0; n<12; n++) { for (int m=0; m<=n; m++) { hij[l] += wv * Jx[n] * Jx[m]; l++; } } for (int n=0; n<6; n++) { vi[n] += wv * rv * Ji[n]; vj[n] += wv * rv * Jj[n]; Eii[block_id][n][k] += wv * Jz * Ji[n]; Eij[block_id][n][k] += wv * Jz * Jj[n]; } Cii[block_id][k] += wv * Jz * Jz; bz[block_id][k] += wv * rv * Jz; } __syncthreads(); __shared__ float sdata[THREADS]; for (int n=0; n<6; n++) { sdata[threadIdx.x] = vi[n]; blockReduce(sdata); if (threadIdx.x == 0) { vs[0][block_id][n] = sdata[0]; } __syncthreads(); sdata[threadIdx.x] = vj[n]; blockReduce(sdata); if (threadIdx.x == 0) { vs[1][block_id][n] = sdata[0]; } } l=0; for (int n=0; n<12; n++) { for (int m=0; m<=n; m++) { sdata[threadIdx.x] = hij[l]; blockReduce(sdata); if (threadIdx.x == 0) { if (n<6 && m<6) { Hs[0][block_id][n][m] = sdata[0]; Hs[0][block_id][m][n] = sdata[0]; } else if (n >=6 && m<6) { Hs[1][block_id][m][n-6] = sdata[0]; Hs[2][block_id][n-6][m] = sdata[0]; } else { Hs[3][block_id][n-6][m-6] = sdata[0]; Hs[3][block_id][m-6][n-6] = sdata[0]; } } l++; } } } __global__ void projmap_kernel( const torch::PackedTensorAccessor32 poses, const torch::PackedTensorAccessor32 disps, const torch::PackedTensorAccessor32 intrinsics, const torch::PackedTensorAccessor32 ii, const torch::PackedTensorAccessor32 jj, torch::PackedTensorAccessor32 coords, torch::PackedTensorAccessor32 valid) { const int block_id = blockIdx.x; const int thread_id = threadIdx.x; const int ht = disps.size(1); const int wd = disps.size(2); __shared__ int ix; __shared__ int jx; __shared__ float fx; __shared__ float fy; __shared__ float cx; __shared__ float cy; __shared__ float ti[3], tj[3], tij[3]; __shared__ float qi[4], qj[4], qij[4]; // load intrinsics from global memory if (thread_id == 0) { ix = static_cast(ii[block_id]); jx = static_cast(jj[block_id]); fx = intrinsics[0]; fy = intrinsics[1]; cx = intrinsics[2]; cy = intrinsics[3]; } __syncthreads(); // load poses from global memory if (thread_id < 3) { ti[thread_id] = poses[ix][thread_id]; tj[thread_id] = poses[jx][thread_id]; } if (thread_id < 4) { qi[thread_id] = poses[ix][thread_id+3]; qj[thread_id] = poses[jx][thread_id+3]; } __syncthreads(); if (thread_id == 0) { relSE3(ti, qi, tj, qj, tij, qij); } //points float Xi[4]; float Xj[4]; __syncthreads(); GPU_1D_KERNEL_LOOP(k, ht*wd) { const int i = k / wd; const int j = k % wd; const float u = static_cast(j); const float v = static_cast(i); // homogenous coordinates Xi[0] = (u - cx) / fx; Xi[1] = (v - cy) / fy; Xi[2] = 1; Xi[3] = disps[ix][i][j]; // transform homogenous point actSE3(tij, qij, Xi, Xj); coords[block_id][i][j][0] = u; coords[block_id][i][j][1] = v; if (Xj[2] > 0.01) { coords[block_id][i][j][0] = fx * (Xj[0] / Xj[2]) + cx; coords[block_id][i][j][1] = fy * (Xj[1] / Xj[2]) + cy; } valid[block_id][i][j][0] = (Xj[2] > MIN_DEPTH) ? 1.0 : 0.0; } } __global__ void frame_distance_kernel( const torch::PackedTensorAccessor32 poses, const torch::PackedTensorAccessor32 disps, const torch::PackedTensorAccessor32 intrinsics, const torch::PackedTensorAccessor32 ii, const torch::PackedTensorAccessor32 jj, torch::PackedTensorAccessor32 dist, const float beta) { const int block_id = blockIdx.x; const int thread_id = threadIdx.x; const int ht = disps.size(1); const int wd = disps.size(2); __shared__ int ix; __shared__ int jx; __shared__ float fx; __shared__ float fy; __shared__ float cx; __shared__ float cy; __shared__ float ti[3], tj[3], tij[3]; __shared__ float qi[4], qj[4], qij[4]; // load intrinsics from global memory if (thread_id == 0) { ix = static_cast(ii[block_id]); jx = static_cast(jj[block_id]); fx = intrinsics[0]; fy = intrinsics[1]; cx = intrinsics[2]; cy = intrinsics[3]; } __syncthreads(); //points float Xi[4]; float Xj[4]; __shared__ float accum[THREADS]; accum[thread_id] = 0; __shared__ float valid[THREADS]; valid[thread_id] = 0; __shared__ float total[THREADS]; total[thread_id] = 0; __syncthreads(); for (int n=0; n<1; n++) { if (thread_id < 3) { ti[thread_id] = poses[ix][thread_id]; tj[thread_id] = poses[jx][thread_id]; } if (thread_id < 4) { qi[thread_id] = poses[ix][thread_id+3]; qj[thread_id] = poses[jx][thread_id+3]; } __syncthreads(); relSE3(ti, qi, tj, qj, tij, qij); float d, du, dv; GPU_1D_KERNEL_LOOP(k, ht*wd) { const int i = k / wd; const int j = k % wd; const float u = static_cast(j); const float v = static_cast(i); // if (disps[ix][i][j] < 0.01) { // continue; // } // homogenous coordinates Xi[0] = (u - cx) / fx; Xi[1] = (v - cy) / fy; Xi[2] = 1; Xi[3] = disps[ix][i][j]; // transform homogenous point actSE3(tij, qij, Xi, Xj); du = fx * (Xj[0] / Xj[2]) + cx - u; dv = fy * (Xj[1] / Xj[2]) + cy - v; d = sqrtf(du*du + dv*dv); total[threadIdx.x] += beta; if (Xj[2] > MIN_DEPTH) { accum[threadIdx.x] += beta * d; valid[threadIdx.x] += beta; } Xi[0] = (u - cx) / fx; Xi[1] = (v - cy) / fy; Xi[2] = 1; Xi[3] = disps[ix][i][j]; Xj[0] = Xi[0] + Xi[3] * tij[0]; Xj[1] = Xi[1] + Xi[3] * tij[1]; Xj[2] = Xi[2] + Xi[3] * tij[2]; du = fx * (Xj[0] / Xj[2]) + cx - u; dv = fy * (Xj[1] / Xj[2]) + cy - v; d = sqrtf(du*du + dv*dv); total[threadIdx.x] += (1 - beta); if (Xj[2] > MIN_DEPTH) { accum[threadIdx.x] += (1 - beta) * d; valid[threadIdx.x] += (1 - beta); } } if (threadIdx.x == 0) { int tmp = ix; ix = jx; jx = tmp; } __syncthreads(); } __syncthreads(); blockReduce(accum); __syncthreads(); blockReduce(total); __syncthreads(); blockReduce(valid); __syncthreads(); if (thread_id == 0) { dist[block_id] = (valid[0] / (total[0] + 1e-8) < 0.75) ? 1000.0 : accum[0] / valid[0]; } } __global__ void depth_filter_kernel( const torch::PackedTensorAccessor32 poses, const torch::PackedTensorAccessor32 disps, const torch::PackedTensorAccessor32 intrinsics, const torch::PackedTensorAccessor32 inds, const torch::PackedTensorAccessor32 thresh, torch::PackedTensorAccessor32 counter) { const int block_id = blockIdx.x; const int neigh_id = blockIdx.y; const int index = blockIdx.z * blockDim.x + threadIdx.x; // if (threadIdx.x == 0) { // printf("%d %d %d %d\n", blockIdx.x, blockIdx.y, blockDim.x, threadIdx.x); // } const int num = disps.size(0); const int ht = disps.size(1); const int wd = disps.size(2); __shared__ int ix; __shared__ int jx; __shared__ float fx; __shared__ float fy; __shared__ float cx; __shared__ float cy; __shared__ float ti[3], tj[3], tij[3]; __shared__ float qi[4], qj[4], qij[4]; if (threadIdx.x == 0) { ix = static_cast(inds[block_id]); jx = (neigh_id < 3) ? ix - neigh_id - 1 : ix + neigh_id; fx = intrinsics[0]; fy = intrinsics[1]; cx = intrinsics[2]; cy = intrinsics[3]; } __syncthreads(); if (jx < 0 || jx >= num) { return; } const float t = thresh[block_id]; // load poses from global memory if (threadIdx.x < 3) { ti[threadIdx.x] = poses[ix][threadIdx.x]; tj[threadIdx.x] = poses[jx][threadIdx.x]; } if (threadIdx.x < 4) { qi[threadIdx.x] = poses[ix][threadIdx.x+3]; qj[threadIdx.x] = poses[jx][threadIdx.x+3]; } __syncthreads(); if (threadIdx.x == 0) { relSE3(ti, qi, tj, qj, tij, qij); } //points float Xi[4]; float Xj[4]; __syncthreads(); if (index < ht*wd) { const int i = index / wd; const int j = index % wd; const float ui = static_cast(j); const float vi = static_cast(i); const float di = disps[ix][i][j]; // homogenous coordinates Xi[0] = (ui - cx) / fx; Xi[1] = (vi - cy) / fy; Xi[2] = 1; Xi[3] = di; // transform homogenous point actSE3(tij, qij, Xi, Xj); const float uj = fx * (Xj[0] / Xj[2]) + cx; const float vj = fy * (Xj[1] / Xj[2]) + cy; const float dj = Xj[3] / Xj[2]; const int u0 = static_cast(floor(uj)); const int v0 = static_cast(floor(vj)); if (u0 >= 0 && v0 >= 0 && u0 < wd-1 && v0 < ht-1) { const float wx = ceil(uj) - uj; const float wy = ceil(vj) - vj; const float d00 = disps[jx][v0+0][u0+0]; const float d01 = disps[jx][v0+0][u0+1]; const float d10 = disps[jx][v0+1][u0+0]; const float d11 = disps[jx][v0+1][u0+1]; const float dj_hat = wy*wx*d00 + wy*(1-wx)*d01 + (1-wy)*wx*d10 + (1-wy)*(1-wx)*d11; const float err = abs(1.0/dj - 1.0/dj_hat); if (abs(1.0/dj - 1.0/d00) < t) atomicAdd(&counter[block_id][i][j], 1.0f); else if (abs(1.0/dj - 1.0/d01) < t) atomicAdd(&counter[block_id][i][j], 1.0f); else if (abs(1.0/dj - 1.0/d10) < t) atomicAdd(&counter[block_id][i][j], 1.0f); else if (abs(1.0/dj - 1.0/d11) < t) atomicAdd(&counter[block_id][i][j], 1.0f); } } } __global__ void iproj_kernel( const torch::PackedTensorAccessor32 poses, const torch::PackedTensorAccessor32 disps, const torch::PackedTensorAccessor32 intrinsics, torch::PackedTensorAccessor32 points) { const int block_id = blockIdx.x; const int index = blockIdx.y * blockDim.x + threadIdx.x; const int num = disps.size(0); const int ht = disps.size(1); const int wd = disps.size(2); __shared__ float fx; __shared__ float fy; __shared__ float cx; __shared__ float cy; __shared__ float t[3]; __shared__ float q[4]; if (threadIdx.x == 0) { fx = intrinsics[0]; fy = intrinsics[1]; cx = intrinsics[2]; cy = intrinsics[3]; } __syncthreads(); // load poses from global memory if (threadIdx.x < 3) { t[threadIdx.x] = poses[block_id][threadIdx.x]; } if (threadIdx.x < 4) { q[threadIdx.x] = poses[block_id][threadIdx.x+3]; } __syncthreads(); //points float Xi[4]; float Xj[4]; if (index < ht*wd) { const int i = index / wd; const int j = index % wd; const float ui = static_cast(j); const float vi = static_cast(i); const float di = disps[block_id][i][j]; // homogenous coordinates Xi[0] = (ui - cx) / fx; Xi[1] = (vi - cy) / fy; Xi[2] = 1; Xi[3] = di; // transform homogenous point actSE3(t, q, Xi, Xj); points[block_id][i][j][0] = Xj[0] / Xj[3]; points[block_id][i][j][1] = Xj[1] / Xj[3]; points[block_id][i][j][2] = Xj[2] / Xj[3]; } } __global__ void accum_kernel( const torch::PackedTensorAccessor32 inps, const torch::PackedTensorAccessor32 ptrs, const torch::PackedTensorAccessor32 idxs, torch::PackedTensorAccessor32 outs) { const int block_id = blockIdx.x; const int D = inps.size(2); const int start = ptrs[block_id]; const int end = ptrs[block_id+1]; for (int k=threadIdx.x; k poses, const torch::PackedTensorAccessor32 dx, const int t0, const int t1) { for (int k=t0+threadIdx.x; k disps, const torch::PackedTensorAccessor32 dz, const torch::PackedTensorAccessor32 inds) { const int i = inds[blockIdx.x]; const int ht = disps.size(1); const int wd = disps.size(2); for (int k=threadIdx.x; k(); long* jx_data = jx_cpu.data_ptr(); long* kx_data = inds.data_ptr(); int count = jx.size(0); std::vector cols; torch::Tensor ptrs_cpu = torch::zeros({count+1}, torch::TensorOptions().dtype(torch::kInt64)); long* ptrs_data = ptrs_cpu.data_ptr(); ptrs_data[0] = 0; int i = 0; for (int j=0; j(); for (int i=0; i>>( data.packed_accessor32(), ptrs.packed_accessor32(), idxs.packed_accessor32(), out.packed_accessor32()); return out; } __global__ void EEt6x6_kernel( const torch::PackedTensorAccessor32 E, const torch::PackedTensorAccessor32 Q, const torch::PackedTensorAccessor32 idx, torch::PackedTensorAccessor32 S) { // indicices const int ix = idx[blockIdx.x][0]; const int jx = idx[blockIdx.x][1]; const int kx = idx[blockIdx.x][2]; const int D = E.size(2); float dS[6][6]; float ei[6]; float ej[6]; for (int i=0; i<6; i++) { for (int j=0; j<6; j++) { dS[i][j] = 0; } } for (int k=threadIdx.x; k E, const torch::PackedTensorAccessor32 Q, const torch::PackedTensorAccessor32 w, const torch::PackedTensorAccessor32 idx, torch::PackedTensorAccessor32 v) { const int D = E.size(2); const int kx = idx[blockIdx.x][0]; float b[6]; for (int n=0; n<6; n++) { b[n] = 0.0; } for (int k=threadIdx.x; k E, const torch::PackedTensorAccessor32 x, const torch::PackedTensorAccessor32 idx, torch::PackedTensorAccessor32 w) { const int D = E.size(2); const int ix = idx[blockIdx.x]; if (idx[blockIdx.x] <= 0 || idx[blockIdx.x] >= x.size(0)) return; for (int k=threadIdx.x; k A; Eigen::VectorX b; SparseBlock(int N, int M) : N(N), M(M) { A = Eigen::SparseMatrix(N*M, N*M); b = Eigen::VectorXd::Zero(N*M); } SparseBlock(Eigen::SparseMatrix const& A, Eigen::VectorX const& b, int N, int M) : A(A), b(b), N(N), M(M) {} void update_lhs(torch::Tensor As, torch::Tensor ii, torch::Tensor jj) { auto As_cpu = As.to(torch::kCPU).to(torch::kFloat64); auto ii_cpu = ii.to(torch::kCPU).to(torch::kInt64); auto jj_cpu = jj.to(torch::kCPU).to(torch::kInt64); auto As_acc = As_cpu.accessor(); auto ii_acc = ii_cpu.accessor(); auto jj_acc = jj_cpu.accessor(); std::vector tripletList; for (int n=0; n= 0 && j >= 0) { for (int k=0; k(); auto ii_acc = ii_cpu.accessor(); for (int n=0; n= 0) { for (int j=0; j get_dense() { Eigen::MatrixXd Ad = Eigen::MatrixXd(A); torch::Tensor H = torch::from_blob(Ad.data(), {N*M, N*M}, torch::TensorOptions() .dtype(torch::kFloat64)).to(torch::kCUDA).to(torch::kFloat32); torch::Tensor v = torch::from_blob(b.data(), {N*M, 1}, torch::TensorOptions() .dtype(torch::kFloat64)).to(torch::kCUDA).to(torch::kFloat32); return std::make_tuple(H, v); } torch::Tensor solve(const float lm=0.0001, const float ep=0.1) { torch::Tensor dx; Eigen::SparseMatrix L(A); L.diagonal().array() += ep + lm * L.diagonal().array(); Eigen::SimplicialLLT> solver; solver.compute(L); if (solver.info() == Eigen::Success) { Eigen::VectorXd x = solver.solve(b); dx = torch::from_blob(x.data(), {N, M}, torch::TensorOptions() .dtype(torch::kFloat64)).to(torch::kCUDA).to(torch::kFloat32); } else { dx = torch::zeros({N, M}, torch::TensorOptions() .device(torch::kCUDA).dtype(torch::kFloat32)); } return dx; } private: const int N; const int M; }; SparseBlock schur_block(torch::Tensor E, torch::Tensor Q, torch::Tensor w, torch::Tensor ii, torch::Tensor jj, torch::Tensor kk, const int t0, const int t1) { torch::Tensor ii_cpu = ii.to(torch::kCPU); torch::Tensor jj_cpu = jj.to(torch::kCPU); torch::Tensor kk_cpu = kk.to(torch::kCPU); const int P = t1 - t0; const long* ii_data = ii_cpu.data_ptr(); const long* jj_data = jj_cpu.data_ptr(); const long* kk_data = kk_cpu.data_ptr(); std::vector> graph(P); std::vector> index(P); for (int n=0; n= t0 && j <= t1) { const int t = j - t0; graph[t].push_back(k); index[t].push_back(n); } } std::vector ii_list, jj_list, idx, jdx; for (int i=0; i>>( E.packed_accessor32(), Q.packed_accessor32(), ix_cuda.packed_accessor32(), S.packed_accessor32()); Ev6x1_kernel<<>>( E.packed_accessor32(), Q.packed_accessor32(), w.packed_accessor32(), jx_cuda.packed_accessor32(), v.packed_accessor32()); // schur block SparseBlock A(P, 6); A.update_lhs(S, ii2_cpu, jj2_cpu); A.update_rhs(v, jj_cpu - t0); return A; } std::vector ba_cuda( torch::Tensor poses, torch::Tensor disps, torch::Tensor intrinsics, torch::Tensor targets, torch::Tensor weights, torch::Tensor eta, torch::Tensor ii, torch::Tensor jj, const int t0, const int t1, const int iterations, const float lm, const float ep, const bool motion_only) { auto opts = poses.options(); const int num = ii.size(0); const int ht = disps.size(1); const int wd = disps.size(2); torch::Tensor ts = torch::arange(t0, t1).to(torch::kCUDA); torch::Tensor ii_exp = torch::cat({ts, ii}, 0); torch::Tensor jj_exp = torch::cat({ts, jj}, 0); std::tuple kuniq = torch::_unique(ii_exp, true, true); torch::Tensor kx = std::get<0>(kuniq); torch::Tensor kk_exp = std::get<1>(kuniq); torch::Tensor dx; torch::Tensor dz; // initialize buffers torch::Tensor Hs = torch::zeros({4, num, 6, 6}, opts); torch::Tensor vs = torch::zeros({2, num, 6}, opts); torch::Tensor Eii = torch::zeros({num, 6, ht*wd}, opts); torch::Tensor Eij = torch::zeros({num, 6, ht*wd}, opts); torch::Tensor Cii = torch::zeros({num, ht*wd}, opts); torch::Tensor wi = torch::zeros({num, ht*wd}, opts); for (int itr=0; itr>>( targets.packed_accessor32(), weights.packed_accessor32(), poses.packed_accessor32(), disps.packed_accessor32(), intrinsics.packed_accessor32(), ii.packed_accessor32(), jj.packed_accessor32(), Hs.packed_accessor32(), vs.packed_accessor32(), Eii.packed_accessor32(), Eij.packed_accessor32(), Cii.packed_accessor32(), wi.packed_accessor32()); // pose x pose block SparseBlock A(t1 - t0, 6); A.update_lhs(Hs.reshape({-1, 6, 6}), torch::cat({ii, ii, jj, jj}) - t0, torch::cat({ii, jj, ii, jj}) - t0); A.update_rhs(vs.reshape({-1, 6}), torch::cat({ii, jj}) - t0); if (motion_only) { dx = A.solve(lm, ep); // update poses pose_retr_kernel<<<1, THREADS>>>( poses.packed_accessor32(), dx.packed_accessor32(), t0, t1); } else { torch::Tensor C = accum_cuda(Cii, ii, kx); torch::Tensor w = accum_cuda(wi, ii, kx); torch::Tensor Q = 1.0 / (C + eta.view({-1, ht*wd})); torch::Tensor Ei = accum_cuda(Eii.view({num, 6*ht*wd}), ii, ts).view({t1-t0, 6, ht*wd}); torch::Tensor E = torch::cat({Ei, Eij}, 0); SparseBlock S = schur_block(E, Q, w, ii_exp, jj_exp, kk_exp, t0, t1); dx = (A - S).solve(lm, ep); torch::Tensor ix = jj_exp - t0; torch::Tensor dw = torch::zeros({ix.size(0), ht*wd}, opts); EvT6x1_kernel<<>>( E.packed_accessor32(), dx.packed_accessor32(), ix.packed_accessor32(), dw.packed_accessor32()); dz = Q * (w - accum_cuda(dw, ii_exp, kx)); // update poses pose_retr_kernel<<<1, THREADS>>>( poses.packed_accessor32(), dx.packed_accessor32(), t0, t1); // update disparity maps disp_retr_kernel<<>>( disps.packed_accessor32(), dz.packed_accessor32(), kx.packed_accessor32()); } } return {dx, dz}; } torch::Tensor frame_distance_cuda( torch::Tensor poses, torch::Tensor disps, torch::Tensor intrinsics, torch::Tensor ii, torch::Tensor jj, const float beta) { auto opts = poses.options(); const int num = ii.size(0); torch::Tensor dist = torch::zeros({num}, opts); frame_distance_kernel<<>>( poses.packed_accessor32(), disps.packed_accessor32(), intrinsics.packed_accessor32(), ii.packed_accessor32(), jj.packed_accessor32(), dist.packed_accessor32(), beta); return dist; } std::vector projmap_cuda( torch::Tensor poses, torch::Tensor disps, torch::Tensor intrinsics, torch::Tensor ii, torch::Tensor jj) { auto opts = poses.options(); const int num = ii.size(0); const int ht = disps.size(1); const int wd = disps.size(2); torch::Tensor coords = torch::zeros({num, ht, wd, 3}, opts); torch::Tensor valid = torch::zeros({num, ht, wd, 1}, opts); projmap_kernel<<>>( poses.packed_accessor32(), disps.packed_accessor32(), intrinsics.packed_accessor32(), ii.packed_accessor32(), jj.packed_accessor32(), coords.packed_accessor32(), valid.packed_accessor32()); return {coords, valid}; } torch::Tensor depth_filter_cuda( torch::Tensor poses, torch::Tensor disps, torch::Tensor intrinsics, torch::Tensor ix, torch::Tensor thresh) { const int num = ix.size(0); const int ht = disps.size(1); const int wd = disps.size(2); torch::Tensor counter = torch::zeros({num, ht, wd}, disps.options()); dim3 blocks(num, 6, NUM_BLOCKS(ht * wd)); depth_filter_kernel<<>>( poses.packed_accessor32(), disps.packed_accessor32(), intrinsics.packed_accessor32(), ix.packed_accessor32(), thresh.packed_accessor32(), counter.packed_accessor32()); return counter; } torch::Tensor iproj_cuda( torch::Tensor poses, torch::Tensor disps, torch::Tensor intrinsics) { const int nm = disps.size(0); const int ht = disps.size(1); const int wd = disps.size(2); auto opts = disps.options(); torch::Tensor points = torch::zeros({nm, ht, wd, 3}, opts); dim3 blocks(nm, NUM_BLOCKS(ht * wd)); iproj_kernel<<>>( poses.packed_accessor32(), disps.packed_accessor32(), intrinsics.packed_accessor32(), points.packed_accessor32()); return points; } ================================================ FILE: VO_Module/thirdparty/eigen/.gitignore ================================================ qrc_*cxx *.orig *.pyc *.diff diff *.save save *.old *.gmo *.qm core core.* *.bak *~ *build* *.moc.* *.moc ui_* CMakeCache.txt tags .*.swp activity.png *.out *.php* *.log *.orig *.rej log patch *.patch a a.* lapack/testing lapack/reference .*project .settings Makefile !ci/build.gitlab-ci.yml ================================================ FILE: VO_Module/thirdparty/eigen/.gitlab/issue_templates/Bug Report.md ================================================ ### Summary ### Environment - **Operating System** : Windows/Linux - **Architecture** : x64/Arm64/PowerPC ... - **Eigen Version** : 3.3.9 - **Compiler Version** : Gcc7.0 - **Compile Flags** : -O3 -march=native - **Vector Extension** : SSE/AVX/NEON ... ### Minimal Example ```cpp //show your code here ``` ### Steps to reproduce 1. first step 2. second step 3. ... ### What is the current *bug* behavior? ### What is the expected *correct* behavior? ### Relevant logs ### Warning Messages ### Benchmark scripts and results ### Anything else that might help - [ ] Have a plan to fix this issue. ================================================ FILE: VO_Module/thirdparty/eigen/.gitlab/issue_templates/Feature Request.md ================================================ ### Describe the feature you would like to be implemented. ### Would such a feature be useful for other users? Why? ### Any hints on how to implement the requested feature? ### Additional resources ================================================ FILE: VO_Module/thirdparty/eigen/.gitlab/merge_request_templates/Merge Request Template.md ================================================ ### Reference issue ### What does this implement/fix? ### Additional information ================================================ FILE: VO_Module/thirdparty/eigen/.gitlab-ci.yml ================================================ # This file is part of Eigen, a lightweight C++ template library # for linear algebra. # # Copyright (C) 2020 Arm Ltd. and Contributors # # This Source Code Form is subject to the terms of the Mozilla # Public License v. 2.0. If a copy of the MPL was not distributed # with this file, You can obtain one at http://mozilla.org/MPL/2.0/. stages: - buildsmoketests - smoketests - build - test variables: BUILDDIR: builddir EIGEN_CI_CMAKE_GENEATOR: "Ninja" include: - "/ci/smoketests.gitlab-ci.yml" - "/ci/build.gitlab-ci.yml" - "/ci/test.gitlab-ci.yml" ================================================ FILE: VO_Module/thirdparty/eigen/.hgeol ================================================ [patterns] *.sh = LF *.MINPACK = CRLF scripts/*.in = LF debug/msvc/*.dat = CRLF debug/msvc/*.natvis = CRLF unsupported/test/mpreal/*.* = CRLF ** = native [repository] native = LF ================================================ FILE: VO_Module/thirdparty/eigen/CMakeLists.txt ================================================ # cmake_minimum_require must be the first command of the file cmake_minimum_required(VERSION 3.5.0) project(Eigen3) set(CMAKE_CXX_STANDARD 11 CACHE STRING "Default C++ standard") set(CMAKE_CXX_STANDARD_REQUIRED ON CACHE BOOL "Require C++ standard") set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Allow C++ extensions") # 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() # Alias Eigen_*_DIR to Eigen3_*_DIR: set(Eigen_SOURCE_DIR ${Eigen3_SOURCE_DIR}) set(Eigen_BINARY_DIR ${Eigen3_BINARY_DIR}) # guard against bad build-type strings if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() ############################################################################# # retrieve version information # ############################################################################# # 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 we are not in a git clone if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git) # if the git program is absent or this will leave the EIGEN_GIT_REVNUM string empty, # but won't stop CMake. execute_process(COMMAND git ls-remote --refs -q ${CMAKE_SOURCE_DIR} HEAD OUTPUT_VARIABLE EIGEN_GIT_OUTPUT) endif() # extract the git rev number from the git output... if(EIGEN_GIT_OUTPUT) string(REGEX MATCH "^([0-9;a-f]+).*" EIGEN_GIT_CHANGESET_MATCH "${EIGEN_GIT_OUTPUT}") set(EIGEN_GIT_REVNUM "${CMAKE_MATCH_1}") endif() #...and show it next to the version number if(EIGEN_GIT_REVNUM) set(EIGEN_VERSION "${EIGEN_VERSION_NUMBER} (git rev ${EIGEN_GIT_REVNUM})") else() set(EIGEN_VERSION "${EIGEN_VERSION_NUMBER}") endif() include(CheckCXXCompilerFlag) include(GNUInstallDirs) include(CMakeDependentOption) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) option(EIGEN_TEST_CXX11 "Enable testing of unsupported CXX11 tests (i.e. those starting with cxx11_)." OFF) macro(ei_add_cxx_compiler_flag FLAG) string(REGEX REPLACE "-" "" SFLAG1 ${FLAG}) string(REGEX REPLACE "\\+" "p" SFLAG ${SFLAG1}) check_cxx_compiler_flag(${FLAG} COMPILER_SUPPORT_${SFLAG}) if(COMPILER_SUPPORT_${SFLAG}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}") endif() endmacro() # Determine if we should build shared libraries on this platform. get_cmake_property(EIGEN_BUILD_SHARED_LIBS TARGET_SUPPORTS_SHARED_LIBS) ############################################################################# # find how to link to the standard libraries # ############################################################################# find_package(StandardMathLibrary) set(EIGEN_TEST_CUSTOM_LINKER_FLAGS "" CACHE STRING "Additional linker flags when linking unit tests.") set(EIGEN_TEST_CUSTOM_CXX_FLAGS "" CACHE STRING "Additional compiler flags when compiling unit tests.") 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) # Disable pkgconfig only for native Windows builds if(NOT WIN32 OR NOT CMAKE_HOST_SYSTEM_NAME MATCHES Windows) option(EIGEN_BUILD_PKGCONFIG "Build pkg-config .pc file for Eigen" ON) endif() set(CMAKE_INCLUDE_CURRENT_DIR OFF) 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() set(EIGEN_TEST_MAX_SIZE "320" CACHE STRING "Maximal matrix/vector size, default is 320") if(NOT MSVC) # We assume that other compilers are partly compatible with GNUCC # clang outputs some warnings for unknown flags that are not caught by check_cxx_compiler_flag # adding -Werror turns such warnings into errors check_cxx_compiler_flag("-Werror" COMPILER_SUPPORT_WERROR) if(COMPILER_SUPPORT_WERROR) set(CMAKE_REQUIRED_FLAGS "-Werror") endif() ei_add_cxx_compiler_flag("-pedantic") ei_add_cxx_compiler_flag("-Wall") ei_add_cxx_compiler_flag("-Wextra") #ei_add_cxx_compiler_flag("-Weverything") # clang ei_add_cxx_compiler_flag("-Wundef") ei_add_cxx_compiler_flag("-Wcast-align") ei_add_cxx_compiler_flag("-Wchar-subscripts") ei_add_cxx_compiler_flag("-Wnon-virtual-dtor") ei_add_cxx_compiler_flag("-Wunused-local-typedefs") ei_add_cxx_compiler_flag("-Wpointer-arith") ei_add_cxx_compiler_flag("-Wwrite-strings") ei_add_cxx_compiler_flag("-Wformat-security") ei_add_cxx_compiler_flag("-Wshorten-64-to-32") ei_add_cxx_compiler_flag("-Wlogical-op") ei_add_cxx_compiler_flag("-Wenum-conversion") ei_add_cxx_compiler_flag("-Wc++11-extensions") ei_add_cxx_compiler_flag("-Wdouble-promotion") # ei_add_cxx_compiler_flag("-Wconversion") ei_add_cxx_compiler_flag("-Wshadow") ei_add_cxx_compiler_flag("-Wno-psabi") ei_add_cxx_compiler_flag("-Wno-variadic-macros") ei_add_cxx_compiler_flag("-Wno-long-long") ei_add_cxx_compiler_flag("-fno-check-new") ei_add_cxx_compiler_flag("-fno-common") ei_add_cxx_compiler_flag("-fstrict-aliasing") ei_add_cxx_compiler_flag("-wd981") # disable ICC's "operands are evaluated in unspecified order" remark ei_add_cxx_compiler_flag("-wd2304") # disable ICC's "warning #2304: non-explicit constructor with single argument may cause implicit type conversion" produced by -Wnon-virtual-dtor if(ANDROID_NDK) ei_add_cxx_compiler_flag("-pie") ei_add_cxx_compiler_flag("-fPIE") endif() set(CMAKE_REQUIRED_FLAGS "") 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_AVX "Enable/Disable AVX in tests/examples" OFF) if(EIGEN_TEST_AVX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx") message(STATUS "Enabling AVX in tests/examples") endif() option(EIGEN_TEST_FMA "Enable/Disable FMA in tests/examples" OFF) if(EIGEN_TEST_FMA AND NOT EIGEN_TEST_NEON) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfma") message(STATUS "Enabling FMA in tests/examples") endif() option(EIGEN_TEST_AVX2 "Enable/Disable AVX2 in tests/examples" OFF) if(EIGEN_TEST_AVX2) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2 -mfma") message(STATUS "Enabling AVX2 in tests/examples") endif() option(EIGEN_TEST_AVX512 "Enable/Disable AVX512 in tests/examples" OFF) if(EIGEN_TEST_AVX512) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512f -mfma") if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fabi-version=6") endif() message(STATUS "Enabling AVX512 in tests/examples") endif() option(EIGEN_TEST_AVX512DQ "Enable/Disable AVX512DQ in tests/examples" OFF) if(EIGEN_TEST_AVX512DQ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512dq") if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fabi-version=6") endif() message(STATUS "Enabling AVX512DQ in tests/examples") endif() option(EIGEN_TEST_F16C "Enable/Disable F16C in tests/examples" OFF) if(EIGEN_TEST_F16C) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mf16c") message(STATUS "Enabling F16C 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_VSX "Enable/Disable VSX in tests/examples" OFF) if(EIGEN_TEST_VSX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -mvsx") message(STATUS "Enabling VSX in tests/examples") endif() option(EIGEN_TEST_MSA "Enable/Disable MSA in tests/examples" OFF) if(EIGEN_TEST_MSA) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmsa") message(STATUS "Enabling MSA in tests/examples") endif() option(EIGEN_TEST_NEON "Enable/Disable Neon in tests/examples" OFF) if(EIGEN_TEST_NEON) if(EIGEN_TEST_FMA) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon-vfpv4") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon") endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfloat-abi=hard") message(STATUS "Enabling NEON in tests/examples") endif() option(EIGEN_TEST_NEON64 "Enable/Disable Neon in tests/examples" OFF) if(EIGEN_TEST_NEON64) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") message(STATUS "Enabling NEON in tests/examples") endif() option(EIGEN_TEST_Z13 "Enable/Disable S390X(zEC13) ZVECTOR in tests/examples" OFF) if(EIGEN_TEST_Z13) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=z13 -mzvector") message(STATUS "Enabling S390X(zEC13) ZVECTOR in tests/examples") endif() option(EIGEN_TEST_Z14 "Enable/Disable S390X(zEC14) ZVECTOR in tests/examples" OFF) if(EIGEN_TEST_Z14) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=z14 -mzvector") message(STATUS "Enabling S390X(zEC13) ZVECTOR 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() else() # 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 deactivate 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() message(STATUS "Enabling SSE2 in tests/examples") endif() option(EIGEN_TEST_AVX "Enable/Disable AVX in tests/examples" OFF) if(EIGEN_TEST_AVX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX") message(STATUS "Enabling AVX in tests/examples") endif() option(EIGEN_TEST_FMA "Enable/Disable FMA/AVX2 in tests/examples" OFF) if(EIGEN_TEST_FMA AND NOT EIGEN_TEST_NEON) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2") message(STATUS "Enabling FMA/AVX2 in tests/examples") endif() endif() 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_NO_EXCEPTIONS "Disables C++ exceptions" OFF) if(EIGEN_TEST_NO_EXCEPTIONS) ei_add_cxx_compiler_flag("-fno-exceptions") message(STATUS "Disabling exceptions in tests/examples") endif() set(EIGEN_CUDA_COMPUTE_ARCH 30 CACHE STRING "The CUDA compute architecture level to target when compiling CUDA code") include_directories(${CMAKE_CURRENT_SOURCE_DIR}) # Backward compatibility support for EIGEN_INCLUDE_INSTALL_DIR if(EIGEN_INCLUDE_INSTALL_DIR) message(WARNING "EIGEN_INCLUDE_INSTALL_DIR is deprecated. Use INCLUDE_INSTALL_DIR instead.") endif() if(EIGEN_INCLUDE_INSTALL_DIR AND NOT INCLUDE_INSTALL_DIR) set(INCLUDE_INSTALL_DIR ${EIGEN_INCLUDE_INSTALL_DIR} CACHE PATH "The directory relative to CMAKE_INSTALL_PREFIX where Eigen header files are installed") else() set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/eigen3" CACHE PATH "The directory relative to CMAKE_INSTALL_PREFIX where Eigen header files are installed" ) endif() set(CMAKEPACKAGE_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/eigen3/cmake" CACHE PATH "The directory relative to CMAKE_INSTALL_PREFIX where Eigen3Config.cmake is installed" ) set(PKGCONFIG_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/pkgconfig" CACHE PATH "The directory relative to CMAKE_INSTALL_PREFIX where eigen3.pc is installed" ) foreach(var INCLUDE_INSTALL_DIR CMAKEPACKAGE_INSTALL_DIR PKGCONFIG_INSTALL_DIR) # If an absolute path is specified, make it relative to "{CMAKE_INSTALL_PREFIX}". if(IS_ABSOLUTE "${${var}}") file(RELATIVE_PATH "${var}" "${CMAKE_INSTALL_PREFIX}" "${${var}}") endif() endforeach() # 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() set_target_properties(${target} PROPERTIES ${prop} "${previous} ${value}") endmacro() install(FILES signature_of_eigen3_matrix_library DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel ) if(EIGEN_BUILD_PKGCONFIG) configure_file(eigen3.pc.in eigen3.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eigen3.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} ) endif() install(DIRECTORY Eigen DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel) option(EIGEN_BUILD_DOC "Enable creation of Eigen documentation" ON) if(EIGEN_BUILD_DOC) add_subdirectory(doc EXCLUDE_FROM_ALL) endif() option(BUILD_TESTING "Enable creation of Eigen tests." ON) if(BUILD_TESTING) include(EigenConfigureTesting) if(EIGEN_LEAVE_TEST_IN_ALL_TARGET) add_subdirectory(test) # can't do EXCLUDE_FROM_ALL here, breaks CTest else() add_subdirectory(test EXCLUDE_FROM_ALL) endif() add_subdirectory(failtest) endif() 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() # add SYCL option(EIGEN_TEST_SYCL "Add Sycl support." OFF) option(EIGEN_SYCL_TRISYCL "Use the triSYCL Sycl implementation (ComputeCPP by default)." OFF) if(EIGEN_TEST_SYCL) set (CMAKE_MODULE_PATH "${CMAKE_ROOT}/Modules" "cmake/Modules/" "${CMAKE_MODULE_PATH}") find_package(Threads REQUIRED) if(EIGEN_SYCL_TRISYCL) message(STATUS "Using triSYCL") include(FindTriSYCL) else() message(STATUS "Using ComputeCPP SYCL") include(FindComputeCpp) set(COMPUTECPP_DRIVER_DEFAULT_VALUE OFF) if (NOT MSVC) set(COMPUTECPP_DRIVER_DEFAULT_VALUE ON) endif() option(COMPUTECPP_USE_COMPILER_DRIVER "Use ComputeCpp driver instead of a 2 steps compilation" ${COMPUTECPP_DRIVER_DEFAULT_VALUE} ) endif(EIGEN_SYCL_TRISYCL) option(EIGEN_DONT_VECTORIZE_SYCL "Don't use vectorisation in the SYCL tests." OFF) if(EIGEN_DONT_VECTORIZE_SYCL) message(STATUS "Disabling SYCL vectorization in tests/examples") # When disabling SYCL vectorization, also disable Eigen default vectorization add_definitions(-DEIGEN_DONT_VECTORIZE=1) add_definitions(-DEIGEN_DONT_VECTORIZE_SYCL=1) endif() endif() 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() if(NOT WIN32) add_subdirectory(bench/spbench EXCLUDE_FROM_ALL) endif() configure_file(scripts/cdashtesting.cmake.in cdashtesting.cmake @ONLY) if(BUILD_TESTING) ei_testing_print_summary() endif() message(STATUS "") message(STATUS "Configured Eigen ${EIGEN_VERSION_NUMBER}") message(STATUS "") string(TOLOWER "${CMAKE_GENERATOR}" cmake_generator_tolower) if(cmake_generator_tolower MATCHES "makefile") message(STATUS "Available targets (use: make TARGET):") else() message(STATUS "Available targets (use: cmake --build . --target TARGET):") endif() message(STATUS "---------+--------------------------------------------------------------") message(STATUS "Target | Description") message(STATUS "---------+--------------------------------------------------------------") message(STATUS "install | Install Eigen. Headers will be installed to:") message(STATUS " | /") message(STATUS " | Using the following values:") message(STATUS " | CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") message(STATUS " | INCLUDE_INSTALL_DIR: ${INCLUDE_INSTALL_DIR}") message(STATUS " | Change the install location of Eigen headers using:") message(STATUS " | cmake . -DCMAKE_INSTALL_PREFIX=yourprefix") message(STATUS " | Or:") message(STATUS " | cmake . -DINCLUDE_INSTALL_DIR=yourdir") message(STATUS "doc | Generate the API documentation, requires Doxygen & LaTeX") if(BUILD_TESTING) message(STATUS "check | Build and run the unit-tests. Read this page:") message(STATUS " | http://eigen.tuxfamily.org/index.php?title=Tests") endif() message(STATUS "blas | Build BLAS library (not the same thing as Eigen)") message(STATUS "uninstall| Remove files installed by the install target") message(STATUS "---------+--------------------------------------------------------------") message(STATUS "") set ( EIGEN_VERSION_STRING ${EIGEN_VERSION_NUMBER} ) set ( EIGEN_VERSION_MAJOR ${EIGEN_WORLD_VERSION} ) set ( EIGEN_VERSION_MINOR ${EIGEN_MAJOR_VERSION} ) set ( EIGEN_VERSION_PATCH ${EIGEN_MINOR_VERSION} ) include (CMakePackageConfigHelpers) # Imported target support add_library (eigen INTERFACE) add_library (Eigen3::Eigen ALIAS eigen) target_compile_definitions (eigen INTERFACE ${EIGEN_DEFINITIONS}) target_include_directories (eigen INTERFACE $ $ ) # Export as title case Eigen set_target_properties (eigen PROPERTIES EXPORT_NAME Eigen) install (TARGETS eigen EXPORT Eigen3Targets) configure_package_config_file ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Eigen3Config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake INSTALL_DESTINATION ${CMAKEPACKAGE_INSTALL_DIR} NO_SET_AND_CHECK_MACRO # Eigen does not provide legacy style defines NO_CHECK_REQUIRED_COMPONENTS_MACRO # Eigen does not provide components ) # Remove CMAKE_SIZEOF_VOID_P from Eigen3ConfigVersion.cmake since Eigen does # not depend on architecture specific settings or libraries. More # specifically, an Eigen3Config.cmake generated from a 64 bit target can be # used for 32 bit targets as well (and vice versa). set (_Eigen3_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P}) unset (CMAKE_SIZEOF_VOID_P) write_basic_package_version_file (Eigen3ConfigVersion.cmake VERSION ${EIGEN_VERSION_NUMBER} COMPATIBILITY SameMajorVersion) set (CMAKE_SIZEOF_VOID_P ${_Eigen3_CMAKE_SIZEOF_VOID_P}) # The Eigen target will be located in the Eigen3 namespace. Other CMake # targets can refer to it using Eigen3::Eigen. export (TARGETS eigen NAMESPACE Eigen3:: FILE Eigen3Targets.cmake) # Export Eigen3 package to CMake registry such that it can be easily found by # CMake even if it has not been installed to a standard directory. export (PACKAGE Eigen3) install (EXPORT Eigen3Targets NAMESPACE Eigen3:: DESTINATION ${CMAKEPACKAGE_INSTALL_DIR}) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake ${CMAKE_CURRENT_BINARY_DIR}/Eigen3ConfigVersion.cmake DESTINATION ${CMAKEPACKAGE_INSTALL_DIR}) # Add uninstall target add_custom_target ( uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/EigenUninstall.cmake) if (EIGEN_SPLIT_TESTSUITE) ei_split_testsuite("${EIGEN_SPLIT_TESTSUITE}") endif() ================================================ FILE: VO_Module/thirdparty/eigen/COPYING.APACHE ================================================ /* Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ ================================================ FILE: VO_Module/thirdparty/eigen/COPYING.BSD ================================================ /* Copyright (c) 2011, Intel Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ ================================================ FILE: VO_Module/thirdparty/eigen/COPYING.GPL ================================================ 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 . ================================================ FILE: VO_Module/thirdparty/eigen/COPYING.LGPL ================================================ GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, 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 Street, 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! ================================================ FILE: VO_Module/thirdparty/eigen/COPYING.MINPACK ================================================ Minpack Copyright Notice (1999) University of Chicago. All rights reserved Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the University of Chicago, as Operator of Argonne National Laboratory. Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4) DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL BE CORRECTED. 5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGES. ================================================ FILE: VO_Module/thirdparty/eigen/COPYING.MPL2 ================================================ Mozilla Public License Version 2.0 ================================== 1. Definitions -------------- 1.1. "Contributor" means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software. 1.2. "Contributor Version" means the combination of the Contributions of others (if any) used by a Contributor and that particular Contributor's Contribution. 1.3. "Contribution" means Covered Software of a particular Contributor. 1.4. "Covered Software" means Source Code Form to which the initial Contributor has attached the notice in Exhibit A, the Executable Form of such Source Code Form, and Modifications of such Source Code Form, in each case including portions thereof. 1.5. "Incompatible With Secondary Licenses" means (a) that the initial Contributor has attached the notice described in Exhibit B to the Covered Software; or (b) that the Covered Software was made available under the terms of version 1.1 or earlier of the License, but not also under the terms of a Secondary License. 1.6. "Executable Form" means any form of the work other than Source Code Form. 1.7. "Larger Work" means a work that combines Covered Software with other material, in a separate file or files, that is not Covered Software. 1.8. "License" means this document. 1.9. "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently, any and all of the rights conveyed by this License. 1.10. "Modifications" means any of the following: (a) any file in Source Code Form that results from an addition to, deletion from, or modification of the contents of Covered Software; or (b) any new file in Source Code Form that contains any Covered Software. 1.11. "Patent Claims" of a Contributor means any patent claim(s), including without limitation, method, process, and apparatus claims, in any patent Licensable by such Contributor that would be infringed, but for the grant of the License, by the making, using, selling, offering for sale, having made, import, or transfer of either its Contributions or its Contributor Version. 1.12. "Secondary License" means either the GNU General Public License, Version 2.0, the GNU Lesser General Public License, Version 2.1, the GNU Affero General Public License, Version 3.0, or any later versions of those licenses. 1.13. "Source Code Form" means the form of the work preferred for making modifications. 1.14. "You" (or "Your") means an individual or a legal entity exercising rights under this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 2. License Grants and Conditions -------------------------------- 2.1. Grants Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license: (a) under intellectual property rights (other than patent or trademark) Licensable by such Contributor to use, reproduce, make available, modify, display, perform, distribute, and otherwise exploit its Contributions, either on an unmodified basis, with Modifications, or as part of a Larger Work; and (b) under Patent Claims of such Contributor to make, use, sell, offer for sale, have made, import, and otherwise transfer either its Contributions or its Contributor Version. 2.2. Effective Date The licenses granted in Section 2.1 with respect to any Contribution become effective for each Contribution on the date the Contributor first distributes such Contribution. 2.3. Limitations on Grant Scope The licenses granted in this Section 2 are the only rights granted under this License. No additional rights or licenses will be implied from the distribution or licensing of Covered Software under this License. Notwithstanding Section 2.1(b) above, no patent license is granted by a Contributor: (a) for any code that a Contributor has removed from Covered Software; or (b) for infringements caused by: (i) Your and any other third party's modifications of Covered Software, or (ii) the combination of its Contributions with other software (except as part of its Contributor Version); or (c) under Patent Claims infringed by Covered Software in the absence of its Contributions. This License does not grant any rights in the trademarks, service marks, or logos of any Contributor (except as may be necessary to comply with the notice requirements in Section 3.4). 2.4. Subsequent Licenses No Contributor makes additional grants as a result of Your choice to distribute the Covered Software under a subsequent version of this License (see Section 10.2) or under the terms of a Secondary License (if permitted under the terms of Section 3.3). 2.5. Representation Each Contributor represents that the Contributor believes its Contributions are its original creation(s) or it has sufficient rights to grant the rights to its Contributions conveyed by this License. 2.6. Fair Use This License is not intended to limit any rights You have under applicable copyright doctrines of fair use, fair dealing, or other equivalents. 2.7. Conditions Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in Section 2.1. 3. Responsibilities ------------------- 3.1. Distribution of Source Form All distribution of Covered Software in Source Code Form, including any Modifications that You create or to which You contribute, must be under the terms of this License. You must inform recipients that the Source Code Form of the Covered Software is governed by the terms of this License, and how they can obtain a copy of this License. You may not attempt to alter or restrict the recipients' rights in the Source Code Form. 3.2. Distribution of Executable Form If You distribute Covered Software in Executable Form then: (a) such Covered Software must also be made available in Source Code Form, as described in Section 3.1, and You must inform recipients of the Executable Form how they can obtain a copy of such Source Code Form by reasonable means in a timely manner, at a charge no more than the cost of distribution to the recipient; and (b) You may distribute such Executable Form under the terms of this License, or sublicense it under different terms, provided that the license for the Executable Form does not attempt to limit or alter the recipients' rights in the Source Code Form under this License. 3.3. Distribution of a Larger Work You may create and distribute a Larger Work under terms of Your choice, provided that You also comply with the requirements of this License for the Covered Software. If the Larger Work is a combination of Covered Software with a work governed by one or more Secondary Licenses, and the Covered Software is not Incompatible With Secondary Licenses, this License permits You to additionally distribute such Covered Software under the terms of such Secondary License(s), so that the recipient of the Larger Work may, at their option, further distribute the Covered Software under the terms of either this License or such Secondary License(s). 3.4. Notices You may not remove or alter the substance of any license notices (including copyright notices, patent notices, disclaimers of warranty, or limitations of liability) contained within the Source Code Form of the Covered Software, except that You may alter any license notices to the extent required to remedy known factual inaccuracies. 3.5. Application of Additional Terms You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, You may do so only on Your own behalf, and not on behalf of any Contributor. You must make it absolutely clear that any such warranty, support, indemnity, or liability obligation is offered by You alone, and You hereby agree to indemnify every Contributor for any liability incurred by such Contributor as a result of warranty, support, indemnity or liability terms You offer. You may include additional disclaimers of warranty and limitations of liability specific to any jurisdiction. 4. Inability to Comply Due to Statute or Regulation --------------------------------------------------- If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Software due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be placed in a text file included with all distributions of the Covered Software under this License. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. 5. Termination -------------- 5.1. The rights granted under this License will terminate automatically if You fail to comply with any of its terms. However, if You become compliant, then the rights granted under this License from a particular Contributor are reinstated (a) provisionally, unless and until such Contributor explicitly and finally terminates Your grants, and (b) on an ongoing basis, if such Contributor fails to notify You of the non-compliance by some reasonable means prior to 60 days after You have come back into compliance. Moreover, Your grants from a particular Contributor are reinstated on an ongoing basis if such Contributor notifies You of the non-compliance by some reasonable means, this is the first time You have received notice of non-compliance with this License from such Contributor, and You become compliant prior to 30 days after Your receipt of the notice. 5.2. If You initiate litigation against any entity by asserting a patent infringement claim (excluding declaratory judgment actions, counter-claims, and cross-claims) alleging that a Contributor Version directly or indirectly infringes any patent, then the rights granted to You by any and all Contributors for the Covered Software under Section 2.1 of this License shall terminate. 5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or Your distributors under this License prior to termination shall survive termination. ************************************************************************ * * * 6. Disclaimer of Warranty * * ------------------------- * * * * Covered Software is provided under this License on an "as is" * * basis, without warranty of any kind, either expressed, implied, or * * statutory, including, without limitation, warranties that the * * Covered Software is free of defects, merchantable, fit for a * * particular purpose or non-infringing. The entire risk as to the * * quality and performance of the Covered Software is with You. * * Should any Covered Software prove defective in any respect, You * * (not any Contributor) assume the cost of any necessary servicing, * * repair, or correction. This disclaimer of warranty constitutes an * * essential part of this License. No use of any Covered Software is * * authorized under this License except under this disclaimer. * * * ************************************************************************ ************************************************************************ * * * 7. Limitation of Liability * * -------------------------- * * * * Under no circumstances and under no legal theory, whether tort * * (including negligence), contract, or otherwise, shall any * * Contributor, or anyone who distributes Covered Software as * * permitted above, be liable to You for any direct, indirect, * * special, incidental, or consequential damages of any character * * including, without limitation, damages for lost profits, loss of * * goodwill, work stoppage, computer failure or malfunction, or any * * and all other commercial damages or losses, even if such party * * shall have been informed of the possibility of such damages. This * * limitation of liability shall not apply to liability for death or * * personal injury resulting from such party's negligence to the * * extent applicable law prohibits such limitation. Some * * jurisdictions do not allow the exclusion or limitation of * * incidental or consequential damages, so this exclusion and * * limitation may not apply to You. * * * ************************************************************************ 8. Litigation ------------- Any litigation relating to this License may be brought only in the courts of a jurisdiction where the defendant maintains its principal place of business and such litigation shall be governed by laws of that jurisdiction, without reference to its conflict-of-law provisions. Nothing in this Section shall prevent a party's ability to bring cross-claims or counter-claims. 9. Miscellaneous ---------------- This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not be used to construe this License against a Contributor. 10. Versions of the License --------------------------- 10.1. New Versions Mozilla Foundation is the license steward. Except as provided in Section 10.3, no one other than the license steward has the right to modify or publish new versions of this License. Each version will be given a distinguishing version number. 10.2. Effect of New Versions You may distribute the Covered Software under the terms of the version of the License under which You originally received the Covered Software, or under the terms of any subsequent version published by the license steward. 10.3. Modified Versions If you create software not governed by this License, and you want to create a new license for such software, you may create and use a modified version of this License if you rename the license and remove any references to the name of the license steward (except to note that such modified license differs from this License). 10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses If You choose to distribute Source Code Form that is Incompatible With Secondary Licenses under the terms of this version of the License, the notice described in Exhibit B of this License must be attached. Exhibit A - Source Code Form License Notice ------------------------------------------- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice. You may add additional accurate notices of copyright ownership. Exhibit B - "Incompatible With Secondary Licenses" Notice --------------------------------------------------------- This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. ================================================ FILE: VO_Module/thirdparty/eigen/COPYING.README ================================================ Eigen is primarily MPL2 licensed. See COPYING.MPL2 and these links: http://www.mozilla.org/MPL/2.0/ http://www.mozilla.org/MPL/2.0/FAQ.html Some files contain third-party code under BSD or LGPL licenses, whence the other COPYING.* files here. All the LGPL code is either LGPL 2.1-only, or LGPL 2.1-or-later. For this reason, the COPYING.LGPL file contains the LGPL 2.1 text. If you want to guarantee that the Eigen code that you are #including is licensed under the MPL2 and possibly more permissive licenses (like BSD), #define this preprocessor symbol: EIGEN_MPL2_ONLY For example, with most compilers, you could add this to your project CXXFLAGS: -DEIGEN_MPL2_ONLY This will cause a compilation error to be generated if you #include any code that is LGPL licensed. ================================================ FILE: VO_Module/thirdparty/eigen/CTestConfig.cmake ================================================ ## 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 "my.cdash.org") set(CTEST_DROP_LOCATION "/submit.php?project=Eigen") set(CTEST_DROP_SITE_CDASH TRUE) #set(CTEST_PROJECT_SUBPROJECTS #Official #Unsupported #) ================================================ FILE: VO_Module/thirdparty/eigen/CTestCustom.cmake.in ================================================ set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS "2000") set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS "2000") list(APPEND CTEST_CUSTOM_ERROR_EXCEPTION @EIGEN_CTEST_ERROR_EXCEPTION@) ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/Cholesky ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_CHOLESKY_MODULE_H #define EIGEN_CHOLESKY_MODULE_H #include "Core" #include "Jacobi" #include "src/Core/util/DisableStupidWarnings.h" /** \defgroup Cholesky_Module Cholesky module * * * * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices. * Those decompositions are also accessible via the following methods: * - MatrixBase::llt() * - MatrixBase::ldlt() * - SelfAdjointView::llt() * - SelfAdjointView::ldlt() * * \code * #include * \endcode */ #include "src/Cholesky/LLT.h" #include "src/Cholesky/LDLT.h" #ifdef EIGEN_USE_LAPACKE #ifdef EIGEN_USE_MKL #include "mkl_lapacke.h" #else #include "src/misc/lapacke.h" #endif #include "src/Cholesky/LLT_LAPACKE.h" #endif #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_CHOLESKY_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/CholmodSupport ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_CHOLMODSUPPORT_MODULE_H #define EIGEN_CHOLMODSUPPORT_MODULE_H #include "SparseCore" #include "src/Core/util/DisableStupidWarnings.h" extern "C" { #include } /** \ingroup Support_modules * \defgroup CholmodSupport_Module CholmodSupport module * * This module provides an interface to the Cholmod library which is part of the suitesparse package. * It provides the two following main factorization classes: * - class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization. * - class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial). * * For the sake of completeness, this module also propose the two following classes: * - class CholmodSimplicialLLT * - class CholmodSimplicialLDLT * Note that these classes does not bring any particular advantage compared to the built-in * SimplicialLLT and SimplicialLDLT factorization classes. * * \code * #include * \endcode * * In order to use this module, the cholmod headers must be accessible from the include paths, and your binary must be linked to the cholmod library and its dependencies. * The dependencies depend on how cholmod has been compiled. * For a cmake based project, you can use our FindCholmod.cmake module to help you in this task. * */ #include "src/CholmodSupport/CholmodSupport.h" #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_CHOLMODSUPPORT_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/Dense ================================================ #include "Core" #include "LU" #include "Cholesky" #include "QR" #include "SVD" #include "Geometry" #include "Eigenvalues" ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/Eigen ================================================ #include "Dense" #include "Sparse" ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/Eigenvalues ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_EIGENVALUES_MODULE_H #define EIGEN_EIGENVALUES_MODULE_H #include "Core" #include "Cholesky" #include "Jacobi" #include "Householder" #include "LU" #include "Geometry" #include "src/Core/util/DisableStupidWarnings.h" /** \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/misc/RealSvd2x2.h" #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/RealQZ.h" #include "src/Eigenvalues/GeneralizedEigenSolver.h" #include "src/Eigenvalues/MatrixBaseEigenvalues.h" #ifdef EIGEN_USE_LAPACKE #ifdef EIGEN_USE_MKL #include "mkl_lapacke.h" #else #include "src/misc/lapacke.h" #endif #include "src/Eigenvalues/RealSchur_LAPACKE.h" #include "src/Eigenvalues/ComplexSchur_LAPACKE.h" #include "src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h" #endif #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_EIGENVALUES_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/Geometry ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_GEOMETRY_MODULE_H #define EIGEN_GEOMETRY_MODULE_H #include "Core" #include "SVD" #include "LU" #include #include "src/Core/util/DisableStupidWarnings.h" /** \defgroup Geometry_Module Geometry module * * This module provides support for: * - fixed-size homogeneous transformations * - translation, scaling, 2D and 3D rotations * - \link Quaternion quaternions \endlink * - cross products (\ref MatrixBase::cross, \ref MatrixBase::cross3) * - orthognal vector generation (\ref MatrixBase::unitOrthogonal) * - some linear components: \link ParametrizedLine parametrized-lines \endlink and \link Hyperplane hyperplanes \endlink * - \link AlignedBox axis aligned bounding boxes \endlink * - \link umeyama least-square transformation fitting \endlink * * \code * #include * \endcode */ #include "src/Geometry/OrthoMethods.h" #include "src/Geometry/EulerAngles.h" #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" // Use the SSE optimized version whenever possible. #if (defined EIGEN_VECTORIZE_SSE) || (defined EIGEN_VECTORIZE_NEON) #include "src/Geometry/arch/Geometry_SIMD.h" #endif #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_GEOMETRY_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/Householder ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_HOUSEHOLDER_MODULE_H #define EIGEN_HOUSEHOLDER_MODULE_H #include "Core" #include "src/Core/util/DisableStupidWarnings.h" /** \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" #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_HOUSEHOLDER_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/IterativeLinearSolvers ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_ITERATIVELINEARSOLVERS_MODULE_H #define EIGEN_ITERATIVELINEARSOLVERS_MODULE_H #include "SparseCore" #include "OrderingMethods" #include "src/Core/util/DisableStupidWarnings.h" /** * \defgroup IterativeLinearSolvers_Module IterativeLinearSolvers module * * This module currently provides iterative methods to solve problems of the form \c A \c x = \c b, where \c A is a squared matrix, usually very large and sparse. * Those solvers are accessible via the following classes: * - ConjugateGradient for selfadjoint (hermitian) matrices, * - LeastSquaresConjugateGradient for rectangular least-square problems, * - BiCGSTAB for general square matrices. * * These iterative solvers are associated with some preconditioners: * - IdentityPreconditioner - not really useful * - DiagonalPreconditioner - also called Jacobi preconditioner, work very well on diagonal dominant matrices. * - IncompleteLUT - incomplete LU factorization with dual thresholding * * Such problems can also be solved using the direct sparse decomposition modules: SparseCholesky, CholmodSupport, UmfPackSupport, SuperLUSupport. * \code #include \endcode */ #include "src/IterativeLinearSolvers/SolveWithGuess.h" #include "src/IterativeLinearSolvers/IterativeSolverBase.h" #include "src/IterativeLinearSolvers/BasicPreconditioners.h" #include "src/IterativeLinearSolvers/ConjugateGradient.h" #include "src/IterativeLinearSolvers/LeastSquareConjugateGradient.h" #include "src/IterativeLinearSolvers/BiCGSTAB.h" #include "src/IterativeLinearSolvers/IncompleteLUT.h" #include "src/IterativeLinearSolvers/IncompleteCholesky.h" #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_ITERATIVELINEARSOLVERS_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/Jacobi ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_JACOBI_MODULE_H #define EIGEN_JACOBI_MODULE_H #include "Core" #include "src/Core/util/DisableStupidWarnings.h" /** \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" #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_JACOBI_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/KLUSupport ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_KLUSUPPORT_MODULE_H #define EIGEN_KLUSUPPORT_MODULE_H #include #include extern "C" { #include #include } /** \ingroup Support_modules * \defgroup KLUSupport_Module KLUSupport module * * This module provides an interface to the KLU library which is part of the suitesparse package. * It provides the following factorization class: * - class KLU: a sparse LU factorization, well-suited for circuit simulation. * * \code * #include * \endcode * * In order to use this module, the klu and btf headers must be accessible from the include paths, and your binary must be linked to the klu library and its dependencies. * The dependencies depend on how umfpack has been compiled. * For a cmake based project, you can use our FindKLU.cmake module to help you in this task. * */ #include "src/KLUSupport/KLUSupport.h" #include #endif // EIGEN_KLUSUPPORT_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/LU ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_LU_MODULE_H #define EIGEN_LU_MODULE_H #include "Core" #include "src/Core/util/DisableStupidWarnings.h" /** \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/Kernel.h" #include "src/misc/Image.h" #include "src/LU/FullPivLU.h" #include "src/LU/PartialPivLU.h" #ifdef EIGEN_USE_LAPACKE #ifdef EIGEN_USE_MKL #include "mkl_lapacke.h" #else #include "src/misc/lapacke.h" #endif #include "src/LU/PartialPivLU_LAPACKE.h" #endif #include "src/LU/Determinant.h" #include "src/LU/InverseImpl.h" #if defined EIGEN_VECTORIZE_SSE || defined EIGEN_VECTORIZE_NEON #include "src/LU/arch/InverseSize4.h" #endif #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_LU_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/MetisSupport ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_METISSUPPORT_MODULE_H #define EIGEN_METISSUPPORT_MODULE_H #include "SparseCore" #include "src/Core/util/DisableStupidWarnings.h" extern "C" { #include } /** \ingroup Support_modules * \defgroup MetisSupport_Module MetisSupport module * * \code * #include * \endcode * This module defines an interface to the METIS reordering package (http://glaros.dtc.umn.edu/gkhome/views/metis). * It can be used just as any other built-in method as explained in \link OrderingMethods_Module here. \endlink */ #include "src/MetisSupport/MetisSupport.h" #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_METISSUPPORT_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/OrderingMethods ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_ORDERINGMETHODS_MODULE_H #define EIGEN_ORDERINGMETHODS_MODULE_H #include "SparseCore" #include "src/Core/util/DisableStupidWarnings.h" /** * \defgroup OrderingMethods_Module OrderingMethods module * * This module is currently for internal use only * * It defines various built-in and external ordering methods for sparse matrices. * They are typically used to reduce the number of elements during * the sparse matrix decomposition (LLT, LU, QR). * Precisely, in a preprocessing step, a permutation matrix P is computed using * those ordering methods and applied to the columns of the matrix. * Using for instance the sparse Cholesky decomposition, it is expected that * the nonzeros elements in LLT(A*P) will be much smaller than that in LLT(A). * * * Usage : * \code * #include * \endcode * * A simple usage is as a template parameter in the sparse decomposition classes : * * \code * SparseLU > solver; * \endcode * * \code * SparseQR > solver; * \endcode * * It is possible as well to call directly a particular ordering method for your own purpose, * \code * AMDOrdering ordering; * PermutationMatrix perm; * SparseMatrix A; * //Fill the matrix ... * * ordering(A, perm); // Call AMD * \endcode * * \note Some of these methods (like AMD or METIS), need the sparsity pattern * of the input matrix to be symmetric. When the matrix is structurally unsymmetric, * Eigen computes internally the pattern of \f$A^T*A\f$ before calling the method. * If your matrix is already symmetric (at leat in structure), you can avoid that * by calling the method with a SelfAdjointView type. * * \code * // Call the ordering on the pattern of the lower triangular matrix A * ordering(A.selfadjointView(), perm); * \endcode */ #include "src/OrderingMethods/Amd.h" #include "src/OrderingMethods/Ordering.h" #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_ORDERINGMETHODS_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/PaStiXSupport ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_PASTIXSUPPORT_MODULE_H #define EIGEN_PASTIXSUPPORT_MODULE_H #include "SparseCore" #include "src/Core/util/DisableStupidWarnings.h" extern "C" { #include #include } #ifdef complex #undef complex #endif /** \ingroup Support_modules * \defgroup PaStiXSupport_Module PaStiXSupport module * * This module provides an interface to the PaSTiX library. * PaSTiX is a general \b supernodal, \b parallel and \b opensource sparse solver. * It provides the two following main factorization classes: * - class PastixLLT : a supernodal, parallel LLt Cholesky factorization. * - class PastixLDLT: a supernodal, parallel LDLt Cholesky factorization. * - class PastixLU : a supernodal, parallel LU factorization (optimized for a symmetric pattern). * * \code * #include * \endcode * * In order to use this module, the PaSTiX headers must be accessible from the include paths, and your binary must be linked to the PaSTiX library and its dependencies. * This wrapper resuires PaStiX version 5.x compiled without MPI support. * The dependencies depend on how PaSTiX has been compiled. * For a cmake based project, you can use our FindPaSTiX.cmake module to help you in this task. * */ #include "src/PaStiXSupport/PaStiXSupport.h" #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_PASTIXSUPPORT_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/PardisoSupport ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_PARDISOSUPPORT_MODULE_H #define EIGEN_PARDISOSUPPORT_MODULE_H #include "SparseCore" #include "src/Core/util/DisableStupidWarnings.h" #include /** \ingroup Support_modules * \defgroup PardisoSupport_Module PardisoSupport module * * This module brings support for the Intel(R) MKL PARDISO direct sparse solvers. * * \code * #include * \endcode * * In order to use this module, the MKL headers must be accessible from the include paths, and your binary must be linked to the MKL library and its dependencies. * See this \ref TopicUsingIntelMKL "page" for more information on MKL-Eigen integration. * */ #include "src/PardisoSupport/PardisoSupport.h" #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_PARDISOSUPPORT_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/QR ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_QR_MODULE_H #define EIGEN_QR_MODULE_H #include "Core" #include "Cholesky" #include "Jacobi" #include "Householder" #include "src/Core/util/DisableStupidWarnings.h" /** \defgroup QR_Module QR module * * * * This module provides various QR decompositions * This module also provides some MatrixBase methods, including: * - MatrixBase::householderQr() * - MatrixBase::colPivHouseholderQr() * - MatrixBase::fullPivHouseholderQr() * * \code * #include * \endcode */ #include "src/QR/HouseholderQR.h" #include "src/QR/FullPivHouseholderQR.h" #include "src/QR/ColPivHouseholderQR.h" #include "src/QR/CompleteOrthogonalDecomposition.h" #ifdef EIGEN_USE_LAPACKE #ifdef EIGEN_USE_MKL #include "mkl_lapacke.h" #else #include "src/misc/lapacke.h" #endif #include "src/QR/HouseholderQR_LAPACKE.h" #include "src/QR/ColPivHouseholderQR_LAPACKE.h" #endif #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_QR_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/QtAlignedMalloc ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_QTMALLOC_MODULE_H #define EIGEN_QTMALLOC_MODULE_H #include "Core" #if (!EIGEN_MALLOC_ALREADY_ALIGNED) #include "src/Core/util/DisableStupidWarnings.h" void *qMalloc(std::size_t size) { return Eigen::internal::aligned_malloc(size); } void qFree(void *ptr) { Eigen::internal::aligned_free(ptr); } void *qRealloc(void *ptr, std::size_t size) { void* newPtr = Eigen::internal::aligned_malloc(size); std::memcpy(newPtr, ptr, size); Eigen::internal::aligned_free(ptr); return newPtr; } #include "src/Core/util/ReenableStupidWarnings.h" #endif #endif // EIGEN_QTMALLOC_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/SPQRSupport ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPQRSUPPORT_MODULE_H #define EIGEN_SPQRSUPPORT_MODULE_H #include "SparseCore" #include "src/Core/util/DisableStupidWarnings.h" #include "SuiteSparseQR.hpp" /** \ingroup Support_modules * \defgroup SPQRSupport_Module SuiteSparseQR module * * This module provides an interface to the SPQR library, which is part of the suitesparse package. * * \code * #include * \endcode * * In order to use this module, the SPQR headers must be accessible from the include paths, and your binary must be linked to the SPQR library and its dependencies (Cholmod, AMD, COLAMD,...). * For a cmake based project, you can use our FindSPQR.cmake and FindCholmod.Cmake modules * */ #include "src/CholmodSupport/CholmodSupport.h" #include "src/SPQRSupport/SuiteSparseQRSupport.h" #endif ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/SVD ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SVD_MODULE_H #define EIGEN_SVD_MODULE_H #include "QR" #include "Householder" #include "Jacobi" #include "src/Core/util/DisableStupidWarnings.h" /** \defgroup SVD_Module SVD module * * * * This module provides SVD decomposition for matrices (both real and complex). * Two decomposition algorithms are provided: * - JacobiSVD implementing two-sided Jacobi iterations is numerically very accurate, fast for small matrices, but very slow for larger ones. * - BDCSVD implementing a recursive divide & conquer strategy on top of an upper-bidiagonalization which remains fast for large problems. * These decompositions are accessible via the respective classes and following MatrixBase methods: * - MatrixBase::jacobiSvd() * - MatrixBase::bdcSvd() * * \code * #include * \endcode */ #include "src/misc/RealSvd2x2.h" #include "src/SVD/UpperBidiagonalization.h" #include "src/SVD/SVDBase.h" #include "src/SVD/JacobiSVD.h" #include "src/SVD/BDCSVD.h" #if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT) #ifdef EIGEN_USE_MKL #include "mkl_lapacke.h" #else #include "src/misc/lapacke.h" #endif #include "src/SVD/JacobiSVD_LAPACKE.h" #endif #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_SVD_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/Sparse ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSE_MODULE_H #define EIGEN_SPARSE_MODULE_H /** \defgroup Sparse_Module Sparse meta-module * * Meta-module including all related modules: * - \ref SparseCore_Module * - \ref OrderingMethods_Module * - \ref SparseCholesky_Module * - \ref SparseLU_Module * - \ref SparseQR_Module * - \ref IterativeLinearSolvers_Module * \code #include \endcode */ #include "SparseCore" #include "OrderingMethods" #include "SparseCholesky" #include "SparseLU" #include "SparseQR" #include "IterativeLinearSolvers" #endif // EIGEN_SPARSE_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/SparseCholesky ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2013 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSECHOLESKY_MODULE_H #define EIGEN_SPARSECHOLESKY_MODULE_H #include "SparseCore" #include "OrderingMethods" #include "src/Core/util/DisableStupidWarnings.h" /** * \defgroup SparseCholesky_Module SparseCholesky module * * This module currently provides two variants of the direct sparse Cholesky decomposition for selfadjoint (hermitian) matrices. * Those decompositions are accessible via the following classes: * - SimplicialLLt, * - SimplicialLDLt * * Such problems can also be solved using the ConjugateGradient solver from the IterativeLinearSolvers module. * * \code * #include * \endcode */ #include "src/SparseCholesky/SimplicialCholesky.h" #include "src/SparseCholesky/SimplicialCholesky_impl.h" #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_SPARSECHOLESKY_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/SparseCore ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSECORE_MODULE_H #define EIGEN_SPARSECORE_MODULE_H #include "Core" #include "src/Core/util/DisableStupidWarnings.h" #include #include #include #include #include /** * \defgroup SparseCore_Module SparseCore module * * This module provides a sparse matrix representation, and basic associated matrix manipulations * and operations. * * See the \ref TutorialSparse "Sparse tutorial" * * \code * #include * \endcode * * This module depends on: Core. */ #include "src/SparseCore/SparseUtil.h" #include "src/SparseCore/SparseMatrixBase.h" #include "src/SparseCore/SparseAssign.h" #include "src/SparseCore/CompressedStorage.h" #include "src/SparseCore/AmbiVector.h" #include "src/SparseCore/SparseCompressedBase.h" #include "src/SparseCore/SparseMatrix.h" #include "src/SparseCore/SparseMap.h" #include "src/SparseCore/MappedSparseMatrix.h" #include "src/SparseCore/SparseVector.h" #include "src/SparseCore/SparseRef.h" #include "src/SparseCore/SparseCwiseUnaryOp.h" #include "src/SparseCore/SparseCwiseBinaryOp.h" #include "src/SparseCore/SparseTranspose.h" #include "src/SparseCore/SparseBlock.h" #include "src/SparseCore/SparseDot.h" #include "src/SparseCore/SparseRedux.h" #include "src/SparseCore/SparseView.h" #include "src/SparseCore/SparseDiagonalProduct.h" #include "src/SparseCore/ConservativeSparseSparseProduct.h" #include "src/SparseCore/SparseSparseProductWithPruning.h" #include "src/SparseCore/SparseProduct.h" #include "src/SparseCore/SparseDenseProduct.h" #include "src/SparseCore/SparseSelfAdjointView.h" #include "src/SparseCore/SparseTriangularView.h" #include "src/SparseCore/TriangularSolver.h" #include "src/SparseCore/SparsePermutation.h" #include "src/SparseCore/SparseFuzzy.h" #include "src/SparseCore/SparseSolverBase.h" #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_SPARSECORE_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/SparseLU ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // Copyright (C) 2012 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSELU_MODULE_H #define EIGEN_SPARSELU_MODULE_H #include "SparseCore" /** * \defgroup SparseLU_Module SparseLU module * This module defines a supernodal factorization of general sparse matrices. * The code is fully optimized for supernode-panel updates with specialized kernels. * Please, see the documentation of the SparseLU class for more details. */ // Ordering interface #include "OrderingMethods" #include "src/Core/util/DisableStupidWarnings.h" #include "src/SparseLU/SparseLU_gemm_kernel.h" #include "src/SparseLU/SparseLU_Structs.h" #include "src/SparseLU/SparseLU_SupernodalMatrix.h" #include "src/SparseLU/SparseLUImpl.h" #include "src/SparseCore/SparseColEtree.h" #include "src/SparseLU/SparseLU_Memory.h" #include "src/SparseLU/SparseLU_heap_relax_snode.h" #include "src/SparseLU/SparseLU_relax_snode.h" #include "src/SparseLU/SparseLU_pivotL.h" #include "src/SparseLU/SparseLU_panel_dfs.h" #include "src/SparseLU/SparseLU_kernel_bmod.h" #include "src/SparseLU/SparseLU_panel_bmod.h" #include "src/SparseLU/SparseLU_column_dfs.h" #include "src/SparseLU/SparseLU_column_bmod.h" #include "src/SparseLU/SparseLU_copy_to_ucol.h" #include "src/SparseLU/SparseLU_pruneL.h" #include "src/SparseLU/SparseLU_Utils.h" #include "src/SparseLU/SparseLU.h" #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_SPARSELU_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/SparseQR ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSEQR_MODULE_H #define EIGEN_SPARSEQR_MODULE_H #include "SparseCore" #include "OrderingMethods" #include "src/Core/util/DisableStupidWarnings.h" /** \defgroup SparseQR_Module SparseQR module * \brief Provides QR decomposition for sparse matrices * * This module provides a simplicial version of the left-looking Sparse QR decomposition. * The columns of the input matrix should be reordered to limit the fill-in during the * decomposition. Built-in methods (COLAMD, AMD) or external methods (METIS) can be used to this end. * See the \link OrderingMethods_Module OrderingMethods\endlink module for the list * of built-in and external ordering methods. * * \code * #include * \endcode * * */ #include "src/SparseCore/SparseColEtree.h" #include "src/SparseQR/SparseQR.h" #include "src/Core/util/ReenableStupidWarnings.h" #endif ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/StdDeque ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Gael Guennebaud // Copyright (C) 2009 Hauke Heibel // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_STDDEQUE_MODULE_H #define EIGEN_STDDEQUE_MODULE_H #include "Core" #include #if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ #define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...) #else #include "src/StlSupport/StdDeque.h" #endif #endif // EIGEN_STDDEQUE_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/StdList ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Hauke Heibel // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_STDLIST_MODULE_H #define EIGEN_STDLIST_MODULE_H #include "Core" #include #if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ #define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) #else #include "src/StlSupport/StdList.h" #endif #endif // EIGEN_STDLIST_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/StdVector ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Gael Guennebaud // Copyright (C) 2009 Hauke Heibel // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_STDVECTOR_MODULE_H #define EIGEN_STDVECTOR_MODULE_H #include "Core" #include #if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ #define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) #else #include "src/StlSupport/StdVector.h" #endif #endif // EIGEN_STDVECTOR_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/SuperLUSupport ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SUPERLUSUPPORT_MODULE_H #define EIGEN_SUPERLUSUPPORT_MODULE_H #include "SparseCore" #include "src/Core/util/DisableStupidWarnings.h" #ifdef EMPTY #define EIGEN_EMPTY_WAS_ALREADY_DEFINED #endif typedef int int_t; #include #include #include // slu_util.h defines a preprocessor token named EMPTY which is really polluting, // so we remove it in favor of a SUPERLU_EMPTY token. // If EMPTY was already defined then we don't undef it. #if defined(EIGEN_EMPTY_WAS_ALREADY_DEFINED) # undef EIGEN_EMPTY_WAS_ALREADY_DEFINED #elif defined(EMPTY) # undef EMPTY #endif #define SUPERLU_EMPTY (-1) namespace Eigen { struct SluMatrix; } /** \ingroup Support_modules * \defgroup SuperLUSupport_Module SuperLUSupport module * * This module provides an interface to the SuperLU library. * It provides the following factorization class: * - class SuperLU: a supernodal sequential LU factorization. * - class SuperILU: a supernodal sequential incomplete LU factorization (to be used as a preconditioner for iterative methods). * * \warning This wrapper requires at least versions 4.0 of SuperLU. The 3.x versions are not supported. * * \warning When including this module, you have to use SUPERLU_EMPTY instead of EMPTY which is no longer defined because it is too polluting. * * \code * #include * \endcode * * In order to use this module, the superlu headers must be accessible from the include paths, and your binary must be linked to the superlu library and its dependencies. * The dependencies depend on how superlu has been compiled. * For a cmake based project, you can use our FindSuperLU.cmake module to help you in this task. * */ #include "src/SuperLUSupport/SuperLUSupport.h" #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_SUPERLUSUPPORT_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/UmfPackSupport ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_UMFPACKSUPPORT_MODULE_H #define EIGEN_UMFPACKSUPPORT_MODULE_H #include "SparseCore" #include "src/Core/util/DisableStupidWarnings.h" extern "C" { #include } /** \ingroup Support_modules * \defgroup UmfPackSupport_Module UmfPackSupport module * * This module provides an interface to the UmfPack library which is part of the suitesparse package. * It provides the following factorization class: * - class UmfPackLU: a multifrontal sequential LU factorization. * * \code * #include * \endcode * * In order to use this module, the umfpack headers must be accessible from the include paths, and your binary must be linked to the umfpack library and its dependencies. * The dependencies depend on how umfpack has been compiled. * For a cmake based project, you can use our FindUmfPack.cmake module to help you in this task. * */ #include "src/UmfPackSupport/UmfPackSupport.h" #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_UMFPACKSUPPORT_MODULE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Cholesky/LDLT.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2011 Gael Guennebaud // Copyright (C) 2009 Keir Mierle // Copyright (C) 2009 Benoit Jacob // Copyright (C) 2011 Timothy E. Holy // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_LDLT_H #define EIGEN_LDLT_H namespace Eigen { namespace internal { template struct traits > : traits { typedef MatrixXpr XprKind; typedef SolverStorage StorageKind; typedef int StorageIndex; enum { Flags = 0 }; }; template struct LDLT_Traits; // PositiveSemiDef means positive semi-definite and non-zero; same for NegativeSemiDef enum SignMatrix { PositiveSemiDef, NegativeSemiDef, ZeroSign, Indefinite }; } /** \ingroup Cholesky_Module * * \class LDLT * * \brief Robust Cholesky decomposition of a matrix with pivoting * * \tparam MatrixType_ the type of the matrix of which to compute the LDL^T Cholesky decomposition * \tparam UpLo_ the triangular part that will be used for the decomposition: Lower (default) or Upper. * The other triangular part won't be read. * * 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 D 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. * * This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism. * * \sa MatrixBase::ldlt(), SelfAdjointView::ldlt(), class LLT */ template class LDLT : public SolverBase > { public: typedef MatrixType_ MatrixType; typedef SolverBase Base; friend class SolverBase; EIGEN_GENERIC_PUBLIC_INTERFACE(LDLT) enum { MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, UpLo = UpLo_ }; 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_sign(internal::ZeroSign), 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() */ explicit LDLT(Index size) : m_matrix(size, size), m_transpositions(size), m_temporary(size), m_sign(internal::ZeroSign), m_isInitialized(false) {} /** \brief Constructor with decomposition * * This calculates the decomposition for the input \a matrix. * * \sa LDLT(Index size) */ template explicit LDLT(const EigenBase& matrix) : m_matrix(matrix.rows(), matrix.cols()), m_transpositions(matrix.rows()), m_temporary(matrix.rows()), m_sign(internal::ZeroSign), m_isInitialized(false) { compute(matrix.derived()); } /** \brief Constructs a LDLT factorization from a given matrix * * This overloaded constructor is provided for \link InplaceDecomposition inplace decomposition \endlink when \c MatrixType is a Eigen::Ref. * * \sa LDLT(const EigenBase&) */ template explicit LDLT(EigenBase& matrix) : m_matrix(matrix.derived()), m_transpositions(matrix.rows()), m_temporary(matrix.rows()), m_sign(internal::ZeroSign), m_isInitialized(false) { compute(matrix.derived()); } /** Clear any existing decomposition * \sa rankUpdate(w,sigma) */ void setZero() { m_isInitialized = false; } /** \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() const { eigen_assert(m_isInitialized && "LDLT is not initialized."); return m_matrix.diagonal(); } /** \returns true if the matrix is positive (semidefinite) */ inline bool isPositive() const { eigen_assert(m_isInitialized && "LDLT is not initialized."); return m_sign == internal::PositiveSemiDef || m_sign == internal::ZeroSign; } /** \returns true if the matrix is negative (semidefinite) */ inline bool isNegative(void) const { eigen_assert(m_isInitialized && "LDLT is not initialized."); return m_sign == internal::NegativeSemiDef || m_sign == internal::ZeroSign; } #ifdef EIGEN_PARSED_BY_DOXYGEN /** \returns a solution x of \f$ A x = b \f$ using the current decomposition of A. * * This function also supports in-place solves using the syntax x = decompositionObject.solve(x) . * * \note_about_checking_solutions * * More precisely, this method solves \f$ A x = b \f$ using the decomposition \f$ A = P^T L D L^* P \f$ * by solving the systems \f$ P^T y_1 = b \f$, \f$ L y_2 = y_1 \f$, \f$ D y_3 = y_2 \f$, * \f$ L^* y_4 = y_3 \f$ and \f$ P x = y_4 \f$ in succession. If the matrix \f$ A \f$ is singular, then * \f$ D \f$ will also be singular (all the other matrices are invertible). In that case, the * least-square solution of \f$ D y_3 = y_2 \f$ is computed. This does not mean that this function * computes the least-square solution of \f$ A x = b \f$ if \f$ A \f$ is singular. * * \sa MatrixBase::ldlt(), SelfAdjointView::ldlt() */ template inline const Solve solve(const MatrixBase& b) const; #endif template bool solveInPlace(MatrixBase &bAndX) const; template LDLT& compute(const EigenBase& matrix); /** \returns an estimate of the reciprocal condition number of the matrix of * which \c *this is the LDLT decomposition. */ RealScalar rcond() const { eigen_assert(m_isInitialized && "LDLT is not initialized."); return internal::rcond_estimate_helper(m_l1_norm, *this); } template LDLT& rankUpdate(const MatrixBase& w, const RealScalar& alpha=1); /** \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; /** \returns the adjoint of \c *this, that is, a const reference to the decomposition itself as the underlying matrix is self-adjoint. * * This method is provided for compatibility with other matrix decompositions, thus enabling generic code such as: * \code x = decomposition.adjoint().solve(b) \endcode */ const LDLT& adjoint() const { return *this; }; EIGEN_DEVICE_FUNC inline EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } EIGEN_DEVICE_FUNC inline EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } /** \brief Reports whether previous computation was successful. * * \returns \c Success if computation was successful, * \c NumericalIssue if the factorization failed because of a zero pivot. */ ComputationInfo info() const { eigen_assert(m_isInitialized && "LDLT is not initialized."); return m_info; } #ifndef EIGEN_PARSED_BY_DOXYGEN template void _solve_impl(const RhsType &rhs, DstType &dst) const; template void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const; #endif protected: static void check_template_parameters() { EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); } /** \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; RealScalar m_l1_norm; TranspositionType m_transpositions; TmpMatrixType m_temporary; internal::SignMatrix m_sign; bool m_isInitialized; ComputationInfo m_info; }; namespace internal { template struct ldlt_inplace; template<> struct ldlt_inplace { template static bool unblocked(MatrixType& mat, TranspositionType& transpositions, Workspace& temp, SignMatrix& sign) { using std::abs; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef typename TranspositionType::StorageIndex IndexType; eigen_assert(mat.rows()==mat.cols()); const Index size = mat.rows(); bool found_zero_pivot = false; bool ret = true; if (size <= 1) { transpositions.setIdentity(); if(size==0) sign = ZeroSign; else if (numext::real(mat.coeff(0,0)) > static_cast(0) ) sign = PositiveSemiDef; else if (numext::real(mat.coeff(0,0)) < static_cast(0)) sign = NegativeSemiDef; else sign = ZeroSign; return true; } for (Index k = 0; k < size; ++k) { // Find largest diagonal element Index index_of_biggest_in_corner; mat.diagonal().tail(size-k).cwiseAbs().maxCoeff(&index_of_biggest_in_corner); index_of_biggest_in_corner += k; transpositions.coeffRef(k) = IndexType(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(Index i=k+1;i::IsComplex) mat.coeffRef(index_of_biggest_in_corner,k) = numext::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().real().head(k).asDiagonal() * A10.adjoint(); mat.coeffRef(k,k) -= (A10 * temp.head(k)).value(); if(rs>0) A21.noalias() -= A20 * temp.head(k); } // In some previous versions of Eigen (e.g., 3.2.1), the scaling was omitted if the pivot // was smaller than the cutoff value. However, since LDLT is not rank-revealing // we should only make sure that we do not introduce INF or NaN values. // Remark that LAPACK also uses 0 as the cutoff value. RealScalar realAkk = numext::real(mat.coeffRef(k,k)); bool pivot_is_valid = (abs(realAkk) > RealScalar(0)); if(k==0 && !pivot_is_valid) { // The entire diagonal is zero, there is nothing more to do // except filling the transpositions, and checking whether the matrix is zero. sign = ZeroSign; for(Index j = 0; j0) && pivot_is_valid) A21 /= realAkk; else if(rs>0) ret = ret && (A21.array()==Scalar(0)).all(); if(found_zero_pivot && pivot_is_valid) ret = false; // factorization failed else if(!pivot_is_valid) found_zero_pivot = true; if (sign == PositiveSemiDef) { if (realAkk < static_cast(0)) sign = Indefinite; } else if (sign == NegativeSemiDef) { if (realAkk > static_cast(0)) sign = Indefinite; } else if (sign == ZeroSign) { if (realAkk > static_cast(0)) sign = PositiveSemiDef; else if (realAkk < static_cast(0)) sign = NegativeSemiDef; } } return ret; } // Reference for the algorithm: Davis and Hager, "Multiple Rank // Modifications of a Sparse Cholesky Factorization" (Algorithm 1) // Trivial rearrangements of their computations (Timothy E. Holy) // allow their algorithm to work for rank-1 updates even if the // original matrix is not of full rank. // Here only rank-1 updates are implemented, to reduce the // requirement for intermediate storage and improve accuracy template static bool updateInPlace(MatrixType& mat, MatrixBase& w, const typename MatrixType::RealScalar& sigma=1) { using numext::isfinite; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; const Index size = mat.rows(); eigen_assert(mat.cols() == size && w.size()==size); RealScalar alpha = 1; // Apply the update for (Index j = 0; j < size; j++) { // Check for termination due to an original decomposition of low-rank if (!(isfinite)(alpha)) break; // Update the diagonal terms RealScalar dj = numext::real(mat.coeff(j,j)); Scalar wj = w.coeff(j); RealScalar swj2 = sigma*numext::abs2(wj); RealScalar gamma = dj*alpha + swj2; mat.coeffRef(j,j) += swj2/alpha; alpha += swj2/dj; // Update the terms of L Index rs = size-j-1; w.tail(rs) -= wj * mat.col(j).tail(rs); if(gamma != 0) mat.col(j).tail(rs) += (sigma*numext::conj(wj)/gamma)*w.tail(rs); } return true; } template static bool update(MatrixType& mat, const TranspositionType& transpositions, Workspace& tmp, const WType& w, const typename MatrixType::RealScalar& sigma=1) { // Apply the permutation to the input w tmp = transpositions * w; return ldlt_inplace::updateInPlace(mat,tmp,sigma); } }; template<> struct ldlt_inplace { template static EIGEN_STRONG_INLINE bool unblocked(MatrixType& mat, TranspositionType& transpositions, Workspace& temp, SignMatrix& sign) { Transpose matt(mat); return ldlt_inplace::unblocked(matt, transpositions, temp, sign); } template static EIGEN_STRONG_INLINE bool update(MatrixType& mat, TranspositionType& transpositions, Workspace& tmp, WType& w, const typename MatrixType::RealScalar& sigma=1) { Transpose matt(mat); return ldlt_inplace::update(matt, transpositions, tmp, w.conjugate(), sigma); } }; template struct LDLT_Traits { typedef const TriangularView MatrixL; typedef const TriangularView MatrixU; static inline MatrixL getL(const MatrixType& m) { return MatrixL(m); } static inline MatrixU getU(const MatrixType& m) { return MatrixU(m.adjoint()); } }; template struct LDLT_Traits { typedef const TriangularView MatrixL; typedef const TriangularView MatrixU; static inline MatrixL getL(const MatrixType& m) { return MatrixL(m.adjoint()); } static inline MatrixU getU(const MatrixType& m) { return MatrixU(m); } }; } // end namespace internal /** Compute / recompute the LDLT decomposition A = L D L^* = U^* D U of \a matrix */ template template LDLT& LDLT::compute(const EigenBase& a) { check_template_parameters(); eigen_assert(a.rows()==a.cols()); const Index size = a.rows(); m_matrix = a.derived(); // Compute matrix L1 norm = max abs column sum. m_l1_norm = RealScalar(0); // TODO move this code to SelfAdjointView for (Index col = 0; col < size; ++col) { RealScalar abs_col_sum; if (UpLo_ == Lower) abs_col_sum = m_matrix.col(col).tail(size - col).template lpNorm<1>() + m_matrix.row(col).head(col).template lpNorm<1>(); else abs_col_sum = m_matrix.col(col).head(col).template lpNorm<1>() + m_matrix.row(col).tail(size - col).template lpNorm<1>(); if (abs_col_sum > m_l1_norm) m_l1_norm = abs_col_sum; } m_transpositions.resize(size); m_isInitialized = false; m_temporary.resize(size); m_sign = internal::ZeroSign; m_info = internal::ldlt_inplace::unblocked(m_matrix, m_transpositions, m_temporary, m_sign) ? Success : NumericalIssue; m_isInitialized = true; return *this; } /** Update the LDLT decomposition: given A = L D L^T, efficiently compute the decomposition of A + sigma w w^T. * \param w a vector to be incorporated into the decomposition. * \param sigma a scalar, +1 for updates and -1 for "downdates," which correspond to removing previously-added column vectors. Optional; default value is +1. * \sa setZero() */ template template LDLT& LDLT::rankUpdate(const MatrixBase& w, const typename LDLT::RealScalar& sigma) { typedef typename TranspositionType::StorageIndex IndexType; const Index size = w.rows(); if (m_isInitialized) { eigen_assert(m_matrix.rows()==size); } else { m_matrix.resize(size,size); m_matrix.setZero(); m_transpositions.resize(size); for (Index i = 0; i < size; i++) m_transpositions.coeffRef(i) = IndexType(i); m_temporary.resize(size); m_sign = sigma>=0 ? internal::PositiveSemiDef : internal::NegativeSemiDef; m_isInitialized = true; } internal::ldlt_inplace::update(m_matrix, m_transpositions, m_temporary, w, sigma); return *this; } #ifndef EIGEN_PARSED_BY_DOXYGEN template template void LDLT::_solve_impl(const RhsType &rhs, DstType &dst) const { _solve_impl_transposed(rhs, dst); } template template void LDLT::_solve_impl_transposed(const RhsType &rhs, DstType &dst) const { // dst = P b dst = m_transpositions * rhs; // dst = L^-1 (P b) // dst = L^-*T (P b) matrixL().template conjugateIf().solveInPlace(dst); // dst = D^-* (L^-1 P b) // dst = D^-1 (L^-*T P b) // more precisely, use pseudo-inverse of D (see bug 241) using std::abs; const typename Diagonal::RealReturnType vecD(vectorD()); // In some previous versions, tolerance was set to the max of 1/highest (or rather numeric_limits::min()) // and the maximal diagonal entry * epsilon as motivated by LAPACK's xGELSS: // RealScalar tolerance = numext::maxi(vecD.array().abs().maxCoeff() * NumTraits::epsilon(),RealScalar(1) / NumTraits::highest()); // However, LDLT is not rank revealing, and so adjusting the tolerance wrt to the highest // diagonal element is not well justified and leads to numerical issues in some cases. // Moreover, Lapack's xSYTRS routines use 0 for the tolerance. // Using numeric_limits::min() gives us more robustness to denormals. RealScalar tolerance = (std::numeric_limits::min)(); for (Index i = 0; i < vecD.size(); ++i) { if(abs(vecD(i)) > tolerance) dst.row(i) /= vecD(i); else dst.row(i).setZero(); } // dst = L^-* (D^-* L^-1 P b) // dst = L^-T (D^-1 L^-*T P b) matrixL().transpose().template conjugateIf().solveInPlace(dst); // dst = P^T (L^-* D^-* L^-1 P b) = A^-1 b // dst = P^-T (L^-T D^-1 L^-*T P b) = A^-1 b dst = m_transpositions.transpose() * dst; } #endif /** \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."); eigen_assert(m_matrix.rows() == 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().real().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 * \sa MatrixBase::ldlt() */ 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 * \sa SelfAdjointView::ldlt() */ template inline const LDLT::PlainObject> MatrixBase::ldlt() const { return LDLT(derived()); } } // end namespace Eigen #endif // EIGEN_LDLT_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Cholesky/LLT.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_LLT_H #define EIGEN_LLT_H namespace Eigen { namespace internal{ template struct traits > : traits { typedef MatrixXpr XprKind; typedef SolverStorage StorageKind; typedef int StorageIndex; enum { Flags = 0 }; }; template struct LLT_Traits; } /** \ingroup Cholesky_Module * * \class LLT * * \brief Standard Cholesky decomposition (LL^T) of a matrix and associated features * * \tparam MatrixType_ the type of the matrix of which we are computing the LL^T Cholesky decomposition * \tparam UpLo_ the triangular part that will be used for the decomposition: Lower (default) or Upper. * The other triangular part won't be read. * * 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. * * Example: \include LLT_example.cpp * Output: \verbinclude LLT_example.out * * \b Performance: for best performance, it is recommended to use a column-major storage format * with the Lower triangular part (the default), or, equivalently, a row-major storage format * with the Upper triangular part. Otherwise, you might get a 20% slowdown for the full factorization * step, and rank-updates can be up to 3 times slower. * * This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism. * * Note that during the decomposition, only the lower (or upper, as defined by UpLo_) triangular part of A is considered. * Therefore, the strict lower part does not have to store correct values. * * \sa MatrixBase::llt(), SelfAdjointView::llt(), class LDLT */ template class LLT : public SolverBase > { public: typedef MatrixType_ MatrixType; typedef SolverBase Base; friend class SolverBase; EIGEN_GENERIC_PUBLIC_INTERFACE(LLT) enum { MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; 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() */ explicit LLT(Index size) : m_matrix(size, size), m_isInitialized(false) {} template explicit LLT(const EigenBase& matrix) : m_matrix(matrix.rows(), matrix.cols()), m_isInitialized(false) { compute(matrix.derived()); } /** \brief Constructs a LLT factorization from a given matrix * * This overloaded constructor is provided for \link InplaceDecomposition inplace decomposition \endlink when * \c MatrixType is a Eigen::Ref. * * \sa LLT(const EigenBase&) */ template explicit LLT(EigenBase& matrix) : m_matrix(matrix.derived()), m_isInitialized(false) { compute(matrix.derived()); } /** \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); } #ifdef EIGEN_PARSED_BY_DOXYGEN /** \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(), SelfAdjointView::llt() */ template inline const Solve solve(const MatrixBase& b) const; #endif template void solveInPlace(const MatrixBase &bAndX) const; template LLT& compute(const EigenBase& matrix); /** \returns an estimate of the reciprocal condition number of the matrix of * which \c *this is the Cholesky decomposition. */ RealScalar rcond() const { eigen_assert(m_isInitialized && "LLT is not initialized."); eigen_assert(m_info == Success && "LLT failed because matrix appears to be negative"); return internal::rcond_estimate_helper(m_l1_norm, *this); } /** \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 successful, * \c NumericalIssue if the matrix.appears not to be positive definite. */ ComputationInfo info() const { eigen_assert(m_isInitialized && "LLT is not initialized."); return m_info; } /** \returns the adjoint of \c *this, that is, a const reference to the decomposition itself as the underlying matrix is self-adjoint. * * This method is provided for compatibility with other matrix decompositions, thus enabling generic code such as: * \code x = decomposition.adjoint().solve(b) \endcode */ const LLT& adjoint() const EIGEN_NOEXCEPT { return *this; }; inline EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } inline EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } template LLT & rankUpdate(const VectorType& vec, const RealScalar& sigma = 1); #ifndef EIGEN_PARSED_BY_DOXYGEN template void _solve_impl(const RhsType &rhs, DstType &dst) const; template void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const; #endif protected: static void check_template_parameters() { EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); } /** \internal * Used to compute and store L * The strict upper part is not used and even not initialized. */ MatrixType m_matrix; RealScalar m_l1_norm; bool m_isInitialized; ComputationInfo m_info; }; namespace internal { template struct llt_inplace; template static Index llt_rank_update_lower(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) { using std::sqrt; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef typename MatrixType::ColXpr ColXpr; typedef typename internal::remove_all::type ColXprCleaned; typedef typename ColXprCleaned::SegmentReturnType ColXprSegment; typedef Matrix TempVectorType; typedef typename TempVectorType::SegmentReturnType TempVecSegment; Index n = mat.cols(); eigen_assert(mat.rows()==n && vec.size()==n); TempVectorType temp; if(sigma>0) { // This version is based on Givens rotations. // It is faster than the other one below, but only works for updates, // i.e., for sigma > 0 temp = sqrt(sigma) * vec; for(Index i=0; i g; g.makeGivens(mat(i,i), -temp(i), &mat(i,i)); Index rs = n-i-1; if(rs>0) { ColXprSegment x(mat.col(i).tail(rs)); TempVecSegment y(temp.tail(rs)); apply_rotation_in_the_plane(x, y, g); } } } else { temp = vec; RealScalar beta = 1; for(Index j=0; j struct llt_inplace { typedef typename NumTraits::Real RealScalar; template static Index unblocked(MatrixType& mat) { using std::sqrt; 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 = numext::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 /= x; } return -1; } template static Index blocked(MatrixType& m) { 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,typename NumTraits::Literal(-1)); // bottleneck } return -1; } template static Index rankUpdate(MatrixType& mat, const VectorType& vec, const RealScalar& sigma) { return Eigen::internal::llt_rank_update_lower(mat, vec, sigma); } }; template struct llt_inplace { typedef typename NumTraits::Real RealScalar; template static EIGEN_STRONG_INLINE Index unblocked(MatrixType& mat) { Transpose matt(mat); return llt_inplace::unblocked(matt); } template static EIGEN_STRONG_INLINE Index blocked(MatrixType& mat) { Transpose matt(mat); return llt_inplace::blocked(matt); } template static Index rankUpdate(MatrixType& mat, const VectorType& vec, const RealScalar& sigma) { Transpose matt(mat); return llt_inplace::rankUpdate(matt, vec.conjugate(), sigma); } }; template struct LLT_Traits { typedef const TriangularView MatrixL; typedef const TriangularView MatrixU; static inline MatrixL getL(const MatrixType& m) { return MatrixL(m); } static inline MatrixU getU(const MatrixType& m) { return MatrixU(m.adjoint()); } static bool inplace_decomposition(MatrixType& m) { return llt_inplace::blocked(m)==-1; } }; template struct LLT_Traits { typedef const TriangularView MatrixL; typedef const TriangularView MatrixU; static inline MatrixL getL(const MatrixType& m) { return MatrixL(m.adjoint()); } static inline MatrixU getU(const MatrixType& m) { return MatrixU(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 * * Example: \include TutorialLinAlgComputeTwice.cpp * Output: \verbinclude TutorialLinAlgComputeTwice.out */ template template LLT& LLT::compute(const EigenBase& a) { check_template_parameters(); eigen_assert(a.rows()==a.cols()); const Index size = a.rows(); m_matrix.resize(size, size); if (!internal::is_same_dense(m_matrix, a.derived())) m_matrix = a.derived(); // Compute matrix L1 norm = max abs column sum. m_l1_norm = RealScalar(0); // TODO move this code to SelfAdjointView for (Index col = 0; col < size; ++col) { RealScalar abs_col_sum; if (UpLo_ == Lower) abs_col_sum = m_matrix.col(col).tail(size - col).template lpNorm<1>() + m_matrix.row(col).head(col).template lpNorm<1>(); else abs_col_sum = m_matrix.col(col).head(col).template lpNorm<1>() + m_matrix.row(col).tail(size - col).template lpNorm<1>(); if (abs_col_sum > m_l1_norm) m_l1_norm = abs_col_sum; } m_isInitialized = true; bool ok = Traits::inplace_decomposition(m_matrix); m_info = ok ? Success : NumericalIssue; return *this; } /** Performs a rank one update (or dowdate) of the current decomposition. * If A = LL^* before the rank one update, * then after it we have LL^* = A + sigma * v v^* where \a v must be a vector * of same dimension. */ template template LLT & LLT::rankUpdate(const VectorType& v, const RealScalar& sigma) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(VectorType); eigen_assert(v.size()==m_matrix.cols()); eigen_assert(m_isInitialized); if(internal::llt_inplace::rankUpdate(m_matrix,v,sigma)>=0) m_info = NumericalIssue; else m_info = Success; return *this; } #ifndef EIGEN_PARSED_BY_DOXYGEN template template void LLT::_solve_impl(const RhsType &rhs, DstType &dst) const { _solve_impl_transposed(rhs, dst); } template template void LLT::_solve_impl_transposed(const RhsType &rhs, DstType &dst) const { dst = rhs; matrixL().template conjugateIf().solveInPlace(dst); matrixU().template conjugateIf().solveInPlace(dst); } #endif /** \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. * * This version avoids a copy when the right hand side matrix b is not needed anymore. * * \warning The parameter is only marked 'const' to make the C++ compiler accept a temporary expression here. * This function will const_cast it, so constness isn't honored here. * * \sa LLT::solve(), MatrixBase::llt() */ template template void LLT::solveInPlace(const 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 * \sa SelfAdjointView::llt() */ template inline const LLT::PlainObject> MatrixBase::llt() const { return LLT(derived()); } /** \cholesky_module * \returns the LLT decomposition of \c *this * \sa SelfAdjointView::llt() */ template inline const LLT::PlainObject, UpLo> SelfAdjointView::llt() const { return LLT(m_matrix); } } // end namespace Eigen #endif // EIGEN_LLT_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h ================================================ /* Copyright (c) 2011, Intel Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************** * Content : Eigen bindings to LAPACKe * LLt decomposition based on LAPACKE_?potrf function. ******************************************************************************** */ #ifndef EIGEN_LLT_LAPACKE_H #define EIGEN_LLT_LAPACKE_H namespace Eigen { namespace internal { template struct lapacke_llt; #define EIGEN_LAPACKE_LLT(EIGTYPE, BLASTYPE, LAPACKE_PREFIX) \ template<> struct lapacke_llt \ { \ template \ static inline Index potrf(MatrixType& m, char uplo) \ { \ lapack_int matrix_order; \ lapack_int size, lda, info, StorageOrder; \ EIGTYPE* a; \ eigen_assert(m.rows()==m.cols()); \ /* Set up parameters for ?potrf */ \ size = convert_index(m.rows()); \ StorageOrder = MatrixType::Flags&RowMajorBit?RowMajor:ColMajor; \ matrix_order = StorageOrder==RowMajor ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \ a = &(m.coeffRef(0,0)); \ lda = convert_index(m.outerStride()); \ \ info = LAPACKE_##LAPACKE_PREFIX##potrf( matrix_order, uplo, size, (BLASTYPE*)a, lda ); \ info = (info==0) ? -1 : info>0 ? info-1 : size; \ return info; \ } \ }; \ template<> struct llt_inplace \ { \ template \ static Index blocked(MatrixType& m) \ { \ return lapacke_llt::potrf(m, 'L'); \ } \ template \ static Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \ { return Eigen::internal::llt_rank_update_lower(mat, vec, sigma); } \ }; \ template<> struct llt_inplace \ { \ template \ static Index blocked(MatrixType& m) \ { \ return lapacke_llt::potrf(m, 'U'); \ } \ template \ static Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \ { \ Transpose matt(mat); \ return llt_inplace::rankUpdate(matt, vec.conjugate(), sigma); \ } \ }; EIGEN_LAPACKE_LLT(double, double, d) EIGEN_LAPACKE_LLT(float, float, s) EIGEN_LAPACKE_LLT(dcomplex, lapack_complex_double, z) EIGEN_LAPACKE_LLT(scomplex, lapack_complex_float, c) } // end namespace internal } // end namespace Eigen #endif // EIGEN_LLT_LAPACKE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/CholmodSupport/CholmodSupport.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2010 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_CHOLMODSUPPORT_H #define EIGEN_CHOLMODSUPPORT_H namespace Eigen { namespace internal { template struct cholmod_configure_matrix; template<> struct cholmod_configure_matrix { template static void run(CholmodType& mat) { mat.xtype = CHOLMOD_REAL; mat.dtype = CHOLMOD_DOUBLE; } }; template<> struct cholmod_configure_matrix > { template static void run(CholmodType& mat) { mat.xtype = CHOLMOD_COMPLEX; mat.dtype = CHOLMOD_DOUBLE; } }; // Other scalar types are not yet supported by Cholmod // template<> struct cholmod_configure_matrix { // template // static void run(CholmodType& mat) { // mat.xtype = CHOLMOD_REAL; // mat.dtype = CHOLMOD_SINGLE; // } // }; // // template<> struct cholmod_configure_matrix > { // template // static void run(CholmodType& mat) { // mat.xtype = CHOLMOD_COMPLEX; // mat.dtype = CHOLMOD_SINGLE; // } // }; } // namespace internal /** Wraps the Eigen sparse matrix \a mat into a Cholmod sparse matrix object. * Note that the data are shared. */ template cholmod_sparse viewAsCholmod(Ref > mat) { cholmod_sparse res; res.nzmax = mat.nonZeros(); res.nrow = mat.rows(); res.ncol = mat.cols(); res.p = mat.outerIndexPtr(); res.i = mat.innerIndexPtr(); res.x = mat.valuePtr(); res.z = 0; res.sorted = 1; if(mat.isCompressed()) { res.packed = 1; res.nz = 0; } else { res.packed = 0; res.nz = mat.innerNonZeroPtr(); } res.dtype = 0; res.stype = -1; if (internal::is_same::value) { res.itype = CHOLMOD_INT; } else if (internal::is_same::value) { res.itype = CHOLMOD_LONG; } else { eigen_assert(false && "Index type not supported yet"); } // setup res.xtype internal::cholmod_configure_matrix::run(res); res.stype = 0; return res; } template const cholmod_sparse viewAsCholmod(const SparseMatrix& mat) { cholmod_sparse res = viewAsCholmod(Ref >(mat.const_cast_derived())); return res; } template const cholmod_sparse viewAsCholmod(const SparseVector& mat) { cholmod_sparse res = viewAsCholmod(Ref >(mat.const_cast_derived())); return res; } /** Returns a view of the Eigen sparse matrix \a mat as Cholmod sparse matrix. * The data are not copied but shared. */ template cholmod_sparse viewAsCholmod(const SparseSelfAdjointView, UpLo>& mat) { cholmod_sparse res = viewAsCholmod(Ref >(mat.matrix().const_cast_derived())); if(UpLo==Upper) res.stype = 1; if(UpLo==Lower) res.stype = -1; // swap stype for rowmajor matrices (only works for real matrices) EIGEN_STATIC_ASSERT((Options_ & RowMajorBit) == 0 || NumTraits::IsComplex == 0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); if(Options_ & RowMajorBit) res.stype *=-1; return res; } /** Returns a view of the Eigen \b dense matrix \a mat as Cholmod dense matrix. * The data are not copied but shared. */ template cholmod_dense viewAsCholmod(MatrixBase& mat) { EIGEN_STATIC_ASSERT((internal::traits::Flags&RowMajorBit)==0,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); typedef typename Derived::Scalar Scalar; cholmod_dense res; res.nrow = mat.rows(); res.ncol = mat.cols(); res.nzmax = res.nrow * res.ncol; res.d = Derived::IsVectorAtCompileTime ? mat.derived().size() : mat.derived().outerStride(); res.x = (void*)(mat.derived().data()); res.z = 0; internal::cholmod_configure_matrix::run(res); return res; } /** Returns a view of the Cholmod sparse matrix \a cm as an Eigen sparse matrix. * The data are not copied but shared. */ template MappedSparseMatrix viewAsEigen(cholmod_sparse& cm) { return MappedSparseMatrix (cm.nrow, cm.ncol, static_cast(cm.p)[cm.ncol], static_cast(cm.p), static_cast(cm.i),static_cast(cm.x) ); } namespace internal { // template specializations for int and long that call the correct cholmod method #define EIGEN_CHOLMOD_SPECIALIZE0(ret, name) \ template inline ret cm_ ## name (cholmod_common &Common) { return cholmod_ ## name (&Common); } \ template<> inline ret cm_ ## name (cholmod_common &Common) { return cholmod_l_ ## name (&Common); } #define EIGEN_CHOLMOD_SPECIALIZE1(ret, name, t1, a1) \ template inline ret cm_ ## name (t1& a1, cholmod_common &Common) { return cholmod_ ## name (&a1, &Common); } \ template<> inline ret cm_ ## name (t1& a1, cholmod_common &Common) { return cholmod_l_ ## name (&a1, &Common); } EIGEN_CHOLMOD_SPECIALIZE0(int, start) EIGEN_CHOLMOD_SPECIALIZE0(int, finish) EIGEN_CHOLMOD_SPECIALIZE1(int, free_factor, cholmod_factor*, L) EIGEN_CHOLMOD_SPECIALIZE1(int, free_dense, cholmod_dense*, X) EIGEN_CHOLMOD_SPECIALIZE1(int, free_sparse, cholmod_sparse*, A) EIGEN_CHOLMOD_SPECIALIZE1(cholmod_factor*, analyze, cholmod_sparse, A) template inline cholmod_dense* cm_solve (int sys, cholmod_factor& L, cholmod_dense& B, cholmod_common &Common) { return cholmod_solve (sys, &L, &B, &Common); } template<> inline cholmod_dense* cm_solve (int sys, cholmod_factor& L, cholmod_dense& B, cholmod_common &Common) { return cholmod_l_solve (sys, &L, &B, &Common); } template inline cholmod_sparse* cm_spsolve (int sys, cholmod_factor& L, cholmod_sparse& B, cholmod_common &Common) { return cholmod_spsolve (sys, &L, &B, &Common); } template<> inline cholmod_sparse* cm_spsolve (int sys, cholmod_factor& L, cholmod_sparse& B, cholmod_common &Common) { return cholmod_l_spsolve (sys, &L, &B, &Common); } template inline int cm_factorize_p (cholmod_sparse* A, double beta[2], StorageIndex_* fset, std::size_t fsize, cholmod_factor* L, cholmod_common &Common) { return cholmod_factorize_p (A, beta, fset, fsize, L, &Common); } template<> inline int cm_factorize_p (cholmod_sparse* A, double beta[2], SuiteSparse_long* fset, std::size_t fsize, cholmod_factor* L, cholmod_common &Common) { return cholmod_l_factorize_p (A, beta, fset, fsize, L, &Common); } #undef EIGEN_CHOLMOD_SPECIALIZE0 #undef EIGEN_CHOLMOD_SPECIALIZE1 } // namespace internal enum CholmodMode { CholmodAuto, CholmodSimplicialLLt, CholmodSupernodalLLt, CholmodLDLt }; /** \ingroup CholmodSupport_Module * \class CholmodBase * \brief The base class for the direct Cholesky factorization of Cholmod * \sa class CholmodSupernodalLLT, class CholmodSimplicialLDLT, class CholmodSimplicialLLT */ template class CholmodBase : public SparseSolverBase { protected: typedef SparseSolverBase Base; using Base::derived; using Base::m_isInitialized; public: typedef MatrixType_ MatrixType; enum { UpLo = UpLo_ }; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef MatrixType CholMatrixType; typedef typename MatrixType::StorageIndex StorageIndex; enum { ColsAtCompileTime = MatrixType::ColsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; public: CholmodBase() : m_cholmodFactor(0), m_info(Success), m_factorizationIsOk(false), m_analysisIsOk(false) { EIGEN_STATIC_ASSERT((internal::is_same::value), CHOLMOD_SUPPORTS_DOUBLE_PRECISION_ONLY); m_shiftOffset[0] = m_shiftOffset[1] = 0.0; internal::cm_start(m_cholmod); } explicit CholmodBase(const MatrixType& matrix) : m_cholmodFactor(0), m_info(Success), m_factorizationIsOk(false), m_analysisIsOk(false) { EIGEN_STATIC_ASSERT((internal::is_same::value), CHOLMOD_SUPPORTS_DOUBLE_PRECISION_ONLY); m_shiftOffset[0] = m_shiftOffset[1] = 0.0; internal::cm_start(m_cholmod); compute(matrix); } ~CholmodBase() { if(m_cholmodFactor) internal::cm_free_factor(m_cholmodFactor, m_cholmod); internal::cm_finish(m_cholmod); } inline StorageIndex cols() const { return internal::convert_index(m_cholmodFactor->n); } inline StorageIndex rows() const { return internal::convert_index(m_cholmodFactor->n); } /** \brief Reports whether previous computation was successful. * * \returns \c Success if computation was successful, * \c NumericalIssue if the matrix.appears to be negative. */ ComputationInfo info() const { eigen_assert(m_isInitialized && "Decomposition is not initialized."); return m_info; } /** Computes the sparse Cholesky decomposition of \a matrix */ Derived& compute(const MatrixType& matrix) { analyzePattern(matrix); factorize(matrix); return derived(); } /** Performs a symbolic decomposition on the sparsity pattern of \a matrix. * * This function is particularly useful when solving for several problems having the same structure. * * \sa factorize() */ void analyzePattern(const MatrixType& matrix) { if(m_cholmodFactor) { internal::cm_free_factor(m_cholmodFactor, m_cholmod); m_cholmodFactor = 0; } cholmod_sparse A = viewAsCholmod(matrix.template selfadjointView()); m_cholmodFactor = internal::cm_analyze(A, m_cholmod); this->m_isInitialized = true; this->m_info = Success; m_analysisIsOk = true; m_factorizationIsOk = false; } /** Performs a numeric decomposition of \a matrix * * The given matrix must have the same sparsity pattern as the matrix on which the symbolic decomposition has been performed. * * \sa analyzePattern() */ void factorize(const MatrixType& matrix) { eigen_assert(m_analysisIsOk && "You must first call analyzePattern()"); cholmod_sparse A = viewAsCholmod(matrix.template selfadjointView()); internal::cm_factorize_p(&A, m_shiftOffset, 0, 0, m_cholmodFactor, m_cholmod); // If the factorization failed, minor is the column at which it did. On success minor == n. this->m_info = (m_cholmodFactor->minor == m_cholmodFactor->n ? Success : NumericalIssue); m_factorizationIsOk = true; } /** Returns a reference to the Cholmod's configuration structure to get a full control over the performed operations. * See the Cholmod user guide for details. */ cholmod_common& cholmod() { return m_cholmod; } #ifndef EIGEN_PARSED_BY_DOXYGEN /** \internal */ template void _solve_impl(const MatrixBase &b, MatrixBase &dest) const { eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()"); const Index size = m_cholmodFactor->n; EIGEN_UNUSED_VARIABLE(size); eigen_assert(size==b.rows()); // Cholmod needs column-major storage without inner-stride, which corresponds to the default behavior of Ref. Ref > b_ref(b.derived()); cholmod_dense b_cd = viewAsCholmod(b_ref); cholmod_dense* x_cd = internal::cm_solve(CHOLMOD_A, *m_cholmodFactor, b_cd, m_cholmod); if(!x_cd) { this->m_info = NumericalIssue; return; } // TODO optimize this copy by swapping when possible (be careful with alignment, etc.) // NOTE Actually, the copy can be avoided by calling cholmod_solve2 instead of cholmod_solve dest = Matrix::Map(reinterpret_cast(x_cd->x),b.rows(),b.cols()); internal::cm_free_dense(x_cd, m_cholmod); } /** \internal */ template void _solve_impl(const SparseMatrixBase &b, SparseMatrixBase &dest) const { eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()"); const Index size = m_cholmodFactor->n; EIGEN_UNUSED_VARIABLE(size); eigen_assert(size==b.rows()); // note: cs stands for Cholmod Sparse Ref > b_ref(b.const_cast_derived()); cholmod_sparse b_cs = viewAsCholmod(b_ref); cholmod_sparse* x_cs = internal::cm_spsolve(CHOLMOD_A, *m_cholmodFactor, b_cs, m_cholmod); if(!x_cs) { this->m_info = NumericalIssue; return; } // TODO optimize this copy by swapping when possible (be careful with alignment, etc.) // NOTE cholmod_spsolve in fact just calls the dense solver for blocks of 4 columns at a time (similar to Eigen's sparse solver) dest.derived() = viewAsEigen(*x_cs); internal::cm_free_sparse(x_cs, m_cholmod); } #endif // EIGEN_PARSED_BY_DOXYGEN /** Sets the shift parameter that will be used to adjust the diagonal coefficients during the numerical factorization. * * During the numerical factorization, an offset term is added to the diagonal coefficients:\n * \c d_ii = \a offset + \c d_ii * * The default is \a offset=0. * * \returns a reference to \c *this. */ Derived& setShift(const RealScalar& offset) { m_shiftOffset[0] = double(offset); return derived(); } /** \returns the determinant of the underlying matrix from the current factorization */ Scalar determinant() const { using std::exp; return exp(logDeterminant()); } /** \returns the log determinant of the underlying matrix from the current factorization */ Scalar logDeterminant() const { using std::log; using numext::real; eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()"); RealScalar logDet = 0; Scalar *x = static_cast(m_cholmodFactor->x); if (m_cholmodFactor->is_super) { // Supernodal factorization stored as a packed list of dense column-major blocs, // as described by the following structure: // super[k] == index of the first column of the j-th super node StorageIndex *super = static_cast(m_cholmodFactor->super); // pi[k] == offset to the description of row indices StorageIndex *pi = static_cast(m_cholmodFactor->pi); // px[k] == offset to the respective dense block StorageIndex *px = static_cast(m_cholmodFactor->px); Index nb_super_nodes = m_cholmodFactor->nsuper; for (Index k=0; k < nb_super_nodes; ++k) { StorageIndex ncols = super[k + 1] - super[k]; StorageIndex nrows = pi[k + 1] - pi[k]; Map, 0, InnerStride<> > sk(x + px[k], ncols, InnerStride<>(nrows+1)); logDet += sk.real().log().sum(); } } else { // Simplicial factorization stored as standard CSC matrix. StorageIndex *p = static_cast(m_cholmodFactor->p); Index size = m_cholmodFactor->n; for (Index k=0; kis_ll) logDet *= 2.0; return logDet; }; template void dumpMemory(Stream& /*s*/) {} protected: mutable cholmod_common m_cholmod; cholmod_factor* m_cholmodFactor; double m_shiftOffset[2]; mutable ComputationInfo m_info; int m_factorizationIsOk; int m_analysisIsOk; }; /** \ingroup CholmodSupport_Module * \class CholmodSimplicialLLT * \brief A simplicial direct Cholesky (LLT) factorization and solver based on Cholmod * * This class allows to solve for A.X = B sparse linear problems via a simplicial LL^T Cholesky factorization * using the Cholmod library. * This simplicial variant is equivalent to Eigen's built-in SimplicialLLT class. Therefore, it has little practical interest. * The sparse matrix A must be selfadjoint and positive definite. The vectors or matrices * X and B can be either dense or sparse. * * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> * \tparam UpLo_ the triangular part that will be used for the computations. It can be Lower * or Upper. Default is Lower. * * \implsparsesolverconcept * * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. * * \warning Only double precision real and complex scalar types are supported by Cholmod. * * \sa \ref TutorialSparseSolverConcept, class CholmodSupernodalLLT, class SimplicialLLT */ template class CholmodSimplicialLLT : public CholmodBase > { typedef CholmodBase Base; using Base::m_cholmod; public: typedef MatrixType_ MatrixType; CholmodSimplicialLLT() : Base() { init(); } CholmodSimplicialLLT(const MatrixType& matrix) : Base() { init(); this->compute(matrix); } ~CholmodSimplicialLLT() {} protected: void init() { m_cholmod.final_asis = 0; m_cholmod.supernodal = CHOLMOD_SIMPLICIAL; m_cholmod.final_ll = 1; } }; /** \ingroup CholmodSupport_Module * \class CholmodSimplicialLDLT * \brief A simplicial direct Cholesky (LDLT) factorization and solver based on Cholmod * * This class allows to solve for A.X = B sparse linear problems via a simplicial LDL^T Cholesky factorization * using the Cholmod library. * This simplicial variant is equivalent to Eigen's built-in SimplicialLDLT class. Therefore, it has little practical interest. * The sparse matrix A must be selfadjoint and positive definite. The vectors or matrices * X and B can be either dense or sparse. * * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> * \tparam UpLo_ the triangular part that will be used for the computations. It can be Lower * or Upper. Default is Lower. * * \implsparsesolverconcept * * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. * * \warning Only double precision real and complex scalar types are supported by Cholmod. * * \sa \ref TutorialSparseSolverConcept, class CholmodSupernodalLLT, class SimplicialLDLT */ template class CholmodSimplicialLDLT : public CholmodBase > { typedef CholmodBase Base; using Base::m_cholmod; public: typedef MatrixType_ MatrixType; CholmodSimplicialLDLT() : Base() { init(); } CholmodSimplicialLDLT(const MatrixType& matrix) : Base() { init(); this->compute(matrix); } ~CholmodSimplicialLDLT() {} protected: void init() { m_cholmod.final_asis = 1; m_cholmod.supernodal = CHOLMOD_SIMPLICIAL; } }; /** \ingroup CholmodSupport_Module * \class CholmodSupernodalLLT * \brief A supernodal Cholesky (LLT) factorization and solver based on Cholmod * * This class allows to solve for A.X = B sparse linear problems via a supernodal LL^T Cholesky factorization * using the Cholmod library. * This supernodal variant performs best on dense enough problems, e.g., 3D FEM, or very high order 2D FEM. * The sparse matrix A must be selfadjoint and positive definite. The vectors or matrices * X and B can be either dense or sparse. * * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> * \tparam UpLo_ the triangular part that will be used for the computations. It can be Lower * or Upper. Default is Lower. * * \implsparsesolverconcept * * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. * * \warning Only double precision real and complex scalar types are supported by Cholmod. * * \sa \ref TutorialSparseSolverConcept */ template class CholmodSupernodalLLT : public CholmodBase > { typedef CholmodBase Base; using Base::m_cholmod; public: typedef MatrixType_ MatrixType; CholmodSupernodalLLT() : Base() { init(); } CholmodSupernodalLLT(const MatrixType& matrix) : Base() { init(); this->compute(matrix); } ~CholmodSupernodalLLT() {} protected: void init() { m_cholmod.final_asis = 1; m_cholmod.supernodal = CHOLMOD_SUPERNODAL; } }; /** \ingroup CholmodSupport_Module * \class CholmodDecomposition * \brief A general Cholesky factorization and solver based on Cholmod * * This class allows to solve for A.X = B sparse linear problems via a LL^T or LDL^T Cholesky factorization * using the Cholmod library. The sparse matrix A must be selfadjoint and positive definite. The vectors or matrices * X and B can be either dense or sparse. * * This variant permits to change the underlying Cholesky method at runtime. * On the other hand, it does not provide access to the result of the factorization. * The default is to let Cholmod automatically choose between a simplicial and supernodal factorization. * * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> * \tparam UpLo_ the triangular part that will be used for the computations. It can be Lower * or Upper. Default is Lower. * * \implsparsesolverconcept * * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. * * \warning Only double precision real and complex scalar types are supported by Cholmod. * * \sa \ref TutorialSparseSolverConcept */ template class CholmodDecomposition : public CholmodBase > { typedef CholmodBase Base; using Base::m_cholmod; public: typedef MatrixType_ MatrixType; CholmodDecomposition() : Base() { init(); } CholmodDecomposition(const MatrixType& matrix) : Base() { init(); this->compute(matrix); } ~CholmodDecomposition() {} void setMode(CholmodMode mode) { switch(mode) { case CholmodAuto: m_cholmod.final_asis = 1; m_cholmod.supernodal = CHOLMOD_AUTO; break; case CholmodSimplicialLLt: m_cholmod.final_asis = 0; m_cholmod.supernodal = CHOLMOD_SIMPLICIAL; m_cholmod.final_ll = 1; break; case CholmodSupernodalLLt: m_cholmod.final_asis = 1; m_cholmod.supernodal = CHOLMOD_SUPERNODAL; break; case CholmodLDLt: m_cholmod.final_asis = 1; m_cholmod.supernodal = CHOLMOD_SIMPLICIAL; break; default: break; } } protected: void init() { m_cholmod.final_asis = 1; m_cholmod.supernodal = CHOLMOD_AUTO; } }; } // end namespace Eigen #endif // EIGEN_CHOLMODSUPPORT_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Claire Maurice // Copyright (C) 2009 Gael Guennebaud // Copyright (C) 2010,2012 Jitse Niesen // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_COMPLEX_EIGEN_SOLVER_H #define EIGEN_COMPLEX_EIGEN_SOLVER_H #include "./ComplexSchur.h" namespace Eigen { /** \eigenvalues_module \ingroup Eigenvalues_Module * * * \class ComplexEigenSolver * * \brief Computes eigenvalues and eigenvectors of general complex matrices * * \tparam MatrixType_ the type of the matrix of which we are * computing the eigendecomposition; this is expected to be an * instantiation of the Matrix class template. * * The eigenvalues and eigenvectors of a matrix \f$ A \f$ are scalars * \f$ \lambda \f$ and vectors \f$ v \f$ such that \f$ Av = \lambda v * \f$. If \f$ D \f$ is a diagonal matrix with the eigenvalues on * the diagonal, and \f$ V \f$ is a matrix with the eigenvectors as * its columns, then \f$ A V = V D \f$. The matrix \f$ V \f$ is * almost always invertible, in which case we have \f$ A = V D V^{-1} * \f$. This is called the eigendecomposition. * * The main function in this class is compute(), which computes the * eigenvalues and eigenvectors of a given function. The * documentation for that function contains an example showing the * main features of the class. * * \sa class EigenSolver, class SelfAdjointEigenSolver */ template class ComplexEigenSolver { public: /** \brief Synonym for the template parameter \p MatrixType_. */ typedef MatrixType_ MatrixType; enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, Options = MatrixType::Options, MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; /** \brief Scalar type for matrices of type #MatrixType. */ typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3 /** \brief Complex scalar type for #MatrixType. * * This is \c std::complex if #Scalar is real (e.g., * \c float or \c double) and just \c Scalar if #Scalar is * complex. */ typedef std::complex ComplexScalar; /** \brief Type for vector of eigenvalues as returned by eigenvalues(). * * This is a column vector with entries of type #ComplexScalar. * The length of the vector is the size of #MatrixType. */ typedef Matrix EigenvalueType; /** \brief Type for matrix of eigenvectors as returned by eigenvectors(). * * This is a square matrix with entries of type #ComplexScalar. * The size is the same as the size of #MatrixType. */ typedef Matrix EigenvectorType; /** \brief Default constructor. * * The default constructor is useful in cases in which the user intends to * perform decompositions via compute(). */ ComplexEigenSolver() : m_eivec(), m_eivalues(), m_schur(), m_isInitialized(false), m_eigenvectorsOk(false), m_matX() {} /** \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 ComplexEigenSolver() */ explicit ComplexEigenSolver(Index size) : m_eivec(size, size), m_eivalues(size), m_schur(size), m_isInitialized(false), m_eigenvectorsOk(false), m_matX(size, size) {} /** \brief Constructor; computes eigendecomposition of given matrix. * * \param[in] matrix Square matrix whose eigendecomposition is to be computed. * \param[in] computeEigenvectors If true, both the eigenvectors and the * eigenvalues are computed; if false, only the eigenvalues are * computed. * * This constructor calls compute() to compute the eigendecomposition. */ template explicit ComplexEigenSolver(const EigenBase& matrix, bool computeEigenvectors = true) : m_eivec(matrix.rows(),matrix.cols()), m_eivalues(matrix.cols()), m_schur(matrix.rows()), m_isInitialized(false), m_eigenvectorsOk(false), m_matX(matrix.rows(),matrix.cols()) { compute(matrix.derived(), computeEigenvectors); } /** \brief Returns the eigenvectors of given matrix. * * \returns A const reference to the matrix whose columns are the eigenvectors. * * \pre Either the constructor * ComplexEigenSolver(const MatrixType& matrix, bool) or the member * function compute(const MatrixType& matrix, bool) has been called before * to compute the eigendecomposition of a matrix, and * \p computeEigenvectors was set to true (the default). * * This function returns a matrix whose columns are the eigenvectors. Column * \f$ k \f$ is an eigenvector corresponding to eigenvalue number \f$ k * \f$ as returned by eigenvalues(). The eigenvectors are normalized to * have (Euclidean) norm equal to one. The matrix returned by this * function is the matrix \f$ V \f$ in the eigendecomposition \f$ A = V D * V^{-1} \f$, if it exists. * * Example: \include ComplexEigenSolver_eigenvectors.cpp * Output: \verbinclude ComplexEigenSolver_eigenvectors.out */ const EigenvectorType& eigenvectors() const { eigen_assert(m_isInitialized && "ComplexEigenSolver is not initialized."); eigen_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues."); return m_eivec; } /** \brief Returns the eigenvalues of given matrix. * * \returns A const reference to the column vector containing the eigenvalues. * * \pre Either the constructor * ComplexEigenSolver(const MatrixType& matrix, bool) or the member * function compute(const MatrixType& matrix, bool) has been called before * to compute the eigendecomposition of a matrix. * * This function returns a column vector containing the * eigenvalues. Eigenvalues are repeated according to their * algebraic multiplicity, so there are as many eigenvalues as * rows in the matrix. The eigenvalues are not sorted in any particular * order. * * Example: \include ComplexEigenSolver_eigenvalues.cpp * Output: \verbinclude ComplexEigenSolver_eigenvalues.out */ const EigenvalueType& eigenvalues() const { eigen_assert(m_isInitialized && "ComplexEigenSolver is not initialized."); return m_eivalues; } /** \brief Computes eigendecomposition of given matrix. * * \param[in] matrix Square matrix whose eigendecomposition is to be computed. * \param[in] computeEigenvectors If true, both the eigenvectors and the * eigenvalues are computed; if false, only the eigenvalues are * computed. * \returns Reference to \c *this * * This function computes the eigenvalues of the complex matrix \p matrix. * The eigenvalues() function can be used to retrieve them. If * \p computeEigenvectors is true, then the eigenvectors are also computed * and can be retrieved by calling eigenvectors(). * * The matrix is first reduced to Schur form using the * ComplexSchur class. The Schur decomposition is then used to * compute the eigenvalues and eigenvectors. * * The cost of the computation is dominated by the cost of the * Schur decomposition, which is \f$ O(n^3) \f$ where \f$ n \f$ * is the size of the matrix. * * Example: \include ComplexEigenSolver_compute.cpp * Output: \verbinclude ComplexEigenSolver_compute.out */ template ComplexEigenSolver& compute(const EigenBase& matrix, bool computeEigenvectors = true); /** \brief Reports whether previous computation was successful. * * \returns \c Success if computation was successful, \c NoConvergence otherwise. */ ComputationInfo info() const { eigen_assert(m_isInitialized && "ComplexEigenSolver is not initialized."); return m_schur.info(); } /** \brief Sets the maximum number of iterations allowed. */ ComplexEigenSolver& setMaxIterations(Index maxIters) { m_schur.setMaxIterations(maxIters); return *this; } /** \brief Returns the maximum number of iterations. */ Index getMaxIterations() { return m_schur.getMaxIterations(); } protected: static void check_template_parameters() { EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); } EigenvectorType m_eivec; EigenvalueType m_eivalues; ComplexSchur m_schur; bool m_isInitialized; bool m_eigenvectorsOk; EigenvectorType m_matX; private: void doComputeEigenvectors(RealScalar matrixnorm); void sortEigenvalues(bool computeEigenvectors); }; template template ComplexEigenSolver& ComplexEigenSolver::compute(const EigenBase& matrix, bool computeEigenvectors) { check_template_parameters(); // this code is inspired from Jampack eigen_assert(matrix.cols() == matrix.rows()); // Do a complex Schur decomposition, A = U T U^* // The eigenvalues are on the diagonal of T. m_schur.compute(matrix.derived(), computeEigenvectors); if(m_schur.info() == Success) { m_eivalues = m_schur.matrixT().diagonal(); if(computeEigenvectors) doComputeEigenvectors(m_schur.matrixT().norm()); sortEigenvalues(computeEigenvectors); } m_isInitialized = true; m_eigenvectorsOk = computeEigenvectors; return *this; } template void ComplexEigenSolver::doComputeEigenvectors(RealScalar matrixnorm) { const Index n = m_eivalues.size(); matrixnorm = numext::maxi(matrixnorm,(std::numeric_limits::min)()); // Compute X such that T = X D X^(-1), where D is the diagonal of T. // The matrix X is unit triangular. m_matX = EigenvectorType::Zero(n, n); for(Index k=n-1 ; k>=0 ; k--) { m_matX.coeffRef(k,k) = ComplexScalar(1.0,0.0); // Compute X(i,k) using the (i,k) entry of the equation X T = D X for(Index i=k-1 ; i>=0 ; i--) { m_matX.coeffRef(i,k) = -m_schur.matrixT().coeff(i,k); if(k-i-1>0) m_matX.coeffRef(i,k) -= (m_schur.matrixT().row(i).segment(i+1,k-i-1) * m_matX.col(k).segment(i+1,k-i-1)).value(); ComplexScalar z = m_schur.matrixT().coeff(i,i) - m_schur.matrixT().coeff(k,k); if(z==ComplexScalar(0)) { // If the i-th and k-th eigenvalue are equal, then z equals 0. // Use a small value instead, to prevent division by zero. numext::real_ref(z) = NumTraits::epsilon() * matrixnorm; } m_matX.coeffRef(i,k) = m_matX.coeff(i,k) / z; } } // Compute V as V = U X; now A = U T U^* = U X D X^(-1) U^* = V D V^(-1) m_eivec.noalias() = m_schur.matrixU() * m_matX; // .. and normalize the eigenvectors for(Index k=0 ; k void ComplexEigenSolver::sortEigenvalues(bool computeEigenvectors) { const Index n = m_eivalues.size(); for (Index i=0; i // Copyright (C) 2010,2012 Jitse Niesen // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_COMPLEX_SCHUR_H #define EIGEN_COMPLEX_SCHUR_H #include "./HessenbergDecomposition.h" namespace Eigen { namespace internal { template struct complex_schur_reduce_to_hessenberg; } /** \eigenvalues_module \ingroup Eigenvalues_Module * * * \class ComplexSchur * * \brief Performs a complex Schur decomposition of a real or complex square matrix * * \tparam MatrixType_ the type of the matrix of which we are * computing the Schur decomposition; this is expected to be an * instantiation of the Matrix class template. * * Given a real or complex square matrix A, this class computes the * Schur decomposition: \f$ A = U T U^*\f$ where U is a unitary * complex matrix, and T is a complex upper triangular matrix. The * diagonal of the matrix T corresponds to the eigenvalues of the * matrix A. * * Call the function compute() to compute the Schur decomposition of * a given matrix. Alternatively, you can use the * ComplexSchur(const MatrixType&, bool) constructor which computes * the Schur decomposition at construction time. Once the * decomposition is computed, you can use the matrixU() and matrixT() * functions to retrieve the matrices U and V in the decomposition. * * \note This code is inspired from Jampack * * \sa class RealSchur, class EigenSolver, class ComplexEigenSolver */ template class ComplexSchur { public: typedef MatrixType_ MatrixType; enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, Options = MatrixType::Options, MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; /** \brief Scalar type for matrices of type \p MatrixType_. */ typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3 /** \brief Complex scalar type for \p MatrixType_. * * This is \c std::complex if #Scalar is real (e.g., * \c float or \c double) and just \c Scalar if #Scalar is * complex. */ typedef std::complex ComplexScalar; /** \brief Type for the matrices in the Schur decomposition. * * This is a square matrix with entries of type #ComplexScalar. * The size is the same as the size of \p MatrixType_. */ typedef Matrix ComplexMatrixType; /** \brief Default constructor. * * \param [in] size Positive integer, size of the matrix whose Schur decomposition will be computed. * * The default constructor is useful in cases in which the user * intends to perform decompositions via compute(). The \p size * parameter is only used as a hint. It is not an error to give a * wrong \p size, but it may impair performance. * * \sa compute() for an example. */ explicit ComplexSchur(Index size = RowsAtCompileTime==Dynamic ? 1 : RowsAtCompileTime) : m_matT(size,size), m_matU(size,size), m_hess(size), m_isInitialized(false), m_matUisUptodate(false), m_maxIters(-1) {} /** \brief Constructor; computes Schur decomposition of given matrix. * * \param[in] matrix Square matrix whose Schur decomposition is to be computed. * \param[in] computeU If true, both T and U are computed; if false, only T is computed. * * This constructor calls compute() to compute the Schur decomposition. * * \sa matrixT() and matrixU() for examples. */ template explicit ComplexSchur(const EigenBase& matrix, bool computeU = true) : m_matT(matrix.rows(),matrix.cols()), m_matU(matrix.rows(),matrix.cols()), m_hess(matrix.rows()), m_isInitialized(false), m_matUisUptodate(false), m_maxIters(-1) { compute(matrix.derived(), computeU); } /** \brief Returns the unitary matrix in the Schur decomposition. * * \returns A const reference to the matrix U. * * It is assumed that either the constructor * ComplexSchur(const MatrixType& matrix, bool computeU) or the * member function compute(const MatrixType& matrix, bool computeU) * has been called before to compute the Schur decomposition of a * matrix, and that \p computeU was set to true (the default * value). * * Example: \include ComplexSchur_matrixU.cpp * Output: \verbinclude ComplexSchur_matrixU.out */ const ComplexMatrixType& matrixU() const { eigen_assert(m_isInitialized && "ComplexSchur is not initialized."); eigen_assert(m_matUisUptodate && "The matrix U has not been computed during the ComplexSchur decomposition."); return m_matU; } /** \brief Returns the triangular matrix in the Schur decomposition. * * \returns A const reference to the matrix T. * * It is assumed that either the constructor * ComplexSchur(const MatrixType& matrix, bool computeU) or the * member function compute(const MatrixType& matrix, bool computeU) * has been called before to compute the Schur decomposition of a * matrix. * * Note that this function returns a plain square matrix. If you want to reference * only the upper triangular part, use: * \code schur.matrixT().triangularView() \endcode * * Example: \include ComplexSchur_matrixT.cpp * Output: \verbinclude ComplexSchur_matrixT.out */ const ComplexMatrixType& matrixT() const { eigen_assert(m_isInitialized && "ComplexSchur is not initialized."); return m_matT; } /** \brief Computes Schur decomposition of given matrix. * * \param[in] matrix Square matrix whose Schur decomposition is to be computed. * \param[in] computeU If true, both T and U are computed; if false, only T is computed. * \returns Reference to \c *this * * The Schur decomposition is computed by first reducing the * matrix to Hessenberg form using the class * HessenbergDecomposition. The Hessenberg matrix is then reduced * to triangular form by performing QR iterations with a single * shift. The cost of computing the Schur decomposition depends * on the number of iterations; as a rough guide, it may be taken * on the number of iterations; as a rough guide, it may be taken * to be \f$25n^3\f$ complex flops, or \f$10n^3\f$ complex flops * if \a computeU is false. * * Example: \include ComplexSchur_compute.cpp * Output: \verbinclude ComplexSchur_compute.out * * \sa compute(const MatrixType&, bool, Index) */ template ComplexSchur& compute(const EigenBase& matrix, bool computeU = true); /** \brief Compute Schur decomposition from a given Hessenberg matrix * \param[in] matrixH Matrix in Hessenberg form H * \param[in] matrixQ orthogonal matrix Q that transform a matrix A to H : A = Q H Q^T * \param computeU Computes the matriX U of the Schur vectors * \return Reference to \c *this * * This routine assumes that the matrix is already reduced in Hessenberg form matrixH * using either the class HessenbergDecomposition or another mean. * It computes the upper quasi-triangular matrix T of the Schur decomposition of H * When computeU is true, this routine computes the matrix U such that * A = U T U^T = (QZ) T (QZ)^T = Q H Q^T where A is the initial matrix * * NOTE Q is referenced if computeU is true; so, if the initial orthogonal matrix * is not available, the user should give an identity matrix (Q.setIdentity()) * * \sa compute(const MatrixType&, bool) */ template ComplexSchur& computeFromHessenberg(const HessMatrixType& matrixH, const OrthMatrixType& matrixQ, bool computeU=true); /** \brief Reports whether previous computation was successful. * * \returns \c Success if computation was successful, \c NoConvergence otherwise. */ ComputationInfo info() const { eigen_assert(m_isInitialized && "ComplexSchur is not initialized."); return m_info; } /** \brief Sets the maximum number of iterations allowed. * * If not specified by the user, the maximum number of iterations is m_maxIterationsPerRow times the size * of the matrix. */ ComplexSchur& setMaxIterations(Index maxIters) { m_maxIters = maxIters; return *this; } /** \brief Returns the maximum number of iterations. */ Index getMaxIterations() { return m_maxIters; } /** \brief Maximum number of iterations per row. * * If not otherwise specified, the maximum number of iterations is this number times the size of the * matrix. It is currently set to 30. */ static const int m_maxIterationsPerRow = 30; protected: ComplexMatrixType m_matT, m_matU; HessenbergDecomposition m_hess; ComputationInfo m_info; bool m_isInitialized; bool m_matUisUptodate; Index m_maxIters; private: bool subdiagonalEntryIsNeglegible(Index i); ComplexScalar computeShift(Index iu, Index iter); void reduceToTriangularForm(bool computeU); friend struct internal::complex_schur_reduce_to_hessenberg::IsComplex>; }; /** If m_matT(i+1,i) is neglegible in floating point arithmetic * compared to m_matT(i,i) and m_matT(j,j), then set it to zero and * return true, else return false. */ template inline bool ComplexSchur::subdiagonalEntryIsNeglegible(Index i) { RealScalar d = numext::norm1(m_matT.coeff(i,i)) + numext::norm1(m_matT.coeff(i+1,i+1)); RealScalar sd = numext::norm1(m_matT.coeff(i+1,i)); if (internal::isMuchSmallerThan(sd, d, NumTraits::epsilon())) { m_matT.coeffRef(i+1,i) = ComplexScalar(0); return true; } return false; } /** Compute the shift in the current QR iteration. */ template typename ComplexSchur::ComplexScalar ComplexSchur::computeShift(Index iu, Index iter) { using std::abs; if (iter == 10 || iter == 20) { // exceptional shift, taken from http://www.netlib.org/eispack/comqr.f return abs(numext::real(m_matT.coeff(iu,iu-1))) + abs(numext::real(m_matT.coeff(iu-1,iu-2))); } // compute the shift as one of the eigenvalues of t, the 2x2 // diagonal block on the bottom of the active submatrix Matrix t = m_matT.template block<2,2>(iu-1,iu-1); RealScalar normt = t.cwiseAbs().sum(); t /= normt; // the normalization by sf is to avoid under/overflow ComplexScalar b = t.coeff(0,1) * t.coeff(1,0); ComplexScalar c = t.coeff(0,0) - t.coeff(1,1); ComplexScalar disc = sqrt(c*c + RealScalar(4)*b); ComplexScalar det = t.coeff(0,0) * t.coeff(1,1) - b; ComplexScalar trace = t.coeff(0,0) + t.coeff(1,1); ComplexScalar eival1 = (trace + disc) / RealScalar(2); ComplexScalar eival2 = (trace - disc) / RealScalar(2); RealScalar eival1_norm = numext::norm1(eival1); RealScalar eival2_norm = numext::norm1(eival2); // A division by zero can only occur if eival1==eival2==0. // In this case, det==0, and all we have to do is checking that eival2_norm!=0 if(eival1_norm > eival2_norm) eival2 = det / eival1; else if(eival2_norm!=RealScalar(0)) eival1 = det / eival2; // choose the eigenvalue closest to the bottom entry of the diagonal if(numext::norm1(eival1-t.coeff(1,1)) < numext::norm1(eival2-t.coeff(1,1))) return normt * eival1; else return normt * eival2; } template template ComplexSchur& ComplexSchur::compute(const EigenBase& matrix, bool computeU) { m_matUisUptodate = false; eigen_assert(matrix.cols() == matrix.rows()); if(matrix.cols() == 1) { m_matT = matrix.derived().template cast(); if(computeU) m_matU = ComplexMatrixType::Identity(1,1); m_info = Success; m_isInitialized = true; m_matUisUptodate = computeU; return *this; } internal::complex_schur_reduce_to_hessenberg::IsComplex>::run(*this, matrix.derived(), computeU); computeFromHessenberg(m_matT, m_matU, computeU); return *this; } template template ComplexSchur& ComplexSchur::computeFromHessenberg(const HessMatrixType& matrixH, const OrthMatrixType& matrixQ, bool computeU) { m_matT = matrixH; if(computeU) m_matU = matrixQ; reduceToTriangularForm(computeU); return *this; } namespace internal { /* Reduce given matrix to Hessenberg form */ template struct complex_schur_reduce_to_hessenberg { // this is the implementation for the case IsComplex = true static void run(ComplexSchur& _this, const MatrixType& matrix, bool computeU) { _this.m_hess.compute(matrix); _this.m_matT = _this.m_hess.matrixH(); if(computeU) _this.m_matU = _this.m_hess.matrixQ(); } }; template struct complex_schur_reduce_to_hessenberg { static void run(ComplexSchur& _this, const MatrixType& matrix, bool computeU) { typedef typename ComplexSchur::ComplexScalar ComplexScalar; // Note: m_hess is over RealScalar; m_matT and m_matU is over ComplexScalar _this.m_hess.compute(matrix); _this.m_matT = _this.m_hess.matrixH().template cast(); if(computeU) { // This may cause an allocation which seems to be avoidable MatrixType Q = _this.m_hess.matrixQ(); _this.m_matU = Q.template cast(); } } }; } // end namespace internal // Reduce the Hessenberg matrix m_matT to triangular form by QR iteration. template void ComplexSchur::reduceToTriangularForm(bool computeU) { Index maxIters = m_maxIters; if (maxIters == -1) maxIters = m_maxIterationsPerRow * m_matT.rows(); // The matrix m_matT is divided in three parts. // Rows 0,...,il-1 are decoupled from the rest because m_matT(il,il-1) is zero. // Rows il,...,iu is the part we are working on (the active submatrix). // Rows iu+1,...,end are already brought in triangular form. Index iu = m_matT.cols() - 1; Index il; Index iter = 0; // number of iterations we are working on the (iu,iu) element Index totalIter = 0; // number of iterations for whole matrix while(true) { // find iu, the bottom row of the active submatrix while(iu > 0) { if(!subdiagonalEntryIsNeglegible(iu-1)) break; iter = 0; --iu; } // if iu is zero then we are done; the whole matrix is triangularized if(iu==0) break; // if we spent too many iterations, we give up iter++; totalIter++; if(totalIter > maxIters) break; // find il, the top row of the active submatrix il = iu-1; while(il > 0 && !subdiagonalEntryIsNeglegible(il-1)) { --il; } /* perform the QR step using Givens rotations. The first rotation creates a bulge; the (il+2,il) element becomes nonzero. This bulge is chased down to the bottom of the active submatrix. */ ComplexScalar shift = computeShift(iu, iter); JacobiRotation rot; rot.makeGivens(m_matT.coeff(il,il) - shift, m_matT.coeff(il+1,il)); m_matT.rightCols(m_matT.cols()-il).applyOnTheLeft(il, il+1, rot.adjoint()); m_matT.topRows((std::min)(il+2,iu)+1).applyOnTheRight(il, il+1, rot); if(computeU) m_matU.applyOnTheRight(il, il+1, rot); for(Index i=il+1 ; i template inline \ ComplexSchur >& \ ComplexSchur >::compute(const EigenBase& matrix, bool computeU) \ { \ typedef Matrix MatrixType; \ typedef MatrixType::RealScalar RealScalar; \ typedef std::complex ComplexScalar; \ \ eigen_assert(matrix.cols() == matrix.rows()); \ \ m_matUisUptodate = false; \ if(matrix.cols() == 1) \ { \ m_matT = matrix.derived().template cast(); \ if(computeU) m_matU = ComplexMatrixType::Identity(1,1); \ m_info = Success; \ m_isInitialized = true; \ m_matUisUptodate = computeU; \ return *this; \ } \ lapack_int n = internal::convert_index(matrix.cols()), sdim, info; \ lapack_int matrix_order = LAPACKE_COLROW; \ char jobvs, sort='N'; \ LAPACK_##LAPACKE_PREFIX_U##_SELECT1 select = 0; \ jobvs = (computeU) ? 'V' : 'N'; \ m_matU.resize(n, n); \ lapack_int ldvs = internal::convert_index(m_matU.outerStride()); \ m_matT = matrix; \ lapack_int lda = internal::convert_index(m_matT.outerStride()); \ Matrix w; \ w.resize(n, 1);\ info = LAPACKE_##LAPACKE_PREFIX##gees( matrix_order, jobvs, sort, select, n, (LAPACKE_TYPE*)m_matT.data(), lda, &sdim, (LAPACKE_TYPE*)w.data(), (LAPACKE_TYPE*)m_matU.data(), ldvs ); \ if(info == 0) \ m_info = Success; \ else \ m_info = NoConvergence; \ \ m_isInitialized = true; \ m_matUisUptodate = computeU; \ return *this; \ \ } EIGEN_LAPACKE_SCHUR_COMPLEX(dcomplex, lapack_complex_double, z, Z, ColMajor, LAPACK_COL_MAJOR) EIGEN_LAPACKE_SCHUR_COMPLEX(scomplex, lapack_complex_float, c, C, ColMajor, LAPACK_COL_MAJOR) EIGEN_LAPACKE_SCHUR_COMPLEX(dcomplex, lapack_complex_double, z, Z, RowMajor, LAPACK_ROW_MAJOR) EIGEN_LAPACKE_SCHUR_COMPLEX(scomplex, lapack_complex_float, c, C, RowMajor, LAPACK_ROW_MAJOR) } // end namespace Eigen #endif // EIGEN_COMPLEX_SCHUR_LAPACKE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Eigenvalues/EigenSolver.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // Copyright (C) 2010,2012 Jitse Niesen // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_EIGENSOLVER_H #define EIGEN_EIGENSOLVER_H #include "./RealSchur.h" namespace Eigen { /** \eigenvalues_module \ingroup Eigenvalues_Module * * * \class EigenSolver * * \brief Computes eigenvalues and eigenvectors of general matrices * * \tparam MatrixType_ the type of the matrix of which we are computing the * eigendecomposition; this is expected to be an instantiation of the Matrix * class template. Currently, only real matrices are supported. * * The eigenvalues and eigenvectors of a matrix \f$ A \f$ are scalars * \f$ \lambda \f$ and vectors \f$ v \f$ such that \f$ Av = \lambda v \f$. If * \f$ D \f$ is a diagonal matrix with the eigenvalues on the diagonal, and * \f$ V \f$ is a matrix with the eigenvectors as its columns, then \f$ A V = * V D \f$. The matrix \f$ V \f$ is almost always invertible, in which case we * have \f$ A = V D V^{-1} \f$. This is called the eigendecomposition. * * The eigenvalues and eigenvectors of a matrix may be complex, even when the * matrix is real. However, we can choose real matrices \f$ V \f$ and \f$ D * \f$ satisfying \f$ A V = V D \f$, just like the eigendecomposition, if the * matrix \f$ D \f$ is not required to be diagonal, but if it is allowed to * have blocks of the form * \f[ \begin{bmatrix} u & v \\ -v & u \end{bmatrix} \f] * (where \f$ u \f$ and \f$ v \f$ are real numbers) on the diagonal. These * blocks correspond to complex eigenvalue pairs \f$ u \pm iv \f$. We call * this variant of the eigendecomposition the pseudo-eigendecomposition. * * Call the function compute() to compute the eigenvalues and eigenvectors of * a given matrix. Alternatively, you can use the * EigenSolver(const MatrixType&, bool) constructor which computes the * eigenvalues and eigenvectors at construction time. Once the eigenvalue and * eigenvectors are computed, they can be retrieved with the eigenvalues() and * eigenvectors() functions. The pseudoEigenvalueMatrix() and * pseudoEigenvectors() methods allow the construction of the * pseudo-eigendecomposition. * * The documentation for EigenSolver(const MatrixType&, bool) contains an * example of the typical use of this class. * * \note The implementation is adapted from * JAMA (public domain). * Their code is based on EISPACK. * * \sa MatrixBase::eigenvalues(), class ComplexEigenSolver, class SelfAdjointEigenSolver */ template class EigenSolver { public: /** \brief Synonym for the template parameter \p MatrixType_. */ typedef MatrixType_ MatrixType; enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, Options = MatrixType::Options, MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; /** \brief Scalar type for matrices of type #MatrixType. */ typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3 /** \brief Complex scalar type for #MatrixType. * * This is \c std::complex if #Scalar is real (e.g., * \c float or \c double) and just \c Scalar if #Scalar is * complex. */ typedef std::complex ComplexScalar; /** \brief Type for vector of eigenvalues as returned by eigenvalues(). * * This is a column vector with entries of type #ComplexScalar. * The length of the vector is the size of #MatrixType. */ typedef Matrix EigenvalueType; /** \brief Type for matrix of eigenvectors as returned by eigenvectors(). * * This is a square matrix with entries of type #ComplexScalar. * The size is the same as the size of #MatrixType. */ typedef Matrix EigenvectorsType; /** \brief Default constructor. * * The default constructor is useful in cases in which the user intends to * perform decompositions via EigenSolver::compute(const MatrixType&, bool). * * \sa compute() for an example. */ EigenSolver() : m_eivec(), m_eivalues(), m_isInitialized(false), m_eigenvectorsOk(false), m_realSchur(), m_matT(), m_tmp() {} /** \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 EigenSolver() */ explicit EigenSolver(Index size) : m_eivec(size, size), m_eivalues(size), m_isInitialized(false), m_eigenvectorsOk(false), m_realSchur(size), m_matT(size, size), m_tmp(size) {} /** \brief Constructor; computes eigendecomposition of given matrix. * * \param[in] matrix Square matrix whose eigendecomposition is to be computed. * \param[in] computeEigenvectors If true, both the eigenvectors and the * eigenvalues are computed; if false, only the eigenvalues are * computed. * * This constructor calls compute() to compute the eigenvalues * and eigenvectors. * * Example: \include EigenSolver_EigenSolver_MatrixType.cpp * Output: \verbinclude EigenSolver_EigenSolver_MatrixType.out * * \sa compute() */ template explicit EigenSolver(const EigenBase& matrix, bool computeEigenvectors = true) : m_eivec(matrix.rows(), matrix.cols()), m_eivalues(matrix.cols()), m_isInitialized(false), m_eigenvectorsOk(false), m_realSchur(matrix.cols()), m_matT(matrix.rows(), matrix.cols()), m_tmp(matrix.cols()) { compute(matrix.derived(), computeEigenvectors); } /** \brief Returns the eigenvectors of given matrix. * * \returns %Matrix whose columns are the (possibly complex) eigenvectors. * * \pre Either the constructor * EigenSolver(const MatrixType&,bool) or the member function * compute(const MatrixType&, bool) has been called before, and * \p computeEigenvectors was set to true (the default). * * Column \f$ k \f$ of the returned matrix is an eigenvector corresponding * to eigenvalue number \f$ k \f$ as returned by eigenvalues(). The * eigenvectors are normalized to have (Euclidean) norm equal to one. The * matrix returned by this function is the matrix \f$ V \f$ in the * eigendecomposition \f$ A = V D V^{-1} \f$, if it exists. * * Example: \include EigenSolver_eigenvectors.cpp * Output: \verbinclude EigenSolver_eigenvectors.out * * \sa eigenvalues(), pseudoEigenvectors() */ EigenvectorsType eigenvectors() const; /** \brief Returns the pseudo-eigenvectors of given matrix. * * \returns Const reference to matrix whose columns are the pseudo-eigenvectors. * * \pre Either the constructor * EigenSolver(const MatrixType&,bool) or the member function * compute(const MatrixType&, bool) has been called before, and * \p computeEigenvectors was set to true (the default). * * The real matrix \f$ V \f$ returned by this function and the * block-diagonal matrix \f$ D \f$ returned by pseudoEigenvalueMatrix() * satisfy \f$ AV = VD \f$. * * Example: \include EigenSolver_pseudoEigenvectors.cpp * Output: \verbinclude EigenSolver_pseudoEigenvectors.out * * \sa pseudoEigenvalueMatrix(), eigenvectors() */ const MatrixType& pseudoEigenvectors() const { eigen_assert(m_isInitialized && "EigenSolver is not initialized."); eigen_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues."); return m_eivec; } /** \brief Returns the block-diagonal matrix in the pseudo-eigendecomposition. * * \returns A block-diagonal matrix. * * \pre Either the constructor * EigenSolver(const MatrixType&,bool) or the member function * compute(const MatrixType&, bool) has been called before. * * The matrix \f$ D \f$ returned by this function is real and * block-diagonal. The blocks on the diagonal are either 1-by-1 or 2-by-2 * blocks of the form * \f$ \begin{bmatrix} u & v \\ -v & u \end{bmatrix} \f$. * These blocks are not sorted in any particular order. * The matrix \f$ D \f$ and the matrix \f$ V \f$ returned by * pseudoEigenvectors() satisfy \f$ AV = VD \f$. * * \sa pseudoEigenvectors() for an example, eigenvalues() */ MatrixType pseudoEigenvalueMatrix() const; /** \brief Returns the eigenvalues of given matrix. * * \returns A const reference to the column vector containing the eigenvalues. * * \pre Either the constructor * EigenSolver(const MatrixType&,bool) or the member function * compute(const MatrixType&, bool) has been called before. * * The eigenvalues are repeated according to their algebraic multiplicity, * so there are as many eigenvalues as rows in the matrix. The eigenvalues * are not sorted in any particular order. * * Example: \include EigenSolver_eigenvalues.cpp * Output: \verbinclude EigenSolver_eigenvalues.out * * \sa eigenvectors(), pseudoEigenvalueMatrix(), * MatrixBase::eigenvalues() */ const EigenvalueType& eigenvalues() const { eigen_assert(m_isInitialized && "EigenSolver is not initialized."); return m_eivalues; } /** \brief Computes eigendecomposition of given matrix. * * \param[in] matrix Square matrix whose eigendecomposition is to be computed. * \param[in] computeEigenvectors If true, both the eigenvectors and the * eigenvalues are computed; if false, only the eigenvalues are * computed. * \returns Reference to \c *this * * This function computes the eigenvalues of the real matrix \p matrix. * The eigenvalues() function can be used to retrieve them. If * \p computeEigenvectors is true, then the eigenvectors are also computed * and can be retrieved by calling eigenvectors(). * * The matrix is first reduced to real Schur form using the RealSchur * class. The Schur decomposition is then used to compute the eigenvalues * and eigenvectors. * * The cost of the computation is dominated by the cost of the * Schur decomposition, which is very approximately \f$ 25n^3 \f$ * (where \f$ n \f$ is the size of the matrix) if \p computeEigenvectors * is true, and \f$ 10n^3 \f$ if \p computeEigenvectors is false. * * This method reuses of the allocated data in the EigenSolver object. * * Example: \include EigenSolver_compute.cpp * Output: \verbinclude EigenSolver_compute.out */ template EigenSolver& compute(const EigenBase& matrix, bool computeEigenvectors = true); /** \returns NumericalIssue if the input contains INF or NaN values or overflow occurred. Returns Success otherwise. */ ComputationInfo info() const { eigen_assert(m_isInitialized && "EigenSolver is not initialized."); return m_info; } /** \brief Sets the maximum number of iterations allowed. */ EigenSolver& setMaxIterations(Index maxIters) { m_realSchur.setMaxIterations(maxIters); return *this; } /** \brief Returns the maximum number of iterations. */ Index getMaxIterations() { return m_realSchur.getMaxIterations(); } private: void doComputeEigenvectors(); protected: static void check_template_parameters() { EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); EIGEN_STATIC_ASSERT(!NumTraits::IsComplex, NUMERIC_TYPE_MUST_BE_REAL); } MatrixType m_eivec; EigenvalueType m_eivalues; bool m_isInitialized; bool m_eigenvectorsOk; ComputationInfo m_info; RealSchur m_realSchur; MatrixType m_matT; typedef Matrix ColumnVectorType; ColumnVectorType m_tmp; }; template MatrixType EigenSolver::pseudoEigenvalueMatrix() const { eigen_assert(m_isInitialized && "EigenSolver is not initialized."); const RealScalar precision = RealScalar(2)*NumTraits::epsilon(); Index n = m_eivalues.rows(); MatrixType matD = MatrixType::Zero(n,n); for (Index i=0; i(i,i) << numext::real(m_eivalues.coeff(i)), numext::imag(m_eivalues.coeff(i)), -numext::imag(m_eivalues.coeff(i)), numext::real(m_eivalues.coeff(i)); ++i; } } return matD; } template typename EigenSolver::EigenvectorsType EigenSolver::eigenvectors() const { eigen_assert(m_isInitialized && "EigenSolver is not initialized."); eigen_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues."); const RealScalar precision = RealScalar(2)*NumTraits::epsilon(); Index n = m_eivec.cols(); EigenvectorsType matV(n,n); for (Index j=0; j(); matV.col(j).normalize(); } else { // we have a pair of complex eigen values for (Index i=0; i template EigenSolver& EigenSolver::compute(const EigenBase& matrix, bool computeEigenvectors) { check_template_parameters(); using std::sqrt; using std::abs; using numext::isfinite; eigen_assert(matrix.cols() == matrix.rows()); // Reduce to real Schur form. m_realSchur.compute(matrix.derived(), computeEigenvectors); m_info = m_realSchur.info(); if (m_info == Success) { m_matT = m_realSchur.matrixT(); if (computeEigenvectors) m_eivec = m_realSchur.matrixU(); // Compute eigenvalues from matT m_eivalues.resize(matrix.cols()); Index i = 0; while (i < matrix.cols()) { if (i == matrix.cols() - 1 || m_matT.coeff(i+1, i) == Scalar(0)) { m_eivalues.coeffRef(i) = m_matT.coeff(i, i); if(!(isfinite)(m_eivalues.coeffRef(i))) { m_isInitialized = true; m_eigenvectorsOk = false; m_info = NumericalIssue; return *this; } ++i; } else { Scalar p = Scalar(0.5) * (m_matT.coeff(i, i) - m_matT.coeff(i+1, i+1)); Scalar z; // Compute z = sqrt(abs(p * p + m_matT.coeff(i+1, i) * m_matT.coeff(i, i+1))); // without overflow { Scalar t0 = m_matT.coeff(i+1, i); Scalar t1 = m_matT.coeff(i, i+1); Scalar maxval = numext::maxi(abs(p),numext::maxi(abs(t0),abs(t1))); t0 /= maxval; t1 /= maxval; Scalar p0 = p/maxval; z = maxval * sqrt(abs(p0 * p0 + t0 * t1)); } m_eivalues.coeffRef(i) = ComplexScalar(m_matT.coeff(i+1, i+1) + p, z); m_eivalues.coeffRef(i+1) = ComplexScalar(m_matT.coeff(i+1, i+1) + p, -z); if(!((isfinite)(m_eivalues.coeffRef(i)) && (isfinite)(m_eivalues.coeffRef(i+1)))) { m_isInitialized = true; m_eigenvectorsOk = false; m_info = NumericalIssue; return *this; } i += 2; } } // Compute eigenvectors. if (computeEigenvectors) doComputeEigenvectors(); } m_isInitialized = true; m_eigenvectorsOk = computeEigenvectors; return *this; } template void EigenSolver::doComputeEigenvectors() { using std::abs; const Index size = m_eivec.cols(); const Scalar eps = NumTraits::epsilon(); // inefficient! this is already computed in RealSchur Scalar norm(0); for (Index j = 0; j < size; ++j) { norm += m_matT.row(j).segment((std::max)(j-1,Index(0)), size-(std::max)(j-1,Index(0))).cwiseAbs().sum(); } // Backsubstitute to find vectors of upper triangular form if (norm == Scalar(0)) { return; } for (Index n = size-1; n >= 0; n--) { Scalar p = m_eivalues.coeff(n).real(); Scalar q = m_eivalues.coeff(n).imag(); // Scalar vector if (q == Scalar(0)) { Scalar lastr(0), lastw(0); Index l = n; m_matT.coeffRef(n,n) = Scalar(1); for (Index i = n-1; i >= 0; i--) { Scalar w = m_matT.coeff(i,i) - p; Scalar r = m_matT.row(i).segment(l,n-l+1).dot(m_matT.col(n).segment(l, n-l+1)); if (m_eivalues.coeff(i).imag() < Scalar(0)) { lastw = w; lastr = r; } else { l = i; if (m_eivalues.coeff(i).imag() == Scalar(0)) { if (w != Scalar(0)) m_matT.coeffRef(i,n) = -r / w; else m_matT.coeffRef(i,n) = -r / (eps * norm); } else // Solve real equations { Scalar x = m_matT.coeff(i,i+1); Scalar y = m_matT.coeff(i+1,i); Scalar denom = (m_eivalues.coeff(i).real() - p) * (m_eivalues.coeff(i).real() - p) + m_eivalues.coeff(i).imag() * m_eivalues.coeff(i).imag(); Scalar t = (x * lastr - lastw * r) / denom; m_matT.coeffRef(i,n) = t; if (abs(x) > abs(lastw)) m_matT.coeffRef(i+1,n) = (-r - w * t) / x; else m_matT.coeffRef(i+1,n) = (-lastr - y * t) / lastw; } // Overflow control Scalar t = abs(m_matT.coeff(i,n)); if ((eps * t) * t > Scalar(1)) m_matT.col(n).tail(size-i) /= t; } } } else if (q < Scalar(0) && n > 0) // Complex vector { Scalar lastra(0), lastsa(0), lastw(0); Index l = n-1; // Last vector component imaginary so matrix is triangular if (abs(m_matT.coeff(n,n-1)) > abs(m_matT.coeff(n-1,n))) { m_matT.coeffRef(n-1,n-1) = q / m_matT.coeff(n,n-1); m_matT.coeffRef(n-1,n) = -(m_matT.coeff(n,n) - p) / m_matT.coeff(n,n-1); } else { ComplexScalar cc = ComplexScalar(Scalar(0),-m_matT.coeff(n-1,n)) / ComplexScalar(m_matT.coeff(n-1,n-1)-p,q); m_matT.coeffRef(n-1,n-1) = numext::real(cc); m_matT.coeffRef(n-1,n) = numext::imag(cc); } m_matT.coeffRef(n,n-1) = Scalar(0); m_matT.coeffRef(n,n) = Scalar(1); for (Index i = n-2; i >= 0; i--) { Scalar ra = m_matT.row(i).segment(l, n-l+1).dot(m_matT.col(n-1).segment(l, n-l+1)); Scalar sa = m_matT.row(i).segment(l, n-l+1).dot(m_matT.col(n).segment(l, n-l+1)); Scalar w = m_matT.coeff(i,i) - p; if (m_eivalues.coeff(i).imag() < Scalar(0)) { lastw = w; lastra = ra; lastsa = sa; } else { l = i; if (m_eivalues.coeff(i).imag() == RealScalar(0)) { ComplexScalar cc = ComplexScalar(-ra,-sa) / ComplexScalar(w,q); m_matT.coeffRef(i,n-1) = numext::real(cc); m_matT.coeffRef(i,n) = numext::imag(cc); } else { // Solve complex equations Scalar x = m_matT.coeff(i,i+1); Scalar y = m_matT.coeff(i+1,i); Scalar vr = (m_eivalues.coeff(i).real() - p) * (m_eivalues.coeff(i).real() - p) + m_eivalues.coeff(i).imag() * m_eivalues.coeff(i).imag() - q * q; Scalar vi = (m_eivalues.coeff(i).real() - p) * Scalar(2) * q; if ((vr == Scalar(0)) && (vi == Scalar(0))) vr = eps * norm * (abs(w) + abs(q) + abs(x) + abs(y) + abs(lastw)); ComplexScalar cc = ComplexScalar(x*lastra-lastw*ra+q*sa,x*lastsa-lastw*sa-q*ra) / ComplexScalar(vr,vi); m_matT.coeffRef(i,n-1) = numext::real(cc); m_matT.coeffRef(i,n) = numext::imag(cc); if (abs(x) > (abs(lastw) + abs(q))) { m_matT.coeffRef(i+1,n-1) = (-ra - w * m_matT.coeff(i,n-1) + q * m_matT.coeff(i,n)) / x; m_matT.coeffRef(i+1,n) = (-sa - w * m_matT.coeff(i,n) - q * m_matT.coeff(i,n-1)) / x; } else { cc = ComplexScalar(-lastra-y*m_matT.coeff(i,n-1),-lastsa-y*m_matT.coeff(i,n)) / ComplexScalar(lastw,q); m_matT.coeffRef(i+1,n-1) = numext::real(cc); m_matT.coeffRef(i+1,n) = numext::imag(cc); } } // Overflow control Scalar t = numext::maxi(abs(m_matT.coeff(i,n-1)),abs(m_matT.coeff(i,n))); if ((eps * t) * t > Scalar(1)) m_matT.block(i, n-1, size-i, 2) /= t; } } // We handled a pair of complex conjugate eigenvalues, so need to skip them both n--; } else { eigen_assert(0 && "Internal bug in EigenSolver (INF or NaN has not been detected)"); // this should not happen } } // Back transformation to get eigenvectors of original matrix for (Index j = size-1; j >= 0; j--) { m_tmp.noalias() = m_eivec.leftCols(j+1) * m_matT.col(j).segment(0, j+1); m_eivec.col(j) = m_tmp; } } } // end namespace Eigen #endif // EIGEN_EIGENSOLVER_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012-2016 Gael Guennebaud // Copyright (C) 2010,2012 Jitse Niesen // Copyright (C) 2016 Tobias Wood // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_GENERALIZEDEIGENSOLVER_H #define EIGEN_GENERALIZEDEIGENSOLVER_H #include "./RealQZ.h" namespace Eigen { /** \eigenvalues_module \ingroup Eigenvalues_Module * * * \class GeneralizedEigenSolver * * \brief Computes the generalized eigenvalues and eigenvectors of a pair of general matrices * * \tparam MatrixType_ the type of the matrices of which we are computing the * eigen-decomposition; this is expected to be an instantiation of the Matrix * class template. Currently, only real matrices are supported. * * The generalized eigenvalues and eigenvectors of a matrix pair \f$ A \f$ and \f$ B \f$ are scalars * \f$ \lambda \f$ and vectors \f$ v \f$ such that \f$ Av = \lambda Bv \f$. If * \f$ D \f$ is a diagonal matrix with the eigenvalues on the diagonal, and * \f$ V \f$ is a matrix with the eigenvectors as its columns, then \f$ A V = * B V D \f$. The matrix \f$ V \f$ is almost always invertible, in which case we * have \f$ A = B V D V^{-1} \f$. This is called the generalized eigen-decomposition. * * The generalized eigenvalues and eigenvectors of a matrix pair may be complex, even when the * matrices are real. Moreover, the generalized eigenvalue might be infinite if the matrix B is * singular. To workaround this difficulty, the eigenvalues are provided as a pair of complex \f$ \alpha \f$ * and real \f$ \beta \f$ such that: \f$ \lambda_i = \alpha_i / \beta_i \f$. If \f$ \beta_i \f$ is (nearly) zero, * then one can consider the well defined left eigenvalue \f$ \mu = \beta_i / \alpha_i\f$ such that: * \f$ \mu_i A v_i = B v_i \f$, or even \f$ \mu_i u_i^T A = u_i^T B \f$ where \f$ u_i \f$ is * called the left eigenvector. * * Call the function compute() to compute the generalized eigenvalues and eigenvectors of * a given matrix pair. Alternatively, you can use the * GeneralizedEigenSolver(const MatrixType&, const MatrixType&, bool) constructor which computes the * eigenvalues and eigenvectors at construction time. Once the eigenvalue and * eigenvectors are computed, they can be retrieved with the eigenvalues() and * eigenvectors() functions. * * Here is an usage example of this class: * Example: \include GeneralizedEigenSolver.cpp * Output: \verbinclude GeneralizedEigenSolver.out * * \sa MatrixBase::eigenvalues(), class ComplexEigenSolver, class SelfAdjointEigenSolver */ template class GeneralizedEigenSolver { public: /** \brief Synonym for the template parameter \p MatrixType_. */ typedef MatrixType_ MatrixType; enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, Options = MatrixType::Options, MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; /** \brief Scalar type for matrices of type #MatrixType. */ typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3 /** \brief Complex scalar type for #MatrixType. * * This is \c std::complex if #Scalar is real (e.g., * \c float or \c double) and just \c Scalar if #Scalar is * complex. */ typedef std::complex ComplexScalar; /** \brief Type for vector of real scalar values eigenvalues as returned by betas(). * * This is a column vector with entries of type #Scalar. * The length of the vector is the size of #MatrixType. */ typedef Matrix VectorType; /** \brief Type for vector of complex scalar values eigenvalues as returned by alphas(). * * This is a column vector with entries of type #ComplexScalar. * The length of the vector is the size of #MatrixType. */ typedef Matrix ComplexVectorType; /** \brief Expression type for the eigenvalues as returned by eigenvalues(). */ typedef CwiseBinaryOp,ComplexVectorType,VectorType> EigenvalueType; /** \brief Type for matrix of eigenvectors as returned by eigenvectors(). * * This is a square matrix with entries of type #ComplexScalar. * The size is the same as the size of #MatrixType. */ typedef Matrix EigenvectorsType; /** \brief Default constructor. * * The default constructor is useful in cases in which the user intends to * perform decompositions via EigenSolver::compute(const MatrixType&, bool). * * \sa compute() for an example. */ GeneralizedEigenSolver() : m_eivec(), m_alphas(), m_betas(), m_valuesOkay(false), m_vectorsOkay(false), m_realQZ() {} /** \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 GeneralizedEigenSolver() */ explicit GeneralizedEigenSolver(Index size) : m_eivec(size, size), m_alphas(size), m_betas(size), m_valuesOkay(false), m_vectorsOkay(false), m_realQZ(size), m_tmp(size) {} /** \brief Constructor; computes the generalized eigendecomposition of given matrix pair. * * \param[in] A Square matrix whose eigendecomposition is to be computed. * \param[in] B Square matrix whose eigendecomposition is to be computed. * \param[in] computeEigenvectors If true, both the eigenvectors and the * eigenvalues are computed; if false, only the eigenvalues are computed. * * This constructor calls compute() to compute the generalized eigenvalues * and eigenvectors. * * \sa compute() */ GeneralizedEigenSolver(const MatrixType& A, const MatrixType& B, bool computeEigenvectors = true) : m_eivec(A.rows(), A.cols()), m_alphas(A.cols()), m_betas(A.cols()), m_valuesOkay(false), m_vectorsOkay(false), m_realQZ(A.cols()), m_tmp(A.cols()) { compute(A, B, computeEigenvectors); } /* \brief Returns the computed generalized eigenvectors. * * \returns %Matrix whose columns are the (possibly complex) right eigenvectors. * i.e. the eigenvectors that solve (A - l*B)x = 0. The ordering matches the eigenvalues. * * \pre Either the constructor * GeneralizedEigenSolver(const MatrixType&,const MatrixType&, bool) or the member function * compute(const MatrixType&, const MatrixType& bool) has been called before, and * \p computeEigenvectors was set to true (the default). * * \sa eigenvalues() */ EigenvectorsType eigenvectors() const { eigen_assert(m_vectorsOkay && "Eigenvectors for GeneralizedEigenSolver were not calculated."); return m_eivec; } /** \brief Returns an expression of the computed generalized eigenvalues. * * \returns An expression of the column vector containing the eigenvalues. * * It is a shortcut for \code this->alphas().cwiseQuotient(this->betas()); \endcode * Not that betas might contain zeros. It is therefore not recommended to use this function, * but rather directly deal with the alphas and betas vectors. * * \pre Either the constructor * GeneralizedEigenSolver(const MatrixType&,const MatrixType&,bool) or the member function * compute(const MatrixType&,const MatrixType&,bool) has been called before. * * The eigenvalues are repeated according to their algebraic multiplicity, * so there are as many eigenvalues as rows in the matrix. The eigenvalues * are not sorted in any particular order. * * \sa alphas(), betas(), eigenvectors() */ EigenvalueType eigenvalues() const { eigen_assert(m_valuesOkay && "GeneralizedEigenSolver is not initialized."); return EigenvalueType(m_alphas,m_betas); } /** \returns A const reference to the vectors containing the alpha values * * This vector permits to reconstruct the j-th eigenvalues as alphas(i)/betas(j). * * \sa betas(), eigenvalues() */ ComplexVectorType alphas() const { eigen_assert(m_valuesOkay && "GeneralizedEigenSolver is not initialized."); return m_alphas; } /** \returns A const reference to the vectors containing the beta values * * This vector permits to reconstruct the j-th eigenvalues as alphas(i)/betas(j). * * \sa alphas(), eigenvalues() */ VectorType betas() const { eigen_assert(m_valuesOkay && "GeneralizedEigenSolver is not initialized."); return m_betas; } /** \brief Computes generalized eigendecomposition of given matrix. * * \param[in] A Square matrix whose eigendecomposition is to be computed. * \param[in] B Square matrix whose eigendecomposition is to be computed. * \param[in] computeEigenvectors If true, both the eigenvectors and the * eigenvalues are computed; if false, only the eigenvalues are * computed. * \returns Reference to \c *this * * This function computes the eigenvalues of the real matrix \p matrix. * The eigenvalues() function can be used to retrieve them. If * \p computeEigenvectors is true, then the eigenvectors are also computed * and can be retrieved by calling eigenvectors(). * * The matrix is first reduced to real generalized Schur form using the RealQZ * class. The generalized Schur decomposition is then used to compute the eigenvalues * and eigenvectors. * * The cost of the computation is dominated by the cost of the * generalized Schur decomposition. * * This method reuses of the allocated data in the GeneralizedEigenSolver object. */ GeneralizedEigenSolver& compute(const MatrixType& A, const MatrixType& B, bool computeEigenvectors = true); ComputationInfo info() const { eigen_assert(m_valuesOkay && "EigenSolver is not initialized."); return m_realQZ.info(); } /** Sets the maximal number of iterations allowed. */ GeneralizedEigenSolver& setMaxIterations(Index maxIters) { m_realQZ.setMaxIterations(maxIters); return *this; } protected: static void check_template_parameters() { EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); EIGEN_STATIC_ASSERT(!NumTraits::IsComplex, NUMERIC_TYPE_MUST_BE_REAL); } EigenvectorsType m_eivec; ComplexVectorType m_alphas; VectorType m_betas; bool m_valuesOkay, m_vectorsOkay; RealQZ m_realQZ; ComplexVectorType m_tmp; }; template GeneralizedEigenSolver& GeneralizedEigenSolver::compute(const MatrixType& A, const MatrixType& B, bool computeEigenvectors) { check_template_parameters(); using std::sqrt; using std::abs; eigen_assert(A.cols() == A.rows() && B.cols() == A.rows() && B.cols() == B.rows()); Index size = A.cols(); m_valuesOkay = false; m_vectorsOkay = false; // Reduce to generalized real Schur form: // A = Q S Z and B = Q T Z m_realQZ.compute(A, B, computeEigenvectors); if (m_realQZ.info() == Success) { // Resize storage m_alphas.resize(size); m_betas.resize(size); if (computeEigenvectors) { m_eivec.resize(size,size); m_tmp.resize(size); } // Aliases: Map v(reinterpret_cast(m_tmp.data()), size); ComplexVectorType &cv = m_tmp; const MatrixType &mS = m_realQZ.matrixS(); const MatrixType &mT = m_realQZ.matrixT(); Index i = 0; while (i < size) { if (i == size - 1 || mS.coeff(i+1, i) == Scalar(0)) { // Real eigenvalue m_alphas.coeffRef(i) = mS.diagonal().coeff(i); m_betas.coeffRef(i) = mT.diagonal().coeff(i); if (computeEigenvectors) { v.setConstant(Scalar(0.0)); v.coeffRef(i) = Scalar(1.0); // For singular eigenvalues do nothing more if(abs(m_betas.coeffRef(i)) >= (std::numeric_limits::min)()) { // Non-singular eigenvalue const Scalar alpha = real(m_alphas.coeffRef(i)); const Scalar beta = m_betas.coeffRef(i); for (Index j = i-1; j >= 0; j--) { const Index st = j+1; const Index sz = i-j; if (j > 0 && mS.coeff(j, j-1) != Scalar(0)) { // 2x2 block Matrix rhs = (alpha*mT.template block<2,Dynamic>(j-1,st,2,sz) - beta*mS.template block<2,Dynamic>(j-1,st,2,sz)) .lazyProduct( v.segment(st,sz) ); Matrix lhs = beta * mS.template block<2,2>(j-1,j-1) - alpha * mT.template block<2,2>(j-1,j-1); v.template segment<2>(j-1) = lhs.partialPivLu().solve(rhs); j--; } else { v.coeffRef(j) = -v.segment(st,sz).transpose().cwiseProduct(beta*mS.block(j,st,1,sz) - alpha*mT.block(j,st,1,sz)).sum() / (beta*mS.coeffRef(j,j) - alpha*mT.coeffRef(j,j)); } } } m_eivec.col(i).real().noalias() = m_realQZ.matrixZ().transpose() * v; m_eivec.col(i).real().normalize(); m_eivec.col(i).imag().setConstant(0); } ++i; } else { // We need to extract the generalized eigenvalues of the pair of a general 2x2 block S and a positive diagonal 2x2 block T // Then taking beta=T_00*T_11, we can avoid any division, and alpha is the eigenvalues of A = (U^-1 * S * U) * diag(T_11,T_00): // T = [a 0] // [0 b] RealScalar a = mT.diagonal().coeff(i), b = mT.diagonal().coeff(i+1); const RealScalar beta = m_betas.coeffRef(i) = m_betas.coeffRef(i+1) = a*b; // ^^ NOTE: using diagonal()(i) instead of coeff(i,i) workarounds a MSVC bug. Matrix S2 = mS.template block<2,2>(i,i) * Matrix(b,a).asDiagonal(); Scalar p = Scalar(0.5) * (S2.coeff(0,0) - S2.coeff(1,1)); Scalar z = sqrt(abs(p * p + S2.coeff(1,0) * S2.coeff(0,1))); const ComplexScalar alpha = ComplexScalar(S2.coeff(1,1) + p, (beta > 0) ? z : -z); m_alphas.coeffRef(i) = conj(alpha); m_alphas.coeffRef(i+1) = alpha; if (computeEigenvectors) { // Compute eigenvector in position (i+1) and then position (i) is just the conjugate cv.setZero(); cv.coeffRef(i+1) = Scalar(1.0); // here, the "static_cast" workaound expression template issues. cv.coeffRef(i) = -(static_cast(beta*mS.coeffRef(i,i+1)) - alpha*mT.coeffRef(i,i+1)) / (static_cast(beta*mS.coeffRef(i,i)) - alpha*mT.coeffRef(i,i)); for (Index j = i-1; j >= 0; j--) { const Index st = j+1; const Index sz = i+1-j; if (j > 0 && mS.coeff(j, j-1) != Scalar(0)) { // 2x2 block Matrix rhs = (alpha*mT.template block<2,Dynamic>(j-1,st,2,sz) - beta*mS.template block<2,Dynamic>(j-1,st,2,sz)) .lazyProduct( cv.segment(st,sz) ); Matrix lhs = beta * mS.template block<2,2>(j-1,j-1) - alpha * mT.template block<2,2>(j-1,j-1); cv.template segment<2>(j-1) = lhs.partialPivLu().solve(rhs); j--; } else { cv.coeffRef(j) = cv.segment(st,sz).transpose().cwiseProduct(beta*mS.block(j,st,1,sz) - alpha*mT.block(j,st,1,sz)).sum() / (alpha*mT.coeffRef(j,j) - static_cast(beta*mS.coeffRef(j,j))); } } m_eivec.col(i+1).noalias() = (m_realQZ.matrixZ().transpose() * cv); m_eivec.col(i+1).normalize(); m_eivec.col(i) = m_eivec.col(i+1).conjugate(); } i += 2; } } m_valuesOkay = true; m_vectorsOkay = computeEigenvectors; } return *this; } } // end namespace Eigen #endif // EIGEN_GENERALIZEDEIGENSOLVER_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2010 Gael Guennebaud // Copyright (C) 2010 Jitse Niesen // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_GENERALIZEDSELFADJOINTEIGENSOLVER_H #define EIGEN_GENERALIZEDSELFADJOINTEIGENSOLVER_H #include "./Tridiagonalization.h" namespace Eigen { /** \eigenvalues_module \ingroup Eigenvalues_Module * * * \class GeneralizedSelfAdjointEigenSolver * * \brief Computes eigenvalues and eigenvectors of the generalized selfadjoint eigen problem * * \tparam MatrixType_ the type of the matrix of which we are computing the * eigendecomposition; this is expected to be an instantiation of the Matrix * class template. * * This class solves the generalized eigenvalue problem * \f$ Av = \lambda Bv \f$. In this case, the matrix \f$ A \f$ should be * selfadjoint and the matrix \f$ B \f$ should be positive definite. * * Only the \b lower \b triangular \b part of the input matrix is referenced. * * Call the function compute() to compute the eigenvalues and eigenvectors of * a given matrix. Alternatively, you can use the * GeneralizedSelfAdjointEigenSolver(const MatrixType&, const MatrixType&, int) * constructor which computes the eigenvalues and eigenvectors at construction time. * Once the eigenvalue and eigenvectors are computed, they can be retrieved with the eigenvalues() * and eigenvectors() functions. * * The documentation for GeneralizedSelfAdjointEigenSolver(const MatrixType&, const MatrixType&, int) * contains an example of the typical use of this class. * * \sa class SelfAdjointEigenSolver, class EigenSolver, class ComplexEigenSolver */ template class GeneralizedSelfAdjointEigenSolver : public SelfAdjointEigenSolver { typedef SelfAdjointEigenSolver Base; public: typedef MatrixType_ MatrixType; /** \brief Default constructor for fixed-size matrices. * * The default constructor is useful in cases in which the user intends to * perform decompositions via compute(). This constructor * can only be used if \p MatrixType_ is a fixed-size matrix; use * GeneralizedSelfAdjointEigenSolver(Index) for dynamic-size matrices. */ GeneralizedSelfAdjointEigenSolver() : Base() {} /** \brief Constructor, pre-allocates memory for dynamic-size matrices. * * \param [in] size Positive integer, size of the matrix whose * eigenvalues and eigenvectors will be computed. * * This constructor is useful for dynamic-size matrices, when the user * intends to perform decompositions via compute(). The \p size * parameter is only used as a hint. It is not an error to give a wrong * \p size, but it may impair performance. * * \sa compute() for an example */ explicit GeneralizedSelfAdjointEigenSolver(Index size) : Base(size) {} /** \brief Constructor; computes generalized eigendecomposition of given matrix pencil. * * \param[in] matA Selfadjoint matrix in matrix pencil. * Only the lower triangular part of the matrix is referenced. * \param[in] matB Positive-definite matrix in matrix pencil. * Only the lower triangular part of the matrix is referenced. * \param[in] options A or-ed set of flags {#ComputeEigenvectors,#EigenvaluesOnly} | {#Ax_lBx,#ABx_lx,#BAx_lx}. * Default is #ComputeEigenvectors|#Ax_lBx. * * This constructor calls compute(const MatrixType&, const MatrixType&, int) * to compute the eigenvalues and (if requested) the eigenvectors of the * generalized eigenproblem \f$ Ax = \lambda B x \f$ with \a matA the * selfadjoint matrix \f$ A \f$ and \a matB the positive definite matrix * \f$ B \f$. Each eigenvector \f$ x \f$ satisfies the property * \f$ x^* B x = 1 \f$. The eigenvectors are computed if * \a options contains ComputeEigenvectors. * * In addition, the two following variants can be solved via \p options: * - \c ABx_lx: \f$ ABx = \lambda x \f$ * - \c BAx_lx: \f$ BAx = \lambda x \f$ * * Example: \include SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType2.cpp * Output: \verbinclude SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType2.out * * \sa compute(const MatrixType&, const MatrixType&, int) */ GeneralizedSelfAdjointEigenSolver(const MatrixType& matA, const MatrixType& matB, int options = ComputeEigenvectors|Ax_lBx) : Base(matA.cols()) { compute(matA, matB, options); } /** \brief Computes generalized eigendecomposition of given matrix pencil. * * \param[in] matA Selfadjoint matrix in matrix pencil. * Only the lower triangular part of the matrix is referenced. * \param[in] matB Positive-definite matrix in matrix pencil. * Only the lower triangular part of the matrix is referenced. * \param[in] options A or-ed set of flags {#ComputeEigenvectors,#EigenvaluesOnly} | {#Ax_lBx,#ABx_lx,#BAx_lx}. * Default is #ComputeEigenvectors|#Ax_lBx. * * \returns Reference to \c *this * * According to \p options, this function computes eigenvalues and (if requested) * the eigenvectors of one of the following three generalized eigenproblems: * - \c Ax_lBx: \f$ Ax = \lambda B x \f$ * - \c ABx_lx: \f$ ABx = \lambda x \f$ * - \c BAx_lx: \f$ BAx = \lambda x \f$ * with \a matA the selfadjoint matrix \f$ A \f$ and \a matB the positive definite * matrix \f$ B \f$. * In addition, each eigenvector \f$ x \f$ satisfies the property \f$ x^* B x = 1 \f$. * * The eigenvalues() function can be used to retrieve * the eigenvalues. If \p options contains ComputeEigenvectors, then the * eigenvectors are also computed and can be retrieved by calling * eigenvectors(). * * The implementation uses LLT to compute the Cholesky decomposition * \f$ B = LL^* \f$ and computes the classical eigendecomposition * of the selfadjoint matrix \f$ L^{-1} A (L^*)^{-1} \f$ if \p options contains Ax_lBx * and of \f$ L^{*} A L \f$ otherwise. This solves the * generalized eigenproblem, because any solution of the generalized * eigenproblem \f$ Ax = \lambda B x \f$ corresponds to a solution * \f$ L^{-1} A (L^*)^{-1} (L^* x) = \lambda (L^* x) \f$ of the * eigenproblem for \f$ L^{-1} A (L^*)^{-1} \f$. Similar statements * can be made for the two other variants. * * Example: \include SelfAdjointEigenSolver_compute_MatrixType2.cpp * Output: \verbinclude SelfAdjointEigenSolver_compute_MatrixType2.out * * \sa GeneralizedSelfAdjointEigenSolver(const MatrixType&, const MatrixType&, int) */ GeneralizedSelfAdjointEigenSolver& compute(const MatrixType& matA, const MatrixType& matB, int options = ComputeEigenvectors|Ax_lBx); protected: }; template GeneralizedSelfAdjointEigenSolver& GeneralizedSelfAdjointEigenSolver:: compute(const MatrixType& matA, const MatrixType& matB, int options) { eigen_assert(matA.cols()==matA.rows() && matB.rows()==matA.rows() && matB.cols()==matB.rows()); eigen_assert((options&~(EigVecMask|GenEigMask))==0 && (options&EigVecMask)!=EigVecMask && ((options&GenEigMask)==0 || (options&GenEigMask)==Ax_lBx || (options&GenEigMask)==ABx_lx || (options&GenEigMask)==BAx_lx) && "invalid option parameter"); bool computeEigVecs = ((options&EigVecMask)==0) || ((options&EigVecMask)==ComputeEigenvectors); // Compute the cholesky decomposition of matB = L L' = U'U LLT cholB(matB); int type = (options&GenEigMask); if(type==0) type = Ax_lBx; if(type==Ax_lBx) { // compute C = inv(L) A inv(L') MatrixType matC = matA.template selfadjointView(); cholB.matrixL().template solveInPlace(matC); cholB.matrixU().template solveInPlace(matC); Base::compute(matC, computeEigVecs ? ComputeEigenvectors : EigenvaluesOnly ); // transform back the eigen vectors: evecs = inv(U) * evecs if(computeEigVecs) cholB.matrixU().solveInPlace(Base::m_eivec); } else if(type==ABx_lx) { // compute C = L' A L MatrixType matC = matA.template selfadjointView(); matC = matC * cholB.matrixL(); matC = cholB.matrixU() * matC; Base::compute(matC, computeEigVecs ? ComputeEigenvectors : EigenvaluesOnly); // transform back the eigen vectors: evecs = inv(U) * evecs if(computeEigVecs) cholB.matrixU().solveInPlace(Base::m_eivec); } else if(type==BAx_lx) { // compute C = L' A L MatrixType matC = matA.template selfadjointView(); matC = matC * cholB.matrixL(); matC = cholB.matrixU() * matC; Base::compute(matC, computeEigVecs ? ComputeEigenvectors : EigenvaluesOnly); // transform back the eigen vectors: evecs = L * evecs if(computeEigVecs) Base::m_eivec = cholB.matrixL() * Base::m_eivec; } return *this; } } // end namespace Eigen #endif // EIGEN_GENERALIZEDSELFADJOINTEIGENSOLVER_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2009 Gael Guennebaud // Copyright (C) 2010 Jitse Niesen // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_HESSENBERGDECOMPOSITION_H #define EIGEN_HESSENBERGDECOMPOSITION_H namespace Eigen { namespace internal { template struct HessenbergDecompositionMatrixHReturnType; template struct traits > { typedef MatrixType ReturnType; }; } /** \eigenvalues_module \ingroup Eigenvalues_Module * * * \class HessenbergDecomposition * * \brief Reduces a square matrix to Hessenberg form by an orthogonal similarity transformation * * \tparam MatrixType_ the type of the matrix of which we are computing the Hessenberg decomposition * * This class performs an Hessenberg decomposition of a matrix \f$ A \f$. In * the real case, the Hessenberg decomposition consists of an orthogonal * matrix \f$ Q \f$ and a Hessenberg matrix \f$ H \f$ such that \f$ A = Q H * Q^T \f$. An orthogonal matrix is a matrix whose inverse equals its * transpose (\f$ Q^{-1} = Q^T \f$). A Hessenberg matrix has zeros below the * subdiagonal, so it is almost upper triangular. The Hessenberg decomposition * of a complex matrix is \f$ A = Q H Q^* \f$ with \f$ Q \f$ unitary (that is, * \f$ Q^{-1} = Q^* \f$). * * Call the function compute() to compute the Hessenberg decomposition of a * given matrix. Alternatively, you can use the * HessenbergDecomposition(const MatrixType&) constructor which computes the * Hessenberg decomposition at construction time. Once the decomposition is * computed, you can use the matrixH() and matrixQ() functions to construct * the matrices H and Q in the decomposition. * * The documentation for matrixH() contains an example of the typical use of * this class. * * \sa class ComplexSchur, class Tridiagonalization, \ref QR_Module "QR Module" */ template class HessenbergDecomposition { public: /** \brief Synonym for the template parameter \p MatrixType_. */ typedef MatrixType_ MatrixType; enum { Size = MatrixType::RowsAtCompileTime, SizeMinusOne = Size == Dynamic ? Dynamic : Size - 1, Options = MatrixType::Options, MaxSize = MatrixType::MaxRowsAtCompileTime, MaxSizeMinusOne = MaxSize == Dynamic ? Dynamic : MaxSize - 1 }; /** \brief Scalar type for matrices of type #MatrixType. */ typedef typename MatrixType::Scalar Scalar; typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3 /** \brief Type for vector of Householder coefficients. * * This is column vector with entries of type #Scalar. The length of the * vector is one less than the size of #MatrixType, if it is a fixed-side * type. */ typedef Matrix CoeffVectorType; /** \brief Return type of matrixQ() */ typedef HouseholderSequence::type> HouseholderSequenceType; typedef internal::HessenbergDecompositionMatrixHReturnType MatrixHReturnType; /** \brief Default constructor; the decomposition will be computed later. * * \param [in] size The size of the matrix whose Hessenberg decomposition will be computed. * * The default constructor is useful in cases in which the user intends to * perform decompositions via compute(). The \p size parameter is only * used as a hint. It is not an error to give a wrong \p size, but it may * impair performance. * * \sa compute() for an example. */ explicit HessenbergDecomposition(Index size = Size==Dynamic ? 2 : Size) : m_matrix(size,size), m_temp(size), m_isInitialized(false) { if(size>1) m_hCoeffs.resize(size-1); } /** \brief Constructor; computes Hessenberg decomposition of given matrix. * * \param[in] matrix Square matrix whose Hessenberg decomposition is to be computed. * * This constructor calls compute() to compute the Hessenberg * decomposition. * * \sa matrixH() for an example. */ template explicit HessenbergDecomposition(const EigenBase& matrix) : m_matrix(matrix.derived()), m_temp(matrix.rows()), m_isInitialized(false) { if(matrix.rows()<2) { m_isInitialized = true; return; } m_hCoeffs.resize(matrix.rows()-1,1); _compute(m_matrix, m_hCoeffs, m_temp); m_isInitialized = true; } /** \brief Computes Hessenberg decomposition of given matrix. * * \param[in] matrix Square matrix whose Hessenberg decomposition is to be computed. * \returns Reference to \c *this * * The Hessenberg decomposition is computed by bringing the columns of the * matrix successively in the required form using Householder reflections * (see, e.g., Algorithm 7.4.2 in Golub \& Van Loan, %Matrix * Computations). The cost is \f$ 10n^3/3 \f$ flops, where \f$ n \f$ * denotes the size of the given matrix. * * This method reuses of the allocated data in the HessenbergDecomposition * object. * * Example: \include HessenbergDecomposition_compute.cpp * Output: \verbinclude HessenbergDecomposition_compute.out */ template HessenbergDecomposition& compute(const EigenBase& matrix) { m_matrix = matrix.derived(); if(matrix.rows()<2) { m_isInitialized = true; return *this; } m_hCoeffs.resize(matrix.rows()-1,1); _compute(m_matrix, m_hCoeffs, m_temp); m_isInitialized = true; return *this; } /** \brief Returns the Householder coefficients. * * \returns a const reference to the vector of Householder coefficients * * \pre Either the constructor HessenbergDecomposition(const MatrixType&) * or the member function compute(const MatrixType&) has been called * before to compute the Hessenberg decomposition of a matrix. * * The Householder coefficients allow the reconstruction of the matrix * \f$ Q \f$ in the Hessenberg decomposition from the packed data. * * \sa packedMatrix(), \ref Householder_Module "Householder module" */ const CoeffVectorType& householderCoefficients() const { eigen_assert(m_isInitialized && "HessenbergDecomposition is not initialized."); return m_hCoeffs; } /** \brief Returns the internal representation of the decomposition * * \returns a const reference to a matrix with the internal representation * of the decomposition. * * \pre Either the constructor HessenbergDecomposition(const MatrixType&) * or the member function compute(const MatrixType&) has been called * before to compute the Hessenberg decomposition of a matrix. * * The returned matrix contains the following information: * - the upper part and lower sub-diagonal represent the Hessenberg matrix H * - the rest of the lower part contains the Householder vectors that, combined with * Householder coefficients returned by householderCoefficients(), * allows to reconstruct the matrix Q as * \f$ Q = H_{N-1} \ldots H_1 H_0 \f$. * Here, the matrices \f$ H_i \f$ are the Householder transformations * \f$ H_i = (I - h_i v_i v_i^T) \f$ * where \f$ h_i \f$ is the \f$ i \f$th Householder coefficient and * \f$ v_i \f$ is the Householder vector defined by * \f$ v_i = [ 0, \ldots, 0, 1, M(i+2,i), \ldots, M(N-1,i) ]^T \f$ * with M the matrix returned by this function. * * See LAPACK for further details on this packed storage. * * Example: \include HessenbergDecomposition_packedMatrix.cpp * Output: \verbinclude HessenbergDecomposition_packedMatrix.out * * \sa householderCoefficients() */ const MatrixType& packedMatrix() const { eigen_assert(m_isInitialized && "HessenbergDecomposition is not initialized."); return m_matrix; } /** \brief Reconstructs the orthogonal matrix Q in the decomposition * * \returns object representing the matrix Q * * \pre Either the constructor HessenbergDecomposition(const MatrixType&) * or the member function compute(const MatrixType&) has been called * before to compute the Hessenberg decomposition of a matrix. * * This function returns a light-weight object of template class * HouseholderSequence. You can either apply it directly to a matrix or * you can convert it to a matrix of type #MatrixType. * * \sa matrixH() for an example, class HouseholderSequence */ HouseholderSequenceType matrixQ() const { eigen_assert(m_isInitialized && "HessenbergDecomposition is not initialized."); return HouseholderSequenceType(m_matrix, m_hCoeffs.conjugate()) .setLength(m_matrix.rows() - 1) .setShift(1); } /** \brief Constructs the Hessenberg matrix H in the decomposition * * \returns expression object representing the matrix H * * \pre Either the constructor HessenbergDecomposition(const MatrixType&) * or the member function compute(const MatrixType&) has been called * before to compute the Hessenberg decomposition of a matrix. * * The object returned by this function constructs the Hessenberg matrix H * when it is assigned to a matrix or otherwise evaluated. The matrix H is * constructed from the packed matrix as returned by packedMatrix(): The * upper part (including the subdiagonal) of the packed matrix contains * the matrix H. It may sometimes be better to directly use the packed * matrix instead of constructing the matrix H. * * Example: \include HessenbergDecomposition_matrixH.cpp * Output: \verbinclude HessenbergDecomposition_matrixH.out * * \sa matrixQ(), packedMatrix() */ MatrixHReturnType matrixH() const { eigen_assert(m_isInitialized && "HessenbergDecomposition is not initialized."); return MatrixHReturnType(*this); } private: typedef Matrix VectorType; typedef typename NumTraits::Real RealScalar; static void _compute(MatrixType& matA, CoeffVectorType& hCoeffs, VectorType& temp); protected: MatrixType m_matrix; CoeffVectorType m_hCoeffs; VectorType m_temp; bool m_isInitialized; }; /** \internal * Performs a tridiagonal decomposition of \a matA in place. * * \param matA the input selfadjoint matrix * \param hCoeffs returned Householder coefficients * * The result is written in the lower triangular part of \a matA. * * Implemented from Golub's "%Matrix Computations", algorithm 8.3.1. * * \sa packedMatrix() */ template void HessenbergDecomposition::_compute(MatrixType& matA, CoeffVectorType& hCoeffs, VectorType& temp) { eigen_assert(matA.rows()==matA.cols()); Index n = matA.rows(); temp.resize(n); for (Index i = 0; i struct HessenbergDecompositionMatrixHReturnType : public ReturnByValue > { public: /** \brief Constructor. * * \param[in] hess Hessenberg decomposition */ HessenbergDecompositionMatrixHReturnType(const HessenbergDecomposition& hess) : m_hess(hess) { } /** \brief Hessenberg matrix in decomposition. * * \param[out] result Hessenberg matrix in decomposition \p hess which * was passed to the constructor */ template inline void evalTo(ResultType& result) const { result = m_hess.packedMatrix(); Index n = result.rows(); if (n>2) result.bottomLeftCorner(n-2, n-2).template triangularView().setZero(); } Index rows() const { return m_hess.packedMatrix().rows(); } Index cols() const { return m_hess.packedMatrix().cols(); } protected: const HessenbergDecomposition& m_hess; }; } // end namespace internal } // end namespace Eigen #endif // EIGEN_HESSENBERGDECOMPOSITION_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // Copyright (C) 2010 Jitse Niesen // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_MATRIXBASEEIGENVALUES_H #define EIGEN_MATRIXBASEEIGENVALUES_H namespace Eigen { namespace internal { template struct eigenvalues_selector { // this is the implementation for the case IsComplex = true static inline typename MatrixBase::EigenvaluesReturnType const run(const MatrixBase& m) { typedef typename Derived::PlainObject PlainObject; PlainObject m_eval(m); return ComplexEigenSolver(m_eval, false).eigenvalues(); } }; template struct eigenvalues_selector { static inline typename MatrixBase::EigenvaluesReturnType const run(const MatrixBase& m) { typedef typename Derived::PlainObject PlainObject; PlainObject m_eval(m); return EigenSolver(m_eval, false).eigenvalues(); } }; } // end namespace internal /** \brief Computes the eigenvalues of a matrix * \returns Column vector containing the eigenvalues. * * \eigenvalues_module * This function computes the eigenvalues with the help of the EigenSolver * class (for real matrices) or the ComplexEigenSolver class (for complex * matrices). * * The eigenvalues are repeated according to their algebraic multiplicity, * so there are as many eigenvalues as rows in the matrix. * * The SelfAdjointView class provides a better algorithm for selfadjoint * matrices. * * Example: \include MatrixBase_eigenvalues.cpp * Output: \verbinclude MatrixBase_eigenvalues.out * * \sa EigenSolver::eigenvalues(), ComplexEigenSolver::eigenvalues(), * SelfAdjointView::eigenvalues() */ template inline typename MatrixBase::EigenvaluesReturnType MatrixBase::eigenvalues() const { return internal::eigenvalues_selector::IsComplex>::run(derived()); } /** \brief Computes the eigenvalues of a matrix * \returns Column vector containing the eigenvalues. * * \eigenvalues_module * This function computes the eigenvalues with the help of the * SelfAdjointEigenSolver class. The eigenvalues are repeated according to * their algebraic multiplicity, so there are as many eigenvalues as rows in * the matrix. * * Example: \include SelfAdjointView_eigenvalues.cpp * Output: \verbinclude SelfAdjointView_eigenvalues.out * * \sa SelfAdjointEigenSolver::eigenvalues(), MatrixBase::eigenvalues() */ template EIGEN_DEVICE_FUNC inline typename SelfAdjointView::EigenvaluesReturnType SelfAdjointView::eigenvalues() const { PlainObject thisAsMatrix(*this); return SelfAdjointEigenSolver(thisAsMatrix, false).eigenvalues(); } /** \brief Computes the L2 operator norm * \returns Operator norm of the matrix. * * \eigenvalues_module * This function computes the L2 operator norm of a matrix, which is also * known as the spectral norm. The norm of a matrix \f$ A \f$ is defined to be * \f[ \|A\|_2 = \max_x \frac{\|Ax\|_2}{\|x\|_2} \f] * where the maximum is over all vectors and the norm on the right is the * Euclidean vector norm. The norm equals the largest singular value, which is * the square root of the largest eigenvalue of the positive semi-definite * matrix \f$ A^*A \f$. * * The current implementation uses the eigenvalues of \f$ A^*A \f$, as computed * by SelfAdjointView::eigenvalues(), to compute the operator norm of a * matrix. The SelfAdjointView class provides a better algorithm for * selfadjoint matrices. * * Example: \include MatrixBase_operatorNorm.cpp * Output: \verbinclude MatrixBase_operatorNorm.out * * \sa SelfAdjointView::eigenvalues(), SelfAdjointView::operatorNorm() */ template inline typename MatrixBase::RealScalar MatrixBase::operatorNorm() const { using std::sqrt; typename Derived::PlainObject m_eval(derived()); // FIXME if it is really guaranteed that the eigenvalues are already sorted, // then we don't need to compute a maxCoeff() here, comparing the 1st and last ones is enough. return sqrt((m_eval*m_eval.adjoint()) .eval() .template selfadjointView() .eigenvalues() .maxCoeff() ); } /** \brief Computes the L2 operator norm * \returns Operator norm of the matrix. * * \eigenvalues_module * This function computes the L2 operator norm of a self-adjoint matrix. For a * self-adjoint matrix, the operator norm is the largest eigenvalue. * * The current implementation uses the eigenvalues of the matrix, as computed * by eigenvalues(), to compute the operator norm of the matrix. * * Example: \include SelfAdjointView_operatorNorm.cpp * Output: \verbinclude SelfAdjointView_operatorNorm.out * * \sa eigenvalues(), MatrixBase::operatorNorm() */ template EIGEN_DEVICE_FUNC inline typename SelfAdjointView::RealScalar SelfAdjointView::operatorNorm() const { return eigenvalues().cwiseAbs().maxCoeff(); } } // end namespace Eigen #endif ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Eigenvalues/RealQZ.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Alexey Korepanov // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_REAL_QZ_H #define EIGEN_REAL_QZ_H namespace Eigen { /** \eigenvalues_module \ingroup Eigenvalues_Module * * * \class RealQZ * * \brief Performs a real QZ decomposition of a pair of square matrices * * \tparam MatrixType_ the type of the matrix of which we are computing the * real QZ decomposition; this is expected to be an instantiation of the * Matrix class template. * * Given a real square matrices A and B, this class computes the real QZ * decomposition: \f$ A = Q S Z \f$, \f$ B = Q T Z \f$ where Q and Z are * real orthogonal matrixes, T is upper-triangular matrix, and S is upper * quasi-triangular matrix. An orthogonal matrix is a matrix whose * inverse is equal to its transpose, \f$ U^{-1} = U^T \f$. A quasi-triangular * matrix is a block-triangular matrix whose diagonal consists of 1-by-1 * blocks and 2-by-2 blocks where further reduction is impossible due to * complex eigenvalues. * * The eigenvalues of the pencil \f$ A - z B \f$ can be obtained from * 1x1 and 2x2 blocks on the diagonals of S and T. * * Call the function compute() to compute the real QZ decomposition of a * given pair of matrices. Alternatively, you can use the * RealQZ(const MatrixType& B, const MatrixType& B, bool computeQZ) * constructor which computes the real QZ decomposition at construction * time. Once the decomposition is computed, you can use the matrixS(), * matrixT(), matrixQ() and matrixZ() functions to retrieve the matrices * S, T, Q and Z in the decomposition. If computeQZ==false, some time * is saved by not computing matrices Q and Z. * * Example: \include RealQZ_compute.cpp * Output: \include RealQZ_compute.out * * \note The implementation is based on the algorithm in "Matrix Computations" * by Gene H. Golub and Charles F. Van Loan, and a paper "An algorithm for * generalized eigenvalue problems" by C.B.Moler and G.W.Stewart. * * \sa class RealSchur, class ComplexSchur, class EigenSolver, class ComplexEigenSolver */ template class RealQZ { public: typedef MatrixType_ MatrixType; enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, Options = MatrixType::Options, MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; typedef typename MatrixType::Scalar Scalar; typedef std::complex::Real> ComplexScalar; typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3 typedef Matrix EigenvalueType; typedef Matrix ColumnVectorType; /** \brief Default constructor. * * \param [in] size Positive integer, size of the matrix whose QZ decomposition will be computed. * * The default constructor is useful in cases in which the user intends to * perform decompositions via compute(). The \p size parameter is only * used as a hint. It is not an error to give a wrong \p size, but it may * impair performance. * * \sa compute() for an example. */ explicit RealQZ(Index size = RowsAtCompileTime==Dynamic ? 1 : RowsAtCompileTime) : m_S(size, size), m_T(size, size), m_Q(size, size), m_Z(size, size), m_workspace(size*2), m_maxIters(400), m_isInitialized(false), m_computeQZ(true) {} /** \brief Constructor; computes real QZ decomposition of given matrices * * \param[in] A Matrix A. * \param[in] B Matrix B. * \param[in] computeQZ If false, A and Z are not computed. * * This constructor calls compute() to compute the QZ decomposition. */ RealQZ(const MatrixType& A, const MatrixType& B, bool computeQZ = true) : m_S(A.rows(),A.cols()), m_T(A.rows(),A.cols()), m_Q(A.rows(),A.cols()), m_Z(A.rows(),A.cols()), m_workspace(A.rows()*2), m_maxIters(400), m_isInitialized(false), m_computeQZ(true) { compute(A, B, computeQZ); } /** \brief Returns matrix Q in the QZ decomposition. * * \returns A const reference to the matrix Q. */ const MatrixType& matrixQ() const { eigen_assert(m_isInitialized && "RealQZ is not initialized."); eigen_assert(m_computeQZ && "The matrices Q and Z have not been computed during the QZ decomposition."); return m_Q; } /** \brief Returns matrix Z in the QZ decomposition. * * \returns A const reference to the matrix Z. */ const MatrixType& matrixZ() const { eigen_assert(m_isInitialized && "RealQZ is not initialized."); eigen_assert(m_computeQZ && "The matrices Q and Z have not been computed during the QZ decomposition."); return m_Z; } /** \brief Returns matrix S in the QZ decomposition. * * \returns A const reference to the matrix S. */ const MatrixType& matrixS() const { eigen_assert(m_isInitialized && "RealQZ is not initialized."); return m_S; } /** \brief Returns matrix S in the QZ decomposition. * * \returns A const reference to the matrix S. */ const MatrixType& matrixT() const { eigen_assert(m_isInitialized && "RealQZ is not initialized."); return m_T; } /** \brief Computes QZ decomposition of given matrix. * * \param[in] A Matrix A. * \param[in] B Matrix B. * \param[in] computeQZ If false, A and Z are not computed. * \returns Reference to \c *this */ RealQZ& compute(const MatrixType& A, const MatrixType& B, bool computeQZ = true); /** \brief Reports whether previous computation was successful. * * \returns \c Success if computation was successful, \c NoConvergence otherwise. */ ComputationInfo info() const { eigen_assert(m_isInitialized && "RealQZ is not initialized."); return m_info; } /** \brief Returns number of performed QR-like iterations. */ Index iterations() const { eigen_assert(m_isInitialized && "RealQZ is not initialized."); return m_global_iter; } /** Sets the maximal number of iterations allowed to converge to one eigenvalue * or decouple the problem. */ RealQZ& setMaxIterations(Index maxIters) { m_maxIters = maxIters; return *this; } private: MatrixType m_S, m_T, m_Q, m_Z; Matrix m_workspace; ComputationInfo m_info; Index m_maxIters; bool m_isInitialized; bool m_computeQZ; Scalar m_normOfT, m_normOfS; Index m_global_iter; typedef Matrix Vector3s; typedef Matrix Vector2s; typedef Matrix Matrix2s; typedef JacobiRotation JRs; void hessenbergTriangular(); void computeNorms(); Index findSmallSubdiagEntry(Index iu); Index findSmallDiagEntry(Index f, Index l); void splitOffTwoRows(Index i); void pushDownZero(Index z, Index f, Index l); void step(Index f, Index l, Index iter); }; // RealQZ /** \internal Reduces S and T to upper Hessenberg - triangular form */ template void RealQZ::hessenbergTriangular() { const Index dim = m_S.cols(); // perform QR decomposition of T, overwrite T with R, save Q HouseholderQR qrT(m_T); m_T = qrT.matrixQR(); m_T.template triangularView().setZero(); m_Q = qrT.householderQ(); // overwrite S with Q* S m_S.applyOnTheLeft(m_Q.adjoint()); // init Z as Identity if (m_computeQZ) m_Z = MatrixType::Identity(dim,dim); // reduce S to upper Hessenberg with Givens rotations for (Index j=0; j<=dim-3; j++) { for (Index i=dim-1; i>=j+2; i--) { JRs G; // kill S(i,j) if(m_S.coeff(i,j) != 0) { G.makeGivens(m_S.coeff(i-1,j), m_S.coeff(i,j), &m_S.coeffRef(i-1, j)); m_S.coeffRef(i,j) = Scalar(0.0); m_S.rightCols(dim-j-1).applyOnTheLeft(i-1,i,G.adjoint()); m_T.rightCols(dim-i+1).applyOnTheLeft(i-1,i,G.adjoint()); // update Q if (m_computeQZ) m_Q.applyOnTheRight(i-1,i,G); } // kill T(i,i-1) if(m_T.coeff(i,i-1)!=Scalar(0)) { G.makeGivens(m_T.coeff(i,i), m_T.coeff(i,i-1), &m_T.coeffRef(i,i)); m_T.coeffRef(i,i-1) = Scalar(0.0); m_S.applyOnTheRight(i,i-1,G); m_T.topRows(i).applyOnTheRight(i,i-1,G); // update Z if (m_computeQZ) m_Z.applyOnTheLeft(i,i-1,G.adjoint()); } } } } /** \internal Computes vector L1 norms of S and T when in Hessenberg-Triangular form already */ template inline void RealQZ::computeNorms() { const Index size = m_S.cols(); m_normOfS = Scalar(0.0); m_normOfT = Scalar(0.0); for (Index j = 0; j < size; ++j) { m_normOfS += m_S.col(j).segment(0, (std::min)(size,j+2)).cwiseAbs().sum(); m_normOfT += m_T.row(j).segment(j, size - j).cwiseAbs().sum(); } } /** \internal Look for single small sub-diagonal element S(res, res-1) and return res (or 0) */ template inline Index RealQZ::findSmallSubdiagEntry(Index iu) { using std::abs; Index res = iu; while (res > 0) { Scalar s = abs(m_S.coeff(res-1,res-1)) + abs(m_S.coeff(res,res)); if (s == Scalar(0.0)) s = m_normOfS; if (abs(m_S.coeff(res,res-1)) < NumTraits::epsilon() * s) break; res--; } return res; } /** \internal Look for single small diagonal element T(res, res) for res between f and l, and return res (or f-1) */ template inline Index RealQZ::findSmallDiagEntry(Index f, Index l) { using std::abs; Index res = l; while (res >= f) { if (abs(m_T.coeff(res,res)) <= NumTraits::epsilon() * m_normOfT) break; res--; } return res; } /** \internal decouple 2x2 diagonal block in rows i, i+1 if eigenvalues are real */ template inline void RealQZ::splitOffTwoRows(Index i) { using std::abs; using std::sqrt; const Index dim=m_S.cols(); if (abs(m_S.coeff(i+1,i))==Scalar(0)) return; Index j = findSmallDiagEntry(i,i+1); if (j==i-1) { // block of (S T^{-1}) Matrix2s STi = m_T.template block<2,2>(i,i).template triangularView(). template solve(m_S.template block<2,2>(i,i)); Scalar p = Scalar(0.5)*(STi(0,0)-STi(1,1)); Scalar q = p*p + STi(1,0)*STi(0,1); if (q>=0) { Scalar z = sqrt(q); // one QR-like iteration for ABi - lambda I // is enough - when we know exact eigenvalue in advance, // convergence is immediate JRs G; if (p>=0) G.makeGivens(p + z, STi(1,0)); else G.makeGivens(p - z, STi(1,0)); m_S.rightCols(dim-i).applyOnTheLeft(i,i+1,G.adjoint()); m_T.rightCols(dim-i).applyOnTheLeft(i,i+1,G.adjoint()); // update Q if (m_computeQZ) m_Q.applyOnTheRight(i,i+1,G); G.makeGivens(m_T.coeff(i+1,i+1), m_T.coeff(i+1,i)); m_S.topRows(i+2).applyOnTheRight(i+1,i,G); m_T.topRows(i+2).applyOnTheRight(i+1,i,G); // update Z if (m_computeQZ) m_Z.applyOnTheLeft(i+1,i,G.adjoint()); m_S.coeffRef(i+1,i) = Scalar(0.0); m_T.coeffRef(i+1,i) = Scalar(0.0); } } else { pushDownZero(j,i,i+1); } } /** \internal use zero in T(z,z) to zero S(l,l-1), working in block f..l */ template inline void RealQZ::pushDownZero(Index z, Index f, Index l) { JRs G; const Index dim = m_S.cols(); for (Index zz=z; zzf ? (zz-1) : zz; G.makeGivens(m_T.coeff(zz, zz+1), m_T.coeff(zz+1, zz+1)); m_S.rightCols(dim-firstColS).applyOnTheLeft(zz,zz+1,G.adjoint()); m_T.rightCols(dim-zz).applyOnTheLeft(zz,zz+1,G.adjoint()); m_T.coeffRef(zz+1,zz+1) = Scalar(0.0); // update Q if (m_computeQZ) m_Q.applyOnTheRight(zz,zz+1,G); // kill S(zz+1, zz-1) if (zz>f) { G.makeGivens(m_S.coeff(zz+1, zz), m_S.coeff(zz+1,zz-1)); m_S.topRows(zz+2).applyOnTheRight(zz, zz-1,G); m_T.topRows(zz+1).applyOnTheRight(zz, zz-1,G); m_S.coeffRef(zz+1,zz-1) = Scalar(0.0); // update Z if (m_computeQZ) m_Z.applyOnTheLeft(zz,zz-1,G.adjoint()); } } // finally kill S(l,l-1) G.makeGivens(m_S.coeff(l,l), m_S.coeff(l,l-1)); m_S.applyOnTheRight(l,l-1,G); m_T.applyOnTheRight(l,l-1,G); m_S.coeffRef(l,l-1)=Scalar(0.0); // update Z if (m_computeQZ) m_Z.applyOnTheLeft(l,l-1,G.adjoint()); } /** \internal QR-like iterative step for block f..l */ template inline void RealQZ::step(Index f, Index l, Index iter) { using std::abs; const Index dim = m_S.cols(); // x, y, z Scalar x, y, z; if (iter==10) { // Wilkinson ad hoc shift const Scalar a11=m_S.coeff(f+0,f+0), a12=m_S.coeff(f+0,f+1), a21=m_S.coeff(f+1,f+0), a22=m_S.coeff(f+1,f+1), a32=m_S.coeff(f+2,f+1), b12=m_T.coeff(f+0,f+1), b11i=Scalar(1.0)/m_T.coeff(f+0,f+0), b22i=Scalar(1.0)/m_T.coeff(f+1,f+1), a87=m_S.coeff(l-1,l-2), a98=m_S.coeff(l-0,l-1), b77i=Scalar(1.0)/m_T.coeff(l-2,l-2), b88i=Scalar(1.0)/m_T.coeff(l-1,l-1); Scalar ss = abs(a87*b77i) + abs(a98*b88i), lpl = Scalar(1.5)*ss, ll = ss*ss; x = ll + a11*a11*b11i*b11i - lpl*a11*b11i + a12*a21*b11i*b22i - a11*a21*b12*b11i*b11i*b22i; y = a11*a21*b11i*b11i - lpl*a21*b11i + a21*a22*b11i*b22i - a21*a21*b12*b11i*b11i*b22i; z = a21*a32*b11i*b22i; } else if (iter==16) { // another exceptional shift x = m_S.coeff(f,f)/m_T.coeff(f,f)-m_S.coeff(l,l)/m_T.coeff(l,l) + m_S.coeff(l,l-1)*m_T.coeff(l-1,l) / (m_T.coeff(l-1,l-1)*m_T.coeff(l,l)); y = m_S.coeff(f+1,f)/m_T.coeff(f,f); z = 0; } else if (iter>23 && !(iter%8)) { // extremely exceptional shift x = internal::random(-1.0,1.0); y = internal::random(-1.0,1.0); z = internal::random(-1.0,1.0); } else { // Compute the shifts: (x,y,z,0...) = (AB^-1 - l1 I) (AB^-1 - l2 I) e1 // where l1 and l2 are the eigenvalues of the 2x2 matrix C = U V^-1 where // U and V are 2x2 bottom right sub matrices of A and B. Thus: // = AB^-1AB^-1 + l1 l2 I - (l1+l2)(AB^-1) // = AB^-1AB^-1 + det(M) - tr(M)(AB^-1) // Since we are only interested in having x, y, z with a correct ratio, we have: const Scalar a11 = m_S.coeff(f,f), a12 = m_S.coeff(f,f+1), a21 = m_S.coeff(f+1,f), a22 = m_S.coeff(f+1,f+1), a32 = m_S.coeff(f+2,f+1), a88 = m_S.coeff(l-1,l-1), a89 = m_S.coeff(l-1,l), a98 = m_S.coeff(l,l-1), a99 = m_S.coeff(l,l), b11 = m_T.coeff(f,f), b12 = m_T.coeff(f,f+1), b22 = m_T.coeff(f+1,f+1), b88 = m_T.coeff(l-1,l-1), b89 = m_T.coeff(l-1,l), b99 = m_T.coeff(l,l); x = ( (a88/b88 - a11/b11)*(a99/b99 - a11/b11) - (a89/b99)*(a98/b88) + (a98/b88)*(b89/b99)*(a11/b11) ) * (b11/a21) + a12/b22 - (a11/b11)*(b12/b22); y = (a22/b22-a11/b11) - (a21/b11)*(b12/b22) - (a88/b88-a11/b11) - (a99/b99-a11/b11) + (a98/b88)*(b89/b99); z = a32/b22; } JRs G; for (Index k=f; k<=l-2; k++) { // variables for Householder reflections Vector2s essential2; Scalar tau, beta; Vector3s hr(x,y,z); // Q_k to annihilate S(k+1,k-1) and S(k+2,k-1) hr.makeHouseholderInPlace(tau, beta); essential2 = hr.template bottomRows<2>(); Index fc=(std::max)(k-1,Index(0)); // first col to update m_S.template middleRows<3>(k).rightCols(dim-fc).applyHouseholderOnTheLeft(essential2, tau, m_workspace.data()); m_T.template middleRows<3>(k).rightCols(dim-fc).applyHouseholderOnTheLeft(essential2, tau, m_workspace.data()); if (m_computeQZ) m_Q.template middleCols<3>(k).applyHouseholderOnTheRight(essential2, tau, m_workspace.data()); if (k>f) m_S.coeffRef(k+2,k-1) = m_S.coeffRef(k+1,k-1) = Scalar(0.0); // Z_{k1} to annihilate T(k+2,k+1) and T(k+2,k) hr << m_T.coeff(k+2,k+2),m_T.coeff(k+2,k),m_T.coeff(k+2,k+1); hr.makeHouseholderInPlace(tau, beta); essential2 = hr.template bottomRows<2>(); { Index lr = (std::min)(k+4,dim); // last row to update Map > tmp(m_workspace.data(),lr); // S tmp = m_S.template middleCols<2>(k).topRows(lr) * essential2; tmp += m_S.col(k+2).head(lr); m_S.col(k+2).head(lr) -= tau*tmp; m_S.template middleCols<2>(k).topRows(lr) -= (tau*tmp) * essential2.adjoint(); // T tmp = m_T.template middleCols<2>(k).topRows(lr) * essential2; tmp += m_T.col(k+2).head(lr); m_T.col(k+2).head(lr) -= tau*tmp; m_T.template middleCols<2>(k).topRows(lr) -= (tau*tmp) * essential2.adjoint(); } if (m_computeQZ) { // Z Map > tmp(m_workspace.data(),dim); tmp = essential2.adjoint()*(m_Z.template middleRows<2>(k)); tmp += m_Z.row(k+2); m_Z.row(k+2) -= tau*tmp; m_Z.template middleRows<2>(k) -= essential2 * (tau*tmp); } m_T.coeffRef(k+2,k) = m_T.coeffRef(k+2,k+1) = Scalar(0.0); // Z_{k2} to annihilate T(k+1,k) G.makeGivens(m_T.coeff(k+1,k+1), m_T.coeff(k+1,k)); m_S.applyOnTheRight(k+1,k,G); m_T.applyOnTheRight(k+1,k,G); // update Z if (m_computeQZ) m_Z.applyOnTheLeft(k+1,k,G.adjoint()); m_T.coeffRef(k+1,k) = Scalar(0.0); // update x,y,z x = m_S.coeff(k+1,k); y = m_S.coeff(k+2,k); if (k < l-2) z = m_S.coeff(k+3,k); } // loop over k // Q_{n-1} to annihilate y = S(l,l-2) G.makeGivens(x,y); m_S.applyOnTheLeft(l-1,l,G.adjoint()); m_T.applyOnTheLeft(l-1,l,G.adjoint()); if (m_computeQZ) m_Q.applyOnTheRight(l-1,l,G); m_S.coeffRef(l,l-2) = Scalar(0.0); // Z_{n-1} to annihilate T(l,l-1) G.makeGivens(m_T.coeff(l,l),m_T.coeff(l,l-1)); m_S.applyOnTheRight(l,l-1,G); m_T.applyOnTheRight(l,l-1,G); if (m_computeQZ) m_Z.applyOnTheLeft(l,l-1,G.adjoint()); m_T.coeffRef(l,l-1) = Scalar(0.0); } template RealQZ& RealQZ::compute(const MatrixType& A_in, const MatrixType& B_in, bool computeQZ) { const Index dim = A_in.cols(); eigen_assert (A_in.rows()==dim && A_in.cols()==dim && B_in.rows()==dim && B_in.cols()==dim && "Need square matrices of the same dimension"); m_isInitialized = true; m_computeQZ = computeQZ; m_S = A_in; m_T = B_in; m_workspace.resize(dim*2); m_global_iter = 0; // entrance point: hessenberg triangular decomposition hessenbergTriangular(); // compute L1 vector norms of T, S into m_normOfS, m_normOfT computeNorms(); Index l = dim-1, f, local_iter = 0; while (l>0 && local_iter0) m_S.coeffRef(f,f-1) = Scalar(0.0); if (f == l) // One root found { l--; local_iter = 0; } else if (f == l-1) // Two roots found { splitOffTwoRows(f); l -= 2; local_iter = 0; } else // No convergence yet { // if there's zero on diagonal of T, we can isolate an eigenvalue with Givens rotations Index z = findSmallDiagEntry(f,l); if (z>=f) { // zero found pushDownZero(z,f,l); } else { // We are sure now that S.block(f,f, l-f+1,l-f+1) is underuced upper-Hessenberg // and T.block(f,f, l-f+1,l-f+1) is invertible uper-triangular, which allows to // apply a QR-like iteration to rows and columns f..l. step(f,l, local_iter); local_iter++; m_global_iter++; } } } // check if we converged before reaching iterations limit m_info = (local_iter j_left, j_right; internal::real_2x2_jacobi_svd(m_T, i, i+1, &j_left, &j_right); // Apply resulting Jacobi rotations m_S.applyOnTheLeft(i,i+1,j_left); m_S.applyOnTheRight(i,i+1,j_right); m_T.applyOnTheLeft(i,i+1,j_left); m_T.applyOnTheRight(i,i+1,j_right); m_T(i+1,i) = m_T(i,i+1) = Scalar(0); if(m_computeQZ) { m_Q.applyOnTheRight(i,i+1,j_left.transpose()); m_Z.applyOnTheLeft(i,i+1,j_right.transpose()); } i++; } } } return *this; } // end compute } // end namespace Eigen #endif //EIGEN_REAL_QZ ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Eigenvalues/RealSchur.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // Copyright (C) 2010,2012 Jitse Niesen // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_REAL_SCHUR_H #define EIGEN_REAL_SCHUR_H #include "./HessenbergDecomposition.h" namespace Eigen { /** \eigenvalues_module \ingroup Eigenvalues_Module * * * \class RealSchur * * \brief Performs a real Schur decomposition of a square matrix * * \tparam MatrixType_ the type of the matrix of which we are computing the * real Schur decomposition; this is expected to be an instantiation of the * Matrix class template. * * Given a real square matrix A, this class computes the real Schur * decomposition: \f$ A = U T U^T \f$ where U is a real orthogonal matrix and * T is a real quasi-triangular matrix. An orthogonal matrix is a matrix whose * inverse is equal to its transpose, \f$ U^{-1} = U^T \f$. A quasi-triangular * matrix is a block-triangular matrix whose diagonal consists of 1-by-1 * blocks and 2-by-2 blocks with complex eigenvalues. The eigenvalues of the * blocks on the diagonal of T are the same as the eigenvalues of the matrix * A, and thus the real Schur decomposition is used in EigenSolver to compute * the eigendecomposition of a matrix. * * Call the function compute() to compute the real Schur decomposition of a * given matrix. Alternatively, you can use the RealSchur(const MatrixType&, bool) * constructor which computes the real Schur decomposition at construction * time. Once the decomposition is computed, you can use the matrixU() and * matrixT() functions to retrieve the matrices U and T in the decomposition. * * The documentation of RealSchur(const MatrixType&, bool) contains an example * of the typical use of this class. * * \note The implementation is adapted from * JAMA (public domain). * Their code is based on EISPACK. * * \sa class ComplexSchur, class EigenSolver, class ComplexEigenSolver */ template class RealSchur { public: typedef MatrixType_ MatrixType; enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, Options = MatrixType::Options, MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; typedef typename MatrixType::Scalar Scalar; typedef std::complex::Real> ComplexScalar; typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3 typedef Matrix EigenvalueType; typedef Matrix ColumnVectorType; /** \brief Default constructor. * * \param [in] size Positive integer, size of the matrix whose Schur decomposition will be computed. * * The default constructor is useful in cases in which the user intends to * perform decompositions via compute(). The \p size parameter is only * used as a hint. It is not an error to give a wrong \p size, but it may * impair performance. * * \sa compute() for an example. */ explicit RealSchur(Index size = RowsAtCompileTime==Dynamic ? 1 : RowsAtCompileTime) : m_matT(size, size), m_matU(size, size), m_workspaceVector(size), m_hess(size), m_isInitialized(false), m_matUisUptodate(false), m_maxIters(-1) { } /** \brief Constructor; computes real Schur decomposition of given matrix. * * \param[in] matrix Square matrix whose Schur decomposition is to be computed. * \param[in] computeU If true, both T and U are computed; if false, only T is computed. * * This constructor calls compute() to compute the Schur decomposition. * * Example: \include RealSchur_RealSchur_MatrixType.cpp * Output: \verbinclude RealSchur_RealSchur_MatrixType.out */ template explicit RealSchur(const EigenBase& matrix, bool computeU = true) : m_matT(matrix.rows(),matrix.cols()), m_matU(matrix.rows(),matrix.cols()), m_workspaceVector(matrix.rows()), m_hess(matrix.rows()), m_isInitialized(false), m_matUisUptodate(false), m_maxIters(-1) { compute(matrix.derived(), computeU); } /** \brief Returns the orthogonal matrix in the Schur decomposition. * * \returns A const reference to the matrix U. * * \pre Either the constructor RealSchur(const MatrixType&, bool) or the * member function compute(const MatrixType&, bool) has been called before * to compute the Schur decomposition of a matrix, and \p computeU was set * to true (the default value). * * \sa RealSchur(const MatrixType&, bool) for an example */ const MatrixType& matrixU() const { eigen_assert(m_isInitialized && "RealSchur is not initialized."); eigen_assert(m_matUisUptodate && "The matrix U has not been computed during the RealSchur decomposition."); return m_matU; } /** \brief Returns the quasi-triangular matrix in the Schur decomposition. * * \returns A const reference to the matrix T. * * \pre Either the constructor RealSchur(const MatrixType&, bool) or the * member function compute(const MatrixType&, bool) has been called before * to compute the Schur decomposition of a matrix. * * \sa RealSchur(const MatrixType&, bool) for an example */ const MatrixType& matrixT() const { eigen_assert(m_isInitialized && "RealSchur is not initialized."); return m_matT; } /** \brief Computes Schur decomposition of given matrix. * * \param[in] matrix Square matrix whose Schur decomposition is to be computed. * \param[in] computeU If true, both T and U are computed; if false, only T is computed. * \returns Reference to \c *this * * The Schur decomposition is computed by first reducing the matrix to * Hessenberg form using the class HessenbergDecomposition. The Hessenberg * matrix is then reduced to triangular form by performing Francis QR * iterations with implicit double shift. The cost of computing the Schur * decomposition depends on the number of iterations; as a rough guide, it * may be taken to be \f$25n^3\f$ flops if \a computeU is true and * \f$10n^3\f$ flops if \a computeU is false. * * Example: \include RealSchur_compute.cpp * Output: \verbinclude RealSchur_compute.out * * \sa compute(const MatrixType&, bool, Index) */ template RealSchur& compute(const EigenBase& matrix, bool computeU = true); /** \brief Computes Schur decomposition of a Hessenberg matrix H = Z T Z^T * \param[in] matrixH Matrix in Hessenberg form H * \param[in] matrixQ orthogonal matrix Q that transform a matrix A to H : A = Q H Q^T * \param computeU Computes the matriX U of the Schur vectors * \return Reference to \c *this * * This routine assumes that the matrix is already reduced in Hessenberg form matrixH * using either the class HessenbergDecomposition or another mean. * It computes the upper quasi-triangular matrix T of the Schur decomposition of H * When computeU is true, this routine computes the matrix U such that * A = U T U^T = (QZ) T (QZ)^T = Q H Q^T where A is the initial matrix * * NOTE Q is referenced if computeU is true; so, if the initial orthogonal matrix * is not available, the user should give an identity matrix (Q.setIdentity()) * * \sa compute(const MatrixType&, bool) */ template RealSchur& computeFromHessenberg(const HessMatrixType& matrixH, const OrthMatrixType& matrixQ, bool computeU); /** \brief Reports whether previous computation was successful. * * \returns \c Success if computation was successful, \c NoConvergence otherwise. */ ComputationInfo info() const { eigen_assert(m_isInitialized && "RealSchur is not initialized."); return m_info; } /** \brief Sets the maximum number of iterations allowed. * * If not specified by the user, the maximum number of iterations is m_maxIterationsPerRow times the size * of the matrix. */ RealSchur& setMaxIterations(Index maxIters) { m_maxIters = maxIters; return *this; } /** \brief Returns the maximum number of iterations. */ Index getMaxIterations() { return m_maxIters; } /** \brief Maximum number of iterations per row. * * If not otherwise specified, the maximum number of iterations is this number times the size of the * matrix. It is currently set to 40. */ static const int m_maxIterationsPerRow = 40; private: MatrixType m_matT; MatrixType m_matU; ColumnVectorType m_workspaceVector; HessenbergDecomposition m_hess; ComputationInfo m_info; bool m_isInitialized; bool m_matUisUptodate; Index m_maxIters; typedef Matrix Vector3s; Scalar computeNormOfT(); Index findSmallSubdiagEntry(Index iu, const Scalar& considerAsZero); void splitOffTwoRows(Index iu, bool computeU, const Scalar& exshift); void computeShift(Index iu, Index iter, Scalar& exshift, Vector3s& shiftInfo); void initFrancisQRStep(Index il, Index iu, const Vector3s& shiftInfo, Index& im, Vector3s& firstHouseholderVector); void performFrancisQRStep(Index il, Index im, Index iu, bool computeU, const Vector3s& firstHouseholderVector, Scalar* workspace); }; template template RealSchur& RealSchur::compute(const EigenBase& matrix, bool computeU) { const Scalar considerAsZero = (std::numeric_limits::min)(); eigen_assert(matrix.cols() == matrix.rows()); Index maxIters = m_maxIters; if (maxIters == -1) maxIters = m_maxIterationsPerRow * matrix.rows(); Scalar scale = matrix.derived().cwiseAbs().maxCoeff(); if(scale template RealSchur& RealSchur::computeFromHessenberg(const HessMatrixType& matrixH, const OrthMatrixType& matrixQ, bool computeU) { using std::abs; m_matT = matrixH; m_workspaceVector.resize(m_matT.cols()); if(computeU && !internal::is_same_dense(m_matU,matrixQ)) m_matU = matrixQ; Index maxIters = m_maxIters; if (maxIters == -1) maxIters = m_maxIterationsPerRow * matrixH.rows(); Scalar* workspace = &m_workspaceVector.coeffRef(0); // The matrix m_matT is divided in three parts. // Rows 0,...,il-1 are decoupled from the rest because m_matT(il,il-1) is zero. // Rows il,...,iu is the part we are working on (the active window). // Rows iu+1,...,end are already brought in triangular form. Index iu = m_matT.cols() - 1; Index iter = 0; // iteration count for current eigenvalue Index totalIter = 0; // iteration count for whole matrix Scalar exshift(0); // sum of exceptional shifts Scalar norm = computeNormOfT(); // sub-diagonal entries smaller than considerAsZero will be treated as zero. // We use eps^2 to enable more precision in small eigenvalues. Scalar considerAsZero = numext::maxi( norm * numext::abs2(NumTraits::epsilon()), (std::numeric_limits::min)() ); if(norm!=Scalar(0)) { while (iu >= 0) { Index il = findSmallSubdiagEntry(iu,considerAsZero); // Check for convergence if (il == iu) // One root found { m_matT.coeffRef(iu,iu) = m_matT.coeff(iu,iu) + exshift; if (iu > 0) m_matT.coeffRef(iu, iu-1) = Scalar(0); iu--; iter = 0; } else if (il == iu-1) // Two roots found { splitOffTwoRows(iu, computeU, exshift); iu -= 2; iter = 0; } else // No convergence yet { // The firstHouseholderVector vector has to be initialized to something to get rid of a silly GCC warning (-O1 -Wall -DNDEBUG ) Vector3s firstHouseholderVector = Vector3s::Zero(), shiftInfo; computeShift(iu, iter, exshift, shiftInfo); iter = iter + 1; totalIter = totalIter + 1; if (totalIter > maxIters) break; Index im; initFrancisQRStep(il, iu, shiftInfo, im, firstHouseholderVector); performFrancisQRStep(il, im, iu, computeU, firstHouseholderVector, workspace); } } } if(totalIter <= maxIters) m_info = Success; else m_info = NoConvergence; m_isInitialized = true; m_matUisUptodate = computeU; return *this; } /** \internal Computes and returns vector L1 norm of T */ template inline typename MatrixType::Scalar RealSchur::computeNormOfT() { const Index size = m_matT.cols(); // FIXME to be efficient the following would requires a triangular reduxion code // Scalar norm = m_matT.upper().cwiseAbs().sum() // + m_matT.bottomLeftCorner(size-1,size-1).diagonal().cwiseAbs().sum(); Scalar norm(0); for (Index j = 0; j < size; ++j) norm += m_matT.col(j).segment(0, (std::min)(size,j+2)).cwiseAbs().sum(); return norm; } /** \internal Look for single small sub-diagonal element and returns its index */ template inline Index RealSchur::findSmallSubdiagEntry(Index iu, const Scalar& considerAsZero) { using std::abs; Index res = iu; while (res > 0) { Scalar s = abs(m_matT.coeff(res-1,res-1)) + abs(m_matT.coeff(res,res)); s = numext::maxi(s * NumTraits::epsilon(), considerAsZero); if (abs(m_matT.coeff(res,res-1)) <= s) break; res--; } return res; } /** \internal Update T given that rows iu-1 and iu decouple from the rest. */ template inline void RealSchur::splitOffTwoRows(Index iu, bool computeU, const Scalar& exshift) { using std::sqrt; using std::abs; const Index size = m_matT.cols(); // The eigenvalues of the 2x2 matrix [a b; c d] are // trace +/- sqrt(discr/4) where discr = tr^2 - 4*det, tr = a + d, det = ad - bc Scalar p = Scalar(0.5) * (m_matT.coeff(iu-1,iu-1) - m_matT.coeff(iu,iu)); Scalar q = p * p + m_matT.coeff(iu,iu-1) * m_matT.coeff(iu-1,iu); // q = tr^2 / 4 - det = discr/4 m_matT.coeffRef(iu,iu) += exshift; m_matT.coeffRef(iu-1,iu-1) += exshift; if (q >= Scalar(0)) // Two real eigenvalues { Scalar z = sqrt(abs(q)); JacobiRotation rot; if (p >= Scalar(0)) rot.makeGivens(p + z, m_matT.coeff(iu, iu-1)); else rot.makeGivens(p - z, m_matT.coeff(iu, iu-1)); m_matT.rightCols(size-iu+1).applyOnTheLeft(iu-1, iu, rot.adjoint()); m_matT.topRows(iu+1).applyOnTheRight(iu-1, iu, rot); m_matT.coeffRef(iu, iu-1) = Scalar(0); if (computeU) m_matU.applyOnTheRight(iu-1, iu, rot); } if (iu > 1) m_matT.coeffRef(iu-1, iu-2) = Scalar(0); } /** \internal Form shift in shiftInfo, and update exshift if an exceptional shift is performed. */ template inline void RealSchur::computeShift(Index iu, Index iter, Scalar& exshift, Vector3s& shiftInfo) { using std::sqrt; using std::abs; shiftInfo.coeffRef(0) = m_matT.coeff(iu,iu); shiftInfo.coeffRef(1) = m_matT.coeff(iu-1,iu-1); shiftInfo.coeffRef(2) = m_matT.coeff(iu,iu-1) * m_matT.coeff(iu-1,iu); // Wilkinson's original ad hoc shift if (iter == 10) { exshift += shiftInfo.coeff(0); for (Index i = 0; i <= iu; ++i) m_matT.coeffRef(i,i) -= shiftInfo.coeff(0); Scalar s = abs(m_matT.coeff(iu,iu-1)) + abs(m_matT.coeff(iu-1,iu-2)); shiftInfo.coeffRef(0) = Scalar(0.75) * s; shiftInfo.coeffRef(1) = Scalar(0.75) * s; shiftInfo.coeffRef(2) = Scalar(-0.4375) * s * s; } // MATLAB's new ad hoc shift if (iter == 30) { Scalar s = (shiftInfo.coeff(1) - shiftInfo.coeff(0)) / Scalar(2.0); s = s * s + shiftInfo.coeff(2); if (s > Scalar(0)) { s = sqrt(s); if (shiftInfo.coeff(1) < shiftInfo.coeff(0)) s = -s; s = s + (shiftInfo.coeff(1) - shiftInfo.coeff(0)) / Scalar(2.0); s = shiftInfo.coeff(0) - shiftInfo.coeff(2) / s; exshift += s; for (Index i = 0; i <= iu; ++i) m_matT.coeffRef(i,i) -= s; shiftInfo.setConstant(Scalar(0.964)); } } } /** \internal Compute index im at which Francis QR step starts and the first Householder vector. */ template inline void RealSchur::initFrancisQRStep(Index il, Index iu, const Vector3s& shiftInfo, Index& im, Vector3s& firstHouseholderVector) { using std::abs; Vector3s& v = firstHouseholderVector; // alias to save typing for (im = iu-2; im >= il; --im) { const Scalar Tmm = m_matT.coeff(im,im); const Scalar r = shiftInfo.coeff(0) - Tmm; const Scalar s = shiftInfo.coeff(1) - Tmm; v.coeffRef(0) = (r * s - shiftInfo.coeff(2)) / m_matT.coeff(im+1,im) + m_matT.coeff(im,im+1); v.coeffRef(1) = m_matT.coeff(im+1,im+1) - Tmm - r - s; v.coeffRef(2) = m_matT.coeff(im+2,im+1); if (im == il) { break; } const Scalar lhs = m_matT.coeff(im,im-1) * (abs(v.coeff(1)) + abs(v.coeff(2))); const Scalar rhs = v.coeff(0) * (abs(m_matT.coeff(im-1,im-1)) + abs(Tmm) + abs(m_matT.coeff(im+1,im+1))); if (abs(lhs) < NumTraits::epsilon() * rhs) break; } } /** \internal Perform a Francis QR step involving rows il:iu and columns im:iu. */ template inline void RealSchur::performFrancisQRStep(Index il, Index im, Index iu, bool computeU, const Vector3s& firstHouseholderVector, Scalar* workspace) { eigen_assert(im >= il); eigen_assert(im <= iu-2); const Index size = m_matT.cols(); for (Index k = im; k <= iu-2; ++k) { bool firstIteration = (k == im); Vector3s v; if (firstIteration) v = firstHouseholderVector; else v = m_matT.template block<3,1>(k,k-1); Scalar tau, beta; Matrix ess; v.makeHouseholder(ess, tau, beta); if (beta != Scalar(0)) // if v is not zero { if (firstIteration && k > il) m_matT.coeffRef(k,k-1) = -m_matT.coeff(k,k-1); else if (!firstIteration) m_matT.coeffRef(k,k-1) = beta; // These Householder transformations form the O(n^3) part of the algorithm m_matT.block(k, k, 3, size-k).applyHouseholderOnTheLeft(ess, tau, workspace); m_matT.block(0, k, (std::min)(iu,k+3) + 1, 3).applyHouseholderOnTheRight(ess, tau, workspace); if (computeU) m_matU.block(0, k, size, 3).applyHouseholderOnTheRight(ess, tau, workspace); } } Matrix v = m_matT.template block<2,1>(iu-1, iu-2); Scalar tau, beta; Matrix ess; v.makeHouseholder(ess, tau, beta); if (beta != Scalar(0)) // if v is not zero { m_matT.coeffRef(iu-1, iu-2) = beta; m_matT.block(iu-1, iu-1, 2, size-iu+1).applyHouseholderOnTheLeft(ess, tau, workspace); m_matT.block(0, iu-1, iu+1, 2).applyHouseholderOnTheRight(ess, tau, workspace); if (computeU) m_matU.block(0, iu-1, size, 2).applyHouseholderOnTheRight(ess, tau, workspace); } // clean up pollution due to round-off errors for (Index i = im+2; i <= iu; ++i) { m_matT.coeffRef(i,i-2) = Scalar(0); if (i > im+2) m_matT.coeffRef(i,i-3) = Scalar(0); } } } // end namespace Eigen #endif // EIGEN_REAL_SCHUR_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h ================================================ /* Copyright (c) 2011, Intel Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************** * Content : Eigen bindings to LAPACKe * Real Schur needed to real unsymmetrical eigenvalues/eigenvectors. ******************************************************************************** */ #ifndef EIGEN_REAL_SCHUR_LAPACKE_H #define EIGEN_REAL_SCHUR_LAPACKE_H namespace Eigen { /** \internal Specialization for the data types supported by LAPACKe */ #define EIGEN_LAPACKE_SCHUR_REAL(EIGTYPE, LAPACKE_TYPE, LAPACKE_PREFIX, LAPACKE_PREFIX_U, EIGCOLROW, LAPACKE_COLROW) \ template<> template inline \ RealSchur >& \ RealSchur >::compute(const EigenBase& matrix, bool computeU) \ { \ eigen_assert(matrix.cols() == matrix.rows()); \ \ lapack_int n = internal::convert_index(matrix.cols()), sdim, info; \ lapack_int matrix_order = LAPACKE_COLROW; \ char jobvs, sort='N'; \ LAPACK_##LAPACKE_PREFIX_U##_SELECT2 select = 0; \ jobvs = (computeU) ? 'V' : 'N'; \ m_matU.resize(n, n); \ lapack_int ldvs = internal::convert_index(m_matU.outerStride()); \ m_matT = matrix; \ lapack_int lda = internal::convert_index(m_matT.outerStride()); \ Matrix wr, wi; \ wr.resize(n, 1); wi.resize(n, 1); \ info = LAPACKE_##LAPACKE_PREFIX##gees( matrix_order, jobvs, sort, select, n, (LAPACKE_TYPE*)m_matT.data(), lda, &sdim, (LAPACKE_TYPE*)wr.data(), (LAPACKE_TYPE*)wi.data(), (LAPACKE_TYPE*)m_matU.data(), ldvs ); \ if(info == 0) \ m_info = Success; \ else \ m_info = NoConvergence; \ \ m_isInitialized = true; \ m_matUisUptodate = computeU; \ return *this; \ \ } EIGEN_LAPACKE_SCHUR_REAL(double, double, d, D, ColMajor, LAPACK_COL_MAJOR) EIGEN_LAPACKE_SCHUR_REAL(float, float, s, S, ColMajor, LAPACK_COL_MAJOR) EIGEN_LAPACKE_SCHUR_REAL(double, double, d, D, RowMajor, LAPACK_ROW_MAJOR) EIGEN_LAPACKE_SCHUR_REAL(float, float, s, S, RowMajor, LAPACK_ROW_MAJOR) } // end namespace Eigen #endif // EIGEN_REAL_SCHUR_LAPACKE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2010 Gael Guennebaud // Copyright (C) 2010 Jitse Niesen // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SELFADJOINTEIGENSOLVER_H #define EIGEN_SELFADJOINTEIGENSOLVER_H #include "./Tridiagonalization.h" namespace Eigen { template class GeneralizedSelfAdjointEigenSolver; namespace internal { template struct direct_selfadjoint_eigenvalues; template EIGEN_DEVICE_FUNC ComputationInfo computeFromTridiagonal_impl(DiagType& diag, SubDiagType& subdiag, const Index maxIterations, bool computeEigenvectors, MatrixType& eivec); } /** \eigenvalues_module \ingroup Eigenvalues_Module * * * \class SelfAdjointEigenSolver * * \brief Computes eigenvalues and eigenvectors of selfadjoint matrices * * \tparam MatrixType_ the type of the matrix of which we are computing the * eigendecomposition; this is expected to be an instantiation of the Matrix * class template. * * A matrix \f$ A \f$ is selfadjoint if it equals its adjoint. For real * matrices, this means that the matrix is symmetric: it equals its * transpose. This class computes the eigenvalues and eigenvectors of a * selfadjoint matrix. These are the scalars \f$ \lambda \f$ and vectors * \f$ v \f$ such that \f$ Av = \lambda v \f$. The eigenvalues of a * selfadjoint matrix are always real. If \f$ D \f$ is a diagonal matrix with * the eigenvalues on the diagonal, and \f$ V \f$ is a matrix with the * eigenvectors as its columns, then \f$ A = V D V^{-1} \f$. This is called the * eigendecomposition. * * For a selfadjoint matrix, \f$ V \f$ is unitary, meaning its inverse is equal * to its adjoint, \f$ V^{-1} = V^{\dagger} \f$. If \f$ A \f$ is real, then * \f$ V \f$ is also real and therefore orthogonal, meaning its inverse is * equal to its transpose, \f$ V^{-1} = V^T \f$. * * The algorithm exploits the fact that the matrix is selfadjoint, making it * faster and more accurate than the general purpose eigenvalue algorithms * implemented in EigenSolver and ComplexEigenSolver. * * Only the \b lower \b triangular \b part of the input matrix is referenced. * * Call the function compute() to compute the eigenvalues and eigenvectors of * a given matrix. Alternatively, you can use the * SelfAdjointEigenSolver(const MatrixType&, int) constructor which computes * the eigenvalues and eigenvectors at construction time. Once the eigenvalue * and eigenvectors are computed, they can be retrieved with the eigenvalues() * and eigenvectors() functions. * * The documentation for SelfAdjointEigenSolver(const MatrixType&, int) * contains an example of the typical use of this class. * * To solve the \em generalized eigenvalue problem \f$ Av = \lambda Bv \f$ and * the likes, see the class GeneralizedSelfAdjointEigenSolver. * * \sa MatrixBase::eigenvalues(), class EigenSolver, class ComplexEigenSolver */ template class SelfAdjointEigenSolver { public: typedef MatrixType_ MatrixType; enum { Size = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, Options = MatrixType::Options, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; /** \brief Scalar type for matrices of type \p MatrixType_. */ typedef typename MatrixType::Scalar Scalar; typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3 typedef Matrix EigenvectorsType; /** \brief Real scalar type for \p MatrixType_. * * This is just \c Scalar if #Scalar is real (e.g., \c float or * \c double), and the type of the real part of \c Scalar if #Scalar is * complex. */ typedef typename NumTraits::Real RealScalar; friend struct internal::direct_selfadjoint_eigenvalues::IsComplex>; /** \brief Type for vector of eigenvalues as returned by eigenvalues(). * * This is a column vector with entries of type #RealScalar. * The length of the vector is the size of \p MatrixType_. */ typedef typename internal::plain_col_type::type RealVectorType; typedef Tridiagonalization TridiagonalizationType; typedef typename TridiagonalizationType::SubDiagonalType SubDiagonalType; /** \brief Default constructor for fixed-size matrices. * * The default constructor is useful in cases in which the user intends to * perform decompositions via compute(). This constructor * can only be used if \p MatrixType_ is a fixed-size matrix; use * SelfAdjointEigenSolver(Index) for dynamic-size matrices. * * Example: \include SelfAdjointEigenSolver_SelfAdjointEigenSolver.cpp * Output: \verbinclude SelfAdjointEigenSolver_SelfAdjointEigenSolver.out */ EIGEN_DEVICE_FUNC SelfAdjointEigenSolver() : m_eivec(), m_eivalues(), m_subdiag(), m_hcoeffs(), m_info(InvalidInput), m_isInitialized(false), m_eigenvectorsOk(false) { } /** \brief Constructor, pre-allocates memory for dynamic-size matrices. * * \param [in] size Positive integer, size of the matrix whose * eigenvalues and eigenvectors will be computed. * * This constructor is useful for dynamic-size matrices, when the user * intends to perform decompositions via compute(). The \p size * parameter is only used as a hint. It is not an error to give a wrong * \p size, but it may impair performance. * * \sa compute() for an example */ EIGEN_DEVICE_FUNC explicit SelfAdjointEigenSolver(Index size) : m_eivec(size, size), m_eivalues(size), m_subdiag(size > 1 ? size - 1 : 1), m_hcoeffs(size > 1 ? size - 1 : 1), m_isInitialized(false), m_eigenvectorsOk(false) {} /** \brief Constructor; computes eigendecomposition of given matrix. * * \param[in] matrix Selfadjoint matrix whose eigendecomposition is to * be computed. Only the lower triangular part of the matrix is referenced. * \param[in] options Can be #ComputeEigenvectors (default) or #EigenvaluesOnly. * * This constructor calls compute(const MatrixType&, int) to compute the * eigenvalues of the matrix \p matrix. The eigenvectors are computed if * \p options equals #ComputeEigenvectors. * * Example: \include SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp * Output: \verbinclude SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.out * * \sa compute(const MatrixType&, int) */ template EIGEN_DEVICE_FUNC explicit SelfAdjointEigenSolver(const EigenBase& matrix, int options = ComputeEigenvectors) : m_eivec(matrix.rows(), matrix.cols()), m_eivalues(matrix.cols()), m_subdiag(matrix.rows() > 1 ? matrix.rows() - 1 : 1), m_hcoeffs(matrix.cols() > 1 ? matrix.cols() - 1 : 1), m_isInitialized(false), m_eigenvectorsOk(false) { compute(matrix.derived(), options); } /** \brief Computes eigendecomposition of given matrix. * * \param[in] matrix Selfadjoint matrix whose eigendecomposition is to * be computed. Only the lower triangular part of the matrix is referenced. * \param[in] options Can be #ComputeEigenvectors (default) or #EigenvaluesOnly. * \returns Reference to \c *this * * This function computes the eigenvalues of \p matrix. The eigenvalues() * function can be used to retrieve them. If \p options equals #ComputeEigenvectors, * then the eigenvectors are also computed and can be retrieved by * calling eigenvectors(). * * This implementation uses a symmetric QR algorithm. The matrix is first * reduced to tridiagonal form using the Tridiagonalization class. The * tridiagonal matrix is then brought to diagonal form with implicit * symmetric QR steps with Wilkinson shift. Details can be found in * Section 8.3 of Golub \& Van Loan, %Matrix Computations. * * The cost of the computation is about \f$ 9n^3 \f$ if the eigenvectors * are required and \f$ 4n^3/3 \f$ if they are not required. * * This method reuses the memory in the SelfAdjointEigenSolver object that * was allocated when the object was constructed, if the size of the * matrix does not change. * * Example: \include SelfAdjointEigenSolver_compute_MatrixType.cpp * Output: \verbinclude SelfAdjointEigenSolver_compute_MatrixType.out * * \sa SelfAdjointEigenSolver(const MatrixType&, int) */ template EIGEN_DEVICE_FUNC SelfAdjointEigenSolver& compute(const EigenBase& matrix, int options = ComputeEigenvectors); /** \brief Computes eigendecomposition of given matrix using a closed-form algorithm * * This is a variant of compute(const MatrixType&, int options) which * directly solves the underlying polynomial equation. * * Currently only 2x2 and 3x3 matrices for which the sizes are known at compile time are supported (e.g., Matrix3d). * * This method is usually significantly faster than the QR iterative algorithm * but it might also be less accurate. It is also worth noting that * for 3x3 matrices it involves trigonometric operations which are * not necessarily available for all scalar types. * * For the 3x3 case, we observed the following worst case relative error regarding the eigenvalues: * - double: 1e-8 * - float: 1e-3 * * \sa compute(const MatrixType&, int options) */ EIGEN_DEVICE_FUNC SelfAdjointEigenSolver& computeDirect(const MatrixType& matrix, int options = ComputeEigenvectors); /** *\brief Computes the eigen decomposition from a tridiagonal symmetric matrix * * \param[in] diag The vector containing the diagonal of the matrix. * \param[in] subdiag The subdiagonal of the matrix. * \param[in] options Can be #ComputeEigenvectors (default) or #EigenvaluesOnly. * \returns Reference to \c *this * * This function assumes that the matrix has been reduced to tridiagonal form. * * \sa compute(const MatrixType&, int) for more information */ SelfAdjointEigenSolver& computeFromTridiagonal(const RealVectorType& diag, const SubDiagonalType& subdiag , int options=ComputeEigenvectors); /** \brief Returns the eigenvectors of given matrix. * * \returns A const reference to the matrix whose columns are the eigenvectors. * * \pre The eigenvectors have been computed before. * * Column \f$ k \f$ of the returned matrix is an eigenvector corresponding * to eigenvalue number \f$ k \f$ as returned by eigenvalues(). The * eigenvectors are normalized to have (Euclidean) norm equal to one. If * this object was used to solve the eigenproblem for the selfadjoint * matrix \f$ A \f$, then the matrix returned by this function is the * matrix \f$ V \f$ in the eigendecomposition \f$ A = V D V^{-1} \f$. * * For a selfadjoint matrix, \f$ V \f$ is unitary, meaning its inverse is equal * to its adjoint, \f$ V^{-1} = V^{\dagger} \f$. If \f$ A \f$ is real, then * \f$ V \f$ is also real and therefore orthogonal, meaning its inverse is * equal to its transpose, \f$ V^{-1} = V^T \f$. * * Example: \include SelfAdjointEigenSolver_eigenvectors.cpp * Output: \verbinclude SelfAdjointEigenSolver_eigenvectors.out * * \sa eigenvalues() */ EIGEN_DEVICE_FUNC const EigenvectorsType& eigenvectors() const { eigen_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized."); eigen_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues."); return m_eivec; } /** \brief Returns the eigenvalues of given matrix. * * \returns A const reference to the column vector containing the eigenvalues. * * \pre The eigenvalues have been computed before. * * The eigenvalues are repeated according to their algebraic multiplicity, * so there are as many eigenvalues as rows in the matrix. The eigenvalues * are sorted in increasing order. * * Example: \include SelfAdjointEigenSolver_eigenvalues.cpp * Output: \verbinclude SelfAdjointEigenSolver_eigenvalues.out * * \sa eigenvectors(), MatrixBase::eigenvalues() */ EIGEN_DEVICE_FUNC const RealVectorType& eigenvalues() const { eigen_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized."); return m_eivalues; } /** \brief Computes the positive-definite square root of the matrix. * * \returns the positive-definite square root of the matrix * * \pre The eigenvalues and eigenvectors of a positive-definite matrix * have been computed before. * * The square root of a positive-definite matrix \f$ A \f$ is the * positive-definite matrix whose square equals \f$ A \f$. This function * uses the eigendecomposition \f$ A = V D V^{-1} \f$ to compute the * square root as \f$ A^{1/2} = V D^{1/2} V^{-1} \f$. * * Example: \include SelfAdjointEigenSolver_operatorSqrt.cpp * Output: \verbinclude SelfAdjointEigenSolver_operatorSqrt.out * * \sa operatorInverseSqrt(), MatrixFunctions Module */ EIGEN_DEVICE_FUNC MatrixType operatorSqrt() const { eigen_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized."); eigen_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues."); return m_eivec * m_eivalues.cwiseSqrt().asDiagonal() * m_eivec.adjoint(); } /** \brief Computes the inverse square root of the matrix. * * \returns the inverse positive-definite square root of the matrix * * \pre The eigenvalues and eigenvectors of a positive-definite matrix * have been computed before. * * This function uses the eigendecomposition \f$ A = V D V^{-1} \f$ to * compute the inverse square root as \f$ V D^{-1/2} V^{-1} \f$. This is * cheaper than first computing the square root with operatorSqrt() and * then its inverse with MatrixBase::inverse(). * * Example: \include SelfAdjointEigenSolver_operatorInverseSqrt.cpp * Output: \verbinclude SelfAdjointEigenSolver_operatorInverseSqrt.out * * \sa operatorSqrt(), MatrixBase::inverse(), MatrixFunctions Module */ EIGEN_DEVICE_FUNC MatrixType operatorInverseSqrt() const { eigen_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized."); eigen_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues."); return m_eivec * m_eivalues.cwiseInverse().cwiseSqrt().asDiagonal() * m_eivec.adjoint(); } /** \brief Reports whether previous computation was successful. * * \returns \c Success if computation was successful, \c NoConvergence otherwise. */ EIGEN_DEVICE_FUNC ComputationInfo info() const { eigen_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized."); return m_info; } /** \brief Maximum number of iterations. * * The algorithm terminates if it does not converge within m_maxIterations * n iterations, where n * denotes the size of the matrix. This value is currently set to 30 (copied from LAPACK). */ static const int m_maxIterations = 30; protected: static EIGEN_DEVICE_FUNC void check_template_parameters() { EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); } EigenvectorsType m_eivec; RealVectorType m_eivalues; typename TridiagonalizationType::SubDiagonalType m_subdiag; typename TridiagonalizationType::CoeffVectorType m_hcoeffs; ComputationInfo m_info; bool m_isInitialized; bool m_eigenvectorsOk; }; namespace internal { /** \internal * * \eigenvalues_module \ingroup Eigenvalues_Module * * Performs a QR step on a tridiagonal symmetric matrix represented as a * pair of two vectors \a diag and \a subdiag. * * \param diag the diagonal part of the input selfadjoint tridiagonal matrix * \param subdiag the sub-diagonal part of the input selfadjoint tridiagonal matrix * \param start starting index of the submatrix to work on * \param end last+1 index of the submatrix to work on * \param matrixQ pointer to the column-major matrix holding the eigenvectors, can be 0 * \param n size of the input matrix * * For compilation efficiency reasons, this procedure does not use eigen expression * for its arguments. * * Implemented from Golub's "Matrix Computations", algorithm 8.3.2: * "implicit symmetric QR step with Wilkinson shift" */ template EIGEN_DEVICE_FUNC static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index start, Index end, Scalar* matrixQ, Index n); } template template EIGEN_DEVICE_FUNC SelfAdjointEigenSolver& SelfAdjointEigenSolver ::compute(const EigenBase& a_matrix, int options) { check_template_parameters(); const InputType &matrix(a_matrix.derived()); EIGEN_USING_STD(abs); eigen_assert(matrix.cols() == matrix.rows()); eigen_assert((options&~(EigVecMask|GenEigMask))==0 && (options&EigVecMask)!=EigVecMask && "invalid option parameter"); bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors; Index n = matrix.cols(); m_eivalues.resize(n,1); if(n==1) { m_eivec = matrix; m_eivalues.coeffRef(0,0) = numext::real(m_eivec.coeff(0,0)); if(computeEigenvectors) m_eivec.setOnes(n,n); m_info = Success; m_isInitialized = true; m_eigenvectorsOk = computeEigenvectors; return *this; } // declare some aliases RealVectorType& diag = m_eivalues; EigenvectorsType& mat = m_eivec; // map the matrix coefficients to [-1:1] to avoid over- and underflow. mat = matrix.template triangularView(); RealScalar scale = mat.cwiseAbs().maxCoeff(); if(scale==RealScalar(0)) scale = RealScalar(1); mat.template triangularView() /= scale; m_subdiag.resize(n-1); m_hcoeffs.resize(n-1); internal::tridiagonalization_inplace(mat, diag, m_subdiag, m_hcoeffs, computeEigenvectors); m_info = internal::computeFromTridiagonal_impl(diag, m_subdiag, m_maxIterations, computeEigenvectors, m_eivec); // scale back the eigen values m_eivalues *= scale; m_isInitialized = true; m_eigenvectorsOk = computeEigenvectors; return *this; } template SelfAdjointEigenSolver& SelfAdjointEigenSolver ::computeFromTridiagonal(const RealVectorType& diag, const SubDiagonalType& subdiag , int options) { //TODO : Add an option to scale the values beforehand bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors; m_eivalues = diag; m_subdiag = subdiag; if (computeEigenvectors) { m_eivec.setIdentity(diag.size(), diag.size()); } m_info = internal::computeFromTridiagonal_impl(m_eivalues, m_subdiag, m_maxIterations, computeEigenvectors, m_eivec); m_isInitialized = true; m_eigenvectorsOk = computeEigenvectors; return *this; } namespace internal { /** * \internal * \brief Compute the eigendecomposition from a tridiagonal matrix * * \param[in,out] diag : On input, the diagonal of the matrix, on output the eigenvalues * \param[in,out] subdiag : The subdiagonal part of the matrix (entries are modified during the decomposition) * \param[in] maxIterations : the maximum number of iterations * \param[in] computeEigenvectors : whether the eigenvectors have to be computed or not * \param[out] eivec : The matrix to store the eigenvectors if computeEigenvectors==true. Must be allocated on input. * \returns \c Success or \c NoConvergence */ template EIGEN_DEVICE_FUNC ComputationInfo computeFromTridiagonal_impl(DiagType& diag, SubDiagType& subdiag, const Index maxIterations, bool computeEigenvectors, MatrixType& eivec) { ComputationInfo info; typedef typename MatrixType::Scalar Scalar; Index n = diag.size(); Index end = n-1; Index start = 0; Index iter = 0; // total number of iterations typedef typename DiagType::RealScalar RealScalar; const RealScalar considerAsZero = (std::numeric_limits::min)(); const RealScalar precision_inv = RealScalar(1)/NumTraits::epsilon(); while (end>0) { for (Index i = start; i0 && subdiag[end-1]==RealScalar(0)) { end--; } if (end<=0) break; // if we spent too many iterations, we give up iter++; if(iter > maxIterations * n) break; start = end - 1; while (start>0 && subdiag[start-1]!=0) start--; internal::tridiagonal_qr_step(diag.data(), subdiag.data(), start, end, computeEigenvectors ? eivec.data() : (Scalar*)0, n); } if (iter <= maxIterations * n) info = Success; else info = NoConvergence; // Sort eigenvalues and corresponding vectors. // TODO make the sort optional ? // TODO use a better sort algorithm !! if (info == Success) { for (Index i = 0; i < n-1; ++i) { Index k; diag.segment(i,n-i).minCoeff(&k); if (k > 0) { numext::swap(diag[i], diag[k+i]); if(computeEigenvectors) eivec.col(i).swap(eivec.col(k+i)); } } } return info; } template struct direct_selfadjoint_eigenvalues { EIGEN_DEVICE_FUNC static inline void run(SolverType& eig, const typename SolverType::MatrixType& A, int options) { eig.compute(A,options); } }; template struct direct_selfadjoint_eigenvalues { typedef typename SolverType::MatrixType MatrixType; typedef typename SolverType::RealVectorType VectorType; typedef typename SolverType::Scalar Scalar; typedef typename SolverType::EigenvectorsType EigenvectorsType; /** \internal * Computes the roots of the characteristic polynomial of \a m. * For numerical stability m.trace() should be near zero and to avoid over- or underflow m should be normalized. */ EIGEN_DEVICE_FUNC static inline void computeRoots(const MatrixType& m, VectorType& roots) { EIGEN_USING_STD(sqrt) EIGEN_USING_STD(atan2) EIGEN_USING_STD(cos) EIGEN_USING_STD(sin) const Scalar s_inv3 = Scalar(1)/Scalar(3); const Scalar s_sqrt3 = sqrt(Scalar(3)); // The characteristic equation is x^3 - c2*x^2 + c1*x - c0 = 0. The // eigenvalues are the roots to this equation, all guaranteed to be // real-valued, because the matrix is symmetric. Scalar c0 = m(0,0)*m(1,1)*m(2,2) + Scalar(2)*m(1,0)*m(2,0)*m(2,1) - m(0,0)*m(2,1)*m(2,1) - m(1,1)*m(2,0)*m(2,0) - m(2,2)*m(1,0)*m(1,0); Scalar c1 = m(0,0)*m(1,1) - m(1,0)*m(1,0) + m(0,0)*m(2,2) - m(2,0)*m(2,0) + m(1,1)*m(2,2) - m(2,1)*m(2,1); Scalar c2 = m(0,0) + m(1,1) + m(2,2); // Construct the parameters used in classifying the roots of the equation // and in solving the equation for the roots in closed form. Scalar c2_over_3 = c2*s_inv3; Scalar a_over_3 = (c2*c2_over_3 - c1)*s_inv3; a_over_3 = numext::maxi(a_over_3, Scalar(0)); Scalar half_b = Scalar(0.5)*(c0 + c2_over_3*(Scalar(2)*c2_over_3*c2_over_3 - c1)); Scalar q = a_over_3*a_over_3*a_over_3 - half_b*half_b; q = numext::maxi(q, Scalar(0)); // Compute the eigenvalues by solving for the roots of the polynomial. Scalar rho = sqrt(a_over_3); Scalar theta = atan2(sqrt(q),half_b)*s_inv3; // since sqrt(q) > 0, atan2 is in [0, pi] and theta is in [0, pi/3] Scalar cos_theta = cos(theta); Scalar sin_theta = sin(theta); // roots are already sorted, since cos is monotonically decreasing on [0, pi] roots(0) = c2_over_3 - rho*(cos_theta + s_sqrt3*sin_theta); // == 2*rho*cos(theta+2pi/3) roots(1) = c2_over_3 - rho*(cos_theta - s_sqrt3*sin_theta); // == 2*rho*cos(theta+ pi/3) roots(2) = c2_over_3 + Scalar(2)*rho*cos_theta; } EIGEN_DEVICE_FUNC static inline bool extract_kernel(MatrixType& mat, Ref res, Ref representative) { EIGEN_USING_STD(abs); EIGEN_USING_STD(sqrt); Index i0; // Find non-zero column i0 (by construction, there must exist a non zero coefficient on the diagonal): mat.diagonal().cwiseAbs().maxCoeff(&i0); // mat.col(i0) is a good candidate for an orthogonal vector to the current eigenvector, // so let's save it: representative = mat.col(i0); Scalar n0, n1; VectorType c0, c1; n0 = (c0 = representative.cross(mat.col((i0+1)%3))).squaredNorm(); n1 = (c1 = representative.cross(mat.col((i0+2)%3))).squaredNorm(); if(n0>n1) res = c0/sqrt(n0); else res = c1/sqrt(n1); return true; } EIGEN_DEVICE_FUNC static inline void run(SolverType& solver, const MatrixType& mat, int options) { eigen_assert(mat.cols() == 3 && mat.cols() == mat.rows()); eigen_assert((options&~(EigVecMask|GenEigMask))==0 && (options&EigVecMask)!=EigVecMask && "invalid option parameter"); bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors; EigenvectorsType& eivecs = solver.m_eivec; VectorType& eivals = solver.m_eivalues; // Shift the matrix to the mean eigenvalue and map the matrix coefficients to [-1:1] to avoid over- and underflow. Scalar shift = mat.trace() / Scalar(3); // TODO Avoid this copy. Currently it is necessary to suppress bogus values when determining maxCoeff and for computing the eigenvectors later MatrixType scaledMat = mat.template selfadjointView(); scaledMat.diagonal().array() -= shift; Scalar scale = scaledMat.cwiseAbs().maxCoeff(); if(scale > 0) scaledMat /= scale; // TODO for scale==0 we could save the remaining operations // compute the eigenvalues computeRoots(scaledMat,eivals); // compute the eigenvectors if(computeEigenvectors) { if((eivals(2)-eivals(0))<=Eigen::NumTraits::epsilon()) { // All three eigenvalues are numerically the same eivecs.setIdentity(); } else { MatrixType tmp; tmp = scaledMat; // Compute the eigenvector of the most distinct eigenvalue Scalar d0 = eivals(2) - eivals(1); Scalar d1 = eivals(1) - eivals(0); Index k(0), l(2); if(d0 > d1) { numext::swap(k,l); d0 = d1; } // Compute the eigenvector of index k { tmp.diagonal().array () -= eivals(k); // By construction, 'tmp' is of rank 2, and its kernel corresponds to the respective eigenvector. extract_kernel(tmp, eivecs.col(k), eivecs.col(l)); } // Compute eigenvector of index l if(d0<=2*Eigen::NumTraits::epsilon()*d1) { // If d0 is too small, then the two other eigenvalues are numerically the same, // and thus we only have to ortho-normalize the near orthogonal vector we saved above. eivecs.col(l) -= eivecs.col(k).dot(eivecs.col(l))*eivecs.col(l); eivecs.col(l).normalize(); } else { tmp = scaledMat; tmp.diagonal().array () -= eivals(l); VectorType dummy; extract_kernel(tmp, eivecs.col(l), dummy); } // Compute last eigenvector from the other two eivecs.col(1) = eivecs.col(2).cross(eivecs.col(0)).normalized(); } } // Rescale back to the original size. eivals *= scale; eivals.array() += shift; solver.m_info = Success; solver.m_isInitialized = true; solver.m_eigenvectorsOk = computeEigenvectors; } }; // 2x2 direct eigenvalues decomposition, code from Hauke Heibel template struct direct_selfadjoint_eigenvalues { typedef typename SolverType::MatrixType MatrixType; typedef typename SolverType::RealVectorType VectorType; typedef typename SolverType::Scalar Scalar; typedef typename SolverType::EigenvectorsType EigenvectorsType; EIGEN_DEVICE_FUNC static inline void computeRoots(const MatrixType& m, VectorType& roots) { EIGEN_USING_STD(sqrt); const Scalar t0 = Scalar(0.5) * sqrt( numext::abs2(m(0,0)-m(1,1)) + Scalar(4)*numext::abs2(m(1,0))); const Scalar t1 = Scalar(0.5) * (m(0,0) + m(1,1)); roots(0) = t1 - t0; roots(1) = t1 + t0; } EIGEN_DEVICE_FUNC static inline void run(SolverType& solver, const MatrixType& mat, int options) { EIGEN_USING_STD(sqrt); EIGEN_USING_STD(abs); eigen_assert(mat.cols() == 2 && mat.cols() == mat.rows()); eigen_assert((options&~(EigVecMask|GenEigMask))==0 && (options&EigVecMask)!=EigVecMask && "invalid option parameter"); bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors; EigenvectorsType& eivecs = solver.m_eivec; VectorType& eivals = solver.m_eivalues; // Shift the matrix to the mean eigenvalue and map the matrix coefficients to [-1:1] to avoid over- and underflow. Scalar shift = mat.trace() / Scalar(2); MatrixType scaledMat = mat; scaledMat.coeffRef(0,1) = mat.coeff(1,0); scaledMat.diagonal().array() -= shift; Scalar scale = scaledMat.cwiseAbs().maxCoeff(); if(scale > Scalar(0)) scaledMat /= scale; // Compute the eigenvalues computeRoots(scaledMat,eivals); // compute the eigen vectors if(computeEigenvectors) { if((eivals(1)-eivals(0))<=abs(eivals(1))*Eigen::NumTraits::epsilon()) { eivecs.setIdentity(); } else { scaledMat.diagonal().array () -= eivals(1); Scalar a2 = numext::abs2(scaledMat(0,0)); Scalar c2 = numext::abs2(scaledMat(1,1)); Scalar b2 = numext::abs2(scaledMat(1,0)); if(a2>c2) { eivecs.col(1) << -scaledMat(1,0), scaledMat(0,0); eivecs.col(1) /= sqrt(a2+b2); } else { eivecs.col(1) << -scaledMat(1,1), scaledMat(1,0); eivecs.col(1) /= sqrt(c2+b2); } eivecs.col(0) << eivecs.col(1).unitOrthogonal(); } } // Rescale back to the original size. eivals *= scale; eivals.array() += shift; solver.m_info = Success; solver.m_isInitialized = true; solver.m_eigenvectorsOk = computeEigenvectors; } }; } template EIGEN_DEVICE_FUNC SelfAdjointEigenSolver& SelfAdjointEigenSolver ::computeDirect(const MatrixType& matrix, int options) { internal::direct_selfadjoint_eigenvalues::IsComplex>::run(*this,matrix,options); return *this; } namespace internal { // Francis implicit QR step. template EIGEN_DEVICE_FUNC static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index start, Index end, Scalar* matrixQ, Index n) { // Wilkinson Shift. RealScalar td = (diag[end-1] - diag[end])*RealScalar(0.5); RealScalar e = subdiag[end-1]; // Note that thanks to scaling, e^2 or td^2 cannot overflow, however they can still // underflow thus leading to inf/NaN values when using the following commented code: // RealScalar e2 = numext::abs2(subdiag[end-1]); // RealScalar mu = diag[end] - e2 / (td + (td>0 ? 1 : -1) * sqrt(td*td + e2)); // This explain the following, somewhat more complicated, version: RealScalar mu = diag[end]; if(td==RealScalar(0)) { mu -= numext::abs(e); } else if (e != RealScalar(0)) { const RealScalar e2 = numext::abs2(e); const RealScalar h = numext::hypot(td,e); if(e2 == RealScalar(0)) { mu -= e / ((td + (td>RealScalar(0) ? h : -h)) / e); } else { mu -= e2 / (td + (td>RealScalar(0) ? h : -h)); } } RealScalar x = diag[start] - mu; RealScalar z = subdiag[start]; // If z ever becomes zero, the Givens rotation will be the identity and // z will stay zero for all future iterations. for (Index k = start; k < end && z != RealScalar(0); ++k) { JacobiRotation rot; rot.makeGivens(x, z); // do T = G' T G RealScalar sdk = rot.s() * diag[k] + rot.c() * subdiag[k]; RealScalar dkp1 = rot.s() * subdiag[k] + rot.c() * diag[k+1]; diag[k] = rot.c() * (rot.c() * diag[k] - rot.s() * subdiag[k]) - rot.s() * (rot.c() * subdiag[k] - rot.s() * diag[k+1]); diag[k+1] = rot.s() * sdk + rot.c() * dkp1; subdiag[k] = rot.c() * sdk - rot.s() * dkp1; if (k > start) subdiag[k - 1] = rot.c() * subdiag[k-1] - rot.s() * z; // "Chasing the bulge" to return to triangular form. x = subdiag[k]; if (k < end - 1) { z = -rot.s() * subdiag[k+1]; subdiag[k + 1] = rot.c() * subdiag[k+1]; } // apply the givens rotation to the unit matrix Q = Q * G if (matrixQ) { // FIXME if StorageOrder == RowMajor this operation is not very efficient Map > q(matrixQ,n,n); q.applyOnTheRight(k,k+1,rot); } } } } // end namespace internal } // end namespace Eigen #endif // EIGEN_SELFADJOINTEIGENSOLVER_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h ================================================ /* Copyright (c) 2011, Intel Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************** * Content : Eigen bindings to LAPACKe * Self-adjoint eigenvalues/eigenvectors. ******************************************************************************** */ #ifndef EIGEN_SAEIGENSOLVER_LAPACKE_H #define EIGEN_SAEIGENSOLVER_LAPACKE_H namespace Eigen { /** \internal Specialization for the data types supported by LAPACKe */ #define EIGEN_LAPACKE_EIG_SELFADJ_2(EIGTYPE, LAPACKE_TYPE, LAPACKE_RTYPE, LAPACKE_NAME, EIGCOLROW ) \ template<> template inline \ SelfAdjointEigenSolver >& \ SelfAdjointEigenSolver >::compute(const EigenBase& matrix, int options) \ { \ eigen_assert(matrix.cols() == matrix.rows()); \ eigen_assert((options&~(EigVecMask|GenEigMask))==0 \ && (options&EigVecMask)!=EigVecMask \ && "invalid option parameter"); \ bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors; \ lapack_int n = internal::convert_index(matrix.cols()), lda, info; \ m_eivalues.resize(n,1); \ m_subdiag.resize(n-1); \ m_eivec = matrix; \ \ if(n==1) \ { \ m_eivalues.coeffRef(0,0) = numext::real(m_eivec.coeff(0,0)); \ if(computeEigenvectors) m_eivec.setOnes(n,n); \ m_info = Success; \ m_isInitialized = true; \ m_eigenvectorsOk = computeEigenvectors; \ return *this; \ } \ \ lda = internal::convert_index(m_eivec.outerStride()); \ char jobz, uplo='L'/*, range='A'*/; \ jobz = computeEigenvectors ? 'V' : 'N'; \ \ info = LAPACKE_##LAPACKE_NAME( LAPACK_COL_MAJOR, jobz, uplo, n, (LAPACKE_TYPE*)m_eivec.data(), lda, (LAPACKE_RTYPE*)m_eivalues.data() ); \ m_info = (info==0) ? Success : NoConvergence; \ m_isInitialized = true; \ m_eigenvectorsOk = computeEigenvectors; \ return *this; \ } #define EIGEN_LAPACKE_EIG_SELFADJ(EIGTYPE, LAPACKE_TYPE, LAPACKE_RTYPE, LAPACKE_NAME ) \ EIGEN_LAPACKE_EIG_SELFADJ_2(EIGTYPE, LAPACKE_TYPE, LAPACKE_RTYPE, LAPACKE_NAME, ColMajor ) \ EIGEN_LAPACKE_EIG_SELFADJ_2(EIGTYPE, LAPACKE_TYPE, LAPACKE_RTYPE, LAPACKE_NAME, RowMajor ) EIGEN_LAPACKE_EIG_SELFADJ(double, double, double, dsyev) EIGEN_LAPACKE_EIG_SELFADJ(float, float, float, ssyev) EIGEN_LAPACKE_EIG_SELFADJ(dcomplex, lapack_complex_double, double, zheev) EIGEN_LAPACKE_EIG_SELFADJ(scomplex, lapack_complex_float, float, cheev) } // end namespace Eigen #endif // EIGEN_SAEIGENSOLVER_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // Copyright (C) 2010 Jitse Niesen // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_TRIDIAGONALIZATION_H #define EIGEN_TRIDIAGONALIZATION_H namespace Eigen { namespace internal { template struct TridiagonalizationMatrixTReturnType; template struct traits > : public traits { typedef typename MatrixType::PlainObject ReturnType; // FIXME shall it be a BandMatrix? enum { Flags = 0 }; }; template EIGEN_DEVICE_FUNC void tridiagonalization_inplace(MatrixType& matA, CoeffVectorType& hCoeffs); } /** \eigenvalues_module \ingroup Eigenvalues_Module * * * \class Tridiagonalization * * \brief Tridiagonal decomposition of a selfadjoint matrix * * \tparam MatrixType_ the type of the matrix of which we are computing the * tridiagonal decomposition; this is expected to be an instantiation of the * Matrix class template. * * This class performs a tridiagonal decomposition of a selfadjoint matrix \f$ A \f$ such that: * \f$ A = Q T Q^* \f$ where \f$ Q \f$ is unitary and \f$ T \f$ a real symmetric tridiagonal matrix. * * A tridiagonal matrix is a matrix which has nonzero elements only on the * main diagonal and the first diagonal below and above it. The Hessenberg * decomposition of a selfadjoint matrix is in fact a tridiagonal * decomposition. This class is used in SelfAdjointEigenSolver to compute the * eigenvalues and eigenvectors of a selfadjoint matrix. * * Call the function compute() to compute the tridiagonal decomposition of a * given matrix. Alternatively, you can use the Tridiagonalization(const MatrixType&) * constructor which computes the tridiagonal Schur decomposition at * construction time. Once the decomposition is computed, you can use the * matrixQ() and matrixT() functions to retrieve the matrices Q and T in the * decomposition. * * The documentation of Tridiagonalization(const MatrixType&) contains an * example of the typical use of this class. * * \sa class HessenbergDecomposition, class SelfAdjointEigenSolver */ template class Tridiagonalization { public: /** \brief Synonym for the template parameter \p MatrixType_. */ typedef MatrixType_ MatrixType; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3 enum { Size = MatrixType::RowsAtCompileTime, SizeMinusOne = Size == Dynamic ? Dynamic : (Size > 1 ? Size - 1 : 1), Options = MatrixType::Options, MaxSize = MatrixType::MaxRowsAtCompileTime, MaxSizeMinusOne = MaxSize == Dynamic ? Dynamic : (MaxSize > 1 ? MaxSize - 1 : 1) }; typedef Matrix CoeffVectorType; typedef typename internal::plain_col_type::type DiagonalType; typedef Matrix SubDiagonalType; typedef typename internal::remove_all::type MatrixTypeRealView; typedef internal::TridiagonalizationMatrixTReturnType MatrixTReturnType; typedef typename internal::conditional::IsComplex, typename internal::add_const_on_value_type::RealReturnType>::type, const Diagonal >::type DiagonalReturnType; typedef typename internal::conditional::IsComplex, typename internal::add_const_on_value_type::RealReturnType>::type, const Diagonal >::type SubDiagonalReturnType; /** \brief Return type of matrixQ() */ typedef HouseholderSequence::type> HouseholderSequenceType; /** \brief Default constructor. * * \param [in] size Positive integer, size of the matrix whose tridiagonal * decomposition will be computed. * * The default constructor is useful in cases in which the user intends to * perform decompositions via compute(). The \p size parameter is only * used as a hint. It is not an error to give a wrong \p size, but it may * impair performance. * * \sa compute() for an example. */ explicit Tridiagonalization(Index size = Size==Dynamic ? 2 : Size) : m_matrix(size,size), m_hCoeffs(size > 1 ? size-1 : 1), m_isInitialized(false) {} /** \brief Constructor; computes tridiagonal decomposition of given matrix. * * \param[in] matrix Selfadjoint matrix whose tridiagonal decomposition * is to be computed. * * This constructor calls compute() to compute the tridiagonal decomposition. * * Example: \include Tridiagonalization_Tridiagonalization_MatrixType.cpp * Output: \verbinclude Tridiagonalization_Tridiagonalization_MatrixType.out */ template explicit Tridiagonalization(const EigenBase& matrix) : m_matrix(matrix.derived()), m_hCoeffs(matrix.cols() > 1 ? matrix.cols()-1 : 1), m_isInitialized(false) { internal::tridiagonalization_inplace(m_matrix, m_hCoeffs); m_isInitialized = true; } /** \brief Computes tridiagonal decomposition of given matrix. * * \param[in] matrix Selfadjoint matrix whose tridiagonal decomposition * is to be computed. * \returns Reference to \c *this * * The tridiagonal decomposition is computed by bringing the columns of * the matrix successively in the required form using Householder * reflections. The cost is \f$ 4n^3/3 \f$ flops, where \f$ n \f$ denotes * the size of the given matrix. * * This method reuses of the allocated data in the Tridiagonalization * object, if the size of the matrix does not change. * * Example: \include Tridiagonalization_compute.cpp * Output: \verbinclude Tridiagonalization_compute.out */ template Tridiagonalization& compute(const EigenBase& matrix) { m_matrix = matrix.derived(); m_hCoeffs.resize(matrix.rows()-1, 1); internal::tridiagonalization_inplace(m_matrix, m_hCoeffs); m_isInitialized = true; return *this; } /** \brief Returns the Householder coefficients. * * \returns a const reference to the vector of Householder coefficients * * \pre Either the constructor Tridiagonalization(const MatrixType&) or * the member function compute(const MatrixType&) has been called before * to compute the tridiagonal decomposition of a matrix. * * The Householder coefficients allow the reconstruction of the matrix * \f$ Q \f$ in the tridiagonal decomposition from the packed data. * * Example: \include Tridiagonalization_householderCoefficients.cpp * Output: \verbinclude Tridiagonalization_householderCoefficients.out * * \sa packedMatrix(), \ref Householder_Module "Householder module" */ inline CoeffVectorType householderCoefficients() const { eigen_assert(m_isInitialized && "Tridiagonalization is not initialized."); return m_hCoeffs; } /** \brief Returns the internal representation of the decomposition * * \returns a const reference to a matrix with the internal representation * of the decomposition. * * \pre Either the constructor Tridiagonalization(const MatrixType&) or * the member function compute(const MatrixType&) has been called before * to compute the tridiagonal decomposition of a matrix. * * The returned matrix contains the following information: * - the strict upper triangular part is equal to the input matrix A. * - the diagonal and lower sub-diagonal represent the real tridiagonal * symmetric matrix T. * - the rest of the lower part contains the Householder vectors that, * combined with Householder coefficients returned by * householderCoefficients(), allows to reconstruct the matrix Q as * \f$ Q = H_{N-1} \ldots H_1 H_0 \f$. * Here, the matrices \f$ H_i \f$ are the Householder transformations * \f$ H_i = (I - h_i v_i v_i^T) \f$ * where \f$ h_i \f$ is the \f$ i \f$th Householder coefficient and * \f$ v_i \f$ is the Householder vector defined by * \f$ v_i = [ 0, \ldots, 0, 1, M(i+2,i), \ldots, M(N-1,i) ]^T \f$ * with M the matrix returned by this function. * * See LAPACK for further details on this packed storage. * * Example: \include Tridiagonalization_packedMatrix.cpp * Output: \verbinclude Tridiagonalization_packedMatrix.out * * \sa householderCoefficients() */ inline const MatrixType& packedMatrix() const { eigen_assert(m_isInitialized && "Tridiagonalization is not initialized."); return m_matrix; } /** \brief Returns the unitary matrix Q in the decomposition * * \returns object representing the matrix Q * * \pre Either the constructor Tridiagonalization(const MatrixType&) or * the member function compute(const MatrixType&) has been called before * to compute the tridiagonal decomposition of a matrix. * * This function returns a light-weight object of template class * HouseholderSequence. You can either apply it directly to a matrix or * you can convert it to a matrix of type #MatrixType. * * \sa Tridiagonalization(const MatrixType&) for an example, * matrixT(), class HouseholderSequence */ HouseholderSequenceType matrixQ() const { eigen_assert(m_isInitialized && "Tridiagonalization is not initialized."); return HouseholderSequenceType(m_matrix, m_hCoeffs.conjugate()) .setLength(m_matrix.rows() - 1) .setShift(1); } /** \brief Returns an expression of the tridiagonal matrix T in the decomposition * * \returns expression object representing the matrix T * * \pre Either the constructor Tridiagonalization(const MatrixType&) or * the member function compute(const MatrixType&) has been called before * to compute the tridiagonal decomposition of a matrix. * * Currently, this function can be used to extract the matrix T from internal * data and copy it to a dense matrix object. In most cases, it may be * sufficient to directly use the packed matrix or the vector expressions * returned by diagonal() and subDiagonal() instead of creating a new * dense copy matrix with this function. * * \sa Tridiagonalization(const MatrixType&) for an example, * matrixQ(), packedMatrix(), diagonal(), subDiagonal() */ MatrixTReturnType matrixT() const { eigen_assert(m_isInitialized && "Tridiagonalization is not initialized."); return MatrixTReturnType(m_matrix.real()); } /** \brief Returns the diagonal of the tridiagonal matrix T in the decomposition. * * \returns expression representing the diagonal of T * * \pre Either the constructor Tridiagonalization(const MatrixType&) or * the member function compute(const MatrixType&) has been called before * to compute the tridiagonal decomposition of a matrix. * * Example: \include Tridiagonalization_diagonal.cpp * Output: \verbinclude Tridiagonalization_diagonal.out * * \sa matrixT(), subDiagonal() */ DiagonalReturnType diagonal() const; /** \brief Returns the subdiagonal of the tridiagonal matrix T in the decomposition. * * \returns expression representing the subdiagonal of T * * \pre Either the constructor Tridiagonalization(const MatrixType&) or * the member function compute(const MatrixType&) has been called before * to compute the tridiagonal decomposition of a matrix. * * \sa diagonal() for an example, matrixT() */ SubDiagonalReturnType subDiagonal() const; protected: MatrixType m_matrix; CoeffVectorType m_hCoeffs; bool m_isInitialized; }; template typename Tridiagonalization::DiagonalReturnType Tridiagonalization::diagonal() const { eigen_assert(m_isInitialized && "Tridiagonalization is not initialized."); return m_matrix.diagonal().real(); } template typename Tridiagonalization::SubDiagonalReturnType Tridiagonalization::subDiagonal() const { eigen_assert(m_isInitialized && "Tridiagonalization is not initialized."); return m_matrix.template diagonal<-1>().real(); } namespace internal { /** \internal * Performs a tridiagonal decomposition of the selfadjoint matrix \a matA in-place. * * \param[in,out] matA On input the selfadjoint matrix. Only the \b lower triangular part is referenced. * On output, the strict upper part is left unchanged, and the lower triangular part * represents the T and Q matrices in packed format has detailed below. * \param[out] hCoeffs returned Householder coefficients (see below) * * On output, the tridiagonal selfadjoint matrix T is stored in the diagonal * and lower sub-diagonal of the matrix \a matA. * The unitary matrix Q is represented in a compact way as a product of * Householder reflectors \f$ H_i \f$ such that: * \f$ Q = H_{N-1} \ldots H_1 H_0 \f$. * The Householder reflectors are defined as * \f$ H_i = (I - h_i v_i v_i^T) \f$ * where \f$ h_i = hCoeffs[i]\f$ is the \f$ i \f$th Householder coefficient and * \f$ v_i \f$ is the Householder vector defined by * \f$ v_i = [ 0, \ldots, 0, 1, matA(i+2,i), \ldots, matA(N-1,i) ]^T \f$. * * Implemented from Golub's "Matrix Computations", algorithm 8.3.1. * * \sa Tridiagonalization::packedMatrix() */ template EIGEN_DEVICE_FUNC void tridiagonalization_inplace(MatrixType& matA, CoeffVectorType& hCoeffs) { using numext::conj; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; Index n = matA.rows(); eigen_assert(n==matA.cols()); eigen_assert(n==hCoeffs.size()+1 || n==1); for (Index i = 0; i() * (conj(h) * matA.col(i).tail(remainingSize))); hCoeffs.tail(n-i-1) += (conj(h)*RealScalar(-0.5)*(hCoeffs.tail(remainingSize).dot(matA.col(i).tail(remainingSize)))) * matA.col(i).tail(n-i-1); matA.bottomRightCorner(remainingSize, remainingSize).template selfadjointView() .rankUpdate(matA.col(i).tail(remainingSize), hCoeffs.tail(remainingSize), Scalar(-1)); matA.col(i).coeffRef(i+1) = beta; hCoeffs.coeffRef(i) = h; } } // forward declaration, implementation at the end of this file template::IsComplex> struct tridiagonalization_inplace_selector; /** \brief Performs a full tridiagonalization in place * * \param[in,out] mat On input, the selfadjoint matrix whose tridiagonal * decomposition is to be computed. Only the lower triangular part referenced. * The rest is left unchanged. On output, the orthogonal matrix Q * in the decomposition if \p extractQ is true. * \param[out] diag The diagonal of the tridiagonal matrix T in the * decomposition. * \param[out] subdiag The subdiagonal of the tridiagonal matrix T in * the decomposition. * \param[in] extractQ If true, the orthogonal matrix Q in the * decomposition is computed and stored in \p mat. * * Computes the tridiagonal decomposition of the selfadjoint matrix \p mat in place * such that \f$ mat = Q T Q^* \f$ where \f$ Q \f$ is unitary and \f$ T \f$ a real * symmetric tridiagonal matrix. * * The tridiagonal matrix T is passed to the output parameters \p diag and \p subdiag. If * \p extractQ is true, then the orthogonal matrix Q is passed to \p mat. Otherwise the lower * part of the matrix \p mat is destroyed. * * The vectors \p diag and \p subdiag are not resized. The function * assumes that they are already of the correct size. The length of the * vector \p diag should equal the number of rows in \p mat, and the * length of the vector \p subdiag should be one left. * * This implementation contains an optimized path for 3-by-3 matrices * which is especially useful for plane fitting. * * \note Currently, it requires two temporary vectors to hold the intermediate * Householder coefficients, and to reconstruct the matrix Q from the Householder * reflectors. * * Example (this uses the same matrix as the example in * Tridiagonalization::Tridiagonalization(const MatrixType&)): * \include Tridiagonalization_decomposeInPlace.cpp * Output: \verbinclude Tridiagonalization_decomposeInPlace.out * * \sa class Tridiagonalization */ template EIGEN_DEVICE_FUNC void tridiagonalization_inplace(MatrixType& mat, DiagonalType& diag, SubDiagonalType& subdiag, CoeffVectorType& hcoeffs, bool extractQ) { eigen_assert(mat.cols()==mat.rows() && diag.size()==mat.rows() && subdiag.size()==mat.rows()-1); tridiagonalization_inplace_selector::run(mat, diag, subdiag, hcoeffs, extractQ); } /** \internal * General full tridiagonalization */ template struct tridiagonalization_inplace_selector { typedef typename Tridiagonalization::CoeffVectorType CoeffVectorType; typedef typename Tridiagonalization::HouseholderSequenceType HouseholderSequenceType; template static EIGEN_DEVICE_FUNC void run(MatrixType& mat, DiagonalType& diag, SubDiagonalType& subdiag, CoeffVectorType& hCoeffs, bool extractQ) { tridiagonalization_inplace(mat, hCoeffs); diag = mat.diagonal().real(); subdiag = mat.template diagonal<-1>().real(); if(extractQ) mat = HouseholderSequenceType(mat, hCoeffs.conjugate()) .setLength(mat.rows() - 1) .setShift(1); } }; /** \internal * Specialization for 3x3 real matrices. * Especially useful for plane fitting. */ template struct tridiagonalization_inplace_selector { typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; template static void run(MatrixType& mat, DiagonalType& diag, SubDiagonalType& subdiag, CoeffVectorType&, bool extractQ) { using std::sqrt; const RealScalar tol = (std::numeric_limits::min)(); diag[0] = mat(0,0); RealScalar v1norm2 = numext::abs2(mat(2,0)); if(v1norm2 <= tol) { diag[1] = mat(1,1); diag[2] = mat(2,2); subdiag[0] = mat(1,0); subdiag[1] = mat(2,1); if (extractQ) mat.setIdentity(); } else { RealScalar beta = sqrt(numext::abs2(mat(1,0)) + v1norm2); RealScalar invBeta = RealScalar(1)/beta; Scalar m01 = mat(1,0) * invBeta; Scalar m02 = mat(2,0) * invBeta; Scalar q = RealScalar(2)*m01*mat(2,1) + m02*(mat(2,2) - mat(1,1)); diag[1] = mat(1,1) + m02*q; diag[2] = mat(2,2) - m02*q; subdiag[0] = beta; subdiag[1] = mat(2,1) - m01 * q; if (extractQ) { mat << 1, 0, 0, 0, m01, m02, 0, m02, -m01; } } } }; /** \internal * Trivial specialization for 1x1 matrices */ template struct tridiagonalization_inplace_selector { typedef typename MatrixType::Scalar Scalar; template static EIGEN_DEVICE_FUNC void run(MatrixType& mat, DiagonalType& diag, SubDiagonalType&, CoeffVectorType&, bool extractQ) { diag(0,0) = numext::real(mat(0,0)); if(extractQ) mat(0,0) = Scalar(1); } }; /** \internal * \eigenvalues_module \ingroup Eigenvalues_Module * * \brief Expression type for return value of Tridiagonalization::matrixT() * * \tparam MatrixType type of underlying dense matrix */ template struct TridiagonalizationMatrixTReturnType : public ReturnByValue > { public: /** \brief Constructor. * * \param[in] mat The underlying dense matrix */ TridiagonalizationMatrixTReturnType(const MatrixType& mat) : m_matrix(mat) { } template inline void evalTo(ResultType& result) const { result.setZero(); result.template diagonal<1>() = m_matrix.template diagonal<-1>().conjugate(); result.diagonal() = m_matrix.diagonal(); result.template diagonal<-1>() = m_matrix.template diagonal<-1>(); } EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } protected: typename MatrixType::Nested m_matrix; }; } // end namespace internal } // end namespace Eigen #endif // EIGEN_TRIDIAGONALIZATION_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Geometry/AlignedBox.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. // Function void Eigen::AlignedBox::transform(const Transform& transform) // is provided under the following license agreement: // // Software License Agreement (BSD License) // // Copyright (c) 2011-2014, Willow Garage, Inc. // Copyright (c) 2014-2015, Open Source Robotics Foundation // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Open Source Robotics Foundation nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. #ifndef EIGEN_ALIGNEDBOX_H #define EIGEN_ALIGNEDBOX_H namespace Eigen { /** \geometry_module \ingroup Geometry_Module * * * \class AlignedBox * * \brief An axis aligned box * * \tparam Scalar_ the type of the scalar coefficients * \tparam _AmbientDim the dimension of the ambient space, can be a compile time value or Dynamic. * * This class represents an axis aligned box as a pair of the minimal and maximal corners. * \warning The result of most methods is undefined when applied to an empty box. You can check for empty boxes using isEmpty(). * \sa alignedboxtypedefs */ template class AlignedBox { public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(Scalar_,_AmbientDim) enum { AmbientDimAtCompileTime = _AmbientDim }; typedef Scalar_ Scalar; typedef NumTraits ScalarTraits; typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3 typedef typename ScalarTraits::Real RealScalar; typedef typename ScalarTraits::NonInteger NonInteger; typedef Matrix VectorType; typedef CwiseBinaryOp, const VectorType, const VectorType> VectorTypeSum; /** Define constants to name the corners of a 1D, 2D or 3D axis aligned bounding box */ enum CornerType { /** 1D names @{ */ Min=0, Max=1, /** @} */ /** Identifier for 2D corner @{ */ BottomLeft=0, BottomRight=1, TopLeft=2, TopRight=3, /** @} */ /** Identifier for 3D corner @{ */ BottomLeftFloor=0, BottomRightFloor=1, TopLeftFloor=2, TopRightFloor=3, BottomLeftCeil=4, BottomRightCeil=5, TopLeftCeil=6, TopRightCeil=7 /** @} */ }; /** Default constructor initializing a null box. */ EIGEN_DEVICE_FUNC inline AlignedBox() { if (EIGEN_CONST_CONDITIONAL(AmbientDimAtCompileTime!=Dynamic)) setEmpty(); } /** Constructs a null box with \a _dim the dimension of the ambient space. */ EIGEN_DEVICE_FUNC inline explicit AlignedBox(Index _dim) : m_min(_dim), m_max(_dim) { setEmpty(); } /** Constructs a box with extremities \a _min and \a _max. * \warning If either component of \a _min is larger than the same component of \a _max, the constructed box is empty. */ template EIGEN_DEVICE_FUNC inline AlignedBox(const OtherVectorType1& _min, const OtherVectorType2& _max) : m_min(_min), m_max(_max) {} /** Constructs a box containing a single point \a p. */ template EIGEN_DEVICE_FUNC inline explicit AlignedBox(const MatrixBase& p) : m_min(p), m_max(m_min) { } EIGEN_DEVICE_FUNC ~AlignedBox() {} /** \returns the dimension in which the box holds */ EIGEN_DEVICE_FUNC inline Index dim() const { return AmbientDimAtCompileTime==Dynamic ? m_min.size() : Index(AmbientDimAtCompileTime); } /** \deprecated use isEmpty() */ EIGEN_DEVICE_FUNC inline bool isNull() const { return isEmpty(); } /** \deprecated use setEmpty() */ EIGEN_DEVICE_FUNC inline void setNull() { setEmpty(); } /** \returns true if the box is empty. * \sa setEmpty */ EIGEN_DEVICE_FUNC inline bool isEmpty() const { return (m_min.array() > m_max.array()).any(); } /** Makes \c *this an empty box. * \sa isEmpty */ EIGEN_DEVICE_FUNC inline void setEmpty() { m_min.setConstant( ScalarTraits::highest() ); m_max.setConstant( ScalarTraits::lowest() ); } /** \returns the minimal corner */ EIGEN_DEVICE_FUNC inline const VectorType& (min)() const { return m_min; } /** \returns a non const reference to the minimal corner */ EIGEN_DEVICE_FUNC inline VectorType& (min)() { return m_min; } /** \returns the maximal corner */ EIGEN_DEVICE_FUNC inline const VectorType& (max)() const { return m_max; } /** \returns a non const reference to the maximal corner */ EIGEN_DEVICE_FUNC inline VectorType& (max)() { return m_max; } /** \returns the center of the box */ EIGEN_DEVICE_FUNC inline const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(VectorTypeSum, RealScalar, quotient) center() const { return (m_min+m_max)/RealScalar(2); } /** \returns the lengths of the sides of the bounding box. * Note that this function does not get the same * result for integral or floating scalar types: see */ EIGEN_DEVICE_FUNC inline const CwiseBinaryOp< internal::scalar_difference_op, const VectorType, const VectorType> sizes() const { return m_max - m_min; } /** \returns the volume of the bounding box */ EIGEN_DEVICE_FUNC inline Scalar volume() const { return sizes().prod(); } /** \returns an expression for the bounding box diagonal vector * if the length of the diagonal is needed: diagonal().norm() * will provide it. */ EIGEN_DEVICE_FUNC inline CwiseBinaryOp< internal::scalar_difference_op, const VectorType, const VectorType> diagonal() const { return sizes(); } /** \returns the vertex of the bounding box at the corner defined by * the corner-id corner. It works only for a 1D, 2D or 3D bounding box. * For 1D bounding boxes corners are named by 2 enum constants: * BottomLeft and BottomRight. * For 2D bounding boxes, corners are named by 4 enum constants: * BottomLeft, BottomRight, TopLeft, TopRight. * For 3D bounding boxes, the following names are added: * BottomLeftCeil, BottomRightCeil, TopLeftCeil, TopRightCeil. */ EIGEN_DEVICE_FUNC inline VectorType corner(CornerType corner) const { EIGEN_STATIC_ASSERT(_AmbientDim <= 3, THIS_METHOD_IS_ONLY_FOR_VECTORS_OF_A_SPECIFIC_SIZE); VectorType res; Index mult = 1; for(Index d=0; d(Scalar(0), Scalar(1)); } else r[d] = internal::random(m_min[d], m_max[d]); } return r; } /** \returns true if the point \a p is inside the box \c *this. */ template EIGEN_DEVICE_FUNC inline bool contains(const MatrixBase& p) const { typename internal::nested_eval::type p_n(p.derived()); return (m_min.array()<=p_n.array()).all() && (p_n.array()<=m_max.array()).all(); } /** \returns true if the box \a b is entirely inside the box \c *this. */ EIGEN_DEVICE_FUNC inline bool contains(const AlignedBox& b) const { return (m_min.array()<=(b.min)().array()).all() && ((b.max)().array()<=m_max.array()).all(); } /** \returns true if the box \a b is intersecting the box \c *this. * \sa intersection, clamp */ EIGEN_DEVICE_FUNC inline bool intersects(const AlignedBox& b) const { return (m_min.array()<=(b.max)().array()).all() && ((b.min)().array()<=m_max.array()).all(); } /** Extends \c *this such that it contains the point \a p and returns a reference to \c *this. * \sa extend(const AlignedBox&) */ template EIGEN_DEVICE_FUNC inline AlignedBox& extend(const MatrixBase& p) { typename internal::nested_eval::type p_n(p.derived()); m_min = m_min.cwiseMin(p_n); m_max = m_max.cwiseMax(p_n); return *this; } /** Extends \c *this such that it contains the box \a b and returns a reference to \c *this. * \sa merged, extend(const MatrixBase&) */ EIGEN_DEVICE_FUNC inline AlignedBox& extend(const AlignedBox& b) { m_min = m_min.cwiseMin(b.m_min); m_max = m_max.cwiseMax(b.m_max); return *this; } /** Clamps \c *this by the box \a b and returns a reference to \c *this. * \note If the boxes don't intersect, the resulting box is empty. * \sa intersection(), intersects() */ EIGEN_DEVICE_FUNC inline AlignedBox& clamp(const AlignedBox& b) { m_min = m_min.cwiseMax(b.m_min); m_max = m_max.cwiseMin(b.m_max); return *this; } /** Returns an AlignedBox that is the intersection of \a b and \c *this * \note If the boxes don't intersect, the resulting box is empty. * \sa intersects(), clamp, contains() */ EIGEN_DEVICE_FUNC inline AlignedBox intersection(const AlignedBox& b) const {return AlignedBox(m_min.cwiseMax(b.m_min), m_max.cwiseMin(b.m_max)); } /** Returns an AlignedBox that is the union of \a b and \c *this. * \note Merging with an empty box may result in a box bigger than \c *this. * \sa extend(const AlignedBox&) */ EIGEN_DEVICE_FUNC inline AlignedBox merged(const AlignedBox& b) const { return AlignedBox(m_min.cwiseMin(b.m_min), m_max.cwiseMax(b.m_max)); } /** Translate \c *this by the vector \a t and returns a reference to \c *this. */ template EIGEN_DEVICE_FUNC inline AlignedBox& translate(const MatrixBase& a_t) { const typename internal::nested_eval::type t(a_t.derived()); m_min += t; m_max += t; return *this; } /** \returns a copy of \c *this translated by the vector \a t. */ template EIGEN_DEVICE_FUNC inline AlignedBox translated(const MatrixBase& a_t) const { AlignedBox result(m_min, m_max); result.translate(a_t); return result; } /** \returns the squared distance between the point \a p and the box \c *this, * and zero if \a p is inside the box. * \sa exteriorDistance(const MatrixBase&), squaredExteriorDistance(const AlignedBox&) */ template EIGEN_DEVICE_FUNC inline Scalar squaredExteriorDistance(const MatrixBase& p) const; /** \returns the squared distance between the boxes \a b and \c *this, * and zero if the boxes intersect. * \sa exteriorDistance(const AlignedBox&), squaredExteriorDistance(const MatrixBase&) */ EIGEN_DEVICE_FUNC inline Scalar squaredExteriorDistance(const AlignedBox& b) const; /** \returns the distance between the point \a p and the box \c *this, * and zero if \a p is inside the box. * \sa squaredExteriorDistance(const MatrixBase&), exteriorDistance(const AlignedBox&) */ template EIGEN_DEVICE_FUNC inline NonInteger exteriorDistance(const MatrixBase& p) const { EIGEN_USING_STD(sqrt) return sqrt(NonInteger(squaredExteriorDistance(p))); } /** \returns the distance between the boxes \a b and \c *this, * and zero if the boxes intersect. * \sa squaredExteriorDistance(const AlignedBox&), exteriorDistance(const MatrixBase&) */ EIGEN_DEVICE_FUNC inline NonInteger exteriorDistance(const AlignedBox& b) const { EIGEN_USING_STD(sqrt) return sqrt(NonInteger(squaredExteriorDistance(b))); } /** * Specialization of transform for pure translation. */ template EIGEN_DEVICE_FUNC inline void transform( const typename Transform::TranslationType& translation) { this->translate(translation); } /** * Transforms this box by \a transform and recomputes it to * still be an axis-aligned box. * * \note This method is provided under BSD license (see the top of this file). */ template EIGEN_DEVICE_FUNC inline void transform(const Transform& transform) { // Only Affine and Isometry transforms are currently supported. EIGEN_STATIC_ASSERT(Mode == Affine || Mode == AffineCompact || Mode == Isometry, THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS); // Method adapted from FCL src/shape/geometric_shapes_utility.cpp#computeBV(...) // https://github.com/flexible-collision-library/fcl/blob/fcl-0.4/src/shape/geometric_shapes_utility.cpp#L292 // // Here's a nice explanation why it works: https://zeuxcg.org/2010/10/17/aabb-from-obb-with-component-wise-abs/ // two times rotated extent const VectorType rotated_extent_2 = transform.linear().cwiseAbs() * sizes(); // two times new center const VectorType rotated_center_2 = transform.linear() * (this->m_max + this->m_min) + Scalar(2) * transform.translation(); this->m_max = (rotated_center_2 + rotated_extent_2) / Scalar(2); this->m_min = (rotated_center_2 - rotated_extent_2) / Scalar(2); } /** * \returns a copy of \c *this transformed by \a transform and recomputed to * still be an axis-aligned box. */ template EIGEN_DEVICE_FUNC AlignedBox transformed(const Transform& transform) const { AlignedBox result(m_min, m_max); result.transform(transform); return result; } /** \returns \c *this with scalar type casted to \a NewScalarType * * Note that if \a NewScalarType is equal to the current scalar type of \c *this * then this function smartly returns a const reference to \c *this. */ template EIGEN_DEVICE_FUNC inline typename internal::cast_return_type >::type cast() const { return typename internal::cast_return_type >::type(*this); } /** Copy constructor with scalar type conversion */ template EIGEN_DEVICE_FUNC inline explicit AlignedBox(const AlignedBox& other) { m_min = (other.min)().template cast(); m_max = (other.max)().template cast(); } /** \returns \c true if \c *this is approximately equal to \a other, within the precision * determined by \a prec. * * \sa MatrixBase::isApprox() */ EIGEN_DEVICE_FUNC bool isApprox(const AlignedBox& other, const RealScalar& prec = ScalarTraits::dummy_precision()) const { return m_min.isApprox(other.m_min, prec) && m_max.isApprox(other.m_max, prec); } protected: VectorType m_min, m_max; }; template template EIGEN_DEVICE_FUNC inline Scalar AlignedBox::squaredExteriorDistance(const MatrixBase& a_p) const { typename internal::nested_eval::type p(a_p.derived()); Scalar dist2(0); Scalar aux; for (Index k=0; k p[k] ) { aux = m_min[k] - p[k]; dist2 += aux*aux; } else if( p[k] > m_max[k] ) { aux = p[k] - m_max[k]; dist2 += aux*aux; } } return dist2; } template EIGEN_DEVICE_FUNC inline Scalar AlignedBox::squaredExteriorDistance(const AlignedBox& b) const { Scalar dist2(0); Scalar aux; for (Index k=0; k b.m_max[k] ) { aux = m_min[k] - b.m_max[k]; dist2 += aux*aux; } else if( b.m_min[k] > m_max[k] ) { aux = b.m_min[k] - m_max[k]; dist2 += aux*aux; } } return dist2; } /** \defgroup alignedboxtypedefs Global aligned box typedefs * * \ingroup Geometry_Module * * Eigen defines several typedef shortcuts for most common aligned box types. * * The general patterns are the following: * * \c AlignedBoxSizeType where \c Size can be \c 1, \c 2,\c 3,\c 4 for fixed size boxes or \c X for dynamic size, * and where \c Type can be \c i for integer, \c f for float, \c d for double. * * For example, \c AlignedBox3d is a fixed-size 3x3 aligned box type of doubles, and \c AlignedBoxXf is a dynamic-size aligned box of floats. * * \sa class AlignedBox */ #define EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \ /** \ingroup alignedboxtypedefs */ \ typedef AlignedBox AlignedBox##SizeSuffix##TypeSuffix; #define EIGEN_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \ EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 1, 1) \ 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_TYPEDEFS_ALL_SIZES(int, i) EIGEN_MAKE_TYPEDEFS_ALL_SIZES(float, f) EIGEN_MAKE_TYPEDEFS_ALL_SIZES(double, d) #undef EIGEN_MAKE_TYPEDEFS_ALL_SIZES #undef EIGEN_MAKE_TYPEDEFS } // end namespace Eigen #endif // EIGEN_ALIGNEDBOX_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Geometry/AngleAxis.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_ANGLEAXIS_H #define EIGEN_ANGLEAXIS_H namespace Eigen { /** \geometry_module \ingroup Geometry_Module * * \class AngleAxis * * \brief Represents a 3D rotation as a rotation angle around an arbitrary 3D axis * * \param Scalar_ the scalar type, i.e., the type of the coefficients. * * \warning When setting up an AngleAxis object, the axis vector \b must \b be \b normalized. * * The following two typedefs are provided for convenience: * \li \c AngleAxisf for \c float * \li \c AngleAxisd for \c double * * Combined with MatrixBase::Unit{X,Y,Z}, AngleAxis can be used to easily * mimic Euler-angles. Here is an example: * \include AngleAxis_mimic_euler.cpp * Output: \verbinclude AngleAxis_mimic_euler.out * * \note This class is not aimed to be used to store a rotation transformation, * but rather to make easier the creation of other rotation (Quaternion, rotation Matrix) * and transformation objects. * * \sa class Quaternion, class Transform, MatrixBase::UnitX() */ namespace internal { template struct traits > { typedef Scalar_ Scalar; }; } template class AngleAxis : public RotationBase,3> { typedef RotationBase,3> Base; public: using Base::operator*; enum { Dim = 3 }; /** the scalar type of the coefficients */ typedef Scalar_ Scalar; typedef Matrix Matrix3; typedef Matrix Vector3; typedef Quaternion QuaternionType; protected: Vector3 m_axis; Scalar m_angle; public: /** Default constructor without initialization. */ EIGEN_DEVICE_FUNC AngleAxis() {} /** Constructs and initialize the angle-axis rotation from an \a angle in radian * and an \a axis which \b must \b be \b normalized. * * \warning If the \a axis vector is not normalized, then the angle-axis object * represents an invalid rotation. */ template EIGEN_DEVICE_FUNC inline AngleAxis(const Scalar& angle, const MatrixBase& axis) : m_axis(axis), m_angle(angle) {} /** Constructs and initialize the angle-axis rotation from a quaternion \a q. * This function implicitly normalizes the quaternion \a q. */ template EIGEN_DEVICE_FUNC inline explicit AngleAxis(const QuaternionBase& q) { *this = q; } /** Constructs and initialize the angle-axis rotation from a 3x3 rotation matrix. */ template EIGEN_DEVICE_FUNC inline explicit AngleAxis(const MatrixBase& m) { *this = m; } /** \returns the value of the rotation angle in radian */ EIGEN_DEVICE_FUNC Scalar angle() const { return m_angle; } /** \returns a read-write reference to the stored angle in radian */ EIGEN_DEVICE_FUNC Scalar& angle() { return m_angle; } /** \returns the rotation axis */ EIGEN_DEVICE_FUNC const Vector3& axis() const { return m_axis; } /** \returns a read-write reference to the stored rotation axis. * * \warning The rotation axis must remain a \b unit vector. */ EIGEN_DEVICE_FUNC Vector3& axis() { return m_axis; } /** Concatenates two rotations */ EIGEN_DEVICE_FUNC inline QuaternionType operator* (const AngleAxis& other) const { return QuaternionType(*this) * QuaternionType(other); } /** Concatenates two rotations */ EIGEN_DEVICE_FUNC inline QuaternionType operator* (const QuaternionType& other) const { return QuaternionType(*this) * other; } /** Concatenates two rotations */ friend EIGEN_DEVICE_FUNC inline QuaternionType operator* (const QuaternionType& a, const AngleAxis& b) { return a * QuaternionType(b); } /** \returns the inverse rotation, i.e., an angle-axis with opposite rotation angle */ EIGEN_DEVICE_FUNC AngleAxis inverse() const { return AngleAxis(-m_angle, m_axis); } template EIGEN_DEVICE_FUNC AngleAxis& operator=(const QuaternionBase& q); template EIGEN_DEVICE_FUNC AngleAxis& operator=(const MatrixBase& m); template EIGEN_DEVICE_FUNC AngleAxis& fromRotationMatrix(const MatrixBase& m); EIGEN_DEVICE_FUNC Matrix3 toRotationMatrix(void) const; /** \returns \c *this with scalar type casted to \a NewScalarType * * Note that if \a NewScalarType is equal to the current scalar type of \c *this * then this function smartly returns a const reference to \c *this. */ template EIGEN_DEVICE_FUNC inline typename internal::cast_return_type >::type cast() const { return typename internal::cast_return_type >::type(*this); } /** Copy constructor with scalar type conversion */ template EIGEN_DEVICE_FUNC inline explicit AngleAxis(const AngleAxis& other) { m_axis = other.axis().template cast(); m_angle = Scalar(other.angle()); } EIGEN_DEVICE_FUNC static inline const AngleAxis Identity() { return AngleAxis(Scalar(0), Vector3::UnitX()); } /** \returns \c true if \c *this is approximately equal to \a other, within the precision * determined by \a prec. * * \sa MatrixBase::isApprox() */ EIGEN_DEVICE_FUNC bool isApprox(const AngleAxis& other, const typename NumTraits::Real& prec = NumTraits::dummy_precision()) const { return m_axis.isApprox(other.m_axis, prec) && internal::isApprox(m_angle,other.m_angle, prec); } }; /** \ingroup Geometry_Module * single precision angle-axis type */ typedef AngleAxis AngleAxisf; /** \ingroup Geometry_Module * double precision angle-axis type */ typedef AngleAxis AngleAxisd; /** Set \c *this from a \b unit quaternion. * * The resulting axis is normalized, and the computed angle is in the [0,pi] range. * * This function implicitly normalizes the quaternion \a q. */ template template EIGEN_DEVICE_FUNC AngleAxis& AngleAxis::operator=(const QuaternionBase& q) { EIGEN_USING_STD(atan2) EIGEN_USING_STD(abs) Scalar n = q.vec().norm(); if(n::epsilon()) n = q.vec().stableNorm(); if (n != Scalar(0)) { m_angle = Scalar(2)*atan2(n, abs(q.w())); if(q.w() < Scalar(0)) n = -n; m_axis = q.vec() / n; } else { m_angle = Scalar(0); m_axis << Scalar(1), Scalar(0), Scalar(0); } return *this; } /** Set \c *this from a 3x3 rotation matrix \a mat. */ template template EIGEN_DEVICE_FUNC AngleAxis& AngleAxis::operator=(const MatrixBase& mat) { // Since a direct conversion would not be really faster, // let's use the robust Quaternion implementation: return *this = QuaternionType(mat); } /** * \brief Sets \c *this from a 3x3 rotation matrix. **/ template template EIGEN_DEVICE_FUNC AngleAxis& AngleAxis::fromRotationMatrix(const MatrixBase& mat) { return *this = QuaternionType(mat); } /** Constructs and \returns an equivalent 3x3 rotation matrix. */ template typename AngleAxis::Matrix3 EIGEN_DEVICE_FUNC AngleAxis::toRotationMatrix(void) const { EIGEN_USING_STD(sin) EIGEN_USING_STD(cos) Matrix3 res; Vector3 sin_axis = sin(m_angle) * m_axis; Scalar c = cos(m_angle); Vector3 cos1_axis = (Scalar(1)-c) * m_axis; Scalar tmp; tmp = cos1_axis.x() * m_axis.y(); res.coeffRef(0,1) = tmp - sin_axis.z(); res.coeffRef(1,0) = tmp + sin_axis.z(); tmp = cos1_axis.x() * m_axis.z(); res.coeffRef(0,2) = tmp + sin_axis.y(); res.coeffRef(2,0) = tmp - sin_axis.y(); tmp = cos1_axis.y() * m_axis.z(); res.coeffRef(1,2) = tmp - sin_axis.x(); res.coeffRef(2,1) = tmp + sin_axis.x(); res.diagonal() = (cos1_axis.cwiseProduct(m_axis)).array() + c; return res; } } // end namespace Eigen #endif // EIGEN_ANGLEAXIS_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Geometry/EulerAngles.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_EULERANGLES_H #define EIGEN_EULERANGLES_H namespace Eigen { /** \geometry_module \ingroup Geometry_Module * * * \returns the Euler-angles of the rotation matrix \c *this using the convention defined by the triplet (\a a0,\a a1,\a a2) * * Each of the three parameters \a a0,\a a1,\a a2 represents the respective rotation axis as an integer in {0,1,2}. * For instance, in: * \code Vector3f ea = mat.eulerAngles(2, 0, 2); \endcode * "2" represents the z axis and "0" the x axis, etc. The returned angles are such that * we have the following equality: * \code * mat == AngleAxisf(ea[0], Vector3f::UnitZ()) * * AngleAxisf(ea[1], Vector3f::UnitX()) * * AngleAxisf(ea[2], Vector3f::UnitZ()); \endcode * This corresponds to the right-multiply conventions (with right hand side frames). * * The returned angles are in the ranges [0:pi]x[-pi:pi]x[-pi:pi]. * * \sa class AngleAxis */ template EIGEN_DEVICE_FUNC inline Matrix::Scalar,3,1> MatrixBase::eulerAngles(Index a0, Index a1, Index a2) const { EIGEN_USING_STD(atan2) EIGEN_USING_STD(sin) EIGEN_USING_STD(cos) /* Implemented from Graphics Gems IV */ EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Derived,3,3) Matrix res; typedef Matrix Vector2; const Index odd = ((a0+1)%3 == a1) ? 0 : 1; const Index i = a0; const Index j = (a0 + 1 + odd)%3; const Index k = (a0 + 2 - odd)%3; if (a0==a2) { res[0] = atan2(coeff(j,i), coeff(k,i)); if((odd && res[0]Scalar(0))) { if(res[0] > Scalar(0)) { res[0] -= Scalar(EIGEN_PI); } else { res[0] += Scalar(EIGEN_PI); } Scalar s2 = Vector2(coeff(j,i), coeff(k,i)).norm(); res[1] = -atan2(s2, coeff(i,i)); } else { Scalar s2 = Vector2(coeff(j,i), coeff(k,i)).norm(); res[1] = atan2(s2, coeff(i,i)); } // With a=(0,1,0), we have i=0; j=1; k=2, and after computing the first two angles, // we can compute their respective rotation, and apply its inverse to M. Since the result must // be a rotation around x, we have: // // c2 s1.s2 c1.s2 1 0 0 // 0 c1 -s1 * M = 0 c3 s3 // -s2 s1.c2 c1.c2 0 -s3 c3 // // Thus: m11.c1 - m21.s1 = c3 & m12.c1 - m22.s1 = s3 Scalar s1 = sin(res[0]); Scalar c1 = cos(res[0]); res[2] = atan2(c1*coeff(j,k)-s1*coeff(k,k), c1*coeff(j,j) - s1 * coeff(k,j)); } else { res[0] = atan2(coeff(j,k), coeff(k,k)); Scalar c2 = Vector2(coeff(i,i), coeff(i,j)).norm(); if((odd && res[0]Scalar(0))) { if(res[0] > Scalar(0)) { res[0] -= Scalar(EIGEN_PI); } else { res[0] += Scalar(EIGEN_PI); } res[1] = atan2(-coeff(i,k), -c2); } else res[1] = atan2(-coeff(i,k), c2); Scalar s1 = sin(res[0]); Scalar c1 = cos(res[0]); res[2] = atan2(s1*coeff(k,i)-c1*coeff(j,i), c1*coeff(j,j) - s1 * coeff(k,j)); } if (!odd) res = -res; return res; } } // end namespace Eigen #endif // EIGEN_EULERANGLES_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Geometry/Homogeneous.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009-2010 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_HOMOGENEOUS_H #define EIGEN_HOMOGENEOUS_H namespace Eigen { /** \geometry_module \ingroup Geometry_Module * * \class Homogeneous * * \brief Expression of one (or a set of) homogeneous vector(s) * * \param MatrixType the type of the object in which we are making homogeneous * * This class represents an expression of one (or a set of) homogeneous vector(s). * It is the return type of MatrixBase::homogeneous() and most of the time * this is the only way it is used. * * \sa MatrixBase::homogeneous() */ namespace internal { template struct traits > : traits { typedef typename traits::StorageKind StorageKind; typedef typename ref_selector::type MatrixTypeNested; typedef typename remove_reference::type _MatrixTypeNested; enum { RowsPlusOne = (MatrixType::RowsAtCompileTime != Dynamic) ? int(MatrixType::RowsAtCompileTime) + 1 : Dynamic, ColsPlusOne = (MatrixType::ColsAtCompileTime != Dynamic) ? int(MatrixType::ColsAtCompileTime) + 1 : Dynamic, RowsAtCompileTime = Direction==Vertical ? RowsPlusOne : MatrixType::RowsAtCompileTime, ColsAtCompileTime = Direction==Horizontal ? ColsPlusOne : MatrixType::ColsAtCompileTime, MaxRowsAtCompileTime = RowsAtCompileTime, MaxColsAtCompileTime = ColsAtCompileTime, TmpFlags = _MatrixTypeNested::Flags & HereditaryBits, Flags = ColsAtCompileTime==1 ? (TmpFlags & ~RowMajorBit) : RowsAtCompileTime==1 ? (TmpFlags | RowMajorBit) : TmpFlags }; }; template struct homogeneous_left_product_impl; template struct homogeneous_right_product_impl; } // end namespace internal template class Homogeneous : public MatrixBase >, internal::no_assignment_operator { public: typedef MatrixType NestedExpression; enum { Direction = Direction_ }; typedef MatrixBase Base; EIGEN_DENSE_PUBLIC_INTERFACE(Homogeneous) EIGEN_DEVICE_FUNC explicit inline Homogeneous(const MatrixType& matrix) : m_matrix(matrix) {} EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows() + (int(Direction)==Vertical ? 1 : 0); } EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols() + (int(Direction)==Horizontal ? 1 : 0); } EIGEN_DEVICE_FUNC const NestedExpression& nestedExpression() const { return m_matrix; } template EIGEN_DEVICE_FUNC inline const Product operator* (const MatrixBase& rhs) const { eigen_assert(int(Direction)==Horizontal); return Product(*this,rhs.derived()); } template friend EIGEN_DEVICE_FUNC inline const Product operator* (const MatrixBase& lhs, const Homogeneous& rhs) { eigen_assert(int(Direction)==Vertical); return Product(lhs.derived(),rhs); } template friend EIGEN_DEVICE_FUNC inline const Product, Homogeneous > operator* (const Transform& lhs, const Homogeneous& rhs) { eigen_assert(int(Direction)==Vertical); return Product, Homogeneous>(lhs,rhs); } template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::result_of::type redux(const Func& func) const { return func(m_matrix.redux(func), Scalar(1)); } protected: typename MatrixType::Nested m_matrix; }; /** \geometry_module \ingroup Geometry_Module * * \returns a vector expression that is one longer than the vector argument, with the value 1 symbolically appended as the last coefficient. * * This can be used to convert affine coordinates to homogeneous coordinates. * * \only_for_vectors * * Example: \include MatrixBase_homogeneous.cpp * Output: \verbinclude MatrixBase_homogeneous.out * * \sa VectorwiseOp::homogeneous(), class Homogeneous */ template EIGEN_DEVICE_FUNC inline typename MatrixBase::HomogeneousReturnType MatrixBase::homogeneous() const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived); return HomogeneousReturnType(derived()); } /** \geometry_module \ingroup Geometry_Module * * \returns an expression where the value 1 is symbolically appended as the final coefficient to each column (or row) of the matrix. * * This can be used to convert affine coordinates to homogeneous coordinates. * * Example: \include VectorwiseOp_homogeneous.cpp * Output: \verbinclude VectorwiseOp_homogeneous.out * * \sa MatrixBase::homogeneous(), class Homogeneous */ template EIGEN_DEVICE_FUNC inline Homogeneous VectorwiseOp::homogeneous() const { return HomogeneousReturnType(_expression()); } /** \geometry_module \ingroup Geometry_Module * * \brief homogeneous normalization * * \returns a vector expression of the N-1 first coefficients of \c *this divided by that last coefficient. * * This can be used to convert homogeneous coordinates to affine coordinates. * * It is essentially a shortcut for: * \code this->head(this->size()-1)/this->coeff(this->size()-1); \endcode * * Example: \include MatrixBase_hnormalized.cpp * Output: \verbinclude MatrixBase_hnormalized.out * * \sa VectorwiseOp::hnormalized() */ template EIGEN_DEVICE_FUNC inline const typename MatrixBase::HNormalizedReturnType MatrixBase::hnormalized() const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived); return ConstStartMinusOne(derived(),0,0, ColsAtCompileTime==1?size()-1:1, ColsAtCompileTime==1?1:size()-1) / coeff(size()-1); } /** \geometry_module \ingroup Geometry_Module * * \brief column or row-wise homogeneous normalization * * \returns an expression of the first N-1 coefficients of each column (or row) of \c *this divided by the last coefficient of each column (or row). * * This can be used to convert homogeneous coordinates to affine coordinates. * * It is conceptually equivalent to calling MatrixBase::hnormalized() to each column (or row) of \c *this. * * Example: \include DirectionWise_hnormalized.cpp * Output: \verbinclude DirectionWise_hnormalized.out * * \sa MatrixBase::hnormalized() */ template EIGEN_DEVICE_FUNC inline const typename VectorwiseOp::HNormalizedReturnType VectorwiseOp::hnormalized() const { return HNormalized_Block(_expression(),0,0, Direction==Vertical ? _expression().rows()-1 : _expression().rows(), Direction==Horizontal ? _expression().cols()-1 : _expression().cols()).cwiseQuotient( Replicate (HNormalized_Factors(_expression(), Direction==Vertical ? _expression().rows()-1:0, Direction==Horizontal ? _expression().cols()-1:0, Direction==Vertical ? 1 : _expression().rows(), Direction==Horizontal ? 1 : _expression().cols()), Direction==Vertical ? _expression().rows()-1 : 1, Direction==Horizontal ? _expression().cols()-1 : 1)); } namespace internal { template struct take_matrix_for_product { typedef MatrixOrTransformType type; EIGEN_DEVICE_FUNC static const type& run(const type &x) { return x; } }; template struct take_matrix_for_product > { typedef Transform TransformType; typedef typename internal::add_const::type type; EIGEN_DEVICE_FUNC static type run (const TransformType& x) { return x.affine(); } }; template struct take_matrix_for_product > { typedef Transform TransformType; typedef typename TransformType::MatrixType type; EIGEN_DEVICE_FUNC static const type& run (const TransformType& x) { return x.matrix(); } }; template struct traits,Lhs> > { typedef typename take_matrix_for_product::type LhsMatrixType; typedef typename remove_all::type MatrixTypeCleaned; typedef typename remove_all::type LhsMatrixTypeCleaned; typedef typename make_proper_matrix_type< typename traits::Scalar, LhsMatrixTypeCleaned::RowsAtCompileTime, MatrixTypeCleaned::ColsAtCompileTime, MatrixTypeCleaned::PlainObject::Options, LhsMatrixTypeCleaned::MaxRowsAtCompileTime, MatrixTypeCleaned::MaxColsAtCompileTime>::type ReturnType; }; template struct homogeneous_left_product_impl,Lhs> : public ReturnByValue,Lhs> > { typedef typename traits::LhsMatrixType LhsMatrixType; typedef typename remove_all::type LhsMatrixTypeCleaned; typedef typename remove_all::type LhsMatrixTypeNested; EIGEN_DEVICE_FUNC homogeneous_left_product_impl(const Lhs& lhs, const MatrixType& rhs) : m_lhs(take_matrix_for_product::run(lhs)), m_rhs(rhs) {} EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index rows() const EIGEN_NOEXCEPT { return m_lhs.rows(); } EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index cols() const EIGEN_NOEXCEPT { return m_rhs.cols(); } template EIGEN_DEVICE_FUNC void evalTo(Dest& dst) const { // FIXME investigate how to allow lazy evaluation of this product when possible dst = Block (m_lhs,0,0,m_lhs.rows(),m_lhs.cols()-1) * m_rhs; dst += m_lhs.col(m_lhs.cols()-1).rowwise() .template replicate(m_rhs.cols()); } typename LhsMatrixTypeCleaned::Nested m_lhs; typename MatrixType::Nested m_rhs; }; template struct traits,Rhs> > { typedef typename make_proper_matrix_type::Scalar, MatrixType::RowsAtCompileTime, Rhs::ColsAtCompileTime, MatrixType::PlainObject::Options, MatrixType::MaxRowsAtCompileTime, Rhs::MaxColsAtCompileTime>::type ReturnType; }; template struct homogeneous_right_product_impl,Rhs> : public ReturnByValue,Rhs> > { typedef typename remove_all::type RhsNested; EIGEN_DEVICE_FUNC homogeneous_right_product_impl(const MatrixType& lhs, const Rhs& rhs) : m_lhs(lhs), m_rhs(rhs) {} EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index rows() const EIGEN_NOEXCEPT { return m_lhs.rows(); } EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index cols() const EIGEN_NOEXCEPT { return m_rhs.cols(); } template EIGEN_DEVICE_FUNC void evalTo(Dest& dst) const { // FIXME investigate how to allow lazy evaluation of this product when possible dst = m_lhs * Block (m_rhs,0,0,m_rhs.rows()-1,m_rhs.cols()); dst += m_rhs.row(m_rhs.rows()-1).colwise() .template replicate(m_lhs.rows()); } typename MatrixType::Nested m_lhs; typename Rhs::Nested m_rhs; }; template struct evaluator_traits > { typedef typename storage_kind_to_evaluator_kind::Kind Kind; typedef HomogeneousShape Shape; }; template<> struct AssignmentKind { typedef Dense2Dense Kind; }; template struct unary_evaluator, IndexBased> : evaluator::PlainObject > { typedef Homogeneous XprType; typedef typename XprType::PlainObject PlainObject; typedef evaluator Base; EIGEN_DEVICE_FUNC explicit unary_evaluator(const XprType& op) : Base(), m_temp(op) { ::new (static_cast(this)) Base(m_temp); } protected: PlainObject m_temp; }; // dense = homogeneous template< typename DstXprType, typename ArgType, typename Scalar> struct Assignment, internal::assign_op, Dense2Dense> { typedef Homogeneous SrcXprType; EIGEN_DEVICE_FUNC static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &) { Index dstRows = src.rows(); Index dstCols = src.cols(); if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) dst.resize(dstRows, dstCols); dst.template topRows(src.nestedExpression().rows()) = src.nestedExpression(); dst.row(dst.rows()-1).setOnes(); } }; // dense = homogeneous template< typename DstXprType, typename ArgType, typename Scalar> struct Assignment, internal::assign_op, Dense2Dense> { typedef Homogeneous SrcXprType; EIGEN_DEVICE_FUNC static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &) { Index dstRows = src.rows(); Index dstCols = src.cols(); if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) dst.resize(dstRows, dstCols); dst.template leftCols(src.nestedExpression().cols()) = src.nestedExpression(); dst.col(dst.cols()-1).setOnes(); } }; template struct generic_product_impl, Rhs, HomogeneousShape, DenseShape, ProductTag> { template EIGEN_DEVICE_FUNC static void evalTo(Dest& dst, const Homogeneous& lhs, const Rhs& rhs) { homogeneous_right_product_impl, Rhs>(lhs.nestedExpression(), rhs).evalTo(dst); } }; template struct homogeneous_right_product_refactoring_helper { enum { Dim = Lhs::ColsAtCompileTime, Rows = Lhs::RowsAtCompileTime }; typedef typename Rhs::template ConstNRowsBlockXpr::Type LinearBlockConst; typedef typename remove_const::type LinearBlock; typedef typename Rhs::ConstRowXpr ConstantColumn; typedef Replicate ConstantBlock; typedef Product LinearProduct; typedef CwiseBinaryOp, const LinearProduct, const ConstantBlock> Xpr; }; template struct product_evaluator, ProductTag, HomogeneousShape, DenseShape> : public evaluator::Xpr> { typedef Product XprType; typedef homogeneous_right_product_refactoring_helper helper; typedef typename helper::ConstantBlock ConstantBlock; typedef typename helper::Xpr RefactoredXpr; typedef evaluator Base; EIGEN_DEVICE_FUNC explicit product_evaluator(const XprType& xpr) : Base( xpr.lhs().nestedExpression() .lazyProduct( xpr.rhs().template topRows(xpr.lhs().nestedExpression().cols()) ) + ConstantBlock(xpr.rhs().row(xpr.rhs().rows()-1),xpr.lhs().rows(), 1) ) {} }; template struct generic_product_impl, DenseShape, HomogeneousShape, ProductTag> { template EIGEN_DEVICE_FUNC static void evalTo(Dest& dst, const Lhs& lhs, const Homogeneous& rhs) { homogeneous_left_product_impl, Lhs>(lhs, rhs.nestedExpression()).evalTo(dst); } }; // TODO: the following specialization is to address a regression from 3.2 to 3.3 // In the future, this path should be optimized. template struct generic_product_impl, TriangularShape, HomogeneousShape, ProductTag> { template static void evalTo(Dest& dst, const Lhs& lhs, const Homogeneous& rhs) { dst.noalias() = lhs * rhs.eval(); } }; template struct homogeneous_left_product_refactoring_helper { enum { Dim = Rhs::RowsAtCompileTime, Cols = Rhs::ColsAtCompileTime }; typedef typename Lhs::template ConstNColsBlockXpr::Type LinearBlockConst; typedef typename remove_const::type LinearBlock; typedef typename Lhs::ConstColXpr ConstantColumn; typedef Replicate ConstantBlock; typedef Product LinearProduct; typedef CwiseBinaryOp, const LinearProduct, const ConstantBlock> Xpr; }; template struct product_evaluator, ProductTag, DenseShape, HomogeneousShape> : public evaluator::Xpr> { typedef Product XprType; typedef homogeneous_left_product_refactoring_helper helper; typedef typename helper::ConstantBlock ConstantBlock; typedef typename helper::Xpr RefactoredXpr; typedef evaluator Base; EIGEN_DEVICE_FUNC explicit product_evaluator(const XprType& xpr) : Base( xpr.lhs().template leftCols(xpr.rhs().nestedExpression().rows()) .lazyProduct( xpr.rhs().nestedExpression() ) + ConstantBlock(xpr.lhs().col(xpr.lhs().cols()-1),1,xpr.rhs().cols()) ) {} }; template struct generic_product_impl, Homogeneous, DenseShape, HomogeneousShape, ProductTag> { typedef Transform TransformType; template EIGEN_DEVICE_FUNC static void evalTo(Dest& dst, const TransformType& lhs, const Homogeneous& rhs) { homogeneous_left_product_impl, TransformType>(lhs, rhs.nestedExpression()).evalTo(dst); } }; template struct permutation_matrix_product : public permutation_matrix_product {}; } // end namespace internal } // end namespace Eigen #endif // EIGEN_HOMOGENEOUS_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Geometry/Hyperplane.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // Copyright (C) 2008 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_HYPERPLANE_H #define EIGEN_HYPERPLANE_H namespace Eigen { /** \geometry_module \ingroup Geometry_Module * * \class Hyperplane * * \brief A hyperplane * * A hyperplane is an affine subspace of dimension n-1 in a space of dimension n. * For example, a hyperplane in a plane is a line; a hyperplane in 3-space is a plane. * * \tparam Scalar_ the scalar type, i.e., the type of the coefficients * \tparam _AmbientDim the dimension of the ambient space, can be a compile time value or Dynamic. * Notice that the dimension of the hyperplane is _AmbientDim-1. * * This class represents an hyperplane as the zero set of the implicit equation * \f$ n \cdot x + d = 0 \f$ where \f$ n \f$ is a unit normal vector of the plane (linear part) * and \f$ d \f$ is the distance (offset) to the origin. */ template class Hyperplane { public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(Scalar_,_AmbientDim==Dynamic ? Dynamic : _AmbientDim+1) enum { AmbientDimAtCompileTime = _AmbientDim, Options = Options_ }; typedef Scalar_ Scalar; typedef typename NumTraits::Real RealScalar; typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3 typedef Matrix VectorType; typedef Matrix Coefficients; typedef Block NormalReturnType; typedef const Block ConstNormalReturnType; /** Default constructor without initialization */ EIGEN_DEVICE_FUNC inline Hyperplane() {} template EIGEN_DEVICE_FUNC Hyperplane(const Hyperplane& other) : m_coeffs(other.coeffs()) {} /** Constructs a dynamic-size hyperplane with \a _dim the dimension * of the ambient space */ EIGEN_DEVICE_FUNC inline explicit Hyperplane(Index _dim) : m_coeffs(_dim+1) {} /** Construct a plane from its normal \a n and a point \a e onto the plane. * \warning the vector normal is assumed to be normalized. */ EIGEN_DEVICE_FUNC inline Hyperplane(const VectorType& n, const VectorType& e) : m_coeffs(n.size()+1) { normal() = n; offset() = -n.dot(e); } /** Constructs a plane from its normal \a n and distance to the origin \a d * such that the algebraic equation of the plane is \f$ n \cdot x + d = 0 \f$. * \warning the vector normal is assumed to be normalized. */ EIGEN_DEVICE_FUNC inline Hyperplane(const VectorType& n, const Scalar& d) : m_coeffs(n.size()+1) { normal() = n; offset() = d; } /** Constructs a hyperplane passing through the two points. If the dimension of the ambient space * is greater than 2, then there isn't uniqueness, so an arbitrary choice is made. */ EIGEN_DEVICE_FUNC static inline Hyperplane Through(const VectorType& p0, const VectorType& p1) { Hyperplane result(p0.size()); result.normal() = (p1 - p0).unitOrthogonal(); result.offset() = -p0.dot(result.normal()); return result; } /** Constructs a hyperplane passing through the three points. The dimension of the ambient space * is required to be exactly 3. */ EIGEN_DEVICE_FUNC static inline Hyperplane Through(const VectorType& p0, const VectorType& p1, const VectorType& p2) { EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(VectorType, 3) Hyperplane result(p0.size()); VectorType v0(p2 - p0), v1(p1 - p0); result.normal() = v0.cross(v1); RealScalar norm = result.normal().norm(); if(norm <= v0.norm() * v1.norm() * NumTraits::epsilon()) { Matrix m; m << v0.transpose(), v1.transpose(); JacobiSVD > svd(m, ComputeFullV); result.normal() = svd.matrixV().col(2); } else result.normal() /= norm; result.offset() = -p0.dot(result.normal()); return result; } /** Constructs a hyperplane passing through the parametrized line \a parametrized. * If the dimension of the ambient space is greater than 2, then there isn't uniqueness, * so an arbitrary choice is made. */ // FIXME to be consistent with the rest this could be implemented as a static Through function ?? EIGEN_DEVICE_FUNC explicit Hyperplane(const ParametrizedLine& parametrized) { normal() = parametrized.direction().unitOrthogonal(); offset() = -parametrized.origin().dot(normal()); } EIGEN_DEVICE_FUNC ~Hyperplane() {} /** \returns the dimension in which the plane holds */ EIGEN_DEVICE_FUNC inline Index dim() const { return AmbientDimAtCompileTime==Dynamic ? m_coeffs.size()-1 : Index(AmbientDimAtCompileTime); } /** normalizes \c *this */ EIGEN_DEVICE_FUNC void normalize(void) { m_coeffs /= normal().norm(); } /** \returns the signed distance between the plane \c *this and a point \a p. * \sa absDistance() */ EIGEN_DEVICE_FUNC inline Scalar signedDistance(const VectorType& p) const { return normal().dot(p) + offset(); } /** \returns the absolute distance between the plane \c *this and a point \a p. * \sa signedDistance() */ EIGEN_DEVICE_FUNC inline Scalar absDistance(const VectorType& p) const { return numext::abs(signedDistance(p)); } /** \returns the projection of a point \a p onto the plane \c *this. */ EIGEN_DEVICE_FUNC inline VectorType projection(const VectorType& p) const { return p - signedDistance(p) * normal(); } /** \returns a constant reference to the unit normal vector of the plane, which corresponds * to the linear part of the implicit equation. */ EIGEN_DEVICE_FUNC inline ConstNormalReturnType normal() const { return ConstNormalReturnType(m_coeffs,0,0,dim(),1); } /** \returns a non-constant reference to the unit normal vector of the plane, which corresponds * to the linear part of the implicit equation. */ EIGEN_DEVICE_FUNC inline NormalReturnType normal() { return NormalReturnType(m_coeffs,0,0,dim(),1); } /** \returns the distance to the origin, which is also the "constant term" of the implicit equation * \warning the vector normal is assumed to be normalized. */ EIGEN_DEVICE_FUNC inline const Scalar& offset() const { return m_coeffs.coeff(dim()); } /** \returns a non-constant reference to the distance to the origin, which is also the constant part * of the implicit equation */ EIGEN_DEVICE_FUNC inline Scalar& offset() { return m_coeffs(dim()); } /** \returns a constant reference to the coefficients c_i of the plane equation: * \f$ c_0*x_0 + ... + c_{d-1}*x_{d-1} + c_d = 0 \f$ */ EIGEN_DEVICE_FUNC inline const Coefficients& coeffs() const { return m_coeffs; } /** \returns a non-constant reference to the coefficients c_i of the plane equation: * \f$ c_0*x_0 + ... + c_{d-1}*x_{d-1} + c_d = 0 \f$ */ EIGEN_DEVICE_FUNC inline Coefficients& coeffs() { return m_coeffs; } /** \returns the intersection of *this with \a other. * * \warning The ambient space must be a plane, i.e. have dimension 2, so that \c *this and \a other are lines. * * \note If \a other is approximately parallel to *this, this method will return any point on *this. */ EIGEN_DEVICE_FUNC VectorType intersection(const Hyperplane& other) const { EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(VectorType, 2) Scalar det = coeffs().coeff(0) * other.coeffs().coeff(1) - coeffs().coeff(1) * other.coeffs().coeff(0); // since the line equations ax+by=c are normalized with a^2+b^2=1, the following tests // whether the two lines are approximately parallel. if(internal::isMuchSmallerThan(det, Scalar(1))) { // special case where the two lines are approximately parallel. Pick any point on the first line. if(numext::abs(coeffs().coeff(1))>numext::abs(coeffs().coeff(0))) return VectorType(coeffs().coeff(1), -coeffs().coeff(2)/coeffs().coeff(1)-coeffs().coeff(0)); else return VectorType(-coeffs().coeff(2)/coeffs().coeff(0)-coeffs().coeff(1), coeffs().coeff(0)); } else { // general case Scalar invdet = Scalar(1) / det; return VectorType(invdet*(coeffs().coeff(1)*other.coeffs().coeff(2)-other.coeffs().coeff(1)*coeffs().coeff(2)), invdet*(other.coeffs().coeff(0)*coeffs().coeff(2)-coeffs().coeff(0)*other.coeffs().coeff(2))); } } /** Applies the transformation matrix \a mat to \c *this and returns a reference to \c *this. * * \param mat the Dim x Dim transformation matrix * \param traits specifies whether the matrix \a mat represents an #Isometry * or a more generic #Affine transformation. The default is #Affine. */ template EIGEN_DEVICE_FUNC inline Hyperplane& transform(const MatrixBase& mat, TransformTraits traits = Affine) { if (traits==Affine) { normal() = mat.inverse().transpose() * normal(); m_coeffs /= normal().norm(); } else if (traits==Isometry) normal() = mat * normal(); else { eigen_assert(0 && "invalid traits value in Hyperplane::transform()"); } return *this; } /** Applies the transformation \a t to \c *this and returns a reference to \c *this. * * \param t the transformation of dimension Dim * \param traits specifies whether the transformation \a t represents an #Isometry * or a more generic #Affine transformation. The default is #Affine. * Other kind of transformations are not supported. */ template EIGEN_DEVICE_FUNC inline Hyperplane& transform(const Transform& t, TransformTraits traits = Affine) { transform(t.linear(), traits); offset() -= normal().dot(t.translation()); return *this; } /** \returns \c *this with scalar type casted to \a NewScalarType * * Note that if \a NewScalarType is equal to the current scalar type of \c *this * then this function smartly returns a const reference to \c *this. */ template EIGEN_DEVICE_FUNC inline typename internal::cast_return_type >::type cast() const { return typename internal::cast_return_type >::type(*this); } /** Copy constructor with scalar type conversion */ template EIGEN_DEVICE_FUNC inline explicit Hyperplane(const Hyperplane& other) { m_coeffs = other.coeffs().template cast(); } /** \returns \c true if \c *this is approximately equal to \a other, within the precision * determined by \a prec. * * \sa MatrixBase::isApprox() */ template EIGEN_DEVICE_FUNC bool isApprox(const Hyperplane& other, const typename NumTraits::Real& prec = NumTraits::dummy_precision()) const { return m_coeffs.isApprox(other.m_coeffs, prec); } protected: Coefficients m_coeffs; }; } // end namespace Eigen #endif // EIGEN_HYPERPLANE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Geometry/OrthoMethods.h ================================================ // 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 // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_ORTHOMETHODS_H #define EIGEN_ORTHOMETHODS_H namespace Eigen { /** \geometry_module \ingroup Geometry_Module * * \returns the cross product of \c *this and \a other * * Here is a very good explanation of cross-product: http://xkcd.com/199/ * * With complex numbers, the cross product is implemented as * \f$ (\mathbf{a}+i\mathbf{b}) \times (\mathbf{c}+i\mathbf{d}) = (\mathbf{a} \times \mathbf{c} - \mathbf{b} \times \mathbf{d}) - i(\mathbf{a} \times \mathbf{d} - \mathbf{b} \times \mathbf{c})\f$ * * \sa MatrixBase::cross3() */ template template #ifndef EIGEN_PARSED_BY_DOXYGEN EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename MatrixBase::template cross_product_return_type::type #else typename MatrixBase::PlainObject #endif MatrixBase::cross(const MatrixBase& other) const { EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Derived,3) EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,3) // Note that there is no need for an expression here since the compiler // optimize such a small temporary very well (even within a complex expression) typename internal::nested_eval::type lhs(derived()); typename internal::nested_eval::type rhs(other.derived()); return typename cross_product_return_type::type( numext::conj(lhs.coeff(1) * rhs.coeff(2) - lhs.coeff(2) * rhs.coeff(1)), numext::conj(lhs.coeff(2) * rhs.coeff(0) - lhs.coeff(0) * rhs.coeff(2)), numext::conj(lhs.coeff(0) * rhs.coeff(1) - lhs.coeff(1) * rhs.coeff(0)) ); } namespace internal { template< int Arch,typename VectorLhs,typename VectorRhs, typename Scalar = typename VectorLhs::Scalar, bool Vectorizable = bool((VectorLhs::Flags&VectorRhs::Flags)&PacketAccessBit)> struct cross3_impl { EIGEN_DEVICE_FUNC static inline typename internal::plain_matrix_type::type run(const VectorLhs& lhs, const VectorRhs& rhs) { return typename internal::plain_matrix_type::type( numext::conj(lhs.coeff(1) * rhs.coeff(2) - lhs.coeff(2) * rhs.coeff(1)), numext::conj(lhs.coeff(2) * rhs.coeff(0) - lhs.coeff(0) * rhs.coeff(2)), numext::conj(lhs.coeff(0) * rhs.coeff(1) - lhs.coeff(1) * rhs.coeff(0)), 0 ); } }; } /** \geometry_module \ingroup Geometry_Module * * \returns the cross product of \c *this and \a other using only the x, y, and z coefficients * * The size of \c *this and \a other must be four. This function is especially useful * when using 4D vectors instead of 3D ones to get advantage of SSE/AltiVec vectorization. * * \sa MatrixBase::cross() */ template template EIGEN_DEVICE_FUNC inline typename MatrixBase::PlainObject MatrixBase::cross3(const MatrixBase& other) const { EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Derived,4) EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,4) typedef typename internal::nested_eval::type DerivedNested; typedef typename internal::nested_eval::type OtherDerivedNested; DerivedNested lhs(derived()); OtherDerivedNested rhs(other.derived()); return internal::cross3_impl::type, typename internal::remove_all::type>::run(lhs,rhs); } /** \geometry_module \ingroup Geometry_Module * * \returns a matrix expression of the cross product of each column or row * of the referenced expression with the \a other vector. * * The referenced matrix must have one dimension equal to 3. * The result matrix has the same dimensions than the referenced one. * * \sa MatrixBase::cross() */ template template EIGEN_DEVICE_FUNC const typename VectorwiseOp::CrossReturnType VectorwiseOp::cross(const MatrixBase& other) const { EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,3) 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) typename internal::nested_eval::type mat(_expression()); typename internal::nested_eval::type vec(other.derived()); CrossReturnType res(_expression().rows(),_expression().cols()); if(Direction==Vertical) { eigen_assert(CrossReturnType::RowsAtCompileTime==3 && "the matrix must have exactly 3 rows"); res.row(0) = (mat.row(1) * vec.coeff(2) - mat.row(2) * vec.coeff(1)).conjugate(); res.row(1) = (mat.row(2) * vec.coeff(0) - mat.row(0) * vec.coeff(2)).conjugate(); res.row(2) = (mat.row(0) * vec.coeff(1) - mat.row(1) * vec.coeff(0)).conjugate(); } else { eigen_assert(CrossReturnType::ColsAtCompileTime==3 && "the matrix must have exactly 3 columns"); res.col(0) = (mat.col(1) * vec.coeff(2) - mat.col(2) * vec.coeff(1)).conjugate(); res.col(1) = (mat.col(2) * vec.coeff(0) - mat.col(0) * vec.coeff(2)).conjugate(); res.col(2) = (mat.col(0) * vec.coeff(1) - mat.col(1) * vec.coeff(0)).conjugate(); } return res; } namespace internal { template struct unitOrthogonal_selector { typedef typename plain_matrix_type::type VectorType; typedef typename traits::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef Matrix Vector2; EIGEN_DEVICE_FUNC static inline VectorType run(const Derived& src) { VectorType perp = VectorType::Zero(src.size()); Index maxi = 0; Index sndi = 0; src.cwiseAbs().maxCoeff(&maxi); if (maxi==0) sndi = 1; RealScalar invnm = RealScalar(1)/(Vector2() << src.coeff(sndi),src.coeff(maxi)).finished().norm(); perp.coeffRef(maxi) = -numext::conj(src.coeff(sndi)) * invnm; perp.coeffRef(sndi) = numext::conj(src.coeff(maxi)) * invnm; return perp; } }; template struct unitOrthogonal_selector { typedef typename plain_matrix_type::type VectorType; typedef typename traits::Scalar Scalar; typedef typename NumTraits::Real RealScalar; EIGEN_DEVICE_FUNC static inline VectorType run(const Derived& src) { VectorType perp; /* Let us compute the crossed product of *this with a vector * that is not too close to being colinear to *this. */ /* unless the x and y coords are both close to zero, we can * simply take ( -y, x, 0 ) and normalize it. */ if((!isMuchSmallerThan(src.x(), src.z())) || (!isMuchSmallerThan(src.y(), src.z()))) { RealScalar invnm = RealScalar(1)/src.template head<2>().norm(); perp.coeffRef(0) = -numext::conj(src.y())*invnm; perp.coeffRef(1) = numext::conj(src.x())*invnm; perp.coeffRef(2) = 0; } /* if both x and y are close to zero, then the vector is close * to the z-axis, so it's far from colinear to the x-axis for instance. * So we take the crossed product with (1,0,0) and normalize it. */ else { RealScalar invnm = RealScalar(1)/src.template tail<2>().norm(); perp.coeffRef(0) = 0; perp.coeffRef(1) = -numext::conj(src.z())*invnm; perp.coeffRef(2) = numext::conj(src.y())*invnm; } return perp; } }; template struct unitOrthogonal_selector { typedef typename plain_matrix_type::type VectorType; EIGEN_DEVICE_FUNC static inline VectorType run(const Derived& src) { return VectorType(-numext::conj(src.y()), numext::conj(src.x())).normalized(); } }; } // end namespace internal /** \geometry_module \ingroup Geometry_Module * * \returns a unit vector which is orthogonal to \c *this * * The size of \c *this must be at least 2. If the size is exactly 2, * then the returned vector is a counter clock wise rotation of \c *this, i.e., (-y,x).normalized(). * * \sa cross() */ template EIGEN_DEVICE_FUNC typename MatrixBase::PlainObject MatrixBase::unitOrthogonal() const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) return internal::unitOrthogonal_selector::run(derived()); } } // end namespace Eigen #endif // EIGEN_ORTHOMETHODS_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Geometry/ParametrizedLine.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // Copyright (C) 2008 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_PARAMETRIZEDLINE_H #define EIGEN_PARAMETRIZEDLINE_H namespace Eigen { /** \geometry_module \ingroup Geometry_Module * * \class ParametrizedLine * * \brief A parametrized line * * A parametrized line is defined by an origin point \f$ \mathbf{o} \f$ and a unit * direction vector \f$ \mathbf{d} \f$ such that the line corresponds to * the set \f$ l(t) = \mathbf{o} + t \mathbf{d} \f$, \f$ t \in \mathbf{R} \f$. * * \tparam Scalar_ the scalar type, i.e., the type of the coefficients * \tparam _AmbientDim the dimension of the ambient space, can be a compile time value or Dynamic. */ template class ParametrizedLine { public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(Scalar_,_AmbientDim) enum { AmbientDimAtCompileTime = _AmbientDim, Options = Options_ }; typedef Scalar_ Scalar; typedef typename NumTraits::Real RealScalar; typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3 typedef Matrix VectorType; /** Default constructor without initialization */ EIGEN_DEVICE_FUNC inline ParametrizedLine() {} template EIGEN_DEVICE_FUNC ParametrizedLine(const ParametrizedLine& other) : m_origin(other.origin()), m_direction(other.direction()) {} /** Constructs a dynamic-size line with \a _dim the dimension * of the ambient space */ EIGEN_DEVICE_FUNC inline explicit ParametrizedLine(Index _dim) : m_origin(_dim), m_direction(_dim) {} /** Initializes a parametrized line of direction \a direction and origin \a origin. * \warning the vector direction is assumed to be normalized. */ EIGEN_DEVICE_FUNC ParametrizedLine(const VectorType& origin, const VectorType& direction) : m_origin(origin), m_direction(direction) {} template EIGEN_DEVICE_FUNC explicit ParametrizedLine(const Hyperplane& hyperplane); /** Constructs a parametrized line going from \a p0 to \a p1. */ EIGEN_DEVICE_FUNC static inline ParametrizedLine Through(const VectorType& p0, const VectorType& p1) { return ParametrizedLine(p0, (p1-p0).normalized()); } EIGEN_DEVICE_FUNC ~ParametrizedLine() {} /** \returns the dimension in which the line holds */ EIGEN_DEVICE_FUNC inline Index dim() const { return m_direction.size(); } EIGEN_DEVICE_FUNC const VectorType& origin() const { return m_origin; } EIGEN_DEVICE_FUNC VectorType& origin() { return m_origin; } EIGEN_DEVICE_FUNC const VectorType& direction() const { return m_direction; } EIGEN_DEVICE_FUNC VectorType& direction() { return m_direction; } /** \returns the squared distance of a point \a p to its projection onto the line \c *this. * \sa distance() */ EIGEN_DEVICE_FUNC RealScalar squaredDistance(const VectorType& p) const { VectorType diff = p - origin(); return (diff - direction().dot(diff) * direction()).squaredNorm(); } /** \returns the distance of a point \a p to its projection onto the line \c *this. * \sa squaredDistance() */ EIGEN_DEVICE_FUNC RealScalar distance(const VectorType& p) const { EIGEN_USING_STD(sqrt) return sqrt(squaredDistance(p)); } /** \returns the projection of a point \a p onto the line \c *this. */ EIGEN_DEVICE_FUNC VectorType projection(const VectorType& p) const { return origin() + direction().dot(p-origin()) * direction(); } EIGEN_DEVICE_FUNC VectorType pointAt(const Scalar& t) const; template EIGEN_DEVICE_FUNC Scalar intersectionParameter(const Hyperplane& hyperplane) const; template EIGEN_DEVICE_FUNC Scalar intersection(const Hyperplane& hyperplane) const; template EIGEN_DEVICE_FUNC VectorType intersectionPoint(const Hyperplane& hyperplane) const; /** Applies the transformation matrix \a mat to \c *this and returns a reference to \c *this. * * \param mat the Dim x Dim transformation matrix * \param traits specifies whether the matrix \a mat represents an #Isometry * or a more generic #Affine transformation. The default is #Affine. */ template EIGEN_DEVICE_FUNC inline ParametrizedLine& transform(const MatrixBase& mat, TransformTraits traits = Affine) { if (traits==Affine) direction() = (mat * direction()).normalized(); else if (traits==Isometry) direction() = mat * direction(); else { eigen_assert(0 && "invalid traits value in ParametrizedLine::transform()"); } origin() = mat * origin(); return *this; } /** Applies the transformation \a t to \c *this and returns a reference to \c *this. * * \param t the transformation of dimension Dim * \param traits specifies whether the transformation \a t represents an #Isometry * or a more generic #Affine transformation. The default is #Affine. * Other kind of transformations are not supported. */ template EIGEN_DEVICE_FUNC inline ParametrizedLine& transform(const Transform& t, TransformTraits traits = Affine) { transform(t.linear(), traits); origin() += t.translation(); return *this; } /** \returns \c *this with scalar type casted to \a NewScalarType * * Note that if \a NewScalarType is equal to the current scalar type of \c *this * then this function smartly returns a const reference to \c *this. */ template EIGEN_DEVICE_FUNC inline typename internal::cast_return_type >::type cast() const { return typename internal::cast_return_type >::type(*this); } /** Copy constructor with scalar type conversion */ template EIGEN_DEVICE_FUNC inline explicit ParametrizedLine(const ParametrizedLine& other) { m_origin = other.origin().template cast(); m_direction = other.direction().template cast(); } /** \returns \c true if \c *this is approximately equal to \a other, within the precision * determined by \a prec. * * \sa MatrixBase::isApprox() */ EIGEN_DEVICE_FUNC bool isApprox(const ParametrizedLine& other, const typename NumTraits::Real& prec = NumTraits::dummy_precision()) const { return m_origin.isApprox(other.m_origin, prec) && m_direction.isApprox(other.m_direction, prec); } protected: VectorType m_origin, m_direction; }; /** Constructs a parametrized line from a 2D hyperplane * * \warning the ambient space must have dimension 2 such that the hyperplane actually describes a line */ template template EIGEN_DEVICE_FUNC inline ParametrizedLine::ParametrizedLine(const Hyperplane& hyperplane) { EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(VectorType, 2) direction() = hyperplane.normal().unitOrthogonal(); origin() = -hyperplane.normal()*hyperplane.offset(); } /** \returns the point at \a t along this line */ template EIGEN_DEVICE_FUNC inline typename ParametrizedLine::VectorType ParametrizedLine::pointAt(const Scalar_& t) const { return origin() + (direction()*t); } /** \returns the parameter value of the intersection between \c *this and the given \a hyperplane */ template template EIGEN_DEVICE_FUNC inline Scalar_ ParametrizedLine::intersectionParameter(const Hyperplane& hyperplane) const { return -(hyperplane.offset()+hyperplane.normal().dot(origin())) / hyperplane.normal().dot(direction()); } /** \deprecated use intersectionParameter() * \returns the parameter value of the intersection between \c *this and the given \a hyperplane */ template template EIGEN_DEVICE_FUNC inline Scalar_ ParametrizedLine::intersection(const Hyperplane& hyperplane) const { return intersectionParameter(hyperplane); } /** \returns the point of the intersection between \c *this and the given hyperplane */ template template EIGEN_DEVICE_FUNC inline typename ParametrizedLine::VectorType ParametrizedLine::intersectionPoint(const Hyperplane& hyperplane) const { return pointAt(intersectionParameter(hyperplane)); } } // end namespace Eigen #endif // EIGEN_PARAMETRIZEDLINE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Geometry/Quaternion.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2010 Gael Guennebaud // Copyright (C) 2009 Mathieu Gautier // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_QUATERNION_H #define EIGEN_QUATERNION_H namespace Eigen { /*************************************************************************** * Definition of QuaternionBase * The implementation is at the end of the file ***************************************************************************/ namespace internal { template struct quaternionbase_assign_impl; } /** \geometry_module \ingroup Geometry_Module * \class QuaternionBase * \brief Base class for quaternion expressions * \tparam Derived derived type (CRTP) * \sa class Quaternion */ template class QuaternionBase : public RotationBase { public: typedef RotationBase Base; using Base::operator*; using Base::derived; typedef typename internal::traits::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef typename internal::traits::Coefficients Coefficients; typedef typename Coefficients::CoeffReturnType CoeffReturnType; typedef typename internal::conditional::Flags&LvalueBit), Scalar&, CoeffReturnType>::type NonConstCoeffReturnType; enum { Flags = Eigen::internal::traits::Flags }; // typedef typename Matrix Coefficients; /** the type of a 3D vector */ typedef Matrix Vector3; /** the equivalent rotation matrix type */ typedef Matrix Matrix3; /** the equivalent angle-axis type */ typedef AngleAxis AngleAxisType; /** \returns the \c x coefficient */ EIGEN_DEVICE_FUNC inline CoeffReturnType x() const { return this->derived().coeffs().coeff(0); } /** \returns the \c y coefficient */ EIGEN_DEVICE_FUNC inline CoeffReturnType y() const { return this->derived().coeffs().coeff(1); } /** \returns the \c z coefficient */ EIGEN_DEVICE_FUNC inline CoeffReturnType z() const { return this->derived().coeffs().coeff(2); } /** \returns the \c w coefficient */ EIGEN_DEVICE_FUNC inline CoeffReturnType w() const { return this->derived().coeffs().coeff(3); } /** \returns a reference to the \c x coefficient (if Derived is a non-const lvalue) */ EIGEN_DEVICE_FUNC inline NonConstCoeffReturnType x() { return this->derived().coeffs().x(); } /** \returns a reference to the \c y coefficient (if Derived is a non-const lvalue) */ EIGEN_DEVICE_FUNC inline NonConstCoeffReturnType y() { return this->derived().coeffs().y(); } /** \returns a reference to the \c z coefficient (if Derived is a non-const lvalue) */ EIGEN_DEVICE_FUNC inline NonConstCoeffReturnType z() { return this->derived().coeffs().z(); } /** \returns a reference to the \c w coefficient (if Derived is a non-const lvalue) */ EIGEN_DEVICE_FUNC inline NonConstCoeffReturnType w() { return this->derived().coeffs().w(); } /** \returns a read-only vector expression of the imaginary part (x,y,z) */ EIGEN_DEVICE_FUNC inline const VectorBlock vec() const { return coeffs().template head<3>(); } /** \returns a vector expression of the imaginary part (x,y,z) */ EIGEN_DEVICE_FUNC inline VectorBlock vec() { return coeffs().template head<3>(); } /** \returns a read-only vector expression of the coefficients (x,y,z,w) */ EIGEN_DEVICE_FUNC inline const typename internal::traits::Coefficients& coeffs() const { return derived().coeffs(); } /** \returns a vector expression of the coefficients (x,y,z,w) */ EIGEN_DEVICE_FUNC inline typename internal::traits::Coefficients& coeffs() { return derived().coeffs(); } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE QuaternionBase& operator=(const QuaternionBase& other); template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const QuaternionBase& other); // disabled this copy operator as it is giving very strange compilation errors when compiling // test_stdvector with GCC 4.4.2. This looks like a GCC bug though, so feel free to re-enable it if it's // useful; however notice that we already have the templated operator= above and e.g. in MatrixBase // we didn't have to add, in addition to templated operator=, such a non-templated copy operator. // Derived& operator=(const QuaternionBase& other) // { return operator=(other); } EIGEN_DEVICE_FUNC Derived& operator=(const AngleAxisType& aa); template EIGEN_DEVICE_FUNC Derived& operator=(const MatrixBase& m); /** \returns a quaternion representing an identity rotation * \sa MatrixBase::Identity() */ EIGEN_DEVICE_FUNC static inline Quaternion Identity() { return Quaternion(Scalar(1), Scalar(0), Scalar(0), Scalar(0)); } /** \sa QuaternionBase::Identity(), MatrixBase::setIdentity() */ EIGEN_DEVICE_FUNC inline QuaternionBase& setIdentity() { coeffs() << Scalar(0), Scalar(0), Scalar(0), Scalar(1); return *this; } /** \returns the squared norm of the quaternion's coefficients * \sa QuaternionBase::norm(), MatrixBase::squaredNorm() */ EIGEN_DEVICE_FUNC inline Scalar squaredNorm() const { return coeffs().squaredNorm(); } /** \returns the norm of the quaternion's coefficients * \sa QuaternionBase::squaredNorm(), MatrixBase::norm() */ EIGEN_DEVICE_FUNC inline Scalar norm() const { return coeffs().norm(); } /** Normalizes the quaternion \c *this * \sa normalized(), MatrixBase::normalize() */ EIGEN_DEVICE_FUNC inline void normalize() { coeffs().normalize(); } /** \returns a normalized copy of \c *this * \sa normalize(), MatrixBase::normalized() */ EIGEN_DEVICE_FUNC inline Quaternion normalized() const { return Quaternion(coeffs().normalized()); } /** \returns the dot product of \c *this and \a other * Geometrically speaking, the dot product of two unit quaternions * corresponds to the cosine of half the angle between the two rotations. * \sa angularDistance() */ template EIGEN_DEVICE_FUNC inline Scalar dot(const QuaternionBase& other) const { return coeffs().dot(other.coeffs()); } template EIGEN_DEVICE_FUNC Scalar angularDistance(const QuaternionBase& other) const; /** \returns an equivalent 3x3 rotation matrix */ EIGEN_DEVICE_FUNC inline Matrix3 toRotationMatrix() const; /** \returns the quaternion which transform \a a into \a b through a rotation */ template EIGEN_DEVICE_FUNC Derived& setFromTwoVectors(const MatrixBase& a, const MatrixBase& b); template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Quaternion operator* (const QuaternionBase& q) const; template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator*= (const QuaternionBase& q); /** \returns the quaternion describing the inverse rotation */ EIGEN_DEVICE_FUNC Quaternion inverse() const; /** \returns the conjugated quaternion */ EIGEN_DEVICE_FUNC Quaternion conjugate() const; template EIGEN_DEVICE_FUNC Quaternion slerp(const Scalar& t, const QuaternionBase& other) 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 EIGEN_DEVICE_FUNC inline bool operator==(const QuaternionBase& other) const { return coeffs() == other.coeffs(); } /** \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 EIGEN_DEVICE_FUNC inline bool operator!=(const QuaternionBase& other) const { return coeffs() != other.coeffs(); } /** \returns \c true if \c *this is approximately equal to \a other, within the precision * determined by \a prec. * * \sa MatrixBase::isApprox() */ template EIGEN_DEVICE_FUNC bool isApprox(const QuaternionBase& other, const RealScalar& prec = NumTraits::dummy_precision()) const { return coeffs().isApprox(other.coeffs(), prec); } /** return the result vector of \a v through the rotation*/ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Vector3 _transformVector(const Vector3& v) const; #ifdef EIGEN_PARSED_BY_DOXYGEN /** \returns \c *this with scalar type casted to \a NewScalarType * * Note that if \a NewScalarType is equal to the current scalar type of \c *this * then this function smartly returns a const reference to \c *this. */ template EIGEN_DEVICE_FUNC inline typename internal::cast_return_type >::type cast() const; #else template EIGEN_DEVICE_FUNC inline typename internal::enable_if::value,const Derived&>::type cast() const { return derived(); } template EIGEN_DEVICE_FUNC inline typename internal::enable_if::value,Quaternion >::type cast() const { return Quaternion(coeffs().template cast()); } #endif #ifndef EIGEN_NO_IO friend std::ostream& operator<<(std::ostream& s, const QuaternionBase& q) { s << q.x() << "i + " << q.y() << "j + " << q.z() << "k" << " + " << q.w(); return s; } #endif #ifdef EIGEN_QUATERNIONBASE_PLUGIN # include EIGEN_QUATERNIONBASE_PLUGIN #endif protected: EIGEN_DEFAULT_COPY_CONSTRUCTOR(QuaternionBase) EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(QuaternionBase) }; /*************************************************************************** * Definition/implementation of Quaternion ***************************************************************************/ /** \geometry_module \ingroup Geometry_Module * * \class Quaternion * * \brief The quaternion class used to represent 3D orientations and rotations * * \tparam Scalar_ the scalar type, i.e., the type of the coefficients * \tparam Options_ controls the memory alignment of the coefficients. Can be \# AutoAlign or \# DontAlign. Default is AutoAlign. * * This class represents a quaternion \f$ w+xi+yj+zk \f$ that is a convenient representation of * orientations and rotations of objects in three dimensions. Compared to other representations * like Euler angles or 3x3 matrices, quaternions offer the following advantages: * \li \b compact storage (4 scalars) * \li \b efficient to compose (28 flops), * \li \b stable spherical interpolation * * The following two typedefs are provided for convenience: * \li \c Quaternionf for \c float * \li \c Quaterniond for \c double * * \warning Operations interpreting the quaternion as rotation have undefined behavior if the quaternion is not normalized. * * \sa class AngleAxis, class Transform */ namespace internal { template struct traits > { typedef Quaternion PlainObject; typedef Scalar_ Scalar; typedef Matrix Coefficients; enum{ Alignment = internal::traits::Alignment, Flags = LvalueBit }; }; } template class Quaternion : public QuaternionBase > { public: typedef QuaternionBase > Base; enum { NeedsAlignment = internal::traits::Alignment>0 }; typedef Scalar_ Scalar; EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Quaternion) using Base::operator*=; typedef typename internal::traits::Coefficients Coefficients; typedef typename Base::AngleAxisType AngleAxisType; /** Default constructor leaving the quaternion uninitialized. */ EIGEN_DEVICE_FUNC inline Quaternion() {} /** Constructs and initializes the quaternion \f$ w+xi+yj+zk \f$ from * its four coefficients \a w, \a x, \a y and \a z. * * \warning Note the order of the arguments: the real \a w coefficient first, * while internally the coefficients are stored in the following order: * [\c x, \c y, \c z, \c w] */ EIGEN_DEVICE_FUNC inline Quaternion(const Scalar& w, const Scalar& x, const Scalar& y, const Scalar& z) : m_coeffs(x, y, z, w){} /** Constructs and initialize a quaternion from the array data */ EIGEN_DEVICE_FUNC explicit inline Quaternion(const Scalar* data) : m_coeffs(data) {} /** Copy constructor */ template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Quaternion(const QuaternionBase& other) { this->Base::operator=(other); } /** Constructs and initializes a quaternion from the angle-axis \a aa */ EIGEN_DEVICE_FUNC explicit inline Quaternion(const AngleAxisType& aa) { *this = aa; } /** Constructs and initializes a quaternion from either: * - a rotation matrix expression, * - a 4D vector expression representing quaternion coefficients. */ template EIGEN_DEVICE_FUNC explicit inline Quaternion(const MatrixBase& other) { *this = other; } /** Explicit copy constructor with scalar conversion */ template EIGEN_DEVICE_FUNC explicit inline Quaternion(const Quaternion& other) { m_coeffs = other.coeffs().template cast(); } #if EIGEN_HAS_RVALUE_REFERENCES // We define a copy constructor, which means we don't get an implicit move constructor or assignment operator. /** Default move constructor */ EIGEN_DEVICE_FUNC inline Quaternion(Quaternion&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible::value) : m_coeffs(std::move(other.coeffs())) {} /** Default move assignment operator */ EIGEN_DEVICE_FUNC Quaternion& operator=(Quaternion&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable::value) { m_coeffs = std::move(other.coeffs()); return *this; } #endif EIGEN_DEVICE_FUNC static Quaternion UnitRandom(); template EIGEN_DEVICE_FUNC static Quaternion FromTwoVectors(const MatrixBase& a, const MatrixBase& b); EIGEN_DEVICE_FUNC inline Coefficients& coeffs() { return m_coeffs;} EIGEN_DEVICE_FUNC inline const Coefficients& coeffs() const { return m_coeffs;} EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(bool(NeedsAlignment)) #ifdef EIGEN_QUATERNION_PLUGIN # include EIGEN_QUATERNION_PLUGIN #endif protected: Coefficients m_coeffs; #ifndef EIGEN_PARSED_BY_DOXYGEN static EIGEN_STRONG_INLINE void _check_template_params() { EIGEN_STATIC_ASSERT( (Options_ & DontAlign) == Options_, INVALID_MATRIX_TEMPLATE_PARAMETERS) } #endif }; /** \ingroup Geometry_Module * single precision quaternion type */ typedef Quaternion Quaternionf; /** \ingroup Geometry_Module * double precision quaternion type */ typedef Quaternion Quaterniond; /*************************************************************************** * Specialization of Map> ***************************************************************************/ namespace internal { template struct traits, Options_> > : traits > { typedef Map, Options_> Coefficients; }; } namespace internal { template struct traits, Options_> > : traits > { typedef Map, Options_> Coefficients; typedef traits > TraitsBase; enum { Flags = TraitsBase::Flags & ~LvalueBit }; }; } /** \ingroup Geometry_Module * \brief Quaternion expression mapping a constant memory buffer * * \tparam Scalar_ the type of the Quaternion coefficients * \tparam Options_ see class Map * * This is a specialization of class Map for Quaternion. This class allows to view * a 4 scalar memory buffer as an Eigen's Quaternion object. * * \sa class Map, class Quaternion, class QuaternionBase */ template class Map, Options_ > : public QuaternionBase, Options_> > { public: typedef QuaternionBase, Options_> > Base; typedef Scalar_ Scalar; typedef typename internal::traits::Coefficients Coefficients; EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map) using Base::operator*=; /** Constructs a Mapped Quaternion object from the pointer \a coeffs * * The pointer \a coeffs must reference the four coefficients of Quaternion in the following order: * \code *coeffs == {x, y, z, w} \endcode * * If the template parameter Options_ is set to #Aligned, then the pointer coeffs must be aligned. */ EIGEN_DEVICE_FUNC explicit EIGEN_STRONG_INLINE Map(const Scalar* coeffs) : m_coeffs(coeffs) {} EIGEN_DEVICE_FUNC inline const Coefficients& coeffs() const { return m_coeffs;} protected: const Coefficients m_coeffs; }; /** \ingroup Geometry_Module * \brief Expression of a quaternion from a memory buffer * * \tparam Scalar_ the type of the Quaternion coefficients * \tparam Options_ see class Map * * This is a specialization of class Map for Quaternion. This class allows to view * a 4 scalar memory buffer as an Eigen's Quaternion object. * * \sa class Map, class Quaternion, class QuaternionBase */ template class Map, Options_ > : public QuaternionBase, Options_> > { public: typedef QuaternionBase, Options_> > Base; typedef Scalar_ Scalar; typedef typename internal::traits::Coefficients Coefficients; EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map) using Base::operator*=; /** Constructs a Mapped Quaternion object from the pointer \a coeffs * * The pointer \a coeffs must reference the four coefficients of Quaternion in the following order: * \code *coeffs == {x, y, z, w} \endcode * * If the template parameter Options_ is set to #Aligned, then the pointer coeffs must be aligned. */ EIGEN_DEVICE_FUNC explicit EIGEN_STRONG_INLINE Map(Scalar* coeffs) : m_coeffs(coeffs) {} EIGEN_DEVICE_FUNC inline Coefficients& coeffs() { return m_coeffs; } EIGEN_DEVICE_FUNC inline const Coefficients& coeffs() const { return m_coeffs; } protected: Coefficients m_coeffs; }; /** \ingroup Geometry_Module * Map an unaligned array of single precision scalars as a quaternion */ typedef Map, 0> QuaternionMapf; /** \ingroup Geometry_Module * Map an unaligned array of double precision scalars as a quaternion */ typedef Map, 0> QuaternionMapd; /** \ingroup Geometry_Module * Map a 16-byte aligned array of single precision scalars as a quaternion */ typedef Map, Aligned> QuaternionMapAlignedf; /** \ingroup Geometry_Module * Map a 16-byte aligned array of double precision scalars as a quaternion */ typedef Map, Aligned> QuaternionMapAlignedd; /*************************************************************************** * Implementation of QuaternionBase methods ***************************************************************************/ // Generic Quaternion * Quaternion product // This product can be specialized for a given architecture via the Arch template argument. namespace internal { template struct quat_product { EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Quaternion run(const QuaternionBase& a, const QuaternionBase& b){ return Quaternion ( a.w() * b.w() - a.x() * b.x() - a.y() * b.y() - a.z() * b.z(), a.w() * b.x() + a.x() * b.w() + a.y() * b.z() - a.z() * b.y(), a.w() * b.y() + a.y() * b.w() + a.z() * b.x() - a.x() * b.z(), a.w() * b.z() + a.z() * b.w() + a.x() * b.y() - a.y() * b.x() ); } }; } /** \returns the concatenation of two rotations as a quaternion-quaternion product */ template template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Quaternion::Scalar> QuaternionBase::operator* (const QuaternionBase& other) const { 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) return internal::quat_product::Scalar>::run(*this, other); } /** \sa operator*(Quaternion) */ template template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& QuaternionBase::operator*= (const QuaternionBase& other) { derived() = derived() * other.derived(); return derived(); } /** Rotation of a vector by a quaternion. * \remarks If the quaternion is used to rotate several points (>1) * then it is much more efficient to first convert it to a 3x3 Matrix. * Comparison of the operation cost for n transformations: * - Quaternion2: 30n * - Via a Matrix3: 24 + 15n */ template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename QuaternionBase::Vector3 QuaternionBase::_transformVector(const Vector3& v) const { // Note that this algorithm comes from the optimization by hand // of the conversion to a Matrix followed by a Matrix/Vector product. // It appears to be much faster than the common algorithm found // in the literature (30 versus 39 flops). It also requires two // Vector3 as temporaries. Vector3 uv = this->vec().cross(v); uv += uv; return v + this->w() * uv + this->vec().cross(uv); } template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE QuaternionBase& QuaternionBase::operator=(const QuaternionBase& other) { coeffs() = other.coeffs(); return derived(); } template template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& QuaternionBase::operator=(const QuaternionBase& other) { coeffs() = other.coeffs(); return derived(); } /** Set \c *this from an angle-axis \a aa and returns a reference to \c *this */ template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& QuaternionBase::operator=(const AngleAxisType& aa) { EIGEN_USING_STD(cos) EIGEN_USING_STD(sin) Scalar ha = Scalar(0.5)*aa.angle(); // Scalar(0.5) to suppress precision loss warnings this->w() = cos(ha); this->vec() = sin(ha) * aa.axis(); return derived(); } /** Set \c *this from the expression \a xpr: * - if \a xpr is a 4x1 vector, then \a xpr is assumed to be a quaternion * - if \a xpr is a 3x3 matrix, then \a xpr is assumed to be rotation matrix * and \a xpr is converted to a quaternion */ template template EIGEN_DEVICE_FUNC inline Derived& QuaternionBase::operator=(const MatrixBase& xpr) { 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) internal::quaternionbase_assign_impl::run(*this, xpr.derived()); return derived(); } /** Convert the quaternion to a 3x3 rotation matrix. The quaternion is required to * be normalized, otherwise the result is undefined. */ template EIGEN_DEVICE_FUNC inline typename QuaternionBase::Matrix3 QuaternionBase::toRotationMatrix(void) const { // NOTE if inlined, then gcc 4.2 and 4.4 get rid of the temporary (not gcc 4.3 !!) // if not inlined then the cost of the return by value is huge ~ +35%, // however, not inlining this function is an order of magnitude slower, so // it has to be inlined, and so the return by value is not an issue Matrix3 res; const Scalar tx = Scalar(2)*this->x(); const Scalar ty = Scalar(2)*this->y(); const Scalar tz = Scalar(2)*this->z(); const Scalar twx = tx*this->w(); const Scalar twy = ty*this->w(); const Scalar twz = tz*this->w(); const Scalar txx = tx*this->x(); const Scalar txy = ty*this->x(); const Scalar txz = tz*this->x(); const Scalar tyy = ty*this->y(); const Scalar tyz = tz*this->y(); const Scalar tzz = tz*this->z(); res.coeffRef(0,0) = Scalar(1)-(tyy+tzz); res.coeffRef(0,1) = txy-twz; res.coeffRef(0,2) = txz+twy; res.coeffRef(1,0) = txy+twz; res.coeffRef(1,1) = Scalar(1)-(txx+tzz); res.coeffRef(1,2) = tyz-twx; res.coeffRef(2,0) = txz-twy; res.coeffRef(2,1) = tyz+twx; res.coeffRef(2,2) = Scalar(1)-(txx+tyy); return res; } /** Sets \c *this to be a quaternion representing a rotation between * the two arbitrary vectors \a a and \a b. In other words, the built * rotation represent a rotation sending the line of direction \a a * to the line of direction \a b, both lines passing through the origin. * * \returns a reference to \c *this. * * Note that the two input vectors do \b not have to be normalized, and * do not need to have the same norm. */ template template EIGEN_DEVICE_FUNC inline Derived& QuaternionBase::setFromTwoVectors(const MatrixBase& a, const MatrixBase& b) { EIGEN_USING_STD(sqrt) Vector3 v0 = a.normalized(); Vector3 v1 = b.normalized(); Scalar c = v1.dot(v0); // if dot == -1, vectors are nearly opposites // => accurately compute the rotation axis by computing the // intersection of the two planes. This is done by solving: // x^T v0 = 0 // x^T v1 = 0 // under the constraint: // ||x|| = 1 // which yields a singular value problem if (c < Scalar(-1)+NumTraits::dummy_precision()) { c = numext::maxi(c,Scalar(-1)); Matrix m; m << v0.transpose(), v1.transpose(); JacobiSVD > svd(m, ComputeFullV); Vector3 axis = svd.matrixV().col(2); Scalar w2 = (Scalar(1)+c)*Scalar(0.5); this->w() = sqrt(w2); this->vec() = axis * sqrt(Scalar(1) - w2); return derived(); } Vector3 axis = v0.cross(v1); Scalar s = sqrt((Scalar(1)+c)*Scalar(2)); Scalar invs = Scalar(1)/s; this->vec() = axis * invs; this->w() = s * Scalar(0.5); return derived(); } /** \returns a random unit quaternion following a uniform distribution law on SO(3) * * \note The implementation is based on http://planning.cs.uiuc.edu/node198.html */ template EIGEN_DEVICE_FUNC Quaternion Quaternion::UnitRandom() { EIGEN_USING_STD(sqrt) EIGEN_USING_STD(sin) EIGEN_USING_STD(cos) const Scalar u1 = internal::random(0, 1), u2 = internal::random(0, 2*EIGEN_PI), u3 = internal::random(0, 2*EIGEN_PI); const Scalar a = sqrt(Scalar(1) - u1), b = sqrt(u1); return Quaternion (a * sin(u2), a * cos(u2), b * sin(u3), b * cos(u3)); } /** Returns a quaternion representing a rotation between * the two arbitrary vectors \a a and \a b. In other words, the built * rotation represent a rotation sending the line of direction \a a * to the line of direction \a b, both lines passing through the origin. * * \returns resulting quaternion * * Note that the two input vectors do \b not have to be normalized, and * do not need to have the same norm. */ template template EIGEN_DEVICE_FUNC Quaternion Quaternion::FromTwoVectors(const MatrixBase& a, const MatrixBase& b) { Quaternion quat; quat.setFromTwoVectors(a, b); return quat; } /** \returns the multiplicative inverse of \c *this * Note that in most cases, i.e., if you simply want the opposite rotation, * and/or the quaternion is normalized, then it is enough to use the conjugate. * * \sa QuaternionBase::conjugate() */ template EIGEN_DEVICE_FUNC inline Quaternion::Scalar> QuaternionBase::inverse() const { // FIXME should this function be called multiplicativeInverse and conjugate() be called inverse() or opposite() ?? Scalar n2 = this->squaredNorm(); if (n2 > Scalar(0)) return Quaternion(conjugate().coeffs() / n2); else { // return an invalid result to flag the error return Quaternion(Coefficients::Zero()); } } // Generic conjugate of a Quaternion namespace internal { template struct quat_conj { EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Quaternion run(const QuaternionBase& q){ return Quaternion(q.w(),-q.x(),-q.y(),-q.z()); } }; } /** \returns the conjugate of the \c *this which is equal to the multiplicative inverse * if the quaternion is normalized. * The conjugate of a quaternion represents the opposite rotation. * * \sa Quaternion2::inverse() */ template EIGEN_DEVICE_FUNC inline Quaternion::Scalar> QuaternionBase::conjugate() const { return internal::quat_conj::Scalar>::run(*this); } /** \returns the angle (in radian) between two rotations * \sa dot() */ template template EIGEN_DEVICE_FUNC inline typename internal::traits::Scalar QuaternionBase::angularDistance(const QuaternionBase& other) const { EIGEN_USING_STD(atan2) Quaternion d = (*this) * other.conjugate(); return Scalar(2) * atan2( d.vec().norm(), numext::abs(d.w()) ); } /** \returns the spherical linear interpolation between the two quaternions * \c *this and \a other at the parameter \a t in [0;1]. * * This represents an interpolation for a constant motion between \c *this and \a other, * see also http://en.wikipedia.org/wiki/Slerp. */ template template EIGEN_DEVICE_FUNC Quaternion::Scalar> QuaternionBase::slerp(const Scalar& t, const QuaternionBase& other) const { EIGEN_USING_STD(acos) EIGEN_USING_STD(sin) const Scalar one = Scalar(1) - NumTraits::epsilon(); Scalar d = this->dot(other); Scalar absD = numext::abs(d); Scalar scale0; Scalar scale1; if(absD>=one) { scale0 = Scalar(1) - t; scale1 = t; } else { // theta is the angle between the 2 quaternions Scalar theta = acos(absD); Scalar sinTheta = sin(theta); scale0 = sin( ( Scalar(1) - t ) * theta) / sinTheta; scale1 = sin( ( t * theta) ) / sinTheta; } if(d(scale0 * coeffs() + scale1 * other.coeffs()); } namespace internal { // set from a rotation matrix template struct quaternionbase_assign_impl { typedef typename Other::Scalar Scalar; template EIGEN_DEVICE_FUNC static inline void run(QuaternionBase& q, const Other& a_mat) { const typename internal::nested_eval::type mat(a_mat); EIGEN_USING_STD(sqrt) // This algorithm comes from "Quaternion Calculus and Fast Animation", // Ken Shoemake, 1987 SIGGRAPH course notes Scalar t = mat.trace(); if (t > Scalar(0)) { t = sqrt(t + Scalar(1.0)); q.w() = Scalar(0.5)*t; t = Scalar(0.5)/t; q.x() = (mat.coeff(2,1) - mat.coeff(1,2)) * t; q.y() = (mat.coeff(0,2) - mat.coeff(2,0)) * t; q.z() = (mat.coeff(1,0) - mat.coeff(0,1)) * t; } else { Index i = 0; if (mat.coeff(1,1) > mat.coeff(0,0)) i = 1; if (mat.coeff(2,2) > mat.coeff(i,i)) i = 2; Index j = (i+1)%3; Index k = (j+1)%3; t = sqrt(mat.coeff(i,i)-mat.coeff(j,j)-mat.coeff(k,k) + Scalar(1.0)); q.coeffs().coeffRef(i) = Scalar(0.5) * t; t = Scalar(0.5)/t; q.w() = (mat.coeff(k,j)-mat.coeff(j,k))*t; q.coeffs().coeffRef(j) = (mat.coeff(j,i)+mat.coeff(i,j))*t; q.coeffs().coeffRef(k) = (mat.coeff(k,i)+mat.coeff(i,k))*t; } } }; // set from a vector of coefficients assumed to be a quaternion template struct quaternionbase_assign_impl { typedef typename Other::Scalar Scalar; template EIGEN_DEVICE_FUNC static inline void run(QuaternionBase& q, const Other& vec) { q.coeffs() = vec; } }; } // end namespace internal } // end namespace Eigen #endif // EIGEN_QUATERNION_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Geometry/Rotation2D.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_ROTATION2D_H #define EIGEN_ROTATION2D_H namespace Eigen { /** \geometry_module \ingroup Geometry_Module * * \class Rotation2D * * \brief Represents a rotation/orientation in a 2 dimensional space. * * \tparam Scalar_ the scalar type, i.e., the type of the coefficients * * This class is equivalent to a single scalar representing a counter clock wise rotation * as a single angle in radian. It provides some additional features such as the automatic * conversion from/to a 2x2 rotation matrix. Moreover this class aims to provide a similar * interface to Quaternion in order to facilitate the writing of generic algorithms * dealing with rotations. * * \sa class Quaternion, class Transform */ namespace internal { template struct traits > { typedef Scalar_ Scalar; }; } // end namespace internal template class Rotation2D : public RotationBase,2> { typedef RotationBase,2> Base; public: using Base::operator*; enum { Dim = 2 }; /** the scalar type of the coefficients */ typedef Scalar_ Scalar; typedef Matrix Vector2; typedef Matrix Matrix2; protected: Scalar m_angle; public: /** Construct a 2D counter clock wise rotation from the angle \a a in radian. */ EIGEN_DEVICE_FUNC explicit inline Rotation2D(const Scalar& a) : m_angle(a) {} /** Default constructor wihtout initialization. The represented rotation is undefined. */ EIGEN_DEVICE_FUNC Rotation2D() {} /** Construct a 2D rotation from a 2x2 rotation matrix \a mat. * * \sa fromRotationMatrix() */ template EIGEN_DEVICE_FUNC explicit Rotation2D(const MatrixBase& m) { fromRotationMatrix(m.derived()); } /** \returns the rotation angle */ EIGEN_DEVICE_FUNC inline Scalar angle() const { return m_angle; } /** \returns a read-write reference to the rotation angle */ EIGEN_DEVICE_FUNC inline Scalar& angle() { return m_angle; } /** \returns the rotation angle in [0,2pi] */ EIGEN_DEVICE_FUNC inline Scalar smallestPositiveAngle() const { Scalar tmp = numext::fmod(m_angle,Scalar(2*EIGEN_PI)); return tmpScalar(EIGEN_PI)) tmp -= Scalar(2*EIGEN_PI); else if(tmp<-Scalar(EIGEN_PI)) tmp += Scalar(2*EIGEN_PI); return tmp; } /** \returns the inverse rotation */ EIGEN_DEVICE_FUNC inline Rotation2D inverse() const { return Rotation2D(-m_angle); } /** Concatenates two rotations */ EIGEN_DEVICE_FUNC inline Rotation2D operator*(const Rotation2D& other) const { return Rotation2D(m_angle + other.m_angle); } /** Concatenates two rotations */ EIGEN_DEVICE_FUNC inline Rotation2D& operator*=(const Rotation2D& other) { m_angle += other.m_angle; return *this; } /** Applies the rotation to a 2D vector */ EIGEN_DEVICE_FUNC Vector2 operator* (const Vector2& vec) const { return toRotationMatrix() * vec; } template EIGEN_DEVICE_FUNC Rotation2D& fromRotationMatrix(const MatrixBase& m); EIGEN_DEVICE_FUNC Matrix2 toRotationMatrix() const; /** Set \c *this from a 2x2 rotation matrix \a mat. * In other words, this function extract the rotation angle from the rotation matrix. * * This method is an alias for fromRotationMatrix() * * \sa fromRotationMatrix() */ template EIGEN_DEVICE_FUNC Rotation2D& operator=(const MatrixBase& m) { return fromRotationMatrix(m.derived()); } /** \returns the spherical interpolation between \c *this and \a other using * parameter \a t. It is in fact equivalent to a linear interpolation. */ EIGEN_DEVICE_FUNC inline Rotation2D slerp(const Scalar& t, const Rotation2D& other) const { Scalar dist = Rotation2D(other.m_angle-m_angle).smallestAngle(); return Rotation2D(m_angle + dist*t); } /** \returns \c *this with scalar type casted to \a NewScalarType * * Note that if \a NewScalarType is equal to the current scalar type of \c *this * then this function smartly returns a const reference to \c *this. */ template EIGEN_DEVICE_FUNC inline typename internal::cast_return_type >::type cast() const { return typename internal::cast_return_type >::type(*this); } /** Copy constructor with scalar type conversion */ template EIGEN_DEVICE_FUNC inline explicit Rotation2D(const Rotation2D& other) { m_angle = Scalar(other.angle()); } EIGEN_DEVICE_FUNC static inline Rotation2D Identity() { return Rotation2D(0); } /** \returns \c true if \c *this is approximately equal to \a other, within the precision * determined by \a prec. * * \sa MatrixBase::isApprox() */ EIGEN_DEVICE_FUNC bool isApprox(const Rotation2D& other, const typename NumTraits::Real& prec = NumTraits::dummy_precision()) const { return internal::isApprox(m_angle,other.m_angle, prec); } }; /** \ingroup Geometry_Module * single precision 2D rotation type */ typedef Rotation2D Rotation2Df; /** \ingroup Geometry_Module * double precision 2D rotation type */ typedef Rotation2D Rotation2Dd; /** Set \c *this from a 2x2 rotation matrix \a mat. * In other words, this function extract the rotation angle * from the rotation matrix. */ template template EIGEN_DEVICE_FUNC Rotation2D& Rotation2D::fromRotationMatrix(const MatrixBase& mat) { EIGEN_USING_STD(atan2) EIGEN_STATIC_ASSERT(Derived::RowsAtCompileTime==2 && Derived::ColsAtCompileTime==2,YOU_MADE_A_PROGRAMMING_MISTAKE) m_angle = atan2(mat.coeff(1,0), mat.coeff(0,0)); return *this; } /** Constructs and \returns an equivalent 2x2 rotation matrix. */ template typename Rotation2D::Matrix2 EIGEN_DEVICE_FUNC Rotation2D::toRotationMatrix(void) const { EIGEN_USING_STD(sin) EIGEN_USING_STD(cos) Scalar sinA = sin(m_angle); Scalar cosA = cos(m_angle); return (Matrix2() << cosA, -sinA, sinA, cosA).finished(); } } // end namespace Eigen #endif // EIGEN_ROTATION2D_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Geometry/RotationBase.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_ROTATIONBASE_H #define EIGEN_ROTATIONBASE_H namespace Eigen { // forward declaration namespace internal { template struct rotation_base_generic_product_selector; } /** \class RotationBase * * \brief Common base class for compact rotation representations * * \tparam Derived is the derived type, i.e., a rotation type * \tparam Dim_ the dimension of the space */ template class RotationBase { public: enum { Dim = Dim_ }; /** the scalar type of the coefficients */ typedef typename internal::traits::Scalar Scalar; /** corresponding linear transformation matrix type */ typedef Matrix RotationMatrixType; typedef Matrix VectorType; public: EIGEN_DEVICE_FUNC inline const Derived& derived() const { return *static_cast(this); } EIGEN_DEVICE_FUNC inline Derived& derived() { return *static_cast(this); } /** \returns an equivalent rotation matrix */ EIGEN_DEVICE_FUNC inline RotationMatrixType toRotationMatrix() const { return derived().toRotationMatrix(); } /** \returns an equivalent rotation matrix * This function is added to be conform with the Transform class' naming scheme. */ EIGEN_DEVICE_FUNC inline RotationMatrixType matrix() const { return derived().toRotationMatrix(); } /** \returns the inverse rotation */ EIGEN_DEVICE_FUNC inline Derived inverse() const { return derived().inverse(); } /** \returns the concatenation of the rotation \c *this with a translation \a t */ EIGEN_DEVICE_FUNC inline Transform operator*(const Translation& t) const { return Transform(*this) * t; } /** \returns the concatenation of the rotation \c *this with a uniform scaling \a s */ EIGEN_DEVICE_FUNC inline RotationMatrixType operator*(const UniformScaling& s) const { return toRotationMatrix() * s.factor(); } /** \returns the concatenation of the rotation \c *this with a generic expression \a e * \a e can be: * - a DimxDim linear transformation matrix * - a DimxDim diagonal matrix (axis aligned scaling) * - a vector of size Dim */ template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::rotation_base_generic_product_selector::ReturnType operator*(const EigenBase& e) const { return internal::rotation_base_generic_product_selector::run(derived(), e.derived()); } /** \returns the concatenation of a linear transformation \a l with the rotation \a r */ template friend EIGEN_DEVICE_FUNC inline RotationMatrixType operator*(const EigenBase& l, const Derived& r) { return l.derived() * r.toRotationMatrix(); } /** \returns the concatenation of a scaling \a l with the rotation \a r */ EIGEN_DEVICE_FUNC friend inline Transform operator*(const DiagonalMatrix& l, const Derived& r) { Transform res(r); res.linear().applyOnTheLeft(l); return res; } /** \returns the concatenation of the rotation \c *this with a transformation \a t */ template EIGEN_DEVICE_FUNC inline Transform operator*(const Transform& t) const { return toRotationMatrix() * t; } template EIGEN_DEVICE_FUNC inline VectorType _transformVector(const OtherVectorType& v) const { return toRotationMatrix() * v; } }; namespace internal { // implementation of the generic product rotation * matrix template struct rotation_base_generic_product_selector { enum { Dim = RotationDerived::Dim }; typedef Matrix ReturnType; EIGEN_DEVICE_FUNC static inline ReturnType run(const RotationDerived& r, const MatrixType& m) { return r.toRotationMatrix() * m; } }; template struct rotation_base_generic_product_selector< RotationDerived, DiagonalMatrix, false > { typedef Transform ReturnType; EIGEN_DEVICE_FUNC static inline ReturnType run(const RotationDerived& r, const DiagonalMatrix& m) { ReturnType res(r); res.linear() *= m; return res; } }; template struct rotation_base_generic_product_selector { enum { Dim = RotationDerived::Dim }; typedef Matrix ReturnType; EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE ReturnType run(const RotationDerived& r, const OtherVectorType& v) { return r._transformVector(v); } }; } // end namespace internal /** \geometry_module * * \brief Constructs a Dim x Dim rotation matrix from the rotation \a r */ template template EIGEN_DEVICE_FUNC Matrix ::Matrix(const RotationBase& r) { EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix,int(OtherDerived::Dim),int(OtherDerived::Dim)) *this = r.toRotationMatrix(); } /** \geometry_module * * \brief Set a Dim x Dim rotation matrix from the rotation \a r */ template template EIGEN_DEVICE_FUNC Matrix& Matrix ::operator=(const RotationBase& r) { EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix,int(OtherDerived::Dim),int(OtherDerived::Dim)) return *this = r.toRotationMatrix(); } namespace internal { /** \internal * * Helper function to return an arbitrary rotation object to a rotation matrix. * * \tparam Scalar the numeric type of the matrix coefficients * \tparam Dim the dimension of the current space * * It returns a Dim x Dim fixed size matrix. * * Default specializations are provided for: * - any scalar type (2D), * - any matrix expression, * - any type based on RotationBase (e.g., Quaternion, AngleAxis, Rotation2D) * * Currently toRotationMatrix is only used by Transform. * * \sa class Transform, class Rotation2D, class Quaternion, class AngleAxis */ template EIGEN_DEVICE_FUNC static inline Matrix toRotationMatrix(const Scalar& s) { EIGEN_STATIC_ASSERT(Dim==2,YOU_MADE_A_PROGRAMMING_MISTAKE) return Rotation2D(s).toRotationMatrix(); } template EIGEN_DEVICE_FUNC static inline Matrix toRotationMatrix(const RotationBase& r) { return r.toRotationMatrix(); } template EIGEN_DEVICE_FUNC static inline const MatrixBase& toRotationMatrix(const MatrixBase& mat) { EIGEN_STATIC_ASSERT(OtherDerived::RowsAtCompileTime==Dim && OtherDerived::ColsAtCompileTime==Dim, YOU_MADE_A_PROGRAMMING_MISTAKE) return mat; } } // end namespace internal } // end namespace Eigen #endif // EIGEN_ROTATIONBASE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Geometry/Scaling.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SCALING_H #define EIGEN_SCALING_H namespace Eigen { /** \geometry_module \ingroup Geometry_Module * * \class UniformScaling * * \brief Represents a generic uniform scaling transformation * * \tparam Scalar_ the scalar type, i.e., the type of the coefficients. * * This class represent a uniform scaling transformation. It is the return * type of Scaling(Scalar), and most of the time this is the only way it * is used. In particular, this class is not aimed to be used to store a scaling transformation, * but rather to make easier the constructions and updates of Transform objects. * * To represent an axis aligned scaling, use the DiagonalMatrix class. * * \sa Scaling(), class DiagonalMatrix, MatrixBase::asDiagonal(), class Translation, class Transform */ namespace internal { // This helper helps nvcc+MSVC to properly parse this file. // See bug 1412. template struct uniformscaling_times_affine_returntype { enum { NewMode = int(Mode) == int(Isometry) ? Affine : Mode }; typedef Transform type; }; } template class UniformScaling { public: /** the scalar type of the coefficients */ typedef Scalar_ Scalar; protected: Scalar m_factor; public: /** Default constructor without initialization. */ UniformScaling() {} /** Constructs and initialize a uniform scaling transformation */ explicit inline UniformScaling(const Scalar& s) : m_factor(s) {} inline const Scalar& factor() const { return m_factor; } inline Scalar& factor() { return m_factor; } /** Concatenates two uniform scaling */ inline UniformScaling operator* (const UniformScaling& other) const { return UniformScaling(m_factor * other.factor()); } /** Concatenates a uniform scaling and a translation */ template inline Transform operator* (const Translation& t) const; /** Concatenates a uniform scaling and an affine transformation */ template inline typename internal::uniformscaling_times_affine_returntype::type operator* (const Transform& t) const { typename internal::uniformscaling_times_affine_returntype::type res = t; res.prescale(factor()); return res; } /** Concatenates a uniform scaling and a linear transformation matrix */ // TODO returns an expression template inline typename Eigen::internal::plain_matrix_type::type operator* (const MatrixBase& other) const { return other * m_factor; } template inline Matrix operator*(const RotationBase& r) const { return r.toRotationMatrix() * m_factor; } /** \returns the inverse scaling */ inline UniformScaling inverse() const { return UniformScaling(Scalar(1)/m_factor); } /** \returns \c *this with scalar type casted to \a NewScalarType * * Note that if \a NewScalarType is equal to the current scalar type of \c *this * then this function smartly returns a const reference to \c *this. */ template inline UniformScaling cast() const { return UniformScaling(NewScalarType(m_factor)); } /** Copy constructor with scalar type conversion */ template inline explicit UniformScaling(const UniformScaling& other) { m_factor = Scalar(other.factor()); } /** \returns \c true if \c *this is approximately equal to \a other, within the precision * determined by \a prec. * * \sa MatrixBase::isApprox() */ bool isApprox(const UniformScaling& other, const typename NumTraits::Real& prec = NumTraits::dummy_precision()) const { return internal::isApprox(m_factor, other.factor(), prec); } }; /** \addtogroup Geometry_Module */ //@{ /** Concatenates a linear transformation matrix and a uniform scaling * \relates UniformScaling */ // NOTE this operator is defined in MatrixBase and not as a friend function // of UniformScaling to fix an internal crash of Intel's ICC template EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,Scalar,product) operator*(const MatrixBase& matrix, const UniformScaling& s) { return matrix.derived() * s.factor(); } /** Constructs a uniform scaling from scale factor \a s */ inline UniformScaling Scaling(float s) { return UniformScaling(s); } /** Constructs a uniform scaling from scale factor \a s */ inline UniformScaling Scaling(double s) { return UniformScaling(s); } /** Constructs a uniform scaling from scale factor \a s */ template inline UniformScaling > Scaling(const std::complex& s) { return UniformScaling >(s); } /** Constructs a 2D axis aligned scaling */ template inline DiagonalMatrix Scaling(const Scalar& sx, const Scalar& sy) { return DiagonalMatrix(sx, sy); } /** Constructs a 3D axis aligned scaling */ template inline DiagonalMatrix Scaling(const Scalar& sx, const Scalar& sy, const Scalar& sz) { return DiagonalMatrix(sx, sy, sz); } /** Constructs an axis aligned scaling expression from vector expression \a coeffs * This is an alias for coeffs.asDiagonal() */ template inline const DiagonalWrapper Scaling(const MatrixBase& coeffs) { return coeffs.asDiagonal(); } /** \deprecated */ typedef DiagonalMatrix AlignedScaling2f; /** \deprecated */ typedef DiagonalMatrix AlignedScaling2d; /** \deprecated */ typedef DiagonalMatrix AlignedScaling3f; /** \deprecated */ typedef DiagonalMatrix AlignedScaling3d; //@} template template inline Transform UniformScaling::operator* (const Translation& t) const { Transform res; res.matrix().setZero(); res.linear().diagonal().fill(factor()); res.translation() = factor() * t.vector(); res(Dim,Dim) = Scalar(1); return res; } } // end namespace Eigen #endif // EIGEN_SCALING_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Geometry/Transform.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // Copyright (C) 2009 Benoit Jacob // Copyright (C) 2010 Hauke Heibel // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_TRANSFORM_H #define EIGEN_TRANSFORM_H namespace Eigen { namespace internal { template struct transform_traits { enum { Dim = Transform::Dim, HDim = Transform::HDim, Mode = Transform::Mode, IsProjective = (int(Mode)==int(Projective)) }; }; template< typename TransformType, typename MatrixType, int Case = transform_traits::IsProjective ? 0 : int(MatrixType::RowsAtCompileTime) == int(transform_traits::HDim) ? 1 : 2, int RhsCols = MatrixType::ColsAtCompileTime> struct transform_right_product_impl; template< typename Other, int Mode, int Options, int Dim, int HDim, int OtherRows=Other::RowsAtCompileTime, int OtherCols=Other::ColsAtCompileTime> struct transform_left_product_impl; template< typename Lhs, typename Rhs, bool AnyProjective = transform_traits::IsProjective || transform_traits::IsProjective> struct transform_transform_product_impl; template< typename Other, int Mode, int Options, int Dim, int HDim, int OtherRows=Other::RowsAtCompileTime, int OtherCols=Other::ColsAtCompileTime> struct transform_construct_from_matrix; template struct transform_take_affine_part; template struct traits > { typedef Scalar_ Scalar; typedef Eigen::Index StorageIndex; typedef Dense StorageKind; enum { Dim1 = Dim_==Dynamic ? Dim_ : Dim_ + 1, RowsAtCompileTime = _Mode==Projective ? Dim1 : Dim_, ColsAtCompileTime = Dim1, MaxRowsAtCompileTime = RowsAtCompileTime, MaxColsAtCompileTime = ColsAtCompileTime, Flags = 0 }; }; template struct transform_make_affine; } // end namespace internal /** \geometry_module \ingroup Geometry_Module * * \class Transform * * \brief Represents an homogeneous transformation in a N dimensional space * * \tparam Scalar_ the scalar type, i.e., the type of the coefficients * \tparam Dim_ the dimension of the space * \tparam _Mode the type of the transformation. Can be: * - #Affine: the transformation is stored as a (Dim+1)^2 matrix, * where the last row is assumed to be [0 ... 0 1]. * - #AffineCompact: the transformation is stored as a (Dim)x(Dim+1) matrix. * - #Projective: the transformation is stored as a (Dim+1)^2 matrix * without any assumption. * - #Isometry: same as #Affine with the additional assumption that * the linear part represents a rotation. This assumption is exploited * to speed up some functions such as inverse() and rotation(). * \tparam Options_ has the same meaning as in class Matrix. It allows to specify DontAlign and/or RowMajor. * These Options are passed directly to the underlying matrix type. * * The homography is internally represented and stored by a matrix which * is available through the matrix() method. To understand the behavior of * this class you have to think a Transform object as its internal * matrix representation. The chosen convention is right multiply: * * \code v' = T * v \endcode * * Therefore, an affine transformation matrix M is shaped like this: * * \f$ \left( \begin{array}{cc} * linear & translation\\ * 0 ... 0 & 1 * \end{array} \right) \f$ * * Note that for a projective transformation the last row can be anything, * and then the interpretation of different parts might be slightly different. * * However, unlike a plain matrix, the Transform class provides many features * simplifying both its assembly and usage. In particular, it can be composed * with any other transformations (Transform,Translation,RotationBase,DiagonalMatrix) * and can be directly used to transform implicit homogeneous vectors. All these * operations are handled via the operator*. For the composition of transformations, * its principle consists to first convert the right/left hand sides of the product * to a compatible (Dim+1)^2 matrix and then perform a pure matrix product. * Of course, internally, operator* tries to perform the minimal number of operations * according to the nature of each terms. Likewise, when applying the transform * to points, the latters are automatically promoted to homogeneous vectors * before doing the matrix product. The conventions to homogeneous representations * are performed as follow: * * \b Translation t (Dim)x(1): * \f$ \left( \begin{array}{cc} * I & t \\ * 0\,...\,0 & 1 * \end{array} \right) \f$ * * \b Rotation R (Dim)x(Dim): * \f$ \left( \begin{array}{cc} * R & 0\\ * 0\,...\,0 & 1 * \end{array} \right) \f$ * * \b Scaling \b DiagonalMatrix S (Dim)x(Dim): * \f$ \left( \begin{array}{cc} * S & 0\\ * 0\,...\,0 & 1 * \end{array} \right) \f$ * * \b Column \b point v (Dim)x(1): * \f$ \left( \begin{array}{c} * v\\ * 1 * \end{array} \right) \f$ * * \b Set \b of \b column \b points V1...Vn (Dim)x(n): * \f$ \left( \begin{array}{ccc} * v_1 & ... & v_n\\ * 1 & ... & 1 * \end{array} \right) \f$ * * The concatenation of a Transform object with any kind of other transformation * always returns a Transform object. * * A little exception to the "as pure matrix product" rule is the case of the * transformation of non homogeneous vectors by an affine transformation. In * that case the last matrix row can be ignored, and the product returns non * homogeneous vectors. * * Since, for instance, a Dim x Dim matrix is interpreted as a linear transformation, * it is not possible to directly transform Dim vectors stored in a Dim x Dim matrix. * The solution is either to use a Dim x Dynamic matrix or explicitly request a * vector transformation by making the vector homogeneous: * \code * m' = T * m.colwise().homogeneous(); * \endcode * Note that there is zero overhead. * * Conversion methods from/to Qt's QMatrix and QTransform are available if the * preprocessor token EIGEN_QT_SUPPORT is defined. * * This class can be extended with the help of the plugin mechanism described on the page * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_TRANSFORM_PLUGIN. * * \sa class Matrix, class Quaternion */ template class Transform { public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(Scalar_,Dim_==Dynamic ? Dynamic : (Dim_+1)*(Dim_+1)) enum { Mode = _Mode, Options = Options_, Dim = Dim_, ///< space dimension in which the transformation holds HDim = Dim_+1, ///< size of a respective homogeneous vector Rows = int(Mode)==(AffineCompact) ? Dim : HDim }; /** the scalar type of the coefficients */ typedef Scalar_ Scalar; typedef Eigen::Index StorageIndex; typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3 /** type of the matrix used to represent the transformation */ typedef typename internal::make_proper_matrix_type::type MatrixType; /** constified MatrixType */ typedef const MatrixType ConstMatrixType; /** type of the matrix used to represent the linear part of the transformation */ typedef Matrix LinearMatrixType; /** type of read/write reference to the linear part of the transformation */ typedef Block LinearPart; /** type of read reference to the linear part of the transformation */ typedef const Block ConstLinearPart; /** type of read/write reference to the affine part of the transformation */ typedef typename internal::conditional >::type AffinePart; /** type of read reference to the affine part of the transformation */ typedef typename internal::conditional >::type ConstAffinePart; /** type of a vector */ typedef Matrix VectorType; /** type of a read/write reference to the translation part of the rotation */ typedef Block::Flags & RowMajorBit)> TranslationPart; /** type of a read reference to the translation part of the rotation */ typedef const Block::Flags & RowMajorBit)> ConstTranslationPart; /** corresponding translation type */ typedef Translation TranslationType; // this intermediate enum is needed to avoid an ICE with gcc 3.4 and 4.0 enum { TransformTimeDiagonalMode = ((Mode==int(Isometry))?Affine:int(Mode)) }; /** The return type of the product between a diagonal matrix and a transform */ typedef Transform TransformTimeDiagonalReturnType; protected: MatrixType m_matrix; public: /** Default constructor without initialization of the meaningful coefficients. * If Mode==Affine or Mode==Isometry, then the last row is set to [0 ... 0 1] */ EIGEN_DEVICE_FUNC inline Transform() { check_template_params(); internal::transform_make_affine<(int(Mode)==Affine || int(Mode)==Isometry) ? Affine : AffineCompact>::run(m_matrix); } EIGEN_DEVICE_FUNC inline explicit Transform(const TranslationType& t) { check_template_params(); *this = t; } EIGEN_DEVICE_FUNC inline explicit Transform(const UniformScaling& s) { check_template_params(); *this = s; } template EIGEN_DEVICE_FUNC inline explicit Transform(const RotationBase& r) { check_template_params(); *this = r; } typedef internal::transform_take_affine_part take_affine_part; /** Constructs and initializes a transformation from a Dim^2 or a (Dim+1)^2 matrix. */ template EIGEN_DEVICE_FUNC inline explicit Transform(const EigenBase& other) { 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); check_template_params(); internal::transform_construct_from_matrix::run(this, other.derived()); } /** Set \c *this from a Dim^2 or (Dim+1)^2 matrix. */ template EIGEN_DEVICE_FUNC inline Transform& operator=(const EigenBase& other) { 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); internal::transform_construct_from_matrix::run(this, other.derived()); return *this; } template EIGEN_DEVICE_FUNC inline Transform(const Transform& other) { check_template_params(); // only the options change, we can directly copy the matrices m_matrix = other.matrix(); } template EIGEN_DEVICE_FUNC inline Transform(const Transform& other) { check_template_params(); // prevent conversions as: // Affine | AffineCompact | Isometry = Projective EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(OtherMode==int(Projective), Mode==int(Projective)), YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION) // prevent conversions as: // Isometry = Affine | AffineCompact EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(OtherMode==int(Affine)||OtherMode==int(AffineCompact), Mode!=int(Isometry)), YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION) enum { ModeIsAffineCompact = Mode == int(AffineCompact), OtherModeIsAffineCompact = OtherMode == int(AffineCompact) }; if(EIGEN_CONST_CONDITIONAL(ModeIsAffineCompact == OtherModeIsAffineCompact)) { // We need the block expression because the code is compiled for all // combinations of transformations and will trigger a compile time error // if one tries to assign the matrices directly m_matrix.template block(0,0) = other.matrix().template block(0,0); makeAffine(); } else if(EIGEN_CONST_CONDITIONAL(OtherModeIsAffineCompact)) { typedef typename Transform::MatrixType OtherMatrixType; internal::transform_construct_from_matrix::run(this, other.matrix()); } else { // here we know that Mode == AffineCompact and OtherMode != AffineCompact. // if OtherMode were Projective, the static assert above would already have caught it. // So the only possibility is that OtherMode == Affine linear() = other.linear(); translation() = other.translation(); } } template EIGEN_DEVICE_FUNC Transform(const ReturnByValue& other) { check_template_params(); other.evalTo(*this); } template EIGEN_DEVICE_FUNC Transform& operator=(const ReturnByValue& other) { other.evalTo(*this); return *this; } #ifdef EIGEN_QT_SUPPORT inline Transform(const QMatrix& other); inline Transform& operator=(const QMatrix& other); inline QMatrix toQMatrix(void) const; inline Transform(const QTransform& other); inline Transform& operator=(const QTransform& other); inline QTransform toQTransform(void) const; #endif EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return int(Mode)==int(Projective) ? m_matrix.cols() : (m_matrix.cols()-1); } EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } /** shortcut for m_matrix(row,col); * \sa MatrixBase::operator(Index,Index) const */ EIGEN_DEVICE_FUNC inline Scalar operator() (Index row, Index col) const { return m_matrix(row,col); } /** shortcut for m_matrix(row,col); * \sa MatrixBase::operator(Index,Index) */ EIGEN_DEVICE_FUNC inline Scalar& operator() (Index row, Index col) { return m_matrix(row,col); } /** \returns a read-only expression of the transformation matrix */ EIGEN_DEVICE_FUNC inline const MatrixType& matrix() const { return m_matrix; } /** \returns a writable expression of the transformation matrix */ EIGEN_DEVICE_FUNC inline MatrixType& matrix() { return m_matrix; } /** \returns a read-only expression of the linear part of the transformation */ EIGEN_DEVICE_FUNC inline ConstLinearPart linear() const { return ConstLinearPart(m_matrix,0,0); } /** \returns a writable expression of the linear part of the transformation */ EIGEN_DEVICE_FUNC inline LinearPart linear() { return LinearPart(m_matrix,0,0); } /** \returns a read-only expression of the Dim x HDim affine part of the transformation */ EIGEN_DEVICE_FUNC inline ConstAffinePart affine() const { return take_affine_part::run(m_matrix); } /** \returns a writable expression of the Dim x HDim affine part of the transformation */ EIGEN_DEVICE_FUNC inline AffinePart affine() { return take_affine_part::run(m_matrix); } /** \returns a read-only expression of the translation vector of the transformation */ EIGEN_DEVICE_FUNC inline ConstTranslationPart translation() const { return ConstTranslationPart(m_matrix,0,Dim); } /** \returns a writable expression of the translation vector of the transformation */ EIGEN_DEVICE_FUNC inline TranslationPart translation() { return TranslationPart(m_matrix,0,Dim); } /** \returns an expression of the product between the transform \c *this and a matrix expression \a other. * * The right-hand-side \a other can be either: * \li an homogeneous vector of size Dim+1, * \li a set of homogeneous vectors of size Dim+1 x N, * \li a transformation matrix of size Dim+1 x Dim+1. * * Moreover, if \c *this represents an affine transformation (i.e., Mode!=Projective), then \a other can also be: * \li a point of size Dim (computes: \code this->linear() * other + this->translation()\endcode), * \li a set of N points as a Dim x N matrix (computes: \code (this->linear() * other).colwise() + this->translation()\endcode), * * In all cases, the return type is a matrix or vector of same sizes as the right-hand-side \a other. * * If you want to interpret \a other as a linear or affine transformation, then first convert it to a Transform<> type, * or do your own cooking. * * Finally, if you want to apply Affine transformations to vectors, then explicitly apply the linear part only: * \code * Affine3f A; * Vector3f v1, v2; * v2 = A.linear() * v1; * \endcode * */ // note: this function is defined here because some compilers cannot find the respective declaration template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename internal::transform_right_product_impl::ResultType operator * (const EigenBase &other) const { return internal::transform_right_product_impl::run(*this,other.derived()); } /** \returns the product expression of a transformation matrix \a a times a transform \a b * * The left hand side \a other can be either: * \li a linear transformation matrix of size Dim x Dim, * \li an affine transformation matrix of size Dim x Dim+1, * \li a general transformation matrix of size Dim+1 x Dim+1. */ template friend EIGEN_DEVICE_FUNC inline const typename internal::transform_left_product_impl::ResultType operator * (const EigenBase &a, const Transform &b) { return internal::transform_left_product_impl::run(a.derived(),b); } /** \returns The product expression of a transform \a a times a diagonal matrix \a b * * The rhs diagonal matrix is interpreted as an affine scaling transformation. The * product results in a Transform of the same type (mode) as the lhs only if the lhs * mode is no isometry. In that case, the returned transform is an affinity. */ template EIGEN_DEVICE_FUNC inline const TransformTimeDiagonalReturnType operator * (const DiagonalBase &b) const { TransformTimeDiagonalReturnType res(*this); res.linearExt() *= b; return res; } /** \returns The product expression of a diagonal matrix \a a times a transform \a b * * The lhs diagonal matrix is interpreted as an affine scaling transformation. The * product results in a Transform of the same type (mode) as the lhs only if the lhs * mode is no isometry. In that case, the returned transform is an affinity. */ template EIGEN_DEVICE_FUNC friend inline TransformTimeDiagonalReturnType operator * (const DiagonalBase &a, const Transform &b) { TransformTimeDiagonalReturnType res; res.linear().noalias() = a*b.linear(); res.translation().noalias() = a*b.translation(); if (EIGEN_CONST_CONDITIONAL(Mode!=int(AffineCompact))) res.matrix().row(Dim) = b.matrix().row(Dim); return res; } template EIGEN_DEVICE_FUNC inline Transform& operator*=(const EigenBase& other) { return *this = *this * other; } /** Concatenates two transformations */ EIGEN_DEVICE_FUNC inline const Transform operator * (const Transform& other) const { return internal::transform_transform_product_impl::run(*this,other); } #if EIGEN_COMP_ICC private: // this intermediate structure permits to workaround a bug in ICC 11: // error: template instantiation resulted in unexpected function type of "Eigen::Transform // (const Eigen::Transform &) const" // (the meaning of a name may have changed since the template declaration -- the type of the template is: // "Eigen::internal::transform_transform_product_impl, // Eigen::Transform, >::ResultType (const Eigen::Transform &) const") // template struct icc_11_workaround { typedef internal::transform_transform_product_impl > ProductType; typedef typename ProductType::ResultType ResultType; }; public: /** Concatenates two different transformations */ template inline typename icc_11_workaround::ResultType operator * (const Transform& other) const { typedef typename icc_11_workaround::ProductType ProductType; return ProductType::run(*this,other); } #else /** Concatenates two different transformations */ template EIGEN_DEVICE_FUNC inline typename internal::transform_transform_product_impl >::ResultType operator * (const Transform& other) const { return internal::transform_transform_product_impl >::run(*this,other); } #endif /** \sa MatrixBase::setIdentity() */ EIGEN_DEVICE_FUNC void setIdentity() { m_matrix.setIdentity(); } /** * \brief Returns an identity transformation. * \todo In the future this function should be returning a Transform expression. */ EIGEN_DEVICE_FUNC static const Transform Identity() { return Transform(MatrixType::Identity()); } template EIGEN_DEVICE_FUNC inline Transform& scale(const MatrixBase &other); template EIGEN_DEVICE_FUNC inline Transform& prescale(const MatrixBase &other); EIGEN_DEVICE_FUNC inline Transform& scale(const Scalar& s); EIGEN_DEVICE_FUNC inline Transform& prescale(const Scalar& s); template EIGEN_DEVICE_FUNC inline Transform& translate(const MatrixBase &other); template EIGEN_DEVICE_FUNC inline Transform& pretranslate(const MatrixBase &other); template EIGEN_DEVICE_FUNC inline Transform& rotate(const RotationType& rotation); template EIGEN_DEVICE_FUNC inline Transform& prerotate(const RotationType& rotation); EIGEN_DEVICE_FUNC Transform& shear(const Scalar& sx, const Scalar& sy); EIGEN_DEVICE_FUNC Transform& preshear(const Scalar& sx, const Scalar& sy); EIGEN_DEVICE_FUNC inline Transform& operator=(const TranslationType& t); EIGEN_DEVICE_FUNC inline Transform& operator*=(const TranslationType& t) { return translate(t.vector()); } EIGEN_DEVICE_FUNC inline Transform operator*(const TranslationType& t) const; EIGEN_DEVICE_FUNC inline Transform& operator=(const UniformScaling& t); EIGEN_DEVICE_FUNC inline Transform& operator*=(const UniformScaling& s) { return scale(s.factor()); } EIGEN_DEVICE_FUNC inline TransformTimeDiagonalReturnType operator*(const UniformScaling& s) const { TransformTimeDiagonalReturnType res = *this; res.scale(s.factor()); return res; } EIGEN_DEVICE_FUNC inline Transform& operator*=(const DiagonalMatrix& s) { linearExt() *= s; return *this; } template EIGEN_DEVICE_FUNC inline Transform& operator=(const RotationBase& r); template EIGEN_DEVICE_FUNC inline Transform& operator*=(const RotationBase& r) { return rotate(r.toRotationMatrix()); } template EIGEN_DEVICE_FUNC inline Transform operator*(const RotationBase& r) const; typedef typename internal::conditional::type RotationReturnType; EIGEN_DEVICE_FUNC RotationReturnType rotation() const; template EIGEN_DEVICE_FUNC void computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const; template EIGEN_DEVICE_FUNC void computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) const; template EIGEN_DEVICE_FUNC Transform& fromPositionOrientationScale(const MatrixBase &position, const OrientationType& orientation, const MatrixBase &scale); EIGEN_DEVICE_FUNC inline Transform inverse(TransformTraits traits = (TransformTraits)Mode) const; /** \returns a const pointer to the column major internal matrix */ EIGEN_DEVICE_FUNC const Scalar* data() const { return m_matrix.data(); } /** \returns a non-const pointer to the column major internal matrix */ EIGEN_DEVICE_FUNC Scalar* data() { return m_matrix.data(); } /** \returns \c *this with scalar type casted to \a NewScalarType * * Note that if \a NewScalarType is equal to the current scalar type of \c *this * then this function smartly returns a const reference to \c *this. */ template EIGEN_DEVICE_FUNC inline typename internal::cast_return_type >::type cast() const { return typename internal::cast_return_type >::type(*this); } /** Copy constructor with scalar type conversion */ template EIGEN_DEVICE_FUNC inline explicit Transform(const Transform& other) { check_template_params(); m_matrix = other.matrix().template cast(); } /** \returns \c true if \c *this is approximately equal to \a other, within the precision * determined by \a prec. * * \sa MatrixBase::isApprox() */ EIGEN_DEVICE_FUNC bool isApprox(const Transform& other, const typename NumTraits::Real& prec = NumTraits::dummy_precision()) const { return m_matrix.isApprox(other.m_matrix, prec); } /** Sets the last row to [0 ... 0 1] */ EIGEN_DEVICE_FUNC void makeAffine() { internal::transform_make_affine::run(m_matrix); } /** \internal * \returns the Dim x Dim linear part if the transformation is affine, * and the HDim x Dim part for projective transformations. */ EIGEN_DEVICE_FUNC inline Block linearExt() { return m_matrix.template block(0,0); } /** \internal * \returns the Dim x Dim linear part if the transformation is affine, * and the HDim x Dim part for projective transformations. */ EIGEN_DEVICE_FUNC inline const Block linearExt() const { return m_matrix.template block(0,0); } /** \internal * \returns the translation part if the transformation is affine, * and the last column for projective transformations. */ EIGEN_DEVICE_FUNC inline Block translationExt() { return m_matrix.template block(0,Dim); } /** \internal * \returns the translation part if the transformation is affine, * and the last column for projective transformations. */ EIGEN_DEVICE_FUNC inline const Block translationExt() const { return m_matrix.template block(0,Dim); } #ifdef EIGEN_TRANSFORM_PLUGIN #include EIGEN_TRANSFORM_PLUGIN #endif protected: #ifndef EIGEN_PARSED_BY_DOXYGEN EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void check_template_params() { EIGEN_STATIC_ASSERT((Options & (DontAlign|RowMajor)) == Options, INVALID_MATRIX_TEMPLATE_PARAMETERS) } #endif }; /** \ingroup Geometry_Module */ typedef Transform Isometry2f; /** \ingroup Geometry_Module */ typedef Transform Isometry3f; /** \ingroup Geometry_Module */ typedef Transform Isometry2d; /** \ingroup Geometry_Module */ typedef Transform Isometry3d; /** \ingroup Geometry_Module */ typedef Transform Affine2f; /** \ingroup Geometry_Module */ typedef Transform Affine3f; /** \ingroup Geometry_Module */ typedef Transform Affine2d; /** \ingroup Geometry_Module */ typedef Transform Affine3d; /** \ingroup Geometry_Module */ typedef Transform AffineCompact2f; /** \ingroup Geometry_Module */ typedef Transform AffineCompact3f; /** \ingroup Geometry_Module */ typedef Transform AffineCompact2d; /** \ingroup Geometry_Module */ typedef Transform AffineCompact3d; /** \ingroup Geometry_Module */ typedef Transform Projective2f; /** \ingroup Geometry_Module */ typedef Transform Projective3f; /** \ingroup Geometry_Module */ typedef Transform Projective2d; /** \ingroup Geometry_Module */ typedef Transform Projective3d; /************************** *** Optional QT support *** **************************/ #ifdef EIGEN_QT_SUPPORT /** Initializes \c *this from a QMatrix assuming the dimension is 2. * * This function is available only if the token EIGEN_QT_SUPPORT is defined. */ template Transform::Transform(const QMatrix& other) { check_template_params(); *this = other; } /** Set \c *this from a QMatrix assuming the dimension is 2. * * This function is available only if the token EIGEN_QT_SUPPORT is defined. */ template Transform& Transform::operator=(const QMatrix& other) { EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE) if (EIGEN_CONST_CONDITIONAL(Mode == int(AffineCompact))) m_matrix << other.m11(), other.m21(), other.dx(), other.m12(), other.m22(), other.dy(); else m_matrix << other.m11(), other.m21(), other.dx(), other.m12(), other.m22(), other.dy(), 0, 0, 1; return *this; } /** \returns a QMatrix from \c *this assuming the dimension is 2. * * \warning this conversion might loss data if \c *this is not affine * * This function is available only if the token EIGEN_QT_SUPPORT is defined. */ template QMatrix Transform::toQMatrix(void) const { check_template_params(); EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE) return QMatrix(m_matrix.coeff(0,0), m_matrix.coeff(1,0), m_matrix.coeff(0,1), m_matrix.coeff(1,1), m_matrix.coeff(0,2), m_matrix.coeff(1,2)); } /** Initializes \c *this from a QTransform assuming the dimension is 2. * * This function is available only if the token EIGEN_QT_SUPPORT is defined. */ template Transform::Transform(const QTransform& other) { check_template_params(); *this = other; } /** Set \c *this from a QTransform assuming the dimension is 2. * * This function is available only if the token EIGEN_QT_SUPPORT is defined. */ template Transform& Transform::operator=(const QTransform& other) { check_template_params(); EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE) if (EIGEN_CONST_CONDITIONAL(Mode == int(AffineCompact))) m_matrix << other.m11(), other.m21(), other.dx(), other.m12(), other.m22(), other.dy(); else m_matrix << other.m11(), other.m21(), other.dx(), other.m12(), other.m22(), other.dy(), other.m13(), other.m23(), other.m33(); return *this; } /** \returns a QTransform from \c *this assuming the dimension is 2. * * This function is available only if the token EIGEN_QT_SUPPORT is defined. */ template QTransform Transform::toQTransform(void) const { EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE) if (EIGEN_CONST_CONDITIONAL(Mode == int(AffineCompact))) return QTransform(m_matrix.coeff(0,0), m_matrix.coeff(1,0), m_matrix.coeff(0,1), m_matrix.coeff(1,1), m_matrix.coeff(0,2), m_matrix.coeff(1,2)); else return QTransform(m_matrix.coeff(0,0), m_matrix.coeff(1,0), m_matrix.coeff(2,0), m_matrix.coeff(0,1), m_matrix.coeff(1,1), m_matrix.coeff(2,1), m_matrix.coeff(0,2), m_matrix.coeff(1,2), m_matrix.coeff(2,2)); } #endif /********************* *** Procedural API *** *********************/ /** Applies on the right the non uniform scale transformation represented * by the vector \a other to \c *this and returns a reference to \c *this. * \sa prescale() */ template template EIGEN_DEVICE_FUNC Transform& Transform::scale(const MatrixBase &other) { EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim)) EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS) linearExt().noalias() = (linearExt() * other.asDiagonal()); return *this; } /** Applies on the right a uniform scale of a factor \a c to \c *this * and returns a reference to \c *this. * \sa prescale(Scalar) */ template EIGEN_DEVICE_FUNC inline Transform& Transform::scale(const Scalar& s) { EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS) linearExt() *= s; return *this; } /** Applies on the left the non uniform scale transformation represented * by the vector \a other to \c *this and returns a reference to \c *this. * \sa scale() */ template template EIGEN_DEVICE_FUNC Transform& Transform::prescale(const MatrixBase &other) { EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim)) EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS) affine().noalias() = (other.asDiagonal() * affine()); return *this; } /** Applies on the left a uniform scale of a factor \a c to \c *this * and returns a reference to \c *this. * \sa scale(Scalar) */ template EIGEN_DEVICE_FUNC inline Transform& Transform::prescale(const Scalar& s) { EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS) m_matrix.template topRows() *= s; return *this; } /** Applies on the right the translation matrix represented by the vector \a other * to \c *this and returns a reference to \c *this. * \sa pretranslate() */ template template EIGEN_DEVICE_FUNC Transform& Transform::translate(const MatrixBase &other) { EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim)) translationExt() += linearExt() * other; return *this; } /** Applies on the left the translation matrix represented by the vector \a other * to \c *this and returns a reference to \c *this. * \sa translate() */ template template EIGEN_DEVICE_FUNC Transform& Transform::pretranslate(const MatrixBase &other) { EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim)) if(EIGEN_CONST_CONDITIONAL(int(Mode)==int(Projective))) affine() += other * m_matrix.row(Dim); else translation() += other; return *this; } /** Applies on the right the rotation represented by the rotation \a rotation * to \c *this and returns a reference to \c *this. * * The template parameter \a RotationType is the type of the rotation which * must be known by internal::toRotationMatrix<>. * * Natively supported types includes: * - any scalar (2D), * - a Dim x Dim matrix expression, * - a Quaternion (3D), * - a AngleAxis (3D) * * This mechanism is easily extendable to support user types such as Euler angles, * or a pair of Quaternion for 4D rotations. * * \sa rotate(Scalar), class Quaternion, class AngleAxis, prerotate(RotationType) */ template template EIGEN_DEVICE_FUNC Transform& Transform::rotate(const RotationType& rotation) { linearExt() *= internal::toRotationMatrix(rotation); return *this; } /** Applies on the left the rotation represented by the rotation \a rotation * to \c *this and returns a reference to \c *this. * * See rotate() for further details. * * \sa rotate() */ template template EIGEN_DEVICE_FUNC Transform& Transform::prerotate(const RotationType& rotation) { m_matrix.template block(0,0) = internal::toRotationMatrix(rotation) * m_matrix.template block(0,0); return *this; } /** Applies on the right the shear transformation represented * by the vector \a other to \c *this and returns a reference to \c *this. * \warning 2D only. * \sa preshear() */ template EIGEN_DEVICE_FUNC Transform& Transform::shear(const Scalar& sx, const Scalar& sy) { EIGEN_STATIC_ASSERT(int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE) EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS) VectorType tmp = linear().col(0)*sy + linear().col(1); linear() << linear().col(0) + linear().col(1)*sx, tmp; return *this; } /** Applies on the left the shear transformation represented * by the vector \a other to \c *this and returns a reference to \c *this. * \warning 2D only. * \sa shear() */ template EIGEN_DEVICE_FUNC Transform& Transform::preshear(const Scalar& sx, const Scalar& sy) { EIGEN_STATIC_ASSERT(int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE) EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS) m_matrix.template block(0,0) = LinearMatrixType(1, sx, sy, 1) * m_matrix.template block(0,0); return *this; } /****************************************************** *** Scaling, Translation and Rotation compatibility *** ******************************************************/ template EIGEN_DEVICE_FUNC inline Transform& Transform::operator=(const TranslationType& t) { linear().setIdentity(); translation() = t.vector(); makeAffine(); return *this; } template EIGEN_DEVICE_FUNC inline Transform Transform::operator*(const TranslationType& t) const { Transform res = *this; res.translate(t.vector()); return res; } template EIGEN_DEVICE_FUNC inline Transform& Transform::operator=(const UniformScaling& s) { m_matrix.setZero(); linear().diagonal().fill(s.factor()); makeAffine(); return *this; } template template EIGEN_DEVICE_FUNC inline Transform& Transform::operator=(const RotationBase& r) { linear() = internal::toRotationMatrix(r); translation().setZero(); makeAffine(); return *this; } template template EIGEN_DEVICE_FUNC inline Transform Transform::operator*(const RotationBase& r) const { Transform res = *this; res.rotate(r.derived()); return res; } /************************ *** Special functions *** ************************/ namespace internal { template struct transform_rotation_impl { template EIGEN_DEVICE_FUNC static inline const typename TransformType::LinearMatrixType run(const TransformType& t) { typedef typename TransformType::LinearMatrixType LinearMatrixType; LinearMatrixType result; t.computeRotationScaling(&result, (LinearMatrixType*)0); return result; } }; template<> struct transform_rotation_impl { template EIGEN_DEVICE_FUNC static inline typename TransformType::ConstLinearPart run(const TransformType& t) { return t.linear(); } }; } /** \returns the rotation part of the transformation * * If Mode==Isometry, then this method is an alias for linear(), * otherwise it calls computeRotationScaling() to extract the rotation * through a SVD decomposition. * * \svd_module * * \sa computeRotationScaling(), computeScalingRotation(), class SVD */ template EIGEN_DEVICE_FUNC typename Transform::RotationReturnType Transform::rotation() const { return internal::transform_rotation_impl::run(*this); } /** decomposes the linear part of the transformation as a product rotation x scaling, the scaling being * not necessarily positive. * * If either pointer is zero, the corresponding computation is skipped. * * * * \svd_module * * \sa computeScalingRotation(), rotation(), class SVD */ template template EIGEN_DEVICE_FUNC void Transform::computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const { // Note that JacobiSVD is faster than BDCSVD for small matrices. JacobiSVD svd(linear(), ComputeFullU | ComputeFullV); Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant() < Scalar(0) ? Scalar(-1) : Scalar(1); // so x has absolute value 1 VectorType sv(svd.singularValues()); sv.coeffRef(Dim-1) *= x; if(scaling) *scaling = svd.matrixV() * sv.asDiagonal() * svd.matrixV().adjoint(); if(rotation) { LinearMatrixType m(svd.matrixU()); m.col(Dim-1) *= x; *rotation = m * svd.matrixV().adjoint(); } } /** decomposes the linear part of the transformation as a product scaling x rotation, the scaling being * not necessarily positive. * * If either pointer is zero, the corresponding computation is skipped. * * * * \svd_module * * \sa computeRotationScaling(), rotation(), class SVD */ template template EIGEN_DEVICE_FUNC void Transform::computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) const { // Note that JacobiSVD is faster than BDCSVD for small matrices. JacobiSVD svd(linear(), ComputeFullU | ComputeFullV); Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant() < Scalar(0) ? Scalar(-1) : Scalar(1); // so x has absolute value 1 VectorType sv(svd.singularValues()); sv.coeffRef(Dim-1) *= x; if(scaling) *scaling = svd.matrixU() * sv.asDiagonal() * svd.matrixU().adjoint(); if(rotation) { LinearMatrixType m(svd.matrixU()); m.col(Dim-1) *= x; *rotation = m * svd.matrixV().adjoint(); } } /** Convenient method to set \c *this from a position, orientation and scale * of a 3D object. */ template template EIGEN_DEVICE_FUNC Transform& Transform::fromPositionOrientationScale(const MatrixBase &position, const OrientationType& orientation, const MatrixBase &scale) { linear() = internal::toRotationMatrix(orientation); linear() *= scale.asDiagonal(); translation() = position; makeAffine(); return *this; } namespace internal { template struct transform_make_affine { template EIGEN_DEVICE_FUNC static void run(MatrixType &mat) { static const int Dim = MatrixType::ColsAtCompileTime-1; mat.template block<1,Dim>(Dim,0).setZero(); mat.coeffRef(Dim,Dim) = typename MatrixType::Scalar(1); } }; template<> struct transform_make_affine { template EIGEN_DEVICE_FUNC static void run(MatrixType &) { } }; // selector needed to avoid taking the inverse of a 3x4 matrix template struct projective_transform_inverse { EIGEN_DEVICE_FUNC static inline void run(const TransformType&, TransformType&) {} }; template struct projective_transform_inverse { EIGEN_DEVICE_FUNC static inline void run(const TransformType& m, TransformType& res) { res.matrix() = m.matrix().inverse(); } }; } // end namespace internal /** * * \returns the inverse transformation according to some given knowledge * on \c *this. * * \param hint allows to optimize the inversion process when the transformation * is known to be not a general transformation (optional). The possible values are: * - #Projective if the transformation is not necessarily affine, i.e., if the * last row is not guaranteed to be [0 ... 0 1] * - #Affine if the last row can be assumed to be [0 ... 0 1] * - #Isometry if the transformation is only a concatenations of translations * and rotations. * The default is the template class parameter \c Mode. * * \warning unless \a traits is always set to NoShear or NoScaling, this function * requires the generic inverse method of MatrixBase defined in the LU module. If * you forget to include this module, then you will get hard to debug linking errors. * * \sa MatrixBase::inverse() */ template EIGEN_DEVICE_FUNC Transform Transform::inverse(TransformTraits hint) const { Transform res; if (hint == Projective) { internal::projective_transform_inverse::run(*this, res); } else { if (hint == Isometry) { res.matrix().template topLeftCorner() = linear().transpose(); } else if(hint&Affine) { res.matrix().template topLeftCorner() = linear().inverse(); } else { eigen_assert(false && "Invalid transform traits in Transform::Inverse"); } // translation and remaining parts res.matrix().template topRightCorner() = - res.matrix().template topLeftCorner() * translation(); res.makeAffine(); // we do need this, because in the beginning res is uninitialized } return res; } namespace internal { /***************************************************** *** Specializations of take affine part *** *****************************************************/ template struct transform_take_affine_part { typedef typename TransformType::MatrixType MatrixType; typedef typename TransformType::AffinePart AffinePart; typedef typename TransformType::ConstAffinePart ConstAffinePart; static inline AffinePart run(MatrixType& m) { return m.template block(0,0); } static inline ConstAffinePart run(const MatrixType& m) { return m.template block(0,0); } }; template struct transform_take_affine_part > { typedef typename Transform::MatrixType MatrixType; static inline MatrixType& run(MatrixType& m) { return m; } static inline const MatrixType& run(const MatrixType& m) { return m; } }; /***************************************************** *** Specializations of construct from matrix *** *****************************************************/ template struct transform_construct_from_matrix { static inline void run(Transform *transform, const Other& other) { transform->linear() = other; transform->translation().setZero(); transform->makeAffine(); } }; template struct transform_construct_from_matrix { static inline void run(Transform *transform, const Other& other) { transform->affine() = other; transform->makeAffine(); } }; template struct transform_construct_from_matrix { static inline void run(Transform *transform, const Other& other) { transform->matrix() = other; } }; template struct transform_construct_from_matrix { static inline void run(Transform *transform, const Other& other) { transform->matrix() = other.template block(0,0); } }; /********************************************************** *** Specializations of operator* with rhs EigenBase *** **********************************************************/ template struct transform_product_result { enum { Mode = (LhsMode == (int)Projective || RhsMode == (int)Projective ) ? Projective : (LhsMode == (int)Affine || RhsMode == (int)Affine ) ? Affine : (LhsMode == (int)AffineCompact || RhsMode == (int)AffineCompact ) ? AffineCompact : (LhsMode == (int)Isometry || RhsMode == (int)Isometry ) ? Isometry : Projective }; }; template< typename TransformType, typename MatrixType, int RhsCols> struct transform_right_product_impl< TransformType, MatrixType, 0, RhsCols> { typedef typename MatrixType::PlainObject ResultType; static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other) { return T.matrix() * other; } }; template< typename TransformType, typename MatrixType, int RhsCols> struct transform_right_product_impl< TransformType, MatrixType, 1, RhsCols> { enum { Dim = TransformType::Dim, HDim = TransformType::HDim, OtherRows = MatrixType::RowsAtCompileTime, OtherCols = MatrixType::ColsAtCompileTime }; typedef typename MatrixType::PlainObject ResultType; static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other) { EIGEN_STATIC_ASSERT(OtherRows==HDim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES); typedef Block TopLeftLhs; ResultType res(other.rows(),other.cols()); TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() = T.affine() * other; res.row(OtherRows-1) = other.row(OtherRows-1); return res; } }; template< typename TransformType, typename MatrixType, int RhsCols> struct transform_right_product_impl< TransformType, MatrixType, 2, RhsCols> { enum { Dim = TransformType::Dim, HDim = TransformType::HDim, OtherRows = MatrixType::RowsAtCompileTime, OtherCols = MatrixType::ColsAtCompileTime }; typedef typename MatrixType::PlainObject ResultType; static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other) { EIGEN_STATIC_ASSERT(OtherRows==Dim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES); typedef Block TopLeftLhs; ResultType res(Replicate(T.translation(),1,other.cols())); TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() += T.linear() * other; return res; } }; template< typename TransformType, typename MatrixType > struct transform_right_product_impl< TransformType, MatrixType, 2, 1> // rhs is a vector of size Dim { typedef typename TransformType::MatrixType TransformMatrix; enum { Dim = TransformType::Dim, HDim = TransformType::HDim, OtherRows = MatrixType::RowsAtCompileTime, WorkingRows = EIGEN_PLAIN_ENUM_MIN(TransformMatrix::RowsAtCompileTime,HDim) }; typedef typename MatrixType::PlainObject ResultType; static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other) { EIGEN_STATIC_ASSERT(OtherRows==Dim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES); Matrix rhs; rhs.template head() = other; rhs[Dim] = typename ResultType::Scalar(1); Matrix res(T.matrix() * rhs); return res.template head(); } }; /********************************************************** *** Specializations of operator* with lhs EigenBase *** **********************************************************/ // generic HDim x HDim matrix * T => Projective template struct transform_left_product_impl { typedef Transform TransformType; typedef typename TransformType::MatrixType MatrixType; typedef Transform ResultType; static ResultType run(const Other& other,const TransformType& tr) { return ResultType(other * tr.matrix()); } }; // generic HDim x HDim matrix * AffineCompact => Projective template struct transform_left_product_impl { typedef Transform TransformType; typedef typename TransformType::MatrixType MatrixType; typedef Transform ResultType; static ResultType run(const Other& other,const TransformType& tr) { ResultType res; res.matrix().noalias() = other.template block(0,0) * tr.matrix(); res.matrix().col(Dim) += other.col(Dim); return res; } }; // affine matrix * T template struct transform_left_product_impl { typedef Transform TransformType; typedef typename TransformType::MatrixType MatrixType; typedef TransformType ResultType; static ResultType run(const Other& other,const TransformType& tr) { ResultType res; res.affine().noalias() = other * tr.matrix(); res.matrix().row(Dim) = tr.matrix().row(Dim); return res; } }; // affine matrix * AffineCompact template struct transform_left_product_impl { typedef Transform TransformType; typedef typename TransformType::MatrixType MatrixType; typedef TransformType ResultType; static ResultType run(const Other& other,const TransformType& tr) { ResultType res; res.matrix().noalias() = other.template block(0,0) * tr.matrix(); res.translation() += other.col(Dim); return res; } }; // linear matrix * T template struct transform_left_product_impl { typedef Transform TransformType; typedef typename TransformType::MatrixType MatrixType; typedef TransformType ResultType; static ResultType run(const Other& other, const TransformType& tr) { TransformType res; if(Mode!=int(AffineCompact)) res.matrix().row(Dim) = tr.matrix().row(Dim); res.matrix().template topRows().noalias() = other * tr.matrix().template topRows(); return res; } }; /********************************************************** *** Specializations of operator* with another Transform *** **********************************************************/ template struct transform_transform_product_impl,Transform,false > { enum { ResultMode = transform_product_result::Mode }; typedef Transform Lhs; typedef Transform Rhs; typedef Transform ResultType; static ResultType run(const Lhs& lhs, const Rhs& rhs) { ResultType res; res.linear() = lhs.linear() * rhs.linear(); res.translation() = lhs.linear() * rhs.translation() + lhs.translation(); res.makeAffine(); return res; } }; template struct transform_transform_product_impl,Transform,true > { typedef Transform Lhs; typedef Transform Rhs; typedef Transform ResultType; static ResultType run(const Lhs& lhs, const Rhs& rhs) { return ResultType( lhs.matrix() * rhs.matrix() ); } }; template struct transform_transform_product_impl,Transform,true > { typedef Transform Lhs; typedef Transform Rhs; typedef Transform ResultType; static ResultType run(const Lhs& lhs, const Rhs& rhs) { ResultType res; res.matrix().template topRows() = lhs.matrix() * rhs.matrix(); res.matrix().row(Dim) = rhs.matrix().row(Dim); return res; } }; template struct transform_transform_product_impl,Transform,true > { typedef Transform Lhs; typedef Transform Rhs; typedef Transform ResultType; static ResultType run(const Lhs& lhs, const Rhs& rhs) { ResultType res(lhs.matrix().template leftCols() * rhs.matrix()); res.matrix().col(Dim) += lhs.matrix().col(Dim); return res; } }; } // end namespace internal } // end namespace Eigen #endif // EIGEN_TRANSFORM_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Geometry/Translation.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_TRANSLATION_H #define EIGEN_TRANSLATION_H namespace Eigen { /** \geometry_module \ingroup Geometry_Module * * \class Translation * * \brief Represents a translation transformation * * \tparam Scalar_ the scalar type, i.e., the type of the coefficients. * \tparam Dim_ the dimension of the space, can be a compile time value or Dynamic * * \note This class is not aimed to be used to store a translation transformation, * but rather to make easier the constructions and updates of Transform objects. * * \sa class Scaling, class Transform */ template class Translation { public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(Scalar_,Dim_) /** dimension of the space */ enum { Dim = Dim_ }; /** the scalar type of the coefficients */ typedef Scalar_ Scalar; /** corresponding vector type */ typedef Matrix VectorType; /** corresponding linear transformation matrix type */ typedef Matrix LinearMatrixType; /** corresponding affine transformation type */ typedef Transform AffineTransformType; /** corresponding isometric transformation type */ typedef Transform IsometryTransformType; protected: VectorType m_coeffs; public: /** Default constructor without initialization. */ EIGEN_DEVICE_FUNC Translation() {} /** */ EIGEN_DEVICE_FUNC inline Translation(const Scalar& sx, const Scalar& sy) { eigen_assert(Dim==2); m_coeffs.x() = sx; m_coeffs.y() = sy; } /** */ EIGEN_DEVICE_FUNC inline Translation(const Scalar& sx, const Scalar& sy, const Scalar& sz) { eigen_assert(Dim==3); m_coeffs.x() = sx; m_coeffs.y() = sy; m_coeffs.z() = sz; } /** Constructs and initialize the translation transformation from a vector of translation coefficients */ EIGEN_DEVICE_FUNC explicit inline Translation(const VectorType& vector) : m_coeffs(vector) {} /** \brief Returns the x-translation by value. **/ EIGEN_DEVICE_FUNC inline Scalar x() const { return m_coeffs.x(); } /** \brief Returns the y-translation by value. **/ EIGEN_DEVICE_FUNC inline Scalar y() const { return m_coeffs.y(); } /** \brief Returns the z-translation by value. **/ EIGEN_DEVICE_FUNC inline Scalar z() const { return m_coeffs.z(); } /** \brief Returns the x-translation as a reference. **/ EIGEN_DEVICE_FUNC inline Scalar& x() { return m_coeffs.x(); } /** \brief Returns the y-translation as a reference. **/ EIGEN_DEVICE_FUNC inline Scalar& y() { return m_coeffs.y(); } /** \brief Returns the z-translation as a reference. **/ EIGEN_DEVICE_FUNC inline Scalar& z() { return m_coeffs.z(); } EIGEN_DEVICE_FUNC const VectorType& vector() const { return m_coeffs; } EIGEN_DEVICE_FUNC VectorType& vector() { return m_coeffs; } EIGEN_DEVICE_FUNC const VectorType& translation() const { return m_coeffs; } EIGEN_DEVICE_FUNC VectorType& translation() { return m_coeffs; } /** Concatenates two translation */ EIGEN_DEVICE_FUNC inline Translation operator* (const Translation& other) const { return Translation(m_coeffs + other.m_coeffs); } /** Concatenates a translation and a uniform scaling */ EIGEN_DEVICE_FUNC inline AffineTransformType operator* (const UniformScaling& other) const; /** Concatenates a translation and a linear transformation */ template EIGEN_DEVICE_FUNC inline AffineTransformType operator* (const EigenBase& linear) const; /** Concatenates a translation and a rotation */ template EIGEN_DEVICE_FUNC inline IsometryTransformType operator*(const RotationBase& r) const { return *this * IsometryTransformType(r); } /** \returns the concatenation of a linear transformation \a l with the translation \a t */ // its a nightmare to define a templated friend function outside its declaration template friend EIGEN_DEVICE_FUNC inline AffineTransformType operator*(const EigenBase& linear, const Translation& t) { AffineTransformType res; res.matrix().setZero(); res.linear() = linear.derived(); res.translation() = linear.derived() * t.m_coeffs; res.matrix().row(Dim).setZero(); res(Dim,Dim) = Scalar(1); return res; } /** Concatenates a translation and a transformation */ template EIGEN_DEVICE_FUNC inline Transform operator* (const Transform& t) const { Transform res = t; res.pretranslate(m_coeffs); return res; } /** Applies translation to vector */ template inline typename internal::enable_if::type operator* (const MatrixBase& vec) const { return m_coeffs + vec.derived(); } /** \returns the inverse translation (opposite) */ Translation inverse() const { return Translation(-m_coeffs); } static const Translation Identity() { return Translation(VectorType::Zero()); } /** \returns \c *this with scalar type casted to \a NewScalarType * * Note that if \a NewScalarType is equal to the current scalar type of \c *this * then this function smartly returns a const reference to \c *this. */ template EIGEN_DEVICE_FUNC inline typename internal::cast_return_type >::type cast() const { return typename internal::cast_return_type >::type(*this); } /** Copy constructor with scalar type conversion */ template EIGEN_DEVICE_FUNC inline explicit Translation(const Translation& other) { m_coeffs = other.vector().template cast(); } /** \returns \c true if \c *this is approximately equal to \a other, within the precision * determined by \a prec. * * \sa MatrixBase::isApprox() */ EIGEN_DEVICE_FUNC bool isApprox(const Translation& other, const typename NumTraits::Real& prec = NumTraits::dummy_precision()) const { return m_coeffs.isApprox(other.m_coeffs, prec); } }; /** \addtogroup Geometry_Module */ //@{ typedef Translation Translation2f; typedef Translation Translation2d; typedef Translation Translation3f; typedef Translation Translation3d; //@} template EIGEN_DEVICE_FUNC inline typename Translation::AffineTransformType Translation::operator* (const UniformScaling& other) const { AffineTransformType res; res.matrix().setZero(); res.linear().diagonal().fill(other.factor()); res.translation() = m_coeffs; res(Dim,Dim) = Scalar(1); return res; } template template EIGEN_DEVICE_FUNC inline typename Translation::AffineTransformType Translation::operator* (const EigenBase& linear) const { AffineTransformType res; res.matrix().setZero(); res.linear() = linear.derived(); res.translation() = m_coeffs; res.matrix().row(Dim).setZero(); res(Dim,Dim) = Scalar(1); return res; } } // end namespace Eigen #endif // EIGEN_TRANSLATION_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Geometry/Umeyama.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Hauke Heibel // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_UMEYAMA_H #define EIGEN_UMEYAMA_H // This file requires the user to include // * Eigen/Core // * Eigen/LU // * Eigen/SVD // * Eigen/Array namespace Eigen { #ifndef EIGEN_PARSED_BY_DOXYGEN // These helpers are required since it allows to use mixed types as parameters // for the Umeyama. The problem with mixed parameters is that the return type // cannot trivially be deduced when float and double types are mixed. namespace internal { // Compile time return type deduction for different MatrixBase types. // Different means here different alignment and parameters but the same underlying // real scalar type. template struct umeyama_transform_matrix_type { enum { MinRowsAtCompileTime = EIGEN_SIZE_MIN_PREFER_DYNAMIC(MatrixType::RowsAtCompileTime, OtherMatrixType::RowsAtCompileTime), // When possible we want to choose some small fixed size value since the result // is likely to fit on the stack. So here, EIGEN_SIZE_MIN_PREFER_DYNAMIC is not what we want. HomogeneousDimension = int(MinRowsAtCompileTime) == Dynamic ? Dynamic : int(MinRowsAtCompileTime)+1 }; typedef Matrix::Scalar, HomogeneousDimension, HomogeneousDimension, AutoAlign | (traits::Flags & RowMajorBit ? RowMajor : ColMajor), HomogeneousDimension, HomogeneousDimension > type; }; } #endif /** * \geometry_module \ingroup Geometry_Module * * \brief Returns the transformation between two point sets. * * The algorithm is based on: * "Least-squares estimation of transformation parameters between two point patterns", * Shinji Umeyama, PAMI 1991, DOI: 10.1109/34.88573 * * It estimates parameters \f$ c, \mathbf{R}, \f$ and \f$ \mathbf{t} \f$ such that * \f{align*} * \frac{1}{n} \sum_{i=1}^n \vert\vert y_i - (c\mathbf{R}x_i + \mathbf{t}) \vert\vert_2^2 * \f} * is minimized. * * The algorithm is based on the analysis of the covariance matrix * \f$ \Sigma_{\mathbf{x}\mathbf{y}} \in \mathbb{R}^{d \times d} \f$ * of the input point sets \f$ \mathbf{x} \f$ and \f$ \mathbf{y} \f$ where * \f$d\f$ is corresponding to the dimension (which is typically small). * The analysis is involving the SVD having a complexity of \f$O(d^3)\f$ * though the actual computational effort lies in the covariance * matrix computation which has an asymptotic lower bound of \f$O(dm)\f$ when * the input point sets have dimension \f$d \times m\f$. * * Currently the method is working only for floating point matrices. * * \todo Should the return type of umeyama() become a Transform? * * \param src Source points \f$ \mathbf{x} = \left( x_1, \hdots, x_n \right) \f$. * \param dst Destination points \f$ \mathbf{y} = \left( y_1, \hdots, y_n \right) \f$. * \param with_scaling Sets \f$ c=1 \f$ when false is passed. * \return The homogeneous transformation * \f{align*} * T = \begin{bmatrix} c\mathbf{R} & \mathbf{t} \\ \mathbf{0} & 1 \end{bmatrix} * \f} * minimizing the residual above. This transformation is always returned as an * Eigen::Matrix. */ template typename internal::umeyama_transform_matrix_type::type umeyama(const MatrixBase& src, const MatrixBase& dst, bool with_scaling = true) { typedef typename internal::umeyama_transform_matrix_type::type TransformationMatrixType; typedef typename internal::traits::Scalar Scalar; typedef typename NumTraits::Real RealScalar; EIGEN_STATIC_ASSERT(!NumTraits::IsComplex, NUMERIC_TYPE_MUST_BE_REAL) EIGEN_STATIC_ASSERT((internal::is_same::Scalar>::value), YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) enum { Dimension = EIGEN_SIZE_MIN_PREFER_DYNAMIC(Derived::RowsAtCompileTime, OtherDerived::RowsAtCompileTime) }; typedef Matrix VectorType; typedef Matrix MatrixType; typedef typename internal::plain_matrix_type_row_major::type RowMajorMatrixType; const Index m = src.rows(); // dimension const Index n = src.cols(); // number of measurements // required for demeaning ... const RealScalar one_over_n = RealScalar(1) / static_cast(n); // computation of mean const VectorType src_mean = src.rowwise().sum() * one_over_n; const VectorType dst_mean = dst.rowwise().sum() * one_over_n; // demeaning of src and dst points const RowMajorMatrixType src_demean = src.colwise() - src_mean; const RowMajorMatrixType dst_demean = dst.colwise() - dst_mean; // Eq. (36)-(37) const Scalar src_var = src_demean.rowwise().squaredNorm().sum() * one_over_n; // Eq. (38) const MatrixType sigma = one_over_n * dst_demean * src_demean.transpose(); JacobiSVD svd(sigma, ComputeFullU | ComputeFullV); // Initialize the resulting transformation with an identity matrix... TransformationMatrixType Rt = TransformationMatrixType::Identity(m+1,m+1); // Eq. (39) VectorType S = VectorType::Ones(m); if ( svd.matrixU().determinant() * svd.matrixV().determinant() < 0 ) S(m-1) = -1; // Eq. (40) and (43) Rt.block(0,0,m,m).noalias() = svd.matrixU() * S.asDiagonal() * svd.matrixV().transpose(); if (with_scaling) { // Eq. (42) const Scalar c = Scalar(1)/src_var * svd.singularValues().dot(S); // Eq. (41) Rt.col(m).head(m) = dst_mean; Rt.col(m).head(m).noalias() -= c*Rt.topLeftCorner(m,m)*src_mean; Rt.block(0,0,m,m) *= c; } else { Rt.col(m).head(m) = dst_mean; Rt.col(m).head(m).noalias() -= Rt.topLeftCorner(m,m)*src_mean; } return Rt; } } // end namespace Eigen #endif // EIGEN_UMEYAMA_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Geometry/arch/Geometry_SIMD.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Rohit Garg // Copyright (C) 2009-2010 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_GEOMETRY_SIMD_H #define EIGEN_GEOMETRY_SIMD_H namespace Eigen { namespace internal { template struct quat_product { enum { AAlignment = traits::Alignment, BAlignment = traits::Alignment, ResAlignment = traits >::Alignment }; static inline Quaternion run(const QuaternionBase& _a, const QuaternionBase& _b) { evaluator ae(_a.coeffs()); evaluator be(_b.coeffs()); Quaternion res; const float neg_zero = numext::bit_cast(0x80000000u); const float arr[4] = {0.f, 0.f, 0.f, neg_zero}; const Packet4f mask = ploadu(arr); Packet4f a = ae.template packet(0); Packet4f b = be.template packet(0); Packet4f s1 = pmul(vec4f_swizzle1(a,1,2,0,2),vec4f_swizzle1(b,2,0,1,2)); Packet4f s2 = pmul(vec4f_swizzle1(a,3,3,3,1),vec4f_swizzle1(b,0,1,2,1)); pstoret( &res.x(), padd(psub(pmul(a,vec4f_swizzle1(b,3,3,3,3)), pmul(vec4f_swizzle1(a,2,0,1,0), vec4f_swizzle1(b,1,2,0,0))), pxor(mask,padd(s1,s2)))); return res; } }; template struct quat_conj { enum { ResAlignment = traits >::Alignment }; static inline Quaternion run(const QuaternionBase& q) { evaluator qe(q.coeffs()); Quaternion res; const float neg_zero = numext::bit_cast(0x80000000u); const float arr[4] = {neg_zero, neg_zero, neg_zero,0.f}; const Packet4f mask = ploadu(arr); pstoret(&res.x(), pxor(mask, qe.template packet::Alignment,Packet4f>(0))); return res; } }; template struct cross3_impl { enum { ResAlignment = traits::type>::Alignment }; static inline typename plain_matrix_type::type run(const VectorLhs& lhs, const VectorRhs& rhs) { evaluator lhs_eval(lhs); evaluator rhs_eval(rhs); Packet4f a = lhs_eval.template packet::Alignment,Packet4f>(0); Packet4f b = rhs_eval.template packet::Alignment,Packet4f>(0); Packet4f mul1 = pmul(vec4f_swizzle1(a,1,2,0,3),vec4f_swizzle1(b,2,0,1,3)); Packet4f mul2 = pmul(vec4f_swizzle1(a,2,0,1,3),vec4f_swizzle1(b,1,2,0,3)); typename plain_matrix_type::type res; pstoret(&res.x(),psub(mul1,mul2)); return res; } }; #if (defined EIGEN_VECTORIZE_SSE) || (EIGEN_ARCH_ARM64) template struct quat_product { enum { BAlignment = traits::Alignment, ResAlignment = traits >::Alignment }; static inline Quaternion run(const QuaternionBase& _a, const QuaternionBase& _b) { Quaternion res; evaluator ae(_a.coeffs()); evaluator be(_b.coeffs()); const double* a = _a.coeffs().data(); Packet2d b_xy = be.template packet(0); Packet2d b_zw = be.template packet(2); Packet2d a_xx = pset1(a[0]); Packet2d a_yy = pset1(a[1]); Packet2d a_zz = pset1(a[2]); Packet2d a_ww = pset1(a[3]); // two temporaries: Packet2d t1, t2; /* * t1 = ww*xy + yy*zw * t2 = zz*xy - xx*zw * res.xy = t1 +/- swap(t2) */ t1 = padd(pmul(a_ww, b_xy), pmul(a_yy, b_zw)); t2 = psub(pmul(a_zz, b_xy), pmul(a_xx, b_zw)); pstoret(&res.x(), paddsub(t1, preverse(t2))); /* * t1 = ww*zw - yy*xy * t2 = zz*zw + xx*xy * res.zw = t1 -/+ swap(t2) = swap( swap(t1) +/- t2) */ t1 = psub(pmul(a_ww, b_zw), pmul(a_yy, b_xy)); t2 = padd(pmul(a_zz, b_zw), pmul(a_xx, b_xy)); pstoret(&res.z(), preverse(paddsub(preverse(t1), t2))); return res; } }; template struct quat_conj { enum { ResAlignment = traits >::Alignment }; static inline Quaternion run(const QuaternionBase& q) { evaluator qe(q.coeffs()); Quaternion res; const double neg_zero = numext::bit_cast(0x8000000000000000ull); const double arr1[2] = {neg_zero, neg_zero}; const double arr2[2] = {neg_zero, 0.0}; const Packet2d mask0 = ploadu(arr1); const Packet2d mask2 = ploadu(arr2); pstoret(&res.x(), pxor(mask0, qe.template packet::Alignment,Packet2d>(0))); pstoret(&res.z(), pxor(mask2, qe.template packet::Alignment,Packet2d>(2))); return res; } }; #endif // end EIGEN_VECTORIZE_SSE_OR_EIGEN_ARCH_ARM64 } // end namespace internal } // end namespace Eigen #endif // EIGEN_GEOMETRY_SIMD_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Householder/BlockHouseholder.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2010 Vincent Lejeune // Copyright (C) 2010 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_BLOCK_HOUSEHOLDER_H #define EIGEN_BLOCK_HOUSEHOLDER_H // This file contains some helper function to deal with block householder reflectors namespace Eigen { namespace internal { /** \internal */ // template // void make_block_householder_triangular_factor(TriangularFactorType& triFactor, const VectorsType& vectors, const CoeffsType& hCoeffs) // { // typedef typename VectorsType::Scalar Scalar; // const Index nbVecs = vectors.cols(); // eigen_assert(triFactor.rows() == nbVecs && triFactor.cols() == nbVecs && vectors.rows()>=nbVecs); // // for(Index i = 0; i < nbVecs; i++) // { // Index rs = vectors.rows() - i; // // Warning, note that hCoeffs may alias with vectors. // // It is then necessary to copy it before modifying vectors(i,i). // typename CoeffsType::Scalar h = hCoeffs(i); // // This hack permits to pass trough nested Block<> and Transpose<> expressions. // Scalar *Vii_ptr = const_cast(vectors.data() + vectors.outerStride()*i + vectors.innerStride()*i); // Scalar Vii = *Vii_ptr; // *Vii_ptr = Scalar(1); // triFactor.col(i).head(i).noalias() = -h * vectors.block(i, 0, rs, i).adjoint() // * vectors.col(i).tail(rs); // *Vii_ptr = Vii; // // FIXME add .noalias() once the triangular product can work inplace // triFactor.col(i).head(i) = triFactor.block(0,0,i,i).template triangularView() // * triFactor.col(i).head(i); // triFactor(i,i) = hCoeffs(i); // } // } /** \internal */ // This variant avoid modifications in vectors template void make_block_householder_triangular_factor(TriangularFactorType& triFactor, const VectorsType& vectors, const CoeffsType& hCoeffs) { const Index nbVecs = vectors.cols(); eigen_assert(triFactor.rows() == nbVecs && triFactor.cols() == nbVecs && vectors.rows()>=nbVecs); for(Index i = nbVecs-1; i >=0 ; --i) { Index rs = vectors.rows() - i - 1; Index rt = nbVecs-i-1; if(rt>0) { triFactor.row(i).tail(rt).noalias() = -hCoeffs(i) * vectors.col(i).tail(rs).adjoint() * vectors.bottomRightCorner(rs, rt).template triangularView(); // FIXME use the following line with .noalias() once the triangular product can work inplace // triFactor.row(i).tail(rt) = triFactor.row(i).tail(rt) * triFactor.bottomRightCorner(rt,rt).template triangularView(); for(Index j=nbVecs-1; j>i; --j) { typename TriangularFactorType::Scalar z = triFactor(i,j); triFactor(i,j) = z * triFactor(j,j); if(nbVecs-j-1>0) triFactor.row(i).tail(nbVecs-j-1) += z * triFactor.row(j).tail(nbVecs-j-1); } } triFactor(i,i) = hCoeffs(i); } } /** \internal * if forward then perform mat = H0 * H1 * H2 * mat * otherwise perform mat = H2 * H1 * H0 * mat */ template void apply_block_householder_on_the_left(MatrixType& mat, const VectorsType& vectors, const CoeffsType& hCoeffs, bool forward) { enum { TFactorSize = MatrixType::ColsAtCompileTime }; Index nbVecs = vectors.cols(); Matrix T(nbVecs,nbVecs); if(forward) make_block_householder_triangular_factor(T, vectors, hCoeffs); else make_block_householder_triangular_factor(T, vectors, hCoeffs.conjugate()); const TriangularView V(vectors); // A -= V T V^* A Matrix tmp = V.adjoint() * mat; // FIXME add .noalias() once the triangular product can work inplace if(forward) tmp = T.template triangularView() * tmp; else tmp = T.template triangularView().adjoint() * tmp; mat.noalias() -= V * tmp; } } // end namespace internal } // end namespace Eigen #endif // EIGEN_BLOCK_HOUSEHOLDER_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Householder/Householder.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2010 Benoit Jacob // Copyright (C) 2009 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_HOUSEHOLDER_H #define EIGEN_HOUSEHOLDER_H namespace Eigen { namespace internal { template struct decrement_size { enum { ret = n==Dynamic ? n : n-1 }; }; } /** Computes the elementary reflector H such that: * \f$ H *this = [ beta 0 ... 0]^T \f$ * where the transformation H is: * \f$ H = I - tau v v^*\f$ * and the vector v is: * \f$ v^T = [1 essential^T] \f$ * * The essential part of the vector \c v is stored in *this. * * On output: * \param tau the scaling factor of the Householder transformation * \param beta the result of H * \c *this * * \sa MatrixBase::makeHouseholder(), MatrixBase::applyHouseholderOnTheLeft(), * MatrixBase::applyHouseholderOnTheRight() */ template EIGEN_DEVICE_FUNC void MatrixBase::makeHouseholderInPlace(Scalar& tau, RealScalar& beta) { VectorBlock::ret> essentialPart(derived(), 1, size()-1); makeHouseholder(essentialPart, tau, beta); } /** Computes the elementary reflector H such that: * \f$ H *this = [ beta 0 ... 0]^T \f$ * where the transformation H is: * \f$ H = I - tau v v^*\f$ * and the vector v is: * \f$ v^T = [1 essential^T] \f$ * * On output: * \param essential the essential part of the vector \c v * \param tau the scaling factor of the Householder transformation * \param beta the result of H * \c *this * * \sa MatrixBase::makeHouseholderInPlace(), MatrixBase::applyHouseholderOnTheLeft(), * MatrixBase::applyHouseholderOnTheRight() */ template template EIGEN_DEVICE_FUNC void MatrixBase::makeHouseholder( EssentialPart& essential, Scalar& tau, RealScalar& beta) const { using std::sqrt; using numext::conj; EIGEN_STATIC_ASSERT_VECTOR_ONLY(EssentialPart) VectorBlock tail(derived(), 1, size()-1); RealScalar tailSqNorm = size()==1 ? RealScalar(0) : tail.squaredNorm(); Scalar c0 = coeff(0); const RealScalar tol = (std::numeric_limits::min)(); if(tailSqNorm <= tol && numext::abs2(numext::imag(c0))<=tol) { tau = RealScalar(0); beta = numext::real(c0); essential.setZero(); } else { beta = sqrt(numext::abs2(c0) + tailSqNorm); if (numext::real(c0)>=RealScalar(0)) beta = -beta; essential = tail / (c0 - beta); tau = conj((beta - c0) / beta); } } /** Apply the elementary reflector H given by * \f$ H = I - tau v v^*\f$ * with * \f$ v^T = [1 essential^T] \f$ * from the left to a vector or matrix. * * On input: * \param essential the essential part of the vector \c v * \param tau the scaling factor of the Householder transformation * \param workspace a pointer to working space with at least * this->cols() entries * * \sa MatrixBase::makeHouseholder(), MatrixBase::makeHouseholderInPlace(), * MatrixBase::applyHouseholderOnTheRight() */ template template EIGEN_DEVICE_FUNC void MatrixBase::applyHouseholderOnTheLeft( const EssentialPart& essential, const Scalar& tau, Scalar* workspace) { if(rows() == 1) { *this *= Scalar(1)-tau; } else if(tau!=Scalar(0)) { Map::type> tmp(workspace,cols()); Block bottom(derived(), 1, 0, rows()-1, cols()); tmp.noalias() = essential.adjoint() * bottom; tmp += this->row(0); this->row(0) -= tau * tmp; bottom.noalias() -= tau * essential * tmp; } } /** Apply the elementary reflector H given by * \f$ H = I - tau v v^*\f$ * with * \f$ v^T = [1 essential^T] \f$ * from the right to a vector or matrix. * * On input: * \param essential the essential part of the vector \c v * \param tau the scaling factor of the Householder transformation * \param workspace a pointer to working space with at least * this->rows() entries * * \sa MatrixBase::makeHouseholder(), MatrixBase::makeHouseholderInPlace(), * MatrixBase::applyHouseholderOnTheLeft() */ template template EIGEN_DEVICE_FUNC void MatrixBase::applyHouseholderOnTheRight( const EssentialPart& essential, const Scalar& tau, Scalar* workspace) { if(cols() == 1) { *this *= Scalar(1)-tau; } else if(tau!=Scalar(0)) { Map::type> tmp(workspace,rows()); Block right(derived(), 0, 1, rows(), cols()-1); tmp.noalias() = right * essential; tmp += this->col(0); this->col(0) -= tau * tmp; right.noalias() -= tau * tmp * essential.adjoint(); } } } // end namespace Eigen #endif // EIGEN_HOUSEHOLDER_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Householder/HouseholderSequence.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Gael Guennebaud // Copyright (C) 2010 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_HOUSEHOLDER_SEQUENCE_H #define EIGEN_HOUSEHOLDER_SEQUENCE_H namespace Eigen { /** \ingroup Householder_Module * \householder_module * \class HouseholderSequence * \brief Sequence of Householder reflections acting on subspaces with decreasing size * \tparam VectorsType type of matrix containing the Householder vectors * \tparam CoeffsType type of vector containing the Householder coefficients * \tparam Side either OnTheLeft (the default) or OnTheRight * * This class represents a product sequence of Householder reflections where the first Householder reflection * acts on the whole space, the second Householder reflection leaves the one-dimensional subspace spanned by * the first unit vector invariant, the third Householder reflection leaves the two-dimensional subspace * spanned by the first two unit vectors invariant, and so on up to the last reflection which leaves all but * one dimensions invariant and acts only on the last dimension. Such sequences of Householder reflections * are used in several algorithms to zero out certain parts of a matrix. Indeed, the methods * HessenbergDecomposition::matrixQ(), Tridiagonalization::matrixQ(), HouseholderQR::householderQ(), * and ColPivHouseholderQR::householderQ() all return a %HouseholderSequence. * * More precisely, the class %HouseholderSequence represents an \f$ n \times n \f$ matrix \f$ H \f$ of the * form \f$ H = \prod_{i=0}^{n-1} H_i \f$ where the i-th Householder reflection is \f$ H_i = I - h_i v_i * v_i^* \f$. The i-th Householder coefficient \f$ h_i \f$ is a scalar and the i-th Householder vector \f$ * v_i \f$ is a vector of the form * \f[ * v_i = [\underbrace{0, \ldots, 0}_{i-1\mbox{ zeros}}, 1, \underbrace{*, \ldots,*}_{n-i\mbox{ arbitrary entries}} ]. * \f] * The last \f$ n-i \f$ entries of \f$ v_i \f$ are called the essential part of the Householder vector. * * Typical usages are listed below, where H is a HouseholderSequence: * \code * A.applyOnTheRight(H); // A = A * H * A.applyOnTheLeft(H); // A = H * A * A.applyOnTheRight(H.adjoint()); // A = A * H^* * A.applyOnTheLeft(H.adjoint()); // A = H^* * A * MatrixXd Q = H; // conversion to a dense matrix * \endcode * In addition to the adjoint, you can also apply the inverse (=adjoint), the transpose, and the conjugate operators. * * See the documentation for HouseholderSequence(const VectorsType&, const CoeffsType&) for an example. * * \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight() */ namespace internal { template struct traits > { typedef typename VectorsType::Scalar Scalar; typedef typename VectorsType::StorageIndex StorageIndex; typedef typename VectorsType::StorageKind StorageKind; enum { RowsAtCompileTime = Side==OnTheLeft ? traits::RowsAtCompileTime : traits::ColsAtCompileTime, ColsAtCompileTime = RowsAtCompileTime, MaxRowsAtCompileTime = Side==OnTheLeft ? traits::MaxRowsAtCompileTime : traits::MaxColsAtCompileTime, MaxColsAtCompileTime = MaxRowsAtCompileTime, Flags = 0 }; }; struct HouseholderSequenceShape {}; template struct evaluator_traits > : public evaluator_traits_base > { typedef HouseholderSequenceShape Shape; }; template struct hseq_side_dependent_impl { typedef Block EssentialVectorType; typedef HouseholderSequence HouseholderSequenceType; static EIGEN_DEVICE_FUNC inline const EssentialVectorType essentialVector(const HouseholderSequenceType& h, Index k) { Index start = k+1+h.m_shift; return Block(h.m_vectors, start, k, h.rows()-start, 1); } }; template struct hseq_side_dependent_impl { typedef Transpose > EssentialVectorType; typedef HouseholderSequence HouseholderSequenceType; static inline const EssentialVectorType essentialVector(const HouseholderSequenceType& h, Index k) { Index start = k+1+h.m_shift; return Block(h.m_vectors, k, start, 1, h.rows()-start).transpose(); } }; template struct matrix_type_times_scalar_type { typedef typename ScalarBinaryOpTraits::ReturnType ResultScalar; typedef Matrix Type; }; } // end namespace internal template class HouseholderSequence : public EigenBase > { typedef typename internal::hseq_side_dependent_impl::EssentialVectorType EssentialVectorType; public: enum { RowsAtCompileTime = internal::traits::RowsAtCompileTime, ColsAtCompileTime = internal::traits::ColsAtCompileTime, MaxRowsAtCompileTime = internal::traits::MaxRowsAtCompileTime, MaxColsAtCompileTime = internal::traits::MaxColsAtCompileTime }; typedef typename internal::traits::Scalar Scalar; typedef HouseholderSequence< typename internal::conditional::IsComplex, typename internal::remove_all::type, VectorsType>::type, typename internal::conditional::IsComplex, typename internal::remove_all::type, CoeffsType>::type, Side > ConjugateReturnType; typedef HouseholderSequence< VectorsType, typename internal::conditional::IsComplex, typename internal::remove_all::type, CoeffsType>::type, Side > AdjointReturnType; typedef HouseholderSequence< typename internal::conditional::IsComplex, typename internal::remove_all::type, VectorsType>::type, CoeffsType, Side > TransposeReturnType; typedef HouseholderSequence< typename internal::add_const::type, typename internal::add_const::type, Side > ConstHouseholderSequence; /** \brief Constructor. * \param[in] v %Matrix containing the essential parts of the Householder vectors * \param[in] h Vector containing the Householder coefficients * * Constructs the Householder sequence with coefficients given by \p h and vectors given by \p v. The * i-th Householder coefficient \f$ h_i \f$ is given by \p h(i) and the essential part of the i-th * Householder vector \f$ v_i \f$ is given by \p v(k,i) with \p k > \p i (the subdiagonal part of the * i-th column). If \p v has fewer columns than rows, then the Householder sequence contains as many * Householder reflections as there are columns. * * \note The %HouseholderSequence object stores \p v and \p h by reference. * * Example: \include HouseholderSequence_HouseholderSequence.cpp * Output: \verbinclude HouseholderSequence_HouseholderSequence.out * * \sa setLength(), setShift() */ EIGEN_DEVICE_FUNC HouseholderSequence(const VectorsType& v, const CoeffsType& h) : m_vectors(v), m_coeffs(h), m_reverse(false), m_length(v.diagonalSize()), m_shift(0) { } /** \brief Copy constructor. */ EIGEN_DEVICE_FUNC HouseholderSequence(const HouseholderSequence& other) : m_vectors(other.m_vectors), m_coeffs(other.m_coeffs), m_reverse(other.m_reverse), m_length(other.m_length), m_shift(other.m_shift) { } /** \brief Number of rows of transformation viewed as a matrix. * \returns Number of rows * \details This equals the dimension of the space that the transformation acts on. */ EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return Side==OnTheLeft ? m_vectors.rows() : m_vectors.cols(); } /** \brief Number of columns of transformation viewed as a matrix. * \returns Number of columns * \details This equals the dimension of the space that the transformation acts on. */ EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return rows(); } /** \brief Essential part of a Householder vector. * \param[in] k Index of Householder reflection * \returns Vector containing non-trivial entries of k-th Householder vector * * This function returns the essential part of the Householder vector \f$ v_i \f$. This is a vector of * length \f$ n-i \f$ containing the last \f$ n-i \f$ entries of the vector * \f[ * v_i = [\underbrace{0, \ldots, 0}_{i-1\mbox{ zeros}}, 1, \underbrace{*, \ldots,*}_{n-i\mbox{ arbitrary entries}} ]. * \f] * The index \f$ i \f$ equals \p k + shift(), corresponding to the k-th column of the matrix \p v * passed to the constructor. * * \sa setShift(), shift() */ EIGEN_DEVICE_FUNC const EssentialVectorType essentialVector(Index k) const { eigen_assert(k >= 0 && k < m_length); return internal::hseq_side_dependent_impl::essentialVector(*this, k); } /** \brief %Transpose of the Householder sequence. */ TransposeReturnType transpose() const { return TransposeReturnType(m_vectors.conjugate(), m_coeffs) .setReverseFlag(!m_reverse) .setLength(m_length) .setShift(m_shift); } /** \brief Complex conjugate of the Householder sequence. */ ConjugateReturnType conjugate() const { return ConjugateReturnType(m_vectors.conjugate(), m_coeffs.conjugate()) .setReverseFlag(m_reverse) .setLength(m_length) .setShift(m_shift); } /** \returns an expression of the complex conjugate of \c *this if Cond==true, * returns \c *this otherwise. */ template EIGEN_DEVICE_FUNC inline typename internal::conditional::type conjugateIf() const { typedef typename internal::conditional::type ReturnType; return ReturnType(m_vectors.template conjugateIf(), m_coeffs.template conjugateIf()); } /** \brief Adjoint (conjugate transpose) of the Householder sequence. */ AdjointReturnType adjoint() const { return AdjointReturnType(m_vectors, m_coeffs.conjugate()) .setReverseFlag(!m_reverse) .setLength(m_length) .setShift(m_shift); } /** \brief Inverse of the Householder sequence (equals the adjoint). */ AdjointReturnType inverse() const { return adjoint(); } /** \internal */ template inline EIGEN_DEVICE_FUNC void evalTo(DestType& dst) const { Matrix workspace(rows()); evalTo(dst, workspace); } /** \internal */ template EIGEN_DEVICE_FUNC void evalTo(Dest& dst, Workspace& workspace) const { workspace.resize(rows()); Index vecs = m_length; if(internal::is_same_dense(dst,m_vectors)) { // in-place dst.diagonal().setOnes(); dst.template triangularView().setZero(); for(Index k = vecs-1; k >= 0; --k) { Index cornerSize = rows() - k - m_shift; if(m_reverse) dst.bottomRightCorner(cornerSize, cornerSize) .applyHouseholderOnTheRight(essentialVector(k), m_coeffs.coeff(k), workspace.data()); else dst.bottomRightCorner(cornerSize, cornerSize) .applyHouseholderOnTheLeft(essentialVector(k), m_coeffs.coeff(k), workspace.data()); // clear the off diagonal vector dst.col(k).tail(rows()-k-1).setZero(); } // clear the remaining columns if needed for(Index k = 0; kBlockSize) { dst.setIdentity(rows(), rows()); if(m_reverse) applyThisOnTheLeft(dst,workspace,true); else applyThisOnTheLeft(dst,workspace,true); } else { dst.setIdentity(rows(), rows()); for(Index k = vecs-1; k >= 0; --k) { Index cornerSize = rows() - k - m_shift; if(m_reverse) dst.bottomRightCorner(cornerSize, cornerSize) .applyHouseholderOnTheRight(essentialVector(k), m_coeffs.coeff(k), workspace.data()); else dst.bottomRightCorner(cornerSize, cornerSize) .applyHouseholderOnTheLeft(essentialVector(k), m_coeffs.coeff(k), workspace.data()); } } } /** \internal */ template inline void applyThisOnTheRight(Dest& dst) const { Matrix workspace(dst.rows()); applyThisOnTheRight(dst, workspace); } /** \internal */ template inline void applyThisOnTheRight(Dest& dst, Workspace& workspace) const { workspace.resize(dst.rows()); for(Index k = 0; k < m_length; ++k) { Index actual_k = m_reverse ? m_length-k-1 : k; dst.rightCols(rows()-m_shift-actual_k) .applyHouseholderOnTheRight(essentialVector(actual_k), m_coeffs.coeff(actual_k), workspace.data()); } } /** \internal */ template inline void applyThisOnTheLeft(Dest& dst, bool inputIsIdentity = false) const { Matrix workspace; applyThisOnTheLeft(dst, workspace, inputIsIdentity); } /** \internal */ template inline void applyThisOnTheLeft(Dest& dst, Workspace& workspace, bool inputIsIdentity = false) const { if(inputIsIdentity && m_reverse) inputIsIdentity = false; // if the entries are large enough, then apply the reflectors by block if(m_length>=BlockSize && dst.cols()>1) { // Make sure we have at least 2 useful blocks, otherwise it is point-less: Index blockSize = m_length::type,Dynamic,Dynamic> SubVectorsType; SubVectorsType sub_vecs1(m_vectors.const_cast_derived(), Side==OnTheRight ? k : start, Side==OnTheRight ? start : k, Side==OnTheRight ? bs : m_vectors.rows()-start, Side==OnTheRight ? m_vectors.cols()-start : bs); typename internal::conditional, SubVectorsType&>::type sub_vecs(sub_vecs1); Index dstStart = dst.rows()-rows()+m_shift+k; Index dstRows = rows()-m_shift-k; Block sub_dst(dst, dstStart, inputIsIdentity ? dstStart : 0, dstRows, inputIsIdentity ? dstRows : dst.cols()); apply_block_householder_on_the_left(sub_dst, sub_vecs, m_coeffs.segment(k, bs), !m_reverse); } } else { workspace.resize(dst.cols()); for(Index k = 0; k < m_length; ++k) { Index actual_k = m_reverse ? k : m_length-k-1; Index dstStart = rows()-m_shift-actual_k; dst.bottomRightCorner(dstStart, inputIsIdentity ? dstStart : dst.cols()) .applyHouseholderOnTheLeft(essentialVector(actual_k), m_coeffs.coeff(actual_k), workspace.data()); } } } /** \brief Computes the product of a Householder sequence with a matrix. * \param[in] other %Matrix being multiplied. * \returns Expression object representing the product. * * This function computes \f$ HM \f$ where \f$ H \f$ is the Householder sequence represented by \p *this * and \f$ M \f$ is the matrix \p other. */ template typename internal::matrix_type_times_scalar_type::Type operator*(const MatrixBase& other) const { typename internal::matrix_type_times_scalar_type::Type res(other.template cast::ResultScalar>()); applyThisOnTheLeft(res, internal::is_identity::value && res.rows()==res.cols()); return res; } template friend struct internal::hseq_side_dependent_impl; /** \brief Sets the length of the Householder sequence. * \param [in] length New value for the length. * * By default, the length \f$ n \f$ of the Householder sequence \f$ H = H_0 H_1 \ldots H_{n-1} \f$ is set * to the number of columns of the matrix \p v passed to the constructor, or the number of rows if that * is smaller. After this function is called, the length equals \p length. * * \sa length() */ EIGEN_DEVICE_FUNC HouseholderSequence& setLength(Index length) { m_length = length; return *this; } /** \brief Sets the shift of the Householder sequence. * \param [in] shift New value for the shift. * * By default, a %HouseholderSequence object represents \f$ H = H_0 H_1 \ldots H_{n-1} \f$ and the i-th * column of the matrix \p v passed to the constructor corresponds to the i-th Householder * reflection. After this function is called, the object represents \f$ H = H_{\mathrm{shift}} * H_{\mathrm{shift}+1} \ldots H_{n-1} \f$ and the i-th column of \p v corresponds to the (shift+i)-th * Householder reflection. * * \sa shift() */ EIGEN_DEVICE_FUNC HouseholderSequence& setShift(Index shift) { m_shift = shift; return *this; } EIGEN_DEVICE_FUNC Index length() const { return m_length; } /**< \brief Returns the length of the Householder sequence. */ EIGEN_DEVICE_FUNC Index shift() const { return m_shift; } /**< \brief Returns the shift of the Householder sequence. */ /* Necessary for .adjoint() and .conjugate() */ template friend class HouseholderSequence; protected: /** \internal * \brief Sets the reverse flag. * \param [in] reverse New value of the reverse flag. * * By default, the reverse flag is not set. If the reverse flag is set, then this object represents * \f$ H^r = H_{n-1} \ldots H_1 H_0 \f$ instead of \f$ H = H_0 H_1 \ldots H_{n-1} \f$. * \note For real valued HouseholderSequence this is equivalent to transposing \f$ H \f$. * * \sa reverseFlag(), transpose(), adjoint() */ HouseholderSequence& setReverseFlag(bool reverse) { m_reverse = reverse; return *this; } bool reverseFlag() const { return m_reverse; } /**< \internal \brief Returns the reverse flag. */ typename VectorsType::Nested m_vectors; typename CoeffsType::Nested m_coeffs; bool m_reverse; Index m_length; Index m_shift; enum { BlockSize = 48 }; }; /** \brief Computes the product of a matrix with a Householder sequence. * \param[in] other %Matrix being multiplied. * \param[in] h %HouseholderSequence being multiplied. * \returns Expression object representing the product. * * This function computes \f$ MH \f$ where \f$ M \f$ is the matrix \p other and \f$ H \f$ is the * Householder sequence represented by \p h. */ template typename internal::matrix_type_times_scalar_type::Type operator*(const MatrixBase& other, const HouseholderSequence& h) { typename internal::matrix_type_times_scalar_type::Type res(other.template cast::ResultScalar>()); h.applyThisOnTheRight(res); return res; } /** \ingroup Householder_Module \householder_module * \brief Convenience function for constructing a Householder sequence. * \returns A HouseholderSequence constructed from the specified arguments. */ template HouseholderSequence householderSequence(const VectorsType& v, const CoeffsType& h) { return HouseholderSequence(v, h); } /** \ingroup Householder_Module \householder_module * \brief Convenience function for constructing a Householder sequence. * \returns A HouseholderSequence constructed from the specified arguments. * \details This function differs from householderSequence() in that the template argument \p OnTheSide of * the constructed HouseholderSequence is set to OnTheRight, instead of the default OnTheLeft. */ template HouseholderSequence rightHouseholderSequence(const VectorsType& v, const CoeffsType& h) { return HouseholderSequence(v, h); } } // end namespace Eigen #endif // EIGEN_HOUSEHOLDER_SEQUENCE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2011-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_BASIC_PRECONDITIONERS_H #define EIGEN_BASIC_PRECONDITIONERS_H namespace Eigen { /** \ingroup IterativeLinearSolvers_Module * \brief A preconditioner based on the digonal entries * * This class allows to approximately solve for A.x = b problems assuming A is a diagonal matrix. * In other words, this preconditioner neglects all off diagonal entries and, in Eigen's language, solves for: \code A.diagonal().asDiagonal() . x = b \endcode * * \tparam Scalar_ the type of the scalar. * * \implsparsesolverconcept * * This preconditioner is suitable for both selfadjoint and general problems. * The diagonal entries are pre-inverted and stored into a dense vector. * * \note A variant that has yet to be implemented would attempt to preserve the norm of each column. * * \sa class LeastSquareDiagonalPreconditioner, class ConjugateGradient */ template class DiagonalPreconditioner { typedef Scalar_ Scalar; typedef Matrix Vector; public: typedef typename Vector::StorageIndex StorageIndex; enum { ColsAtCompileTime = Dynamic, MaxColsAtCompileTime = Dynamic }; DiagonalPreconditioner() : m_isInitialized(false) {} template explicit DiagonalPreconditioner(const MatType& mat) : m_invdiag(mat.cols()) { compute(mat); } EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_invdiag.size(); } EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_invdiag.size(); } template DiagonalPreconditioner& analyzePattern(const MatType& ) { return *this; } template DiagonalPreconditioner& factorize(const MatType& mat) { m_invdiag.resize(mat.cols()); for(int j=0; j DiagonalPreconditioner& compute(const MatType& mat) { return factorize(mat); } /** \internal */ template void _solve_impl(const Rhs& b, Dest& x) const { x = m_invdiag.array() * b.array() ; } template inline const Solve solve(const MatrixBase& b) const { eigen_assert(m_isInitialized && "DiagonalPreconditioner is not initialized."); eigen_assert(m_invdiag.size()==b.rows() && "DiagonalPreconditioner::solve(): invalid number of rows of the right hand side matrix b"); return Solve(*this, b.derived()); } ComputationInfo info() { return Success; } protected: Vector m_invdiag; bool m_isInitialized; }; /** \ingroup IterativeLinearSolvers_Module * \brief Jacobi preconditioner for LeastSquaresConjugateGradient * * This class allows to approximately solve for A' A x = A' b problems assuming A' A is a diagonal matrix. * In other words, this preconditioner neglects all off diagonal entries and, in Eigen's language, solves for: \code (A.adjoint() * A).diagonal().asDiagonal() * x = b \endcode * * \tparam Scalar_ the type of the scalar. * * \implsparsesolverconcept * * The diagonal entries are pre-inverted and stored into a dense vector. * * \sa class LeastSquaresConjugateGradient, class DiagonalPreconditioner */ template class LeastSquareDiagonalPreconditioner : public DiagonalPreconditioner { typedef Scalar_ Scalar; typedef typename NumTraits::Real RealScalar; typedef DiagonalPreconditioner Base; using Base::m_invdiag; public: LeastSquareDiagonalPreconditioner() : Base() {} template explicit LeastSquareDiagonalPreconditioner(const MatType& mat) : Base() { compute(mat); } template LeastSquareDiagonalPreconditioner& analyzePattern(const MatType& ) { return *this; } template LeastSquareDiagonalPreconditioner& factorize(const MatType& mat) { // Compute the inverse squared-norm of each column of mat m_invdiag.resize(mat.cols()); if(MatType::IsRowMajor) { m_invdiag.setZero(); for(Index j=0; jRealScalar(0)) m_invdiag(j) = RealScalar(1)/numext::real(m_invdiag(j)); } else { for(Index j=0; jRealScalar(0)) m_invdiag(j) = RealScalar(1)/sum; else m_invdiag(j) = RealScalar(1); } } Base::m_isInitialized = true; return *this; } template LeastSquareDiagonalPreconditioner& compute(const MatType& mat) { return factorize(mat); } ComputationInfo info() { return Success; } protected: }; /** \ingroup IterativeLinearSolvers_Module * \brief A naive preconditioner which approximates any matrix as the identity matrix * * \implsparsesolverconcept * * \sa class DiagonalPreconditioner */ class IdentityPreconditioner { public: IdentityPreconditioner() {} template explicit IdentityPreconditioner(const MatrixType& ) {} template IdentityPreconditioner& analyzePattern(const MatrixType& ) { return *this; } template IdentityPreconditioner& factorize(const MatrixType& ) { return *this; } template IdentityPreconditioner& compute(const MatrixType& ) { return *this; } template inline const Rhs& solve(const Rhs& b) const { return b; } ComputationInfo info() { return Success; } }; } // end namespace Eigen #endif // EIGEN_BASIC_PRECONDITIONERS_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2011-2014 Gael Guennebaud // Copyright (C) 2012 Désiré Nuentsa-Wakam // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_BICGSTAB_H #define EIGEN_BICGSTAB_H namespace Eigen { namespace internal { /** \internal Low-level bi conjugate gradient stabilized algorithm * \param mat The matrix A * \param rhs The right hand side vector b * \param x On input and initial solution, on output the computed solution. * \param precond A preconditioner being able to efficiently solve for an * approximation of Ax=b (regardless of b) * \param iters On input the max number of iteration, on output the number of performed iterations. * \param tol_error On input the tolerance error, on output an estimation of the relative error. * \return false in the case of numerical issue, for example a break down of BiCGSTAB. */ template bool bicgstab(const MatrixType& mat, const Rhs& rhs, Dest& x, const Preconditioner& precond, Index& iters, typename Dest::RealScalar& tol_error) { using std::sqrt; using std::abs; typedef typename Dest::RealScalar RealScalar; typedef typename Dest::Scalar Scalar; typedef Matrix VectorType; RealScalar tol = tol_error; Index maxIters = iters; Index n = mat.cols(); VectorType r = rhs - mat * x; VectorType r0 = r; RealScalar r0_sqnorm = r0.squaredNorm(); RealScalar rhs_sqnorm = rhs.squaredNorm(); if(rhs_sqnorm == 0) { x.setZero(); return true; } Scalar rho = 1; Scalar alpha = 1; Scalar w = 1; VectorType v = VectorType::Zero(n), p = VectorType::Zero(n); VectorType y(n), z(n); VectorType kt(n), ks(n); VectorType s(n), t(n); RealScalar tol2 = tol*tol*rhs_sqnorm; RealScalar eps2 = NumTraits::epsilon()*NumTraits::epsilon(); Index i = 0; Index restarts = 0; while ( r.squaredNorm() > tol2 && iRealScalar(0)) w = t.dot(s) / tmp; else w = Scalar(0); x += alpha * y + w * z; r = s - w * t; ++i; } tol_error = sqrt(r.squaredNorm()/rhs_sqnorm); iters = i; return true; } } template< typename MatrixType_, typename Preconditioner_ = DiagonalPreconditioner > class BiCGSTAB; namespace internal { template< typename MatrixType_, typename Preconditioner_> struct traits > { typedef MatrixType_ MatrixType; typedef Preconditioner_ Preconditioner; }; } /** \ingroup IterativeLinearSolvers_Module * \brief A bi conjugate gradient stabilized solver for sparse square problems * * This class allows to solve for A.x = b sparse linear problems using a bi conjugate gradient * stabilized algorithm. The vectors x and b can be either dense or sparse. * * \tparam MatrixType_ the type of the sparse matrix A, can be a dense or a sparse matrix. * \tparam Preconditioner_ the type of the preconditioner. Default is DiagonalPreconditioner * * \implsparsesolverconcept * * The maximal number of iterations and tolerance value can be controlled via the setMaxIterations() * and setTolerance() methods. The defaults are the size of the problem for the maximal number of iterations * and NumTraits::epsilon() for the tolerance. * * The tolerance corresponds to the relative residual error: |Ax-b|/|b| * * \b Performance: when using sparse matrices, best performance is achied for a row-major sparse matrix format. * Moreover, in this case multi-threading can be exploited if the user code is compiled with OpenMP enabled. * See \ref TopicMultiThreading for details. * * This class can be used as the direct solver classes. Here is a typical usage example: * \include BiCGSTAB_simple.cpp * * By default the iterations start with x=0 as an initial guess of the solution. * One can control the start using the solveWithGuess() method. * * BiCGSTAB can also be used in a matrix-free context, see the following \link MatrixfreeSolverExample example \endlink. * * \sa class SimplicialCholesky, DiagonalPreconditioner, IdentityPreconditioner */ template< typename MatrixType_, typename Preconditioner_> class BiCGSTAB : public IterativeSolverBase > { typedef IterativeSolverBase Base; using Base::matrix; using Base::m_error; using Base::m_iterations; using Base::m_info; using Base::m_isInitialized; public: typedef MatrixType_ MatrixType; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef Preconditioner_ Preconditioner; public: /** Default constructor. */ BiCGSTAB() : Base() {} /** Initialize the solver with matrix \a A for further \c Ax=b solving. * * This constructor is a shortcut for the default constructor followed * by a call to compute(). * * \warning this class stores a reference to the matrix A as well as some * precomputed values that depend on it. Therefore, if \a A is changed * this class becomes invalid. Call compute() to update it with the new * matrix A, or modify a copy of A. */ template explicit BiCGSTAB(const EigenBase& A) : Base(A.derived()) {} ~BiCGSTAB() {} /** \internal */ template void _solve_vector_with_guess_impl(const Rhs& b, Dest& x) const { m_iterations = Base::maxIterations(); m_error = Base::m_tolerance; bool ret = internal::bicgstab(matrix(), b, x, Base::m_preconditioner, m_iterations, m_error); m_info = (!ret) ? NumericalIssue : m_error <= Base::m_tolerance ? Success : NoConvergence; } protected: }; } // end namespace Eigen #endif // EIGEN_BICGSTAB_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2011-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_CONJUGATE_GRADIENT_H #define EIGEN_CONJUGATE_GRADIENT_H namespace Eigen { namespace internal { /** \internal Low-level conjugate gradient algorithm * \param mat The matrix A * \param rhs The right hand side vector b * \param x On input and initial solution, on output the computed solution. * \param precond A preconditioner being able to efficiently solve for an * approximation of Ax=b (regardless of b) * \param iters On input the max number of iteration, on output the number of performed iterations. * \param tol_error On input the tolerance error, on output an estimation of the relative error. */ template EIGEN_DONT_INLINE void conjugate_gradient(const MatrixType& mat, const Rhs& rhs, Dest& x, const Preconditioner& precond, Index& iters, typename Dest::RealScalar& tol_error) { using std::sqrt; using std::abs; typedef typename Dest::RealScalar RealScalar; typedef typename Dest::Scalar Scalar; typedef Matrix VectorType; RealScalar tol = tol_error; Index maxIters = iters; Index n = mat.cols(); VectorType residual = rhs - mat * x; //initial residual RealScalar rhsNorm2 = rhs.squaredNorm(); if(rhsNorm2 == 0) { x.setZero(); iters = 0; tol_error = 0; return; } const RealScalar considerAsZero = (std::numeric_limits::min)(); RealScalar threshold = numext::maxi(RealScalar(tol*tol*rhsNorm2),considerAsZero); RealScalar residualNorm2 = residual.squaredNorm(); if (residualNorm2 < threshold) { iters = 0; tol_error = sqrt(residualNorm2 / rhsNorm2); return; } VectorType p(n); p = precond.solve(residual); // initial search direction VectorType z(n), tmp(n); RealScalar absNew = numext::real(residual.dot(p)); // the square of the absolute value of r scaled by invM Index i = 0; while(i < maxIters) { tmp.noalias() = mat * p; // the bottleneck of the algorithm Scalar alpha = absNew / p.dot(tmp); // the amount we travel on dir x += alpha * p; // update solution residual -= alpha * tmp; // update residual residualNorm2 = residual.squaredNorm(); if(residualNorm2 < threshold) break; z = precond.solve(residual); // approximately solve for "A z = residual" RealScalar absOld = absNew; absNew = numext::real(residual.dot(z)); // update the absolute value of r RealScalar beta = absNew / absOld; // calculate the Gram-Schmidt value used to create the new search direction p = z + beta * p; // update search direction i++; } tol_error = sqrt(residualNorm2 / rhsNorm2); iters = i; } } template< typename MatrixType_, int UpLo_=Lower, typename Preconditioner_ = DiagonalPreconditioner > class ConjugateGradient; namespace internal { template< typename MatrixType_, int UpLo_, typename Preconditioner_> struct traits > { typedef MatrixType_ MatrixType; typedef Preconditioner_ Preconditioner; }; } /** \ingroup IterativeLinearSolvers_Module * \brief A conjugate gradient solver for sparse (or dense) self-adjoint problems * * This class allows to solve for A.x = b linear problems using an iterative conjugate gradient algorithm. * The matrix A must be selfadjoint. The matrix A and the vectors x and b can be either dense or sparse. * * \tparam MatrixType_ the type of the matrix A, can be a dense or a sparse matrix. * \tparam UpLo_ the triangular part that will be used for the computations. It can be Lower, * \c Upper, or \c Lower|Upper in which the full matrix entries will be considered. * Default is \c Lower, best performance is \c Lower|Upper. * \tparam Preconditioner_ the type of the preconditioner. Default is DiagonalPreconditioner * * \implsparsesolverconcept * * The maximal number of iterations and tolerance value can be controlled via the setMaxIterations() * and setTolerance() methods. The defaults are the size of the problem for the maximal number of iterations * and NumTraits::epsilon() for the tolerance. * * The tolerance corresponds to the relative residual error: |Ax-b|/|b| * * \b Performance: Even though the default value of \c UpLo_ is \c Lower, significantly higher performance is * achieved when using a complete matrix and \b Lower|Upper as the \a UpLo_ template parameter. Moreover, in this * case multi-threading can be exploited if the user code is compiled with OpenMP enabled. * See \ref TopicMultiThreading for details. * * This class can be used as the direct solver classes. Here is a typical usage example: \code int n = 10000; VectorXd x(n), b(n); SparseMatrix A(n,n); // fill A and b ConjugateGradient, Lower|Upper> cg; cg.compute(A); x = cg.solve(b); std::cout << "#iterations: " << cg.iterations() << std::endl; std::cout << "estimated error: " << cg.error() << std::endl; // update b, and solve again x = cg.solve(b); \endcode * * By default the iterations start with x=0 as an initial guess of the solution. * One can control the start using the solveWithGuess() method. * * ConjugateGradient can also be used in a matrix-free context, see the following \link MatrixfreeSolverExample example \endlink. * * \sa class LeastSquaresConjugateGradient, class SimplicialCholesky, DiagonalPreconditioner, IdentityPreconditioner */ template< typename MatrixType_, int UpLo_, typename Preconditioner_> class ConjugateGradient : public IterativeSolverBase > { typedef IterativeSolverBase Base; using Base::matrix; using Base::m_error; using Base::m_iterations; using Base::m_info; using Base::m_isInitialized; public: typedef MatrixType_ MatrixType; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef Preconditioner_ Preconditioner; enum { UpLo = UpLo_ }; public: /** Default constructor. */ ConjugateGradient() : Base() {} /** Initialize the solver with matrix \a A for further \c Ax=b solving. * * This constructor is a shortcut for the default constructor followed * by a call to compute(). * * \warning this class stores a reference to the matrix A as well as some * precomputed values that depend on it. Therefore, if \a A is changed * this class becomes invalid. Call compute() to update it with the new * matrix A, or modify a copy of A. */ template explicit ConjugateGradient(const EigenBase& A) : Base(A.derived()) {} ~ConjugateGradient() {} /** \internal */ template void _solve_vector_with_guess_impl(const Rhs& b, Dest& x) const { typedef typename Base::MatrixWrapper MatrixWrapper; typedef typename Base::ActualMatrixType ActualMatrixType; enum { TransposeInput = (!MatrixWrapper::MatrixFree) && (UpLo==(Lower|Upper)) && (!MatrixType::IsRowMajor) && (!NumTraits::IsComplex) }; typedef typename internal::conditional, ActualMatrixType const&>::type RowMajorWrapper; EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(MatrixWrapper::MatrixFree,UpLo==(Lower|Upper)),MATRIX_FREE_CONJUGATE_GRADIENT_IS_COMPATIBLE_WITH_UPPER_UNION_LOWER_MODE_ONLY); typedef typename internal::conditional::Type >::type SelfAdjointWrapper; m_iterations = Base::maxIterations(); m_error = Base::m_tolerance; RowMajorWrapper row_mat(matrix()); internal::conjugate_gradient(SelfAdjointWrapper(row_mat), b, x, Base::m_preconditioner, m_iterations, m_error); m_info = m_error <= Base::m_tolerance ? Success : NoConvergence; } protected: }; } // end namespace Eigen #endif // EIGEN_CONJUGATE_GRADIENT_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // Copyright (C) 2015 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_INCOMPLETE_CHOlESKY_H #define EIGEN_INCOMPLETE_CHOlESKY_H #include #include namespace Eigen { /** * \brief Modified Incomplete Cholesky with dual threshold * * References : C-J. Lin and J. J. Moré, Incomplete Cholesky Factorizations with * Limited memory, SIAM J. Sci. Comput. 21(1), pp. 24-45, 1999 * * \tparam Scalar the scalar type of the input matrices * \tparam UpLo_ The triangular part that will be used for the computations. It can be Lower * or Upper. Default is Lower. * \tparam OrderingType_ The ordering method to use, either AMDOrdering<> or NaturalOrdering<>. Default is AMDOrdering, * unless EIGEN_MPL2_ONLY is defined, in which case the default is NaturalOrdering. * * \implsparsesolverconcept * * It performs the following incomplete factorization: \f$ S P A P' S \approx L L' \f$ * where L is a lower triangular factor, S is a diagonal scaling matrix, and P is a * fill-in reducing permutation as computed by the ordering method. * * \b Shifting \b strategy: Let \f$ B = S P A P' S \f$ be the scaled matrix on which the factorization is carried out, * and \f$ \beta \f$ be the minimum value of the diagonal. If \f$ \beta > 0 \f$ then, the factorization is directly performed * on the matrix B. Otherwise, the factorization is performed on the shifted matrix \f$ B + (\sigma+|\beta| I \f$ where * \f$ \sigma \f$ is the initial shift value as returned and set by setInitialShift() method. The default value is \f$ \sigma = 10^{-3} \f$. * If the factorization fails, then the shift in doubled until it succeed or a maximum of ten attempts. If it still fails, as returned by * the info() method, then you can either increase the initial shift, or better use another preconditioning technique. * */ template > class IncompleteCholesky : public SparseSolverBase > { protected: typedef SparseSolverBase > Base; using Base::m_isInitialized; public: typedef typename NumTraits::Real RealScalar; typedef OrderingType_ OrderingType; typedef typename OrderingType::PermutationType PermutationType; typedef typename PermutationType::StorageIndex StorageIndex; typedef SparseMatrix FactorType; typedef Matrix VectorSx; typedef Matrix VectorRx; typedef Matrix VectorIx; typedef std::vector > VectorList; enum { UpLo = UpLo_ }; enum { ColsAtCompileTime = Dynamic, MaxColsAtCompileTime = Dynamic }; public: /** Default constructor leaving the object in a partly non-initialized stage. * * You must call compute() or the pair analyzePattern()/factorize() to make it valid. * * \sa IncompleteCholesky(const MatrixType&) */ IncompleteCholesky() : m_initialShift(1e-3),m_analysisIsOk(false),m_factorizationIsOk(false) {} /** Constructor computing the incomplete factorization for the given matrix \a matrix. */ template IncompleteCholesky(const MatrixType& matrix) : m_initialShift(1e-3),m_analysisIsOk(false),m_factorizationIsOk(false) { compute(matrix); } /** \returns number of rows of the factored matrix */ EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_L.rows(); } /** \returns number of columns of the factored matrix */ EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_L.cols(); } /** \brief Reports whether previous computation was successful. * * It triggers an assertion if \c *this has not been initialized through the respective constructor, * or a call to compute() or analyzePattern(). * * \returns \c Success if computation was successful, * \c NumericalIssue if the matrix appears to be negative. */ ComputationInfo info() const { eigen_assert(m_isInitialized && "IncompleteCholesky is not initialized."); return m_info; } /** \brief Set the initial shift parameter \f$ \sigma \f$. */ void setInitialShift(RealScalar shift) { m_initialShift = shift; } /** \brief Computes the fill reducing permutation vector using the sparsity pattern of \a mat */ template void analyzePattern(const MatrixType& mat) { OrderingType ord; PermutationType pinv; ord(mat.template selfadjointView(), pinv); if(pinv.size()>0) m_perm = pinv.inverse(); else m_perm.resize(0); m_L.resize(mat.rows(), mat.cols()); m_analysisIsOk = true; m_isInitialized = true; m_info = Success; } /** \brief Performs the numerical factorization of the input matrix \a mat * * The method analyzePattern() or compute() must have been called beforehand * with a matrix having the same pattern. * * \sa compute(), analyzePattern() */ template void factorize(const MatrixType& mat); /** Computes or re-computes the incomplete Cholesky factorization of the input matrix \a mat * * It is a shortcut for a sequential call to the analyzePattern() and factorize() methods. * * \sa analyzePattern(), factorize() */ template void compute(const MatrixType& mat) { analyzePattern(mat); factorize(mat); } // internal template void _solve_impl(const Rhs& b, Dest& x) const { eigen_assert(m_factorizationIsOk && "factorize() should be called first"); if (m_perm.rows() == b.rows()) x = m_perm * b; else x = b; x = m_scale.asDiagonal() * x; x = m_L.template triangularView().solve(x); x = m_L.adjoint().template triangularView().solve(x); x = m_scale.asDiagonal() * x; if (m_perm.rows() == b.rows()) x = m_perm.inverse() * x; } /** \returns the sparse lower triangular factor L */ const FactorType& matrixL() const { eigen_assert("m_factorizationIsOk"); return m_L; } /** \returns a vector representing the scaling factor S */ const VectorRx& scalingS() const { eigen_assert("m_factorizationIsOk"); return m_scale; } /** \returns the fill-in reducing permutation P (can be empty for a natural ordering) */ const PermutationType& permutationP() const { eigen_assert("m_analysisIsOk"); return m_perm; } protected: FactorType m_L; // The lower part stored in CSC VectorRx m_scale; // The vector for scaling the matrix RealScalar m_initialShift; // The initial shift parameter bool m_analysisIsOk; bool m_factorizationIsOk; ComputationInfo m_info; PermutationType m_perm; private: inline void updateList(Ref colPtr, Ref rowIdx, Ref vals, const Index& col, const Index& jk, VectorIx& firstElt, VectorList& listCol); }; // Based on the following paper: // C-J. Lin and J. J. Moré, Incomplete Cholesky Factorizations with // Limited memory, SIAM J. Sci. Comput. 21(1), pp. 24-45, 1999 // http://ftp.mcs.anl.gov/pub/tech_reports/reports/P682.pdf template template void IncompleteCholesky::factorize(const MatrixType_& mat) { using std::sqrt; eigen_assert(m_analysisIsOk && "analyzePattern() should be called first"); // Dropping strategy : Keep only the p largest elements per column, where p is the number of elements in the column of the original matrix. Other strategies will be added // Apply the fill-reducing permutation computed in analyzePattern() if (m_perm.rows() == mat.rows() ) // To detect the null permutation { // The temporary is needed to make sure that the diagonal entry is properly sorted FactorType tmp(mat.rows(), mat.cols()); tmp = mat.template selfadjointView().twistedBy(m_perm); m_L.template selfadjointView() = tmp.template selfadjointView(); } else { m_L.template selfadjointView() = mat.template selfadjointView(); } Index n = m_L.cols(); Index nnz = m_L.nonZeros(); Map vals(m_L.valuePtr(), nnz); //values Map rowIdx(m_L.innerIndexPtr(), nnz); //Row indices Map colPtr( m_L.outerIndexPtr(), n+1); // Pointer to the beginning of each row VectorIx firstElt(n-1); // for each j, points to the next entry in vals that will be used in the factorization VectorList listCol(n); // listCol(j) is a linked list of columns to update column j VectorSx col_vals(n); // Store a nonzero values in each column VectorIx col_irow(n); // Row indices of nonzero elements in each column VectorIx col_pattern(n); col_pattern.fill(-1); StorageIndex col_nnz; // Computes the scaling factors m_scale.resize(n); m_scale.setZero(); for (Index j = 0; j < n; j++) for (Index k = colPtr[j]; k < colPtr[j+1]; k++) { m_scale(j) += numext::abs2(vals(k)); if(rowIdx[k]!=j) m_scale(rowIdx[k]) += numext::abs2(vals(k)); } m_scale = m_scale.cwiseSqrt().cwiseSqrt(); for (Index j = 0; j < n; ++j) if(m_scale(j)>(std::numeric_limits::min)()) m_scale(j) = RealScalar(1)/m_scale(j); else m_scale(j) = 1; // TODO disable scaling if not needed, i.e., if it is roughly uniform? (this will make solve() faster) // Scale and compute the shift for the matrix RealScalar mindiag = NumTraits::highest(); for (Index j = 0; j < n; j++) { for (Index k = colPtr[j]; k < colPtr[j+1]; k++) vals[k] *= (m_scale(j)*m_scale(rowIdx[k])); eigen_internal_assert(rowIdx[colPtr[j]]==j && "IncompleteCholesky: only the lower triangular part must be stored"); mindiag = numext::mini(numext::real(vals[colPtr[j]]), mindiag); } FactorType L_save = m_L; RealScalar shift = 0; if(mindiag <= RealScalar(0.)) shift = m_initialShift - mindiag; m_info = NumericalIssue; // Try to perform the incomplete factorization using the current shift int iter = 0; do { // Apply the shift to the diagonal elements of the matrix for (Index j = 0; j < n; j++) vals[colPtr[j]] += shift; // jki version of the Cholesky factorization Index j=0; for (; j < n; ++j) { // Left-looking factorization of the j-th column // First, load the j-th column into col_vals Scalar diag = vals[colPtr[j]]; // It is assumed that only the lower part is stored col_nnz = 0; for (Index i = colPtr[j] + 1; i < colPtr[j+1]; i++) { StorageIndex l = rowIdx[i]; col_vals(col_nnz) = vals[i]; col_irow(col_nnz) = l; col_pattern(l) = col_nnz; col_nnz++; } { typename std::list::iterator k; // Browse all previous columns that will update column j for(k = listCol[j].begin(); k != listCol[j].end(); k++) { Index jk = firstElt(*k); // First element to use in the column eigen_internal_assert(rowIdx[jk]==j); Scalar v_j_jk = numext::conj(vals[jk]); jk += 1; for (Index i = jk; i < colPtr[*k+1]; i++) { StorageIndex l = rowIdx[i]; if(col_pattern[l]<0) { col_vals(col_nnz) = vals[i] * v_j_jk; col_irow[col_nnz] = l; col_pattern(l) = col_nnz; col_nnz++; } else col_vals(col_pattern[l]) -= vals[i] * v_j_jk; } updateList(colPtr,rowIdx,vals, *k, jk, firstElt, listCol); } } // Scale the current column if(numext::real(diag) <= 0) { if(++iter>=10) return; // increase shift shift = numext::maxi(m_initialShift,RealScalar(2)*shift); // restore m_L, col_pattern, and listCol vals = Map(L_save.valuePtr(), nnz); rowIdx = Map(L_save.innerIndexPtr(), nnz); colPtr = Map(L_save.outerIndexPtr(), n+1); col_pattern.fill(-1); for(Index i=0; i cvals = col_vals.head(col_nnz); Ref cirow = col_irow.head(col_nnz); internal::QuickSplit(cvals,cirow, p); // Insert the largest p elements in the matrix Index cpt = 0; for (Index i = colPtr[j]+1; i < colPtr[j+1]; i++) { vals[i] = col_vals(cpt); rowIdx[i] = col_irow(cpt); // restore col_pattern: col_pattern(col_irow(cpt)) = -1; cpt++; } // Get the first smallest row index and put it after the diagonal element Index jk = colPtr(j)+1; updateList(colPtr,rowIdx,vals,j,jk,firstElt,listCol); } if(j==n) { m_factorizationIsOk = true; m_info = Success; } } while(m_info!=Success); } template inline void IncompleteCholesky::updateList(Ref colPtr, Ref rowIdx, Ref vals, const Index& col, const Index& jk, VectorIx& firstElt, VectorList& listCol) { if (jk < colPtr(col+1) ) { Index p = colPtr(col+1) - jk; Index minpos; rowIdx.segment(jk,p).minCoeff(&minpos); minpos += jk; if (rowIdx(minpos) != rowIdx(jk)) { //Swap std::swap(rowIdx(jk),rowIdx(minpos)); std::swap(vals(jk),vals(minpos)); } firstElt(col) = internal::convert_index(jk); listCol[rowIdx(jk)].push_back(internal::convert_index(col)); } } } // end namespace Eigen #endif ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // Copyright (C) 2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_INCOMPLETE_LUT_H #define EIGEN_INCOMPLETE_LUT_H namespace Eigen { namespace internal { /** \internal * Compute a quick-sort split of a vector * On output, the vector row is permuted such that its elements satisfy * abs(row(i)) >= abs(row(ncut)) if incut * \param row The vector of values * \param ind The array of index for the elements in @p row * \param ncut The number of largest elements to keep **/ template Index QuickSplit(VectorV &row, VectorI &ind, Index ncut) { typedef typename VectorV::RealScalar RealScalar; using std::swap; using std::abs; Index mid; Index n = row.size(); /* length of the vector */ Index first, last ; ncut--; /* to fit the zero-based indices */ first = 0; last = n-1; if (ncut < first || ncut > last ) return 0; do { mid = first; RealScalar abskey = abs(row(mid)); for (Index j = first + 1; j <= last; j++) { if ( abs(row(j)) > abskey) { ++mid; swap(row(mid), row(j)); swap(ind(mid), ind(j)); } } /* Interchange for the pivot element */ swap(row(mid), row(first)); swap(ind(mid), ind(first)); if (mid > ncut) last = mid - 1; else if (mid < ncut ) first = mid + 1; } while (mid != ncut ); return 0; /* mid is equal to ncut */ } }// end namespace internal /** \ingroup IterativeLinearSolvers_Module * \class IncompleteLUT * \brief Incomplete LU factorization with dual-threshold strategy * * \implsparsesolverconcept * * During the numerical factorization, two dropping rules are used : * 1) any element whose magnitude is less than some tolerance is dropped. * This tolerance is obtained by multiplying the input tolerance @p droptol * by the average magnitude of all the original elements in the current row. * 2) After the elimination of the row, only the @p fill largest elements in * the L part and the @p fill largest elements in the U part are kept * (in addition to the diagonal element ). Note that @p fill is computed from * the input parameter @p fillfactor which is used the ratio to control the fill_in * relatively to the initial number of nonzero elements. * * The two extreme cases are when @p droptol=0 (to keep all the @p fill*2 largest elements) * and when @p fill=n/2 with @p droptol being different to zero. * * References : Yousef Saad, ILUT: A dual threshold incomplete LU factorization, * Numerical Linear Algebra with Applications, 1(4), pp 387-402, 1994. * * NOTE : The following implementation is derived from the ILUT implementation * in the SPARSKIT package, Copyright (C) 2005, the Regents of the University of Minnesota * released under the terms of the GNU LGPL: * http://www-users.cs.umn.edu/~saad/software/SPARSKIT/README * However, Yousef Saad gave us permission to relicense his ILUT code to MPL2. * See the Eigen mailing list archive, thread: ILUT, date: July 8, 2012: * http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2012/07/msg00064.html * alternatively, on GMANE: * http://comments.gmane.org/gmane.comp.lib.eigen/3302 */ template class IncompleteLUT : public SparseSolverBase > { protected: typedef SparseSolverBase Base; using Base::m_isInitialized; public: typedef Scalar_ Scalar; typedef StorageIndex_ StorageIndex; typedef typename NumTraits::Real RealScalar; typedef Matrix Vector; typedef Matrix VectorI; typedef SparseMatrix FactorType; enum { ColsAtCompileTime = Dynamic, MaxColsAtCompileTime = Dynamic }; public: IncompleteLUT() : m_droptol(NumTraits::dummy_precision()), m_fillfactor(10), m_analysisIsOk(false), m_factorizationIsOk(false) {} template explicit IncompleteLUT(const MatrixType& mat, const RealScalar& droptol=NumTraits::dummy_precision(), int fillfactor = 10) : m_droptol(droptol),m_fillfactor(fillfactor), m_analysisIsOk(false),m_factorizationIsOk(false) { eigen_assert(fillfactor != 0); compute(mat); } EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_lu.rows(); } EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_lu.cols(); } /** \brief Reports whether previous computation was successful. * * \returns \c Success if computation was successful, * \c NumericalIssue if the matrix.appears to be negative. */ ComputationInfo info() const { eigen_assert(m_isInitialized && "IncompleteLUT is not initialized."); return m_info; } template void analyzePattern(const MatrixType& amat); template void factorize(const MatrixType& amat); /** * Compute an incomplete LU factorization with dual threshold on the matrix mat * No pivoting is done in this version * **/ template IncompleteLUT& compute(const MatrixType& amat) { analyzePattern(amat); factorize(amat); return *this; } void setDroptol(const RealScalar& droptol); void setFillfactor(int fillfactor); template void _solve_impl(const Rhs& b, Dest& x) const { x = m_Pinv * b; x = m_lu.template triangularView().solve(x); x = m_lu.template triangularView().solve(x); x = m_P * x; } protected: /** keeps off-diagonal entries; drops diagonal entries */ struct keep_diag { inline bool operator() (const Index& row, const Index& col, const Scalar&) const { return row!=col; } }; protected: FactorType m_lu; RealScalar m_droptol; int m_fillfactor; bool m_analysisIsOk; bool m_factorizationIsOk; ComputationInfo m_info; PermutationMatrix m_P; // Fill-reducing permutation PermutationMatrix m_Pinv; // Inverse permutation }; /** * Set control parameter droptol * \param droptol Drop any element whose magnitude is less than this tolerance **/ template void IncompleteLUT::setDroptol(const RealScalar& droptol) { this->m_droptol = droptol; } /** * Set control parameter fillfactor * \param fillfactor This is used to compute the number @p fill_in of largest elements to keep on each row. **/ template void IncompleteLUT::setFillfactor(int fillfactor) { this->m_fillfactor = fillfactor; } template template void IncompleteLUT::analyzePattern(const MatrixType_& amat) { // Compute the Fill-reducing permutation // Since ILUT does not perform any numerical pivoting, // it is highly preferable to keep the diagonal through symmetric permutations. // To this end, let's symmetrize the pattern and perform AMD on it. SparseMatrix mat1 = amat; SparseMatrix mat2 = amat.transpose(); // FIXME for a matrix with nearly symmetric pattern, mat2+mat1 is the appropriate choice. // on the other hand for a really non-symmetric pattern, mat2*mat1 should be preferred... SparseMatrix AtA = mat2 + mat1; AMDOrdering ordering; ordering(AtA,m_P); m_Pinv = m_P.inverse(); // cache the inverse permutation m_analysisIsOk = true; m_factorizationIsOk = false; m_isInitialized = true; } template template void IncompleteLUT::factorize(const MatrixType_& amat) { using std::sqrt; using std::swap; using std::abs; using internal::convert_index; eigen_assert((amat.rows() == amat.cols()) && "The factorization should be done on a square matrix"); Index n = amat.cols(); // Size of the matrix m_lu.resize(n,n); // Declare Working vectors and variables Vector u(n) ; // real values of the row -- maximum size is n -- VectorI ju(n); // column position of the values in u -- maximum size is n VectorI jr(n); // Indicate the position of the nonzero elements in the vector u -- A zero location is indicated by -1 // Apply the fill-reducing permutation eigen_assert(m_analysisIsOk && "You must first call analyzePattern()"); SparseMatrix mat; mat = amat.twistedBy(m_Pinv); // Initialization jr.fill(-1); ju.fill(0); u.fill(0); // number of largest elements to keep in each row: Index fill_in = (amat.nonZeros()*m_fillfactor)/n + 1; if (fill_in > n) fill_in = n; // number of largest nonzero elements to keep in the L and the U part of the current row: Index nnzL = fill_in/2; Index nnzU = nnzL; m_lu.reserve(n * (nnzL + nnzU + 1)); // global loop over the rows of the sparse matrix for (Index ii = 0; ii < n; ii++) { // 1 - copy the lower and the upper part of the row i of mat in the working vector u Index sizeu = 1; // number of nonzero elements in the upper part of the current row Index sizel = 0; // number of nonzero elements in the lower part of the current row ju(ii) = convert_index(ii); u(ii) = 0; jr(ii) = convert_index(ii); RealScalar rownorm = 0; typename FactorType::InnerIterator j_it(mat, ii); // Iterate through the current row ii for (; j_it; ++j_it) { Index k = j_it.index(); if (k < ii) { // copy the lower part ju(sizel) = convert_index(k); u(sizel) = j_it.value(); jr(k) = convert_index(sizel); ++sizel; } else if (k == ii) { u(ii) = j_it.value(); } else { // copy the upper part Index jpos = ii + sizeu; ju(jpos) = convert_index(k); u(jpos) = j_it.value(); jr(k) = convert_index(jpos); ++sizeu; } rownorm += numext::abs2(j_it.value()); } // 2 - detect possible zero row if(rownorm==0) { m_info = NumericalIssue; return; } // Take the 2-norm of the current row as a relative tolerance rownorm = sqrt(rownorm); // 3 - eliminate the previous nonzero rows Index jj = 0; Index len = 0; while (jj < sizel) { // In order to eliminate in the correct order, // we must select first the smallest column index among ju(jj:sizel) Index k; Index minrow = ju.segment(jj,sizel-jj).minCoeff(&k); // k is relative to the segment k += jj; if (minrow != ju(jj)) { // swap the two locations Index j = ju(jj); swap(ju(jj), ju(k)); jr(minrow) = convert_index(jj); jr(j) = convert_index(k); swap(u(jj), u(k)); } // Reset this location jr(minrow) = -1; // Start elimination typename FactorType::InnerIterator ki_it(m_lu, minrow); while (ki_it && ki_it.index() < minrow) ++ki_it; eigen_internal_assert(ki_it && ki_it.col()==minrow); Scalar fact = u(jj) / ki_it.value(); // drop too small elements if(abs(fact) <= m_droptol) { jj++; continue; } // linear combination of the current row ii and the row minrow ++ki_it; for (; ki_it; ++ki_it) { Scalar prod = fact * ki_it.value(); Index j = ki_it.index(); Index jpos = jr(j); if (jpos == -1) // fill-in element { Index newpos; if (j >= ii) // dealing with the upper part { newpos = ii + sizeu; sizeu++; eigen_internal_assert(sizeu<=n); } else // dealing with the lower part { newpos = sizel; sizel++; eigen_internal_assert(sizel<=ii); } ju(newpos) = convert_index(j); u(newpos) = -prod; jr(j) = convert_index(newpos); } else u(jpos) -= prod; } // store the pivot element u(len) = fact; ju(len) = convert_index(minrow); ++len; jj++; } // end of the elimination on the row ii // reset the upper part of the pointer jr to zero for(Index k = 0; k m_droptol * rownorm ) { ++len; u(ii + len) = u(ii + k); ju(ii + len) = ju(ii + k); } } sizeu = len + 1; // +1 to take into account the diagonal element len = (std::min)(sizeu, nnzU); typename Vector::SegmentReturnType uu(u.segment(ii+1, sizeu-1)); typename VectorI::SegmentReturnType juu(ju.segment(ii+1, sizeu-1)); internal::QuickSplit(uu, juu, len); // store the largest elements of the U part for(Index k = ii + 1; k < ii + len; k++) m_lu.insertBackByOuterInnerUnordered(ii,ju(k)) = u(k); } m_lu.finalize(); m_lu.makeCompressed(); m_factorizationIsOk = true; m_info = Success; } } // end namespace Eigen #endif // EIGEN_INCOMPLETE_LUT_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2011-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_ITERATIVE_SOLVER_BASE_H #define EIGEN_ITERATIVE_SOLVER_BASE_H namespace Eigen { namespace internal { template struct is_ref_compatible_impl { private: template struct any_conversion { template any_conversion(const volatile T&); template any_conversion(T&); }; struct yes {int a[1];}; struct no {int a[2];}; template static yes test(const Ref&, int); template static no test(any_conversion, ...); public: static MatrixType ms_from; enum { value = sizeof(test(ms_from, 0))==sizeof(yes) }; }; template struct is_ref_compatible { enum { value = is_ref_compatible_impl::type>::value }; }; template::value> class generic_matrix_wrapper; // We have an explicit matrix at hand, compatible with Ref<> template class generic_matrix_wrapper { public: typedef Ref ActualMatrixType; template struct ConstSelfAdjointViewReturnType { typedef typename ActualMatrixType::template ConstSelfAdjointViewReturnType::Type Type; }; enum { MatrixFree = false }; generic_matrix_wrapper() : m_dummy(0,0), m_matrix(m_dummy) {} template generic_matrix_wrapper(const InputType &mat) : m_matrix(mat) {} const ActualMatrixType& matrix() const { return m_matrix; } template void grab(const EigenBase &mat) { m_matrix.~Ref(); ::new (&m_matrix) Ref(mat.derived()); } void grab(const Ref &mat) { if(&(mat.derived()) != &m_matrix) { m_matrix.~Ref(); ::new (&m_matrix) Ref(mat); } } protected: MatrixType m_dummy; // used to default initialize the Ref<> object ActualMatrixType m_matrix; }; // MatrixType is not compatible with Ref<> -> matrix-free wrapper template class generic_matrix_wrapper { public: typedef MatrixType ActualMatrixType; template struct ConstSelfAdjointViewReturnType { typedef ActualMatrixType Type; }; enum { MatrixFree = true }; generic_matrix_wrapper() : mp_matrix(0) {} generic_matrix_wrapper(const MatrixType &mat) : mp_matrix(&mat) {} const ActualMatrixType& matrix() const { return *mp_matrix; } void grab(const MatrixType &mat) { mp_matrix = &mat; } protected: const ActualMatrixType *mp_matrix; }; } /** \ingroup IterativeLinearSolvers_Module * \brief Base class for linear iterative solvers * * \sa class SimplicialCholesky, DiagonalPreconditioner, IdentityPreconditioner */ template< typename Derived> class IterativeSolverBase : public SparseSolverBase { protected: typedef SparseSolverBase Base; using Base::m_isInitialized; public: typedef typename internal::traits::MatrixType MatrixType; typedef typename internal::traits::Preconditioner Preconditioner; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::StorageIndex StorageIndex; typedef typename MatrixType::RealScalar RealScalar; enum { ColsAtCompileTime = MatrixType::ColsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; public: using Base::derived; /** Default constructor. */ IterativeSolverBase() { init(); } /** Initialize the solver with matrix \a A for further \c Ax=b solving. * * This constructor is a shortcut for the default constructor followed * by a call to compute(). * * \warning this class stores a reference to the matrix A as well as some * precomputed values that depend on it. Therefore, if \a A is changed * this class becomes invalid. Call compute() to update it with the new * matrix A, or modify a copy of A. */ template explicit IterativeSolverBase(const EigenBase& A) : m_matrixWrapper(A.derived()) { init(); compute(matrix()); } ~IterativeSolverBase() {} /** Initializes the iterative solver for the sparsity pattern of the matrix \a A for further solving \c Ax=b problems. * * Currently, this function mostly calls analyzePattern on the preconditioner. In the future * we might, for instance, implement column reordering for faster matrix vector products. */ template Derived& analyzePattern(const EigenBase& A) { grab(A.derived()); m_preconditioner.analyzePattern(matrix()); m_isInitialized = true; m_analysisIsOk = true; m_info = m_preconditioner.info(); return derived(); } /** Initializes the iterative solver with the numerical values of the matrix \a A for further solving \c Ax=b problems. * * Currently, this function mostly calls factorize on the preconditioner. * * \warning this class stores a reference to the matrix A as well as some * precomputed values that depend on it. Therefore, if \a A is changed * this class becomes invalid. Call compute() to update it with the new * matrix A, or modify a copy of A. */ template Derived& factorize(const EigenBase& A) { eigen_assert(m_analysisIsOk && "You must first call analyzePattern()"); grab(A.derived()); m_preconditioner.factorize(matrix()); m_factorizationIsOk = true; m_info = m_preconditioner.info(); return derived(); } /** Initializes the iterative solver with the matrix \a A for further solving \c Ax=b problems. * * Currently, this function mostly initializes/computes the preconditioner. In the future * we might, for instance, implement column reordering for faster matrix vector products. * * \warning this class stores a reference to the matrix A as well as some * precomputed values that depend on it. Therefore, if \a A is changed * this class becomes invalid. Call compute() to update it with the new * matrix A, or modify a copy of A. */ template Derived& compute(const EigenBase& A) { grab(A.derived()); m_preconditioner.compute(matrix()); m_isInitialized = true; m_analysisIsOk = true; m_factorizationIsOk = true; m_info = m_preconditioner.info(); return derived(); } /** \internal */ EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return matrix().rows(); } /** \internal */ EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return matrix().cols(); } /** \returns the tolerance threshold used by the stopping criteria. * \sa setTolerance() */ RealScalar tolerance() const { return m_tolerance; } /** Sets the tolerance threshold used by the stopping criteria. * * This value is used as an upper bound to the relative residual error: |Ax-b|/|b|. * The default value is the machine precision given by NumTraits::epsilon() */ Derived& setTolerance(const RealScalar& tolerance) { m_tolerance = tolerance; return derived(); } /** \returns a read-write reference to the preconditioner for custom configuration. */ Preconditioner& preconditioner() { return m_preconditioner; } /** \returns a read-only reference to the preconditioner. */ const Preconditioner& preconditioner() const { return m_preconditioner; } /** \returns the max number of iterations. * It is either the value set by setMaxIterations or, by default, * twice the number of columns of the matrix. */ Index maxIterations() const { return (m_maxIterations<0) ? 2*matrix().cols() : m_maxIterations; } /** Sets the max number of iterations. * Default is twice the number of columns of the matrix. */ Derived& setMaxIterations(Index maxIters) { m_maxIterations = maxIters; return derived(); } /** \returns the number of iterations performed during the last solve */ Index iterations() const { eigen_assert(m_isInitialized && "ConjugateGradient is not initialized."); return m_iterations; } /** \returns the tolerance error reached during the last solve. * It is a close approximation of the true relative residual error |Ax-b|/|b|. */ RealScalar error() const { eigen_assert(m_isInitialized && "ConjugateGradient is not initialized."); return m_error; } /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A * and \a x0 as an initial solution. * * \sa solve(), compute() */ template inline const SolveWithGuess solveWithGuess(const MatrixBase& b, const Guess& x0) const { eigen_assert(m_isInitialized && "Solver is not initialized."); eigen_assert(derived().rows()==b.rows() && "solve(): invalid number of rows of the right hand side matrix b"); return SolveWithGuess(derived(), b.derived(), x0); } /** \returns Success if the iterations converged, and NoConvergence otherwise. */ ComputationInfo info() const { eigen_assert(m_isInitialized && "IterativeSolverBase is not initialized."); return m_info; } /** \internal */ template void _solve_with_guess_impl(const Rhs& b, SparseMatrixBase &aDest) const { eigen_assert(rows()==b.rows()); Index rhsCols = b.cols(); Index size = b.rows(); DestDerived& dest(aDest.derived()); typedef typename DestDerived::Scalar DestScalar; Eigen::Matrix tb(size); Eigen::Matrix tx(cols()); // We do not directly fill dest because sparse expressions have to be free of aliasing issue. // For non square least-square problems, b and dest might not have the same size whereas they might alias each-other. typename DestDerived::PlainObject tmp(cols(),rhsCols); ComputationInfo global_info = Success; for(Index k=0; k typename internal::enable_if::type _solve_with_guess_impl(const Rhs& b, MatrixBase &aDest) const { eigen_assert(rows()==b.rows()); Index rhsCols = b.cols(); DestDerived& dest(aDest.derived()); ComputationInfo global_info = Success; for(Index k=0; k typename internal::enable_if::type _solve_with_guess_impl(const Rhs& b, MatrixBase &dest) const { derived()._solve_vector_with_guess_impl(b,dest.derived()); } /** \internal default initial guess = 0 */ template void _solve_impl(const Rhs& b, Dest& x) const { x.setZero(); derived()._solve_with_guess_impl(b,x); } protected: void init() { m_isInitialized = false; m_analysisIsOk = false; m_factorizationIsOk = false; m_maxIterations = -1; m_tolerance = NumTraits::epsilon(); } typedef internal::generic_matrix_wrapper MatrixWrapper; typedef typename MatrixWrapper::ActualMatrixType ActualMatrixType; const ActualMatrixType& matrix() const { return m_matrixWrapper.matrix(); } template void grab(const InputType &A) { m_matrixWrapper.grab(A); } MatrixWrapper m_matrixWrapper; Preconditioner m_preconditioner; Index m_maxIterations; RealScalar m_tolerance; mutable RealScalar m_error; mutable Index m_iterations; mutable ComputationInfo m_info; mutable bool m_analysisIsOk, m_factorizationIsOk; }; } // end namespace Eigen #endif // EIGEN_ITERATIVE_SOLVER_BASE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2015 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_LEAST_SQUARE_CONJUGATE_GRADIENT_H #define EIGEN_LEAST_SQUARE_CONJUGATE_GRADIENT_H namespace Eigen { namespace internal { /** \internal Low-level conjugate gradient algorithm for least-square problems * \param mat The matrix A * \param rhs The right hand side vector b * \param x On input and initial solution, on output the computed solution. * \param precond A preconditioner being able to efficiently solve for an * approximation of A'Ax=b (regardless of b) * \param iters On input the max number of iteration, on output the number of performed iterations. * \param tol_error On input the tolerance error, on output an estimation of the relative error. */ template EIGEN_DONT_INLINE void least_square_conjugate_gradient(const MatrixType& mat, const Rhs& rhs, Dest& x, const Preconditioner& precond, Index& iters, typename Dest::RealScalar& tol_error) { using std::sqrt; using std::abs; typedef typename Dest::RealScalar RealScalar; typedef typename Dest::Scalar Scalar; typedef Matrix VectorType; RealScalar tol = tol_error; Index maxIters = iters; Index m = mat.rows(), n = mat.cols(); VectorType residual = rhs - mat * x; VectorType normal_residual = mat.adjoint() * residual; RealScalar rhsNorm2 = (mat.adjoint()*rhs).squaredNorm(); if(rhsNorm2 == 0) { x.setZero(); iters = 0; tol_error = 0; return; } RealScalar threshold = tol*tol*rhsNorm2; RealScalar residualNorm2 = normal_residual.squaredNorm(); if (residualNorm2 < threshold) { iters = 0; tol_error = sqrt(residualNorm2 / rhsNorm2); return; } VectorType p(n); p = precond.solve(normal_residual); // initial search direction VectorType z(n), tmp(m); RealScalar absNew = numext::real(normal_residual.dot(p)); // the square of the absolute value of r scaled by invM Index i = 0; while(i < maxIters) { tmp.noalias() = mat * p; Scalar alpha = absNew / tmp.squaredNorm(); // the amount we travel on dir x += alpha * p; // update solution residual -= alpha * tmp; // update residual normal_residual = mat.adjoint() * residual; // update residual of the normal equation residualNorm2 = normal_residual.squaredNorm(); if(residualNorm2 < threshold) break; z = precond.solve(normal_residual); // approximately solve for "A'A z = normal_residual" RealScalar absOld = absNew; absNew = numext::real(normal_residual.dot(z)); // update the absolute value of r RealScalar beta = absNew / absOld; // calculate the Gram-Schmidt value used to create the new search direction p = z + beta * p; // update search direction i++; } tol_error = sqrt(residualNorm2 / rhsNorm2); iters = i; } } template< typename MatrixType_, typename Preconditioner_ = LeastSquareDiagonalPreconditioner > class LeastSquaresConjugateGradient; namespace internal { template< typename MatrixType_, typename Preconditioner_> struct traits > { typedef MatrixType_ MatrixType; typedef Preconditioner_ Preconditioner; }; } /** \ingroup IterativeLinearSolvers_Module * \brief A conjugate gradient solver for sparse (or dense) least-square problems * * This class allows to solve for A x = b linear problems using an iterative conjugate gradient algorithm. * The matrix A can be non symmetric and rectangular, but the matrix A' A should be positive-definite to guaranty stability. * Otherwise, the SparseLU or SparseQR classes might be preferable. * The matrix A and the vectors x and b can be either dense or sparse. * * \tparam MatrixType_ the type of the matrix A, can be a dense or a sparse matrix. * \tparam Preconditioner_ the type of the preconditioner. Default is LeastSquareDiagonalPreconditioner * * \implsparsesolverconcept * * The maximal number of iterations and tolerance value can be controlled via the setMaxIterations() * and setTolerance() methods. The defaults are the size of the problem for the maximal number of iterations * and NumTraits::epsilon() for the tolerance. * * This class can be used as the direct solver classes. Here is a typical usage example: \code int m=1000000, n = 10000; VectorXd x(n), b(m); SparseMatrix A(m,n); // fill A and b LeastSquaresConjugateGradient > lscg; lscg.compute(A); x = lscg.solve(b); std::cout << "#iterations: " << lscg.iterations() << std::endl; std::cout << "estimated error: " << lscg.error() << std::endl; // update b, and solve again x = lscg.solve(b); \endcode * * By default the iterations start with x=0 as an initial guess of the solution. * One can control the start using the solveWithGuess() method. * * \sa class ConjugateGradient, SparseLU, SparseQR */ template< typename MatrixType_, typename Preconditioner_> class LeastSquaresConjugateGradient : public IterativeSolverBase > { typedef IterativeSolverBase Base; using Base::matrix; using Base::m_error; using Base::m_iterations; using Base::m_info; using Base::m_isInitialized; public: typedef MatrixType_ MatrixType; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef Preconditioner_ Preconditioner; public: /** Default constructor. */ LeastSquaresConjugateGradient() : Base() {} /** Initialize the solver with matrix \a A for further \c Ax=b solving. * * This constructor is a shortcut for the default constructor followed * by a call to compute(). * * \warning this class stores a reference to the matrix A as well as some * precomputed values that depend on it. Therefore, if \a A is changed * this class becomes invalid. Call compute() to update it with the new * matrix A, or modify a copy of A. */ template explicit LeastSquaresConjugateGradient(const EigenBase& A) : Base(A.derived()) {} ~LeastSquaresConjugateGradient() {} /** \internal */ template void _solve_vector_with_guess_impl(const Rhs& b, Dest& x) const { m_iterations = Base::maxIterations(); m_error = Base::m_tolerance; internal::least_square_conjugate_gradient(matrix(), b, x, Base::m_preconditioner, m_iterations, m_error); m_info = m_error <= Base::m_tolerance ? Success : NoConvergence; } }; } // end namespace Eigen #endif // EIGEN_LEAST_SQUARE_CONJUGATE_GRADIENT_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SOLVEWITHGUESS_H #define EIGEN_SOLVEWITHGUESS_H namespace Eigen { template class SolveWithGuess; /** \class SolveWithGuess * \ingroup IterativeLinearSolvers_Module * * \brief Pseudo expression representing a solving operation * * \tparam Decomposition the type of the matrix or decomposion object * \tparam Rhstype the type of the right-hand side * * This class represents an expression of A.solve(B) * and most of the time this is the only way it is used. * */ namespace internal { template struct traits > : traits > {}; } template class SolveWithGuess : public internal::generic_xpr_base, MatrixXpr, typename internal::traits::StorageKind>::type { public: typedef typename internal::traits::Scalar Scalar; typedef typename internal::traits::PlainObject PlainObject; typedef typename internal::generic_xpr_base, MatrixXpr, typename internal::traits::StorageKind>::type Base; typedef typename internal::ref_selector::type Nested; SolveWithGuess(const Decomposition &dec, const RhsType &rhs, const GuessType &guess) : m_dec(dec), m_rhs(rhs), m_guess(guess) {} EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_dec.cols(); } EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_rhs.cols(); } EIGEN_DEVICE_FUNC const Decomposition& dec() const { return m_dec; } EIGEN_DEVICE_FUNC const RhsType& rhs() const { return m_rhs; } EIGEN_DEVICE_FUNC const GuessType& guess() const { return m_guess; } protected: const Decomposition &m_dec; const RhsType &m_rhs; const GuessType &m_guess; private: Scalar coeff(Index row, Index col) const; Scalar coeff(Index i) const; }; namespace internal { // Evaluator of SolveWithGuess -> eval into a temporary template struct evaluator > : public evaluator::PlainObject> { typedef SolveWithGuess SolveType; typedef typename SolveType::PlainObject PlainObject; typedef evaluator Base; evaluator(const SolveType& solve) : m_result(solve.rows(), solve.cols()) { ::new (static_cast(this)) Base(m_result); m_result = solve.guess(); solve.dec()._solve_with_guess_impl(solve.rhs(), m_result); } protected: PlainObject m_result; }; // Specialization for "dst = dec.solveWithGuess(rhs)" // NOTE we need to specialize it for Dense2Dense to avoid ambiguous specialization error and a Sparse2Sparse specialization must exist somewhere template struct Assignment, internal::assign_op, Dense2Dense> { typedef SolveWithGuess SrcXprType; static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &) { Index dstRows = src.rows(); Index dstCols = src.cols(); if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) dst.resize(dstRows, dstCols); dst = src.guess(); src.dec()._solve_with_guess_impl(src.rhs(), dst/*, src.guess()*/); } }; } // end namespace internal } // end namespace Eigen #endif // EIGEN_SOLVEWITHGUESS_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/Jacobi/Jacobi.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Benoit Jacob // Copyright (C) 2009 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_JACOBI_H #define EIGEN_JACOBI_H namespace Eigen { /** \ingroup Jacobi_Module * \jacobi_module * \class JacobiRotation * \brief Rotation given by a cosine-sine pair. * * This class represents a Jacobi or Givens rotation. * This is a 2D rotation in the plane \c J of angle \f$ \theta \f$ defined by * its cosine \c c and sine \c s as follow: * \f$ J = \left ( \begin{array}{cc} c & \overline s \\ -s & \overline c \end{array} \right ) \f$ * * You can apply the respective counter-clockwise rotation to a column vector \c v by * applying its adjoint on the left: \f$ v = J^* v \f$ that translates to the following Eigen code: * \code * v.applyOnTheLeft(J.adjoint()); * \endcode * * \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight() */ template class JacobiRotation { public: typedef typename NumTraits::Real RealScalar; /** Default constructor without any initialization. */ EIGEN_DEVICE_FUNC JacobiRotation() {} /** Construct a planar rotation from a cosine-sine pair (\a c, \c s). */ EIGEN_DEVICE_FUNC JacobiRotation(const Scalar& c, const Scalar& s) : m_c(c), m_s(s) {} EIGEN_DEVICE_FUNC Scalar& c() { return m_c; } EIGEN_DEVICE_FUNC Scalar c() const { return m_c; } EIGEN_DEVICE_FUNC Scalar& s() { return m_s; } EIGEN_DEVICE_FUNC Scalar s() const { return m_s; } /** Concatenates two planar rotation */ EIGEN_DEVICE_FUNC JacobiRotation operator*(const JacobiRotation& other) { using numext::conj; return JacobiRotation(m_c * other.m_c - conj(m_s) * other.m_s, conj(m_c * conj(other.m_s) + conj(m_s) * conj(other.m_c))); } /** Returns the transposed transformation */ EIGEN_DEVICE_FUNC JacobiRotation transpose() const { using numext::conj; return JacobiRotation(m_c, -conj(m_s)); } /** Returns the adjoint transformation */ EIGEN_DEVICE_FUNC JacobiRotation adjoint() const { using numext::conj; return JacobiRotation(conj(m_c), -m_s); } template EIGEN_DEVICE_FUNC bool makeJacobi(const MatrixBase&, Index p, Index q); EIGEN_DEVICE_FUNC bool makeJacobi(const RealScalar& x, const Scalar& y, const RealScalar& z); EIGEN_DEVICE_FUNC void makeGivens(const Scalar& p, const Scalar& q, Scalar* r=0); protected: EIGEN_DEVICE_FUNC void makeGivens(const Scalar& p, const Scalar& q, Scalar* r, internal::true_type); EIGEN_DEVICE_FUNC void makeGivens(const Scalar& p, const Scalar& q, Scalar* r, internal::false_type); Scalar m_c, m_s; }; /** Makes \c *this as a Jacobi rotation \a J such that applying \a J on both the right and left sides of the selfadjoint 2x2 matrix * \f$ B = \left ( \begin{array}{cc} x & y \\ \overline y & z \end{array} \right )\f$ yields a diagonal matrix \f$ A = J^* B J \f$ * * \sa MatrixBase::makeJacobi(const MatrixBase&, Index, Index), MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight() */ template EIGEN_DEVICE_FUNC bool JacobiRotation::makeJacobi(const RealScalar& x, const Scalar& y, const RealScalar& z) { using std::sqrt; using std::abs; RealScalar deno = RealScalar(2)*abs(y); if(deno < (std::numeric_limits::min)()) { m_c = Scalar(1); m_s = Scalar(0); return false; } else { RealScalar tau = (x-z)/deno; RealScalar w = sqrt(numext::abs2(tau) + RealScalar(1)); RealScalar t; if(tau>RealScalar(0)) { t = RealScalar(1) / (tau + w); } else { t = RealScalar(1) / (tau - w); } RealScalar sign_t = t > RealScalar(0) ? RealScalar(1) : RealScalar(-1); RealScalar n = RealScalar(1) / sqrt(numext::abs2(t)+RealScalar(1)); m_s = - sign_t * (numext::conj(y) / abs(y)) * abs(t) * n; m_c = n; return true; } } /** Makes \c *this as a Jacobi rotation \c J such that applying \a J on both the right and left sides of the 2x2 selfadjoint matrix * \f$ B = \left ( \begin{array}{cc} \text{this}_{pp} & \text{this}_{pq} \\ (\text{this}_{pq})^* & \text{this}_{qq} \end{array} \right )\f$ yields * a diagonal matrix \f$ A = J^* B J \f$ * * Example: \include Jacobi_makeJacobi.cpp * Output: \verbinclude Jacobi_makeJacobi.out * * \sa JacobiRotation::makeJacobi(RealScalar, Scalar, RealScalar), MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight() */ template template EIGEN_DEVICE_FUNC inline bool JacobiRotation::makeJacobi(const MatrixBase& m, Index p, Index q) { return makeJacobi(numext::real(m.coeff(p,p)), m.coeff(p,q), numext::real(m.coeff(q,q))); } /** Makes \c *this as a Givens rotation \c G such that applying \f$ G^* \f$ to the left of the vector * \f$ V = \left ( \begin{array}{c} p \\ q \end{array} \right )\f$ yields: * \f$ G^* V = \left ( \begin{array}{c} r \\ 0 \end{array} \right )\f$. * * The value of \a r is returned if \a r is not null (the default is null). * Also note that G is built such that the cosine is always real. * * Example: \include Jacobi_makeGivens.cpp * Output: \verbinclude Jacobi_makeGivens.out * * This function implements the continuous Givens rotation generation algorithm * found in Anderson (2000), Discontinuous Plane Rotations and the Symmetric Eigenvalue Problem. * LAPACK Working Note 150, University of Tennessee, UT-CS-00-454, December 4, 2000. * * \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight() */ template EIGEN_DEVICE_FUNC void JacobiRotation::makeGivens(const Scalar& p, const Scalar& q, Scalar* r) { makeGivens(p, q, r, typename internal::conditional::IsComplex, internal::true_type, internal::false_type>::type()); } // specialization for complexes template EIGEN_DEVICE_FUNC void JacobiRotation::makeGivens(const Scalar& p, const Scalar& q, Scalar* r, internal::true_type) { using std::sqrt; using std::abs; using numext::conj; if(q==Scalar(0)) { m_c = numext::real(p)<0 ? Scalar(-1) : Scalar(1); m_s = 0; if(r) *r = m_c * p; } else if(p==Scalar(0)) { m_c = 0; m_s = -q/abs(q); if(r) *r = abs(q); } else { RealScalar p1 = numext::norm1(p); RealScalar q1 = numext::norm1(q); if(p1>=q1) { Scalar ps = p / p1; RealScalar p2 = numext::abs2(ps); Scalar qs = q / p1; RealScalar q2 = numext::abs2(qs); RealScalar u = sqrt(RealScalar(1) + q2/p2); if(numext::real(p) EIGEN_DEVICE_FUNC void JacobiRotation::makeGivens(const Scalar& p, const Scalar& q, Scalar* r, internal::false_type) { using std::sqrt; using std::abs; if(q==Scalar(0)) { m_c = p abs(q)) { Scalar t = q/p; Scalar u = sqrt(Scalar(1) + numext::abs2(t)); if(p EIGEN_DEVICE_FUNC void apply_rotation_in_the_plane(DenseBase& xpr_x, DenseBase& xpr_y, const JacobiRotation& j); } /** \jacobi_module * Applies the rotation in the plane \a j to the rows \a p and \a q of \c *this, i.e., it computes B = J * B, * with \f$ B = \left ( \begin{array}{cc} \text{*this.row}(p) \\ \text{*this.row}(q) \end{array} \right ) \f$. * * \sa class JacobiRotation, MatrixBase::applyOnTheRight(), internal::apply_rotation_in_the_plane() */ template template EIGEN_DEVICE_FUNC inline void MatrixBase::applyOnTheLeft(Index p, Index q, const JacobiRotation& j) { RowXpr x(this->row(p)); RowXpr y(this->row(q)); internal::apply_rotation_in_the_plane(x, y, j); } /** \ingroup Jacobi_Module * Applies the rotation in the plane \a j to the columns \a p and \a q of \c *this, i.e., it computes B = B * J * with \f$ B = \left ( \begin{array}{cc} \text{*this.col}(p) & \text{*this.col}(q) \end{array} \right ) \f$. * * \sa class JacobiRotation, MatrixBase::applyOnTheLeft(), internal::apply_rotation_in_the_plane() */ template template EIGEN_DEVICE_FUNC inline void MatrixBase::applyOnTheRight(Index p, Index q, const JacobiRotation& j) { ColXpr x(this->col(p)); ColXpr y(this->col(q)); internal::apply_rotation_in_the_plane(x, y, j.transpose()); } namespace internal { template struct apply_rotation_in_the_plane_selector { static EIGEN_DEVICE_FUNC inline void run(Scalar *x, Index incrx, Scalar *y, Index incry, Index size, OtherScalar c, OtherScalar s) { for(Index i=0; i struct apply_rotation_in_the_plane_selector { static inline void run(Scalar *x, Index incrx, Scalar *y, Index incry, Index size, OtherScalar c, OtherScalar s) { enum { PacketSize = packet_traits::size, OtherPacketSize = packet_traits::size }; typedef typename packet_traits::type Packet; typedef typename packet_traits::type OtherPacket; /*** dynamic-size vectorized paths ***/ if(SizeAtCompileTime == Dynamic && ((incrx==1 && incry==1) || PacketSize == 1)) { // both vectors are sequentially stored in memory => vectorization enum { Peeling = 2 }; Index alignedStart = internal::first_default_aligned(y, size); Index alignedEnd = alignedStart + ((size-alignedStart)/PacketSize)*PacketSize; const OtherPacket pc = pset1(c); const OtherPacket ps = pset1(s); conj_helper::IsComplex,false> pcj; conj_helper pm; for(Index i=0; i(px); Packet yi = pload(py); pstore(px, padd(pm.pmul(pc,xi),pcj.pmul(ps,yi))); pstore(py, psub(pcj.pmul(pc,yi),pm.pmul(ps,xi))); px += PacketSize; py += PacketSize; } } else { Index peelingEnd = alignedStart + ((size-alignedStart)/(Peeling*PacketSize))*(Peeling*PacketSize); for(Index i=alignedStart; i(px); Packet xi1 = ploadu(px+PacketSize); Packet yi = pload (py); Packet yi1 = pload (py+PacketSize); pstoreu(px, padd(pm.pmul(pc,xi),pcj.pmul(ps,yi))); pstoreu(px+PacketSize, padd(pm.pmul(pc,xi1),pcj.pmul(ps,yi1))); pstore (py, psub(pcj.pmul(pc,yi),pm.pmul(ps,xi))); pstore (py+PacketSize, psub(pcj.pmul(pc,yi1),pm.pmul(ps,xi1))); px += Peeling*PacketSize; py += Peeling*PacketSize; } if(alignedEnd!=peelingEnd) { Packet xi = ploadu(x+peelingEnd); Packet yi = pload (y+peelingEnd); pstoreu(x+peelingEnd, padd(pm.pmul(pc,xi),pcj.pmul(ps,yi))); pstore (y+peelingEnd, psub(pcj.pmul(pc,yi),pm.pmul(ps,xi))); } } for(Index i=alignedEnd; i0) // FIXME should be compared to the required alignment { const OtherPacket pc = pset1(c); const OtherPacket ps = pset1(s); conj_helper::IsComplex,false> pcj; conj_helper pm; Scalar* EIGEN_RESTRICT px = x; Scalar* EIGEN_RESTRICT py = y; for(Index i=0; i(px); Packet yi = pload(py); pstore(px, padd(pm.pmul(pc,xi),pcj.pmul(ps,yi))); pstore(py, psub(pcj.pmul(pc,yi),pm.pmul(ps,xi))); px += PacketSize; py += PacketSize; } } /*** non-vectorized path ***/ else { apply_rotation_in_the_plane_selector::run(x,incrx,y,incry,size,c,s); } } }; template EIGEN_DEVICE_FUNC void /*EIGEN_DONT_INLINE*/ apply_rotation_in_the_plane(DenseBase& xpr_x, DenseBase& xpr_y, const JacobiRotation& j) { typedef typename VectorX::Scalar Scalar; const bool Vectorizable = (int(VectorX::Flags) & int(VectorY::Flags) & PacketAccessBit) && (int(packet_traits::size) == int(packet_traits::size)); eigen_assert(xpr_x.size() == xpr_y.size()); Index size = xpr_x.size(); Index incrx = xpr_x.derived().innerStride(); Index incry = xpr_y.derived().innerStride(); Scalar* EIGEN_RESTRICT x = &xpr_x.derived().coeffRef(0); Scalar* EIGEN_RESTRICT y = &xpr_y.derived().coeffRef(0); OtherScalar c = j.c(); OtherScalar s = j.s(); if (c==OtherScalar(1) && s==OtherScalar(0)) return; apply_rotation_in_the_plane_selector< Scalar,OtherScalar, VectorX::SizeAtCompileTime, EIGEN_PLAIN_ENUM_MIN(evaluator::Alignment, evaluator::Alignment), Vectorizable>::run(x,incrx,y,incry,size,c,s); } } // end namespace internal } // end namespace Eigen #endif // EIGEN_JACOBI_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/KLUSupport/KLUSupport.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2017 Kyle Macfarlan // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_KLUSUPPORT_H #define EIGEN_KLUSUPPORT_H namespace Eigen { /* TODO extract L, extract U, compute det, etc... */ /** \ingroup KLUSupport_Module * \brief A sparse LU factorization and solver based on KLU * * This class allows to solve for A.X = B sparse linear problems via a LU factorization * using the KLU library. The sparse matrix A must be squared and full rank. * The vectors or matrices X and B can be either dense or sparse. * * \warning The input matrix A should be in a \b compressed and \b column-major form. * Otherwise an expensive copy will be made. You can call the inexpensive makeCompressed() to get a compressed matrix. * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> * * \implsparsesolverconcept * * \sa \ref TutorialSparseSolverConcept, class UmfPackLU, class SparseLU */ inline int klu_solve(klu_symbolic *Symbolic, klu_numeric *Numeric, Index ldim, Index nrhs, double B [ ], klu_common *Common, double) { return klu_solve(Symbolic, Numeric, internal::convert_index(ldim), internal::convert_index(nrhs), B, Common); } inline int klu_solve(klu_symbolic *Symbolic, klu_numeric *Numeric, Index ldim, Index nrhs, std::complexB[], klu_common *Common, std::complex) { return klu_z_solve(Symbolic, Numeric, internal::convert_index(ldim), internal::convert_index(nrhs), &numext::real_ref(B[0]), Common); } inline int klu_tsolve(klu_symbolic *Symbolic, klu_numeric *Numeric, Index ldim, Index nrhs, double B[], klu_common *Common, double) { return klu_tsolve(Symbolic, Numeric, internal::convert_index(ldim), internal::convert_index(nrhs), B, Common); } inline int klu_tsolve(klu_symbolic *Symbolic, klu_numeric *Numeric, Index ldim, Index nrhs, std::complexB[], klu_common *Common, std::complex) { return klu_z_tsolve(Symbolic, Numeric, internal::convert_index(ldim), internal::convert_index(nrhs), &numext::real_ref(B[0]), 0, Common); } inline klu_numeric* klu_factor(int Ap [ ], int Ai [ ], double Ax [ ], klu_symbolic *Symbolic, klu_common *Common, double) { return klu_factor(Ap, Ai, Ax, Symbolic, Common); } inline klu_numeric* klu_factor(int Ap[], int Ai[], std::complex Ax[], klu_symbolic *Symbolic, klu_common *Common, std::complex) { return klu_z_factor(Ap, Ai, &numext::real_ref(Ax[0]), Symbolic, Common); } template class KLU : public SparseSolverBase > { protected: typedef SparseSolverBase > Base; using Base::m_isInitialized; public: using Base::_solve_impl; typedef MatrixType_ MatrixType; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef typename MatrixType::StorageIndex StorageIndex; typedef Matrix Vector; typedef Matrix IntRowVectorType; typedef Matrix IntColVectorType; typedef SparseMatrix LUMatrixType; typedef SparseMatrix KLUMatrixType; typedef Ref KLUMatrixRef; enum { ColsAtCompileTime = MatrixType::ColsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; public: KLU() : m_dummy(0,0), mp_matrix(m_dummy) { init(); } template explicit KLU(const InputMatrixType& matrix) : mp_matrix(matrix) { init(); compute(matrix); } ~KLU() { if(m_symbolic) klu_free_symbolic(&m_symbolic,&m_common); if(m_numeric) klu_free_numeric(&m_numeric,&m_common); } EIGEN_CONSTEXPR inline Index rows() const EIGEN_NOEXCEPT { return mp_matrix.rows(); } EIGEN_CONSTEXPR inline Index cols() const EIGEN_NOEXCEPT { return mp_matrix.cols(); } /** \brief Reports whether previous computation was successful. * * \returns \c Success if computation was successful, * \c NumericalIssue if the matrix.appears to be negative. */ ComputationInfo info() const { eigen_assert(m_isInitialized && "Decomposition is not initialized."); return m_info; } #if 0 // not implemented yet inline const LUMatrixType& matrixL() const { if (m_extractedDataAreDirty) extractData(); return m_l; } inline const LUMatrixType& matrixU() const { if (m_extractedDataAreDirty) extractData(); return m_u; } inline const IntColVectorType& permutationP() const { if (m_extractedDataAreDirty) extractData(); return m_p; } inline const IntRowVectorType& permutationQ() const { if (m_extractedDataAreDirty) extractData(); return m_q; } #endif /** Computes the sparse Cholesky decomposition of \a matrix * Note that the matrix should be column-major, and in compressed format for best performance. * \sa SparseMatrix::makeCompressed(). */ template void compute(const InputMatrixType& matrix) { if(m_symbolic) klu_free_symbolic(&m_symbolic, &m_common); if(m_numeric) klu_free_numeric(&m_numeric, &m_common); grab(matrix.derived()); analyzePattern_impl(); factorize_impl(); } /** Performs a symbolic decomposition on the sparcity of \a matrix. * * This function is particularly useful when solving for several problems having the same structure. * * \sa factorize(), compute() */ template void analyzePattern(const InputMatrixType& matrix) { if(m_symbolic) klu_free_symbolic(&m_symbolic, &m_common); if(m_numeric) klu_free_numeric(&m_numeric, &m_common); grab(matrix.derived()); analyzePattern_impl(); } /** Provides access to the control settings array used by KLU. * * See KLU documentation for details. */ inline const klu_common& kluCommon() const { return m_common; } /** Provides access to the control settings array used by UmfPack. * * If this array contains NaN's, the default values are used. * * See KLU documentation for details. */ inline klu_common& kluCommon() { return m_common; } /** Performs a numeric decomposition of \a matrix * * The given matrix must has the same sparcity than the matrix on which the pattern anylysis has been performed. * * \sa analyzePattern(), compute() */ template void factorize(const InputMatrixType& matrix) { eigen_assert(m_analysisIsOk && "KLU: you must first call analyzePattern()"); if(m_numeric) klu_free_numeric(&m_numeric,&m_common); grab(matrix.derived()); factorize_impl(); } /** \internal */ template bool _solve_impl(const MatrixBase &b, MatrixBase &x) const; #if 0 // not implemented yet Scalar determinant() const; void extractData() const; #endif protected: void init() { m_info = InvalidInput; m_isInitialized = false; m_numeric = 0; m_symbolic = 0; m_extractedDataAreDirty = true; klu_defaults(&m_common); } void analyzePattern_impl() { m_info = InvalidInput; m_analysisIsOk = false; m_factorizationIsOk = false; m_symbolic = klu_analyze(internal::convert_index(mp_matrix.rows()), const_cast(mp_matrix.outerIndexPtr()), const_cast(mp_matrix.innerIndexPtr()), &m_common); if (m_symbolic) { m_isInitialized = true; m_info = Success; m_analysisIsOk = true; m_extractedDataAreDirty = true; } } void factorize_impl() { m_numeric = klu_factor(const_cast(mp_matrix.outerIndexPtr()), const_cast(mp_matrix.innerIndexPtr()), const_cast(mp_matrix.valuePtr()), m_symbolic, &m_common, Scalar()); m_info = m_numeric ? Success : NumericalIssue; m_factorizationIsOk = m_numeric ? 1 : 0; m_extractedDataAreDirty = true; } template void grab(const EigenBase &A) { mp_matrix.~KLUMatrixRef(); ::new (&mp_matrix) KLUMatrixRef(A.derived()); } void grab(const KLUMatrixRef &A) { if(&(A.derived()) != &mp_matrix) { mp_matrix.~KLUMatrixRef(); ::new (&mp_matrix) KLUMatrixRef(A); } } // cached data to reduce reallocation, etc. #if 0 // not implemented yet mutable LUMatrixType m_l; mutable LUMatrixType m_u; mutable IntColVectorType m_p; mutable IntRowVectorType m_q; #endif KLUMatrixType m_dummy; KLUMatrixRef mp_matrix; klu_numeric* m_numeric; klu_symbolic* m_symbolic; klu_common m_common; mutable ComputationInfo m_info; int m_factorizationIsOk; int m_analysisIsOk; mutable bool m_extractedDataAreDirty; private: KLU(const KLU& ) { } }; #if 0 // not implemented yet template void KLU::extractData() const { if (m_extractedDataAreDirty) { eigen_assert(false && "KLU: extractData Not Yet Implemented"); // get size of the data int lnz, unz, rows, cols, nz_udiag; umfpack_get_lunz(&lnz, &unz, &rows, &cols, &nz_udiag, m_numeric, Scalar()); // allocate data m_l.resize(rows,(std::min)(rows,cols)); m_l.resizeNonZeros(lnz); m_u.resize((std::min)(rows,cols),cols); m_u.resizeNonZeros(unz); m_p.resize(rows); m_q.resize(cols); // extract umfpack_get_numeric(m_l.outerIndexPtr(), m_l.innerIndexPtr(), m_l.valuePtr(), m_u.outerIndexPtr(), m_u.innerIndexPtr(), m_u.valuePtr(), m_p.data(), m_q.data(), 0, 0, 0, m_numeric); m_extractedDataAreDirty = false; } } template typename KLU::Scalar KLU::determinant() const { eigen_assert(false && "KLU: extractData Not Yet Implemented"); return Scalar(); } #endif template template bool KLU::_solve_impl(const MatrixBase &b, MatrixBase &x) const { Index rhsCols = b.cols(); EIGEN_STATIC_ASSERT((XDerived::Flags&RowMajorBit)==0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or analyzePattern()/factorize()"); x = b; int info = klu_solve(m_symbolic, m_numeric, b.rows(), rhsCols, x.const_cast_derived().data(), const_cast(&m_common), Scalar()); m_info = info!=0 ? Success : NumericalIssue; return true; } } // end namespace Eigen #endif // EIGEN_KLUSUPPORT_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/LU/Determinant.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_DETERMINANT_H #define EIGEN_DETERMINANT_H namespace Eigen { namespace internal { template EIGEN_DEVICE_FUNC inline const typename Derived::Scalar bruteforce_det3_helper (const MatrixBase& matrix, int a, int b, int c) { return matrix.coeff(0,a) * (matrix.coeff(1,b) * matrix.coeff(2,c) - matrix.coeff(1,c) * matrix.coeff(2,b)); } template struct determinant_impl { static inline typename traits::Scalar run(const Derived& m) { if(Derived::ColsAtCompileTime==Dynamic && m.rows()==0) return typename traits::Scalar(1); return m.partialPivLu().determinant(); } }; template struct determinant_impl { static inline EIGEN_DEVICE_FUNC typename traits::Scalar run(const Derived& m) { return m.coeff(0,0); } }; template struct determinant_impl { static inline EIGEN_DEVICE_FUNC typename traits::Scalar run(const Derived& m) { return m.coeff(0,0) * m.coeff(1,1) - m.coeff(1,0) * m.coeff(0,1); } }; template struct determinant_impl { static inline EIGEN_DEVICE_FUNC typename traits::Scalar run(const Derived& m) { return bruteforce_det3_helper(m,0,1,2) - bruteforce_det3_helper(m,1,0,2) + bruteforce_det3_helper(m,2,0,1); } }; template struct determinant_impl { typedef typename traits::Scalar Scalar; static EIGEN_DEVICE_FUNC Scalar run(const Derived& m) { Scalar d2_01 = det2(m, 0, 1); Scalar d2_02 = det2(m, 0, 2); Scalar d2_03 = det2(m, 0, 3); Scalar d2_12 = det2(m, 1, 2); Scalar d2_13 = det2(m, 1, 3); Scalar d2_23 = det2(m, 2, 3); Scalar d3_0 = det3(m, 1,d2_23, 2,d2_13, 3,d2_12); Scalar d3_1 = det3(m, 0,d2_23, 2,d2_03, 3,d2_02); Scalar d3_2 = det3(m, 0,d2_13, 1,d2_03, 3,d2_01); Scalar d3_3 = det3(m, 0,d2_12, 1,d2_02, 2,d2_01); return internal::pmadd(-m(0,3),d3_0, m(1,3)*d3_1) + internal::pmadd(-m(2,3),d3_2, m(3,3)*d3_3); } protected: static EIGEN_DEVICE_FUNC Scalar det2(const Derived& m, Index i0, Index i1) { return m(i0,0) * m(i1,1) - m(i1,0) * m(i0,1); } static EIGEN_DEVICE_FUNC Scalar det3(const Derived& m, Index i0, const Scalar& d0, Index i1, const Scalar& d1, Index i2, const Scalar& d2) { return internal::pmadd(m(i0,2), d0, internal::pmadd(-m(i1,2), d1, m(i2,2)*d2)); } }; } // end namespace internal /** \lu_module * * \returns the determinant of this matrix */ template EIGEN_DEVICE_FUNC inline typename internal::traits::Scalar MatrixBase::determinant() const { eigen_assert(rows() == cols()); typedef typename internal::nested_eval::type Nested; return internal::determinant_impl::type>::run(derived()); } } // end namespace Eigen #endif // EIGEN_DETERMINANT_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/LU/FullPivLU.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2006-2009 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_LU_H #define EIGEN_LU_H namespace Eigen { namespace internal { template struct traits > : traits { typedef MatrixXpr XprKind; typedef SolverStorage StorageKind; typedef int StorageIndex; enum { Flags = 0 }; }; } // end namespace internal /** \ingroup LU_Module * * \class FullPivLU * * \brief LU decomposition of a matrix with complete pivoting, and related features * * \tparam MatrixType_ the type of the matrix of which we are computing the LU decomposition * * This class represents a LU decomposition of any matrix, with complete pivoting: the matrix A is * decomposed as \f$ A = P^{-1} L U Q^{-1} \f$ where L is unit-lower-triangular, U is * upper-triangular, and P and Q are permutation matrices. This is a rank-revealing LU * decomposition. The eigenvalues (diagonal coefficients) of U are sorted in such a way that any * zeros are at the end. * * This decomposition provides the generic approach to solving systems of linear equations, computing * the rank, invertibility, inverse, kernel, and determinant. * * This LU decomposition is very stable and well tested with large matrices. However there are use cases where the SVD * decomposition is inherently more stable and/or flexible. For example, when computing the kernel of a matrix, * working with the SVD allows to select the smallest singular values of the matrix, something that * the LU decomposition doesn't see. * * The data of the LU decomposition can be directly accessed through the methods matrixLU(), * permutationP(), permutationQ(). * * As an example, here is how the original matrix can be retrieved: * \include class_FullPivLU.cpp * Output: \verbinclude class_FullPivLU.out * * This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism. * * \sa MatrixBase::fullPivLu(), MatrixBase::determinant(), MatrixBase::inverse() */ template class FullPivLU : public SolverBase > { public: typedef MatrixType_ MatrixType; typedef SolverBase Base; friend class SolverBase; EIGEN_GENERIC_PUBLIC_INTERFACE(FullPivLU) enum { MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; typedef typename internal::plain_row_type::type IntRowVectorType; typedef typename internal::plain_col_type::type IntColVectorType; typedef PermutationMatrix PermutationQType; typedef PermutationMatrix PermutationPType; typedef typename MatrixType::PlainObject PlainObject; /** * \brief Default Constructor. * * The default constructor is useful in cases in which the user intends to * perform decompositions via LU::compute(const MatrixType&). */ FullPivLU(); /** \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 FullPivLU() */ FullPivLU(Index rows, Index cols); /** Constructor. * * \param matrix the matrix of which to compute the LU decomposition. * It is required to be nonzero. */ template explicit FullPivLU(const EigenBase& matrix); /** \brief Constructs a LU factorization from a given matrix * * This overloaded constructor is provided for \link InplaceDecomposition inplace decomposition \endlink when \c MatrixType is a Eigen::Ref. * * \sa FullPivLU(const EigenBase&) */ template explicit FullPivLU(EigenBase& matrix); /** Computes the LU decomposition of the given matrix. * * \param matrix the matrix of which to compute the LU decomposition. * It is required to be nonzero. * * \returns a reference to *this */ template FullPivLU& compute(const EigenBase& matrix) { m_lu = matrix.derived(); computeInPlace(); return *this; } /** \returns the LU decomposition matrix: the upper-triangular part is U, the * unit-lower-triangular part is L (at least for square matrices; in the non-square * case, special care is needed, see the documentation of class FullPivLU). * * \sa matrixL(), matrixU() */ inline const MatrixType& matrixLU() const { eigen_assert(m_isInitialized && "LU is not initialized."); return m_lu; } /** \returns the number of nonzero pivots in the LU decomposition. * Here nonzero is meant in the exact sense, not in a fuzzy sense. * So that notion isn't really intrinsically interesting, but it is * still useful when implementing algorithms. * * \sa rank() */ inline Index nonzeroPivots() const { eigen_assert(m_isInitialized && "LU is not initialized."); return m_nonzero_pivots; } /** \returns the absolute value of the biggest pivot, i.e. the biggest * diagonal coefficient of U. */ RealScalar maxPivot() const { return m_maxpivot; } /** \returns the permutation matrix P * * \sa permutationQ() */ EIGEN_DEVICE_FUNC inline const PermutationPType& permutationP() const { eigen_assert(m_isInitialized && "LU is not initialized."); return m_p; } /** \returns the permutation matrix Q * * \sa permutationP() */ inline const PermutationQType& permutationQ() const { eigen_assert(m_isInitialized && "LU is not initialized."); return m_q; } /** \returns the kernel of the matrix, also called its null-space. The columns of the returned matrix * will form a basis of the kernel. * * \note If the kernel has dimension zero, then the returned matrix is a column-vector filled with zeros. * * \note This method has to determine which pivots should be considered nonzero. * For that, it uses the threshold value that you can control by calling * setThreshold(const RealScalar&). * * Example: \include FullPivLU_kernel.cpp * Output: \verbinclude FullPivLU_kernel.out * * \sa image() */ inline const internal::kernel_retval kernel() const { eigen_assert(m_isInitialized && "LU is not initialized."); return internal::kernel_retval(*this); } /** \returns the image of the matrix, also called its column-space. The columns of the returned matrix * will form a basis of the image (column-space). * * \param originalMatrix the original matrix, of which *this is the LU decomposition. * The reason why it is needed to pass it here, is that this allows * a large optimization, as otherwise this method would need to reconstruct it * from the LU decomposition. * * \note If the image has dimension zero, then the returned matrix is a column-vector filled with zeros. * * \note This method has to determine which pivots should be considered nonzero. * For that, it uses the threshold value that you can control by calling * setThreshold(const RealScalar&). * * Example: \include FullPivLU_image.cpp * Output: \verbinclude FullPivLU_image.out * * \sa kernel() */ inline const internal::image_retval image(const MatrixType& originalMatrix) const { eigen_assert(m_isInitialized && "LU is not initialized."); return internal::image_retval(*this, originalMatrix); } #ifdef EIGEN_PARSED_BY_DOXYGEN /** \return a solution x to the equation Ax=b, where A is the matrix of which * *this is the LU decomposition. * * \param b the right-hand-side of the equation to solve. Can be a vector or a matrix, * the only requirement in order for the equation to make sense is that * b.rows()==A.rows(), where A is the matrix of which *this is the LU decomposition. * * \returns a solution. * * \note_about_checking_solutions * * \note_about_arbitrary_choice_of_solution * \note_about_using_kernel_to_study_multiple_solutions * * Example: \include FullPivLU_solve.cpp * Output: \verbinclude FullPivLU_solve.out * * \sa TriangularView::solve(), kernel(), inverse() */ template inline const Solve solve(const MatrixBase& b) const; #endif /** \returns an estimate of the reciprocal condition number of the matrix of which \c *this is the LU decomposition. */ inline RealScalar rcond() const { eigen_assert(m_isInitialized && "PartialPivLU is not initialized."); return internal::rcond_estimate_helper(m_l1_norm, *this); } /** \returns the determinant of the matrix of which * *this is the LU decomposition. It has only linear complexity * (that is, O(n) where n is the dimension of the square matrix) * as the LU decomposition has already been computed. * * \note This is only for square matrices. * * \note For fixed-size matrices of size up to 4, MatrixBase::determinant() offers * optimized paths. * * \warning a determinant can be very big or small, so for matrices * of large enough dimension, there is a risk of overflow/underflow. * * \sa MatrixBase::determinant() */ typename internal::traits::Scalar determinant() const; /** Allows to prescribe a threshold to be used by certain methods, such as rank(), * who need to determine when pivots are to be considered nonzero. This is not used for the * LU decomposition itself. * * When it needs to get the threshold value, Eigen calls threshold(). By default, this * uses a formula to automatically determine a reasonable threshold. * Once you have called the present method setThreshold(const RealScalar&), * your value is used instead. * * \param threshold The new value to use as the threshold. * * A pivot will be considered nonzero if its absolute value is strictly greater than * \f$ \vert pivot \vert \leqslant threshold \times \vert maxpivot \vert \f$ * where maxpivot is the biggest pivot. * * If you want to come back to the default behavior, call setThreshold(Default_t) */ FullPivLU& setThreshold(const RealScalar& threshold) { m_usePrescribedThreshold = true; m_prescribedThreshold = threshold; return *this; } /** Allows to come back to the default behavior, letting Eigen use its default formula for * determining the threshold. * * You should pass the special object Eigen::Default as parameter here. * \code lu.setThreshold(Eigen::Default); \endcode * * See the documentation of setThreshold(const RealScalar&). */ FullPivLU& setThreshold(Default_t) { m_usePrescribedThreshold = false; return *this; } /** Returns the threshold that will be used by certain methods such as rank(). * * See the documentation of setThreshold(const RealScalar&). */ RealScalar threshold() const { eigen_assert(m_isInitialized || m_usePrescribedThreshold); return m_usePrescribedThreshold ? m_prescribedThreshold // this formula comes from experimenting (see "LU precision tuning" thread on the list) // and turns out to be identical to Higham's formula used already in LDLt. : NumTraits::epsilon() * RealScalar(m_lu.diagonalSize()); } /** \returns the rank of the matrix of which *this is the LU decomposition. * * \note This method has to determine which pivots should be considered nonzero. * For that, it uses the threshold value that you can control by calling * setThreshold(const RealScalar&). */ inline Index rank() const { using std::abs; eigen_assert(m_isInitialized && "LU is not initialized."); RealScalar premultiplied_threshold = abs(m_maxpivot) * threshold(); Index result = 0; for(Index i = 0; i < m_nonzero_pivots; ++i) result += (abs(m_lu.coeff(i,i)) > premultiplied_threshold); return result; } /** \returns the dimension of the kernel of the matrix of which *this is the LU decomposition. * * \note This method has to determine which pivots should be considered nonzero. * For that, it uses the threshold value that you can control by calling * setThreshold(const RealScalar&). */ inline Index dimensionOfKernel() const { eigen_assert(m_isInitialized && "LU is not initialized."); return cols() - rank(); } /** \returns true if the matrix of which *this is the LU decomposition represents an injective * linear map, i.e. has trivial kernel; false otherwise. * * \note This method has to determine which pivots should be considered nonzero. * For that, it uses the threshold value that you can control by calling * setThreshold(const RealScalar&). */ inline bool isInjective() const { eigen_assert(m_isInitialized && "LU is not initialized."); return rank() == cols(); } /** \returns true if the matrix of which *this is the LU decomposition represents a surjective * linear map; false otherwise. * * \note This method has to determine which pivots should be considered nonzero. * For that, it uses the threshold value that you can control by calling * setThreshold(const RealScalar&). */ inline bool isSurjective() const { eigen_assert(m_isInitialized && "LU is not initialized."); return rank() == rows(); } /** \returns true if the matrix of which *this is the LU decomposition is invertible. * * \note This method has to determine which pivots should be considered nonzero. * For that, it uses the threshold value that you can control by calling * setThreshold(const RealScalar&). */ inline bool isInvertible() const { eigen_assert(m_isInitialized && "LU is not initialized."); return isInjective() && (m_lu.rows() == m_lu.cols()); } /** \returns the inverse of the matrix of which *this is the LU decomposition. * * \note If this matrix is not invertible, the returned matrix has undefined coefficients. * Use isInvertible() to first determine whether this matrix is invertible. * * \sa MatrixBase::inverse() */ inline const Inverse inverse() const { eigen_assert(m_isInitialized && "LU is not initialized."); eigen_assert(m_lu.rows() == m_lu.cols() && "You can't take the inverse of a non-square matrix!"); return Inverse(*this); } MatrixType reconstructedMatrix() const; EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index rows() const EIGEN_NOEXCEPT { return m_lu.rows(); } EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index cols() const EIGEN_NOEXCEPT { return m_lu.cols(); } #ifndef EIGEN_PARSED_BY_DOXYGEN template void _solve_impl(const RhsType &rhs, DstType &dst) const; template void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const; #endif protected: static void check_template_parameters() { EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); } void computeInPlace(); MatrixType m_lu; PermutationPType m_p; PermutationQType m_q; IntColVectorType m_rowsTranspositions; IntRowVectorType m_colsTranspositions; Index m_nonzero_pivots; RealScalar m_l1_norm; RealScalar m_maxpivot, m_prescribedThreshold; signed char m_det_pq; bool m_isInitialized, m_usePrescribedThreshold; }; template FullPivLU::FullPivLU() : m_isInitialized(false), m_usePrescribedThreshold(false) { } template FullPivLU::FullPivLU(Index rows, Index cols) : m_lu(rows, cols), m_p(rows), m_q(cols), m_rowsTranspositions(rows), m_colsTranspositions(cols), m_isInitialized(false), m_usePrescribedThreshold(false) { } template template FullPivLU::FullPivLU(const EigenBase& matrix) : m_lu(matrix.rows(), matrix.cols()), m_p(matrix.rows()), m_q(matrix.cols()), m_rowsTranspositions(matrix.rows()), m_colsTranspositions(matrix.cols()), m_isInitialized(false), m_usePrescribedThreshold(false) { compute(matrix.derived()); } template template FullPivLU::FullPivLU(EigenBase& matrix) : m_lu(matrix.derived()), m_p(matrix.rows()), m_q(matrix.cols()), m_rowsTranspositions(matrix.rows()), m_colsTranspositions(matrix.cols()), m_isInitialized(false), m_usePrescribedThreshold(false) { computeInPlace(); } template void FullPivLU::computeInPlace() { check_template_parameters(); // the permutations are stored as int indices, so just to be sure: eigen_assert(m_lu.rows()<=NumTraits::highest() && m_lu.cols()<=NumTraits::highest()); m_l1_norm = m_lu.cwiseAbs().colwise().sum().maxCoeff(); const Index size = m_lu.diagonalSize(); const Index rows = m_lu.rows(); const Index cols = m_lu.cols(); // will store the transpositions, before we accumulate them at the end. // can't accumulate on-the-fly because that will be done in reverse order for the rows. m_rowsTranspositions.resize(m_lu.rows()); m_colsTranspositions.resize(m_lu.cols()); Index number_of_transpositions = 0; // number of NONTRIVIAL transpositions, i.e. m_rowsTranspositions[i]!=i m_nonzero_pivots = size; // the generic case is that in which all pivots are nonzero (invertible case) m_maxpivot = RealScalar(0); for(Index k = 0; k < size; ++k) { // First, we need to find the pivot. // biggest coefficient in the remaining bottom-right corner (starting at row k, col k) Index row_of_biggest_in_corner, col_of_biggest_in_corner; typedef internal::scalar_score_coeff_op Scoring; typedef typename Scoring::result_type Score; Score biggest_in_corner; biggest_in_corner = m_lu.bottomRightCorner(rows-k, cols-k) .unaryExpr(Scoring()) .maxCoeff(&row_of_biggest_in_corner, &col_of_biggest_in_corner); row_of_biggest_in_corner += k; // correct the values! since they were computed in the corner, col_of_biggest_in_corner += k; // need to add k to them. if(biggest_in_corner==Score(0)) { // before exiting, make sure to initialize the still uninitialized transpositions // in a sane state without destroying what we already have. m_nonzero_pivots = k; for(Index i = k; i < size; ++i) { m_rowsTranspositions.coeffRef(i) = internal::convert_index(i); m_colsTranspositions.coeffRef(i) = internal::convert_index(i); } break; } RealScalar abs_pivot = internal::abs_knowing_score()(m_lu(row_of_biggest_in_corner, col_of_biggest_in_corner), biggest_in_corner); if(abs_pivot > m_maxpivot) m_maxpivot = abs_pivot; // Now that we've found the pivot, we need to apply the row/col swaps to // bring it to the location (k,k). m_rowsTranspositions.coeffRef(k) = internal::convert_index(row_of_biggest_in_corner); m_colsTranspositions.coeffRef(k) = internal::convert_index(col_of_biggest_in_corner); if(k != row_of_biggest_in_corner) { m_lu.row(k).swap(m_lu.row(row_of_biggest_in_corner)); ++number_of_transpositions; } if(k != col_of_biggest_in_corner) { m_lu.col(k).swap(m_lu.col(col_of_biggest_in_corner)); ++number_of_transpositions; } // Now that the pivot is at the right location, we update the remaining // bottom-right corner by Gaussian elimination. if(k= 0; --k) m_p.applyTranspositionOnTheRight(k, m_rowsTranspositions.coeff(k)); m_q.setIdentity(cols); for(Index k = 0; k < size; ++k) m_q.applyTranspositionOnTheRight(k, m_colsTranspositions.coeff(k)); m_det_pq = (number_of_transpositions%2) ? -1 : 1; m_isInitialized = true; } template typename internal::traits::Scalar FullPivLU::determinant() const { eigen_assert(m_isInitialized && "LU is not initialized."); eigen_assert(m_lu.rows() == m_lu.cols() && "You can't take the determinant of a non-square matrix!"); return Scalar(m_det_pq) * Scalar(m_lu.diagonal().prod()); } /** \returns the matrix represented by the decomposition, * i.e., it returns the product: \f$ P^{-1} L U Q^{-1} \f$. * This function is provided for debug purposes. */ template MatrixType FullPivLU::reconstructedMatrix() const { eigen_assert(m_isInitialized && "LU is not initialized."); const Index smalldim = (std::min)(m_lu.rows(), m_lu.cols()); // LU MatrixType res(m_lu.rows(),m_lu.cols()); // FIXME the .toDenseMatrix() should not be needed... res = m_lu.leftCols(smalldim) .template triangularView().toDenseMatrix() * m_lu.topRows(smalldim) .template triangularView().toDenseMatrix(); // P^{-1}(LU) res = m_p.inverse() * res; // (P^{-1}LU)Q^{-1} res = res * m_q.inverse(); return res; } /********* Implementation of kernel() **************************************************/ namespace internal { template struct kernel_retval > : kernel_retval_base > { EIGEN_MAKE_KERNEL_HELPERS(FullPivLU) enum { MaxSmallDimAtCompileTime = EIGEN_SIZE_MIN_PREFER_FIXED( MatrixType::MaxColsAtCompileTime, MatrixType::MaxRowsAtCompileTime) }; template void evalTo(Dest& dst) const { using std::abs; const Index cols = dec().matrixLU().cols(), dimker = cols - rank(); if(dimker == 0) { // The Kernel is just {0}, so it doesn't have a basis properly speaking, but let's // avoid crashing/asserting as that depends on floating point calculations. Let's // just return a single column vector filled with zeros. dst.setZero(); return; } /* Let us use the following lemma: * * Lemma: If the matrix A has the LU decomposition PAQ = LU, * then Ker A = Q(Ker U). * * Proof: trivial: just keep in mind that P, Q, L are invertible. */ /* Thus, all we need to do is to compute Ker U, and then apply Q. * * U is upper triangular, with eigenvalues sorted so that any zeros appear at the end. * Thus, the diagonal of U ends with exactly * dimKer zero's. Let us use that to construct dimKer linearly * independent vectors in Ker U. */ Matrix pivots(rank()); RealScalar premultiplied_threshold = dec().maxPivot() * dec().threshold(); Index p = 0; for(Index i = 0; i < dec().nonzeroPivots(); ++i) if(abs(dec().matrixLU().coeff(i,i)) > premultiplied_threshold) pivots.coeffRef(p++) = i; eigen_internal_assert(p == rank()); // we construct a temporaty trapezoid matrix m, by taking the U matrix and // permuting the rows and cols to bring the nonnegligible pivots to the top of // the main diagonal. We need that to be able to apply our triangular solvers. // FIXME when we get triangularView-for-rectangular-matrices, this can be simplified Matrix m(dec().matrixLU().block(0, 0, rank(), cols)); for(Index i = 0; i < rank(); ++i) { if(i) m.row(i).head(i).setZero(); m.row(i).tail(cols-i) = dec().matrixLU().row(pivots.coeff(i)).tail(cols-i); } m.block(0, 0, rank(), rank()); m.block(0, 0, rank(), rank()).template triangularView().setZero(); for(Index i = 0; i < rank(); ++i) m.col(i).swap(m.col(pivots.coeff(i))); // ok, we have our trapezoid matrix, we can apply the triangular solver. // notice that the math behind this suggests that we should apply this to the // negative of the RHS, but for performance we just put the negative sign elsewhere, see below. m.topLeftCorner(rank(), rank()) .template triangularView().solveInPlace( m.topRightCorner(rank(), dimker) ); // now we must undo the column permutation that we had applied! for(Index i = rank()-1; i >= 0; --i) m.col(i).swap(m.col(pivots.coeff(i))); // see the negative sign in the next line, that's what we were talking about above. for(Index i = 0; i < rank(); ++i) dst.row(dec().permutationQ().indices().coeff(i)) = -m.row(i).tail(dimker); for(Index i = rank(); i < cols; ++i) dst.row(dec().permutationQ().indices().coeff(i)).setZero(); for(Index k = 0; k < dimker; ++k) dst.coeffRef(dec().permutationQ().indices().coeff(rank()+k), k) = Scalar(1); } }; /***** Implementation of image() *****************************************************/ template struct image_retval > : image_retval_base > { EIGEN_MAKE_IMAGE_HELPERS(FullPivLU) enum { MaxSmallDimAtCompileTime = EIGEN_SIZE_MIN_PREFER_FIXED( MatrixType::MaxColsAtCompileTime, MatrixType::MaxRowsAtCompileTime) }; template void evalTo(Dest& dst) const { using std::abs; if(rank() == 0) { // The Image is just {0}, so it doesn't have a basis properly speaking, but let's // avoid crashing/asserting as that depends on floating point calculations. Let's // just return a single column vector filled with zeros. dst.setZero(); return; } Matrix pivots(rank()); RealScalar premultiplied_threshold = dec().maxPivot() * dec().threshold(); Index p = 0; for(Index i = 0; i < dec().nonzeroPivots(); ++i) if(abs(dec().matrixLU().coeff(i,i)) > premultiplied_threshold) pivots.coeffRef(p++) = i; eigen_internal_assert(p == rank()); for(Index i = 0; i < rank(); ++i) dst.col(i) = originalMatrix().col(dec().permutationQ().indices().coeff(pivots.coeff(i))); } }; /***** Implementation of solve() *****************************************************/ } // end namespace internal #ifndef EIGEN_PARSED_BY_DOXYGEN template template void FullPivLU::_solve_impl(const RhsType &rhs, DstType &dst) const { /* The decomposition PAQ = LU can be rewritten as A = P^{-1} L U Q^{-1}. * So we proceed as follows: * Step 1: compute c = P * rhs. * Step 2: replace c by the solution x to Lx = c. Exists because L is invertible. * Step 3: replace c by the solution x to Ux = c. May or may not exist. * Step 4: result = Q * c; */ const Index rows = this->rows(), cols = this->cols(), nonzero_pivots = this->rank(); const Index smalldim = (std::min)(rows, cols); if(nonzero_pivots == 0) { dst.setZero(); return; } typename RhsType::PlainObject c(rhs.rows(), rhs.cols()); // Step 1 c = permutationP() * rhs; // Step 2 m_lu.topLeftCorner(smalldim,smalldim) .template triangularView() .solveInPlace(c.topRows(smalldim)); if(rows>cols) c.bottomRows(rows-cols) -= m_lu.bottomRows(rows-cols) * c.topRows(cols); // Step 3 m_lu.topLeftCorner(nonzero_pivots, nonzero_pivots) .template triangularView() .solveInPlace(c.topRows(nonzero_pivots)); // Step 4 for(Index i = 0; i < nonzero_pivots; ++i) dst.row(permutationQ().indices().coeff(i)) = c.row(i); for(Index i = nonzero_pivots; i < m_lu.cols(); ++i) dst.row(permutationQ().indices().coeff(i)).setZero(); } template template void FullPivLU::_solve_impl_transposed(const RhsType &rhs, DstType &dst) const { /* The decomposition PAQ = LU can be rewritten as A = P^{-1} L U Q^{-1}, * and since permutations are real and unitary, we can write this * as A^T = Q U^T L^T P, * So we proceed as follows: * Step 1: compute c = Q^T rhs. * Step 2: replace c by the solution x to U^T x = c. May or may not exist. * Step 3: replace c by the solution x to L^T x = c. * Step 4: result = P^T c. * If Conjugate is true, replace "^T" by "^*" above. */ const Index rows = this->rows(), cols = this->cols(), nonzero_pivots = this->rank(); const Index smalldim = (std::min)(rows, cols); if(nonzero_pivots == 0) { dst.setZero(); return; } typename RhsType::PlainObject c(rhs.rows(), rhs.cols()); // Step 1 c = permutationQ().inverse() * rhs; // Step 2 m_lu.topLeftCorner(nonzero_pivots, nonzero_pivots) .template triangularView() .transpose() .template conjugateIf() .solveInPlace(c.topRows(nonzero_pivots)); // Step 3 m_lu.topLeftCorner(smalldim, smalldim) .template triangularView() .transpose() .template conjugateIf() .solveInPlace(c.topRows(smalldim)); // Step 4 PermutationPType invp = permutationP().inverse().eval(); for(Index i = 0; i < smalldim; ++i) dst.row(invp.indices().coeff(i)) = c.row(i); for(Index i = smalldim; i < rows; ++i) dst.row(invp.indices().coeff(i)).setZero(); } #endif namespace internal { /***** Implementation of inverse() *****************************************************/ template struct Assignment >, internal::assign_op::Scalar>, Dense2Dense> { typedef FullPivLU LuType; typedef Inverse SrcXprType; static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &) { dst = src.nestedExpression().solve(MatrixType::Identity(src.rows(), src.cols())); } }; } // end namespace internal /******* MatrixBase methods *****************************************************************/ /** \lu_module * * \return the full-pivoting LU decomposition of \c *this. * * \sa class FullPivLU */ template inline const FullPivLU::PlainObject> MatrixBase::fullPivLu() const { return FullPivLU(eval()); } } // end namespace Eigen #endif // EIGEN_LU_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/LU/InverseImpl.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2010 Benoit Jacob // Copyright (C) 2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_INVERSE_IMPL_H #define EIGEN_INVERSE_IMPL_H namespace Eigen { namespace internal { /********************************** *** General case implementation *** **********************************/ template struct compute_inverse { EIGEN_DEVICE_FUNC static inline void run(const MatrixType& matrix, ResultType& result) { result = matrix.partialPivLu().inverse(); } }; template struct compute_inverse_and_det_with_check { /* nothing! general case not supported. */ }; /**************************** *** Size 1 implementation *** ****************************/ template struct compute_inverse { EIGEN_DEVICE_FUNC static inline void run(const MatrixType& matrix, ResultType& result) { typedef typename MatrixType::Scalar Scalar; internal::evaluator matrixEval(matrix); result.coeffRef(0,0) = Scalar(1) / matrixEval.coeff(0,0); } }; template struct compute_inverse_and_det_with_check { EIGEN_DEVICE_FUNC static inline void run( const MatrixType& matrix, const typename MatrixType::RealScalar& absDeterminantThreshold, ResultType& result, typename ResultType::Scalar& determinant, bool& invertible ) { using std::abs; determinant = matrix.coeff(0,0); invertible = abs(determinant) > absDeterminantThreshold; if(invertible) result.coeffRef(0,0) = typename ResultType::Scalar(1) / determinant; } }; /**************************** *** Size 2 implementation *** ****************************/ template EIGEN_DEVICE_FUNC inline void compute_inverse_size2_helper( const MatrixType& matrix, const typename ResultType::Scalar& invdet, ResultType& result) { typename ResultType::Scalar temp = matrix.coeff(0,0); result.coeffRef(0,0) = matrix.coeff(1,1) * invdet; result.coeffRef(1,0) = -matrix.coeff(1,0) * invdet; result.coeffRef(0,1) = -matrix.coeff(0,1) * invdet; result.coeffRef(1,1) = temp * invdet; } template struct compute_inverse { EIGEN_DEVICE_FUNC static inline void run(const MatrixType& matrix, ResultType& result) { typedef typename ResultType::Scalar Scalar; const Scalar invdet = typename MatrixType::Scalar(1) / matrix.determinant(); compute_inverse_size2_helper(matrix, invdet, result); } }; template struct compute_inverse_and_det_with_check { EIGEN_DEVICE_FUNC static inline void run( const MatrixType& matrix, const typename MatrixType::RealScalar& absDeterminantThreshold, ResultType& inverse, typename ResultType::Scalar& determinant, bool& invertible ) { using std::abs; typedef typename ResultType::Scalar Scalar; determinant = matrix.determinant(); invertible = abs(determinant) > absDeterminantThreshold; if(!invertible) return; const Scalar invdet = Scalar(1) / determinant; compute_inverse_size2_helper(matrix, invdet, inverse); } }; /**************************** *** Size 3 implementation *** ****************************/ template EIGEN_DEVICE_FUNC inline typename MatrixType::Scalar cofactor_3x3(const MatrixType& m) { enum { i1 = (i+1) % 3, i2 = (i+2) % 3, j1 = (j+1) % 3, j2 = (j+2) % 3 }; return m.coeff(i1, j1) * m.coeff(i2, j2) - m.coeff(i1, j2) * m.coeff(i2, j1); } template EIGEN_DEVICE_FUNC inline void compute_inverse_size3_helper( const MatrixType& matrix, const typename ResultType::Scalar& invdet, const Matrix& cofactors_col0, ResultType& result) { // Compute cofactors in a way that avoids aliasing issues. typedef typename ResultType::Scalar Scalar; const Scalar c01 = cofactor_3x3(matrix) * invdet; const Scalar c11 = cofactor_3x3(matrix) * invdet; const Scalar c02 = cofactor_3x3(matrix) * invdet; result.coeffRef(1,2) = cofactor_3x3(matrix) * invdet; result.coeffRef(2,1) = cofactor_3x3(matrix) * invdet; result.coeffRef(2,2) = cofactor_3x3(matrix) * invdet; result.coeffRef(1,0) = c01; result.coeffRef(1,1) = c11; result.coeffRef(2,0) = c02; result.row(0) = cofactors_col0 * invdet; } template struct compute_inverse { EIGEN_DEVICE_FUNC static inline void run(const MatrixType& matrix, ResultType& result) { typedef typename ResultType::Scalar Scalar; Matrix cofactors_col0; cofactors_col0.coeffRef(0) = cofactor_3x3(matrix); cofactors_col0.coeffRef(1) = cofactor_3x3(matrix); cofactors_col0.coeffRef(2) = cofactor_3x3(matrix); const Scalar det = (cofactors_col0.cwiseProduct(matrix.col(0))).sum(); const Scalar invdet = Scalar(1) / det; compute_inverse_size3_helper(matrix, invdet, cofactors_col0, result); } }; template struct compute_inverse_and_det_with_check { EIGEN_DEVICE_FUNC static inline void run( const MatrixType& matrix, const typename MatrixType::RealScalar& absDeterminantThreshold, ResultType& inverse, typename ResultType::Scalar& determinant, bool& invertible ) { typedef typename ResultType::Scalar Scalar; Matrix cofactors_col0; cofactors_col0.coeffRef(0) = cofactor_3x3(matrix); cofactors_col0.coeffRef(1) = cofactor_3x3(matrix); cofactors_col0.coeffRef(2) = cofactor_3x3(matrix); determinant = (cofactors_col0.cwiseProduct(matrix.col(0))).sum(); invertible = Eigen::numext::abs(determinant) > absDeterminantThreshold; if(!invertible) return; const Scalar invdet = Scalar(1) / determinant; compute_inverse_size3_helper(matrix, invdet, cofactors_col0, inverse); } }; /**************************** *** Size 4 implementation *** ****************************/ template EIGEN_DEVICE_FUNC inline const typename Derived::Scalar general_det3_helper (const MatrixBase& matrix, int i1, int i2, int i3, int j1, int j2, int j3) { return matrix.coeff(i1,j1) * (matrix.coeff(i2,j2) * matrix.coeff(i3,j3) - matrix.coeff(i2,j3) * matrix.coeff(i3,j2)); } template EIGEN_DEVICE_FUNC inline typename MatrixType::Scalar cofactor_4x4(const MatrixType& matrix) { enum { i1 = (i+1) % 4, i2 = (i+2) % 4, i3 = (i+3) % 4, j1 = (j+1) % 4, j2 = (j+2) % 4, j3 = (j+3) % 4 }; return general_det3_helper(matrix, i1, i2, i3, j1, j2, j3) + general_det3_helper(matrix, i2, i3, i1, j1, j2, j3) + general_det3_helper(matrix, i3, i1, i2, j1, j2, j3); } template struct compute_inverse_size4 { EIGEN_DEVICE_FUNC static void run(const MatrixType& matrix, ResultType& result) { result.coeffRef(0,0) = cofactor_4x4(matrix); result.coeffRef(1,0) = -cofactor_4x4(matrix); result.coeffRef(2,0) = cofactor_4x4(matrix); result.coeffRef(3,0) = -cofactor_4x4(matrix); result.coeffRef(0,2) = cofactor_4x4(matrix); result.coeffRef(1,2) = -cofactor_4x4(matrix); result.coeffRef(2,2) = cofactor_4x4(matrix); result.coeffRef(3,2) = -cofactor_4x4(matrix); result.coeffRef(0,1) = -cofactor_4x4(matrix); result.coeffRef(1,1) = cofactor_4x4(matrix); result.coeffRef(2,1) = -cofactor_4x4(matrix); result.coeffRef(3,1) = cofactor_4x4(matrix); result.coeffRef(0,3) = -cofactor_4x4(matrix); result.coeffRef(1,3) = cofactor_4x4(matrix); result.coeffRef(2,3) = -cofactor_4x4(matrix); result.coeffRef(3,3) = cofactor_4x4(matrix); result /= (matrix.col(0).cwiseProduct(result.row(0).transpose())).sum(); } }; template struct compute_inverse : compute_inverse_size4 { }; template struct compute_inverse_and_det_with_check { EIGEN_DEVICE_FUNC static inline void run( const MatrixType& matrix, const typename MatrixType::RealScalar& absDeterminantThreshold, ResultType& inverse, typename ResultType::Scalar& determinant, bool& invertible ) { using std::abs; determinant = matrix.determinant(); invertible = abs(determinant) > absDeterminantThreshold; if(invertible && extract_data(matrix) != extract_data(inverse)) { compute_inverse::run(matrix, inverse); } else if(invertible) { MatrixType matrix_t = matrix; compute_inverse::run(matrix_t, inverse); } } }; /************************* *** MatrixBase methods *** *************************/ } // end namespace internal namespace internal { // Specialization for "dense = dense_xpr.inverse()" template struct Assignment, internal::assign_op, Dense2Dense> { typedef Inverse SrcXprType; EIGEN_DEVICE_FUNC static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &) { Index dstRows = src.rows(); Index dstCols = src.cols(); if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) dst.resize(dstRows, dstCols); const int Size = EIGEN_PLAIN_ENUM_MIN(XprType::ColsAtCompileTime,DstXprType::ColsAtCompileTime); EIGEN_ONLY_USED_FOR_DEBUG(Size); eigen_assert(( (Size<=1) || (Size>4) || (extract_data(src.nestedExpression())!=extract_data(dst))) && "Aliasing problem detected in inverse(), you need to do inverse().eval() here."); typedef typename internal::nested_eval::type ActualXprType; typedef typename internal::remove_all::type ActualXprTypeCleanded; ActualXprType actual_xpr(src.nestedExpression()); compute_inverse::run(actual_xpr, dst); } }; } // end namespace internal /** \lu_module * * \returns the matrix inverse of this matrix. * * For small fixed sizes up to 4x4, this method uses cofactors. * In the general case, this method uses class PartialPivLU. * * \note This matrix must be invertible, otherwise the result is undefined. If you need an * invertibility check, do the following: * \li for fixed sizes up to 4x4, use computeInverseAndDetWithCheck(). * \li for the general case, use class FullPivLU. * * Example: \include MatrixBase_inverse.cpp * Output: \verbinclude MatrixBase_inverse.out * * \sa computeInverseAndDetWithCheck() */ template EIGEN_DEVICE_FUNC inline const Inverse MatrixBase::inverse() const { EIGEN_STATIC_ASSERT(!NumTraits::IsInteger,THIS_FUNCTION_IS_NOT_FOR_INTEGER_NUMERIC_TYPES) eigen_assert(rows() == cols()); return Inverse(derived()); } /** \lu_module * * Computation of matrix inverse and determinant, with invertibility check. * * This is only for fixed-size square matrices of size up to 4x4. * * Notice that it will trigger a copy of input matrix when trying to do the inverse in place. * * \param inverse Reference to the matrix in which to store the inverse. * \param determinant Reference to the variable in which to store the determinant. * \param invertible Reference to the bool variable in which to store whether the matrix is invertible. * \param absDeterminantThreshold Optional parameter controlling the invertibility check. * The matrix will be declared invertible if the absolute value of its * determinant is greater than this threshold. * * Example: \include MatrixBase_computeInverseAndDetWithCheck.cpp * Output: \verbinclude MatrixBase_computeInverseAndDetWithCheck.out * * \sa inverse(), computeInverseWithCheck() */ template template inline void MatrixBase::computeInverseAndDetWithCheck( ResultType& inverse, typename ResultType::Scalar& determinant, bool& invertible, const RealScalar& absDeterminantThreshold ) const { // i'd love to put some static assertions there, but SFINAE means that they have no effect... eigen_assert(rows() == cols()); // for 2x2, it's worth giving a chance to avoid evaluating. // for larger sizes, evaluating has negligible cost and limits code size. typedef typename internal::conditional< RowsAtCompileTime == 2, typename internal::remove_all::type>::type, PlainObject >::type MatrixType; internal::compute_inverse_and_det_with_check::run (derived(), absDeterminantThreshold, inverse, determinant, invertible); } /** \lu_module * * Computation of matrix inverse, with invertibility check. * * This is only for fixed-size square matrices of size up to 4x4. * * Notice that it will trigger a copy of input matrix when trying to do the inverse in place. * * \param inverse Reference to the matrix in which to store the inverse. * \param invertible Reference to the bool variable in which to store whether the matrix is invertible. * \param absDeterminantThreshold Optional parameter controlling the invertibility check. * The matrix will be declared invertible if the absolute value of its * determinant is greater than this threshold. * * Example: \include MatrixBase_computeInverseWithCheck.cpp * Output: \verbinclude MatrixBase_computeInverseWithCheck.out * * \sa inverse(), computeInverseAndDetWithCheck() */ template template inline void MatrixBase::computeInverseWithCheck( ResultType& inverse, bool& invertible, const RealScalar& absDeterminantThreshold ) const { Scalar determinant; // i'd love to put some static assertions there, but SFINAE means that they have no effect... eigen_assert(rows() == cols()); computeInverseAndDetWithCheck(inverse,determinant,invertible,absDeterminantThreshold); } } // end namespace Eigen #endif // EIGEN_INVERSE_IMPL_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/LU/PartialPivLU.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2006-2009 Benoit Jacob // Copyright (C) 2009 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_PARTIALLU_H #define EIGEN_PARTIALLU_H namespace Eigen { namespace internal { template struct traits > : traits { typedef MatrixXpr XprKind; typedef SolverStorage StorageKind; typedef int StorageIndex; typedef traits BaseTraits; enum { Flags = BaseTraits::Flags & RowMajorBit, CoeffReadCost = Dynamic }; }; template struct enable_if_ref; // { // typedef Derived type; // }; template struct enable_if_ref,Derived> { typedef Derived type; }; } // end namespace internal /** \ingroup LU_Module * * \class PartialPivLU * * \brief LU decomposition of a matrix with partial pivoting, and related features * * \tparam MatrixType_ the type of the matrix of which we are computing the LU decomposition * * This class represents a LU decomposition of a \b square \b invertible matrix, with partial pivoting: the matrix A * is decomposed as A = PLU where L is unit-lower-triangular, U is upper-triangular, and P * is a permutation matrix. * * Typically, partial pivoting LU decomposition is only considered numerically stable for square invertible * matrices. Thus LAPACK's dgesv and dgesvx require the matrix to be square and invertible. The present class * does the same. It will assert that the matrix is square, but it won't (actually it can't) check that the * matrix is invertible: it is your task to check that you only use this decomposition on invertible matrices. * * The guaranteed safe alternative, working for all matrices, is the full pivoting LU decomposition, provided * by class FullPivLU. * * This is \b not a rank-revealing LU decomposition. Many features are intentionally absent from this class, * such as rank computation. If you need these features, use class FullPivLU. * * This LU decomposition is suitable to invert invertible matrices. It is what MatrixBase::inverse() uses * in the general case. * On the other hand, it is \b not suitable to determine whether a given matrix is invertible. * * The data of the LU decomposition can be directly accessed through the methods matrixLU(), permutationP(). * * This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism. * * \sa MatrixBase::partialPivLu(), MatrixBase::determinant(), MatrixBase::inverse(), MatrixBase::computeInverse(), class FullPivLU */ template class PartialPivLU : public SolverBase > { public: typedef MatrixType_ MatrixType; typedef SolverBase Base; friend class SolverBase; EIGEN_GENERIC_PUBLIC_INTERFACE(PartialPivLU) enum { MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; typedef PermutationMatrix PermutationType; typedef Transpositions TranspositionType; typedef typename MatrixType::PlainObject PlainObject; /** * \brief Default Constructor. * * The default constructor is useful in cases in which the user intends to * perform decompositions via PartialPivLU::compute(const MatrixType&). */ PartialPivLU(); /** \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 PartialPivLU() */ explicit PartialPivLU(Index size); /** Constructor. * * \param matrix the matrix of which to compute the LU decomposition. * * \warning The matrix should have full rank (e.g. if it's square, it should be invertible). * If you need to deal with non-full rank, use class FullPivLU instead. */ template explicit PartialPivLU(const EigenBase& matrix); /** Constructor for \link InplaceDecomposition inplace decomposition \endlink * * \param matrix the matrix of which to compute the LU decomposition. * * \warning The matrix should have full rank (e.g. if it's square, it should be invertible). * If you need to deal with non-full rank, use class FullPivLU instead. */ template explicit PartialPivLU(EigenBase& matrix); template PartialPivLU& compute(const EigenBase& matrix) { m_lu = matrix.derived(); compute(); return *this; } /** \returns the LU decomposition matrix: the upper-triangular part is U, the * unit-lower-triangular part is L (at least for square matrices; in the non-square * case, special care is needed, see the documentation of class FullPivLU). * * \sa matrixL(), matrixU() */ inline const MatrixType& matrixLU() const { eigen_assert(m_isInitialized && "PartialPivLU is not initialized."); return m_lu; } /** \returns the permutation matrix P. */ inline const PermutationType& permutationP() const { eigen_assert(m_isInitialized && "PartialPivLU is not initialized."); return m_p; } #ifdef EIGEN_PARSED_BY_DOXYGEN /** This method returns the solution x to the equation Ax=b, where A is the matrix of which * *this is the LU decomposition. * * \param b the right-hand-side of the equation to solve. Can be a vector or a matrix, * the only requirement in order for the equation to make sense is that * b.rows()==A.rows(), where A is the matrix of which *this is the LU decomposition. * * \returns the solution. * * Example: \include PartialPivLU_solve.cpp * Output: \verbinclude PartialPivLU_solve.out * * Since this PartialPivLU class assumes anyway that the matrix A is invertible, the solution * theoretically exists and is unique regardless of b. * * \sa TriangularView::solve(), inverse(), computeInverse() */ template inline const Solve solve(const MatrixBase& b) const; #endif /** \returns an estimate of the reciprocal condition number of the matrix of which \c *this is the LU decomposition. */ inline RealScalar rcond() const { eigen_assert(m_isInitialized && "PartialPivLU is not initialized."); return internal::rcond_estimate_helper(m_l1_norm, *this); } /** \returns the inverse of the matrix of which *this is the LU decomposition. * * \warning The matrix being decomposed here is assumed to be invertible. If you need to check for * invertibility, use class FullPivLU instead. * * \sa MatrixBase::inverse(), LU::inverse() */ inline const Inverse inverse() const { eigen_assert(m_isInitialized && "PartialPivLU is not initialized."); return Inverse(*this); } /** \returns the determinant of the matrix of which * *this is the LU decomposition. It has only linear complexity * (that is, O(n) where n is the dimension of the square matrix) * as the LU decomposition has already been computed. * * \note For fixed-size matrices of size up to 4, MatrixBase::determinant() offers * optimized paths. * * \warning a determinant can be very big or small, so for matrices * of large enough dimension, there is a risk of overflow/underflow. * * \sa MatrixBase::determinant() */ Scalar determinant() const; MatrixType reconstructedMatrix() const; EIGEN_CONSTEXPR inline Index rows() const EIGEN_NOEXCEPT { return m_lu.rows(); } EIGEN_CONSTEXPR inline Index cols() const EIGEN_NOEXCEPT { return m_lu.cols(); } #ifndef EIGEN_PARSED_BY_DOXYGEN template EIGEN_DEVICE_FUNC void _solve_impl(const RhsType &rhs, DstType &dst) const { /* The decomposition PA = LU can be rewritten as A = P^{-1} L U. * So we proceed as follows: * Step 1: compute c = Pb. * Step 2: replace c by the solution x to Lx = c. * Step 3: replace c by the solution x to Ux = c. */ // Step 1 dst = permutationP() * rhs; // Step 2 m_lu.template triangularView().solveInPlace(dst); // Step 3 m_lu.template triangularView().solveInPlace(dst); } template EIGEN_DEVICE_FUNC void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const { /* The decomposition PA = LU can be rewritten as A^T = U^T L^T P. * So we proceed as follows: * Step 1: compute c as the solution to L^T c = b * Step 2: replace c by the solution x to U^T x = c. * Step 3: update c = P^-1 c. */ eigen_assert(rhs.rows() == m_lu.cols()); // Step 1 dst = m_lu.template triangularView().transpose() .template conjugateIf().solve(rhs); // Step 2 m_lu.template triangularView().transpose() .template conjugateIf().solveInPlace(dst); // Step 3 dst = permutationP().transpose() * dst; } #endif protected: static void check_template_parameters() { EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); } void compute(); MatrixType m_lu; PermutationType m_p; TranspositionType m_rowsTranspositions; RealScalar m_l1_norm; signed char m_det_p; bool m_isInitialized; }; template PartialPivLU::PartialPivLU() : m_lu(), m_p(), m_rowsTranspositions(), m_l1_norm(0), m_det_p(0), m_isInitialized(false) { } template PartialPivLU::PartialPivLU(Index size) : m_lu(size, size), m_p(size), m_rowsTranspositions(size), m_l1_norm(0), m_det_p(0), m_isInitialized(false) { } template template PartialPivLU::PartialPivLU(const EigenBase& matrix) : m_lu(matrix.rows(),matrix.cols()), m_p(matrix.rows()), m_rowsTranspositions(matrix.rows()), m_l1_norm(0), m_det_p(0), m_isInitialized(false) { compute(matrix.derived()); } template template PartialPivLU::PartialPivLU(EigenBase& matrix) : m_lu(matrix.derived()), m_p(matrix.rows()), m_rowsTranspositions(matrix.rows()), m_l1_norm(0), m_det_p(0), m_isInitialized(false) { compute(); } namespace internal { /** \internal This is the blocked version of fullpivlu_unblocked() */ template struct partial_lu_impl { static const int UnBlockedBound = 16; static const bool UnBlockedAtCompileTime = SizeAtCompileTime!=Dynamic && SizeAtCompileTime<=UnBlockedBound; static const int ActualSizeAtCompileTime = UnBlockedAtCompileTime ? SizeAtCompileTime : Dynamic; // Remaining rows and columns at compile-time: static const int RRows = SizeAtCompileTime==2 ? 1 : Dynamic; static const int RCols = SizeAtCompileTime==2 ? 1 : Dynamic; typedef Matrix MatrixType; typedef Ref MatrixTypeRef; typedef Ref > BlockType; typedef typename MatrixType::RealScalar RealScalar; /** \internal performs the LU decomposition in-place of the matrix \a lu * using an unblocked algorithm. * * In addition, this function returns the row transpositions in the * vector \a row_transpositions which must have a size equal to the number * of columns of the matrix \a lu, and an integer \a nb_transpositions * which returns the actual number of transpositions. * * \returns The index of the first pivot which is exactly zero if any, or a negative number otherwise. */ static Index unblocked_lu(MatrixTypeRef& lu, PivIndex* row_transpositions, PivIndex& nb_transpositions) { typedef scalar_score_coeff_op Scoring; typedef typename Scoring::result_type Score; const Index rows = lu.rows(); const Index cols = lu.cols(); const Index size = (std::min)(rows,cols); // For small compile-time matrices it is worth processing the last row separately: // speedup: +100% for 2x2, +10% for others. const Index endk = UnBlockedAtCompileTime ? size-1 : size; nb_transpositions = 0; Index first_zero_pivot = -1; for(Index k = 0; k < endk; ++k) { int rrows = internal::convert_index(rows-k-1); int rcols = internal::convert_index(cols-k-1); Index row_of_biggest_in_col; Score biggest_in_corner = lu.col(k).tail(rows-k).unaryExpr(Scoring()).maxCoeff(&row_of_biggest_in_col); row_of_biggest_in_col += k; row_transpositions[k] = PivIndex(row_of_biggest_in_col); if(biggest_in_corner != Score(0)) { if(k != row_of_biggest_in_col) { lu.row(k).swap(lu.row(row_of_biggest_in_col)); ++nb_transpositions; } lu.col(k).tail(fix(rrows)) /= lu.coeff(k,k); } else if(first_zero_pivot==-1) { // the pivot is exactly zero, we record the index of the first pivot which is exactly 0, // and continue the factorization such we still have A = PLU first_zero_pivot = k; } if(k(rrows),fix(rcols)).noalias() -= lu.col(k).tail(fix(rrows)) * lu.row(k).tail(fix(rcols)); } // special handling of the last entry if(UnBlockedAtCompileTime) { Index k = endk; row_transpositions[k] = PivIndex(k); if (Scoring()(lu(k, k)) == Score(0) && first_zero_pivot == -1) first_zero_pivot = k; } return first_zero_pivot; } /** \internal performs the LU decomposition in-place of the matrix represented * by the variables \a rows, \a cols, \a lu_data, and \a lu_stride using a * recursive, blocked algorithm. * * In addition, this function returns the row transpositions in the * vector \a row_transpositions which must have a size equal to the number * of columns of the matrix \a lu, and an integer \a nb_transpositions * which returns the actual number of transpositions. * * \returns The index of the first pivot which is exactly zero if any, or a negative number otherwise. * * \note This very low level interface using pointers, etc. is to: * 1 - reduce the number of instantiations to the strict minimum * 2 - avoid infinite recursion of the instantiations with Block > > */ static Index blocked_lu(Index rows, Index cols, Scalar* lu_data, Index luStride, PivIndex* row_transpositions, PivIndex& nb_transpositions, Index maxBlockSize=256) { MatrixTypeRef lu = MatrixType::Map(lu_data,rows, cols, OuterStride<>(luStride)); const Index size = (std::min)(rows,cols); // if the matrix is too small, no blocking: if(UnBlockedAtCompileTime || size<=UnBlockedBound) { return unblocked_lu(lu, row_transpositions, nb_transpositions); } // automatically adjust the number of subdivisions to the size // of the matrix so that there is enough sub blocks: Index blockSize; { blockSize = size/8; blockSize = (blockSize/16)*16; blockSize = (std::min)((std::max)(blockSize,Index(8)), maxBlockSize); } nb_transpositions = 0; Index first_zero_pivot = -1; for(Index k = 0; k < size; k+=blockSize) { Index bs = (std::min)(size-k,blockSize); // actual size of the block Index trows = rows - k - bs; // trailing rows Index tsize = size - k - bs; // trailing size // partition the matrix: // A00 | A01 | A02 // lu = A_0 | A_1 | A_2 = A10 | A11 | A12 // A20 | A21 | A22 BlockType A_0 = lu.block(0,0,rows,k); BlockType A_2 = lu.block(0,k+bs,rows,tsize); BlockType A11 = lu.block(k,k,bs,bs); BlockType A12 = lu.block(k,k+bs,bs,tsize); BlockType A21 = lu.block(k+bs,k,trows,bs); BlockType A22 = lu.block(k+bs,k+bs,trows,tsize); PivIndex nb_transpositions_in_panel; // recursively call the blocked LU algorithm on [A11^T A21^T]^T // with a very small blocking size: Index ret = blocked_lu(trows+bs, bs, &lu.coeffRef(k,k), luStride, row_transpositions+k, nb_transpositions_in_panel, 16); if(ret>=0 && first_zero_pivot==-1) first_zero_pivot = k+ret; nb_transpositions += nb_transpositions_in_panel; // update permutations and apply them to A_0 for(Index i=k; i(k)); A_0.row(i).swap(A_0.row(piv)); } if(trows) { // apply permutations to A_2 for(Index i=k;i().solveInPlace(A12); A22.noalias() -= A21 * A12; } } return first_zero_pivot; } }; /** \internal performs the LU decomposition with partial pivoting in-place. */ template void partial_lu_inplace(MatrixType& lu, TranspositionType& row_transpositions, typename TranspositionType::StorageIndex& nb_transpositions) { // Special-case of zero matrix. if (lu.rows() == 0 || lu.cols() == 0) { nb_transpositions = 0; return; } eigen_assert(lu.cols() == row_transpositions.size()); eigen_assert(row_transpositions.size() < 2 || (&row_transpositions.coeffRef(1)-&row_transpositions.coeffRef(0)) == 1); partial_lu_impl < typename MatrixType::Scalar, MatrixType::Flags&RowMajorBit?RowMajor:ColMajor, typename TranspositionType::StorageIndex, EIGEN_SIZE_MIN_PREFER_FIXED(MatrixType::RowsAtCompileTime,MatrixType::ColsAtCompileTime)> ::blocked_lu(lu.rows(), lu.cols(), &lu.coeffRef(0,0), lu.outerStride(), &row_transpositions.coeffRef(0), nb_transpositions); } } // end namespace internal template void PartialPivLU::compute() { check_template_parameters(); // the row permutation is stored as int indices, so just to be sure: eigen_assert(m_lu.rows()::highest()); if(m_lu.cols()>0) m_l1_norm = m_lu.cwiseAbs().colwise().sum().maxCoeff(); else m_l1_norm = RealScalar(0); eigen_assert(m_lu.rows() == m_lu.cols() && "PartialPivLU is only for square (and moreover invertible) matrices"); const Index size = m_lu.rows(); m_rowsTranspositions.resize(size); typename TranspositionType::StorageIndex nb_transpositions; internal::partial_lu_inplace(m_lu, m_rowsTranspositions, nb_transpositions); m_det_p = (nb_transpositions%2) ? -1 : 1; m_p = m_rowsTranspositions; m_isInitialized = true; } template typename PartialPivLU::Scalar PartialPivLU::determinant() const { eigen_assert(m_isInitialized && "PartialPivLU is not initialized."); return Scalar(m_det_p) * m_lu.diagonal().prod(); } /** \returns the matrix represented by the decomposition, * i.e., it returns the product: P^{-1} L U. * This function is provided for debug purpose. */ template MatrixType PartialPivLU::reconstructedMatrix() const { eigen_assert(m_isInitialized && "LU is not initialized."); // LU MatrixType res = m_lu.template triangularView().toDenseMatrix() * m_lu.template triangularView(); // P^{-1}(LU) res = m_p.inverse() * res; return res; } /***** Implementation details *****************************************************/ namespace internal { /***** Implementation of inverse() *****************************************************/ template struct Assignment >, internal::assign_op::Scalar>, Dense2Dense> { typedef PartialPivLU LuType; typedef Inverse SrcXprType; static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &) { dst = src.nestedExpression().solve(MatrixType::Identity(src.rows(), src.cols())); } }; } // end namespace internal /******** MatrixBase methods *******/ /** \lu_module * * \return the partial-pivoting LU decomposition of \c *this. * * \sa class PartialPivLU */ template inline const PartialPivLU::PlainObject> MatrixBase::partialPivLu() const { return PartialPivLU(eval()); } /** \lu_module * * Synonym of partialPivLu(). * * \return the partial-pivoting LU decomposition of \c *this. * * \sa class PartialPivLU */ template inline const PartialPivLU::PlainObject> MatrixBase::lu() const { return PartialPivLU(eval()); } } // end namespace Eigen #endif // EIGEN_PARTIALLU_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/LU/PartialPivLU_LAPACKE.h ================================================ /* Copyright (c) 2011, Intel Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************** * Content : Eigen bindings to LAPACKe * LU decomposition with partial pivoting based on LAPACKE_?getrf function. ******************************************************************************** */ #ifndef EIGEN_PARTIALLU_LAPACK_H #define EIGEN_PARTIALLU_LAPACK_H namespace Eigen { namespace internal { /** \internal Specialization for the data types supported by LAPACKe */ #define EIGEN_LAPACKE_LU_PARTPIV(EIGTYPE, LAPACKE_TYPE, LAPACKE_PREFIX) \ template \ struct partial_lu_impl \ { \ /* \internal performs the LU decomposition in-place of the matrix represented */ \ static lapack_int blocked_lu(Index rows, Index cols, EIGTYPE* lu_data, Index luStride, lapack_int* row_transpositions, lapack_int& nb_transpositions, lapack_int maxBlockSize=256) \ { \ EIGEN_UNUSED_VARIABLE(maxBlockSize);\ lapack_int matrix_order, first_zero_pivot; \ lapack_int m, n, lda, *ipiv, info; \ EIGTYPE* a; \ /* Set up parameters for ?getrf */ \ matrix_order = StorageOrder==RowMajor ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \ lda = convert_index(luStride); \ a = lu_data; \ ipiv = row_transpositions; \ m = convert_index(rows); \ n = convert_index(cols); \ nb_transpositions = 0; \ \ info = LAPACKE_##LAPACKE_PREFIX##getrf( matrix_order, m, n, (LAPACKE_TYPE*)a, lda, ipiv ); \ \ for(int i=0;i= 0); \ /* something should be done with nb_transpositions */ \ \ first_zero_pivot = info; \ return first_zero_pivot; \ } \ }; EIGEN_LAPACKE_LU_PARTPIV(double, double, d) EIGEN_LAPACKE_LU_PARTPIV(float, float, s) EIGEN_LAPACKE_LU_PARTPIV(dcomplex, lapack_complex_double, z) EIGEN_LAPACKE_LU_PARTPIV(scomplex, lapack_complex_float, c) } // end namespace internal } // end namespace Eigen #endif // EIGEN_PARTIALLU_LAPACK_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/LU/arch/InverseSize4.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2001 Intel Corporation // Copyright (C) 2010 Gael Guennebaud // Copyright (C) 2009 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. // // The algorithm below is a reimplementation of former \src\LU\Inverse_SSE.h using PacketMath. // inv(M) = M#/|M|, where inv(M), M# and |M| denote the inverse of M, // adjugate of M and determinant of M respectively. M# is computed block-wise // using specific formulae. For proof, see: // https://lxjk.github.io/2017/09/03/Fast-4x4-Matrix-Inverse-with-SSE-SIMD-Explained.html // Variable names are adopted from \src\LU\Inverse_SSE.h. // // The SSE code for the 4x4 float and double matrix inverse in former (deprecated) \src\LU\Inverse_SSE.h // comes from the following Intel's library: // http://software.intel.com/en-us/articles/optimized-matrix-library-for-use-with-the-intel-pentiumr-4-processors-sse2-instructions/ // // Here is the respective copyright and license statement: // // Copyright (c) 2001 Intel Corporation. // // Permition is granted to use, copy, distribute and prepare derivative works // of this library for any purpose and without fee, provided, that the above // copyright notice and this statement appear in all copies. // Intel makes no representations about the suitability of this software for // any purpose, and specifically disclaims all warranties. // See LEGAL.TXT for all the legal information. // // TODO: Unify implementations of different data types (i.e. float and double). #ifndef EIGEN_INVERSE_SIZE_4_H #define EIGEN_INVERSE_SIZE_4_H namespace Eigen { namespace internal { template struct compute_inverse_size4 { enum { MatrixAlignment = traits::Alignment, ResultAlignment = traits::Alignment, StorageOrdersMatch = (MatrixType::Flags & RowMajorBit) == (ResultType::Flags & RowMajorBit) }; typedef typename conditional<(MatrixType::Flags & LinearAccessBit), MatrixType const &, typename MatrixType::PlainObject>::type ActualMatrixType; static void run(const MatrixType &mat, ResultType &result) { ActualMatrixType matrix(mat); const float* data = matrix.data(); const Index stride = matrix.innerStride(); Packet4f _L1 = ploadt(data); Packet4f _L2 = ploadt(data + stride*4); Packet4f _L3 = ploadt(data + stride*8); Packet4f _L4 = ploadt(data + stride*12); // Four 2x2 sub-matrices of the input matrix // input = [[A, B], // [C, D]] Packet4f A, B, C, D; if (!StorageOrdersMatch) { A = vec4f_unpacklo(_L1, _L2); B = vec4f_unpacklo(_L3, _L4); C = vec4f_unpackhi(_L1, _L2); D = vec4f_unpackhi(_L3, _L4); } else { A = vec4f_movelh(_L1, _L2); B = vec4f_movehl(_L2, _L1); C = vec4f_movelh(_L3, _L4); D = vec4f_movehl(_L4, _L3); } Packet4f AB, DC; // AB = A# * B, where A# denotes the adjugate of A, and * denotes matrix product. AB = pmul(vec4f_swizzle2(A, A, 3, 3, 0, 0), B); AB = psub(AB, pmul(vec4f_swizzle2(A, A, 1, 1, 2, 2), vec4f_swizzle2(B, B, 2, 3, 0, 1))); // DC = D#*C DC = pmul(vec4f_swizzle2(D, D, 3, 3, 0, 0), C); DC = psub(DC, pmul(vec4f_swizzle2(D, D, 1, 1, 2, 2), vec4f_swizzle2(C, C, 2, 3, 0, 1))); // determinants of the sub-matrices Packet4f dA, dB, dC, dD; dA = pmul(vec4f_swizzle2(A, A, 3, 3, 1, 1), A); dA = psub(dA, vec4f_movehl(dA, dA)); dB = pmul(vec4f_swizzle2(B, B, 3, 3, 1, 1), B); dB = psub(dB, vec4f_movehl(dB, dB)); dC = pmul(vec4f_swizzle2(C, C, 3, 3, 1, 1), C); dC = psub(dC, vec4f_movehl(dC, dC)); dD = pmul(vec4f_swizzle2(D, D, 3, 3, 1, 1), D); dD = psub(dD, vec4f_movehl(dD, dD)); Packet4f d, d1, d2; d = pmul(vec4f_swizzle2(DC, DC, 0, 2, 1, 3), AB); d = padd(d, vec4f_movehl(d, d)); d = padd(d, vec4f_swizzle2(d, d, 1, 0, 0, 0)); d1 = pmul(dA, dD); d2 = pmul(dB, dC); // determinant of the input matrix, det = |A||D| + |B||C| - trace(A#*B*D#*C) Packet4f det = vec4f_duplane(psub(padd(d1, d2), d), 0); // reciprocal of the determinant of the input matrix, rd = 1/det Packet4f rd = pdiv(pset1(1.0f), det); // Four sub-matrices of the inverse Packet4f iA, iB, iC, iD; // iD = D*|A| - C*A#*B iD = pmul(vec4f_swizzle2(C, C, 0, 0, 2, 2), vec4f_movelh(AB, AB)); iD = padd(iD, pmul(vec4f_swizzle2(C, C, 1, 1, 3, 3), vec4f_movehl(AB, AB))); iD = psub(pmul(D, vec4f_duplane(dA, 0)), iD); // iA = A*|D| - B*D#*C iA = pmul(vec4f_swizzle2(B, B, 0, 0, 2, 2), vec4f_movelh(DC, DC)); iA = padd(iA, pmul(vec4f_swizzle2(B, B, 1, 1, 3, 3), vec4f_movehl(DC, DC))); iA = psub(pmul(A, vec4f_duplane(dD, 0)), iA); // iB = C*|B| - D * (A#B)# = C*|B| - D*B#*A iB = pmul(D, vec4f_swizzle2(AB, AB, 3, 0, 3, 0)); iB = psub(iB, pmul(vec4f_swizzle2(D, D, 1, 0, 3, 2), vec4f_swizzle2(AB, AB, 2, 1, 2, 1))); iB = psub(pmul(C, vec4f_duplane(dB, 0)), iB); // iC = B*|C| - A * (D#C)# = B*|C| - A*C#*D iC = pmul(A, vec4f_swizzle2(DC, DC, 3, 0, 3, 0)); iC = psub(iC, pmul(vec4f_swizzle2(A, A, 1, 0, 3, 2), vec4f_swizzle2(DC, DC, 2, 1, 2, 1))); iC = psub(pmul(B, vec4f_duplane(dC, 0)), iC); const float sign_mask[4] = {0.0f, numext::bit_cast(0x80000000u), numext::bit_cast(0x80000000u), 0.0f}; const Packet4f p4f_sign_PNNP = ploadu(sign_mask); rd = pxor(rd, p4f_sign_PNNP); iA = pmul(iA, rd); iB = pmul(iB, rd); iC = pmul(iC, rd); iD = pmul(iD, rd); Index res_stride = result.outerStride(); float *res = result.data(); pstoret(res + 0, vec4f_swizzle2(iA, iB, 3, 1, 3, 1)); pstoret(res + res_stride, vec4f_swizzle2(iA, iB, 2, 0, 2, 0)); pstoret(res + 2 * res_stride, vec4f_swizzle2(iC, iD, 3, 1, 3, 1)); pstoret(res + 3 * res_stride, vec4f_swizzle2(iC, iD, 2, 0, 2, 0)); } }; #if !(defined EIGEN_VECTORIZE_NEON && !(EIGEN_ARCH_ARM64 && !EIGEN_APPLE_DOUBLE_NEON_BUG)) // same algorithm as above, except that each operand is split into // halves for two registers to hold. template struct compute_inverse_size4 { enum { MatrixAlignment = traits::Alignment, ResultAlignment = traits::Alignment, StorageOrdersMatch = (MatrixType::Flags & RowMajorBit) == (ResultType::Flags & RowMajorBit) }; typedef typename conditional<(MatrixType::Flags & LinearAccessBit), MatrixType const &, typename MatrixType::PlainObject>::type ActualMatrixType; static void run(const MatrixType &mat, ResultType &result) { ActualMatrixType matrix(mat); // Four 2x2 sub-matrices of the input matrix, each is further divided into upper and lower // row e.g. A1, upper row of A, A2, lower row of A // input = [[A, B], = [[[A1, [B1, // [C, D]] A2], B2]], // [[C1, [D1, // C2], D2]]] Packet2d A1, A2, B1, B2, C1, C2, D1, D2; const double* data = matrix.data(); const Index stride = matrix.innerStride(); if (StorageOrdersMatch) { A1 = ploadt(data + stride*0); B1 = ploadt(data + stride*2); A2 = ploadt(data + stride*4); B2 = ploadt(data + stride*6); C1 = ploadt(data + stride*8); D1 = ploadt(data + stride*10); C2 = ploadt(data + stride*12); D2 = ploadt(data + stride*14); } else { Packet2d temp; A1 = ploadt(data + stride*0); C1 = ploadt(data + stride*2); A2 = ploadt(data + stride*4); C2 = ploadt(data + stride*6); temp = A1; A1 = vec2d_unpacklo(A1, A2); A2 = vec2d_unpackhi(temp, A2); temp = C1; C1 = vec2d_unpacklo(C1, C2); C2 = vec2d_unpackhi(temp, C2); B1 = ploadt(data + stride*8); D1 = ploadt(data + stride*10); B2 = ploadt(data + stride*12); D2 = ploadt(data + stride*14); temp = B1; B1 = vec2d_unpacklo(B1, B2); B2 = vec2d_unpackhi(temp, B2); temp = D1; D1 = vec2d_unpacklo(D1, D2); D2 = vec2d_unpackhi(temp, D2); } // determinants of the sub-matrices Packet2d dA, dB, dC, dD; dA = vec2d_swizzle2(A2, A2, 1); dA = pmul(A1, dA); dA = psub(dA, vec2d_duplane(dA, 1)); dB = vec2d_swizzle2(B2, B2, 1); dB = pmul(B1, dB); dB = psub(dB, vec2d_duplane(dB, 1)); dC = vec2d_swizzle2(C2, C2, 1); dC = pmul(C1, dC); dC = psub(dC, vec2d_duplane(dC, 1)); dD = vec2d_swizzle2(D2, D2, 1); dD = pmul(D1, dD); dD = psub(dD, vec2d_duplane(dD, 1)); Packet2d DC1, DC2, AB1, AB2; // AB = A# * B, where A# denotes the adjugate of A, and * denotes matrix product. AB1 = pmul(B1, vec2d_duplane(A2, 1)); AB2 = pmul(B2, vec2d_duplane(A1, 0)); AB1 = psub(AB1, pmul(B2, vec2d_duplane(A1, 1))); AB2 = psub(AB2, pmul(B1, vec2d_duplane(A2, 0))); // DC = D#*C DC1 = pmul(C1, vec2d_duplane(D2, 1)); DC2 = pmul(C2, vec2d_duplane(D1, 0)); DC1 = psub(DC1, pmul(C2, vec2d_duplane(D1, 1))); DC2 = psub(DC2, pmul(C1, vec2d_duplane(D2, 0))); Packet2d d1, d2; // determinant of the input matrix, det = |A||D| + |B||C| - trace(A#*B*D#*C) Packet2d det; // reciprocal of the determinant of the input matrix, rd = 1/det Packet2d rd; d1 = pmul(AB1, vec2d_swizzle2(DC1, DC2, 0)); d2 = pmul(AB2, vec2d_swizzle2(DC1, DC2, 3)); rd = padd(d1, d2); rd = padd(rd, vec2d_duplane(rd, 1)); d1 = pmul(dA, dD); d2 = pmul(dB, dC); det = padd(d1, d2); det = psub(det, rd); det = vec2d_duplane(det, 0); rd = pdiv(pset1(1.0), det); // rows of four sub-matrices of the inverse Packet2d iA1, iA2, iB1, iB2, iC1, iC2, iD1, iD2; // iD = D*|A| - C*A#*B iD1 = pmul(AB1, vec2d_duplane(C1, 0)); iD2 = pmul(AB1, vec2d_duplane(C2, 0)); iD1 = padd(iD1, pmul(AB2, vec2d_duplane(C1, 1))); iD2 = padd(iD2, pmul(AB2, vec2d_duplane(C2, 1))); dA = vec2d_duplane(dA, 0); iD1 = psub(pmul(D1, dA), iD1); iD2 = psub(pmul(D2, dA), iD2); // iA = A*|D| - B*D#*C iA1 = pmul(DC1, vec2d_duplane(B1, 0)); iA2 = pmul(DC1, vec2d_duplane(B2, 0)); iA1 = padd(iA1, pmul(DC2, vec2d_duplane(B1, 1))); iA2 = padd(iA2, pmul(DC2, vec2d_duplane(B2, 1))); dD = vec2d_duplane(dD, 0); iA1 = psub(pmul(A1, dD), iA1); iA2 = psub(pmul(A2, dD), iA2); // iB = C*|B| - D * (A#B)# = C*|B| - D*B#*A iB1 = pmul(D1, vec2d_swizzle2(AB2, AB1, 1)); iB2 = pmul(D2, vec2d_swizzle2(AB2, AB1, 1)); iB1 = psub(iB1, pmul(vec2d_swizzle2(D1, D1, 1), vec2d_swizzle2(AB2, AB1, 2))); iB2 = psub(iB2, pmul(vec2d_swizzle2(D2, D2, 1), vec2d_swizzle2(AB2, AB1, 2))); dB = vec2d_duplane(dB, 0); iB1 = psub(pmul(C1, dB), iB1); iB2 = psub(pmul(C2, dB), iB2); // iC = B*|C| - A * (D#C)# = B*|C| - A*C#*D iC1 = pmul(A1, vec2d_swizzle2(DC2, DC1, 1)); iC2 = pmul(A2, vec2d_swizzle2(DC2, DC1, 1)); iC1 = psub(iC1, pmul(vec2d_swizzle2(A1, A1, 1), vec2d_swizzle2(DC2, DC1, 2))); iC2 = psub(iC2, pmul(vec2d_swizzle2(A2, A2, 1), vec2d_swizzle2(DC2, DC1, 2))); dC = vec2d_duplane(dC, 0); iC1 = psub(pmul(B1, dC), iC1); iC2 = psub(pmul(B2, dC), iC2); const double sign_mask1[2] = {0.0, numext::bit_cast(0x8000000000000000ull)}; const double sign_mask2[2] = {numext::bit_cast(0x8000000000000000ull), 0.0}; const Packet2d sign_PN = ploadu(sign_mask1); const Packet2d sign_NP = ploadu(sign_mask2); d1 = pxor(rd, sign_PN); d2 = pxor(rd, sign_NP); Index res_stride = result.outerStride(); double *res = result.data(); pstoret(res + 0, pmul(vec2d_swizzle2(iA2, iA1, 3), d1)); pstoret(res + res_stride, pmul(vec2d_swizzle2(iA2, iA1, 0), d2)); pstoret(res + 2, pmul(vec2d_swizzle2(iB2, iB1, 3), d1)); pstoret(res + res_stride + 2, pmul(vec2d_swizzle2(iB2, iB1, 0), d2)); pstoret(res + 2 * res_stride, pmul(vec2d_swizzle2(iC2, iC1, 3), d1)); pstoret(res + 3 * res_stride, pmul(vec2d_swizzle2(iC2, iC1, 0), d2)); pstoret(res + 2 * res_stride + 2, pmul(vec2d_swizzle2(iD2, iD1, 3), d1)); pstoret(res + 3 * res_stride + 2, pmul(vec2d_swizzle2(iD2, iD1, 0), d2)); } }; #endif } // namespace internal } // namespace Eigen #endif ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/MetisSupport/MetisSupport.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef METIS_SUPPORT_H #define METIS_SUPPORT_H namespace Eigen { /** * Get the fill-reducing ordering from the METIS package * * If A is the original matrix and Ap is the permuted matrix, * the fill-reducing permutation is defined as follows : * Row (column) i of A is the matperm(i) row (column) of Ap. * WARNING: As computed by METIS, this corresponds to the vector iperm (instead of perm) */ template class MetisOrdering { public: typedef PermutationMatrix PermutationType; typedef Matrix IndexVector; template void get_symmetrized_graph(const MatrixType& A) { Index m = A.cols(); eigen_assert((A.rows() == A.cols()) && "ONLY FOR SQUARED MATRICES"); // Get the transpose of the input matrix MatrixType At = A.transpose(); // Get the number of nonzeros elements in each row/col of At+A Index TotNz = 0; IndexVector visited(m); visited.setConstant(-1); for (StorageIndex j = 0; j < m; j++) { // Compute the union structure of of A(j,:) and At(j,:) visited(j) = j; // Do not include the diagonal element // Get the nonzeros in row/column j of A for (typename MatrixType::InnerIterator it(A, j); it; ++it) { Index idx = it.index(); // Get the row index (for column major) or column index (for row major) if (visited(idx) != j ) { visited(idx) = j; ++TotNz; } } //Get the nonzeros in row/column j of At for (typename MatrixType::InnerIterator it(At, j); it; ++it) { Index idx = it.index(); if(visited(idx) != j) { visited(idx) = j; ++TotNz; } } } // Reserve place for A + At m_indexPtr.resize(m+1); m_innerIndices.resize(TotNz); // Now compute the real adjacency list of each column/row visited.setConstant(-1); StorageIndex CurNz = 0; for (StorageIndex j = 0; j < m; j++) { m_indexPtr(j) = CurNz; visited(j) = j; // Do not include the diagonal element // Add the pattern of row/column j of A to A+At for (typename MatrixType::InnerIterator it(A,j); it; ++it) { StorageIndex idx = it.index(); // Get the row index (for column major) or column index (for row major) if (visited(idx) != j ) { visited(idx) = j; m_innerIndices(CurNz) = idx; CurNz++; } } //Add the pattern of row/column j of At to A+At for (typename MatrixType::InnerIterator it(At, j); it; ++it) { StorageIndex idx = it.index(); if(visited(idx) != j) { visited(idx) = j; m_innerIndices(CurNz) = idx; ++CurNz; } } } m_indexPtr(m) = CurNz; } template void operator() (const MatrixType& A, PermutationType& matperm) { StorageIndex m = internal::convert_index(A.cols()); // must be StorageIndex, because it is passed by address to METIS IndexVector perm(m),iperm(m); // First, symmetrize the matrix graph. get_symmetrized_graph(A); int output_error; // Call the fill-reducing routine from METIS output_error = METIS_NodeND(&m, m_indexPtr.data(), m_innerIndices.data(), NULL, NULL, perm.data(), iperm.data()); if(output_error != METIS_OK) { //FIXME The ordering interface should define a class of possible errors std::cerr << "ERROR WHILE CALLING THE METIS PACKAGE \n"; return; } // Get the fill-reducing permutation //NOTE: If Ap is the permuted matrix then perm and iperm vectors are defined as follows // Row (column) i of Ap is the perm(i) row(column) of A, and row (column) i of A is the iperm(i) row(column) of Ap matperm.resize(m); for (int j = 0; j < m; j++) matperm.indices()(iperm(j)) = j; } protected: IndexVector m_indexPtr; // Pointer to the adjacenccy list of each row/column IndexVector m_innerIndices; // Adjacency list }; }// end namespace eigen #endif ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/OrderingMethods/Amd.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2010 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. /* NOTE: this routine has been adapted from the CSparse library: Copyright (c) 2006, Timothy A. Davis. http://www.suitesparse.com The author of CSparse, Timothy A. Davis., has executed a license with Google LLC to permit distribution of this code and derivative works as part of Eigen under the Mozilla Public License v. 2.0, as stated at the top of this file. */ #ifndef EIGEN_SPARSE_AMD_H #define EIGEN_SPARSE_AMD_H namespace Eigen { namespace internal { template inline T amd_flip(const T& i) { return -i-2; } template inline T amd_unflip(const T& i) { return i<0 ? amd_flip(i) : i; } template inline bool amd_marked(const T0* w, const T1& j) { return w[j]<0; } template inline void amd_mark(const T0* w, const T1& j) { return w[j] = amd_flip(w[j]); } /* clear w */ template static StorageIndex cs_wclear (StorageIndex mark, StorageIndex lemax, StorageIndex *w, StorageIndex n) { StorageIndex k; if(mark < 2 || (mark + lemax < 0)) { for(k = 0; k < n; k++) if(w[k] != 0) w[k] = 1; mark = 2; } return (mark); /* at this point, w[0..n-1] < mark holds */ } /* depth-first search and postorder of a tree rooted at node j */ template StorageIndex cs_tdfs(StorageIndex j, StorageIndex k, StorageIndex *head, const StorageIndex *next, StorageIndex *post, StorageIndex *stack) { StorageIndex i, p, top = 0; if(!head || !next || !post || !stack) return (-1); /* check inputs */ stack[0] = j; /* place j on the stack */ while (top >= 0) /* while (stack is not empty) */ { p = stack[top]; /* p = top of stack */ i = head[p]; /* i = youngest child of p */ if(i == -1) { top--; /* p has no unordered children left */ post[k++] = p; /* node p is the kth postordered node */ } else { head[p] = next[i]; /* remove i from children of p */ stack[++top] = i; /* start dfs on child node i */ } } return k; } /** \internal * \ingroup OrderingMethods_Module * Approximate minimum degree ordering algorithm. * * \param[in] C the input selfadjoint matrix stored in compressed column major format. * \param[out] perm the permutation P reducing the fill-in of the input matrix \a C * * Note that the input matrix \a C must be complete, that is both the upper and lower parts have to be stored, as well as the diagonal entries. * On exit the values of C are destroyed */ template void minimum_degree_ordering(SparseMatrix& C, PermutationMatrix& perm) { using std::sqrt; StorageIndex d, dk, dext, lemax = 0, e, elenk, eln, i, j, k, k1, k2, k3, jlast, ln, dense, nzmax, mindeg = 0, nvi, nvj, nvk, mark, wnvi, ok, nel = 0, p, p1, p2, p3, p4, pj, pk, pk1, pk2, pn, q, t, h; StorageIndex n = StorageIndex(C.cols()); dense = std::max (16, StorageIndex(10 * sqrt(double(n)))); /* find dense threshold */ dense = (std::min)(n-2, dense); StorageIndex cnz = StorageIndex(C.nonZeros()); perm.resize(n+1); t = cnz + cnz/5 + 2*n; /* add elbow room to C */ C.resizeNonZeros(t); // get workspace ei_declare_aligned_stack_constructed_variable(StorageIndex,W,8*(n+1),0); StorageIndex* len = W; StorageIndex* nv = W + (n+1); StorageIndex* next = W + 2*(n+1); StorageIndex* head = W + 3*(n+1); StorageIndex* elen = W + 4*(n+1); StorageIndex* degree = W + 5*(n+1); StorageIndex* w = W + 6*(n+1); StorageIndex* hhead = W + 7*(n+1); StorageIndex* last = perm.indices().data(); /* use P as workspace for last */ /* --- Initialize quotient graph ---------------------------------------- */ StorageIndex* Cp = C.outerIndexPtr(); StorageIndex* Ci = C.innerIndexPtr(); for(k = 0; k < n; k++) len[k] = Cp[k+1] - Cp[k]; len[n] = 0; nzmax = t; for(i = 0; i <= n; i++) { head[i] = -1; // degree list i is empty last[i] = -1; next[i] = -1; hhead[i] = -1; // hash list i is empty nv[i] = 1; // node i is just one node w[i] = 1; // node i is alive elen[i] = 0; // Ek of node i is empty degree[i] = len[i]; // degree of node i } mark = internal::cs_wclear(0, 0, w, n); /* clear w */ /* --- Initialize degree lists ------------------------------------------ */ for(i = 0; i < n; i++) { bool has_diag = false; for(p = Cp[i]; p dense || !has_diag) /* node i is dense or has no structural diagonal element */ { nv[i] = 0; /* absorb i into element n */ elen[i] = -1; /* node i is dead */ nel++; Cp[i] = amd_flip (n); nv[n]++; } else { if(head[d] != -1) last[head[d]] = i; next[i] = head[d]; /* put node i in degree list d */ head[d] = i; } } elen[n] = -2; /* n is a dead element */ Cp[n] = -1; /* n is a root of assembly tree */ w[n] = 0; /* n is a dead element */ while (nel < n) /* while (selecting pivots) do */ { /* --- Select node of minimum approximate degree -------------------- */ for(k = -1; mindeg < n && (k = head[mindeg]) == -1; mindeg++) {} if(next[k] != -1) last[next[k]] = -1; head[mindeg] = next[k]; /* remove k from degree list */ elenk = elen[k]; /* elenk = |Ek| */ nvk = nv[k]; /* # of nodes k represents */ nel += nvk; /* nv[k] nodes of A eliminated */ /* --- Garbage collection ------------------------------------------- */ if(elenk > 0 && cnz + mindeg >= nzmax) { for(j = 0; j < n; j++) { if((p = Cp[j]) >= 0) /* j is a live node or element */ { Cp[j] = Ci[p]; /* save first entry of object */ Ci[p] = amd_flip (j); /* first entry is now amd_flip(j) */ } } for(q = 0, p = 0; p < cnz; ) /* scan all of memory */ { if((j = amd_flip (Ci[p++])) >= 0) /* found object j */ { Ci[q] = Cp[j]; /* restore first entry of object */ Cp[j] = q++; /* new pointer to object j */ for(k3 = 0; k3 < len[j]-1; k3++) Ci[q++] = Ci[p++]; } } cnz = q; /* Ci[cnz...nzmax-1] now free */ } /* --- Construct new element ---------------------------------------- */ dk = 0; nv[k] = -nvk; /* flag k as in Lk */ p = Cp[k]; pk1 = (elenk == 0) ? p : cnz; /* do in place if elen[k] == 0 */ pk2 = pk1; for(k1 = 1; k1 <= elenk + 1; k1++) { if(k1 > elenk) { e = k; /* search the nodes in k */ pj = p; /* list of nodes starts at Ci[pj]*/ ln = len[k] - elenk; /* length of list of nodes in k */ } else { e = Ci[p++]; /* search the nodes in e */ pj = Cp[e]; ln = len[e]; /* length of list of nodes in e */ } for(k2 = 1; k2 <= ln; k2++) { i = Ci[pj++]; if((nvi = nv[i]) <= 0) continue; /* node i dead, or seen */ dk += nvi; /* degree[Lk] += size of node i */ nv[i] = -nvi; /* negate nv[i] to denote i in Lk*/ Ci[pk2++] = i; /* place i in Lk */ if(next[i] != -1) last[next[i]] = last[i]; if(last[i] != -1) /* remove i from degree list */ { next[last[i]] = next[i]; } else { head[degree[i]] = next[i]; } } if(e != k) { Cp[e] = amd_flip (k); /* absorb e into k */ w[e] = 0; /* e is now a dead element */ } } if(elenk != 0) cnz = pk2; /* Ci[cnz...nzmax] is free */ degree[k] = dk; /* external degree of k - |Lk\i| */ Cp[k] = pk1; /* element k is in Ci[pk1..pk2-1] */ len[k] = pk2 - pk1; elen[k] = -2; /* k is now an element */ /* --- Find set differences ----------------------------------------- */ mark = internal::cs_wclear(mark, lemax, w, n); /* clear w if necessary */ for(pk = pk1; pk < pk2; pk++) /* scan 1: find |Le\Lk| */ { i = Ci[pk]; if((eln = elen[i]) <= 0) continue;/* skip if elen[i] empty */ nvi = -nv[i]; /* nv[i] was negated */ wnvi = mark - nvi; for(p = Cp[i]; p <= Cp[i] + eln - 1; p++) /* scan Ei */ { e = Ci[p]; if(w[e] >= mark) { w[e] -= nvi; /* decrement |Le\Lk| */ } else if(w[e] != 0) /* ensure e is a live element */ { w[e] = degree[e] + wnvi; /* 1st time e seen in scan 1 */ } } } /* --- Degree update ------------------------------------------------ */ for(pk = pk1; pk < pk2; pk++) /* scan2: degree update */ { i = Ci[pk]; /* consider node i in Lk */ p1 = Cp[i]; p2 = p1 + elen[i] - 1; pn = p1; for(h = 0, d = 0, p = p1; p <= p2; p++) /* scan Ei */ { e = Ci[p]; if(w[e] != 0) /* e is an unabsorbed element */ { dext = w[e] - mark; /* dext = |Le\Lk| */ if(dext > 0) { d += dext; /* sum up the set differences */ Ci[pn++] = e; /* keep e in Ei */ h += e; /* compute the hash of node i */ } else { Cp[e] = amd_flip (k); /* aggressive absorb. e->k */ w[e] = 0; /* e is a dead element */ } } } elen[i] = pn - p1 + 1; /* elen[i] = |Ei| */ p3 = pn; p4 = p1 + len[i]; for(p = p2 + 1; p < p4; p++) /* prune edges in Ai */ { j = Ci[p]; if((nvj = nv[j]) <= 0) continue; /* node j dead or in Lk */ d += nvj; /* degree(i) += |j| */ Ci[pn++] = j; /* place j in node list of i */ h += j; /* compute hash for node i */ } if(d == 0) /* check for mass elimination */ { Cp[i] = amd_flip (k); /* absorb i into k */ nvi = -nv[i]; dk -= nvi; /* |Lk| -= |i| */ nvk += nvi; /* |k| += nv[i] */ nel += nvi; nv[i] = 0; elen[i] = -1; /* node i is dead */ } else { degree[i] = std::min (degree[i], d); /* update degree(i) */ Ci[pn] = Ci[p3]; /* move first node to end */ Ci[p3] = Ci[p1]; /* move 1st el. to end of Ei */ Ci[p1] = k; /* add k as 1st element in of Ei */ len[i] = pn - p1 + 1; /* new len of adj. list of node i */ h %= n; /* finalize hash of i */ next[i] = hhead[h]; /* place i in hash bucket */ hhead[h] = i; last[i] = h; /* save hash of i in last[i] */ } } /* scan2 is done */ degree[k] = dk; /* finalize |Lk| */ lemax = std::max(lemax, dk); mark = internal::cs_wclear(mark+lemax, lemax, w, n); /* clear w */ /* --- Supernode detection ------------------------------------------ */ for(pk = pk1; pk < pk2; pk++) { i = Ci[pk]; if(nv[i] >= 0) continue; /* skip if i is dead */ h = last[i]; /* scan hash bucket of node i */ i = hhead[h]; hhead[h] = -1; /* hash bucket will be empty */ for(; i != -1 && next[i] != -1; i = next[i], mark++) { ln = len[i]; eln = elen[i]; for(p = Cp[i]+1; p <= Cp[i] + ln-1; p++) w[Ci[p]] = mark; jlast = i; for(j = next[i]; j != -1; ) /* compare i with all j */ { ok = (len[j] == ln) && (elen[j] == eln); for(p = Cp[j] + 1; ok && p <= Cp[j] + ln - 1; p++) { if(w[Ci[p]] != mark) ok = 0; /* compare i and j*/ } if(ok) /* i and j are identical */ { Cp[j] = amd_flip (i); /* absorb j into i */ nv[i] += nv[j]; nv[j] = 0; elen[j] = -1; /* node j is dead */ j = next[j]; /* delete j from hash bucket */ next[jlast] = j; } else { jlast = j; /* j and i are different */ j = next[j]; } } } } /* --- Finalize new element------------------------------------------ */ for(p = pk1, pk = pk1; pk < pk2; pk++) /* finalize Lk */ { i = Ci[pk]; if((nvi = -nv[i]) <= 0) continue;/* skip if i is dead */ nv[i] = nvi; /* restore nv[i] */ d = degree[i] + dk - nvi; /* compute external degree(i) */ d = std::min (d, n - nel - nvi); if(head[d] != -1) last[head[d]] = i; next[i] = head[d]; /* put i back in degree list */ last[i] = -1; head[d] = i; mindeg = std::min (mindeg, d); /* find new minimum degree */ degree[i] = d; Ci[p++] = i; /* place i in Lk */ } nv[k] = nvk; /* # nodes absorbed into k */ if((len[k] = p-pk1) == 0) /* length of adj list of element k*/ { Cp[k] = -1; /* k is a root of the tree */ w[k] = 0; /* k is now a dead element */ } if(elenk != 0) cnz = p; /* free unused space in Lk */ } /* --- Postordering ----------------------------------------------------- */ for(i = 0; i < n; i++) Cp[i] = amd_flip (Cp[i]);/* fix assembly tree */ for(j = 0; j <= n; j++) head[j] = -1; for(j = n; j >= 0; j--) /* place unordered nodes in lists */ { if(nv[j] > 0) continue; /* skip if j is an element */ next[j] = head[Cp[j]]; /* place j in list of its parent */ head[Cp[j]] = j; } for(e = n; e >= 0; e--) /* place elements in lists */ { if(nv[e] <= 0) continue; /* skip unless e is an element */ if(Cp[e] != -1) { next[e] = head[Cp[e]]; /* place e in list of its parent */ head[Cp[e]] = e; } } for(k = 0, i = 0; i <= n; i++) /* postorder the assembly tree */ { if(Cp[i] == -1) k = internal::cs_tdfs(i, k, head, next, perm.indices().data(), w); } perm.indices().conservativeResize(n); } } // namespace internal } // end namespace Eigen #endif // EIGEN_SPARSE_AMD_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h ================================================ // // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Desire Nuentsa Wakam // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. // This file is modified from the colamd/symamd library. The copyright is below // The authors of the code itself are Stefan I. Larimore and Timothy A. // Davis (davis@cise.ufl.edu), University of Florida. The algorithm was // developed in collaboration with John Gilbert, Xerox PARC, and Esmond // Ng, Oak Ridge National Laboratory. // // Date: // // September 8, 2003. Version 2.3. // // Acknowledgements: // // This work was supported by the National Science Foundation, under // grants DMS-9504974 and DMS-9803599. // // Notice: // // Copyright (c) 1998-2003 by the University of Florida. // All Rights Reserved. // // THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY // EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. // // Permission is hereby granted to use, copy, modify, and/or distribute // this program, provided that the Copyright, this License, and the // Availability of the original version is retained on all copies and made // accessible to the end-user of any code or package that includes COLAMD // or any modified version of COLAMD. // // Availability: // // The colamd/symamd library is available at // // http://www.suitesparse.com #ifndef EIGEN_COLAMD_H #define EIGEN_COLAMD_H namespace internal { namespace Colamd { /* Ensure that debugging is turned off: */ #ifndef COLAMD_NDEBUG #define COLAMD_NDEBUG #endif /* NDEBUG */ /* ========================================================================== */ /* === Knob and statistics definitions ====================================== */ /* ========================================================================== */ /* size of the knobs [ ] array. Only knobs [0..1] are currently used. */ const int NKnobs = 20; /* number of output statistics. Only stats [0..6] are currently used. */ const int NStats = 20; /* Indices into knobs and stats array. */ enum KnobsStatsIndex { /* knobs [0] and stats [0]: dense row knob and output statistic. */ DenseRow = 0, /* knobs [1] and stats [1]: dense column knob and output statistic. */ DenseCol = 1, /* stats [2]: memory defragmentation count output statistic */ DefragCount = 2, /* stats [3]: colamd status: zero OK, > 0 warning or notice, < 0 error */ Status = 3, /* stats [4..6]: error info, or info on jumbled columns */ Info1 = 4, Info2 = 5, Info3 = 6 }; /* error codes returned in stats [3]: */ enum Status { Ok = 0, OkButJumbled = 1, ErrorANotPresent = -1, ErrorPNotPresent = -2, ErrorNrowNegative = -3, ErrorNcolNegative = -4, ErrorNnzNegative = -5, ErrorP0Nonzero = -6, ErrorATooSmall = -7, ErrorColLengthNegative = -8, ErrorRowIndexOutOfBounds = -9, ErrorOutOfMemory = -10, ErrorInternalError = -999 }; /* ========================================================================== */ /* === Definitions ========================================================== */ /* ========================================================================== */ template IndexType ones_complement(const IndexType r) { return (-(r)-1); } /* -------------------------------------------------------------------------- */ const int Empty = -1; /* Row and column status */ enum RowColumnStatus { Alive = 0, Dead = -1 }; /* Column status */ enum ColumnStatus { DeadPrincipal = -1, DeadNonPrincipal = -2 }; /* ========================================================================== */ /* === Colamd reporting mechanism =========================================== */ /* ========================================================================== */ // == Row and Column structures == template struct ColStructure { IndexType start ; /* index for A of first row in this column, or Dead */ /* if column is dead */ IndexType length ; /* number of rows in this column */ union { IndexType thickness ; /* number of original columns represented by this */ /* col, if the column is alive */ IndexType parent ; /* parent in parent tree super-column structure, if */ /* the column is dead */ } shared1 ; union { IndexType score ; /* the score used to maintain heap, if col is alive */ IndexType order ; /* pivot ordering of this column, if col is dead */ } shared2 ; union { IndexType headhash ; /* head of a hash bucket, if col is at the head of */ /* a degree list */ IndexType hash ; /* hash value, if col is not in a degree list */ IndexType prev ; /* previous column in degree list, if col is in a */ /* degree list (but not at the head of a degree list) */ } shared3 ; union { IndexType degree_next ; /* next column, if col is in a degree list */ IndexType hash_next ; /* next column, if col is in a hash list */ } shared4 ; inline bool is_dead() const { return start < Alive; } inline bool is_alive() const { return start >= Alive; } inline bool is_dead_principal() const { return start == DeadPrincipal; } inline void kill_principal() { start = DeadPrincipal; } inline void kill_non_principal() { start = DeadNonPrincipal; } }; template struct RowStructure { IndexType start ; /* index for A of first col in this row */ IndexType length ; /* number of principal columns in this row */ union { IndexType degree ; /* number of principal & non-principal columns in row */ IndexType p ; /* used as a row pointer in init_rows_cols () */ } shared1 ; union { IndexType mark ; /* for computing set differences and marking dead rows*/ IndexType first_column ;/* first column in row (used in garbage collection) */ } shared2 ; inline bool is_dead() const { return shared2.mark < Alive; } inline bool is_alive() const { return shared2.mark >= Alive; } inline void kill() { shared2.mark = Dead; } }; /* ========================================================================== */ /* === Colamd recommended memory size ======================================= */ /* ========================================================================== */ /* The recommended length Alen of the array A passed to colamd is given by the COLAMD_RECOMMENDED (nnz, n_row, n_col) macro. It returns -1 if any argument is negative. 2*nnz space is required for the row and column indices of the matrix. colamd_c (n_col) + colamd_r (n_row) space is required for the Col and Row arrays, respectively, which are internal to colamd. An additional n_col space is the minimal amount of "elbow room", and nnz/5 more space is recommended for run time efficiency. This macro is not needed when using symamd. Explicit typecast to IndexType added Sept. 23, 2002, COLAMD version 2.2, to avoid gcc -pedantic warning messages. */ template inline IndexType colamd_c(IndexType n_col) { return IndexType( ((n_col) + 1) * sizeof (ColStructure) / sizeof (IndexType) ) ; } template inline IndexType colamd_r(IndexType n_row) { return IndexType(((n_row) + 1) * sizeof (RowStructure) / sizeof (IndexType)); } // Prototypes of non-user callable routines template static IndexType init_rows_cols (IndexType n_row, IndexType n_col, RowStructure Row [], ColStructure col [], IndexType A [], IndexType p [], IndexType stats[NStats] ); template static void init_scoring (IndexType n_row, IndexType n_col, RowStructure Row [], ColStructure Col [], IndexType A [], IndexType head [], double knobs[NKnobs], IndexType *p_n_row2, IndexType *p_n_col2, IndexType *p_max_deg); template static IndexType find_ordering (IndexType n_row, IndexType n_col, IndexType Alen, RowStructure Row [], ColStructure Col [], IndexType A [], IndexType head [], IndexType n_col2, IndexType max_deg, IndexType pfree); template static void order_children (IndexType n_col, ColStructure Col [], IndexType p []); template static void detect_super_cols (ColStructure Col [], IndexType A [], IndexType head [], IndexType row_start, IndexType row_length ) ; template static IndexType garbage_collection (IndexType n_row, IndexType n_col, RowStructure Row [], ColStructure Col [], IndexType A [], IndexType *pfree) ; template static inline IndexType clear_mark (IndexType n_row, RowStructure Row [] ) ; /* === No debugging ========================================================= */ #define COLAMD_DEBUG0(params) ; #define COLAMD_DEBUG1(params) ; #define COLAMD_DEBUG2(params) ; #define COLAMD_DEBUG3(params) ; #define COLAMD_DEBUG4(params) ; #define COLAMD_ASSERT(expression) ((void) 0) /** * \brief Returns the recommended value of Alen * * Returns recommended value of Alen for use by colamd. * Returns -1 if any input argument is negative. * The use of this routine or macro is optional. * Note that the macro uses its arguments more than once, * so be careful for side effects, if you pass expressions as arguments to COLAMD_RECOMMENDED. * * \param nnz nonzeros in A * \param n_row number of rows in A * \param n_col number of columns in A * \return recommended value of Alen for use by colamd */ template inline IndexType recommended ( IndexType nnz, IndexType n_row, IndexType n_col) { if ((nnz) < 0 || (n_row) < 0 || (n_col) < 0) return (-1); else return (2 * (nnz) + colamd_c (n_col) + colamd_r (n_row) + (n_col) + ((nnz) / 5)); } /** * \brief set default parameters The use of this routine is optional. * * Colamd: rows with more than (knobs [DenseRow] * n_col) * entries are removed prior to ordering. Columns with more than * (knobs [DenseCol] * n_row) entries are removed prior to * ordering, and placed last in the output column ordering. * * DenseRow and DenseCol are defined as 0 and 1, * respectively, in colamd.h. Default values of these two knobs * are both 0.5. Currently, only knobs [0] and knobs [1] are * used, but future versions may use more knobs. If so, they will * be properly set to their defaults by the future version of * colamd_set_defaults, so that the code that calls colamd will * not need to change, assuming that you either use * colamd_set_defaults, or pass a (double *) NULL pointer as the * knobs array to colamd or symamd. * * \param knobs parameter settings for colamd */ static inline void set_defaults(double knobs[NKnobs]) { /* === Local variables ================================================== */ int i ; if (!knobs) { return ; /* no knobs to initialize */ } for (i = 0 ; i < NKnobs ; i++) { knobs [i] = 0 ; } knobs [Colamd::DenseRow] = 0.5 ; /* ignore rows over 50% dense */ knobs [Colamd::DenseCol] = 0.5 ; /* ignore columns over 50% dense */ } /** * \brief Computes a column ordering using the column approximate minimum degree ordering * * 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. * * * \param n_row number of rows in A * \param n_col number of columns in A * \param Alen, size of the array A * \param A row indices of the matrix, of size ALen * \param p column pointers of A, of size n_col+1 * \param knobs parameter settings for colamd * \param stats colamd output statistics and error codes */ template static bool compute_ordering(IndexType n_row, IndexType n_col, IndexType Alen, IndexType *A, IndexType *p, double knobs[NKnobs], IndexType stats[NStats]) { /* === Local variables ================================================== */ IndexType i ; /* loop index */ IndexType nnz ; /* nonzeros in A */ IndexType Row_size ; /* size of Row [], in integers */ IndexType Col_size ; /* size of Col [], in integers */ IndexType need ; /* minimum required length of A */ Colamd::RowStructure *Row ; /* pointer into A of Row [0..n_row] array */ Colamd::ColStructure *Col ; /* pointer into A of Col [0..n_col] array */ IndexType n_col2 ; /* number of non-dense, non-empty columns */ IndexType n_row2 ; /* number of non-dense, non-empty rows */ IndexType ngarbage ; /* number of garbage collections performed */ IndexType max_deg ; /* maximum row degree */ double default_knobs [NKnobs] ; /* default knobs array */ /* === Check the input arguments ======================================== */ if (!stats) { COLAMD_DEBUG0 (("colamd: stats not present\n")) ; return (false) ; } for (i = 0 ; i < NStats ; i++) { stats [i] = 0 ; } stats [Colamd::Status] = Colamd::Ok ; stats [Colamd::Info1] = -1 ; stats [Colamd::Info2] = -1 ; if (!A) /* A is not present */ { stats [Colamd::Status] = Colamd::ErrorANotPresent ; COLAMD_DEBUG0 (("colamd: A not present\n")) ; return (false) ; } if (!p) /* p is not present */ { stats [Colamd::Status] = Colamd::ErrorPNotPresent ; COLAMD_DEBUG0 (("colamd: p not present\n")) ; return (false) ; } if (n_row < 0) /* n_row must be >= 0 */ { stats [Colamd::Status] = Colamd::ErrorNrowNegative ; stats [Colamd::Info1] = n_row ; COLAMD_DEBUG0 (("colamd: nrow negative %d\n", n_row)) ; return (false) ; } if (n_col < 0) /* n_col must be >= 0 */ { stats [Colamd::Status] = Colamd::ErrorNcolNegative ; stats [Colamd::Info1] = n_col ; COLAMD_DEBUG0 (("colamd: ncol negative %d\n", n_col)) ; return (false) ; } nnz = p [n_col] ; if (nnz < 0) /* nnz must be >= 0 */ { stats [Colamd::Status] = Colamd::ErrorNnzNegative ; stats [Colamd::Info1] = nnz ; COLAMD_DEBUG0 (("colamd: number of entries negative %d\n", nnz)) ; return (false) ; } if (p [0] != 0) { stats [Colamd::Status] = Colamd::ErrorP0Nonzero ; stats [Colamd::Info1] = p [0] ; COLAMD_DEBUG0 (("colamd: p[0] not zero %d\n", p [0])) ; return (false) ; } /* === If no knobs, set default knobs =================================== */ if (!knobs) { set_defaults (default_knobs) ; knobs = default_knobs ; } /* === Allocate the Row and Col arrays from array A ===================== */ Col_size = colamd_c (n_col) ; Row_size = colamd_r (n_row) ; need = 2*nnz + n_col + Col_size + Row_size ; if (need > Alen) { /* not enough space in array A to perform the ordering */ stats [Colamd::Status] = Colamd::ErrorATooSmall ; stats [Colamd::Info1] = need ; stats [Colamd::Info2] = Alen ; COLAMD_DEBUG0 (("colamd: Need Alen >= %d, given only Alen = %d\n", need,Alen)); return (false) ; } Alen -= Col_size + Row_size ; Col = (ColStructure *) &A [Alen] ; Row = (RowStructure *) &A [Alen + Col_size] ; /* === Construct the row and column data structures ===================== */ if (!Colamd::init_rows_cols (n_row, n_col, Row, Col, A, p, stats)) { /* input matrix is invalid */ COLAMD_DEBUG0 (("colamd: Matrix invalid\n")) ; return (false) ; } /* === Initialize scores, kill dense rows/columns ======================= */ Colamd::init_scoring (n_row, n_col, Row, Col, A, p, knobs, &n_row2, &n_col2, &max_deg) ; /* === Order the supercolumns =========================================== */ ngarbage = Colamd::find_ordering (n_row, n_col, Alen, Row, Col, A, p, n_col2, max_deg, 2*nnz) ; /* === Order the non-principal columns ================================== */ Colamd::order_children (n_col, Col, p) ; /* === Return statistics in stats ======================================= */ stats [Colamd::DenseRow] = n_row - n_row2 ; stats [Colamd::DenseCol] = n_col - n_col2 ; stats [Colamd::DefragCount] = ngarbage ; COLAMD_DEBUG0 (("colamd: done.\n")) ; return (true) ; } /* ========================================================================== */ /* === 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. */ template static IndexType init_rows_cols /* returns true if OK, or false otherwise */ ( /* === Parameters ======================================================= */ IndexType n_row, /* number of rows of A */ IndexType n_col, /* number of columns of A */ RowStructure Row [], /* of size n_row+1 */ ColStructure Col [], /* of size n_col+1 */ IndexType A [], /* row indices of A, of size Alen */ IndexType p [], /* pointers to columns in A, of size n_col+1 */ IndexType stats [NStats] /* colamd statistics */ ) { /* === Local variables ================================================== */ IndexType col ; /* a column index */ IndexType row ; /* a row index */ IndexType *cp ; /* a column pointer */ IndexType *cp_end ; /* a pointer to the end of a column */ IndexType *rp ; /* a row pointer */ IndexType *rp_end ; /* a pointer to the end of a row */ IndexType 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) // extra parentheses to work-around gcc bug 10200 { /* column pointers must be non-decreasing */ stats [Colamd::Status] = Colamd::ErrorColLengthNegative ; stats [Colamd::Info1] = col ; stats [Colamd::Info2] = Col [col].length ; COLAMD_DEBUG0 (("colamd: col %d length %d < 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 ; } /* p [0..n_col] no longer needed, used as "head" in subsequent routines */ /* === Scan columns, compute row degrees, and check row indices ========= */ stats [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 ; } for (col = 0 ; col < n_col ; col++) { last_row = -1 ; cp = &A [p [col]] ; cp_end = &A [p [col+1]] ; while (cp < cp_end) { row = *cp++ ; /* make sure row indices within range */ if (row < 0 || row >= n_row) { stats [Colamd::Status] = Colamd::ErrorRowIndexOutOfBounds ; stats [Colamd::Info1] = col ; stats [Colamd::Info2] = row ; stats [Colamd::Info3] = n_row ; COLAMD_DEBUG0 (("colamd: row %d col %d 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 [Colamd::Status] = Colamd::OkButJumbled ; stats [Colamd::Info1] = col ; stats [Colamd::Info2] = row ; (stats [Colamd::Info3]) ++ ; COLAMD_DEBUG1 (("colamd: row %d col %d 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 [Status] == OkButJumbled) { /* 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 [Status] == OkButJumbled) { COLAMD_DEBUG0 (("colamd: reconstructing column form, matrix jumbled\n")) ; /* === 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. */ template static void init_scoring ( /* === Parameters ======================================================= */ IndexType n_row, /* number of rows of A */ IndexType n_col, /* number of columns of A */ RowStructure Row [], /* of size n_row+1 */ ColStructure Col [], /* of size n_col+1 */ IndexType A [], /* column form and row form of A */ IndexType head [], /* of size n_col+1 */ double knobs [NKnobs],/* parameters */ IndexType *p_n_row2, /* number of non-dense, non-empty rows */ IndexType *p_n_col2, /* number of non-dense, non-empty columns */ IndexType *p_max_deg /* maximum row degree */ ) { /* === Local variables ================================================== */ IndexType c ; /* a column index */ IndexType r, row ; /* a row index */ IndexType *cp ; /* a column pointer */ IndexType deg ; /* degree of a row or column */ IndexType *cp_end ; /* a pointer to the end of a column */ IndexType *new_cp ; /* new column pointer */ IndexType col_length ; /* length of pruned column */ IndexType score ; /* current column score */ IndexType n_col2 ; /* number of non-dense, non-empty columns */ IndexType n_row2 ; /* number of non-dense, non-empty rows */ IndexType dense_row_count ; /* remove rows with more entries than this */ IndexType dense_col_count ; /* remove cols with more entries than this */ IndexType min_score ; /* smallest column score */ IndexType max_deg ; /* maximum row degree */ IndexType next_col ; /* Used to add to degree list.*/ /* === Extract knobs ==================================================== */ dense_row_count = numext::maxi(IndexType(0), numext::mini(IndexType(knobs [Colamd::DenseRow] * n_col), n_col)) ; dense_col_count = numext::maxi(IndexType(0), numext::mini(IndexType(knobs [Colamd::DenseCol] * n_row), n_row)) ; COLAMD_DEBUG1 (("colamd: densecount: %d %d\n", dense_row_count, dense_col_count)) ; max_deg = 0 ; n_col2 = n_col ; n_row2 = n_row ; /* === 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 */ Col [c].shared2.order = --n_col2 ; Col[c].kill_principal() ; } } COLAMD_DEBUG1 (("colamd: null columns killed: %d\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[c].is_dead()) { continue ; } deg = Col [c].length ; if (deg > dense_col_count) { /* this is a dense column, kill and order it last */ Col [c].shared2.order = --n_col2 ; /* decrement the row degrees */ cp = &A [Col [c].start] ; cp_end = cp + Col [c].length ; while (cp < cp_end) { Row [*cp++].shared1.degree-- ; } Col[c].kill_principal() ; } } COLAMD_DEBUG1 (("colamd: Dense and null columns killed: %d\n", n_col - n_col2)) ; /* === Kill dense and empty rows ======================================== */ for (r = 0 ; r < n_row ; r++) { deg = Row [r].shared1.degree ; COLAMD_ASSERT (deg >= 0 && deg <= n_col) ; if (deg > dense_row_count || deg == 0) { /* kill a dense or empty row */ Row[r].kill() ; --n_row2 ; } else { /* keep track of max degree of remaining rows */ max_deg = numext::maxi(max_deg, deg) ; } } COLAMD_DEBUG1 (("colamd: Dense and null rows killed: %d\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 matlab score for each column */ for (c = n_col-1 ; c >= 0 ; c--) { /* skip dead column */ if (Col[c].is_dead()) { 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[row].is_dead()) { continue ; } /* compact the column */ *new_cp++ = row ; /* add row's external degree */ score += Row [row].shared1.degree - 1 ; /* guard against integer overflow */ score = numext::mini(score, n_col) ; } /* determine pruned column length */ col_length = (IndexType) (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) */ COLAMD_DEBUG2 (("Newly null killed: %d\n", c)) ; Col [c].shared2.order = --n_col2 ; Col[c].kill_principal() ; } else { /* set column length and set score */ COLAMD_ASSERT (score >= 0) ; COLAMD_ASSERT (score <= n_col) ; Col [c].length = col_length ; Col [c].shared2.score = score ; } } COLAMD_DEBUG1 (("colamd: Dense, null, and newly-null columns killed: %d\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. */ /* === Initialize degree lists ========================================== */ /* clear the hash buckets */ for (c = 0 ; c <= n_col ; c++) { head [c] = Empty ; } min_score = n_col ; /* place in reverse order, so low column indices are at the front */ /* of the lists. This is to encourage natural tie-breaking */ for (c = n_col-1 ; c >= 0 ; c--) { /* only add principal columns to degree lists */ if (Col[c].is_alive()) { COLAMD_DEBUG4 (("place %d score %d minscore %d ncol %d\n", c, Col [c].shared2.score, min_score, n_col)) ; /* === Add columns score to DList =============================== */ score = Col [c].shared2.score ; COLAMD_ASSERT (min_score >= 0) ; COLAMD_ASSERT (min_score <= n_col) ; COLAMD_ASSERT (score >= 0) ; COLAMD_ASSERT (score <= n_col) ; COLAMD_ASSERT (head [score] >= Empty) ; /* now add this column to dList at proper score location */ next_col = head [score] ; Col [c].shared3.prev = Empty ; Col [c].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 = c ; } head [score] = c ; /* see if this score is less than current min */ min_score = numext::mini(min_score, score) ; } } /* === Return number of remaining columns, and max row degree =========== */ *p_n_col2 = n_col2 ; *p_n_row2 = n_row2 ; *p_max_deg = max_deg ; } /* ========================================================================== */ /* === 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. */ template static IndexType find_ordering /* return the number of garbage collections */ ( /* === Parameters ======================================================= */ IndexType n_row, /* number of rows of A */ IndexType n_col, /* number of columns of A */ IndexType Alen, /* size of A, 2*nnz + n_col or larger */ RowStructure Row [], /* of size n_row+1 */ ColStructure Col [], /* of size n_col+1 */ IndexType A [], /* column form and row form of A */ IndexType head [], /* of size n_col+1 */ IndexType n_col2, /* Remaining columns to order */ IndexType max_deg, /* Maximum row degree */ IndexType pfree /* index of first free slot (2*nnz on entry) */ ) { /* === Local variables ================================================== */ IndexType k ; /* current pivot ordering step */ IndexType pivot_col ; /* current pivot column */ IndexType *cp ; /* a column pointer */ IndexType *rp ; /* a row pointer */ IndexType pivot_row ; /* current pivot row */ IndexType *new_cp ; /* modified column pointer */ IndexType *new_rp ; /* modified row pointer */ IndexType pivot_row_start ; /* pointer to start of pivot row */ IndexType pivot_row_degree ; /* number of columns in pivot row */ IndexType pivot_row_length ; /* number of supercolumns in pivot row */ IndexType pivot_col_score ; /* score of pivot column */ IndexType needed_memory ; /* free space needed for pivot row */ IndexType *cp_end ; /* pointer to the end of a column */ IndexType *rp_end ; /* pointer to the end of a row */ IndexType row ; /* a row index */ IndexType col ; /* a column index */ IndexType max_score ; /* maximum possible score */ IndexType cur_score ; /* score of current column */ unsigned int hash ; /* hash value for supernode detection */ IndexType head_column ; /* head of hash bucket */ IndexType first_col ; /* first column in hash bucket */ IndexType tag_mark ; /* marker value for mark array */ IndexType row_mark ; /* Row [row].shared2.mark */ IndexType set_difference ; /* set difference size of row with pivot row */ IndexType min_score ; /* smallest column score */ IndexType col_thickness ; /* "thickness" (no. of columns in a supercol) */ IndexType max_mark ; /* maximum value of tag_mark */ IndexType pivot_col_thickness ; /* number of columns represented by pivot col */ IndexType prev_col ; /* Used by Dlist operations. */ IndexType next_col ; /* Used by Dlist operations. */ IndexType ngarbage ; /* number of garbage collections performed */ /* === Initialization and clear mark ==================================== */ max_mark = INT_MAX - n_col ; /* INT_MAX defined in */ tag_mark = Colamd::clear_mark (n_row, Row) ; min_score = 0 ; ngarbage = 0 ; COLAMD_DEBUG1 (("colamd: Ordering, n_col2=%d\n", n_col2)) ; /* === Order the columns ================================================ */ for (k = 0 ; k < n_col2 ; /* 'k' is incremented below */) { /* === Select pivot column, and order it ============================ */ /* make sure degree list isn't empty */ COLAMD_ASSERT (min_score >= 0) ; COLAMD_ASSERT (min_score <= n_col) ; COLAMD_ASSERT (head [min_score] >= Empty) ; /* get pivot column from head of minimum degree list */ while (min_score < n_col && head [min_score] == Empty) { min_score++ ; } pivot_col = head [min_score] ; COLAMD_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 ; } COLAMD_ASSERT (Col[pivot_col].is_alive()) ; COLAMD_DEBUG3 (("Pivot col: %d\n", 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 ; COLAMD_ASSERT (pivot_col_thickness > 0) ; /* === Garbage_collection, if necessary ============================= */ needed_memory = numext::mini(pivot_col_score, n_col - k) ; if (pfree + needed_memory >= Alen) { pfree = Colamd::garbage_collection (n_row, n_col, Row, Col, A, &A [pfree]) ; ngarbage++ ; /* after garbage collection we will have enough */ COLAMD_ASSERT (pfree + needed_memory < Alen) ; /* garbage collection has wiped out the Row[].shared2.mark array */ tag_mark = Colamd::clear_mark (n_row, Row) ; } /* === 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 ; /* 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++ ; COLAMD_DEBUG4 (("Pivot col pattern %d %d\n", Row[row].is_alive(), row)) ; /* skip if row is dead */ if (Row[row].is_dead()) { continue ; } 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[col].is_alive()) { /* tag column in pivot row */ Col [col].shared1.thickness = -col_thickness ; COLAMD_ASSERT (pfree < Alen) ; /* place column in pivot row */ A [pfree++] = col ; pivot_row_degree += col_thickness ; } } } /* clear tag on pivot column */ Col [pivot_col].shared1.thickness = pivot_col_thickness ; max_deg = numext::maxi(max_deg, pivot_row_degree) ; /* === 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++ ; COLAMD_DEBUG3 (("Kill row in pivot col: %d\n", row)) ; Row[row].kill() ; } /* === 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] ; COLAMD_DEBUG3 (("Pivotal row is %d\n", pivot_row)) ; } else { /* there is no pivot row, since it is of zero length */ pivot_row = Empty ; COLAMD_ASSERT (pivot_row_length == 0) ; } COLAMD_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 ====================================== */ COLAMD_DEBUG3 (("** Computing set differences phase. **\n")) ; /* pivot row is currently dead - it will be revived later. */ COLAMD_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++ ; COLAMD_ASSERT (Col[col].is_alive() && col != pivot_col) ; COLAMD_DEBUG3 (("Col: %d\n", col)) ; /* clear tags used to construct pivot row pattern */ col_thickness = -Col [col].shared1.thickness ; COLAMD_ASSERT (col_thickness > 0) ; Col [col].shared1.thickness = col_thickness ; /* === Remove column from degree list =========================== */ cur_score = Col [col].shared2.score ; prev_col = Col [col].shared3.prev ; next_col = Col [col].shared4.degree_next ; COLAMD_ASSERT (cur_score >= 0) ; COLAMD_ASSERT (cur_score <= n_col) ; COLAMD_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++ ; /* skip if dead */ if (Row[row].is_dead()) { continue ; } row_mark = Row [row].shared2.mark ; COLAMD_ASSERT (row != pivot_row) ; set_difference = row_mark - tag_mark ; /* check if the row has been seen yet */ if (set_difference < 0) { COLAMD_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 ; COLAMD_ASSERT (set_difference >= 0) ; /* absorb this row if the set difference becomes zero */ if (set_difference == 0) { COLAMD_DEBUG3 (("aggressive absorption. Row: %d\n", row)) ; Row[row].kill() ; } else { /* save the new mark */ Row [row].shared2.mark = set_difference + tag_mark ; } } } /* === Add up set differences for each column ======================= */ COLAMD_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++ ; COLAMD_ASSERT (Col[col].is_alive() && 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 ; COLAMD_DEBUG4 (("Adding set diffs for Col: %d.\n", col)) ; while (cp < cp_end) { /* get a row */ row = *cp++ ; COLAMD_ASSERT(row >= 0 && row < n_row) ; /* skip if dead */ if (Row [row].is_dead()) { continue ; } row_mark = Row [row].shared2.mark ; COLAMD_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 = numext::mini(cur_score, n_col) ; } /* recompute the column's length */ Col [col].length = (IndexType) (new_cp - &A [Col [col].start]) ; /* === Further mass elimination ================================= */ if (Col [col].length == 0) { COLAMD_DEBUG4 (("further mass elimination. Col: %d\n", col)) ; /* nothing left but the pivot row in this column */ Col[col].kill_principal() ; pivot_row_degree -= Col [col].shared1.thickness ; COLAMD_ASSERT (pivot_row_degree >= 0) ; /* order it */ Col [col].shared2.order = k ; /* increment order count by column thickness */ k += Col [col].shared1.thickness ; } else { /* === Prepare for supercolumn detection ==================== */ COLAMD_DEBUG4 (("Preparing supercol detection for Col: %d.\n", col)) ; /* save score so far */ Col [col].shared2.score = cur_score ; /* add column to hash table, for supercolumn detection */ hash %= n_col + 1 ; COLAMD_DEBUG4 ((" Hash = %d, n_col = %d.\n", hash, n_col)) ; COLAMD_ASSERT (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 = (IndexType) hash ; COLAMD_ASSERT (Col[col].is_alive()) ; } } /* The approximate external column degree is now computed. */ /* === Supercolumn detection ======================================== */ COLAMD_DEBUG3 (("** Supercolumn detection phase. **\n")) ; Colamd::detect_super_cols (Col, A, head, pivot_row_start, pivot_row_length) ; /* === Kill the pivotal column ====================================== */ Col[pivot_col].kill_principal() ; /* === Clear mark =================================================== */ tag_mark += (max_deg + 1) ; if (tag_mark >= max_mark) { COLAMD_DEBUG2 (("clearing tag_mark\n")) ; tag_mark = Colamd::clear_mark (n_row, Row) ; } /* === Finalize the new pivot row, and column scores ================ */ COLAMD_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[col].is_dead()) { 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 = numext::mini(cur_score, max_score) ; COLAMD_ASSERT (cur_score >= 0) ; /* store updated score */ Col [col].shared2.score = cur_score ; /* === Place column back in degree list ========================= */ COLAMD_ASSERT (min_score >= 0) ; COLAMD_ASSERT (min_score <= n_col) ; COLAMD_ASSERT (cur_score >= 0) ; COLAMD_ASSERT (cur_score <= n_col) ; COLAMD_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 = numext::mini(min_score, cur_score) ; } /* === Resurrect the new pivot row ================================== */ if (pivot_row_degree > 0) { /* 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 = (IndexType) (new_rp - &A[pivot_row_start]) ; Row [pivot_row].shared1.degree = pivot_row_degree ; Row [pivot_row].shared2.mark = 0 ; /* pivot row is no longer dead */ } } /* === All principal columns have now been ordered ====================== */ return (ngarbage) ; } /* ========================================================================== */ /* === order_children ======================================================= */ /* ========================================================================== */ /* The find_ordering routine has ordered all of the principal columns (the representatives of the supercolumns). The non-principal columns have not yet been ordered. This routine orders those columns by walking up the parent tree (a column is a child of the column which absorbed it). The final permutation vector is then placed in p [0 ... n_col-1], with p [0] being the first column, and p [n_col-1] being the last. It doesn't look like it at first glance, but be assured that this routine takes time linear in the number of columns. Although not immediately obvious, the time taken by this routine is O (n_col), that is, linear in the number of columns. Not user-callable. */ template static inline void order_children ( /* === Parameters ======================================================= */ IndexType n_col, /* number of columns of A */ ColStructure Col [], /* of size n_col+1 */ IndexType p [] /* p [0 ... n_col-1] is the column permutation*/ ) { /* === Local variables ================================================== */ IndexType i ; /* loop counter for all columns */ IndexType c ; /* column index */ IndexType parent ; /* index of column's parent */ IndexType order ; /* column's order */ /* === Order each non-principal column ================================== */ for (i = 0 ; i < n_col ; i++) { /* find an un-ordered non-principal column */ COLAMD_ASSERT (col_is_dead(Col, i)) ; if (!Col[i].is_dead_principal() && Col [i].shared2.order == Empty) { parent = i ; /* once found, find its principal parent */ do { parent = Col [parent].shared1.parent ; } while (!Col[parent].is_dead_principal()) ; /* now, order all un-ordered non-principal columns along path */ /* to this parent. collapse tree at the same time */ c = i ; /* get order of parent */ order = Col [parent].shared2.order ; do { COLAMD_ASSERT (Col [c].shared2.order == Empty) ; /* order this column */ Col [c].shared2.order = order++ ; /* collaps tree */ Col [c].shared1.parent = parent ; /* get immediate parent of this column */ c = Col [c].shared1.parent ; /* continue until we hit an ordered column. There are */ /* guaranteed not to be anymore unordered columns */ /* above an ordered column */ } while (Col [c].shared2.order == Empty) ; /* re-order the super_col parent to largest order for this group */ Col [parent].shared2.order = order ; } } /* === Generate the permutation ========================================= */ for (c = 0 ; c < n_col ; c++) { p [Col [c].shared2.order] = c ; } } /* ========================================================================== */ /* === 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. */ template static void detect_super_cols ( /* === Parameters ======================================================= */ ColStructure Col [], /* of size n_col+1 */ IndexType A [], /* row indices of A */ IndexType head [], /* head of degree lists and hash buckets */ IndexType row_start, /* pointer to set of columns to check */ IndexType row_length /* number of columns to check */ ) { /* === Local variables ================================================== */ IndexType hash ; /* hash value for a column */ IndexType *rp ; /* pointer to a row */ IndexType c ; /* a column index */ IndexType super_c ; /* column index of the column to absorb into */ IndexType *cp1 ; /* column pointer for column super_c */ IndexType *cp2 ; /* column pointer for column c */ IndexType length ; /* length of column super_c */ IndexType prev_c ; /* column preceding c in hash bucket */ IndexType i ; /* loop counter */ IndexType *rp_end ; /* pointer to the end of the row */ IndexType col ; /* a column index in the row to check */ IndexType head_column ; /* first column in hash bucket or degree list */ IndexType 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[col].is_dead()) { continue ; } /* get hash number for this column */ hash = Col [col].shared3.hash ; COLAMD_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) { COLAMD_ASSERT (Col [super_c].is_alive()) ; COLAMD_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) { COLAMD_ASSERT (c != super_c) ; COLAMD_ASSERT (Col[c].is_alive()) ; COLAMD_ASSERT (Col [c].shared3.hash == hash) ; /* not identical if lengths or scores are different */ if (Col [c].length != length || Col [c].shared2.score != Col [super_c].shared2.score) { 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) */ COLAMD_ASSERT ( cp1->is_alive() ); COLAMD_ASSERT ( cp2->is_alive() ); /* row indices will same order for both supercols, */ /* no gather scatter necessary */ if (*cp1++ != *cp2++) { break ; } } /* the two columns are different if the for-loop "broke" */ if (i != length) { prev_c = c ; continue ; } /* === Got it! two columns are identical =================== */ COLAMD_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 ; Col[c].kill_non_principal() ; /* 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 ; } } /* === 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 available 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. */ template static IndexType garbage_collection /* returns the new value of pfree */ ( /* === Parameters ======================================================= */ IndexType n_row, /* number of rows */ IndexType n_col, /* number of columns */ RowStructure Row [], /* row info */ ColStructure Col [], /* column info */ IndexType A [], /* A [0 ... Alen-1] holds the matrix */ IndexType *pfree /* &A [0] ... pfree is in use */ ) { /* === Local variables ================================================== */ IndexType *psrc ; /* source pointer */ IndexType *pdest ; /* destination pointer */ IndexType j ; /* counter */ IndexType r ; /* a row index */ IndexType c ; /* a column index */ IndexType length ; /* length of a row or column */ /* === Defragment the columns =========================================== */ pdest = &A[0] ; for (c = 0 ; c < n_col ; c++) { if (Col[c].is_alive()) { psrc = &A [Col [c].start] ; /* move and compact the column */ COLAMD_ASSERT (pdest <= psrc) ; Col [c].start = (IndexType) (pdest - &A [0]) ; length = Col [c].length ; for (j = 0 ; j < length ; j++) { r = *psrc++ ; if (Row[r].is_alive()) { *pdest++ = r ; } } Col [c].length = (IndexType) (pdest - &A [Col [c].start]) ; } } /* === Prepare to defragment the rows =================================== */ for (r = 0 ; r < n_row ; r++) { if (Row[r].is_alive()) { if (Row [r].length == 0) { /* this row is of zero length. cannot compact it, so kill it */ COLAMD_DEBUG3 (("Defrag row kill\n")) ; Row[r].kill() ; } else { /* save first column index in Row [r].shared2.first_column */ psrc = &A [Row [r].start] ; Row [r].shared2.first_column = *psrc ; COLAMD_ASSERT (Row[r].is_alive()) ; /* flag the start of the row with the one's complement of row */ *psrc = ones_complement(r) ; } } } /* === 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) ; COLAMD_ASSERT (r >= 0 && r < n_row) ; /* restore first column index */ *psrc = Row [r].shared2.first_column ; COLAMD_ASSERT (Row[r].is_alive()) ; /* move and compact the row */ COLAMD_ASSERT (pdest <= psrc) ; Row [r].start = (IndexType) (pdest - &A [0]) ; length = Row [r].length ; for (j = 0 ; j < length ; j++) { c = *psrc++ ; if (Col[c].is_alive()) { *pdest++ = c ; } } Row [r].length = (IndexType) (pdest - &A [Row [r].start]) ; } } /* ensure we found all the rows */ COLAMD_ASSERT (debug_rows == 0) ; /* === Return the new value of pfree ==================================== */ return ((IndexType) (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. */ template static inline IndexType clear_mark /* return the new value for tag_mark */ ( /* === Parameters ======================================================= */ IndexType n_row, /* number of rows in A */ RowStructure Row [] /* Row [0 ... n_row-1].shared2.mark is set to zero */ ) { /* === Local variables ================================================== */ IndexType r ; for (r = 0 ; r < n_row ; r++) { if (Row[r].is_alive()) { Row [r].shared2.mark = 0 ; } } return (1) ; } } // namespace Colamd } // namespace internal #endif ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/OrderingMethods/Ordering.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_ORDERING_H #define EIGEN_ORDERING_H namespace Eigen { #include "Eigen_Colamd.h" namespace internal { /** \internal * \ingroup OrderingMethods_Module * \param[in] A the input non-symmetric matrix * \param[out] symmat the symmetric pattern A^T+A from the input matrix \a A. * FIXME: The values should not be considered here */ template void ordering_helper_at_plus_a(const MatrixType& A, MatrixType& symmat) { MatrixType C; C = A.transpose(); // NOTE: Could be costly for (int i = 0; i < C.rows(); i++) { for (typename MatrixType::InnerIterator it(C, i); it; ++it) it.valueRef() = typename MatrixType::Scalar(0); } symmat = C + A; } } /** \ingroup OrderingMethods_Module * \class AMDOrdering * * Functor computing the \em approximate \em minimum \em degree ordering * If the matrix is not structurally symmetric, an ordering of A^T+A is computed * \tparam StorageIndex The type of indices of the matrix * \sa COLAMDOrdering */ template class AMDOrdering { public: typedef PermutationMatrix PermutationType; /** Compute the permutation vector from a sparse matrix * This routine is much faster if the input matrix is column-major */ template void operator()(const MatrixType& mat, PermutationType& perm) { // Compute the symmetric pattern SparseMatrix symm; internal::ordering_helper_at_plus_a(mat,symm); // Call the AMD routine //m_mat.prune(keep_diag()); internal::minimum_degree_ordering(symm, perm); } /** Compute the permutation with a selfadjoint matrix */ template void operator()(const SparseSelfAdjointView& mat, PermutationType& perm) { SparseMatrix C; C = mat; // Call the AMD routine // m_mat.prune(keep_diag()); //Remove the diagonal elements internal::minimum_degree_ordering(C, perm); } }; /** \ingroup OrderingMethods_Module * \class NaturalOrdering * * Functor computing the natural ordering (identity) * * \note Returns an empty permutation matrix * \tparam StorageIndex The type of indices of the matrix */ template class NaturalOrdering { public: typedef PermutationMatrix PermutationType; /** Compute the permutation vector from a column-major sparse matrix */ template void operator()(const MatrixType& /*mat*/, PermutationType& perm) { perm.resize(0); } }; /** \ingroup OrderingMethods_Module * \class COLAMDOrdering * * \tparam StorageIndex The type of indices of the matrix * * Functor computing the \em column \em approximate \em minimum \em degree ordering * The matrix should be in column-major and \b compressed format (see SparseMatrix::makeCompressed()). */ template class COLAMDOrdering { public: typedef PermutationMatrix PermutationType; typedef Matrix IndexVector; /** Compute the permutation vector \a perm form the sparse matrix \a mat * \warning The input sparse matrix \a mat must be in compressed mode (see SparseMatrix::makeCompressed()). */ template void operator() (const MatrixType& mat, PermutationType& perm) { eigen_assert(mat.isCompressed() && "COLAMDOrdering requires a sparse matrix in compressed mode. Call .makeCompressed() before passing it to COLAMDOrdering"); StorageIndex m = StorageIndex(mat.rows()); StorageIndex n = StorageIndex(mat.cols()); StorageIndex nnz = StorageIndex(mat.nonZeros()); // Get the recommended value of Alen to be used by colamd StorageIndex Alen = internal::Colamd::recommended(nnz, m, n); // Set the default parameters double knobs [internal::Colamd::NKnobs]; StorageIndex stats [internal::Colamd::NStats]; internal::Colamd::set_defaults(knobs); IndexVector p(n+1), A(Alen); for(StorageIndex i=0; i <= n; i++) p(i) = mat.outerIndexPtr()[i]; for(StorageIndex i=0; i < nnz; i++) A(i) = mat.innerIndexPtr()[i]; // Call Colamd routine to compute the ordering StorageIndex info = internal::Colamd::compute_ordering(m, n, Alen, A.data(), p.data(), knobs, stats); EIGEN_UNUSED_VARIABLE(info); eigen_assert( info && "COLAMD failed " ); perm.resize(n); for (StorageIndex i = 0; i < n; i++) perm.indices()(p(i)) = i; } }; } // end namespace Eigen #endif ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_PASTIXSUPPORT_H #define EIGEN_PASTIXSUPPORT_H namespace Eigen { #if defined(DCOMPLEX) #define PASTIX_COMPLEX COMPLEX #define PASTIX_DCOMPLEX DCOMPLEX #else #define PASTIX_COMPLEX std::complex #define PASTIX_DCOMPLEX std::complex #endif /** \ingroup PaStiXSupport_Module * \brief Interface to the PaStix solver * * This class is used to solve the linear systems A.X = B via the PaStix library. * The matrix can be either real or complex, symmetric or not. * * \sa TutorialSparseDirectSolvers */ template class PastixLU; template class PastixLLT; template class PastixLDLT; namespace internal { template struct pastix_traits; template struct pastix_traits< PastixLU > { typedef MatrixType_ MatrixType; typedef typename MatrixType_::Scalar Scalar; typedef typename MatrixType_::RealScalar RealScalar; typedef typename MatrixType_::StorageIndex StorageIndex; }; template struct pastix_traits< PastixLLT > { typedef MatrixType_ MatrixType; typedef typename MatrixType_::Scalar Scalar; typedef typename MatrixType_::RealScalar RealScalar; typedef typename MatrixType_::StorageIndex StorageIndex; }; template struct pastix_traits< PastixLDLT > { typedef MatrixType_ MatrixType; typedef typename MatrixType_::Scalar Scalar; typedef typename MatrixType_::RealScalar RealScalar; typedef typename MatrixType_::StorageIndex StorageIndex; }; inline void eigen_pastix(pastix_data_t **pastix_data, int pastix_comm, int n, int *ptr, int *idx, float *vals, int *perm, int * invp, float *x, int nbrhs, int *iparm, double *dparm) { if (n == 0) { ptr = NULL; idx = NULL; vals = NULL; } if (nbrhs == 0) {x = NULL; nbrhs=1;} s_pastix(pastix_data, pastix_comm, n, ptr, idx, vals, perm, invp, x, nbrhs, iparm, dparm); } inline void eigen_pastix(pastix_data_t **pastix_data, int pastix_comm, int n, int *ptr, int *idx, double *vals, int *perm, int * invp, double *x, int nbrhs, int *iparm, double *dparm) { if (n == 0) { ptr = NULL; idx = NULL; vals = NULL; } if (nbrhs == 0) {x = NULL; nbrhs=1;} d_pastix(pastix_data, pastix_comm, n, ptr, idx, vals, perm, invp, x, nbrhs, iparm, dparm); } inline void eigen_pastix(pastix_data_t **pastix_data, int pastix_comm, int n, int *ptr, int *idx, std::complex *vals, int *perm, int * invp, std::complex *x, int nbrhs, int *iparm, double *dparm) { if (n == 0) { ptr = NULL; idx = NULL; vals = NULL; } if (nbrhs == 0) {x = NULL; nbrhs=1;} c_pastix(pastix_data, pastix_comm, n, ptr, idx, reinterpret_cast(vals), perm, invp, reinterpret_cast(x), nbrhs, iparm, dparm); } inline void eigen_pastix(pastix_data_t **pastix_data, int pastix_comm, int n, int *ptr, int *idx, std::complex *vals, int *perm, int * invp, std::complex *x, int nbrhs, int *iparm, double *dparm) { if (n == 0) { ptr = NULL; idx = NULL; vals = NULL; } if (nbrhs == 0) {x = NULL; nbrhs=1;} z_pastix(pastix_data, pastix_comm, n, ptr, idx, reinterpret_cast(vals), perm, invp, reinterpret_cast(x), nbrhs, iparm, dparm); } // Convert the matrix to Fortran-style Numbering template void c_to_fortran_numbering (MatrixType& mat) { if ( !(mat.outerIndexPtr()[0]) ) { int i; for(i = 0; i <= mat.rows(); ++i) ++mat.outerIndexPtr()[i]; for(i = 0; i < mat.nonZeros(); ++i) ++mat.innerIndexPtr()[i]; } } // Convert to C-style Numbering template void fortran_to_c_numbering (MatrixType& mat) { // Check the Numbering if ( mat.outerIndexPtr()[0] == 1 ) { // Convert to C-style numbering int i; for(i = 0; i <= mat.rows(); ++i) --mat.outerIndexPtr()[i]; for(i = 0; i < mat.nonZeros(); ++i) --mat.innerIndexPtr()[i]; } } } // This is the base class to interface with PaStiX functions. // Users should not used this class directly. template class PastixBase : public SparseSolverBase { protected: typedef SparseSolverBase Base; using Base::derived; using Base::m_isInitialized; public: using Base::_solve_impl; typedef typename internal::pastix_traits::MatrixType MatrixType_; typedef MatrixType_ MatrixType; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef typename MatrixType::StorageIndex StorageIndex; typedef Matrix Vector; typedef SparseMatrix ColSpMatrix; enum { ColsAtCompileTime = MatrixType::ColsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; public: PastixBase() : m_initisOk(false), m_analysisIsOk(false), m_factorizationIsOk(false), m_pastixdata(0), m_size(0) { init(); } ~PastixBase() { clean(); } template bool _solve_impl(const MatrixBase &b, MatrixBase &x) const; /** Returns a reference to the integer vector IPARM of PaStiX parameters * to modify the default parameters. * The statistics related to the different phases of factorization and solve are saved here as well * \sa analyzePattern() factorize() */ Array& iparm() { return m_iparm; } /** Return a reference to a particular index parameter of the IPARM vector * \sa iparm() */ int& iparm(int idxparam) { return m_iparm(idxparam); } /** Returns a reference to the double vector DPARM of PaStiX parameters * The statistics related to the different phases of factorization and solve are saved here as well * \sa analyzePattern() factorize() */ Array& dparm() { return m_dparm; } /** Return a reference to a particular index parameter of the DPARM vector * \sa dparm() */ double& dparm(int idxparam) { return m_dparm(idxparam); } inline Index cols() const { return m_size; } inline Index rows() const { return m_size; } /** \brief Reports whether previous computation was successful. * * \returns \c Success if computation was successful, * \c NumericalIssue if the PaStiX reports a problem * \c InvalidInput if the input matrix is invalid * * \sa iparm() */ ComputationInfo info() const { eigen_assert(m_isInitialized && "Decomposition is not initialized."); return m_info; } protected: // Initialize the Pastix data structure, check the matrix void init(); // Compute the ordering and the symbolic factorization void analyzePattern(ColSpMatrix& mat); // Compute the numerical factorization void factorize(ColSpMatrix& mat); // Free all the data allocated by Pastix void clean() { eigen_assert(m_initisOk && "The Pastix structure should be allocated first"); m_iparm(IPARM_START_TASK) = API_TASK_CLEAN; m_iparm(IPARM_END_TASK) = API_TASK_CLEAN; internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, 0, 0, 0, (Scalar*)0, m_perm.data(), m_invp.data(), 0, 0, m_iparm.data(), m_dparm.data()); } void compute(ColSpMatrix& mat); int m_initisOk; int m_analysisIsOk; int m_factorizationIsOk; mutable ComputationInfo m_info; mutable pastix_data_t *m_pastixdata; // Data structure for pastix mutable int m_comm; // The MPI communicator identifier mutable Array m_iparm; // integer vector for the input parameters mutable Array m_dparm; // Scalar vector for the input parameters mutable Matrix m_perm; // Permutation vector mutable Matrix m_invp; // Inverse permutation vector mutable int m_size; // Size of the matrix }; /** Initialize the PaStiX data structure. *A first call to this function fills iparm and dparm with the default PaStiX parameters * \sa iparm() dparm() */ template void PastixBase::init() { m_size = 0; m_iparm.setZero(IPARM_SIZE); m_dparm.setZero(DPARM_SIZE); m_iparm(IPARM_MODIFY_PARAMETER) = API_NO; pastix(&m_pastixdata, MPI_COMM_WORLD, 0, 0, 0, 0, 0, 0, 0, 1, m_iparm.data(), m_dparm.data()); m_iparm[IPARM_MATRIX_VERIFICATION] = API_NO; m_iparm[IPARM_VERBOSE] = API_VERBOSE_NOT; m_iparm[IPARM_ORDERING] = API_ORDER_SCOTCH; m_iparm[IPARM_INCOMPLETE] = API_NO; m_iparm[IPARM_OOC_LIMIT] = 2000; m_iparm[IPARM_RHS_MAKING] = API_RHS_B; m_iparm(IPARM_MATRIX_VERIFICATION) = API_NO; m_iparm(IPARM_START_TASK) = API_TASK_INIT; m_iparm(IPARM_END_TASK) = API_TASK_INIT; internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, 0, 0, 0, (Scalar*)0, 0, 0, 0, 0, m_iparm.data(), m_dparm.data()); // Check the returned error if(m_iparm(IPARM_ERROR_NUMBER)) { m_info = InvalidInput; m_initisOk = false; } else { m_info = Success; m_initisOk = true; } } template void PastixBase::compute(ColSpMatrix& mat) { eigen_assert(mat.rows() == mat.cols() && "The input matrix should be squared"); analyzePattern(mat); factorize(mat); m_iparm(IPARM_MATRIX_VERIFICATION) = API_NO; } template void PastixBase::analyzePattern(ColSpMatrix& mat) { eigen_assert(m_initisOk && "The initialization of PaSTiX failed"); // clean previous calls if(m_size>0) clean(); m_size = internal::convert_index(mat.rows()); m_perm.resize(m_size); m_invp.resize(m_size); m_iparm(IPARM_START_TASK) = API_TASK_ORDERING; m_iparm(IPARM_END_TASK) = API_TASK_ANALYSE; internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, m_size, mat.outerIndexPtr(), mat.innerIndexPtr(), mat.valuePtr(), m_perm.data(), m_invp.data(), 0, 0, m_iparm.data(), m_dparm.data()); // Check the returned error if(m_iparm(IPARM_ERROR_NUMBER)) { m_info = NumericalIssue; m_analysisIsOk = false; } else { m_info = Success; m_analysisIsOk = true; } } template void PastixBase::factorize(ColSpMatrix& mat) { // if(&m_cpyMat != &mat) m_cpyMat = mat; eigen_assert(m_analysisIsOk && "The analysis phase should be called before the factorization phase"); m_iparm(IPARM_START_TASK) = API_TASK_NUMFACT; m_iparm(IPARM_END_TASK) = API_TASK_NUMFACT; m_size = internal::convert_index(mat.rows()); internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, m_size, mat.outerIndexPtr(), mat.innerIndexPtr(), mat.valuePtr(), m_perm.data(), m_invp.data(), 0, 0, m_iparm.data(), m_dparm.data()); // Check the returned error if(m_iparm(IPARM_ERROR_NUMBER)) { m_info = NumericalIssue; m_factorizationIsOk = false; m_isInitialized = false; } else { m_info = Success; m_factorizationIsOk = true; m_isInitialized = true; } } /* Solve the system */ template template bool PastixBase::_solve_impl(const MatrixBase &b, MatrixBase &x) const { eigen_assert(m_isInitialized && "The matrix should be factorized first"); EIGEN_STATIC_ASSERT((Dest::Flags&RowMajorBit)==0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); int rhs = 1; x = b; /* on return, x is overwritten by the computed solution */ for (int i = 0; i < b.cols(); i++){ m_iparm[IPARM_START_TASK] = API_TASK_SOLVE; m_iparm[IPARM_END_TASK] = API_TASK_REFINE; internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, internal::convert_index(x.rows()), 0, 0, 0, m_perm.data(), m_invp.data(), &x(0, i), rhs, m_iparm.data(), m_dparm.data()); } // Check the returned error m_info = m_iparm(IPARM_ERROR_NUMBER)==0 ? Success : NumericalIssue; return m_iparm(IPARM_ERROR_NUMBER)==0; } /** \ingroup PaStiXSupport_Module * \class PastixLU * \brief Sparse direct LU solver based on PaStiX library * * This class is used to solve the linear systems A.X = B with a supernodal LU * factorization in the PaStiX library. The matrix A should be squared and nonsingular * PaStiX requires that the matrix A has a symmetric structural pattern. * This interface can symmetrize the input matrix otherwise. * The vectors or matrices X and B can be either dense or sparse. * * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> * \tparam IsStrSym Indicates if the input matrix has a symmetric pattern, default is false * NOTE : Note that if the analysis and factorization phase are called separately, * the input matrix will be symmetrized at each call, hence it is advised to * symmetrize the matrix in a end-user program and set \p IsStrSym to true * * \implsparsesolverconcept * * \sa \ref TutorialSparseSolverConcept, class SparseLU * */ template class PastixLU : public PastixBase< PastixLU > { public: typedef MatrixType_ MatrixType; typedef PastixBase > Base; typedef typename Base::ColSpMatrix ColSpMatrix; typedef typename MatrixType::StorageIndex StorageIndex; public: PastixLU() : Base() { init(); } explicit PastixLU(const MatrixType& matrix):Base() { init(); compute(matrix); } /** Compute the LU supernodal factorization of \p matrix. * iparm and dparm can be used to tune the PaStiX parameters. * see the PaStiX user's manual * \sa analyzePattern() factorize() */ void compute (const MatrixType& matrix) { m_structureIsUptodate = false; ColSpMatrix temp; grabMatrix(matrix, temp); Base::compute(temp); } /** Compute the LU symbolic factorization of \p matrix using its sparsity pattern. * Several ordering methods can be used at this step. See the PaStiX user's manual. * The result of this operation can be used with successive matrices having the same pattern as \p matrix * \sa factorize() */ void analyzePattern(const MatrixType& matrix) { m_structureIsUptodate = false; ColSpMatrix temp; grabMatrix(matrix, temp); Base::analyzePattern(temp); } /** Compute the LU supernodal factorization of \p matrix * WARNING The matrix \p matrix should have the same structural pattern * as the same used in the analysis phase. * \sa analyzePattern() */ void factorize(const MatrixType& matrix) { ColSpMatrix temp; grabMatrix(matrix, temp); Base::factorize(temp); } protected: void init() { m_structureIsUptodate = false; m_iparm(IPARM_SYM) = API_SYM_NO; m_iparm(IPARM_FACTORIZATION) = API_FACT_LU; } void grabMatrix(const MatrixType& matrix, ColSpMatrix& out) { if(IsStrSym) out = matrix; else { if(!m_structureIsUptodate) { // update the transposed structure m_transposedStructure = matrix.transpose(); // Set the elements of the matrix to zero for (Index j=0; j * \tparam UpLo The part of the matrix to use : Lower or Upper. The default is Lower as required by PaStiX * * \implsparsesolverconcept * * \sa \ref TutorialSparseSolverConcept, class SimplicialLLT */ template class PastixLLT : public PastixBase< PastixLLT > { public: typedef MatrixType_ MatrixType; typedef PastixBase > Base; typedef typename Base::ColSpMatrix ColSpMatrix; public: enum { UpLo = UpLo_ }; PastixLLT() : Base() { init(); } explicit PastixLLT(const MatrixType& matrix):Base() { init(); compute(matrix); } /** Compute the L factor of the LL^T supernodal factorization of \p matrix * \sa analyzePattern() factorize() */ void compute (const MatrixType& matrix) { ColSpMatrix temp; grabMatrix(matrix, temp); Base::compute(temp); } /** Compute the LL^T symbolic factorization of \p matrix using its sparsity pattern * The result of this operation can be used with successive matrices having the same pattern as \p matrix * \sa factorize() */ void analyzePattern(const MatrixType& matrix) { ColSpMatrix temp; grabMatrix(matrix, temp); Base::analyzePattern(temp); } /** Compute the LL^T supernodal numerical factorization of \p matrix * \sa analyzePattern() */ void factorize(const MatrixType& matrix) { ColSpMatrix temp; grabMatrix(matrix, temp); Base::factorize(temp); } protected: using Base::m_iparm; void init() { m_iparm(IPARM_SYM) = API_SYM_YES; m_iparm(IPARM_FACTORIZATION) = API_FACT_LLT; } void grabMatrix(const MatrixType& matrix, ColSpMatrix& out) { out.resize(matrix.rows(), matrix.cols()); // Pastix supports only lower, column-major matrices out.template selfadjointView() = matrix.template selfadjointView(); internal::c_to_fortran_numbering(out); } }; /** \ingroup PaStiXSupport_Module * \class PastixLDLT * \brief A sparse direct supernodal Cholesky (LLT) factorization and solver based on the PaStiX library * * This class is used to solve the linear systems A.X = B via a LDL^T supernodal Cholesky factorization * available in the PaStiX library. The matrix A should be symmetric and positive definite * WARNING Selfadjoint complex matrices are not supported in the current version of PaStiX * The vectors or matrices X and B can be either dense or sparse * * \tparam MatrixType the type of the sparse matrix A, it must be a SparseMatrix<> * \tparam UpLo The part of the matrix to use : Lower or Upper. The default is Lower as required by PaStiX * * \implsparsesolverconcept * * \sa \ref TutorialSparseSolverConcept, class SimplicialLDLT */ template class PastixLDLT : public PastixBase< PastixLDLT > { public: typedef MatrixType_ MatrixType; typedef PastixBase > Base; typedef typename Base::ColSpMatrix ColSpMatrix; public: enum { UpLo = UpLo_ }; PastixLDLT():Base() { init(); } explicit PastixLDLT(const MatrixType& matrix):Base() { init(); compute(matrix); } /** Compute the L and D factors of the LDL^T factorization of \p matrix * \sa analyzePattern() factorize() */ void compute (const MatrixType& matrix) { ColSpMatrix temp; grabMatrix(matrix, temp); Base::compute(temp); } /** Compute the LDL^T symbolic factorization of \p matrix using its sparsity pattern * The result of this operation can be used with successive matrices having the same pattern as \p matrix * \sa factorize() */ void analyzePattern(const MatrixType& matrix) { ColSpMatrix temp; grabMatrix(matrix, temp); Base::analyzePattern(temp); } /** Compute the LDL^T supernodal numerical factorization of \p matrix * */ void factorize(const MatrixType& matrix) { ColSpMatrix temp; grabMatrix(matrix, temp); Base::factorize(temp); } protected: using Base::m_iparm; void init() { m_iparm(IPARM_SYM) = API_SYM_YES; m_iparm(IPARM_FACTORIZATION) = API_FACT_LDLT; } void grabMatrix(const MatrixType& matrix, ColSpMatrix& out) { // Pastix supports only lower, column-major matrices out.resize(matrix.rows(), matrix.cols()); out.template selfadjointView() = matrix.template selfadjointView(); internal::c_to_fortran_numbering(out); } }; } // end namespace Eigen #endif ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/PardisoSupport/PardisoSupport.h ================================================ /* Copyright (c) 2011, Intel Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************** * Content : Eigen bindings to Intel(R) MKL PARDISO ******************************************************************************** */ #ifndef EIGEN_PARDISOSUPPORT_H #define EIGEN_PARDISOSUPPORT_H namespace Eigen { template class PardisoLU; template class PardisoLLT; template class PardisoLDLT; namespace internal { template struct pardiso_run_selector { static IndexType run( _MKL_DSS_HANDLE_t pt, IndexType maxfct, IndexType mnum, IndexType type, IndexType phase, IndexType n, void *a, IndexType *ia, IndexType *ja, IndexType *perm, IndexType nrhs, IndexType *iparm, IndexType msglvl, void *b, void *x) { IndexType error = 0; ::pardiso(pt, &maxfct, &mnum, &type, &phase, &n, a, ia, ja, perm, &nrhs, iparm, &msglvl, b, x, &error); return error; } }; template<> struct pardiso_run_selector { typedef long long int IndexType; static IndexType run( _MKL_DSS_HANDLE_t pt, IndexType maxfct, IndexType mnum, IndexType type, IndexType phase, IndexType n, void *a, IndexType *ia, IndexType *ja, IndexType *perm, IndexType nrhs, IndexType *iparm, IndexType msglvl, void *b, void *x) { IndexType error = 0; ::pardiso_64(pt, &maxfct, &mnum, &type, &phase, &n, a, ia, ja, perm, &nrhs, iparm, &msglvl, b, x, &error); return error; } }; template struct pardiso_traits; template struct pardiso_traits< PardisoLU > { typedef MatrixType_ MatrixType; typedef typename MatrixType_::Scalar Scalar; typedef typename MatrixType_::RealScalar RealScalar; typedef typename MatrixType_::StorageIndex StorageIndex; }; template struct pardiso_traits< PardisoLLT > { typedef MatrixType_ MatrixType; typedef typename MatrixType_::Scalar Scalar; typedef typename MatrixType_::RealScalar RealScalar; typedef typename MatrixType_::StorageIndex StorageIndex; }; template struct pardiso_traits< PardisoLDLT > { typedef MatrixType_ MatrixType; typedef typename MatrixType_::Scalar Scalar; typedef typename MatrixType_::RealScalar RealScalar; typedef typename MatrixType_::StorageIndex StorageIndex; }; } // end namespace internal template class PardisoImpl : public SparseSolverBase { protected: typedef SparseSolverBase Base; using Base::derived; using Base::m_isInitialized; typedef internal::pardiso_traits Traits; public: using Base::_solve_impl; typedef typename Traits::MatrixType MatrixType; typedef typename Traits::Scalar Scalar; typedef typename Traits::RealScalar RealScalar; typedef typename Traits::StorageIndex StorageIndex; typedef SparseMatrix SparseMatrixType; typedef Matrix VectorType; typedef Matrix IntRowVectorType; typedef Matrix IntColVectorType; typedef Array ParameterType; enum { ScalarIsComplex = NumTraits::IsComplex, ColsAtCompileTime = Dynamic, MaxColsAtCompileTime = Dynamic }; PardisoImpl() : m_analysisIsOk(false), m_factorizationIsOk(false) { eigen_assert((sizeof(StorageIndex) >= sizeof(_INTEGER_t) && sizeof(StorageIndex) <= 8) && "Non-supported index type"); m_iparm.setZero(); m_msglvl = 0; // No output m_isInitialized = false; } ~PardisoImpl() { pardisoRelease(); } inline Index cols() const { return m_size; } inline Index rows() const { return m_size; } /** \brief Reports whether previous computation was successful. * * \returns \c Success if computation was successful, * \c NumericalIssue if the matrix appears to be negative. */ ComputationInfo info() const { eigen_assert(m_isInitialized && "Decomposition is not initialized."); return m_info; } /** \warning for advanced usage only. * \returns a reference to the parameter array controlling PARDISO. * See the PARDISO manual to know how to use it. */ ParameterType& pardisoParameterArray() { return m_iparm; } /** Performs a symbolic decomposition on the sparcity of \a matrix. * * This function is particularly useful when solving for several problems having the same structure. * * \sa factorize() */ Derived& analyzePattern(const MatrixType& matrix); /** Performs a numeric decomposition of \a matrix * * The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed. * * \sa analyzePattern() */ Derived& factorize(const MatrixType& matrix); Derived& compute(const MatrixType& matrix); template void _solve_impl(const MatrixBase &b, MatrixBase &dest) const; protected: void pardisoRelease() { if(m_isInitialized) // Factorization ran at least once { internal::pardiso_run_selector::run(m_pt, 1, 1, m_type, -1, internal::convert_index(m_size),0, 0, 0, m_perm.data(), 0, m_iparm.data(), m_msglvl, NULL, NULL); m_isInitialized = false; } } void pardisoInit(int type) { m_type = type; bool symmetric = std::abs(m_type) < 10; m_iparm[0] = 1; // No solver default m_iparm[1] = 2; // use Metis for the ordering m_iparm[2] = 0; // Reserved. Set to zero. (??Numbers of processors, value of OMP_NUM_THREADS??) m_iparm[3] = 0; // No iterative-direct algorithm m_iparm[4] = 0; // No user fill-in reducing permutation m_iparm[5] = 0; // Write solution into x, b is left unchanged m_iparm[6] = 0; // Not in use m_iparm[7] = 2; // Max numbers of iterative refinement steps m_iparm[8] = 0; // Not in use m_iparm[9] = 13; // Perturb the pivot elements with 1E-13 m_iparm[10] = symmetric ? 0 : 1; // Use nonsymmetric permutation and scaling MPS m_iparm[11] = 0; // Not in use m_iparm[12] = symmetric ? 0 : 1; // Maximum weighted matching algorithm is switched-off (default for symmetric). // Try m_iparm[12] = 1 in case of inappropriate accuracy m_iparm[13] = 0; // Output: Number of perturbed pivots m_iparm[14] = 0; // Not in use m_iparm[15] = 0; // Not in use m_iparm[16] = 0; // Not in use m_iparm[17] = -1; // Output: Number of nonzeros in the factor LU m_iparm[18] = -1; // Output: Mflops for LU factorization m_iparm[19] = 0; // Output: Numbers of CG Iterations m_iparm[20] = 0; // 1x1 pivoting m_iparm[26] = 0; // No matrix checker m_iparm[27] = (sizeof(RealScalar) == 4) ? 1 : 0; m_iparm[34] = 1; // C indexing m_iparm[36] = 0; // CSR m_iparm[59] = 0; // 0 - In-Core ; 1 - Automatic switch between In-Core and Out-of-Core modes ; 2 - Out-of-Core memset(m_pt, 0, sizeof(m_pt)); } protected: // cached data to reduce reallocation, etc. void manageErrorCode(Index error) const { switch(error) { case 0: m_info = Success; break; case -4: case -7: m_info = NumericalIssue; break; default: m_info = InvalidInput; } } mutable SparseMatrixType m_matrix; mutable ComputationInfo m_info; bool m_analysisIsOk, m_factorizationIsOk; StorageIndex m_type, m_msglvl; mutable void *m_pt[64]; mutable ParameterType m_iparm; mutable IntColVectorType m_perm; Index m_size; }; template Derived& PardisoImpl::compute(const MatrixType& a) { m_size = a.rows(); eigen_assert(a.rows() == a.cols()); pardisoRelease(); m_perm.setZero(m_size); derived().getMatrix(a); Index error; error = internal::pardiso_run_selector::run(m_pt, 1, 1, m_type, 12, internal::convert_index(m_size), m_matrix.valuePtr(), m_matrix.outerIndexPtr(), m_matrix.innerIndexPtr(), m_perm.data(), 0, m_iparm.data(), m_msglvl, NULL, NULL); manageErrorCode(error); m_analysisIsOk = true; m_factorizationIsOk = true; m_isInitialized = true; return derived(); } template Derived& PardisoImpl::analyzePattern(const MatrixType& a) { m_size = a.rows(); eigen_assert(m_size == a.cols()); pardisoRelease(); m_perm.setZero(m_size); derived().getMatrix(a); Index error; error = internal::pardiso_run_selector::run(m_pt, 1, 1, m_type, 11, internal::convert_index(m_size), m_matrix.valuePtr(), m_matrix.outerIndexPtr(), m_matrix.innerIndexPtr(), m_perm.data(), 0, m_iparm.data(), m_msglvl, NULL, NULL); manageErrorCode(error); m_analysisIsOk = true; m_factorizationIsOk = false; m_isInitialized = true; return derived(); } template Derived& PardisoImpl::factorize(const MatrixType& a) { eigen_assert(m_analysisIsOk && "You must first call analyzePattern()"); eigen_assert(m_size == a.rows() && m_size == a.cols()); derived().getMatrix(a); Index error; error = internal::pardiso_run_selector::run(m_pt, 1, 1, m_type, 22, internal::convert_index(m_size), m_matrix.valuePtr(), m_matrix.outerIndexPtr(), m_matrix.innerIndexPtr(), m_perm.data(), 0, m_iparm.data(), m_msglvl, NULL, NULL); manageErrorCode(error); m_factorizationIsOk = true; return derived(); } template template void PardisoImpl::_solve_impl(const MatrixBase &b, MatrixBase& x) const { if(m_iparm[0] == 0) // Factorization was not computed { m_info = InvalidInput; return; } //Index n = m_matrix.rows(); Index nrhs = Index(b.cols()); eigen_assert(m_size==b.rows()); eigen_assert(((MatrixBase::Flags & RowMajorBit) == 0 || nrhs == 1) && "Row-major right hand sides are not supported"); eigen_assert(((MatrixBase::Flags & RowMajorBit) == 0 || nrhs == 1) && "Row-major matrices of unknowns are not supported"); eigen_assert(((nrhs == 1) || b.outerStride() == b.rows())); // switch (transposed) { // case SvNoTrans : m_iparm[11] = 0 ; break; // case SvTranspose : m_iparm[11] = 2 ; break; // case SvAdjoint : m_iparm[11] = 1 ; break; // default: // //std::cerr << "Eigen: transposition option \"" << transposed << "\" not supported by the PARDISO backend\n"; // m_iparm[11] = 0; // } Scalar* rhs_ptr = const_cast(b.derived().data()); Matrix tmp; // Pardiso cannot solve in-place if(rhs_ptr == x.derived().data()) { tmp = b; rhs_ptr = tmp.data(); } Index error; error = internal::pardiso_run_selector::run(m_pt, 1, 1, m_type, 33, internal::convert_index(m_size), m_matrix.valuePtr(), m_matrix.outerIndexPtr(), m_matrix.innerIndexPtr(), m_perm.data(), internal::convert_index(nrhs), m_iparm.data(), m_msglvl, rhs_ptr, x.derived().data()); manageErrorCode(error); } /** \ingroup PardisoSupport_Module * \class PardisoLU * \brief A sparse direct LU factorization and solver based on the PARDISO library * * This class allows to solve for A.X = B sparse linear problems via a direct LU factorization * using the Intel MKL PARDISO library. The sparse matrix A must be squared and invertible. * The vectors or matrices X and B can be either dense or sparse. * * By default, it runs in in-core mode. To enable PARDISO's out-of-core feature, set: * \code solver.pardisoParameterArray()[59] = 1; \endcode * * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> * * \implsparsesolverconcept * * \sa \ref TutorialSparseSolverConcept, class SparseLU */ template class PardisoLU : public PardisoImpl< PardisoLU > { protected: typedef PardisoImpl Base; using Base::pardisoInit; using Base::m_matrix; friend class PardisoImpl< PardisoLU >; public: typedef typename Base::Scalar Scalar; typedef typename Base::RealScalar RealScalar; using Base::compute; using Base::solve; PardisoLU() : Base() { pardisoInit(Base::ScalarIsComplex ? 13 : 11); } explicit PardisoLU(const MatrixType& matrix) : Base() { pardisoInit(Base::ScalarIsComplex ? 13 : 11); compute(matrix); } protected: void getMatrix(const MatrixType& matrix) { m_matrix = matrix; m_matrix.makeCompressed(); } }; /** \ingroup PardisoSupport_Module * \class PardisoLLT * \brief A sparse direct Cholesky (LLT) factorization and solver based on the PARDISO library * * This class allows to solve for A.X = B sparse linear problems via a LL^T Cholesky factorization * using the Intel MKL PARDISO library. The sparse matrix A must be selfajoint and positive definite. * The vectors or matrices X and B can be either dense or sparse. * * By default, it runs in in-core mode. To enable PARDISO's out-of-core feature, set: * \code solver.pardisoParameterArray()[59] = 1; \endcode * * \tparam MatrixType the type of the sparse matrix A, it must be a SparseMatrix<> * \tparam UpLo can be any bitwise combination of Upper, Lower. The default is Upper, meaning only the upper triangular part has to be used. * Upper|Lower can be used to tell both triangular parts can be used as input. * * \implsparsesolverconcept * * \sa \ref TutorialSparseSolverConcept, class SimplicialLLT */ template class PardisoLLT : public PardisoImpl< PardisoLLT > { protected: typedef PardisoImpl< PardisoLLT > Base; using Base::pardisoInit; using Base::m_matrix; friend class PardisoImpl< PardisoLLT >; public: typedef typename Base::Scalar Scalar; typedef typename Base::RealScalar RealScalar; typedef typename Base::StorageIndex StorageIndex; enum { UpLo = UpLo_ }; using Base::compute; PardisoLLT() : Base() { pardisoInit(Base::ScalarIsComplex ? 4 : 2); } explicit PardisoLLT(const MatrixType& matrix) : Base() { pardisoInit(Base::ScalarIsComplex ? 4 : 2); compute(matrix); } protected: void getMatrix(const MatrixType& matrix) { // PARDISO supports only upper, row-major matrices PermutationMatrix p_null; m_matrix.resize(matrix.rows(), matrix.cols()); m_matrix.template selfadjointView() = matrix.template selfadjointView().twistedBy(p_null); m_matrix.makeCompressed(); } }; /** \ingroup PardisoSupport_Module * \class PardisoLDLT * \brief A sparse direct Cholesky (LDLT) factorization and solver based on the PARDISO library * * This class allows to solve for A.X = B sparse linear problems via a LDL^T Cholesky factorization * using the Intel MKL PARDISO library. The sparse matrix A is assumed to be selfajoint and positive definite. * For complex matrices, A can also be symmetric only, see the \a Options template parameter. * The vectors or matrices X and B can be either dense or sparse. * * By default, it runs in in-core mode. To enable PARDISO's out-of-core feature, set: * \code solver.pardisoParameterArray()[59] = 1; \endcode * * \tparam MatrixType the type of the sparse matrix A, it must be a SparseMatrix<> * \tparam Options can be any bitwise combination of Upper, Lower, and Symmetric. The default is Upper, meaning only the upper triangular part has to be used. * Symmetric can be used for symmetric, non-selfadjoint complex matrices, the default being to assume a selfadjoint matrix. * Upper|Lower can be used to tell both triangular parts can be used as input. * * \implsparsesolverconcept * * \sa \ref TutorialSparseSolverConcept, class SimplicialLDLT */ template class PardisoLDLT : public PardisoImpl< PardisoLDLT > { protected: typedef PardisoImpl< PardisoLDLT > Base; using Base::pardisoInit; using Base::m_matrix; friend class PardisoImpl< PardisoLDLT >; public: typedef typename Base::Scalar Scalar; typedef typename Base::RealScalar RealScalar; typedef typename Base::StorageIndex StorageIndex; using Base::compute; enum { UpLo = Options&(Upper|Lower) }; PardisoLDLT() : Base() { pardisoInit(Base::ScalarIsComplex ? ( bool(Options&Symmetric) ? 6 : -4 ) : -2); } explicit PardisoLDLT(const MatrixType& matrix) : Base() { pardisoInit(Base::ScalarIsComplex ? ( bool(Options&Symmetric) ? 6 : -4 ) : -2); compute(matrix); } void getMatrix(const MatrixType& matrix) { // PARDISO supports only upper, row-major matrices PermutationMatrix p_null; m_matrix.resize(matrix.rows(), matrix.cols()); m_matrix.template selfadjointView() = matrix.template selfadjointView().twistedBy(p_null); m_matrix.makeCompressed(); } }; } // end namespace Eigen #endif // EIGEN_PARDISOSUPPORT_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/QR/ColPivHouseholderQR.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2009 Gael Guennebaud // Copyright (C) 2009 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_COLPIVOTINGHOUSEHOLDERQR_H #define EIGEN_COLPIVOTINGHOUSEHOLDERQR_H namespace Eigen { namespace internal { template struct traits > : traits { typedef MatrixXpr XprKind; typedef SolverStorage StorageKind; typedef int StorageIndex; enum { Flags = 0 }; }; } // end namespace internal /** \ingroup QR_Module * * \class ColPivHouseholderQR * * \brief Householder rank-revealing QR decomposition of a matrix with column-pivoting * * \tparam MatrixType_ the type of the matrix of which we are computing the QR decomposition * * This class performs a rank-revealing QR decomposition of a matrix \b A into matrices \b P, \b Q and \b R * such that * \f[ * \mathbf{A} \, \mathbf{P} = \mathbf{Q} \, \mathbf{R} * \f] * by using Householder transformations. Here, \b P is a permutation matrix, \b Q a unitary matrix and \b R an * upper triangular matrix. * * This decomposition performs column pivoting in order to be rank-revealing and improve * numerical stability. It is slower than HouseholderQR, and faster than FullPivHouseholderQR. * * This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism. * * \sa MatrixBase::colPivHouseholderQr() */ template class ColPivHouseholderQR : public SolverBase > { public: typedef MatrixType_ MatrixType; typedef SolverBase Base; friend class SolverBase; EIGEN_GENERIC_PUBLIC_INTERFACE(ColPivHouseholderQR) enum { MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; typedef typename internal::plain_diag_type::type HCoeffsType; typedef PermutationMatrix PermutationType; typedef typename internal::plain_row_type::type IntRowVectorType; typedef typename internal::plain_row_type::type RowVectorType; typedef typename internal::plain_row_type::type RealRowVectorType; typedef HouseholderSequence::type> HouseholderSequenceType; typedef typename MatrixType::PlainObject PlainObject; private: typedef typename PermutationType::StorageIndex PermIndexType; public: /** * \brief Default Constructor. * * The default constructor is useful in cases in which the user intends to * perform decompositions via ColPivHouseholderQR::compute(const MatrixType&). */ ColPivHouseholderQR() : m_qr(), m_hCoeffs(), m_colsPermutation(), m_colsTranspositions(), m_temp(), m_colNormsUpdated(), m_colNormsDirect(), m_isInitialized(false), m_usePrescribedThreshold(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 ColPivHouseholderQR() */ ColPivHouseholderQR(Index rows, Index cols) : m_qr(rows, cols), m_hCoeffs((std::min)(rows,cols)), m_colsPermutation(PermIndexType(cols)), m_colsTranspositions(cols), m_temp(cols), m_colNormsUpdated(cols), m_colNormsDirect(cols), m_isInitialized(false), m_usePrescribedThreshold(false) {} /** \brief Constructs a QR factorization from a given matrix * * This constructor computes the QR factorization of the matrix \a matrix by calling * the method compute(). It is a short cut for: * * \code * ColPivHouseholderQR qr(matrix.rows(), matrix.cols()); * qr.compute(matrix); * \endcode * * \sa compute() */ template explicit ColPivHouseholderQR(const EigenBase& matrix) : m_qr(matrix.rows(), matrix.cols()), m_hCoeffs((std::min)(matrix.rows(),matrix.cols())), m_colsPermutation(PermIndexType(matrix.cols())), m_colsTranspositions(matrix.cols()), m_temp(matrix.cols()), m_colNormsUpdated(matrix.cols()), m_colNormsDirect(matrix.cols()), m_isInitialized(false), m_usePrescribedThreshold(false) { compute(matrix.derived()); } /** \brief Constructs a QR factorization from a given matrix * * This overloaded constructor is provided for \link InplaceDecomposition inplace decomposition \endlink when \c MatrixType is a Eigen::Ref. * * \sa ColPivHouseholderQR(const EigenBase&) */ template explicit ColPivHouseholderQR(EigenBase& matrix) : m_qr(matrix.derived()), m_hCoeffs((std::min)(matrix.rows(),matrix.cols())), m_colsPermutation(PermIndexType(matrix.cols())), m_colsTranspositions(matrix.cols()), m_temp(matrix.cols()), m_colNormsUpdated(matrix.cols()), m_colNormsDirect(matrix.cols()), m_isInitialized(false), m_usePrescribedThreshold(false) { computeInPlace(); } #ifdef EIGEN_PARSED_BY_DOXYGEN /** This method finds a solution x to the equation Ax=b, where A is the matrix of which * *this is the QR decomposition, if any exists. * * \param b the right-hand-side of the equation to solve. * * \returns a solution. * * \note_about_checking_solutions * * \note_about_arbitrary_choice_of_solution * * Example: \include ColPivHouseholderQR_solve.cpp * Output: \verbinclude ColPivHouseholderQR_solve.out */ template inline const Solve solve(const MatrixBase& b) const; #endif HouseholderSequenceType householderQ() const; HouseholderSequenceType matrixQ() const { return householderQ(); } /** \returns a reference to the matrix where the Householder QR decomposition is stored */ const MatrixType& matrixQR() const { eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized."); return m_qr; } /** \returns a reference to the matrix where the result Householder QR is stored * \warning The strict lower part of this matrix contains internal values. * Only the upper triangular part should be referenced. To get it, use * \code matrixR().template triangularView() \endcode * For rank-deficient matrices, use * \code * matrixR().topLeftCorner(rank(), rank()).template triangularView() * \endcode */ const MatrixType& matrixR() const { eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized."); return m_qr; } template ColPivHouseholderQR& compute(const EigenBase& matrix); /** \returns a const reference to the column permutation matrix */ const PermutationType& colsPermutation() const { eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized."); return m_colsPermutation; } /** \returns the absolute value of the determinant of the matrix of which * *this is the QR decomposition. It has only linear complexity * (that is, O(n) where n is the dimension of the square matrix) * as the QR decomposition has already been computed. * * \note This is only for square matrices. * * \warning a determinant can be very big or small, so for matrices * of large enough dimension, there is a risk of overflow/underflow. * One way to work around that is to use logAbsDeterminant() instead. * * \sa logAbsDeterminant(), MatrixBase::determinant() */ typename MatrixType::RealScalar absDeterminant() const; /** \returns the natural log of the absolute value of the determinant of the matrix of which * *this is the QR decomposition. It has only linear complexity * (that is, O(n) where n is the dimension of the square matrix) * as the QR decomposition has already been computed. * * \note This is only for square matrices. * * \note This method is useful to work around the risk of overflow/underflow that's inherent * to determinant computation. * * \sa absDeterminant(), MatrixBase::determinant() */ typename MatrixType::RealScalar logAbsDeterminant() const; /** \returns the rank of the matrix of which *this is the QR decomposition. * * \note This method has to determine which pivots should be considered nonzero. * For that, it uses the threshold value that you can control by calling * setThreshold(const RealScalar&). */ inline Index rank() const { using std::abs; eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized."); RealScalar premultiplied_threshold = abs(m_maxpivot) * threshold(); Index result = 0; for(Index i = 0; i < m_nonzero_pivots; ++i) result += (abs(m_qr.coeff(i,i)) > premultiplied_threshold); return result; } /** \returns the dimension of the kernel of the matrix of which *this is the QR decomposition. * * \note This method has to determine which pivots should be considered nonzero. * For that, it uses the threshold value that you can control by calling * setThreshold(const RealScalar&). */ inline Index dimensionOfKernel() const { eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized."); return cols() - rank(); } /** \returns true if the matrix of which *this is the QR decomposition represents an injective * linear map, i.e. has trivial kernel; false otherwise. * * \note This method has to determine which pivots should be considered nonzero. * For that, it uses the threshold value that you can control by calling * setThreshold(const RealScalar&). */ inline bool isInjective() const { eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized."); return rank() == cols(); } /** \returns true if the matrix of which *this is the QR decomposition represents a surjective * linear map; false otherwise. * * \note This method has to determine which pivots should be considered nonzero. * For that, it uses the threshold value that you can control by calling * setThreshold(const RealScalar&). */ inline bool isSurjective() const { eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized."); return rank() == rows(); } /** \returns true if the matrix of which *this is the QR decomposition is invertible. * * \note This method has to determine which pivots should be considered nonzero. * For that, it uses the threshold value that you can control by calling * setThreshold(const RealScalar&). */ inline bool isInvertible() const { eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized."); return isInjective() && isSurjective(); } /** \returns the inverse of the matrix of which *this is the QR decomposition. * * \note If this matrix is not invertible, the returned matrix has undefined coefficients. * Use isInvertible() to first determine whether this matrix is invertible. */ inline const Inverse inverse() const { eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized."); return Inverse(*this); } inline Index rows() const { return m_qr.rows(); } inline Index cols() const { return m_qr.cols(); } /** \returns a const reference to the vector of Householder coefficients used to represent the factor \c Q. * * For advanced uses only. */ const HCoeffsType& hCoeffs() const { return m_hCoeffs; } /** Allows to prescribe a threshold to be used by certain methods, such as rank(), * who need to determine when pivots are to be considered nonzero. This is not used for the * QR decomposition itself. * * When it needs to get the threshold value, Eigen calls threshold(). By default, this * uses a formula to automatically determine a reasonable threshold. * Once you have called the present method setThreshold(const RealScalar&), * your value is used instead. * * \param threshold The new value to use as the threshold. * * A pivot will be considered nonzero if its absolute value is strictly greater than * \f$ \vert pivot \vert \leqslant threshold \times \vert maxpivot \vert \f$ * where maxpivot is the biggest pivot. * * If you want to come back to the default behavior, call setThreshold(Default_t) */ ColPivHouseholderQR& setThreshold(const RealScalar& threshold) { m_usePrescribedThreshold = true; m_prescribedThreshold = threshold; return *this; } /** Allows to come back to the default behavior, letting Eigen use its default formula for * determining the threshold. * * You should pass the special object Eigen::Default as parameter here. * \code qr.setThreshold(Eigen::Default); \endcode * * See the documentation of setThreshold(const RealScalar&). */ ColPivHouseholderQR& setThreshold(Default_t) { m_usePrescribedThreshold = false; return *this; } /** Returns the threshold that will be used by certain methods such as rank(). * * See the documentation of setThreshold(const RealScalar&). */ RealScalar threshold() const { eigen_assert(m_isInitialized || m_usePrescribedThreshold); return m_usePrescribedThreshold ? m_prescribedThreshold // this formula comes from experimenting (see "LU precision tuning" thread on the list) // and turns out to be identical to Higham's formula used already in LDLt. : NumTraits::epsilon() * RealScalar(m_qr.diagonalSize()); } /** \returns the number of nonzero pivots in the QR decomposition. * Here nonzero is meant in the exact sense, not in a fuzzy sense. * So that notion isn't really intrinsically interesting, but it is * still useful when implementing algorithms. * * \sa rank() */ inline Index nonzeroPivots() const { eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized."); return m_nonzero_pivots; } /** \returns the absolute value of the biggest pivot, i.e. the biggest * diagonal coefficient of R. */ RealScalar maxPivot() const { return m_maxpivot; } /** \brief Reports whether the QR factorization was successful. * * \note This function always returns \c Success. It is provided for compatibility * with other factorization routines. * \returns \c Success */ ComputationInfo info() const { eigen_assert(m_isInitialized && "Decomposition is not initialized."); return Success; } #ifndef EIGEN_PARSED_BY_DOXYGEN template void _solve_impl(const RhsType &rhs, DstType &dst) const; template void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const; #endif protected: friend class CompleteOrthogonalDecomposition; static void check_template_parameters() { EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); } void computeInPlace(); MatrixType m_qr; HCoeffsType m_hCoeffs; PermutationType m_colsPermutation; IntRowVectorType m_colsTranspositions; RowVectorType m_temp; RealRowVectorType m_colNormsUpdated; RealRowVectorType m_colNormsDirect; bool m_isInitialized, m_usePrescribedThreshold; RealScalar m_prescribedThreshold, m_maxpivot; Index m_nonzero_pivots; Index m_det_pq; }; template typename MatrixType::RealScalar ColPivHouseholderQR::absDeterminant() const { using std::abs; eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized."); eigen_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!"); return abs(m_qr.diagonal().prod()); } template typename MatrixType::RealScalar ColPivHouseholderQR::logAbsDeterminant() const { eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized."); eigen_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!"); return m_qr.diagonal().cwiseAbs().array().log().sum(); } /** Performs the QR factorization of the given matrix \a matrix. The result of * the factorization is stored into \c *this, and a reference to \c *this * is returned. * * \sa class ColPivHouseholderQR, ColPivHouseholderQR(const MatrixType&) */ template template ColPivHouseholderQR& ColPivHouseholderQR::compute(const EigenBase& matrix) { m_qr = matrix.derived(); computeInPlace(); return *this; } template void ColPivHouseholderQR::computeInPlace() { check_template_parameters(); // the column permutation is stored as int indices, so just to be sure: eigen_assert(m_qr.cols()<=NumTraits::highest()); using std::abs; Index rows = m_qr.rows(); Index cols = m_qr.cols(); Index size = m_qr.diagonalSize(); m_hCoeffs.resize(size); m_temp.resize(cols); m_colsTranspositions.resize(m_qr.cols()); Index number_of_transpositions = 0; m_colNormsUpdated.resize(cols); m_colNormsDirect.resize(cols); for (Index k = 0; k < cols; ++k) { // colNormsDirect(k) caches the most recent directly computed norm of // column k. m_colNormsDirect.coeffRef(k) = m_qr.col(k).norm(); m_colNormsUpdated.coeffRef(k) = m_colNormsDirect.coeffRef(k); } RealScalar threshold_helper = numext::abs2(m_colNormsUpdated.maxCoeff() * NumTraits::epsilon()) / RealScalar(rows); RealScalar norm_downdate_threshold = numext::sqrt(NumTraits::epsilon()); m_nonzero_pivots = size; // the generic case is that in which all pivots are nonzero (invertible case) m_maxpivot = RealScalar(0); for(Index k = 0; k < size; ++k) { // first, we look up in our table m_colNormsUpdated which column has the biggest norm Index biggest_col_index; RealScalar biggest_col_sq_norm = numext::abs2(m_colNormsUpdated.tail(cols-k).maxCoeff(&biggest_col_index)); biggest_col_index += k; // Track the number of meaningful pivots but do not stop the decomposition to make // sure that the initial matrix is properly reproduced. See bug 941. if(m_nonzero_pivots==size && biggest_col_sq_norm < threshold_helper * RealScalar(rows-k)) m_nonzero_pivots = k; // apply the transposition to the columns m_colsTranspositions.coeffRef(k) = biggest_col_index; if(k != biggest_col_index) { m_qr.col(k).swap(m_qr.col(biggest_col_index)); std::swap(m_colNormsUpdated.coeffRef(k), m_colNormsUpdated.coeffRef(biggest_col_index)); std::swap(m_colNormsDirect.coeffRef(k), m_colNormsDirect.coeffRef(biggest_col_index)); ++number_of_transpositions; } // generate the householder vector, store it below the diagonal RealScalar beta; m_qr.col(k).tail(rows-k).makeHouseholderInPlace(m_hCoeffs.coeffRef(k), beta); // apply the householder transformation to the diagonal coefficient m_qr.coeffRef(k,k) = beta; // remember the maximum absolute value of diagonal coefficients if(abs(beta) > m_maxpivot) m_maxpivot = abs(beta); // apply the householder transformation m_qr.bottomRightCorner(rows-k, cols-k-1) .applyHouseholderOnTheLeft(m_qr.col(k).tail(rows-k-1), m_hCoeffs.coeffRef(k), &m_temp.coeffRef(k+1)); // update our table of norms of the columns for (Index j = k + 1; j < cols; ++j) { // The following implements the stable norm downgrade step discussed in // http://www.netlib.org/lapack/lawnspdf/lawn176.pdf // and used in LAPACK routines xGEQPF and xGEQP3. // See lines 278-297 in http://www.netlib.org/lapack/explore-html/dc/df4/sgeqpf_8f_source.html if (m_colNormsUpdated.coeffRef(j) != RealScalar(0)) { RealScalar temp = abs(m_qr.coeffRef(k, j)) / m_colNormsUpdated.coeffRef(j); temp = (RealScalar(1) + temp) * (RealScalar(1) - temp); temp = temp < RealScalar(0) ? RealScalar(0) : temp; RealScalar temp2 = temp * numext::abs2(m_colNormsUpdated.coeffRef(j) / m_colNormsDirect.coeffRef(j)); if (temp2 <= norm_downdate_threshold) { // The updated norm has become too inaccurate so re-compute the column // norm directly. m_colNormsDirect.coeffRef(j) = m_qr.col(j).tail(rows - k - 1).norm(); m_colNormsUpdated.coeffRef(j) = m_colNormsDirect.coeffRef(j); } else { m_colNormsUpdated.coeffRef(j) *= numext::sqrt(temp); } } } } m_colsPermutation.setIdentity(PermIndexType(cols)); for(PermIndexType k = 0; k < size/*m_nonzero_pivots*/; ++k) m_colsPermutation.applyTranspositionOnTheRight(k, PermIndexType(m_colsTranspositions.coeff(k))); m_det_pq = (number_of_transpositions%2) ? -1 : 1; m_isInitialized = true; } #ifndef EIGEN_PARSED_BY_DOXYGEN template template void ColPivHouseholderQR::_solve_impl(const RhsType &rhs, DstType &dst) const { const Index nonzero_pivots = nonzeroPivots(); if(nonzero_pivots == 0) { dst.setZero(); return; } typename RhsType::PlainObject c(rhs); c.applyOnTheLeft(householderQ().setLength(nonzero_pivots).adjoint() ); m_qr.topLeftCorner(nonzero_pivots, nonzero_pivots) .template triangularView() .solveInPlace(c.topRows(nonzero_pivots)); for(Index i = 0; i < nonzero_pivots; ++i) dst.row(m_colsPermutation.indices().coeff(i)) = c.row(i); for(Index i = nonzero_pivots; i < cols(); ++i) dst.row(m_colsPermutation.indices().coeff(i)).setZero(); } template template void ColPivHouseholderQR::_solve_impl_transposed(const RhsType &rhs, DstType &dst) const { const Index nonzero_pivots = nonzeroPivots(); if(nonzero_pivots == 0) { dst.setZero(); return; } typename RhsType::PlainObject c(m_colsPermutation.transpose()*rhs); m_qr.topLeftCorner(nonzero_pivots, nonzero_pivots) .template triangularView() .transpose().template conjugateIf() .solveInPlace(c.topRows(nonzero_pivots)); dst.topRows(nonzero_pivots) = c.topRows(nonzero_pivots); dst.bottomRows(rows()-nonzero_pivots).setZero(); dst.applyOnTheLeft(householderQ().setLength(nonzero_pivots).template conjugateIf() ); } #endif namespace internal { template struct Assignment >, internal::assign_op::Scalar>, Dense2Dense> { typedef ColPivHouseholderQR QrType; typedef Inverse SrcXprType; static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &) { dst = src.nestedExpression().solve(MatrixType::Identity(src.rows(), src.cols())); } }; } // end namespace internal /** \returns the matrix Q as a sequence of householder transformations. * You can extract the meaningful part only by using: * \code qr.householderQ().setLength(qr.nonzeroPivots()) \endcode*/ template typename ColPivHouseholderQR::HouseholderSequenceType ColPivHouseholderQR ::householderQ() const { eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized."); return HouseholderSequenceType(m_qr, m_hCoeffs.conjugate()); } /** \return the column-pivoting Householder QR decomposition of \c *this. * * \sa class ColPivHouseholderQR */ template const ColPivHouseholderQR::PlainObject> MatrixBase::colPivHouseholderQr() const { return ColPivHouseholderQR(eval()); } } // end namespace Eigen #endif // EIGEN_COLPIVOTINGHOUSEHOLDERQR_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h ================================================ /* Copyright (c) 2011, Intel Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************** * Content : Eigen bindings to LAPACKe * Householder QR decomposition of a matrix with column pivoting based on * LAPACKE_?geqp3 function. ******************************************************************************** */ #ifndef EIGEN_COLPIVOTINGHOUSEHOLDERQR_LAPACKE_H #define EIGEN_COLPIVOTINGHOUSEHOLDERQR_LAPACKE_H namespace Eigen { /** \internal Specialization for the data types supported by LAPACKe */ #define EIGEN_LAPACKE_QR_COLPIV(EIGTYPE, LAPACKE_TYPE, LAPACKE_PREFIX, EIGCOLROW, LAPACKE_COLROW) \ template<> template inline \ ColPivHouseholderQR >& \ ColPivHouseholderQR >::compute( \ const EigenBase& matrix) \ \ { \ using std::abs; \ typedef Matrix MatrixType; \ typedef MatrixType::RealScalar RealScalar; \ Index rows = matrix.rows();\ Index cols = matrix.cols();\ \ m_qr = matrix;\ Index size = m_qr.diagonalSize();\ m_hCoeffs.resize(size);\ \ m_colsTranspositions.resize(cols);\ /*Index number_of_transpositions = 0;*/ \ \ m_nonzero_pivots = 0; \ m_maxpivot = RealScalar(0);\ m_colsPermutation.resize(cols); \ m_colsPermutation.indices().setZero(); \ \ lapack_int lda = internal::convert_index(m_qr.outerStride()); \ lapack_int matrix_order = LAPACKE_COLROW; \ LAPACKE_##LAPACKE_PREFIX##geqp3( matrix_order, internal::convert_index(rows), internal::convert_index(cols), \ (LAPACKE_TYPE*)m_qr.data(), lda, (lapack_int*)m_colsPermutation.indices().data(), (LAPACKE_TYPE*)m_hCoeffs.data()); \ m_isInitialized = true; \ m_maxpivot=m_qr.diagonal().cwiseAbs().maxCoeff(); \ m_hCoeffs.adjointInPlace(); \ RealScalar premultiplied_threshold = abs(m_maxpivot) * threshold(); \ lapack_int *perm = m_colsPermutation.indices().data(); \ for(Index i=0;i premultiplied_threshold);\ } \ for(Index i=0;i // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_COMPLETEORTHOGONALDECOMPOSITION_H #define EIGEN_COMPLETEORTHOGONALDECOMPOSITION_H namespace Eigen { namespace internal { template struct traits > : traits { typedef MatrixXpr XprKind; typedef SolverStorage StorageKind; typedef int StorageIndex; enum { Flags = 0 }; }; } // end namespace internal /** \ingroup QR_Module * * \class CompleteOrthogonalDecomposition * * \brief Complete orthogonal decomposition (COD) of a matrix. * * \param MatrixType the type of the matrix of which we are computing the COD. * * This class performs a rank-revealing complete orthogonal decomposition of a * matrix \b A into matrices \b P, \b Q, \b T, and \b Z such that * \f[ * \mathbf{A} \, \mathbf{P} = \mathbf{Q} \, * \begin{bmatrix} \mathbf{T} & \mathbf{0} \\ * \mathbf{0} & \mathbf{0} \end{bmatrix} \, \mathbf{Z} * \f] * by using Householder transformations. Here, \b P is a permutation matrix, * \b Q and \b Z are unitary matrices and \b T an upper triangular matrix of * size rank-by-rank. \b A may be rank deficient. * * This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism. * * \sa MatrixBase::completeOrthogonalDecomposition() */ template class CompleteOrthogonalDecomposition : public SolverBase > { public: typedef MatrixType_ MatrixType; typedef SolverBase Base; template friend struct internal::solve_assertion; EIGEN_GENERIC_PUBLIC_INTERFACE(CompleteOrthogonalDecomposition) enum { MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; typedef typename internal::plain_diag_type::type HCoeffsType; typedef PermutationMatrix PermutationType; typedef typename internal::plain_row_type::type IntRowVectorType; typedef typename internal::plain_row_type::type RowVectorType; typedef typename internal::plain_row_type::type RealRowVectorType; typedef HouseholderSequence< MatrixType, typename internal::remove_all< typename HCoeffsType::ConjugateReturnType>::type> HouseholderSequenceType; typedef typename MatrixType::PlainObject PlainObject; private: typedef typename PermutationType::Index PermIndexType; public: /** * \brief Default Constructor. * * The default constructor is useful in cases in which the user intends to * perform decompositions via * \c CompleteOrthogonalDecomposition::compute(const* MatrixType&). */ CompleteOrthogonalDecomposition() : m_cpqr(), m_zCoeffs(), m_temp() {} /** \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 CompleteOrthogonalDecomposition() */ CompleteOrthogonalDecomposition(Index rows, Index cols) : m_cpqr(rows, cols), m_zCoeffs((std::min)(rows, cols)), m_temp(cols) {} /** \brief Constructs a complete orthogonal decomposition from a given * matrix. * * This constructor computes the complete orthogonal decomposition of the * matrix \a matrix by calling the method compute(). The default * threshold for rank determination will be used. It is a short cut for: * * \code * CompleteOrthogonalDecomposition cod(matrix.rows(), * matrix.cols()); * cod.setThreshold(Default); * cod.compute(matrix); * \endcode * * \sa compute() */ template explicit CompleteOrthogonalDecomposition(const EigenBase& matrix) : m_cpqr(matrix.rows(), matrix.cols()), m_zCoeffs((std::min)(matrix.rows(), matrix.cols())), m_temp(matrix.cols()) { compute(matrix.derived()); } /** \brief Constructs a complete orthogonal decomposition from a given matrix * * This overloaded constructor is provided for \link InplaceDecomposition inplace decomposition \endlink when \c MatrixType is a Eigen::Ref. * * \sa CompleteOrthogonalDecomposition(const EigenBase&) */ template explicit CompleteOrthogonalDecomposition(EigenBase& matrix) : m_cpqr(matrix.derived()), m_zCoeffs((std::min)(matrix.rows(), matrix.cols())), m_temp(matrix.cols()) { computeInPlace(); } #ifdef EIGEN_PARSED_BY_DOXYGEN /** This method computes the minimum-norm solution X to a least squares * problem \f[\mathrm{minimize} \|A X - B\|, \f] where \b A is the matrix of * which \c *this is the complete orthogonal decomposition. * * \param b the right-hand sides of the problem to solve. * * \returns a solution. * */ template inline const Solve solve( const MatrixBase& b) const; #endif HouseholderSequenceType householderQ(void) const; HouseholderSequenceType matrixQ(void) const { return m_cpqr.householderQ(); } /** \returns the matrix \b Z. */ MatrixType matrixZ() const { MatrixType Z = MatrixType::Identity(m_cpqr.cols(), m_cpqr.cols()); applyZOnTheLeftInPlace(Z); return Z; } /** \returns a reference to the matrix where the complete orthogonal * decomposition is stored */ const MatrixType& matrixQTZ() const { return m_cpqr.matrixQR(); } /** \returns a reference to the matrix where the complete orthogonal * decomposition is stored. * \warning The strict lower part and \code cols() - rank() \endcode right * columns of this matrix contains internal values. * Only the upper triangular part should be referenced. To get it, use * \code matrixT().template triangularView() \endcode * For rank-deficient matrices, use * \code * matrixR().topLeftCorner(rank(), rank()).template triangularView() * \endcode */ const MatrixType& matrixT() const { return m_cpqr.matrixQR(); } template CompleteOrthogonalDecomposition& compute(const EigenBase& matrix) { // Compute the column pivoted QR factorization A P = Q R. m_cpqr.compute(matrix); computeInPlace(); return *this; } /** \returns a const reference to the column permutation matrix */ const PermutationType& colsPermutation() const { return m_cpqr.colsPermutation(); } /** \returns the absolute value of the determinant of the matrix of which * *this is the complete orthogonal decomposition. It has only linear * complexity (that is, O(n) where n is the dimension of the square matrix) * as the complete orthogonal decomposition has already been computed. * * \note This is only for square matrices. * * \warning a determinant can be very big or small, so for matrices * of large enough dimension, there is a risk of overflow/underflow. * One way to work around that is to use logAbsDeterminant() instead. * * \sa logAbsDeterminant(), MatrixBase::determinant() */ typename MatrixType::RealScalar absDeterminant() const; /** \returns the natural log of the absolute value of the determinant of the * matrix of which *this is the complete orthogonal decomposition. It has * only linear complexity (that is, O(n) where n is the dimension of the * square matrix) as the complete orthogonal decomposition has already been * computed. * * \note This is only for square matrices. * * \note This method is useful to work around the risk of overflow/underflow * that's inherent to determinant computation. * * \sa absDeterminant(), MatrixBase::determinant() */ typename MatrixType::RealScalar logAbsDeterminant() const; /** \returns the rank of the matrix of which *this is the complete orthogonal * decomposition. * * \note This method has to determine which pivots should be considered * nonzero. For that, it uses the threshold value that you can control by * calling setThreshold(const RealScalar&). */ inline Index rank() const { return m_cpqr.rank(); } /** \returns the dimension of the kernel of the matrix of which *this is the * complete orthogonal decomposition. * * \note This method has to determine which pivots should be considered * nonzero. For that, it uses the threshold value that you can control by * calling setThreshold(const RealScalar&). */ inline Index dimensionOfKernel() const { return m_cpqr.dimensionOfKernel(); } /** \returns true if the matrix of which *this is the decomposition represents * an injective linear map, i.e. has trivial kernel; false otherwise. * * \note This method has to determine which pivots should be considered * nonzero. For that, it uses the threshold value that you can control by * calling setThreshold(const RealScalar&). */ inline bool isInjective() const { return m_cpqr.isInjective(); } /** \returns true if the matrix of which *this is the decomposition represents * a surjective linear map; false otherwise. * * \note This method has to determine which pivots should be considered * nonzero. For that, it uses the threshold value that you can control by * calling setThreshold(const RealScalar&). */ inline bool isSurjective() const { return m_cpqr.isSurjective(); } /** \returns true if the matrix of which *this is the complete orthogonal * decomposition is invertible. * * \note This method has to determine which pivots should be considered * nonzero. For that, it uses the threshold value that you can control by * calling setThreshold(const RealScalar&). */ inline bool isInvertible() const { return m_cpqr.isInvertible(); } /** \returns the pseudo-inverse of the matrix of which *this is the complete * orthogonal decomposition. * \warning: Do not compute \c this->pseudoInverse()*rhs to solve a linear systems. * It is more efficient and numerically stable to call \c this->solve(rhs). */ inline const Inverse pseudoInverse() const { eigen_assert(m_cpqr.m_isInitialized && "CompleteOrthogonalDecomposition is not initialized."); return Inverse(*this); } inline Index rows() const { return m_cpqr.rows(); } inline Index cols() const { return m_cpqr.cols(); } /** \returns a const reference to the vector of Householder coefficients used * to represent the factor \c Q. * * For advanced uses only. */ inline const HCoeffsType& hCoeffs() const { return m_cpqr.hCoeffs(); } /** \returns a const reference to the vector of Householder coefficients * used to represent the factor \c Z. * * For advanced uses only. */ const HCoeffsType& zCoeffs() const { return m_zCoeffs; } /** Allows to prescribe a threshold to be used by certain methods, such as * rank(), who need to determine when pivots are to be considered nonzero. * Most be called before calling compute(). * * When it needs to get the threshold value, Eigen calls threshold(). By * default, this uses a formula to automatically determine a reasonable * threshold. Once you have called the present method * setThreshold(const RealScalar&), your value is used instead. * * \param threshold The new value to use as the threshold. * * A pivot will be considered nonzero if its absolute value is strictly * greater than * \f$ \vert pivot \vert \leqslant threshold \times \vert maxpivot \vert \f$ * where maxpivot is the biggest pivot. * * If you want to come back to the default behavior, call * setThreshold(Default_t) */ CompleteOrthogonalDecomposition& setThreshold(const RealScalar& threshold) { m_cpqr.setThreshold(threshold); return *this; } /** Allows to come back to the default behavior, letting Eigen use its default * formula for determining the threshold. * * You should pass the special object Eigen::Default as parameter here. * \code qr.setThreshold(Eigen::Default); \endcode * * See the documentation of setThreshold(const RealScalar&). */ CompleteOrthogonalDecomposition& setThreshold(Default_t) { m_cpqr.setThreshold(Default); return *this; } /** Returns the threshold that will be used by certain methods such as rank(). * * See the documentation of setThreshold(const RealScalar&). */ RealScalar threshold() const { return m_cpqr.threshold(); } /** \returns the number of nonzero pivots in the complete orthogonal * decomposition. Here nonzero is meant in the exact sense, not in a * fuzzy sense. So that notion isn't really intrinsically interesting, * but it is still useful when implementing algorithms. * * \sa rank() */ inline Index nonzeroPivots() const { return m_cpqr.nonzeroPivots(); } /** \returns the absolute value of the biggest pivot, i.e. the biggest * diagonal coefficient of R. */ inline RealScalar maxPivot() const { return m_cpqr.maxPivot(); } /** \brief Reports whether the complete orthogonal decomposition was * successful. * * \note This function always returns \c Success. It is provided for * compatibility * with other factorization routines. * \returns \c Success */ ComputationInfo info() const { eigen_assert(m_cpqr.m_isInitialized && "Decomposition is not initialized."); return Success; } #ifndef EIGEN_PARSED_BY_DOXYGEN template void _solve_impl(const RhsType& rhs, DstType& dst) const; template void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const; #endif protected: static void check_template_parameters() { EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); } template void _check_solve_assertion(const Rhs& b) const { EIGEN_ONLY_USED_FOR_DEBUG(b); eigen_assert(m_cpqr.m_isInitialized && "CompleteOrthogonalDecomposition is not initialized."); eigen_assert((Transpose_?derived().cols():derived().rows())==b.rows() && "CompleteOrthogonalDecomposition::solve(): invalid number of rows of the right hand side matrix b"); } void computeInPlace(); /** Overwrites \b rhs with \f$ \mathbf{Z} * \mathbf{rhs} \f$ or * \f$ \mathbf{\overline Z} * \mathbf{rhs} \f$ if \c Conjugate * is set to \c true. */ template void applyZOnTheLeftInPlace(Rhs& rhs) const; /** Overwrites \b rhs with \f$ \mathbf{Z}^* * \mathbf{rhs} \f$. */ template void applyZAdjointOnTheLeftInPlace(Rhs& rhs) const; ColPivHouseholderQR m_cpqr; HCoeffsType m_zCoeffs; RowVectorType m_temp; }; template typename MatrixType::RealScalar CompleteOrthogonalDecomposition::absDeterminant() const { return m_cpqr.absDeterminant(); } template typename MatrixType::RealScalar CompleteOrthogonalDecomposition::logAbsDeterminant() const { return m_cpqr.logAbsDeterminant(); } /** Performs the complete orthogonal decomposition of the given matrix \a * matrix. The result of the factorization is stored into \c *this, and a * reference to \c *this is returned. * * \sa class CompleteOrthogonalDecomposition, * CompleteOrthogonalDecomposition(const MatrixType&) */ template void CompleteOrthogonalDecomposition::computeInPlace() { check_template_parameters(); // the column permutation is stored as int indices, so just to be sure: eigen_assert(m_cpqr.cols() <= NumTraits::highest()); const Index rank = m_cpqr.rank(); const Index cols = m_cpqr.cols(); const Index rows = m_cpqr.rows(); m_zCoeffs.resize((std::min)(rows, cols)); m_temp.resize(cols); if (rank < cols) { // We have reduced the (permuted) matrix to the form // [R11 R12] // [ 0 R22] // where R11 is r-by-r (r = rank) upper triangular, R12 is // r-by-(n-r), and R22 is empty or the norm of R22 is negligible. // We now compute the complete orthogonal decomposition by applying // Householder transformations from the right to the upper trapezoidal // matrix X = [R11 R12] to zero out R12 and obtain the factorization // [R11 R12] = [T11 0] * Z, where T11 is r-by-r upper triangular and // Z = Z(0) * Z(1) ... Z(r-1) is an n-by-n orthogonal matrix. // We store the data representing Z in R12 and m_zCoeffs. for (Index k = rank - 1; k >= 0; --k) { if (k != rank - 1) { // Given the API for Householder reflectors, it is more convenient if // we swap the leading parts of columns k and r-1 (zero-based) to form // the matrix X_k = [X(0:k, k), X(0:k, r:n)] m_cpqr.m_qr.col(k).head(k + 1).swap( m_cpqr.m_qr.col(rank - 1).head(k + 1)); } // Construct Householder reflector Z(k) to zero out the last row of X_k, // i.e. choose Z(k) such that // [X(k, k), X(k, r:n)] * Z(k) = [beta, 0, .., 0]. RealScalar beta; m_cpqr.m_qr.row(k) .tail(cols - rank + 1) .makeHouseholderInPlace(m_zCoeffs(k), beta); m_cpqr.m_qr(k, rank - 1) = beta; if (k > 0) { // Apply Z(k) to the first k rows of X_k m_cpqr.m_qr.topRightCorner(k, cols - rank + 1) .applyHouseholderOnTheRight( m_cpqr.m_qr.row(k).tail(cols - rank).adjoint(), m_zCoeffs(k), &m_temp(0)); } if (k != rank - 1) { // Swap X(0:k,k) back to its proper location. m_cpqr.m_qr.col(k).head(k + 1).swap( m_cpqr.m_qr.col(rank - 1).head(k + 1)); } } } } template template void CompleteOrthogonalDecomposition::applyZOnTheLeftInPlace( Rhs& rhs) const { const Index cols = this->cols(); const Index nrhs = rhs.cols(); const Index rank = this->rank(); Matrix temp((std::max)(cols, nrhs)); for (Index k = rank-1; k >= 0; --k) { if (k != rank - 1) { rhs.row(k).swap(rhs.row(rank - 1)); } rhs.middleRows(rank - 1, cols - rank + 1) .applyHouseholderOnTheLeft( matrixQTZ().row(k).tail(cols - rank).transpose().template conjugateIf(), zCoeffs().template conjugateIf()(k), &temp(0)); if (k != rank - 1) { rhs.row(k).swap(rhs.row(rank - 1)); } } } template template void CompleteOrthogonalDecomposition::applyZAdjointOnTheLeftInPlace( Rhs& rhs) const { const Index cols = this->cols(); const Index nrhs = rhs.cols(); const Index rank = this->rank(); Matrix temp((std::max)(cols, nrhs)); for (Index k = 0; k < rank; ++k) { if (k != rank - 1) { rhs.row(k).swap(rhs.row(rank - 1)); } rhs.middleRows(rank - 1, cols - rank + 1) .applyHouseholderOnTheLeft( matrixQTZ().row(k).tail(cols - rank).adjoint(), zCoeffs()(k), &temp(0)); if (k != rank - 1) { rhs.row(k).swap(rhs.row(rank - 1)); } } } #ifndef EIGEN_PARSED_BY_DOXYGEN template template void CompleteOrthogonalDecomposition::_solve_impl( const RhsType& rhs, DstType& dst) const { const Index rank = this->rank(); if (rank == 0) { dst.setZero(); return; } // Compute c = Q^* * rhs typename RhsType::PlainObject c(rhs); c.applyOnTheLeft(matrixQ().setLength(rank).adjoint()); // Solve T z = c(1:rank, :) dst.topRows(rank) = matrixT() .topLeftCorner(rank, rank) .template triangularView() .solve(c.topRows(rank)); const Index cols = this->cols(); if (rank < cols) { // Compute y = Z^* * [ z ] // [ 0 ] dst.bottomRows(cols - rank).setZero(); applyZAdjointOnTheLeftInPlace(dst); } // Undo permutation to get x = P^{-1} * y. dst = colsPermutation() * dst; } template template void CompleteOrthogonalDecomposition::_solve_impl_transposed(const RhsType &rhs, DstType &dst) const { const Index rank = this->rank(); if (rank == 0) { dst.setZero(); return; } typename RhsType::PlainObject c(colsPermutation().transpose()*rhs); if (rank < cols()) { applyZOnTheLeftInPlace(c); } matrixT().topLeftCorner(rank, rank) .template triangularView() .transpose().template conjugateIf() .solveInPlace(c.topRows(rank)); dst.topRows(rank) = c.topRows(rank); dst.bottomRows(rows()-rank).setZero(); dst.applyOnTheLeft(householderQ().setLength(rank).template conjugateIf() ); } #endif namespace internal { template struct traits > > : traits::PlainObject> { enum { Flags = 0 }; }; template struct Assignment >, internal::assign_op::Scalar>, Dense2Dense> { typedef CompleteOrthogonalDecomposition CodType; typedef Inverse SrcXprType; static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &) { typedef Matrix IdentityMatrixType; dst = src.nestedExpression().solve(IdentityMatrixType::Identity(src.cols(), src.cols())); } }; } // end namespace internal /** \returns the matrix Q as a sequence of householder transformations */ template typename CompleteOrthogonalDecomposition::HouseholderSequenceType CompleteOrthogonalDecomposition::householderQ() const { return m_cpqr.householderQ(); } /** \return the complete orthogonal decomposition of \c *this. * * \sa class CompleteOrthogonalDecomposition */ template const CompleteOrthogonalDecomposition::PlainObject> MatrixBase::completeOrthogonalDecomposition() const { return CompleteOrthogonalDecomposition(eval()); } } // end namespace Eigen #endif // EIGEN_COMPLETEORTHOGONALDECOMPOSITION_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/QR/FullPivHouseholderQR.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2009 Gael Guennebaud // Copyright (C) 2009 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_FULLPIVOTINGHOUSEHOLDERQR_H #define EIGEN_FULLPIVOTINGHOUSEHOLDERQR_H namespace Eigen { namespace internal { template struct traits > : traits { typedef MatrixXpr XprKind; typedef SolverStorage StorageKind; typedef int StorageIndex; enum { Flags = 0 }; }; template struct FullPivHouseholderQRMatrixQReturnType; template struct traits > { typedef typename MatrixType::PlainObject ReturnType; }; } // end namespace internal /** \ingroup QR_Module * * \class FullPivHouseholderQR * * \brief Householder rank-revealing QR decomposition of a matrix with full pivoting * * \tparam MatrixType_ the type of the matrix of which we are computing the QR decomposition * * This class performs a rank-revealing QR decomposition of a matrix \b A into matrices \b P, \b P', \b Q and \b R * such that * \f[ * \mathbf{P} \, \mathbf{A} \, \mathbf{P}' = \mathbf{Q} \, \mathbf{R} * \f] * by using Householder transformations. Here, \b P and \b P' are permutation matrices, \b Q a unitary matrix * and \b R an upper triangular matrix. * * This decomposition performs a very prudent full pivoting in order to be rank-revealing and achieve optimal * numerical stability. The trade-off is that it is slower than HouseholderQR and ColPivHouseholderQR. * * This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism. * * \sa MatrixBase::fullPivHouseholderQr() */ template class FullPivHouseholderQR : public SolverBase > { public: typedef MatrixType_ MatrixType; typedef SolverBase Base; friend class SolverBase; EIGEN_GENERIC_PUBLIC_INTERFACE(FullPivHouseholderQR) enum { MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; typedef internal::FullPivHouseholderQRMatrixQReturnType MatrixQReturnType; typedef typename internal::plain_diag_type::type HCoeffsType; typedef Matrix IntDiagSizeVectorType; typedef PermutationMatrix PermutationType; typedef typename internal::plain_row_type::type RowVectorType; typedef typename internal::plain_col_type::type ColVectorType; typedef typename MatrixType::PlainObject PlainObject; /** \brief Default Constructor. * * The default constructor is useful in cases in which the user intends to * perform decompositions via FullPivHouseholderQR::compute(const MatrixType&). */ FullPivHouseholderQR() : m_qr(), m_hCoeffs(), m_rows_transpositions(), m_cols_transpositions(), m_cols_permutation(), m_temp(), m_isInitialized(false), m_usePrescribedThreshold(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 FullPivHouseholderQR() */ FullPivHouseholderQR(Index rows, Index cols) : m_qr(rows, cols), m_hCoeffs((std::min)(rows,cols)), m_rows_transpositions((std::min)(rows,cols)), m_cols_transpositions((std::min)(rows,cols)), m_cols_permutation(cols), m_temp(cols), m_isInitialized(false), m_usePrescribedThreshold(false) {} /** \brief Constructs a QR factorization from a given matrix * * This constructor computes the QR factorization of the matrix \a matrix by calling * the method compute(). It is a short cut for: * * \code * FullPivHouseholderQR qr(matrix.rows(), matrix.cols()); * qr.compute(matrix); * \endcode * * \sa compute() */ template explicit FullPivHouseholderQR(const EigenBase& matrix) : m_qr(matrix.rows(), matrix.cols()), m_hCoeffs((std::min)(matrix.rows(), matrix.cols())), m_rows_transpositions((std::min)(matrix.rows(), matrix.cols())), m_cols_transpositions((std::min)(matrix.rows(), matrix.cols())), m_cols_permutation(matrix.cols()), m_temp(matrix.cols()), m_isInitialized(false), m_usePrescribedThreshold(false) { compute(matrix.derived()); } /** \brief Constructs a QR factorization from a given matrix * * This overloaded constructor is provided for \link InplaceDecomposition inplace decomposition \endlink when \c MatrixType is a Eigen::Ref. * * \sa FullPivHouseholderQR(const EigenBase&) */ template explicit FullPivHouseholderQR(EigenBase& matrix) : m_qr(matrix.derived()), m_hCoeffs((std::min)(matrix.rows(), matrix.cols())), m_rows_transpositions((std::min)(matrix.rows(), matrix.cols())), m_cols_transpositions((std::min)(matrix.rows(), matrix.cols())), m_cols_permutation(matrix.cols()), m_temp(matrix.cols()), m_isInitialized(false), m_usePrescribedThreshold(false) { computeInPlace(); } #ifdef EIGEN_PARSED_BY_DOXYGEN /** This method finds a solution x to the equation Ax=b, where A is the matrix of which * \c *this is the QR decomposition. * * \param b the right-hand-side of the equation to solve. * * \returns the exact or least-square solution if the rank is greater or equal to the number of columns of A, * and an arbitrary solution otherwise. * * \note_about_checking_solutions * * \note_about_arbitrary_choice_of_solution * * Example: \include FullPivHouseholderQR_solve.cpp * Output: \verbinclude FullPivHouseholderQR_solve.out */ template inline const Solve solve(const MatrixBase& b) const; #endif /** \returns Expression object representing the matrix Q */ MatrixQReturnType matrixQ(void) const; /** \returns a reference to the matrix where the Householder QR decomposition is stored */ const MatrixType& matrixQR() const { eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized."); return m_qr; } template FullPivHouseholderQR& compute(const EigenBase& matrix); /** \returns a const reference to the column permutation matrix */ const PermutationType& colsPermutation() const { eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized."); return m_cols_permutation; } /** \returns a const reference to the vector of indices representing the rows transpositions */ const IntDiagSizeVectorType& rowsTranspositions() const { eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized."); return m_rows_transpositions; } /** \returns the absolute value of the determinant of the matrix of which * *this is the QR decomposition. It has only linear complexity * (that is, O(n) where n is the dimension of the square matrix) * as the QR decomposition has already been computed. * * \note This is only for square matrices. * * \warning a determinant can be very big or small, so for matrices * of large enough dimension, there is a risk of overflow/underflow. * One way to work around that is to use logAbsDeterminant() instead. * * \sa logAbsDeterminant(), MatrixBase::determinant() */ typename MatrixType::RealScalar absDeterminant() const; /** \returns the natural log of the absolute value of the determinant of the matrix of which * *this is the QR decomposition. It has only linear complexity * (that is, O(n) where n is the dimension of the square matrix) * as the QR decomposition has already been computed. * * \note This is only for square matrices. * * \note This method is useful to work around the risk of overflow/underflow that's inherent * to determinant computation. * * \sa absDeterminant(), MatrixBase::determinant() */ typename MatrixType::RealScalar logAbsDeterminant() const; /** \returns the rank of the matrix of which *this is the QR decomposition. * * \note This method has to determine which pivots should be considered nonzero. * For that, it uses the threshold value that you can control by calling * setThreshold(const RealScalar&). */ inline Index rank() const { using std::abs; eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized."); RealScalar premultiplied_threshold = abs(m_maxpivot) * threshold(); Index result = 0; for(Index i = 0; i < m_nonzero_pivots; ++i) result += (abs(m_qr.coeff(i,i)) > premultiplied_threshold); return result; } /** \returns the dimension of the kernel of the matrix of which *this is the QR decomposition. * * \note This method has to determine which pivots should be considered nonzero. * For that, it uses the threshold value that you can control by calling * setThreshold(const RealScalar&). */ inline Index dimensionOfKernel() const { eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized."); return cols() - rank(); } /** \returns true if the matrix of which *this is the QR decomposition represents an injective * linear map, i.e. has trivial kernel; false otherwise. * * \note This method has to determine which pivots should be considered nonzero. * For that, it uses the threshold value that you can control by calling * setThreshold(const RealScalar&). */ inline bool isInjective() const { eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized."); return rank() == cols(); } /** \returns true if the matrix of which *this is the QR decomposition represents a surjective * linear map; false otherwise. * * \note This method has to determine which pivots should be considered nonzero. * For that, it uses the threshold value that you can control by calling * setThreshold(const RealScalar&). */ inline bool isSurjective() const { eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized."); return rank() == rows(); } /** \returns true if the matrix of which *this is the QR decomposition is invertible. * * \note This method has to determine which pivots should be considered nonzero. * For that, it uses the threshold value that you can control by calling * setThreshold(const RealScalar&). */ inline bool isInvertible() const { eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized."); return isInjective() && isSurjective(); } /** \returns the inverse of the matrix of which *this is the QR decomposition. * * \note If this matrix is not invertible, the returned matrix has undefined coefficients. * Use isInvertible() to first determine whether this matrix is invertible. */ inline const Inverse inverse() const { eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized."); return Inverse(*this); } inline Index rows() const { return m_qr.rows(); } inline Index cols() const { return m_qr.cols(); } /** \returns a const reference to the vector of Householder coefficients used to represent the factor \c Q. * * For advanced uses only. */ const HCoeffsType& hCoeffs() const { return m_hCoeffs; } /** Allows to prescribe a threshold to be used by certain methods, such as rank(), * who need to determine when pivots are to be considered nonzero. This is not used for the * QR decomposition itself. * * When it needs to get the threshold value, Eigen calls threshold(). By default, this * uses a formula to automatically determine a reasonable threshold. * Once you have called the present method setThreshold(const RealScalar&), * your value is used instead. * * \param threshold The new value to use as the threshold. * * A pivot will be considered nonzero if its absolute value is strictly greater than * \f$ \vert pivot \vert \leqslant threshold \times \vert maxpivot \vert \f$ * where maxpivot is the biggest pivot. * * If you want to come back to the default behavior, call setThreshold(Default_t) */ FullPivHouseholderQR& setThreshold(const RealScalar& threshold) { m_usePrescribedThreshold = true; m_prescribedThreshold = threshold; return *this; } /** Allows to come back to the default behavior, letting Eigen use its default formula for * determining the threshold. * * You should pass the special object Eigen::Default as parameter here. * \code qr.setThreshold(Eigen::Default); \endcode * * See the documentation of setThreshold(const RealScalar&). */ FullPivHouseholderQR& setThreshold(Default_t) { m_usePrescribedThreshold = false; return *this; } /** Returns the threshold that will be used by certain methods such as rank(). * * See the documentation of setThreshold(const RealScalar&). */ RealScalar threshold() const { eigen_assert(m_isInitialized || m_usePrescribedThreshold); return m_usePrescribedThreshold ? m_prescribedThreshold // this formula comes from experimenting (see "LU precision tuning" thread on the list) // and turns out to be identical to Higham's formula used already in LDLt. : NumTraits::epsilon() * RealScalar(m_qr.diagonalSize()); } /** \returns the number of nonzero pivots in the QR decomposition. * Here nonzero is meant in the exact sense, not in a fuzzy sense. * So that notion isn't really intrinsically interesting, but it is * still useful when implementing algorithms. * * \sa rank() */ inline Index nonzeroPivots() const { eigen_assert(m_isInitialized && "LU is not initialized."); return m_nonzero_pivots; } /** \returns the absolute value of the biggest pivot, i.e. the biggest * diagonal coefficient of U. */ RealScalar maxPivot() const { return m_maxpivot; } #ifndef EIGEN_PARSED_BY_DOXYGEN template void _solve_impl(const RhsType &rhs, DstType &dst) const; template void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const; #endif protected: static void check_template_parameters() { EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); } void computeInPlace(); MatrixType m_qr; HCoeffsType m_hCoeffs; IntDiagSizeVectorType m_rows_transpositions; IntDiagSizeVectorType m_cols_transpositions; PermutationType m_cols_permutation; RowVectorType m_temp; bool m_isInitialized, m_usePrescribedThreshold; RealScalar m_prescribedThreshold, m_maxpivot; Index m_nonzero_pivots; RealScalar m_precision; Index m_det_pq; }; template typename MatrixType::RealScalar FullPivHouseholderQR::absDeterminant() const { using std::abs; eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized."); eigen_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!"); return abs(m_qr.diagonal().prod()); } template typename MatrixType::RealScalar FullPivHouseholderQR::logAbsDeterminant() const { eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized."); eigen_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!"); return m_qr.diagonal().cwiseAbs().array().log().sum(); } /** Performs the QR factorization of the given matrix \a matrix. The result of * the factorization is stored into \c *this, and a reference to \c *this * is returned. * * \sa class FullPivHouseholderQR, FullPivHouseholderQR(const MatrixType&) */ template template FullPivHouseholderQR& FullPivHouseholderQR::compute(const EigenBase& matrix) { m_qr = matrix.derived(); computeInPlace(); return *this; } template void FullPivHouseholderQR::computeInPlace() { check_template_parameters(); using std::abs; Index rows = m_qr.rows(); Index cols = m_qr.cols(); Index size = (std::min)(rows,cols); m_hCoeffs.resize(size); m_temp.resize(cols); m_precision = NumTraits::epsilon() * RealScalar(size); m_rows_transpositions.resize(size); m_cols_transpositions.resize(size); Index number_of_transpositions = 0; RealScalar biggest(0); m_nonzero_pivots = size; // the generic case is that in which all pivots are nonzero (invertible case) m_maxpivot = RealScalar(0); for (Index k = 0; k < size; ++k) { Index row_of_biggest_in_corner, col_of_biggest_in_corner; typedef internal::scalar_score_coeff_op Scoring; typedef typename Scoring::result_type Score; Score score = m_qr.bottomRightCorner(rows-k, cols-k) .unaryExpr(Scoring()) .maxCoeff(&row_of_biggest_in_corner, &col_of_biggest_in_corner); row_of_biggest_in_corner += k; col_of_biggest_in_corner += k; RealScalar biggest_in_corner = internal::abs_knowing_score()(m_qr(row_of_biggest_in_corner, col_of_biggest_in_corner), score); if(k==0) biggest = biggest_in_corner; // if the corner is negligible, then we have less than full rank, and we can finish early if(internal::isMuchSmallerThan(biggest_in_corner, biggest, m_precision)) { m_nonzero_pivots = k; for(Index i = k; i < size; i++) { m_rows_transpositions.coeffRef(i) = internal::convert_index(i); m_cols_transpositions.coeffRef(i) = internal::convert_index(i); m_hCoeffs.coeffRef(i) = Scalar(0); } break; } m_rows_transpositions.coeffRef(k) = internal::convert_index(row_of_biggest_in_corner); m_cols_transpositions.coeffRef(k) = internal::convert_index(col_of_biggest_in_corner); if(k != row_of_biggest_in_corner) { m_qr.row(k).tail(cols-k).swap(m_qr.row(row_of_biggest_in_corner).tail(cols-k)); ++number_of_transpositions; } if(k != col_of_biggest_in_corner) { m_qr.col(k).swap(m_qr.col(col_of_biggest_in_corner)); ++number_of_transpositions; } RealScalar beta; m_qr.col(k).tail(rows-k).makeHouseholderInPlace(m_hCoeffs.coeffRef(k), beta); m_qr.coeffRef(k,k) = beta; // remember the maximum absolute value of diagonal coefficients if(abs(beta) > m_maxpivot) m_maxpivot = abs(beta); m_qr.bottomRightCorner(rows-k, cols-k-1) .applyHouseholderOnTheLeft(m_qr.col(k).tail(rows-k-1), m_hCoeffs.coeffRef(k), &m_temp.coeffRef(k+1)); } m_cols_permutation.setIdentity(cols); for(Index k = 0; k < size; ++k) m_cols_permutation.applyTranspositionOnTheRight(k, m_cols_transpositions.coeff(k)); m_det_pq = (number_of_transpositions%2) ? -1 : 1; m_isInitialized = true; } #ifndef EIGEN_PARSED_BY_DOXYGEN template template void FullPivHouseholderQR::_solve_impl(const RhsType &rhs, DstType &dst) const { const Index l_rank = rank(); // FIXME introduce nonzeroPivots() and use it here. and more generally, // make the same improvements in this dec as in FullPivLU. if(l_rank==0) { dst.setZero(); return; } typename RhsType::PlainObject c(rhs); Matrix temp(rhs.cols()); for (Index k = 0; k < l_rank; ++k) { Index remainingSize = rows()-k; c.row(k).swap(c.row(m_rows_transpositions.coeff(k))); c.bottomRightCorner(remainingSize, rhs.cols()) .applyHouseholderOnTheLeft(m_qr.col(k).tail(remainingSize-1), m_hCoeffs.coeff(k), &temp.coeffRef(0)); } m_qr.topLeftCorner(l_rank, l_rank) .template triangularView() .solveInPlace(c.topRows(l_rank)); for(Index i = 0; i < l_rank; ++i) dst.row(m_cols_permutation.indices().coeff(i)) = c.row(i); for(Index i = l_rank; i < cols(); ++i) dst.row(m_cols_permutation.indices().coeff(i)).setZero(); } template template void FullPivHouseholderQR::_solve_impl_transposed(const RhsType &rhs, DstType &dst) const { const Index l_rank = rank(); if(l_rank == 0) { dst.setZero(); return; } typename RhsType::PlainObject c(m_cols_permutation.transpose()*rhs); m_qr.topLeftCorner(l_rank, l_rank) .template triangularView() .transpose().template conjugateIf() .solveInPlace(c.topRows(l_rank)); dst.topRows(l_rank) = c.topRows(l_rank); dst.bottomRows(rows()-l_rank).setZero(); Matrix temp(dst.cols()); const Index size = (std::min)(rows(), cols()); for (Index k = size-1; k >= 0; --k) { Index remainingSize = rows()-k; dst.bottomRightCorner(remainingSize, dst.cols()) .applyHouseholderOnTheLeft(m_qr.col(k).tail(remainingSize-1).template conjugateIf(), m_hCoeffs.template conjugateIf().coeff(k), &temp.coeffRef(0)); dst.row(k).swap(dst.row(m_rows_transpositions.coeff(k))); } } #endif namespace internal { template struct Assignment >, internal::assign_op::Scalar>, Dense2Dense> { typedef FullPivHouseholderQR QrType; typedef Inverse SrcXprType; static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &) { dst = src.nestedExpression().solve(MatrixType::Identity(src.rows(), src.cols())); } }; /** \ingroup QR_Module * * \brief Expression type for return value of FullPivHouseholderQR::matrixQ() * * \tparam MatrixType type of underlying dense matrix */ template struct FullPivHouseholderQRMatrixQReturnType : public ReturnByValue > { public: typedef typename FullPivHouseholderQR::IntDiagSizeVectorType IntDiagSizeVectorType; typedef typename internal::plain_diag_type::type HCoeffsType; typedef Matrix WorkVectorType; FullPivHouseholderQRMatrixQReturnType(const MatrixType& qr, const HCoeffsType& hCoeffs, const IntDiagSizeVectorType& rowsTranspositions) : m_qr(qr), m_hCoeffs(hCoeffs), m_rowsTranspositions(rowsTranspositions) {} template void evalTo(ResultType& result) const { const Index rows = m_qr.rows(); WorkVectorType workspace(rows); evalTo(result, workspace); } template void evalTo(ResultType& result, WorkVectorType& workspace) const { using numext::conj; // compute the product H'_0 H'_1 ... H'_n-1, // where H_k is the k-th Householder transformation I - h_k v_k v_k' // and v_k is the k-th Householder vector [1,m_qr(k+1,k), m_qr(k+2,k), ...] const Index rows = m_qr.rows(); const Index cols = m_qr.cols(); const Index size = (std::min)(rows, cols); workspace.resize(rows); result.setIdentity(rows, rows); for (Index k = size-1; k >= 0; k--) { result.block(k, k, rows-k, rows-k) .applyHouseholderOnTheLeft(m_qr.col(k).tail(rows-k-1), conj(m_hCoeffs.coeff(k)), &workspace.coeffRef(k)); result.row(k).swap(result.row(m_rowsTranspositions.coeff(k))); } } Index rows() const { return m_qr.rows(); } Index cols() const { return m_qr.rows(); } protected: typename MatrixType::Nested m_qr; typename HCoeffsType::Nested m_hCoeffs; typename IntDiagSizeVectorType::Nested m_rowsTranspositions; }; // template // struct evaluator > // : public evaluator > > // {}; } // end namespace internal template inline typename FullPivHouseholderQR::MatrixQReturnType FullPivHouseholderQR::matrixQ() const { eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized."); return MatrixQReturnType(m_qr, m_hCoeffs, m_rows_transpositions); } /** \return the full-pivoting Householder QR decomposition of \c *this. * * \sa class FullPivHouseholderQR */ template const FullPivHouseholderQR::PlainObject> MatrixBase::fullPivHouseholderQr() const { return FullPivHouseholderQR(eval()); } } // end namespace Eigen #endif // EIGEN_FULLPIVOTINGHOUSEHOLDERQR_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/QR/HouseholderQR.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2010 Gael Guennebaud // Copyright (C) 2009 Benoit Jacob // Copyright (C) 2010 Vincent Lejeune // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_QR_H #define EIGEN_QR_H namespace Eigen { namespace internal { template struct traits > : traits { typedef MatrixXpr XprKind; typedef SolverStorage StorageKind; typedef int StorageIndex; enum { Flags = 0 }; }; } // end namespace internal /** \ingroup QR_Module * * * \class HouseholderQR * * \brief Householder QR decomposition of a matrix * * \tparam MatrixType_ the type of the matrix of which we are computing the QR decomposition * * This class performs a QR decomposition of a matrix \b A into matrices \b Q and \b R * such that * \f[ * \mathbf{A} = \mathbf{Q} \, \mathbf{R} * \f] * by using Householder transformations. Here, \b Q a unitary matrix and \b R an upper triangular matrix. * The result is stored in a compact way compatible with LAPACK. * * Note that no pivoting is performed. This is \b not a rank-revealing decomposition. * If you want that feature, use FullPivHouseholderQR or ColPivHouseholderQR instead. * * This Householder QR decomposition is faster, but less numerically stable and less feature-full than * FullPivHouseholderQR or ColPivHouseholderQR. * * This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism. * * \sa MatrixBase::householderQr() */ template class HouseholderQR : public SolverBase > { public: typedef MatrixType_ MatrixType; typedef SolverBase Base; friend class SolverBase; EIGEN_GENERIC_PUBLIC_INTERFACE(HouseholderQR) enum { MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; typedef Matrix MatrixQType; typedef typename internal::plain_diag_type::type HCoeffsType; typedef typename internal::plain_row_type::type RowVectorType; typedef HouseholderSequence::type> HouseholderSequenceType; /** * \brief Default Constructor. * * The default constructor is useful in cases in which the user intends to * perform decompositions via HouseholderQR::compute(const MatrixType&). */ HouseholderQR() : m_qr(), m_hCoeffs(), m_temp(), 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 HouseholderQR() */ HouseholderQR(Index rows, Index cols) : m_qr(rows, cols), m_hCoeffs((std::min)(rows,cols)), m_temp(cols), m_isInitialized(false) {} /** \brief Constructs a QR factorization from a given matrix * * This constructor computes the QR factorization of the matrix \a matrix by calling * the method compute(). It is a short cut for: * * \code * HouseholderQR qr(matrix.rows(), matrix.cols()); * qr.compute(matrix); * \endcode * * \sa compute() */ template explicit HouseholderQR(const EigenBase& matrix) : m_qr(matrix.rows(), matrix.cols()), m_hCoeffs((std::min)(matrix.rows(),matrix.cols())), m_temp(matrix.cols()), m_isInitialized(false) { compute(matrix.derived()); } /** \brief Constructs a QR factorization from a given matrix * * This overloaded constructor is provided for \link InplaceDecomposition inplace decomposition \endlink when * \c MatrixType is a Eigen::Ref. * * \sa HouseholderQR(const EigenBase&) */ template explicit HouseholderQR(EigenBase& matrix) : m_qr(matrix.derived()), m_hCoeffs((std::min)(matrix.rows(),matrix.cols())), m_temp(matrix.cols()), m_isInitialized(false) { computeInPlace(); } #ifdef EIGEN_PARSED_BY_DOXYGEN /** This method finds a solution x to the equation Ax=b, where A is the matrix of which * *this is the QR decomposition, if any exists. * * \param b the right-hand-side of the equation to solve. * * \returns a solution. * * \note_about_checking_solutions * * \note_about_arbitrary_choice_of_solution * * Example: \include HouseholderQR_solve.cpp * Output: \verbinclude HouseholderQR_solve.out */ template inline const Solve solve(const MatrixBase& b) const; #endif /** This method returns an expression of the unitary matrix Q as a sequence of Householder transformations. * * The returned expression can directly be used to perform matrix products. It can also be assigned to a dense Matrix object. * Here is an example showing how to recover the full or thin matrix Q, as well as how to perform matrix products using operator*: * * Example: \include HouseholderQR_householderQ.cpp * Output: \verbinclude HouseholderQR_householderQ.out */ HouseholderSequenceType householderQ() const { eigen_assert(m_isInitialized && "HouseholderQR is not initialized."); return HouseholderSequenceType(m_qr, m_hCoeffs.conjugate()); } /** \returns a reference to the matrix where the Householder QR decomposition is stored * in a LAPACK-compatible way. */ const MatrixType& matrixQR() const { eigen_assert(m_isInitialized && "HouseholderQR is not initialized."); return m_qr; } template HouseholderQR& compute(const EigenBase& matrix) { m_qr = matrix.derived(); computeInPlace(); return *this; } /** \returns the absolute value of the determinant of the matrix of which * *this is the QR decomposition. It has only linear complexity * (that is, O(n) where n is the dimension of the square matrix) * as the QR decomposition has already been computed. * * \note This is only for square matrices. * * \warning a determinant can be very big or small, so for matrices * of large enough dimension, there is a risk of overflow/underflow. * One way to work around that is to use logAbsDeterminant() instead. * * \sa logAbsDeterminant(), MatrixBase::determinant() */ typename MatrixType::RealScalar absDeterminant() const; /** \returns the natural log of the absolute value of the determinant of the matrix of which * *this is the QR decomposition. It has only linear complexity * (that is, O(n) where n is the dimension of the square matrix) * as the QR decomposition has already been computed. * * \note This is only for square matrices. * * \note This method is useful to work around the risk of overflow/underflow that's inherent * to determinant computation. * * \sa absDeterminant(), MatrixBase::determinant() */ typename MatrixType::RealScalar logAbsDeterminant() const; inline Index rows() const { return m_qr.rows(); } inline Index cols() const { return m_qr.cols(); } /** \returns a const reference to the vector of Householder coefficients used to represent the factor \c Q. * * For advanced uses only. */ const HCoeffsType& hCoeffs() const { return m_hCoeffs; } #ifndef EIGEN_PARSED_BY_DOXYGEN template void _solve_impl(const RhsType &rhs, DstType &dst) const; template void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const; #endif protected: static void check_template_parameters() { EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); } void computeInPlace(); MatrixType m_qr; HCoeffsType m_hCoeffs; RowVectorType m_temp; bool m_isInitialized; }; template typename MatrixType::RealScalar HouseholderQR::absDeterminant() const { using std::abs; eigen_assert(m_isInitialized && "HouseholderQR is not initialized."); eigen_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!"); return abs(m_qr.diagonal().prod()); } template typename MatrixType::RealScalar HouseholderQR::logAbsDeterminant() const { eigen_assert(m_isInitialized && "HouseholderQR is not initialized."); eigen_assert(m_qr.rows() == m_qr.cols() && "You can't take the determinant of a non-square matrix!"); return m_qr.diagonal().cwiseAbs().array().log().sum(); } namespace internal { /** \internal */ template void householder_qr_inplace_unblocked(MatrixQR& mat, HCoeffs& hCoeffs, typename MatrixQR::Scalar* tempData = 0) { typedef typename MatrixQR::Scalar Scalar; typedef typename MatrixQR::RealScalar RealScalar; Index rows = mat.rows(); Index cols = mat.cols(); Index size = (std::min)(rows,cols); eigen_assert(hCoeffs.size() == size); typedef Matrix TempType; TempType tempVector; if(tempData==0) { tempVector.resize(cols); tempData = tempVector.data(); } for(Index k = 0; k < size; ++k) { Index remainingRows = rows - k; Index remainingCols = cols - k - 1; RealScalar beta; mat.col(k).tail(remainingRows).makeHouseholderInPlace(hCoeffs.coeffRef(k), beta); mat.coeffRef(k,k) = beta; // apply H to remaining part of m_qr from the left mat.bottomRightCorner(remainingRows, remainingCols) .applyHouseholderOnTheLeft(mat.col(k).tail(remainingRows-1), hCoeffs.coeffRef(k), tempData+k+1); } } /** \internal */ template struct householder_qr_inplace_blocked { // This is specialized for LAPACK-supported Scalar types in HouseholderQR_LAPACKE.h static void run(MatrixQR& mat, HCoeffs& hCoeffs, Index maxBlockSize=32, typename MatrixQR::Scalar* tempData = 0) { typedef typename MatrixQR::Scalar Scalar; typedef Block BlockType; Index rows = mat.rows(); Index cols = mat.cols(); Index size = (std::min)(rows, cols); typedef Matrix TempType; TempType tempVector; if(tempData==0) { tempVector.resize(cols); tempData = tempVector.data(); } Index blockSize = (std::min)(maxBlockSize,size); Index k = 0; for (k = 0; k < size; k += blockSize) { Index bs = (std::min)(size-k,blockSize); // actual size of the block Index tcols = cols - k - bs; // trailing columns Index brows = rows-k; // rows of the block // partition the matrix: // A00 | A01 | A02 // mat = A10 | A11 | A12 // A20 | A21 | A22 // and performs the qr dec of [A11^T A12^T]^T // and update [A21^T A22^T]^T using level 3 operations. // Finally, the algorithm continue on A22 BlockType A11_21 = mat.block(k,k,brows,bs); Block hCoeffsSegment = hCoeffs.segment(k,bs); householder_qr_inplace_unblocked(A11_21, hCoeffsSegment, tempData); if(tcols) { BlockType A21_22 = mat.block(k,k+bs,brows,tcols); apply_block_householder_on_the_left(A21_22,A11_21,hCoeffsSegment, false); // false == backward } } } }; } // end namespace internal #ifndef EIGEN_PARSED_BY_DOXYGEN template template void HouseholderQR::_solve_impl(const RhsType &rhs, DstType &dst) const { const Index rank = (std::min)(rows(), cols()); typename RhsType::PlainObject c(rhs); c.applyOnTheLeft(householderQ().setLength(rank).adjoint() ); m_qr.topLeftCorner(rank, rank) .template triangularView() .solveInPlace(c.topRows(rank)); dst.topRows(rank) = c.topRows(rank); dst.bottomRows(cols()-rank).setZero(); } template template void HouseholderQR::_solve_impl_transposed(const RhsType &rhs, DstType &dst) const { const Index rank = (std::min)(rows(), cols()); typename RhsType::PlainObject c(rhs); m_qr.topLeftCorner(rank, rank) .template triangularView() .transpose().template conjugateIf() .solveInPlace(c.topRows(rank)); dst.topRows(rank) = c.topRows(rank); dst.bottomRows(rows()-rank).setZero(); dst.applyOnTheLeft(householderQ().setLength(rank).template conjugateIf() ); } #endif /** Performs the QR factorization of the given matrix \a matrix. The result of * the factorization is stored into \c *this, and a reference to \c *this * is returned. * * \sa class HouseholderQR, HouseholderQR(const MatrixType&) */ template void HouseholderQR::computeInPlace() { check_template_parameters(); Index rows = m_qr.rows(); Index cols = m_qr.cols(); Index size = (std::min)(rows,cols); m_hCoeffs.resize(size); m_temp.resize(cols); internal::householder_qr_inplace_blocked::run(m_qr, m_hCoeffs, 48, m_temp.data()); m_isInitialized = true; } /** \return the Householder QR decomposition of \c *this. * * \sa class HouseholderQR */ template const HouseholderQR::PlainObject> MatrixBase::householderQr() const { return HouseholderQR(eval()); } } // end namespace Eigen #endif // EIGEN_QR_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/QR/HouseholderQR_LAPACKE.h ================================================ /* Copyright (c) 2011, Intel Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************** * Content : Eigen bindings to LAPACKe * Householder QR decomposition of a matrix w/o pivoting based on * LAPACKE_?geqrf function. ******************************************************************************** */ #ifndef EIGEN_QR_LAPACKE_H #define EIGEN_QR_LAPACKE_H namespace Eigen { namespace internal { /** \internal Specialization for the data types supported by LAPACKe */ #define EIGEN_LAPACKE_QR_NOPIV(EIGTYPE, LAPACKE_TYPE, LAPACKE_PREFIX) \ template \ struct householder_qr_inplace_blocked \ { \ static void run(MatrixQR& mat, HCoeffs& hCoeffs, Index = 32, \ typename MatrixQR::Scalar* = 0) \ { \ lapack_int m = (lapack_int) mat.rows(); \ lapack_int n = (lapack_int) mat.cols(); \ lapack_int lda = (lapack_int) mat.outerStride(); \ lapack_int matrix_order = (MatrixQR::IsRowMajor) ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \ LAPACKE_##LAPACKE_PREFIX##geqrf( matrix_order, m, n, (LAPACKE_TYPE*)mat.data(), lda, (LAPACKE_TYPE*)hCoeffs.data()); \ hCoeffs.adjointInPlace(); \ } \ }; EIGEN_LAPACKE_QR_NOPIV(double, double, d) EIGEN_LAPACKE_QR_NOPIV(float, float, s) EIGEN_LAPACKE_QR_NOPIV(dcomplex, lapack_complex_double, z) EIGEN_LAPACKE_QR_NOPIV(scomplex, lapack_complex_float, c) } // end namespace internal } // end namespace Eigen #endif // EIGEN_QR_LAPACKE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Desire Nuentsa // Copyright (C) 2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SUITESPARSEQRSUPPORT_H #define EIGEN_SUITESPARSEQRSUPPORT_H namespace Eigen { template class SPQR; template struct SPQRMatrixQReturnType; template struct SPQRMatrixQTransposeReturnType; template struct SPQR_QProduct; namespace internal { template struct traits > { typedef typename SPQRType::MatrixType ReturnType; }; template struct traits > { typedef typename SPQRType::MatrixType ReturnType; }; template struct traits > { typedef typename Derived::PlainObject ReturnType; }; } // End namespace internal /** * \ingroup SPQRSupport_Module * \class SPQR * \brief Sparse QR factorization based on SuiteSparseQR library * * This class is used to perform a multithreaded and multifrontal rank-revealing QR decomposition * of sparse matrices. The result is then used to solve linear leasts_square systems. * Clearly, a QR factorization is returned such that A*P = Q*R where : * * P is the column permutation. Use colsPermutation() to get it. * * Q is the orthogonal matrix represented as Householder reflectors. * Use matrixQ() to get an expression and matrixQ().transpose() to get the transpose. * You can then apply it to a vector. * * R is the sparse triangular factor. Use matrixQR() to get it as SparseMatrix. * NOTE : The Index type of R is always SuiteSparse_long. You can get it with SPQR::Index * * \tparam MatrixType_ The type of the sparse matrix A, must be a column-major SparseMatrix<> * * \implsparsesolverconcept * * */ template class SPQR : public SparseSolverBase > { protected: typedef SparseSolverBase > Base; using Base::m_isInitialized; public: typedef typename MatrixType_::Scalar Scalar; typedef typename MatrixType_::RealScalar RealScalar; typedef SuiteSparse_long StorageIndex ; typedef SparseMatrix MatrixType; typedef Map > PermutationType; enum { ColsAtCompileTime = Dynamic, MaxColsAtCompileTime = Dynamic }; public: SPQR() : m_analysisIsOk(false), m_factorizationIsOk(false), m_isRUpToDate(false), m_ordering(SPQR_ORDERING_DEFAULT), m_allow_tol(SPQR_DEFAULT_TOL), m_tolerance (NumTraits::epsilon()), m_cR(0), m_E(0), m_H(0), m_HPinv(0), m_HTau(0), m_useDefaultThreshold(true) { cholmod_l_start(&m_cc); } explicit SPQR(const MatrixType_& matrix) : m_analysisIsOk(false), m_factorizationIsOk(false), m_isRUpToDate(false), m_ordering(SPQR_ORDERING_DEFAULT), m_allow_tol(SPQR_DEFAULT_TOL), m_tolerance (NumTraits::epsilon()), m_cR(0), m_E(0), m_H(0), m_HPinv(0), m_HTau(0), m_useDefaultThreshold(true) { cholmod_l_start(&m_cc); compute(matrix); } ~SPQR() { SPQR_free(); cholmod_l_finish(&m_cc); } void SPQR_free() { cholmod_l_free_sparse(&m_H, &m_cc); cholmod_l_free_sparse(&m_cR, &m_cc); cholmod_l_free_dense(&m_HTau, &m_cc); std::free(m_E); std::free(m_HPinv); } void compute(const MatrixType_& matrix) { if(m_isInitialized) SPQR_free(); MatrixType mat(matrix); /* Compute the default threshold as in MatLab, see: * Tim Davis, "Algorithm 915, SuiteSparseQR: Multifrontal Multithreaded Rank-Revealing * Sparse QR Factorization, ACM Trans. on Math. Soft. 38(1), 2011, Page 8:3 */ RealScalar pivotThreshold = m_tolerance; if(m_useDefaultThreshold) { RealScalar max2Norm = 0.0; for (int j = 0; j < mat.cols(); j++) max2Norm = numext::maxi(max2Norm, mat.col(j).norm()); if(max2Norm==RealScalar(0)) max2Norm = RealScalar(1); pivotThreshold = 20 * (mat.rows() + mat.cols()) * max2Norm * NumTraits::epsilon(); } cholmod_sparse A; A = viewAsCholmod(mat); m_rows = matrix.rows(); Index col = matrix.cols(); m_rank = SuiteSparseQR(m_ordering, pivotThreshold, col, &A, &m_cR, &m_E, &m_H, &m_HPinv, &m_HTau, &m_cc); if (!m_cR) { m_info = NumericalIssue; m_isInitialized = false; return; } m_info = Success; m_isInitialized = true; m_isRUpToDate = false; } /** * Get the number of rows of the input matrix and the Q matrix */ inline Index rows() const {return m_rows; } /** * Get the number of columns of the input matrix. */ inline Index cols() const { return m_cR->ncol; } template void _solve_impl(const MatrixBase &b, MatrixBase &dest) const { eigen_assert(m_isInitialized && " The QR factorization should be computed first, call compute()"); eigen_assert(b.cols()==1 && "This method is for vectors only"); //Compute Q^T * b typename Dest::PlainObject y, y2; y = matrixQ().transpose() * b; // Solves with the triangular matrix R Index rk = this->rank(); y2 = y; y.resize((std::max)(cols(),Index(y.rows())),y.cols()); y.topRows(rk) = this->matrixR().topLeftCorner(rk, rk).template triangularView().solve(y2.topRows(rk)); // Apply the column permutation // colsPermutation() performs a copy of the permutation, // so let's apply it manually: for(Index i = 0; i < rk; ++i) dest.row(m_E[i]) = y.row(i); for(Index i = rk; i < cols(); ++i) dest.row(m_E[i]).setZero(); // y.bottomRows(y.rows()-rk).setZero(); // dest = colsPermutation() * y.topRows(cols()); m_info = Success; } /** \returns the sparse triangular factor R. It is a sparse matrix */ const MatrixType matrixR() const { eigen_assert(m_isInitialized && " The QR factorization should be computed first, call compute()"); if(!m_isRUpToDate) { m_R = viewAsEigen(*m_cR); m_isRUpToDate = true; } return m_R; } /// Get an expression of the matrix Q SPQRMatrixQReturnType matrixQ() const { return SPQRMatrixQReturnType(*this); } /// Get the permutation that was applied to columns of A PermutationType colsPermutation() const { eigen_assert(m_isInitialized && "Decomposition is not initialized."); return PermutationType(m_E, m_cR->ncol); } /** * Gets the rank of the matrix. * It should be equal to matrixQR().cols if the matrix is full-rank */ Index rank() const { eigen_assert(m_isInitialized && "Decomposition is not initialized."); return m_cc.SPQR_istat[4]; } /// Set the fill-reducing ordering method to be used void setSPQROrdering(int ord) { m_ordering = ord;} /// Set the tolerance tol to treat columns with 2-norm < =tol as zero void setPivotThreshold(const RealScalar& tol) { m_useDefaultThreshold = false; m_tolerance = tol; } /** \returns a pointer to the SPQR workspace */ cholmod_common *cholmodCommon() const { return &m_cc; } /** \brief Reports whether previous computation was successful. * * \returns \c Success if computation was successful, * \c NumericalIssue if the sparse QR can not be computed */ ComputationInfo info() const { eigen_assert(m_isInitialized && "Decomposition is not initialized."); return m_info; } protected: bool m_analysisIsOk; bool m_factorizationIsOk; mutable bool m_isRUpToDate; mutable ComputationInfo m_info; int m_ordering; // Ordering method to use, see SPQR's manual int m_allow_tol; // Allow to use some tolerance during numerical factorization. RealScalar m_tolerance; // treat columns with 2-norm below this tolerance as zero mutable cholmod_sparse *m_cR; // The sparse R factor in cholmod format mutable MatrixType m_R; // The sparse matrix R in Eigen format mutable StorageIndex *m_E; // The permutation applied to columns mutable cholmod_sparse *m_H; //The householder vectors mutable StorageIndex *m_HPinv; // The row permutation of H mutable cholmod_dense *m_HTau; // The Householder coefficients mutable Index m_rank; // The rank of the matrix mutable cholmod_common m_cc; // Workspace and parameters bool m_useDefaultThreshold; // Use default threshold Index m_rows; template friend struct SPQR_QProduct; }; template struct SPQR_QProduct : ReturnByValue > { typedef typename SPQRType::Scalar Scalar; typedef typename SPQRType::StorageIndex StorageIndex; //Define the constructor to get reference to argument types SPQR_QProduct(const SPQRType& spqr, const Derived& other, bool transpose) : m_spqr(spqr),m_other(other),m_transpose(transpose) {} inline Index rows() const { return m_transpose ? m_spqr.rows() : m_spqr.cols(); } inline Index cols() const { return m_other.cols(); } // Assign to a vector template void evalTo(ResType& res) const { cholmod_dense y_cd; cholmod_dense *x_cd; int method = m_transpose ? SPQR_QTX : SPQR_QX; cholmod_common *cc = m_spqr.cholmodCommon(); y_cd = viewAsCholmod(m_other.const_cast_derived()); x_cd = SuiteSparseQR_qmult(method, m_spqr.m_H, m_spqr.m_HTau, m_spqr.m_HPinv, &y_cd, cc); res = Matrix::Map(reinterpret_cast(x_cd->x), x_cd->nrow, x_cd->ncol); cholmod_l_free_dense(&x_cd, cc); } const SPQRType& m_spqr; const Derived& m_other; bool m_transpose; }; template struct SPQRMatrixQReturnType{ SPQRMatrixQReturnType(const SPQRType& spqr) : m_spqr(spqr) {} template SPQR_QProduct operator*(const MatrixBase& other) { return SPQR_QProduct(m_spqr,other.derived(),false); } SPQRMatrixQTransposeReturnType adjoint() const { return SPQRMatrixQTransposeReturnType(m_spqr); } // To use for operations with the transpose of Q SPQRMatrixQTransposeReturnType transpose() const { return SPQRMatrixQTransposeReturnType(m_spqr); } const SPQRType& m_spqr; }; template struct SPQRMatrixQTransposeReturnType{ SPQRMatrixQTransposeReturnType(const SPQRType& spqr) : m_spqr(spqr) {} template SPQR_QProduct operator*(const MatrixBase& other) { return SPQR_QProduct(m_spqr,other.derived(), true); } const SPQRType& m_spqr; }; }// End namespace Eigen #endif ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SVD/BDCSVD.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // We used the "A Divide-And-Conquer Algorithm for the Bidiagonal SVD" // research report written by Ming Gu and Stanley C.Eisenstat // The code variable names correspond to the names they used in their // report // // Copyright (C) 2013 Gauthier Brun // Copyright (C) 2013 Nicolas Carre // Copyright (C) 2013 Jean Ceccato // Copyright (C) 2013 Pierre Zoppitelli // Copyright (C) 2013 Jitse Niesen // Copyright (C) 2014-2017 Gael Guennebaud // // Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_BDCSVD_H #define EIGEN_BDCSVD_H // #define EIGEN_BDCSVD_DEBUG_VERBOSE // #define EIGEN_BDCSVD_SANITY_CHECKS #ifdef EIGEN_BDCSVD_SANITY_CHECKS #undef eigen_internal_assert #define eigen_internal_assert(X) assert(X); #endif namespace Eigen { #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE IOFormat bdcsvdfmt(8, 0, ", ", "\n", " [", "]"); #endif template class BDCSVD; namespace internal { template struct traits > : traits { typedef MatrixType_ MatrixType; }; } // end namespace internal /** \ingroup SVD_Module * * * \class BDCSVD * * \brief class Bidiagonal Divide and Conquer SVD * * \tparam MatrixType_ the type of the matrix of which we are computing the SVD decomposition * * This class first reduces the input matrix to bi-diagonal form using class UpperBidiagonalization, * and then performs a divide-and-conquer diagonalization. Small blocks are diagonalized using class JacobiSVD. * You can control the switching size with the setSwitchSize() method, default is 16. * For small matrice (<16), it is thus preferable to directly use JacobiSVD. For larger ones, BDCSVD is highly * recommended and can several order of magnitude faster. * * \warning this algorithm is unlikely to provide accurate result when compiled with unsafe math optimizations. * For instance, this concerns Intel's compiler (ICC), which performs such optimization by default unless * you compile with the \c -fp-model \c precise option. Likewise, the \c -ffast-math option of GCC or clang will * significantly degrade the accuracy. * * \sa class JacobiSVD */ template class BDCSVD : public SVDBase > { typedef SVDBase Base; public: using Base::rows; using Base::cols; using Base::computeU; using Base::computeV; typedef MatrixType_ MatrixType; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef typename NumTraits::Literal Literal; enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, DiagSizeAtCompileTime = EIGEN_SIZE_MIN_PREFER_DYNAMIC(RowsAtCompileTime, ColsAtCompileTime), MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, MaxDiagSizeAtCompileTime = EIGEN_SIZE_MIN_PREFER_FIXED(MaxRowsAtCompileTime, MaxColsAtCompileTime), MatrixOptions = MatrixType::Options }; typedef typename Base::MatrixUType MatrixUType; typedef typename Base::MatrixVType MatrixVType; typedef typename Base::SingularValuesType SingularValuesType; typedef Matrix MatrixX; typedef Matrix MatrixXr; typedef Matrix VectorType; typedef Array ArrayXr; typedef Array ArrayXi; typedef Ref ArrayRef; typedef Ref IndicesRef; /** \brief Default Constructor. * * The default constructor is useful in cases in which the user intends to * perform decompositions via BDCSVD::compute(const MatrixType&). */ BDCSVD() : m_algoswap(16), m_isTranspose(false), m_compU(false), m_compV(false), m_numIters(0) {} /** \brief Default Constructor with memory preallocation * * Like the default constructor but with preallocation of the internal data * according to the specified problem size. * \sa BDCSVD() */ BDCSVD(Index rows, Index cols, unsigned int computationOptions = 0) : m_algoswap(16), m_numIters(0) { allocate(rows, cols, computationOptions); } /** \brief Constructor performing the decomposition of given matrix. * * \param matrix the matrix to decompose * \param computationOptions optional parameter allowing to specify if you want full or thin U or V unitaries to be computed. * By default, none is computed. This is a bit - field, the possible bits are #ComputeFullU, #ComputeThinU, * #ComputeFullV, #ComputeThinV. * * Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not * available with the (non - default) FullPivHouseholderQR preconditioner. */ BDCSVD(const MatrixType& matrix, unsigned int computationOptions = 0) : m_algoswap(16), m_numIters(0) { compute(matrix, computationOptions); } ~BDCSVD() { } /** \brief Method performing the decomposition of given matrix using custom options. * * \param matrix the matrix to decompose * \param computationOptions optional parameter allowing to specify if you want full or thin U or V unitaries to be computed. * By default, none is computed. This is a bit - field, the possible bits are #ComputeFullU, #ComputeThinU, * #ComputeFullV, #ComputeThinV. * * Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not * available with the (non - default) FullPivHouseholderQR preconditioner. */ BDCSVD& compute(const MatrixType& matrix, unsigned int computationOptions); /** \brief Method performing the decomposition of given matrix using current options. * * \param matrix the matrix to decompose * * This method uses the current \a computationOptions, as already passed to the constructor or to compute(const MatrixType&, unsigned int). */ BDCSVD& compute(const MatrixType& matrix) { return compute(matrix, this->m_computationOptions); } void setSwitchSize(int s) { eigen_assert(s>3 && "BDCSVD the size of the algo switch has to be greater than 3"); m_algoswap = s; } private: void allocate(Index rows, Index cols, unsigned int computationOptions); void divide(Index firstCol, Index lastCol, Index firstRowW, Index firstColW, Index shift); void computeSVDofM(Index firstCol, Index n, MatrixXr& U, VectorType& singVals, MatrixXr& V); void computeSingVals(const ArrayRef& col0, const ArrayRef& diag, const IndicesRef& perm, VectorType& singVals, ArrayRef shifts, ArrayRef mus); void perturbCol0(const ArrayRef& col0, const ArrayRef& diag, const IndicesRef& perm, const VectorType& singVals, const ArrayRef& shifts, const ArrayRef& mus, ArrayRef zhat); void computeSingVecs(const ArrayRef& zhat, const ArrayRef& diag, const IndicesRef& perm, const VectorType& singVals, const ArrayRef& shifts, const ArrayRef& mus, MatrixXr& U, MatrixXr& V); void deflation43(Index firstCol, Index shift, Index i, Index size); void deflation44(Index firstColu , Index firstColm, Index firstRowW, Index firstColW, Index i, Index j, Index size); void deflation(Index firstCol, Index lastCol, Index k, Index firstRowW, Index firstColW, Index shift); template void copyUV(const HouseholderU &householderU, const HouseholderV &householderV, const NaiveU &naiveU, const NaiveV &naivev); void structured_update(Block A, const MatrixXr &B, Index n1); static RealScalar secularEq(RealScalar x, const ArrayRef& col0, const ArrayRef& diag, const IndicesRef &perm, const ArrayRef& diagShifted, RealScalar shift); protected: MatrixXr m_naiveU, m_naiveV; MatrixXr m_computed; Index m_nRec; ArrayXr m_workspace; ArrayXi m_workspaceI; int m_algoswap; bool m_isTranspose, m_compU, m_compV; using Base::m_singularValues; using Base::m_diagSize; using Base::m_computeFullU; using Base::m_computeFullV; using Base::m_computeThinU; using Base::m_computeThinV; using Base::m_matrixU; using Base::m_matrixV; using Base::m_info; using Base::m_isInitialized; using Base::m_nonzeroSingularValues; public: int m_numIters; }; //end class BDCSVD // Method to allocate and initialize matrix and attributes template void BDCSVD::allocate(Eigen::Index rows, Eigen::Index cols, unsigned int computationOptions) { m_isTranspose = (cols > rows); if (Base::allocate(rows, cols, computationOptions)) return; m_computed = MatrixXr::Zero(m_diagSize + 1, m_diagSize ); m_compU = computeV(); m_compV = computeU(); if (m_isTranspose) std::swap(m_compU, m_compV); if (m_compU) m_naiveU = MatrixXr::Zero(m_diagSize + 1, m_diagSize + 1 ); else m_naiveU = MatrixXr::Zero(2, m_diagSize + 1 ); if (m_compV) m_naiveV = MatrixXr::Zero(m_diagSize, m_diagSize); m_workspace.resize((m_diagSize+1)*(m_diagSize+1)*3); m_workspaceI.resize(3*m_diagSize); }// end allocate template BDCSVD& BDCSVD::compute(const MatrixType& matrix, unsigned int computationOptions) { #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE std::cout << "\n\n\n======================================================================================================================\n\n\n"; #endif allocate(matrix.rows(), matrix.cols(), computationOptions); using std::abs; const RealScalar considerZero = (std::numeric_limits::min)(); //**** step -1 - If the problem is too small, directly falls back to JacobiSVD and return if(matrix.cols() < m_algoswap) { // FIXME this line involves temporaries JacobiSVD jsvd(matrix,computationOptions); m_isInitialized = true; m_info = jsvd.info(); if (m_info == Success || m_info == NoConvergence) { if(computeU()) m_matrixU = jsvd.matrixU(); if(computeV()) m_matrixV = jsvd.matrixV(); m_singularValues = jsvd.singularValues(); m_nonzeroSingularValues = jsvd.nonzeroSingularValues(); } return *this; } //**** step 0 - Copy the input matrix and apply scaling to reduce over/under-flows RealScalar scale = matrix.cwiseAbs().template maxCoeff(); if (!(numext::isfinite)(scale)) { m_isInitialized = true; m_info = InvalidInput; return *this; } if(scale==Literal(0)) scale = Literal(1); MatrixX copy; if (m_isTranspose) copy = matrix.adjoint()/scale; else copy = matrix/scale; //**** step 1 - Bidiagonalization // FIXME this line involves temporaries internal::UpperBidiagonalization bid(copy); //**** step 2 - Divide & Conquer m_naiveU.setZero(); m_naiveV.setZero(); // FIXME this line involves a temporary matrix m_computed.topRows(m_diagSize) = bid.bidiagonal().toDenseMatrix().transpose(); m_computed.template bottomRows<1>().setZero(); divide(0, m_diagSize - 1, 0, 0, 0); if (m_info != Success && m_info != NoConvergence) { m_isInitialized = true; return *this; } //**** step 3 - Copy singular values and vectors for (int i=0; i template void BDCSVD::copyUV(const HouseholderU &householderU, const HouseholderV &householderV, const NaiveU &naiveU, const NaiveV &naiveV) { // Note exchange of U and V: m_matrixU is set from m_naiveV and vice versa if (computeU()) { Index Ucols = m_computeThinU ? m_diagSize : householderU.cols(); m_matrixU = MatrixX::Identity(householderU.cols(), Ucols); m_matrixU.topLeftCorner(m_diagSize, m_diagSize) = naiveV.template cast().topLeftCorner(m_diagSize, m_diagSize); householderU.applyThisOnTheLeft(m_matrixU); // FIXME this line involves a temporary buffer } if (computeV()) { Index Vcols = m_computeThinV ? m_diagSize : householderV.cols(); m_matrixV = MatrixX::Identity(householderV.cols(), Vcols); m_matrixV.topLeftCorner(m_diagSize, m_diagSize) = naiveU.template cast().topLeftCorner(m_diagSize, m_diagSize); householderV.applyThisOnTheLeft(m_matrixV); // FIXME this line involves a temporary buffer } } /** \internal * Performs A = A * B exploiting the special structure of the matrix A. Splitting A as: * A = [A1] * [A2] * such that A1.rows()==n1, then we assume that at least half of the columns of A1 and A2 are zeros. * We can thus pack them prior to the the matrix product. However, this is only worth the effort if the matrix is large * enough. */ template void BDCSVD::structured_update(Block A, const MatrixXr &B, Index n1) { Index n = A.rows(); if(n>100) { // If the matrices are large enough, let's exploit the sparse structure of A by // splitting it in half (wrt n1), and packing the non-zero columns. Index n2 = n - n1; Map A1(m_workspace.data() , n1, n); Map A2(m_workspace.data()+ n1*n, n2, n); Map B1(m_workspace.data()+ n*n, n, n); Map B2(m_workspace.data()+2*n*n, n, n); Index k1=0, k2=0; for(Index j=0; j tmp(m_workspace.data(),n,n); tmp.noalias() = A*B; A = tmp; } } // The divide algorithm is done "in place", we are always working on subsets of the same matrix. The divide methods takes as argument the // place of the submatrix we are currently working on. //@param firstCol : The Index of the first column of the submatrix of m_computed and for m_naiveU; //@param lastCol : The Index of the last column of the submatrix of m_computed and for m_naiveU; // lastCol + 1 - firstCol is the size of the submatrix. //@param firstRowW : The Index of the first row of the matrix W that we are to change. (see the reference paper section 1 for more information on W) //@param firstRowW : Same as firstRowW with the column. //@param shift : Each time one takes the left submatrix, one must add 1 to the shift. Why? Because! We actually want the last column of the U submatrix // to become the first column (*coeff) and to shift all the other columns to the right. There are more details on the reference paper. template void BDCSVD::divide(Eigen::Index firstCol, Eigen::Index lastCol, Eigen::Index firstRowW, Eigen::Index firstColW, Eigen::Index shift) { // requires rows = cols + 1; using std::pow; using std::sqrt; using std::abs; const Index n = lastCol - firstCol + 1; const Index k = n/2; const RealScalar considerZero = (std::numeric_limits::min)(); RealScalar alphaK; RealScalar betaK; RealScalar r0; RealScalar lambda, phi, c0, s0; VectorType l, f; // We use the other algorithm which is more efficient for small // matrices. if (n < m_algoswap) { // FIXME this line involves temporaries JacobiSVD b(m_computed.block(firstCol, firstCol, n + 1, n), ComputeFullU | (m_compV ? ComputeFullV : 0)); m_info = b.info(); if (m_info != Success && m_info != NoConvergence) return; if (m_compU) m_naiveU.block(firstCol, firstCol, n + 1, n + 1).real() = b.matrixU(); else { m_naiveU.row(0).segment(firstCol, n + 1).real() = b.matrixU().row(0); m_naiveU.row(1).segment(firstCol, n + 1).real() = b.matrixU().row(n); } if (m_compV) m_naiveV.block(firstRowW, firstColW, n, n).real() = b.matrixV(); m_computed.block(firstCol + shift, firstCol + shift, n + 1, n).setZero(); m_computed.diagonal().segment(firstCol + shift, n) = b.singularValues().head(n); return; } // We use the divide and conquer algorithm alphaK = m_computed(firstCol + k, firstCol + k); betaK = m_computed(firstCol + k + 1, firstCol + k); // The divide must be done in that order in order to have good results. Divide change the data inside the submatrices // and the divide of the right submatrice reads one column of the left submatrice. That's why we need to treat the // right submatrix before the left one. divide(k + 1 + firstCol, lastCol, k + 1 + firstRowW, k + 1 + firstColW, shift); if (m_info != Success && m_info != NoConvergence) return; divide(firstCol, k - 1 + firstCol, firstRowW, firstColW + 1, shift + 1); if (m_info != Success && m_info != NoConvergence) return; if (m_compU) { lambda = m_naiveU(firstCol + k, firstCol + k); phi = m_naiveU(firstCol + k + 1, lastCol + 1); } else { lambda = m_naiveU(1, firstCol + k); phi = m_naiveU(0, lastCol + 1); } r0 = sqrt((abs(alphaK * lambda) * abs(alphaK * lambda)) + abs(betaK * phi) * abs(betaK * phi)); if (m_compU) { l = m_naiveU.row(firstCol + k).segment(firstCol, k); f = m_naiveU.row(firstCol + k + 1).segment(firstCol + k + 1, n - k - 1); } else { l = m_naiveU.row(1).segment(firstCol, k); f = m_naiveU.row(0).segment(firstCol + k + 1, n - k - 1); } if (m_compV) m_naiveV(firstRowW+k, firstColW) = Literal(1); if (r0= firstCol; i--) m_naiveU.col(i + 1).segment(firstCol, k + 1) = m_naiveU.col(i).segment(firstCol, k + 1); // we shift q1 at the left with a factor c0 m_naiveU.col(firstCol).segment( firstCol, k + 1) = (q1 * c0); // last column = q1 * - s0 m_naiveU.col(lastCol + 1).segment(firstCol, k + 1) = (q1 * ( - s0)); // first column = q2 * s0 m_naiveU.col(firstCol).segment(firstCol + k + 1, n - k) = m_naiveU.col(lastCol + 1).segment(firstCol + k + 1, n - k) * s0; // q2 *= c0 m_naiveU.col(lastCol + 1).segment(firstCol + k + 1, n - k) *= c0; } else { RealScalar q1 = m_naiveU(0, firstCol + k); // we shift Q1 to the right for (Index i = firstCol + k - 1; i >= firstCol; i--) m_naiveU(0, i + 1) = m_naiveU(0, i); // we shift q1 at the left with a factor c0 m_naiveU(0, firstCol) = (q1 * c0); // last column = q1 * - s0 m_naiveU(0, lastCol + 1) = (q1 * ( - s0)); // first column = q2 * s0 m_naiveU(1, firstCol) = m_naiveU(1, lastCol + 1) *s0; // q2 *= c0 m_naiveU(1, lastCol + 1) *= c0; m_naiveU.row(1).segment(firstCol + 1, k).setZero(); m_naiveU.row(0).segment(firstCol + k + 1, n - k - 1).setZero(); } #ifdef EIGEN_BDCSVD_SANITY_CHECKS assert(m_naiveU.allFinite()); assert(m_naiveV.allFinite()); assert(m_computed.allFinite()); #endif m_computed(firstCol + shift, firstCol + shift) = r0; m_computed.col(firstCol + shift).segment(firstCol + shift + 1, k) = alphaK * l.transpose().real(); m_computed.col(firstCol + shift).segment(firstCol + shift + k + 1, n - k - 1) = betaK * f.transpose().real(); #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE ArrayXr tmp1 = (m_computed.block(firstCol+shift, firstCol+shift, n, n)).jacobiSvd().singularValues(); #endif // Second part: try to deflate singular values in combined matrix deflation(firstCol, lastCol, k, firstRowW, firstColW, shift); #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE ArrayXr tmp2 = (m_computed.block(firstCol+shift, firstCol+shift, n, n)).jacobiSvd().singularValues(); std::cout << "\n\nj1 = " << tmp1.transpose().format(bdcsvdfmt) << "\n"; std::cout << "j2 = " << tmp2.transpose().format(bdcsvdfmt) << "\n\n"; std::cout << "err: " << ((tmp1-tmp2).abs()>1e-12*tmp2.abs()).transpose() << "\n"; static int count = 0; std::cout << "# " << ++count << "\n\n"; assert((tmp1-tmp2).matrix().norm() < 1e-14*tmp2.matrix().norm()); // assert(count<681); // assert(((tmp1-tmp2).abs()<1e-13*tmp2.abs()).all()); #endif // Third part: compute SVD of combined matrix MatrixXr UofSVD, VofSVD; VectorType singVals; computeSVDofM(firstCol + shift, n, UofSVD, singVals, VofSVD); #ifdef EIGEN_BDCSVD_SANITY_CHECKS assert(UofSVD.allFinite()); assert(VofSVD.allFinite()); #endif if (m_compU) structured_update(m_naiveU.block(firstCol, firstCol, n + 1, n + 1), UofSVD, (n+2)/2); else { Map,Aligned> tmp(m_workspace.data(),2,n+1); tmp.noalias() = m_naiveU.middleCols(firstCol, n+1) * UofSVD; m_naiveU.middleCols(firstCol, n + 1) = tmp; } if (m_compV) structured_update(m_naiveV.block(firstRowW, firstColW, n, n), VofSVD, (n+1)/2); #ifdef EIGEN_BDCSVD_SANITY_CHECKS assert(m_naiveU.allFinite()); assert(m_naiveV.allFinite()); assert(m_computed.allFinite()); #endif m_computed.block(firstCol + shift, firstCol + shift, n, n).setZero(); m_computed.block(firstCol + shift, firstCol + shift, n, n).diagonal() = singVals; }// end divide // Compute SVD of m_computed.block(firstCol, firstCol, n + 1, n); this block only has non-zeros in // the first column and on the diagonal and has undergone deflation, so diagonal is in increasing // order except for possibly the (0,0) entry. The computed SVD is stored U, singVals and V, except // that if m_compV is false, then V is not computed. Singular values are sorted in decreasing order. // // TODO Opportunities for optimization: better root finding algo, better stopping criterion, better // handling of round-off errors, be consistent in ordering // For instance, to solve the secular equation using FMM, see http://www.stat.uchicago.edu/~lekheng/courses/302/classics/greengard-rokhlin.pdf template void BDCSVD::computeSVDofM(Eigen::Index firstCol, Eigen::Index n, MatrixXr& U, VectorType& singVals, MatrixXr& V) { const RealScalar considerZero = (std::numeric_limits::min)(); using std::abs; ArrayRef col0 = m_computed.col(firstCol).segment(firstCol, n); m_workspace.head(n) = m_computed.block(firstCol, firstCol, n, n).diagonal(); ArrayRef diag = m_workspace.head(n); diag(0) = Literal(0); // Allocate space for singular values and vectors singVals.resize(n); U.resize(n+1, n+1); if (m_compV) V.resize(n, n); #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE if (col0.hasNaN() || diag.hasNaN()) std::cout << "\n\nHAS NAN\n\n"; #endif // Many singular values might have been deflated, the zero ones have been moved to the end, // but others are interleaved and we must ignore them at this stage. // To this end, let's compute a permutation skipping them: Index actual_n = n; while(actual_n>1 && diag(actual_n-1)==Literal(0)) {--actual_n; eigen_internal_assert(col0(actual_n)==Literal(0)); } Index m = 0; // size of the deflated problem for(Index k=0;kconsiderZero) m_workspaceI(m++) = k; Map perm(m_workspaceI.data(),m); Map shifts(m_workspace.data()+1*n, n); Map mus(m_workspace.data()+2*n, n); Map zhat(m_workspace.data()+3*n, n); #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE std::cout << "computeSVDofM using:\n"; std::cout << " z: " << col0.transpose() << "\n"; std::cout << " d: " << diag.transpose() << "\n"; #endif // Compute singVals, shifts, and mus computeSingVals(col0, diag, perm, singVals, shifts, mus); #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE std::cout << " j: " << (m_computed.block(firstCol, firstCol, n, n)).jacobiSvd().singularValues().transpose().reverse() << "\n\n"; std::cout << " sing-val: " << singVals.transpose() << "\n"; std::cout << " mu: " << mus.transpose() << "\n"; std::cout << " shift: " << shifts.transpose() << "\n"; { std::cout << "\n\n mus: " << mus.head(actual_n).transpose() << "\n\n"; std::cout << " check1 (expect0) : " << ((singVals.array()-(shifts+mus)) / singVals.array()).head(actual_n).transpose() << "\n\n"; assert((((singVals.array()-(shifts+mus)) / singVals.array()).head(actual_n) >= 0).all()); std::cout << " check2 (>0) : " << ((singVals.array()-diag) / singVals.array()).head(actual_n).transpose() << "\n\n"; assert((((singVals.array()-diag) / singVals.array()).head(actual_n) >= 0).all()); } #endif #ifdef EIGEN_BDCSVD_SANITY_CHECKS assert(singVals.allFinite()); assert(mus.allFinite()); assert(shifts.allFinite()); #endif // Compute zhat perturbCol0(col0, diag, perm, singVals, shifts, mus, zhat); #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE std::cout << " zhat: " << zhat.transpose() << "\n"; #endif #ifdef EIGEN_BDCSVD_SANITY_CHECKS assert(zhat.allFinite()); #endif computeSingVecs(zhat, diag, perm, singVals, shifts, mus, U, V); #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE std::cout << "U^T U: " << (U.transpose() * U - MatrixXr(MatrixXr::Identity(U.cols(),U.cols()))).norm() << "\n"; std::cout << "V^T V: " << (V.transpose() * V - MatrixXr(MatrixXr::Identity(V.cols(),V.cols()))).norm() << "\n"; #endif #ifdef EIGEN_BDCSVD_SANITY_CHECKS assert(m_naiveU.allFinite()); assert(m_naiveV.allFinite()); assert(m_computed.allFinite()); assert(U.allFinite()); assert(V.allFinite()); // assert((U.transpose() * U - MatrixXr(MatrixXr::Identity(U.cols(),U.cols()))).norm() < 100*NumTraits::epsilon() * n); // assert((V.transpose() * V - MatrixXr(MatrixXr::Identity(V.cols(),V.cols()))).norm() < 100*NumTraits::epsilon() * n); #endif // Because of deflation, the singular values might not be completely sorted. // Fortunately, reordering them is a O(n) problem for(Index i=0; isingVals(i+1)) { using std::swap; swap(singVals(i),singVals(i+1)); U.col(i).swap(U.col(i+1)); if(m_compV) V.col(i).swap(V.col(i+1)); } } #ifdef EIGEN_BDCSVD_SANITY_CHECKS { bool singular_values_sorted = (((singVals.segment(1,actual_n-1)-singVals.head(actual_n-1))).array() >= 0).all(); if(!singular_values_sorted) std::cout << "Singular values are not sorted: " << singVals.segment(1,actual_n).transpose() << "\n"; assert(singular_values_sorted); } #endif // Reverse order so that singular values in increased order // Because of deflation, the zeros singular-values are already at the end singVals.head(actual_n).reverseInPlace(); U.leftCols(actual_n).rowwise().reverseInPlace(); if (m_compV) V.leftCols(actual_n).rowwise().reverseInPlace(); #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE JacobiSVD jsvd(m_computed.block(firstCol, firstCol, n, n) ); std::cout << " * j: " << jsvd.singularValues().transpose() << "\n\n"; std::cout << " * sing-val: " << singVals.transpose() << "\n"; // std::cout << " * err: " << ((jsvd.singularValues()-singVals)>1e-13*singVals.norm()).transpose() << "\n"; #endif } template typename BDCSVD::RealScalar BDCSVD::secularEq(RealScalar mu, const ArrayRef& col0, const ArrayRef& diag, const IndicesRef &perm, const ArrayRef& diagShifted, RealScalar shift) { Index m = perm.size(); RealScalar res = Literal(1); for(Index i=0; i void BDCSVD::computeSingVals(const ArrayRef& col0, const ArrayRef& diag, const IndicesRef &perm, VectorType& singVals, ArrayRef shifts, ArrayRef mus) { using std::abs; using std::swap; using std::sqrt; Index n = col0.size(); Index actual_n = n; // Note that here actual_n is computed based on col0(i)==0 instead of diag(i)==0 as above // because 1) we have diag(i)==0 => col0(i)==0 and 2) if col0(i)==0, then diag(i) is already a singular value. while(actual_n>1 && col0(actual_n-1)==Literal(0)) --actual_n; for (Index k = 0; k < n; ++k) { if (col0(k) == Literal(0) || actual_n==1) { // if col0(k) == 0, then entry is deflated, so singular value is on diagonal // if actual_n==1, then the deflated problem is already diagonalized singVals(k) = k==0 ? col0(0) : diag(k); mus(k) = Literal(0); shifts(k) = k==0 ? col0(0) : diag(k); continue; } // otherwise, use secular equation to find singular value RealScalar left = diag(k); RealScalar right; // was: = (k != actual_n-1) ? diag(k+1) : (diag(actual_n-1) + col0.matrix().norm()); if(k==actual_n-1) right = (diag(actual_n-1) + col0.matrix().norm()); else { // Skip deflated singular values, // recall that at this stage we assume that z[j]!=0 and all entries for which z[j]==0 have been put aside. // This should be equivalent to using perm[] Index l = k+1; while(col0(l)==Literal(0)) { ++l; eigen_internal_assert(l Literal(0)) ? left : right; // measure everything relative to shift Map diagShifted(m_workspace.data()+4*n, n); diagShifted = diag - shift; if(k!=actual_n-1) { // check that after the shift, f(mid) is still negative: RealScalar midShifted = (right - left) / RealScalar(2); if(shift==right) midShifted = -midShifted; RealScalar fMidShifted = secularEq(midShifted, col0, diag, perm, diagShifted, shift); if(fMidShifted>0) { // fMid was erroneous, fix it: shift = fMidShifted > Literal(0) ? left : right; diagShifted = diag - shift; } } // initial guess RealScalar muPrev, muCur; if (shift == left) { muPrev = (right - left) * RealScalar(0.1); if (k == actual_n-1) muCur = right - left; else muCur = (right - left) * RealScalar(0.5); } else { muPrev = -(right - left) * RealScalar(0.1); muCur = -(right - left) * RealScalar(0.5); } RealScalar fPrev = secularEq(muPrev, col0, diag, perm, diagShifted, shift); RealScalar fCur = secularEq(muCur, col0, diag, perm, diagShifted, shift); if (abs(fPrev) < abs(fCur)) { swap(fPrev, fCur); swap(muPrev, muCur); } // rational interpolation: fit a function of the form a / mu + b through the two previous // iterates and use its zero to compute the next iterate bool useBisection = fPrev*fCur>Literal(0); while (fCur!=Literal(0) && abs(muCur - muPrev) > Literal(8) * NumTraits::epsilon() * numext::maxi(abs(muCur), abs(muPrev)) && abs(fCur - fPrev)>NumTraits::epsilon() && !useBisection) { ++m_numIters; // Find a and b such that the function f(mu) = a / mu + b matches the current and previous samples. RealScalar a = (fCur - fPrev) / (Literal(1)/muCur - Literal(1)/muPrev); RealScalar b = fCur - a / muCur; // And find mu such that f(mu)==0: RealScalar muZero = -a/b; RealScalar fZero = secularEq(muZero, col0, diag, perm, diagShifted, shift); #ifdef EIGEN_BDCSVD_SANITY_CHECKS assert((numext::isfinite)(fZero)); #endif muPrev = muCur; fPrev = fCur; muCur = muZero; fCur = fZero; if (shift == left && (muCur < Literal(0) || muCur > right - left)) useBisection = true; if (shift == right && (muCur < -(right - left) || muCur > Literal(0))) useBisection = true; if (abs(fCur)>abs(fPrev)) useBisection = true; } // fall back on bisection method if rational interpolation did not work if (useBisection) { #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE std::cout << "useBisection for k = " << k << ", actual_n = " << actual_n << "\n"; #endif RealScalar leftShifted, rightShifted; if (shift == left) { // to avoid overflow, we must have mu > max(real_min, |z(k)|/sqrt(real_max)), // the factor 2 is to be more conservative leftShifted = numext::maxi( (std::numeric_limits::min)(), Literal(2) * abs(col0(k)) / sqrt((std::numeric_limits::max)()) ); // check that we did it right: eigen_internal_assert( (numext::isfinite)( (col0(k)/leftShifted)*(col0(k)/(diag(k)+shift+leftShifted)) ) ); // I don't understand why the case k==0 would be special there: // if (k == 0) rightShifted = right - left; else rightShifted = (k==actual_n-1) ? right : ((right - left) * RealScalar(0.51)); // theoretically we can take 0.5, but let's be safe } else { leftShifted = -(right - left) * RealScalar(0.51); if(k+1( (std::numeric_limits::min)(), abs(col0(k+1)) / sqrt((std::numeric_limits::max)()) ); else rightShifted = -(std::numeric_limits::min)(); } RealScalar fLeft = secularEq(leftShifted, col0, diag, perm, diagShifted, shift); eigen_internal_assert(fLeft [" << leftShifted << " " << rightShifted << "], shift=" << shift << " , f(right)=" << secularEq(0, col0, diag, perm, diagShifted, shift) << " == " << secularEq(right, col0, diag, perm, diag, 0) << " == " << fRight << "\n"; } #endif eigen_internal_assert(fLeft * fRight < Literal(0)); if(fLeft Literal(2) * NumTraits::epsilon() * numext::maxi(abs(leftShifted), abs(rightShifted))) { RealScalar midShifted = (leftShifted + rightShifted) / Literal(2); fMid = secularEq(midShifted, col0, diag, perm, diagShifted, shift); eigen_internal_assert((numext::isfinite)(fMid)); if (fLeft * fMid < Literal(0)) { rightShifted = midShifted; } else { leftShifted = midShifted; fLeft = fMid; } } muCur = (leftShifted + rightShifted) / Literal(2); } else { // We have a problem as shifting on the left or right give either a positive or negative value // at the middle of [left,right]... // Instead fo abbording or entering an infinite loop, // let's just use the middle as the estimated zero-crossing: muCur = (right - left) * RealScalar(0.5); if(shift == right) muCur = -muCur; } } singVals[k] = shift + muCur; shifts[k] = shift; mus[k] = muCur; #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE if(k+1=singVals[k-1]); assert(singVals[k]>=diag(k)); #endif // perturb singular value slightly if it equals diagonal entry to avoid division by zero later // (deflation is supposed to avoid this from happening) // - this does no seem to be necessary anymore - // if (singVals[k] == left) singVals[k] *= 1 + NumTraits::epsilon(); // if (singVals[k] == right) singVals[k] *= 1 - NumTraits::epsilon(); } } // zhat is perturbation of col0 for which singular vectors can be computed stably (see Section 3.1) template void BDCSVD::perturbCol0 (const ArrayRef& col0, const ArrayRef& diag, const IndicesRef &perm, const VectorType& singVals, const ArrayRef& shifts, const ArrayRef& mus, ArrayRef zhat) { using std::sqrt; Index n = col0.size(); Index m = perm.size(); if(m==0) { zhat.setZero(); return; } Index lastIdx = perm(m-1); // The offset permits to skip deflated entries while computing zhat for (Index k = 0; k < n; ++k) { if (col0(k) == Literal(0)) // deflated zhat(k) = Literal(0); else { // see equation (3.6) RealScalar dk = diag(k); RealScalar prod = (singVals(lastIdx) + dk) * (mus(lastIdx) + (shifts(lastIdx) - dk)); #ifdef EIGEN_BDCSVD_SANITY_CHECKS if(prod<0) { std::cout << "k = " << k << " ; z(k)=" << col0(k) << ", diag(k)=" << dk << "\n"; std::cout << "prod = " << "(" << singVals(lastIdx) << " + " << dk << ") * (" << mus(lastIdx) << " + (" << shifts(lastIdx) << " - " << dk << "))" << "\n"; std::cout << " = " << singVals(lastIdx) + dk << " * " << mus(lastIdx) + (shifts(lastIdx) - dk) << "\n"; } assert(prod>=0); #endif for(Index l = 0; l=k && (l==0 || l-1>=m)) { std::cout << "Error in perturbCol0\n"; std::cout << " " << k << "/" << n << " " << l << "/" << m << " " << i << "/" << n << " ; " << col0(k) << " " << diag(k) << " " << "\n"; std::cout << " " <=0); #endif #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE if(i!=k && numext::abs(((singVals(j)+dk)*(mus(j)+(shifts(j)-dk)))/((diag(i)+dk)*(diag(i)-dk)) - 1) > 0.9 ) std::cout << " " << ((singVals(j)+dk)*(mus(j)+(shifts(j)-dk)))/((diag(i)+dk)*(diag(i)-dk)) << " == (" << (singVals(j)+dk) << " * " << (mus(j)+(shifts(j)-dk)) << ") / (" << (diag(i)+dk) << " * " << (diag(i)-dk) << ")\n"; #endif } } #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE std::cout << "zhat(" << k << ") = sqrt( " << prod << ") ; " << (singVals(lastIdx) + dk) << " * " << mus(lastIdx) + shifts(lastIdx) << " - " << dk << "\n"; #endif RealScalar tmp = sqrt(prod); #ifdef EIGEN_BDCSVD_SANITY_CHECKS assert((numext::isfinite)(tmp)); #endif zhat(k) = col0(k) > Literal(0) ? RealScalar(tmp) : RealScalar(-tmp); } } } // compute singular vectors template void BDCSVD::computeSingVecs (const ArrayRef& zhat, const ArrayRef& diag, const IndicesRef &perm, const VectorType& singVals, const ArrayRef& shifts, const ArrayRef& mus, MatrixXr& U, MatrixXr& V) { Index n = zhat.size(); Index m = perm.size(); for (Index k = 0; k < n; ++k) { if (zhat(k) == Literal(0)) { U.col(k) = VectorType::Unit(n+1, k); if (m_compV) V.col(k) = VectorType::Unit(n, k); } else { U.col(k).setZero(); for(Index l=0;l= 1, di almost null and zi non null. // We use a rotation to zero out zi applied to the left of M template void BDCSVD::deflation43(Eigen::Index firstCol, Eigen::Index shift, Eigen::Index i, Eigen::Index size) { using std::abs; using std::sqrt; using std::pow; Index start = firstCol + shift; RealScalar c = m_computed(start, start); RealScalar s = m_computed(start+i, start); RealScalar r = numext::hypot(c,s); if (r == Literal(0)) { m_computed(start+i, start+i) = Literal(0); return; } m_computed(start,start) = r; m_computed(start+i, start) = Literal(0); m_computed(start+i, start+i) = Literal(0); JacobiRotation J(c/r,-s/r); if (m_compU) m_naiveU.middleRows(firstCol, size+1).applyOnTheRight(firstCol, firstCol+i, J); else m_naiveU.applyOnTheRight(firstCol, firstCol+i, J); }// end deflation 43 // page 13 // i,j >= 1, i!=j and |di - dj| < epsilon * norm2(M) // We apply two rotations to have zj = 0; // TODO deflation44 is still broken and not properly tested template void BDCSVD::deflation44(Eigen::Index firstColu , Eigen::Index firstColm, Eigen::Index firstRowW, Eigen::Index firstColW, Eigen::Index i, Eigen::Index j, Eigen::Index size) { using std::abs; using std::sqrt; using std::conj; using std::pow; RealScalar c = m_computed(firstColm+i, firstColm); RealScalar s = m_computed(firstColm+j, firstColm); RealScalar r = sqrt(numext::abs2(c) + numext::abs2(s)); #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE std::cout << "deflation 4.4: " << i << "," << j << " -> " << c << " " << s << " " << r << " ; " << m_computed(firstColm + i-1, firstColm) << " " << m_computed(firstColm + i, firstColm) << " " << m_computed(firstColm + i+1, firstColm) << " " << m_computed(firstColm + i+2, firstColm) << "\n"; std::cout << m_computed(firstColm + i-1, firstColm + i-1) << " " << m_computed(firstColm + i, firstColm+i) << " " << m_computed(firstColm + i+1, firstColm+i+1) << " " << m_computed(firstColm + i+2, firstColm+i+2) << "\n"; #endif if (r==Literal(0)) { m_computed(firstColm + i, firstColm + i) = m_computed(firstColm + j, firstColm + j); return; } c/=r; s/=r; m_computed(firstColm + i, firstColm) = r; m_computed(firstColm + j, firstColm + j) = m_computed(firstColm + i, firstColm + i); m_computed(firstColm + j, firstColm) = Literal(0); JacobiRotation J(c,-s); if (m_compU) m_naiveU.middleRows(firstColu, size+1).applyOnTheRight(firstColu + i, firstColu + j, J); else m_naiveU.applyOnTheRight(firstColu+i, firstColu+j, J); if (m_compV) m_naiveV.middleRows(firstRowW, size).applyOnTheRight(firstColW + i, firstColW + j, J); }// end deflation 44 // acts on block from (firstCol+shift, firstCol+shift) to (lastCol+shift, lastCol+shift) [inclusive] template void BDCSVD::deflation(Eigen::Index firstCol, Eigen::Index lastCol, Eigen::Index k, Eigen::Index firstRowW, Eigen::Index firstColW, Eigen::Index shift) { using std::sqrt; using std::abs; const Index length = lastCol + 1 - firstCol; Block col0(m_computed, firstCol+shift, firstCol+shift, length, 1); Diagonal fulldiag(m_computed); VectorBlock,Dynamic> diag(fulldiag, firstCol+shift, length); const RealScalar considerZero = (std::numeric_limits::min)(); RealScalar maxDiag = diag.tail((std::max)(Index(1),length-1)).cwiseAbs().maxCoeff(); RealScalar epsilon_strict = numext::maxi(considerZero,NumTraits::epsilon() * maxDiag); RealScalar epsilon_coarse = Literal(8) * NumTraits::epsilon() * numext::maxi(col0.cwiseAbs().maxCoeff(), maxDiag); #ifdef EIGEN_BDCSVD_SANITY_CHECKS assert(m_naiveU.allFinite()); assert(m_naiveV.allFinite()); assert(m_computed.allFinite()); #endif #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE std::cout << "\ndeflate:" << diag.head(k+1).transpose() << " | " << diag.segment(k+1,length-k-1).transpose() << "\n"; #endif //condition 4.1 if (diag(0) < epsilon_coarse) { #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE std::cout << "deflation 4.1, because " << diag(0) << " < " << epsilon_coarse << "\n"; #endif diag(0) = epsilon_coarse; } //condition 4.2 for (Index i=1;i k) permutation[p] = j++; else if (j >= length) permutation[p] = i++; else if (diag(i) < diag(j)) permutation[p] = j++; else permutation[p] = i++; } } // If we have a total deflation, then we have to insert diag(0) at the right place if(total_deflation) { for(Index i=1; i0 && (abs(diag(i))1;--i) if( (diag(i) - diag(i-1)) < NumTraits::epsilon()*maxDiag ) { #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE std::cout << "deflation 4.4 with i = " << i << " because " << diag(i) << " - " << diag(i-1) << " == " << (diag(i) - diag(i-1)) << " < " << NumTraits::epsilon()*/*diag(i)*/maxDiag << "\n"; #endif eigen_internal_assert(abs(diag(i) - diag(i-1)) BDCSVD::PlainObject> MatrixBase::bdcSvd(unsigned int computationOptions) const { return BDCSVD(*this, computationOptions); } } // end namespace Eigen #endif ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SVD/JacobiSVD.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009-2010 Benoit Jacob // Copyright (C) 2013-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_JACOBISVD_H #define EIGEN_JACOBISVD_H namespace Eigen { namespace internal { // forward declaration (needed by ICC) // the empty body is required by MSVC template::IsComplex> struct svd_precondition_2x2_block_to_be_real {}; /*** QR preconditioners (R-SVD) *** *** Their role is to reduce the problem of computing the SVD to the case of a square matrix. *** This approach, known as R-SVD, is an optimization for rectangular-enough matrices, and is a requirement for *** JacobiSVD which by itself is only able to work on square matrices. ***/ enum { PreconditionIfMoreColsThanRows, PreconditionIfMoreRowsThanCols }; template struct qr_preconditioner_should_do_anything { enum { a = MatrixType::RowsAtCompileTime != Dynamic && MatrixType::ColsAtCompileTime != Dynamic && MatrixType::ColsAtCompileTime <= MatrixType::RowsAtCompileTime, b = MatrixType::RowsAtCompileTime != Dynamic && MatrixType::ColsAtCompileTime != Dynamic && MatrixType::RowsAtCompileTime <= MatrixType::ColsAtCompileTime, ret = !( (QRPreconditioner == NoQRPreconditioner) || (Case == PreconditionIfMoreColsThanRows && bool(a)) || (Case == PreconditionIfMoreRowsThanCols && bool(b)) ) }; }; template::ret > struct qr_preconditioner_impl {}; template class qr_preconditioner_impl { public: void allocate(const JacobiSVD&) {} bool run(JacobiSVD&, const MatrixType&) { return false; } }; /*** preconditioner using FullPivHouseholderQR ***/ template class qr_preconditioner_impl { public: typedef typename MatrixType::Scalar Scalar; enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime }; typedef Matrix WorkspaceType; void allocate(const JacobiSVD& svd) { if (svd.rows() != m_qr.rows() || svd.cols() != m_qr.cols()) { m_qr.~QRType(); ::new (&m_qr) QRType(svd.rows(), svd.cols()); } if (svd.m_computeFullU) m_workspace.resize(svd.rows()); } bool run(JacobiSVD& svd, const MatrixType& matrix) { if(matrix.rows() > matrix.cols()) { m_qr.compute(matrix); svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.cols(),matrix.cols()).template triangularView(); if(svd.m_computeFullU) m_qr.matrixQ().evalTo(svd.m_matrixU, m_workspace); if(svd.computeV()) svd.m_matrixV = m_qr.colsPermutation(); return true; } return false; } private: typedef FullPivHouseholderQR QRType; QRType m_qr; WorkspaceType m_workspace; }; template class qr_preconditioner_impl { public: typedef typename MatrixType::Scalar Scalar; enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, Options = MatrixType::Options }; typedef typename internal::make_proper_matrix_type< Scalar, ColsAtCompileTime, RowsAtCompileTime, Options, MaxColsAtCompileTime, MaxRowsAtCompileTime >::type TransposeTypeWithSameStorageOrder; void allocate(const JacobiSVD& svd) { if (svd.cols() != m_qr.rows() || svd.rows() != m_qr.cols()) { m_qr.~QRType(); ::new (&m_qr) QRType(svd.cols(), svd.rows()); } m_adjoint.resize(svd.cols(), svd.rows()); if (svd.m_computeFullV) m_workspace.resize(svd.cols()); } bool run(JacobiSVD& svd, const MatrixType& matrix) { if(matrix.cols() > matrix.rows()) { m_adjoint = matrix.adjoint(); m_qr.compute(m_adjoint); svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.rows(),matrix.rows()).template triangularView().adjoint(); if(svd.m_computeFullV) m_qr.matrixQ().evalTo(svd.m_matrixV, m_workspace); if(svd.computeU()) svd.m_matrixU = m_qr.colsPermutation(); return true; } else return false; } private: typedef FullPivHouseholderQR QRType; QRType m_qr; TransposeTypeWithSameStorageOrder m_adjoint; typename internal::plain_row_type::type m_workspace; }; /*** preconditioner using ColPivHouseholderQR ***/ template class qr_preconditioner_impl { public: void allocate(const JacobiSVD& svd) { if (svd.rows() != m_qr.rows() || svd.cols() != m_qr.cols()) { m_qr.~QRType(); ::new (&m_qr) QRType(svd.rows(), svd.cols()); } if (svd.m_computeFullU) m_workspace.resize(svd.rows()); else if (svd.m_computeThinU) m_workspace.resize(svd.cols()); } bool run(JacobiSVD& svd, const MatrixType& matrix) { if(matrix.rows() > matrix.cols()) { m_qr.compute(matrix); svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.cols(),matrix.cols()).template triangularView(); if(svd.m_computeFullU) m_qr.householderQ().evalTo(svd.m_matrixU, m_workspace); else if(svd.m_computeThinU) { svd.m_matrixU.setIdentity(matrix.rows(), matrix.cols()); m_qr.householderQ().applyThisOnTheLeft(svd.m_matrixU, m_workspace); } if(svd.computeV()) svd.m_matrixV = m_qr.colsPermutation(); return true; } return false; } private: typedef ColPivHouseholderQR QRType; QRType m_qr; typename internal::plain_col_type::type m_workspace; }; template class qr_preconditioner_impl { public: typedef typename MatrixType::Scalar Scalar; enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, Options = MatrixType::Options }; typedef typename internal::make_proper_matrix_type< Scalar, ColsAtCompileTime, RowsAtCompileTime, Options, MaxColsAtCompileTime, MaxRowsAtCompileTime >::type TransposeTypeWithSameStorageOrder; void allocate(const JacobiSVD& svd) { if (svd.cols() != m_qr.rows() || svd.rows() != m_qr.cols()) { m_qr.~QRType(); ::new (&m_qr) QRType(svd.cols(), svd.rows()); } if (svd.m_computeFullV) m_workspace.resize(svd.cols()); else if (svd.m_computeThinV) m_workspace.resize(svd.rows()); m_adjoint.resize(svd.cols(), svd.rows()); } bool run(JacobiSVD& svd, const MatrixType& matrix) { if(matrix.cols() > matrix.rows()) { m_adjoint = matrix.adjoint(); m_qr.compute(m_adjoint); svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.rows(),matrix.rows()).template triangularView().adjoint(); if(svd.m_computeFullV) m_qr.householderQ().evalTo(svd.m_matrixV, m_workspace); else if(svd.m_computeThinV) { svd.m_matrixV.setIdentity(matrix.cols(), matrix.rows()); m_qr.householderQ().applyThisOnTheLeft(svd.m_matrixV, m_workspace); } if(svd.computeU()) svd.m_matrixU = m_qr.colsPermutation(); return true; } else return false; } private: typedef ColPivHouseholderQR QRType; QRType m_qr; TransposeTypeWithSameStorageOrder m_adjoint; typename internal::plain_row_type::type m_workspace; }; /*** preconditioner using HouseholderQR ***/ template class qr_preconditioner_impl { public: void allocate(const JacobiSVD& svd) { if (svd.rows() != m_qr.rows() || svd.cols() != m_qr.cols()) { m_qr.~QRType(); ::new (&m_qr) QRType(svd.rows(), svd.cols()); } if (svd.m_computeFullU) m_workspace.resize(svd.rows()); else if (svd.m_computeThinU) m_workspace.resize(svd.cols()); } bool run(JacobiSVD& svd, const MatrixType& matrix) { if(matrix.rows() > matrix.cols()) { m_qr.compute(matrix); svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.cols(),matrix.cols()).template triangularView(); if(svd.m_computeFullU) m_qr.householderQ().evalTo(svd.m_matrixU, m_workspace); else if(svd.m_computeThinU) { svd.m_matrixU.setIdentity(matrix.rows(), matrix.cols()); m_qr.householderQ().applyThisOnTheLeft(svd.m_matrixU, m_workspace); } if(svd.computeV()) svd.m_matrixV.setIdentity(matrix.cols(), matrix.cols()); return true; } return false; } private: typedef HouseholderQR QRType; QRType m_qr; typename internal::plain_col_type::type m_workspace; }; template class qr_preconditioner_impl { public: typedef typename MatrixType::Scalar Scalar; enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, Options = MatrixType::Options }; typedef typename internal::make_proper_matrix_type< Scalar, ColsAtCompileTime, RowsAtCompileTime, Options, MaxColsAtCompileTime, MaxRowsAtCompileTime >::type TransposeTypeWithSameStorageOrder; void allocate(const JacobiSVD& svd) { if (svd.cols() != m_qr.rows() || svd.rows() != m_qr.cols()) { m_qr.~QRType(); ::new (&m_qr) QRType(svd.cols(), svd.rows()); } if (svd.m_computeFullV) m_workspace.resize(svd.cols()); else if (svd.m_computeThinV) m_workspace.resize(svd.rows()); m_adjoint.resize(svd.cols(), svd.rows()); } bool run(JacobiSVD& svd, const MatrixType& matrix) { if(matrix.cols() > matrix.rows()) { m_adjoint = matrix.adjoint(); m_qr.compute(m_adjoint); svd.m_workMatrix = m_qr.matrixQR().block(0,0,matrix.rows(),matrix.rows()).template triangularView().adjoint(); if(svd.m_computeFullV) m_qr.householderQ().evalTo(svd.m_matrixV, m_workspace); else if(svd.m_computeThinV) { svd.m_matrixV.setIdentity(matrix.cols(), matrix.rows()); m_qr.householderQ().applyThisOnTheLeft(svd.m_matrixV, m_workspace); } if(svd.computeU()) svd.m_matrixU.setIdentity(matrix.rows(), matrix.rows()); return true; } else return false; } private: typedef HouseholderQR QRType; QRType m_qr; TransposeTypeWithSameStorageOrder m_adjoint; typename internal::plain_row_type::type m_workspace; }; /*** 2x2 SVD implementation *** *** JacobiSVD consists in performing a series of 2x2 SVD subproblems ***/ template struct svd_precondition_2x2_block_to_be_real { typedef JacobiSVD SVD; typedef typename MatrixType::RealScalar RealScalar; static bool run(typename SVD::WorkMatrixType&, SVD&, Index, Index, RealScalar&) { return true; } }; template struct svd_precondition_2x2_block_to_be_real { typedef JacobiSVD SVD; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; static bool run(typename SVD::WorkMatrixType& work_matrix, SVD& svd, Index p, Index q, RealScalar& maxDiagEntry) { using std::sqrt; using std::abs; Scalar z; JacobiRotation rot; RealScalar n = sqrt(numext::abs2(work_matrix.coeff(p,p)) + numext::abs2(work_matrix.coeff(q,p))); const RealScalar considerAsZero = (std::numeric_limits::min)(); const RealScalar precision = NumTraits::epsilon(); if(n==0) { // make sure first column is zero work_matrix.coeffRef(p,p) = work_matrix.coeffRef(q,p) = Scalar(0); if(abs(numext::imag(work_matrix.coeff(p,q)))>considerAsZero) { // work_matrix.coeff(p,q) can be zero if work_matrix.coeff(q,p) is not zero but small enough to underflow when computing n z = abs(work_matrix.coeff(p,q)) / work_matrix.coeff(p,q); work_matrix.row(p) *= z; if(svd.computeU()) svd.m_matrixU.col(p) *= conj(z); } if(abs(numext::imag(work_matrix.coeff(q,q)))>considerAsZero) { z = abs(work_matrix.coeff(q,q)) / work_matrix.coeff(q,q); work_matrix.row(q) *= z; if(svd.computeU()) svd.m_matrixU.col(q) *= conj(z); } // otherwise the second row is already zero, so we have nothing to do. } else { rot.c() = conj(work_matrix.coeff(p,p)) / n; rot.s() = work_matrix.coeff(q,p) / n; work_matrix.applyOnTheLeft(p,q,rot); if(svd.computeU()) svd.m_matrixU.applyOnTheRight(p,q,rot.adjoint()); if(abs(numext::imag(work_matrix.coeff(p,q)))>considerAsZero) { z = abs(work_matrix.coeff(p,q)) / work_matrix.coeff(p,q); work_matrix.col(q) *= z; if(svd.computeV()) svd.m_matrixV.col(q) *= z; } if(abs(numext::imag(work_matrix.coeff(q,q)))>considerAsZero) { z = abs(work_matrix.coeff(q,q)) / work_matrix.coeff(q,q); work_matrix.row(q) *= z; if(svd.computeU()) svd.m_matrixU.col(q) *= conj(z); } } // update largest diagonal entry maxDiagEntry = numext::maxi(maxDiagEntry,numext::maxi(abs(work_matrix.coeff(p,p)), abs(work_matrix.coeff(q,q)))); // and check whether the 2x2 block is already diagonal RealScalar threshold = numext::maxi(considerAsZero, precision * maxDiagEntry); return abs(work_matrix.coeff(p,q))>threshold || abs(work_matrix.coeff(q,p)) > threshold; } }; template struct traits > : traits { typedef MatrixType_ MatrixType; }; } // end namespace internal /** \ingroup SVD_Module * * * \class JacobiSVD * * \brief Two-sided Jacobi SVD decomposition of a rectangular matrix * * \tparam MatrixType_ the type of the matrix of which we are computing the SVD decomposition * \tparam QRPreconditioner this optional parameter allows to specify the type of QR decomposition that will be used internally * for the R-SVD step for non-square matrices. See discussion of possible values below. * * SVD decomposition consists in decomposing any n-by-p matrix \a A as a product * \f[ A = U S V^* \f] * where \a U is a n-by-n unitary, \a V is a p-by-p unitary, and \a S is a n-by-p real positive matrix which is zero outside of its main diagonal; * the diagonal entries of S are known as the \em singular \em values of \a A and the columns of \a U and \a V are known as the left * and right \em singular \em vectors of \a A respectively. * * Singular values are always sorted in decreasing order. * * This JacobiSVD decomposition computes only the singular values by default. If you want \a U or \a V, you need to ask for them explicitly. * * You can ask for only \em thin \a U or \a V to be computed, meaning the following. In case of a rectangular n-by-p matrix, letting \a m be the * smaller value among \a n and \a p, there are only \a m singular vectors; the remaining columns of \a U and \a V do not correspond to actual * singular vectors. Asking for \em thin \a U or \a V means asking for only their \a m first columns to be formed. So \a U is then a n-by-m matrix, * and \a V is then a p-by-m matrix. Notice that thin \a U and \a V are all you need for (least squares) solving. * * Here's an example demonstrating basic usage: * \include JacobiSVD_basic.cpp * Output: \verbinclude JacobiSVD_basic.out * * This JacobiSVD class is a two-sided Jacobi R-SVD decomposition, ensuring optimal reliability and accuracy. The downside is that it's slower than * bidiagonalizing SVD algorithms for large square matrices; however its complexity is still \f$ O(n^2p) \f$ where \a n is the smaller dimension and * \a p is the greater dimension, meaning that it is still of the same order of complexity as the faster bidiagonalizing R-SVD algorithms. * In particular, like any R-SVD, it takes advantage of non-squareness in that its complexity is only linear in the greater dimension. * * If the input matrix has inf or nan coefficients, the result of the computation is undefined, but the computation is guaranteed to * terminate in finite (and reasonable) time. * * The possible values for QRPreconditioner are: * \li ColPivHouseholderQRPreconditioner is the default. In practice it's very safe. It uses column-pivoting QR. * \li FullPivHouseholderQRPreconditioner, is the safest and slowest. It uses full-pivoting QR. * Contrary to other QRs, it doesn't allow computing thin unitaries. * \li HouseholderQRPreconditioner is the fastest, and less safe and accurate than the pivoting variants. It uses non-pivoting QR. * This is very similar in safety and accuracy to the bidiagonalization process used by bidiagonalizing SVD algorithms (since bidiagonalization * is inherently non-pivoting). However the resulting SVD is still more reliable than bidiagonalizing SVDs because the Jacobi-based iterarive * process is more reliable than the optimized bidiagonal SVD iterations. * \li NoQRPreconditioner allows not to use a QR preconditioner at all. This is useful if you know that you will only be computing * JacobiSVD decompositions of square matrices. Non-square matrices require a QR preconditioner. Using this option will result in * faster compilation and smaller executable code. It won't significantly speed up computation, since JacobiSVD is always checking * if QR preconditioning is needed before applying it anyway. * * \sa MatrixBase::jacobiSvd() */ template class JacobiSVD : public SVDBase > { typedef SVDBase Base; public: typedef MatrixType_ MatrixType; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, DiagSizeAtCompileTime = EIGEN_SIZE_MIN_PREFER_DYNAMIC(RowsAtCompileTime,ColsAtCompileTime), MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, MaxDiagSizeAtCompileTime = EIGEN_SIZE_MIN_PREFER_FIXED(MaxRowsAtCompileTime,MaxColsAtCompileTime), MatrixOptions = MatrixType::Options }; typedef typename Base::MatrixUType MatrixUType; typedef typename Base::MatrixVType MatrixVType; typedef typename Base::SingularValuesType SingularValuesType; typedef typename internal::plain_row_type::type RowType; typedef typename internal::plain_col_type::type ColType; typedef Matrix WorkMatrixType; /** \brief Default Constructor. * * The default constructor is useful in cases in which the user intends to * perform decompositions via JacobiSVD::compute(const MatrixType&). */ JacobiSVD() {} /** \brief Default Constructor with memory preallocation * * Like the default constructor but with preallocation of the internal data * according to the specified problem size. * \sa JacobiSVD() */ JacobiSVD(Index rows, Index cols, unsigned int computationOptions = 0) { allocate(rows, cols, computationOptions); } /** \brief Constructor performing the decomposition of given matrix. * * \param matrix the matrix to decompose * \param computationOptions optional parameter allowing to specify if you want full or thin U or V unitaries to be computed. * By default, none is computed. This is a bit-field, the possible bits are #ComputeFullU, #ComputeThinU, * #ComputeFullV, #ComputeThinV. * * Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not * available with the (non-default) FullPivHouseholderQR preconditioner. */ explicit JacobiSVD(const MatrixType& matrix, unsigned int computationOptions = 0) { compute(matrix, computationOptions); } /** \brief Method performing the decomposition of given matrix using custom options. * * \param matrix the matrix to decompose * \param computationOptions optional parameter allowing to specify if you want full or thin U or V unitaries to be computed. * By default, none is computed. This is a bit-field, the possible bits are #ComputeFullU, #ComputeThinU, * #ComputeFullV, #ComputeThinV. * * Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not * available with the (non-default) FullPivHouseholderQR preconditioner. */ JacobiSVD& compute(const MatrixType& matrix, unsigned int computationOptions); /** \brief Method performing the decomposition of given matrix using current options. * * \param matrix the matrix to decompose * * This method uses the current \a computationOptions, as already passed to the constructor or to compute(const MatrixType&, unsigned int). */ JacobiSVD& compute(const MatrixType& matrix) { return compute(matrix, m_computationOptions); } using Base::computeU; using Base::computeV; using Base::rows; using Base::cols; using Base::rank; private: void allocate(Index rows, Index cols, unsigned int computationOptions); protected: using Base::m_matrixU; using Base::m_matrixV; using Base::m_singularValues; using Base::m_info; using Base::m_isInitialized; using Base::m_isAllocated; using Base::m_usePrescribedThreshold; using Base::m_computeFullU; using Base::m_computeThinU; using Base::m_computeFullV; using Base::m_computeThinV; using Base::m_computationOptions; using Base::m_nonzeroSingularValues; using Base::m_rows; using Base::m_cols; using Base::m_diagSize; using Base::m_prescribedThreshold; WorkMatrixType m_workMatrix; template friend struct internal::svd_precondition_2x2_block_to_be_real; template friend struct internal::qr_preconditioner_impl; internal::qr_preconditioner_impl m_qr_precond_morecols; internal::qr_preconditioner_impl m_qr_precond_morerows; MatrixType m_scaledMatrix; }; template void JacobiSVD::allocate(Eigen::Index rows, Eigen::Index cols, unsigned int computationOptions) { eigen_assert(rows >= 0 && cols >= 0); if (m_isAllocated && rows == m_rows && cols == m_cols && computationOptions == m_computationOptions) { return; } m_rows = rows; m_cols = cols; m_info = Success; m_isInitialized = false; m_isAllocated = true; m_computationOptions = computationOptions; m_computeFullU = (computationOptions & ComputeFullU) != 0; m_computeThinU = (computationOptions & ComputeThinU) != 0; m_computeFullV = (computationOptions & ComputeFullV) != 0; m_computeThinV = (computationOptions & ComputeThinV) != 0; eigen_assert(!(m_computeFullU && m_computeThinU) && "JacobiSVD: you can't ask for both full and thin U"); eigen_assert(!(m_computeFullV && m_computeThinV) && "JacobiSVD: you can't ask for both full and thin V"); eigen_assert(EIGEN_IMPLIES(m_computeThinU || m_computeThinV, MatrixType::ColsAtCompileTime==Dynamic) && "JacobiSVD: thin U and V are only available when your matrix has a dynamic number of columns."); if (QRPreconditioner == FullPivHouseholderQRPreconditioner) { eigen_assert(!(m_computeThinU || m_computeThinV) && "JacobiSVD: can't compute thin U or thin V with the FullPivHouseholderQR preconditioner. " "Use the ColPivHouseholderQR preconditioner instead."); } m_diagSize = (std::min)(m_rows, m_cols); m_singularValues.resize(m_diagSize); if(RowsAtCompileTime==Dynamic) m_matrixU.resize(m_rows, m_computeFullU ? m_rows : m_computeThinU ? m_diagSize : 0); if(ColsAtCompileTime==Dynamic) m_matrixV.resize(m_cols, m_computeFullV ? m_cols : m_computeThinV ? m_diagSize : 0); m_workMatrix.resize(m_diagSize, m_diagSize); if(m_cols>m_rows) m_qr_precond_morecols.allocate(*this); if(m_rows>m_cols) m_qr_precond_morerows.allocate(*this); if(m_rows!=m_cols) m_scaledMatrix.resize(rows,cols); } template JacobiSVD& JacobiSVD::compute(const MatrixType& matrix, unsigned int computationOptions) { using std::abs; allocate(matrix.rows(), matrix.cols(), computationOptions); // currently we stop when we reach precision 2*epsilon as the last bit of precision can require an unreasonable number of iterations, // only worsening the precision of U and V as we accumulate more rotations const RealScalar precision = RealScalar(2) * NumTraits::epsilon(); // limit for denormal numbers to be considered zero in order to avoid infinite loops (see bug 286) const RealScalar considerAsZero = (std::numeric_limits::min)(); // Scaling factor to reduce over/under-flows RealScalar scale = matrix.cwiseAbs().template maxCoeff(); if (!(numext::isfinite)(scale)) { m_isInitialized = true; m_info = InvalidInput; return *this; } if(scale==RealScalar(0)) scale = RealScalar(1); /*** step 1. The R-SVD step: we use a QR decomposition to reduce to the case of a square matrix */ if(m_rows!=m_cols) { m_scaledMatrix = matrix / scale; m_qr_precond_morecols.run(*this, m_scaledMatrix); m_qr_precond_morerows.run(*this, m_scaledMatrix); } else { m_workMatrix = matrix.block(0,0,m_diagSize,m_diagSize) / scale; if(m_computeFullU) m_matrixU.setIdentity(m_rows,m_rows); if(m_computeThinU) m_matrixU.setIdentity(m_rows,m_diagSize); if(m_computeFullV) m_matrixV.setIdentity(m_cols,m_cols); if(m_computeThinV) m_matrixV.setIdentity(m_cols, m_diagSize); } /*** step 2. The main Jacobi SVD iteration. ***/ RealScalar maxDiagEntry = m_workMatrix.cwiseAbs().diagonal().maxCoeff(); bool finished = false; while(!finished) { finished = true; // do a sweep: for all index pairs (p,q), perform SVD of the corresponding 2x2 sub-matrix for(Index p = 1; p < m_diagSize; ++p) { for(Index q = 0; q < p; ++q) { // if this 2x2 sub-matrix is not diagonal already... // notice that this comparison will evaluate to false if any NaN is involved, ensuring that NaN's don't // keep us iterating forever. Similarly, small denormal numbers are considered zero. RealScalar threshold = numext::maxi(considerAsZero, precision * maxDiagEntry); if(abs(m_workMatrix.coeff(p,q))>threshold || abs(m_workMatrix.coeff(q,p)) > threshold) { finished = false; // perform SVD decomposition of 2x2 sub-matrix corresponding to indices p,q to make it diagonal // the complex to real operation returns true if the updated 2x2 block is not already diagonal if(internal::svd_precondition_2x2_block_to_be_real::run(m_workMatrix, *this, p, q, maxDiagEntry)) { JacobiRotation j_left, j_right; internal::real_2x2_jacobi_svd(m_workMatrix, p, q, &j_left, &j_right); // accumulate resulting Jacobi rotations m_workMatrix.applyOnTheLeft(p,q,j_left); if(computeU()) m_matrixU.applyOnTheRight(p,q,j_left.transpose()); m_workMatrix.applyOnTheRight(p,q,j_right); if(computeV()) m_matrixV.applyOnTheRight(p,q,j_right); // keep track of the largest diagonal coefficient maxDiagEntry = numext::maxi(maxDiagEntry,numext::maxi(abs(m_workMatrix.coeff(p,p)), abs(m_workMatrix.coeff(q,q)))); } } } } } /*** step 3. The work matrix is now diagonal, so ensure it's positive so its diagonal entries are the singular values ***/ for(Index i = 0; i < m_diagSize; ++i) { // For a complex matrix, some diagonal coefficients might note have been // treated by svd_precondition_2x2_block_to_be_real, and the imaginary part // of some diagonal entry might not be null. if(NumTraits::IsComplex && abs(numext::imag(m_workMatrix.coeff(i,i)))>considerAsZero) { RealScalar a = abs(m_workMatrix.coeff(i,i)); m_singularValues.coeffRef(i) = abs(a); if(computeU()) m_matrixU.col(i) *= m_workMatrix.coeff(i,i)/a; } else { // m_workMatrix.coeff(i,i) is already real, no difficulty: RealScalar a = numext::real(m_workMatrix.coeff(i,i)); m_singularValues.coeffRef(i) = abs(a); if(computeU() && (a JacobiSVD::PlainObject> MatrixBase::jacobiSvd(unsigned int computationOptions) const { return JacobiSVD(*this, computationOptions); } } // end namespace Eigen #endif // EIGEN_JACOBISVD_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SVD/JacobiSVD_LAPACKE.h ================================================ /* Copyright (c) 2011, Intel Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************** * Content : Eigen bindings to LAPACKe * Singular Value Decomposition - SVD. ******************************************************************************** */ #ifndef EIGEN_JACOBISVD_LAPACKE_H #define EIGEN_JACOBISVD_LAPACKE_H namespace Eigen { /** \internal Specialization for the data types supported by LAPACKe */ #define EIGEN_LAPACKE_SVD(EIGTYPE, LAPACKE_TYPE, LAPACKE_RTYPE, LAPACKE_PREFIX, EIGCOLROW, LAPACKE_COLROW) \ template<> inline \ JacobiSVD, ColPivHouseholderQRPreconditioner>& \ JacobiSVD, ColPivHouseholderQRPreconditioner>::compute(const Matrix& matrix, unsigned int computationOptions) \ { \ typedef Matrix MatrixType; \ /*typedef MatrixType::Scalar Scalar;*/ \ /*typedef MatrixType::RealScalar RealScalar;*/ \ allocate(matrix.rows(), matrix.cols(), computationOptions); \ \ /*const RealScalar precision = RealScalar(2) * NumTraits::epsilon();*/ \ m_nonzeroSingularValues = m_diagSize; \ \ lapack_int lda = internal::convert_index(matrix.outerStride()), ldu, ldvt; \ lapack_int matrix_order = LAPACKE_COLROW; \ char jobu, jobvt; \ LAPACKE_TYPE *u, *vt, dummy; \ jobu = (m_computeFullU) ? 'A' : (m_computeThinU) ? 'S' : 'N'; \ jobvt = (m_computeFullV) ? 'A' : (m_computeThinV) ? 'S' : 'N'; \ if (computeU()) { \ ldu = internal::convert_index(m_matrixU.outerStride()); \ u = (LAPACKE_TYPE*)m_matrixU.data(); \ } else { ldu=1; u=&dummy; }\ MatrixType localV; \ lapack_int vt_rows = (m_computeFullV) ? internal::convert_index(m_cols) : (m_computeThinV) ? internal::convert_index(m_diagSize) : 1; \ if (computeV()) { \ localV.resize(vt_rows, m_cols); \ ldvt = internal::convert_index(localV.outerStride()); \ vt = (LAPACKE_TYPE*)localV.data(); \ } else { ldvt=1; vt=&dummy; }\ Matrix superb; superb.resize(m_diagSize, 1); \ MatrixType m_temp; m_temp = matrix; \ LAPACKE_##LAPACKE_PREFIX##gesvd( matrix_order, jobu, jobvt, internal::convert_index(m_rows), internal::convert_index(m_cols), (LAPACKE_TYPE*)m_temp.data(), lda, (LAPACKE_RTYPE*)m_singularValues.data(), u, ldu, vt, ldvt, superb.data()); \ if (computeV()) m_matrixV = localV.adjoint(); \ /* for(int i=0;i // Copyright (C) 2014 Gael Guennebaud // // Copyright (C) 2013 Gauthier Brun // Copyright (C) 2013 Nicolas Carre // Copyright (C) 2013 Jean Ceccato // Copyright (C) 2013 Pierre Zoppitelli // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SVDBASE_H #define EIGEN_SVDBASE_H namespace Eigen { namespace internal { template struct traits > : traits { typedef MatrixXpr XprKind; typedef SolverStorage StorageKind; typedef int StorageIndex; enum { Flags = 0 }; }; } /** \ingroup SVD_Module * * * \class SVDBase * * \brief Base class of SVD algorithms * * \tparam Derived the type of the actual SVD decomposition * * SVD decomposition consists in decomposing any n-by-p matrix \a A as a product * \f[ A = U S V^* \f] * where \a U is a n-by-n unitary, \a V is a p-by-p unitary, and \a S is a n-by-p real positive matrix which is zero outside of its main diagonal; * the diagonal entries of S are known as the \em singular \em values of \a A and the columns of \a U and \a V are known as the left * and right \em singular \em vectors of \a A respectively. * * Singular values are always sorted in decreasing order. * * * You can ask for only \em thin \a U or \a V to be computed, meaning the following. In case of a rectangular n-by-p matrix, letting \a m be the * smaller value among \a n and \a p, there are only \a m singular vectors; the remaining columns of \a U and \a V do not correspond to actual * singular vectors. Asking for \em thin \a U or \a V means asking for only their \a m first columns to be formed. So \a U is then a n-by-m matrix, * and \a V is then a p-by-m matrix. Notice that thin \a U and \a V are all you need for (least squares) solving. * * The status of the computation can be retrived using the \a info() method. Unless \a info() returns \a Success, the results should be not * considered well defined. * * If the input matrix has inf or nan coefficients, the result of the computation is undefined, and \a info() will return \a InvalidInput, but the computation is guaranteed to * terminate in finite (and reasonable) time. * \sa class BDCSVD, class JacobiSVD */ template class SVDBase : public SolverBase > { public: template friend struct internal::solve_assertion; typedef typename internal::traits::MatrixType MatrixType; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef typename Eigen::internal::traits::StorageIndex StorageIndex; typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3 enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, DiagSizeAtCompileTime = EIGEN_SIZE_MIN_PREFER_DYNAMIC(RowsAtCompileTime,ColsAtCompileTime), MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, MaxDiagSizeAtCompileTime = EIGEN_SIZE_MIN_PREFER_FIXED(MaxRowsAtCompileTime,MaxColsAtCompileTime), MatrixOptions = MatrixType::Options }; typedef Matrix MatrixUType; typedef Matrix MatrixVType; typedef typename internal::plain_diag_type::type SingularValuesType; Derived& derived() { return *static_cast(this); } const Derived& derived() const { return *static_cast(this); } /** \returns the \a U matrix. * * For the SVD decomposition of a n-by-p matrix, letting \a m be the minimum of \a n and \a p, * the U matrix is n-by-n if you asked for \link Eigen::ComputeFullU ComputeFullU \endlink, and is n-by-m if you asked for \link Eigen::ComputeThinU ComputeThinU \endlink. * * The \a m first columns of \a U are the left singular vectors of the matrix being decomposed. * * This method asserts that you asked for \a U to be computed. */ const MatrixUType& matrixU() const { _check_compute_assertions(); eigen_assert(computeU() && "This SVD decomposition didn't compute U. Did you ask for it?"); return m_matrixU; } /** \returns the \a V matrix. * * For the SVD decomposition of a n-by-p matrix, letting \a m be the minimum of \a n and \a p, * the V matrix is p-by-p if you asked for \link Eigen::ComputeFullV ComputeFullV \endlink, and is p-by-m if you asked for \link Eigen::ComputeThinV ComputeThinV \endlink. * * The \a m first columns of \a V are the right singular vectors of the matrix being decomposed. * * This method asserts that you asked for \a V to be computed. */ const MatrixVType& matrixV() const { _check_compute_assertions(); eigen_assert(computeV() && "This SVD decomposition didn't compute V. Did you ask for it?"); return m_matrixV; } /** \returns the vector of singular values. * * For the SVD decomposition of a n-by-p matrix, letting \a m be the minimum of \a n and \a p, the * returned vector has size \a m. Singular values are always sorted in decreasing order. */ const SingularValuesType& singularValues() const { _check_compute_assertions(); return m_singularValues; } /** \returns the number of singular values that are not exactly 0 */ Index nonzeroSingularValues() const { _check_compute_assertions(); return m_nonzeroSingularValues; } /** \returns the rank of the matrix of which \c *this is the SVD. * * \note This method has to determine which singular values should be considered nonzero. * For that, it uses the threshold value that you can control by calling * setThreshold(const RealScalar&). */ inline Index rank() const { using std::abs; _check_compute_assertions(); if(m_singularValues.size()==0) return 0; RealScalar premultiplied_threshold = numext::maxi(m_singularValues.coeff(0) * threshold(), (std::numeric_limits::min)()); Index i = m_nonzeroSingularValues-1; while(i>=0 && m_singularValues.coeff(i) < premultiplied_threshold) --i; return i+1; } /** Allows to prescribe a threshold to be used by certain methods, such as rank() and solve(), * which need to determine when singular values are to be considered nonzero. * This is not used for the SVD decomposition itself. * * When it needs to get the threshold value, Eigen calls threshold(). * The default is \c NumTraits::epsilon() * * \param threshold The new value to use as the threshold. * * A singular value will be considered nonzero if its value is strictly greater than * \f$ \vert singular value \vert \leqslant threshold \times \vert max singular value \vert \f$. * * If you want to come back to the default behavior, call setThreshold(Default_t) */ Derived& setThreshold(const RealScalar& threshold) { m_usePrescribedThreshold = true; m_prescribedThreshold = threshold; return derived(); } /** Allows to come back to the default behavior, letting Eigen use its default formula for * determining the threshold. * * You should pass the special object Eigen::Default as parameter here. * \code svd.setThreshold(Eigen::Default); \endcode * * See the documentation of setThreshold(const RealScalar&). */ Derived& setThreshold(Default_t) { m_usePrescribedThreshold = false; return derived(); } /** Returns the threshold that will be used by certain methods such as rank(). * * See the documentation of setThreshold(const RealScalar&). */ RealScalar threshold() const { eigen_assert(m_isInitialized || m_usePrescribedThreshold); // this temporary is needed to workaround a MSVC issue Index diagSize = (std::max)(1,m_diagSize); return m_usePrescribedThreshold ? m_prescribedThreshold : RealScalar(diagSize)*NumTraits::epsilon(); } /** \returns true if \a U (full or thin) is asked for in this SVD decomposition */ inline bool computeU() const { return m_computeFullU || m_computeThinU; } /** \returns true if \a V (full or thin) is asked for in this SVD decomposition */ inline bool computeV() const { return m_computeFullV || m_computeThinV; } inline Index rows() const { return m_rows; } inline Index cols() const { return m_cols; } #ifdef EIGEN_PARSED_BY_DOXYGEN /** \returns a (least squares) solution of \f$ A x = b \f$ using the current SVD decomposition of A. * * \param b the right-hand-side of the equation to solve. * * \note Solving requires both U and V to be computed. Thin U and V are enough, there is no need for full U or V. * * \note SVD solving is implicitly least-squares. Thus, this method serves both purposes of exact solving and least-squares solving. * In other words, the returned solution is guaranteed to minimize the Euclidean norm \f$ \Vert A x - b \Vert \f$. */ template inline const Solve solve(const MatrixBase& b) const; #endif /** \brief Reports whether previous computation was successful. * * \returns \c Success if computation was successful. */ EIGEN_DEVICE_FUNC ComputationInfo info() const { eigen_assert(m_isInitialized && "SVD is not initialized."); return m_info; } #ifndef EIGEN_PARSED_BY_DOXYGEN template void _solve_impl(const RhsType &rhs, DstType &dst) const; template void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const; #endif protected: static void check_template_parameters() { EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); } void _check_compute_assertions() const { eigen_assert(m_isInitialized && "SVD is not initialized."); } template void _check_solve_assertion(const Rhs& b) const { EIGEN_ONLY_USED_FOR_DEBUG(b); _check_compute_assertions(); eigen_assert(computeU() && computeV() && "SVDBase::solve(): Both unitaries U and V are required to be computed (thin unitaries suffice)."); eigen_assert((Transpose_?cols():rows())==b.rows() && "SVDBase::solve(): invalid number of rows of the right hand side matrix b"); } // return true if already allocated bool allocate(Index rows, Index cols, unsigned int computationOptions) ; MatrixUType m_matrixU; MatrixVType m_matrixV; SingularValuesType m_singularValues; ComputationInfo m_info; bool m_isInitialized, m_isAllocated, m_usePrescribedThreshold; bool m_computeFullU, m_computeThinU; bool m_computeFullV, m_computeThinV; unsigned int m_computationOptions; Index m_nonzeroSingularValues, m_rows, m_cols, m_diagSize; RealScalar m_prescribedThreshold; /** \brief Default Constructor. * * Default constructor of SVDBase */ SVDBase() : m_info(Success), m_isInitialized(false), m_isAllocated(false), m_usePrescribedThreshold(false), m_computeFullU(false), m_computeThinU(false), m_computeFullV(false), m_computeThinV(false), m_computationOptions(0), m_rows(-1), m_cols(-1), m_diagSize(0) { check_template_parameters(); } }; #ifndef EIGEN_PARSED_BY_DOXYGEN template template void SVDBase::_solve_impl(const RhsType &rhs, DstType &dst) const { // A = U S V^* // So A^{-1} = V S^{-1} U^* Matrix tmp; Index l_rank = rank(); tmp.noalias() = m_matrixU.leftCols(l_rank).adjoint() * rhs; tmp = m_singularValues.head(l_rank).asDiagonal().inverse() * tmp; dst = m_matrixV.leftCols(l_rank) * tmp; } template template void SVDBase::_solve_impl_transposed(const RhsType &rhs, DstType &dst) const { // A = U S V^* // So A^{-*} = U S^{-1} V^* // And A^{-T} = U_conj S^{-1} V^T Matrix tmp; Index l_rank = rank(); tmp.noalias() = m_matrixV.leftCols(l_rank).transpose().template conjugateIf() * rhs; tmp = m_singularValues.head(l_rank).asDiagonal().inverse() * tmp; dst = m_matrixU.template conjugateIf().leftCols(l_rank) * tmp; } #endif template bool SVDBase::allocate(Index rows, Index cols, unsigned int computationOptions) { eigen_assert(rows >= 0 && cols >= 0); if (m_isAllocated && rows == m_rows && cols == m_cols && computationOptions == m_computationOptions) { return true; } m_rows = rows; m_cols = cols; m_info = Success; m_isInitialized = false; m_isAllocated = true; m_computationOptions = computationOptions; m_computeFullU = (computationOptions & ComputeFullU) != 0; m_computeThinU = (computationOptions & ComputeThinU) != 0; m_computeFullV = (computationOptions & ComputeFullV) != 0; m_computeThinV = (computationOptions & ComputeThinV) != 0; eigen_assert(!(m_computeFullU && m_computeThinU) && "SVDBase: you can't ask for both full and thin U"); eigen_assert(!(m_computeFullV && m_computeThinV) && "SVDBase: you can't ask for both full and thin V"); eigen_assert(EIGEN_IMPLIES(m_computeThinU || m_computeThinV, MatrixType::ColsAtCompileTime==Dynamic) && "SVDBase: thin U and V are only available when your matrix has a dynamic number of columns."); m_diagSize = (std::min)(m_rows, m_cols); m_singularValues.resize(m_diagSize); if(RowsAtCompileTime==Dynamic) m_matrixU.resize(m_rows, m_computeFullU ? m_rows : m_computeThinU ? m_diagSize : 0); if(ColsAtCompileTime==Dynamic) m_matrixV.resize(m_cols, m_computeFullV ? m_cols : m_computeThinV ? m_diagSize : 0); return false; } }// end namespace #endif // EIGEN_SVDBASE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SVD/UpperBidiagonalization.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2010 Benoit Jacob // Copyright (C) 2013-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_BIDIAGONALIZATION_H #define EIGEN_BIDIAGONALIZATION_H namespace Eigen { namespace internal { // UpperBidiagonalization will probably be replaced by a Bidiagonalization class, don't want to make it stable API. // At the same time, it's useful to keep for now as it's about the only thing that is testing the BandMatrix class. template class UpperBidiagonalization { public: typedef MatrixType_ MatrixType; enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, ColsAtCompileTimeMinusOne = internal::decrement_size::ret }; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3 typedef Matrix RowVectorType; typedef Matrix ColVectorType; typedef BandMatrix BidiagonalType; typedef Matrix DiagVectorType; typedef Matrix SuperDiagVectorType; typedef HouseholderSequence< const MatrixType, const typename internal::remove_all::ConjugateReturnType>::type > HouseholderUSequenceType; typedef HouseholderSequence< const typename internal::remove_all::type, Diagonal, OnTheRight > HouseholderVSequenceType; /** * \brief Default Constructor. * * The default constructor is useful in cases in which the user intends to * perform decompositions via Bidiagonalization::compute(const MatrixType&). */ UpperBidiagonalization() : m_householder(), m_bidiagonal(), m_isInitialized(false) {} explicit UpperBidiagonalization(const MatrixType& matrix) : m_householder(matrix.rows(), matrix.cols()), m_bidiagonal(matrix.cols(), matrix.cols()), m_isInitialized(false) { compute(matrix); } UpperBidiagonalization& compute(const MatrixType& matrix); UpperBidiagonalization& computeUnblocked(const MatrixType& matrix); const MatrixType& householder() const { return m_householder; } const BidiagonalType& bidiagonal() const { return m_bidiagonal; } const HouseholderUSequenceType householderU() const { eigen_assert(m_isInitialized && "UpperBidiagonalization is not initialized."); return HouseholderUSequenceType(m_householder, m_householder.diagonal().conjugate()); } const HouseholderVSequenceType householderV() // const here gives nasty errors and i'm lazy { eigen_assert(m_isInitialized && "UpperBidiagonalization is not initialized."); return HouseholderVSequenceType(m_householder.conjugate(), m_householder.const_derived().template diagonal<1>()) .setLength(m_householder.cols()-1) .setShift(1); } protected: MatrixType m_householder; BidiagonalType m_bidiagonal; bool m_isInitialized; }; // Standard upper bidiagonalization without fancy optimizations // This version should be faster for small matrix size template void upperbidiagonalization_inplace_unblocked(MatrixType& mat, typename MatrixType::RealScalar *diagonal, typename MatrixType::RealScalar *upper_diagonal, typename MatrixType::Scalar* tempData = 0) { typedef typename MatrixType::Scalar Scalar; Index rows = mat.rows(); Index cols = mat.cols(); typedef Matrix TempType; TempType tempVector; if(tempData==0) { tempVector.resize(rows); tempData = tempVector.data(); } for (Index k = 0; /* breaks at k==cols-1 below */ ; ++k) { Index remainingRows = rows - k; Index remainingCols = cols - k - 1; // construct left householder transform in-place in A mat.col(k).tail(remainingRows) .makeHouseholderInPlace(mat.coeffRef(k,k), diagonal[k]); // apply householder transform to remaining part of A on the left mat.bottomRightCorner(remainingRows, remainingCols) .applyHouseholderOnTheLeft(mat.col(k).tail(remainingRows-1), mat.coeff(k,k), tempData); if(k == cols-1) break; // construct right householder transform in-place in mat mat.row(k).tail(remainingCols) .makeHouseholderInPlace(mat.coeffRef(k,k+1), upper_diagonal[k]); // apply householder transform to remaining part of mat on the left mat.bottomRightCorner(remainingRows-1, remainingCols) .applyHouseholderOnTheRight(mat.row(k).tail(remainingCols-1).adjoint(), mat.coeff(k,k+1), tempData); } } /** \internal * Helper routine for the block reduction to upper bidiagonal form. * * Let's partition the matrix A: * * | A00 A01 | * A = | | * | A10 A11 | * * This function reduces to bidiagonal form the left \c rows x \a blockSize vertical panel [A00/A10] * and the \a blockSize x \c cols horizontal panel [A00 A01] of the matrix \a A. The bottom-right block A11 * is updated using matrix-matrix products: * A22 -= V * Y^T - X * U^T * where V and U contains the left and right Householder vectors. U and V are stored in A10, and A01 * respectively, and the update matrices X and Y are computed during the reduction. * */ template void upperbidiagonalization_blocked_helper(MatrixType& A, typename MatrixType::RealScalar *diagonal, typename MatrixType::RealScalar *upper_diagonal, Index bs, Ref::Flags & RowMajorBit> > X, Ref::Flags & RowMajorBit> > Y) { typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef typename NumTraits::Literal Literal; enum { StorageOrder = traits::Flags & RowMajorBit }; typedef InnerStride ColInnerStride; typedef InnerStride RowInnerStride; typedef Ref, 0, ColInnerStride> SubColumnType; typedef Ref, 0, RowInnerStride> SubRowType; typedef Ref > SubMatType; Index brows = A.rows(); Index bcols = A.cols(); Scalar tau_u, tau_u_prev(0), tau_v; for(Index k = 0; k < bs; ++k) { Index remainingRows = brows - k; Index remainingCols = bcols - k - 1; SubMatType X_k1( X.block(k,0, remainingRows,k) ); SubMatType V_k1( A.block(k,0, remainingRows,k) ); // 1 - update the k-th column of A SubColumnType v_k = A.col(k).tail(remainingRows); v_k -= V_k1 * Y.row(k).head(k).adjoint(); if(k) v_k -= X_k1 * A.col(k).head(k); // 2 - construct left Householder transform in-place v_k.makeHouseholderInPlace(tau_v, diagonal[k]); if(k+10) A.coeffRef(k-1,k) = tau_u_prev; tau_u_prev = tau_u; } else A.coeffRef(k-1,k) = tau_u_prev; A.coeffRef(k,k) = tau_v; } if(bsbs && brows>bs) { SubMatType A11( A.bottomRightCorner(brows-bs,bcols-bs) ); SubMatType A10( A.block(bs,0, brows-bs,bs) ); SubMatType A01( A.block(0,bs, bs,bcols-bs) ); Scalar tmp = A01(bs-1,0); A01(bs-1,0) = Literal(1); A11.noalias() -= A10 * Y.topLeftCorner(bcols,bs).bottomRows(bcols-bs).adjoint(); A11.noalias() -= X.topLeftCorner(brows,bs).bottomRows(brows-bs) * A01; A01(bs-1,0) = tmp; } } /** \internal * * Implementation of a block-bidiagonal reduction. * It is based on the following paper: * The Design of a Parallel Dense Linear Algebra Software Library: Reduction to Hessenberg, Tridiagonal, and Bidiagonal Form. * by Jaeyoung Choi, Jack J. Dongarra, David W. Walker. (1995) * section 3.3 */ template void upperbidiagonalization_inplace_blocked(MatrixType& A, BidiagType& bidiagonal, Index maxBlockSize=32, typename MatrixType::Scalar* /*tempData*/ = 0) { typedef typename MatrixType::Scalar Scalar; typedef Block BlockType; Index rows = A.rows(); Index cols = A.cols(); Index size = (std::min)(rows, cols); // X and Y are work space enum { StorageOrder = traits::Flags & RowMajorBit }; Matrix X(rows,maxBlockSize); Matrix Y(cols,maxBlockSize); Index blockSize = (std::min)(maxBlockSize,size); Index k = 0; for(k = 0; k < size; k += blockSize) { Index bs = (std::min)(size-k,blockSize); // actual size of the block Index brows = rows - k; // rows of the block Index bcols = cols - k; // columns of the block // partition the matrix A: // // | A00 A01 A02 | // | | // A = | A10 A11 A12 | // | | // | A20 A21 A22 | // // where A11 is a bs x bs diagonal block, // and let: // | A11 A12 | // B = | | // | A21 A22 | BlockType B = A.block(k,k,brows,bcols); // This stage performs the bidiagonalization of A11, A21, A12, and updating of A22. // Finally, the algorithm continue on the updated A22. // // However, if B is too small, or A22 empty, then let's use an unblocked strategy if(k+bs==cols || bcols<48) // somewhat arbitrary threshold { upperbidiagonalization_inplace_unblocked(B, &(bidiagonal.template diagonal<0>().coeffRef(k)), &(bidiagonal.template diagonal<1>().coeffRef(k)), X.data() ); break; // We're done } else { upperbidiagonalization_blocked_helper( B, &(bidiagonal.template diagonal<0>().coeffRef(k)), &(bidiagonal.template diagonal<1>().coeffRef(k)), bs, X.topLeftCorner(brows,bs), Y.topLeftCorner(bcols,bs) ); } } } template UpperBidiagonalization& UpperBidiagonalization::computeUnblocked(const MatrixType_& matrix) { Index rows = matrix.rows(); Index cols = matrix.cols(); EIGEN_ONLY_USED_FOR_DEBUG(cols); eigen_assert(rows >= cols && "UpperBidiagonalization is only for Arices satisfying rows>=cols."); m_householder = matrix; ColVectorType temp(rows); upperbidiagonalization_inplace_unblocked(m_householder, &(m_bidiagonal.template diagonal<0>().coeffRef(0)), &(m_bidiagonal.template diagonal<1>().coeffRef(0)), temp.data()); m_isInitialized = true; return *this; } template UpperBidiagonalization& UpperBidiagonalization::compute(const MatrixType_& matrix) { Index rows = matrix.rows(); Index cols = matrix.cols(); EIGEN_ONLY_USED_FOR_DEBUG(rows); EIGEN_ONLY_USED_FOR_DEBUG(cols); eigen_assert(rows >= cols && "UpperBidiagonalization is only for Arices satisfying rows>=cols."); m_householder = matrix; upperbidiagonalization_inplace_blocked(m_householder, m_bidiagonal); m_isInitialized = true; return *this; } #if 0 /** \return the Householder QR decomposition of \c *this. * * \sa class Bidiagonalization */ template const UpperBidiagonalization::PlainObject> MatrixBase::bidiagonalization() const { return UpperBidiagonalization(eval()); } #endif } // end namespace internal } // end namespace Eigen #endif // EIGEN_BIDIAGONALIZATION_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2012 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SIMPLICIAL_CHOLESKY_H #define EIGEN_SIMPLICIAL_CHOLESKY_H namespace Eigen { enum SimplicialCholeskyMode { SimplicialCholeskyLLT, SimplicialCholeskyLDLT }; namespace internal { template struct simplicial_cholesky_grab_input { typedef CholMatrixType const * ConstCholMatrixPtr; static void run(const InputMatrixType& input, ConstCholMatrixPtr &pmat, CholMatrixType &tmp) { tmp = input; pmat = &tmp; } }; template struct simplicial_cholesky_grab_input { typedef MatrixType const * ConstMatrixPtr; static void run(const MatrixType& input, ConstMatrixPtr &pmat, MatrixType &/*tmp*/) { pmat = &input; } }; } // end namespace internal /** \ingroup SparseCholesky_Module * \brief A base class for direct sparse Cholesky factorizations * * This is a base class for LL^T and LDL^T Cholesky factorizations of sparse matrices that are * selfadjoint and positive definite. These factorizations allow for solving A.X = B where * X and B can be either dense or sparse. * * In order to reduce the fill-in, a symmetric permutation P is applied prior to the factorization * such that the factorized matrix is P A P^-1. * * \tparam Derived the type of the derived class, that is the actual factorization type. * */ template class SimplicialCholeskyBase : public SparseSolverBase { typedef SparseSolverBase Base; using Base::m_isInitialized; public: typedef typename internal::traits::MatrixType MatrixType; typedef typename internal::traits::OrderingType OrderingType; enum { UpLo = internal::traits::UpLo }; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef typename MatrixType::StorageIndex StorageIndex; typedef SparseMatrix CholMatrixType; typedef CholMatrixType const * ConstCholMatrixPtr; typedef Matrix VectorType; typedef Matrix VectorI; enum { ColsAtCompileTime = MatrixType::ColsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; public: using Base::derived; /** Default constructor */ SimplicialCholeskyBase() : m_info(Success), m_factorizationIsOk(false), m_analysisIsOk(false), m_shiftOffset(0), m_shiftScale(1) {} explicit SimplicialCholeskyBase(const MatrixType& matrix) : m_info(Success), m_factorizationIsOk(false), m_analysisIsOk(false), m_shiftOffset(0), m_shiftScale(1) { derived().compute(matrix); } ~SimplicialCholeskyBase() { } Derived& derived() { return *static_cast(this); } const Derived& derived() const { return *static_cast(this); } inline Index cols() const { return m_matrix.cols(); } inline Index rows() const { return m_matrix.rows(); } /** \brief Reports whether previous computation was successful. * * \returns \c Success if computation was successful, * \c NumericalIssue if the matrix.appears to be negative. */ ComputationInfo info() const { eigen_assert(m_isInitialized && "Decomposition is not initialized."); return m_info; } /** \returns the permutation P * \sa permutationPinv() */ const PermutationMatrix& permutationP() const { return m_P; } /** \returns the inverse P^-1 of the permutation P * \sa permutationP() */ const PermutationMatrix& permutationPinv() const { return m_Pinv; } /** Sets the shift parameters that will be used to adjust the diagonal coefficients during the numerical factorization. * * During the numerical factorization, the diagonal coefficients are transformed by the following linear model:\n * \c d_ii = \a offset + \a scale * \c d_ii * * The default is the identity transformation with \a offset=0, and \a scale=1. * * \returns a reference to \c *this. */ Derived& setShift(const RealScalar& offset, const RealScalar& scale = 1) { m_shiftOffset = offset; m_shiftScale = scale; return derived(); } #ifndef EIGEN_PARSED_BY_DOXYGEN /** \internal */ template void dumpMemory(Stream& s) { int total = 0; s << " L: " << ((total+=(m_matrix.cols()+1) * sizeof(int) + m_matrix.nonZeros()*(sizeof(int)+sizeof(Scalar))) >> 20) << "Mb" << "\n"; s << " diag: " << ((total+=m_diag.size() * sizeof(Scalar)) >> 20) << "Mb" << "\n"; s << " tree: " << ((total+=m_parent.size() * sizeof(int)) >> 20) << "Mb" << "\n"; s << " nonzeros: " << ((total+=m_nonZerosPerCol.size() * sizeof(int)) >> 20) << "Mb" << "\n"; s << " perm: " << ((total+=m_P.size() * sizeof(int)) >> 20) << "Mb" << "\n"; s << " perm^-1: " << ((total+=m_Pinv.size() * sizeof(int)) >> 20) << "Mb" << "\n"; s << " TOTAL: " << (total>> 20) << "Mb" << "\n"; } /** \internal */ template void _solve_impl(const MatrixBase &b, MatrixBase &dest) const { eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()"); eigen_assert(m_matrix.rows()==b.rows()); if(m_info!=Success) return; if(m_P.size()>0) dest = m_P * b; else dest = b; if(m_matrix.nonZeros()>0) // otherwise L==I derived().matrixL().solveInPlace(dest); if(m_diag.size()>0) dest = m_diag.asDiagonal().inverse() * dest; if (m_matrix.nonZeros()>0) // otherwise U==I derived().matrixU().solveInPlace(dest); if(m_P.size()>0) dest = m_Pinv * dest; } template void _solve_impl(const SparseMatrixBase &b, SparseMatrixBase &dest) const { internal::solve_sparse_through_dense_panels(derived(), b, dest); } #endif // EIGEN_PARSED_BY_DOXYGEN protected: /** Computes the sparse Cholesky decomposition of \a matrix */ template void compute(const MatrixType& matrix) { eigen_assert(matrix.rows()==matrix.cols()); Index size = matrix.cols(); CholMatrixType tmp(size,size); ConstCholMatrixPtr pmat; ordering(matrix, pmat, tmp); analyzePattern_preordered(*pmat, DoLDLT); factorize_preordered(*pmat); } template void factorize(const MatrixType& a) { eigen_assert(a.rows()==a.cols()); Index size = a.cols(); CholMatrixType tmp(size,size); ConstCholMatrixPtr pmat; if(m_P.size() == 0 && (int(UpLo) & int(Upper)) == Upper) { // If there is no ordering, try to directly use the input matrix without any copy internal::simplicial_cholesky_grab_input::run(a, pmat, tmp); } else { tmp.template selfadjointView() = a.template selfadjointView().twistedBy(m_P); pmat = &tmp; } factorize_preordered(*pmat); } template void factorize_preordered(const CholMatrixType& a); void analyzePattern(const MatrixType& a, bool doLDLT) { eigen_assert(a.rows()==a.cols()); Index size = a.cols(); CholMatrixType tmp(size,size); ConstCholMatrixPtr pmat; ordering(a, pmat, tmp); analyzePattern_preordered(*pmat,doLDLT); } void analyzePattern_preordered(const CholMatrixType& a, bool doLDLT); void ordering(const MatrixType& a, ConstCholMatrixPtr &pmat, CholMatrixType& ap); /** keeps off-diagonal entries; drops diagonal entries */ struct keep_diag { inline bool operator() (const Index& row, const Index& col, const Scalar&) const { return row!=col; } }; mutable ComputationInfo m_info; bool m_factorizationIsOk; bool m_analysisIsOk; CholMatrixType m_matrix; VectorType m_diag; // the diagonal coefficients (LDLT mode) VectorI m_parent; // elimination tree VectorI m_nonZerosPerCol; PermutationMatrix m_P; // the permutation PermutationMatrix m_Pinv; // the inverse permutation RealScalar m_shiftOffset; RealScalar m_shiftScale; }; template > class SimplicialLLT; template > class SimplicialLDLT; template > class SimplicialCholesky; namespace internal { template struct traits > { typedef MatrixType_ MatrixType; typedef Ordering_ OrderingType; enum { UpLo = UpLo_ }; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::StorageIndex StorageIndex; typedef SparseMatrix CholMatrixType; typedef TriangularView MatrixL; typedef TriangularView MatrixU; static inline MatrixL getL(const CholMatrixType& m) { return MatrixL(m); } static inline MatrixU getU(const CholMatrixType& m) { return MatrixU(m.adjoint()); } }; template struct traits > { typedef MatrixType_ MatrixType; typedef Ordering_ OrderingType; enum { UpLo = UpLo_ }; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::StorageIndex StorageIndex; typedef SparseMatrix CholMatrixType; typedef TriangularView MatrixL; typedef TriangularView MatrixU; static inline MatrixL getL(const CholMatrixType& m) { return MatrixL(m); } static inline MatrixU getU(const CholMatrixType& m) { return MatrixU(m.adjoint()); } }; template struct traits > { typedef MatrixType_ MatrixType; typedef Ordering_ OrderingType; enum { UpLo = UpLo_ }; }; } /** \ingroup SparseCholesky_Module * \class SimplicialLLT * \brief A direct sparse LLT Cholesky factorizations * * This class provides a LL^T Cholesky factorizations of sparse matrices that are * selfadjoint and positive definite. The factorization allows for solving A.X = B where * X and B can be either dense or sparse. * * In order to reduce the fill-in, a symmetric permutation P is applied prior to the factorization * such that the factorized matrix is P A P^-1. * * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> * \tparam UpLo_ the triangular part that will be used for the computations. It can be Lower * or Upper. Default is Lower. * \tparam Ordering_ The ordering method to use, either AMDOrdering<> or NaturalOrdering<>. Default is AMDOrdering<> * * \implsparsesolverconcept * * \sa class SimplicialLDLT, class AMDOrdering, class NaturalOrdering */ template class SimplicialLLT : public SimplicialCholeskyBase > { public: typedef MatrixType_ MatrixType; enum { UpLo = UpLo_ }; typedef SimplicialCholeskyBase Base; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef typename MatrixType::StorageIndex StorageIndex; typedef SparseMatrix CholMatrixType; typedef Matrix VectorType; typedef internal::traits Traits; typedef typename Traits::MatrixL MatrixL; typedef typename Traits::MatrixU MatrixU; public: /** Default constructor */ SimplicialLLT() : Base() {} /** Constructs and performs the LLT factorization of \a matrix */ explicit SimplicialLLT(const MatrixType& matrix) : Base(matrix) {} /** \returns an expression of the factor L */ inline const MatrixL matrixL() const { eigen_assert(Base::m_factorizationIsOk && "Simplicial LLT not factorized"); return Traits::getL(Base::m_matrix); } /** \returns an expression of the factor U (= L^*) */ inline const MatrixU matrixU() const { eigen_assert(Base::m_factorizationIsOk && "Simplicial LLT not factorized"); return Traits::getU(Base::m_matrix); } /** Computes the sparse Cholesky decomposition of \a matrix */ SimplicialLLT& compute(const MatrixType& matrix) { Base::template compute(matrix); return *this; } /** Performs a symbolic decomposition on the sparcity of \a matrix. * * This function is particularly useful when solving for several problems having the same structure. * * \sa factorize() */ void analyzePattern(const MatrixType& a) { Base::analyzePattern(a, false); } /** Performs a numeric decomposition of \a matrix * * The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed. * * \sa analyzePattern() */ void factorize(const MatrixType& a) { Base::template factorize(a); } /** \returns the determinant of the underlying matrix from the current factorization */ Scalar determinant() const { Scalar detL = Base::m_matrix.diagonal().prod(); return numext::abs2(detL); } }; /** \ingroup SparseCholesky_Module * \class SimplicialLDLT * \brief A direct sparse LDLT Cholesky factorizations without square root. * * This class provides a LDL^T Cholesky factorizations without square root of sparse matrices that are * selfadjoint and positive definite. The factorization allows for solving A.X = B where * X and B can be either dense or sparse. * * In order to reduce the fill-in, a symmetric permutation P is applied prior to the factorization * such that the factorized matrix is P A P^-1. * * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> * \tparam UpLo_ the triangular part that will be used for the computations. It can be Lower * or Upper. Default is Lower. * \tparam Ordering_ The ordering method to use, either AMDOrdering<> or NaturalOrdering<>. Default is AMDOrdering<> * * \implsparsesolverconcept * * \sa class SimplicialLLT, class AMDOrdering, class NaturalOrdering */ template class SimplicialLDLT : public SimplicialCholeskyBase > { public: typedef MatrixType_ MatrixType; enum { UpLo = UpLo_ }; typedef SimplicialCholeskyBase Base; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef typename MatrixType::StorageIndex StorageIndex; typedef SparseMatrix CholMatrixType; typedef Matrix VectorType; typedef internal::traits Traits; typedef typename Traits::MatrixL MatrixL; typedef typename Traits::MatrixU MatrixU; public: /** Default constructor */ SimplicialLDLT() : Base() {} /** Constructs and performs the LLT factorization of \a matrix */ explicit SimplicialLDLT(const MatrixType& matrix) : Base(matrix) {} /** \returns a vector expression of the diagonal D */ inline const VectorType vectorD() const { eigen_assert(Base::m_factorizationIsOk && "Simplicial LDLT not factorized"); return Base::m_diag; } /** \returns an expression of the factor L */ inline const MatrixL matrixL() const { eigen_assert(Base::m_factorizationIsOk && "Simplicial LDLT not factorized"); return Traits::getL(Base::m_matrix); } /** \returns an expression of the factor U (= L^*) */ inline const MatrixU matrixU() const { eigen_assert(Base::m_factorizationIsOk && "Simplicial LDLT not factorized"); return Traits::getU(Base::m_matrix); } /** Computes the sparse Cholesky decomposition of \a matrix */ SimplicialLDLT& compute(const MatrixType& matrix) { Base::template compute(matrix); return *this; } /** Performs a symbolic decomposition on the sparcity of \a matrix. * * This function is particularly useful when solving for several problems having the same structure. * * \sa factorize() */ void analyzePattern(const MatrixType& a) { Base::analyzePattern(a, true); } /** Performs a numeric decomposition of \a matrix * * The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed. * * \sa analyzePattern() */ void factorize(const MatrixType& a) { Base::template factorize(a); } /** \returns the determinant of the underlying matrix from the current factorization */ Scalar determinant() const { return Base::m_diag.prod(); } }; /** \deprecated use SimplicialLDLT or class SimplicialLLT * \ingroup SparseCholesky_Module * \class SimplicialCholesky * * \sa class SimplicialLDLT, class SimplicialLLT */ template class SimplicialCholesky : public SimplicialCholeskyBase > { public: typedef MatrixType_ MatrixType; enum { UpLo = UpLo_ }; typedef SimplicialCholeskyBase Base; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef typename MatrixType::StorageIndex StorageIndex; typedef SparseMatrix CholMatrixType; typedef Matrix VectorType; typedef internal::traits Traits; typedef internal::traits > LDLTTraits; typedef internal::traits > LLTTraits; public: SimplicialCholesky() : Base(), m_LDLT(true) {} explicit SimplicialCholesky(const MatrixType& matrix) : Base(), m_LDLT(true) { compute(matrix); } SimplicialCholesky& setMode(SimplicialCholeskyMode mode) { switch(mode) { case SimplicialCholeskyLLT: m_LDLT = false; break; case SimplicialCholeskyLDLT: m_LDLT = true; break; default: break; } return *this; } inline const VectorType vectorD() const { eigen_assert(Base::m_factorizationIsOk && "Simplicial Cholesky not factorized"); return Base::m_diag; } inline const CholMatrixType rawMatrix() const { eigen_assert(Base::m_factorizationIsOk && "Simplicial Cholesky not factorized"); return Base::m_matrix; } /** Computes the sparse Cholesky decomposition of \a matrix */ SimplicialCholesky& compute(const MatrixType& matrix) { if(m_LDLT) Base::template compute(matrix); else Base::template compute(matrix); return *this; } /** Performs a symbolic decomposition on the sparcity of \a matrix. * * This function is particularly useful when solving for several problems having the same structure. * * \sa factorize() */ void analyzePattern(const MatrixType& a) { Base::analyzePattern(a, m_LDLT); } /** Performs a numeric decomposition of \a matrix * * The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed. * * \sa analyzePattern() */ void factorize(const MatrixType& a) { if(m_LDLT) Base::template factorize(a); else Base::template factorize(a); } /** \internal */ template void _solve_impl(const MatrixBase &b, MatrixBase &dest) const { eigen_assert(Base::m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()"); eigen_assert(Base::m_matrix.rows()==b.rows()); if(Base::m_info!=Success) return; if(Base::m_P.size()>0) dest = Base::m_P * b; else dest = b; if(Base::m_matrix.nonZeros()>0) // otherwise L==I { if(m_LDLT) LDLTTraits::getL(Base::m_matrix).solveInPlace(dest); else LLTTraits::getL(Base::m_matrix).solveInPlace(dest); } if(Base::m_diag.size()>0) dest = Base::m_diag.real().asDiagonal().inverse() * dest; if (Base::m_matrix.nonZeros()>0) // otherwise I==I { if(m_LDLT) LDLTTraits::getU(Base::m_matrix).solveInPlace(dest); else LLTTraits::getU(Base::m_matrix).solveInPlace(dest); } if(Base::m_P.size()>0) dest = Base::m_Pinv * dest; } /** \internal */ template void _solve_impl(const SparseMatrixBase &b, SparseMatrixBase &dest) const { internal::solve_sparse_through_dense_panels(*this, b, dest); } Scalar determinant() const { if(m_LDLT) { return Base::m_diag.prod(); } else { Scalar detL = Diagonal(Base::m_matrix).prod(); return numext::abs2(detL); } } protected: bool m_LDLT; }; template void SimplicialCholeskyBase::ordering(const MatrixType& a, ConstCholMatrixPtr &pmat, CholMatrixType& ap) { eigen_assert(a.rows()==a.cols()); const Index size = a.rows(); pmat = ≈ // Note that ordering methods compute the inverse permutation if(!internal::is_same >::value) { { CholMatrixType C; C = a.template selfadjointView(); OrderingType ordering; ordering(C,m_Pinv); } if(m_Pinv.size()>0) m_P = m_Pinv.inverse(); else m_P.resize(0); ap.resize(size,size); ap.template selfadjointView() = a.template selfadjointView().twistedBy(m_P); } else { m_Pinv.resize(0); m_P.resize(0); if(int(UpLo)==int(Lower) || MatrixType::IsRowMajor) { // we have to transpose the lower part to to the upper one ap.resize(size,size); ap.template selfadjointView() = a.template selfadjointView(); } else internal::simplicial_cholesky_grab_input::run(a, pmat, ap); } } } // end namespace Eigen #endif // EIGEN_SIMPLICIAL_CHOLESKY_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2012 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. /* NOTE: these functions have been adapted from the LDL library: LDL Copyright (c) 2005 by Timothy A. Davis. All Rights Reserved. The author of LDL, Timothy A. Davis., has executed a license with Google LLC to permit distribution of this code and derivative works as part of Eigen under the Mozilla Public License v. 2.0, as stated at the top of this file. */ #ifndef EIGEN_SIMPLICIAL_CHOLESKY_IMPL_H #define EIGEN_SIMPLICIAL_CHOLESKY_IMPL_H namespace Eigen { template void SimplicialCholeskyBase::analyzePattern_preordered(const CholMatrixType& ap, bool doLDLT) { const StorageIndex size = StorageIndex(ap.rows()); m_matrix.resize(size, size); m_parent.resize(size); m_nonZerosPerCol.resize(size); ei_declare_aligned_stack_constructed_variable(StorageIndex, tags, size, 0); for(StorageIndex k = 0; k < size; ++k) { /* L(k,:) pattern: all nodes reachable in etree from nz in A(0:k-1,k) */ m_parent[k] = -1; /* parent of k is not yet known */ tags[k] = k; /* mark node k as visited */ m_nonZerosPerCol[k] = 0; /* count of nonzeros in column k of L */ for(typename CholMatrixType::InnerIterator it(ap,k); it; ++it) { StorageIndex i = it.index(); if(i < k) { /* follow path from i to root of etree, stop at flagged node */ for(; tags[i] != k; i = m_parent[i]) { /* find parent of i if not yet determined */ if (m_parent[i] == -1) m_parent[i] = k; m_nonZerosPerCol[i]++; /* L (k,i) is nonzero */ tags[i] = k; /* mark i as visited */ } } } } /* construct Lp index array from m_nonZerosPerCol column counts */ StorageIndex* Lp = m_matrix.outerIndexPtr(); Lp[0] = 0; for(StorageIndex k = 0; k < size; ++k) Lp[k+1] = Lp[k] + m_nonZerosPerCol[k] + (doLDLT ? 0 : 1); m_matrix.resizeNonZeros(Lp[size]); m_isInitialized = true; m_info = Success; m_analysisIsOk = true; m_factorizationIsOk = false; } template template void SimplicialCholeskyBase::factorize_preordered(const CholMatrixType& ap) { using std::sqrt; eigen_assert(m_analysisIsOk && "You must first call analyzePattern()"); eigen_assert(ap.rows()==ap.cols()); eigen_assert(m_parent.size()==ap.rows()); eigen_assert(m_nonZerosPerCol.size()==ap.rows()); const StorageIndex size = StorageIndex(ap.rows()); const StorageIndex* Lp = m_matrix.outerIndexPtr(); StorageIndex* Li = m_matrix.innerIndexPtr(); Scalar* Lx = m_matrix.valuePtr(); ei_declare_aligned_stack_constructed_variable(Scalar, y, size, 0); ei_declare_aligned_stack_constructed_variable(StorageIndex, pattern, size, 0); ei_declare_aligned_stack_constructed_variable(StorageIndex, tags, size, 0); bool ok = true; m_diag.resize(DoLDLT ? size : 0); for(StorageIndex k = 0; k < size; ++k) { // compute nonzero pattern of kth row of L, in topological order y[k] = Scalar(0); // Y(0:k) is now all zero StorageIndex top = size; // stack for pattern is empty tags[k] = k; // mark node k as visited m_nonZerosPerCol[k] = 0; // count of nonzeros in column k of L for(typename CholMatrixType::InnerIterator it(ap,k); it; ++it) { StorageIndex i = it.index(); if(i <= k) { y[i] += numext::conj(it.value()); /* scatter A(i,k) into Y (sum duplicates) */ Index len; for(len = 0; tags[i] != k; i = m_parent[i]) { pattern[len++] = i; /* L(k,i) is nonzero */ tags[i] = k; /* mark i as visited */ } while(len > 0) pattern[--top] = pattern[--len]; } } /* compute numerical values kth row of L (a sparse triangular solve) */ RealScalar d = numext::real(y[k]) * m_shiftScale + m_shiftOffset; // get D(k,k), apply the shift function, and clear Y(k) y[k] = Scalar(0); for(; top < size; ++top) { Index i = pattern[top]; /* pattern[top:n-1] is pattern of L(:,k) */ Scalar yi = y[i]; /* get and clear Y(i) */ y[i] = Scalar(0); /* the nonzero entry L(k,i) */ Scalar l_ki; if(DoLDLT) l_ki = yi / numext::real(m_diag[i]); else yi = l_ki = yi / Lx[Lp[i]]; Index p2 = Lp[i] + m_nonZerosPerCol[i]; Index p; for(p = Lp[i] + (DoLDLT ? 0 : 1); p < p2; ++p) y[Li[p]] -= numext::conj(Lx[p]) * yi; d -= numext::real(l_ki * numext::conj(yi)); Li[p] = k; /* store L(k,i) in column form of L */ Lx[p] = l_ki; ++m_nonZerosPerCol[i]; /* increment count of nonzeros in col i */ } if(DoLDLT) { m_diag[k] = d; if(d == RealScalar(0)) { ok = false; /* failure, D(k,k) is zero */ break; } } else { Index p = Lp[k] + m_nonZerosPerCol[k]++; Li[p] = k ; /* store L(k,k) = sqrt (d) in column k */ if(d <= RealScalar(0)) { ok = false; /* failure, matrix is not positive definite */ break; } Lx[p] = sqrt(d) ; } } m_info = ok ? Success : NumericalIssue; m_factorizationIsOk = true; } } // end namespace Eigen #endif // EIGEN_SIMPLICIAL_CHOLESKY_IMPL_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/AmbiVector.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_AMBIVECTOR_H #define EIGEN_AMBIVECTOR_H namespace Eigen { namespace internal { /** \internal * Hybrid sparse/dense vector class designed for intensive read-write operations. * * See BasicSparseLLT and SparseProduct for usage examples. */ template class AmbiVector { public: typedef Scalar_ Scalar; typedef StorageIndex_ StorageIndex; typedef typename NumTraits::Real RealScalar; explicit AmbiVector(Index size) : m_buffer(0), m_zero(0), m_size(0), m_end(0), m_allocatedSize(0), m_allocatedElements(0), m_mode(-1) { resize(size); } void init(double estimatedDensity); void init(int mode); Index nonZeros() const; /** Specifies a sub-vector to work on */ void setBounds(Index start, Index end) { m_start = convert_index(start); m_end = convert_index(end); } void setZero(); void restart(); Scalar& coeffRef(Index i); Scalar& coeff(Index i); class Iterator; ~AmbiVector() { delete[] m_buffer; } void resize(Index size) { if (m_allocatedSize < size) reallocate(size); m_size = convert_index(size); } StorageIndex size() const { return m_size; } protected: StorageIndex convert_index(Index idx) { return internal::convert_index(idx); } void reallocate(Index size) { // if the size of the matrix is not too large, let's allocate a bit more than needed such // that we can handle dense vector even in sparse mode. delete[] m_buffer; if (size<1000) { Index allocSize = (size * sizeof(ListEl) + sizeof(Scalar) - 1)/sizeof(Scalar); m_allocatedElements = convert_index((allocSize*sizeof(Scalar))/sizeof(ListEl)); m_buffer = new Scalar[allocSize]; } else { m_allocatedElements = convert_index((size*sizeof(Scalar))/sizeof(ListEl)); m_buffer = new Scalar[size]; } m_size = convert_index(size); m_start = 0; m_end = m_size; } void reallocateSparse() { Index copyElements = m_allocatedElements; m_allocatedElements = (std::min)(StorageIndex(m_allocatedElements*1.5),m_size); Index allocSize = m_allocatedElements * sizeof(ListEl); allocSize = (allocSize + sizeof(Scalar) - 1)/sizeof(Scalar); Scalar* newBuffer = new Scalar[allocSize]; std::memcpy(newBuffer, m_buffer, copyElements * sizeof(ListEl)); delete[] m_buffer; m_buffer = newBuffer; } protected: // element type of the linked list struct ListEl { StorageIndex next; StorageIndex index; Scalar value; }; // used to store data in both mode Scalar* m_buffer; Scalar m_zero; StorageIndex m_size; StorageIndex m_start; StorageIndex m_end; StorageIndex m_allocatedSize; StorageIndex m_allocatedElements; StorageIndex m_mode; // linked list mode StorageIndex m_llStart; StorageIndex m_llCurrent; StorageIndex m_llSize; }; /** \returns the number of non zeros in the current sub vector */ template Index AmbiVector::nonZeros() const { if (m_mode==IsSparse) return m_llSize; else return m_end - m_start; } template void AmbiVector::init(double estimatedDensity) { if (estimatedDensity>0.1) init(IsDense); else init(IsSparse); } template void AmbiVector::init(int mode) { m_mode = mode; // This is only necessary in sparse mode, but we set these unconditionally to avoid some maybe-uninitialized warnings // if (m_mode==IsSparse) { m_llSize = 0; m_llStart = -1; } } /** Must be called whenever we might perform a write access * with an index smaller than the previous one. * * Don't worry, this function is extremely cheap. */ template void AmbiVector::restart() { m_llCurrent = m_llStart; } /** Set all coefficients of current subvector to zero */ template void AmbiVector::setZero() { if (m_mode==IsDense) { for (Index i=m_start; i Scalar_& AmbiVector::coeffRef(Index i) { if (m_mode==IsDense) return m_buffer[i]; else { ListEl* EIGEN_RESTRICT llElements = reinterpret_cast(m_buffer); // TODO factorize the following code to reduce code generation eigen_assert(m_mode==IsSparse); if (m_llSize==0) { // this is the first element m_llStart = 0; m_llCurrent = 0; ++m_llSize; llElements[0].value = Scalar(0); llElements[0].index = convert_index(i); llElements[0].next = -1; return llElements[0].value; } else if (i=llElements[m_llCurrent].index && "you must call restart() before inserting an element with lower or equal index"); while (nextel >= 0 && llElements[nextel].index<=i) { m_llCurrent = nextel; nextel = llElements[nextel].next; } if (llElements[m_llCurrent].index==i) { // the coefficient already exists and we found it ! return llElements[m_llCurrent].value; } else { if (m_llSize>=m_allocatedElements) { reallocateSparse(); llElements = reinterpret_cast(m_buffer); } eigen_internal_assert(m_llSize Scalar_& AmbiVector::coeff(Index i) { if (m_mode==IsDense) return m_buffer[i]; else { ListEl* EIGEN_RESTRICT llElements = reinterpret_cast(m_buffer); eigen_assert(m_mode==IsSparse); if ((m_llSize==0) || (i= 0 && llElements[elid].index class AmbiVector::Iterator { public: typedef Scalar_ Scalar; typedef typename NumTraits::Real RealScalar; /** Default constructor * \param vec the vector on which we iterate * \param epsilon the minimal value used to prune zero coefficients. * In practice, all coefficients having a magnitude smaller than \a epsilon * are skipped. */ explicit Iterator(const AmbiVector& vec, const RealScalar& epsilon = 0) : m_vector(vec) { using std::abs; m_epsilon = epsilon; m_isDense = m_vector.m_mode==IsDense; if (m_isDense) { m_currentEl = 0; // this is to avoid a compilation warning m_cachedValue = 0; // this is to avoid a compilation warning m_cachedIndex = m_vector.m_start-1; ++(*this); } else { ListEl* EIGEN_RESTRICT llElements = reinterpret_cast(m_vector.m_buffer); m_currentEl = m_vector.m_llStart; while (m_currentEl>=0 && abs(llElements[m_currentEl].value)<=m_epsilon) m_currentEl = llElements[m_currentEl].next; if (m_currentEl<0) { m_cachedValue = 0; // this is to avoid a compilation warning m_cachedIndex = -1; } else { m_cachedIndex = llElements[m_currentEl].index; m_cachedValue = llElements[m_currentEl].value; } } } StorageIndex index() const { return m_cachedIndex; } Scalar value() const { return m_cachedValue; } operator bool() const { return m_cachedIndex>=0; } Iterator& operator++() { using std::abs; if (m_isDense) { do { ++m_cachedIndex; } while (m_cachedIndex(m_vector.m_buffer); do { m_currentEl = llElements[m_currentEl].next; } while (m_currentEl>=0 && abs(llElements[m_currentEl].value)<=m_epsilon); if (m_currentEl<0) { m_cachedIndex = -1; } else { m_cachedIndex = llElements[m_currentEl].index; m_cachedValue = llElements[m_currentEl].value; } } return *this; } protected: const AmbiVector& m_vector; // the target vector StorageIndex m_currentEl; // the current element in sparse/linked-list mode RealScalar m_epsilon; // epsilon used to prune zero coefficients StorageIndex m_cachedIndex; // current coordinate Scalar m_cachedValue; // current value bool m_isDense; // mode of the vector }; } // end namespace internal } // end namespace Eigen #endif // EIGEN_AMBIVECTOR_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/CompressedStorage.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_COMPRESSED_STORAGE_H #define EIGEN_COMPRESSED_STORAGE_H namespace Eigen { namespace internal { /** \internal * Stores a sparse set of values as a list of values and a list of indices. * */ template class CompressedStorage { public: typedef Scalar_ Scalar; typedef StorageIndex_ StorageIndex; protected: typedef typename NumTraits::Real RealScalar; public: CompressedStorage() : m_values(0), m_indices(0), m_size(0), m_allocatedSize(0) {} explicit CompressedStorage(Index size) : m_values(0), m_indices(0), m_size(0), m_allocatedSize(0) { resize(size); } CompressedStorage(const CompressedStorage& other) : m_values(0), m_indices(0), m_size(0), m_allocatedSize(0) { *this = other; } CompressedStorage& operator=(const CompressedStorage& other) { resize(other.size()); if(other.size()>0) { internal::smart_copy(other.m_values, other.m_values + m_size, m_values); internal::smart_copy(other.m_indices, other.m_indices + m_size, m_indices); } return *this; } void swap(CompressedStorage& other) { std::swap(m_values, other.m_values); std::swap(m_indices, other.m_indices); std::swap(m_size, other.m_size); std::swap(m_allocatedSize, other.m_allocatedSize); } ~CompressedStorage() { delete[] m_values; delete[] m_indices; } void reserve(Index size) { Index newAllocatedSize = m_size + size; if (newAllocatedSize > m_allocatedSize) reallocate(newAllocatedSize); } void squeeze() { if (m_allocatedSize>m_size) reallocate(m_size); } void resize(Index size, double reserveSizeFactor = 0) { if (m_allocatedSize)(NumTraits::highest(), size + Index(reserveSizeFactor*double(size))); if(realloc_size(i); } inline Index size() const { return m_size; } inline Index allocatedSize() const { return m_allocatedSize; } inline void clear() { m_size = 0; } const Scalar* valuePtr() const { return m_values; } Scalar* valuePtr() { return m_values; } const StorageIndex* indexPtr() const { return m_indices; } StorageIndex* indexPtr() { return m_indices; } inline Scalar& value(Index i) { eigen_internal_assert(m_values!=0); return m_values[i]; } inline const Scalar& value(Index i) const { eigen_internal_assert(m_values!=0); return m_values[i]; } inline StorageIndex& index(Index i) { eigen_internal_assert(m_indices!=0); return m_indices[i]; } inline const StorageIndex& index(Index i) const { eigen_internal_assert(m_indices!=0); return m_indices[i]; } /** \returns the largest \c k such that for all \c j in [0,k) index[\c j]\<\a key */ inline Index searchLowerIndex(Index key) const { return searchLowerIndex(0, m_size, key); } /** \returns the largest \c k in [start,end) such that for all \c j in [start,k) index[\c j]\<\a key */ inline Index searchLowerIndex(Index start, Index end, Index key) const { while(end>start) { Index mid = (end+start)>>1; if (m_indices[mid]=end) return defaultValue; else if (end>start && key==m_indices[end-1]) return m_values[end-1]; // ^^ optimization: let's first check if it is the last coefficient // (very common in high level algorithms) const Index id = searchLowerIndex(start,end-1,key); return ((id=m_size || m_indices[id]!=key) { if (m_allocatedSize newValues(m_allocatedSize); internal::scoped_array newIndices(m_allocatedSize); // copy first chunk internal::smart_copy(m_values, m_values +id, newValues.ptr()); internal::smart_copy(m_indices, m_indices+id, newIndices.ptr()); // copy the rest if(m_size>id) { internal::smart_copy(m_values +id, m_values +m_size, newValues.ptr() +id+1); internal::smart_copy(m_indices+id, m_indices+m_size, newIndices.ptr()+id+1); } std::swap(m_values,newValues.ptr()); std::swap(m_indices,newIndices.ptr()); } else if(m_size>id) { internal::smart_memmove(m_values +id, m_values +m_size, m_values +id+1); internal::smart_memmove(m_indices+id, m_indices+m_size, m_indices+id+1); } m_size++; m_indices[id] = internal::convert_index(key); m_values[id] = defaultValue; } return m_values[id]; } void moveChunk(Index from, Index to, Index chunkSize) { eigen_internal_assert(to+chunkSize <= m_size); if(to>from && from+chunkSize>to) { // move backward internal::smart_memmove(m_values+from, m_values+from+chunkSize, m_values+to); internal::smart_memmove(m_indices+from, m_indices+from+chunkSize, m_indices+to); } else { internal::smart_copy(m_values+from, m_values+from+chunkSize, m_values+to); internal::smart_copy(m_indices+from, m_indices+from+chunkSize, m_indices+to); } } void prune(const Scalar& reference, const RealScalar& epsilon = NumTraits::dummy_precision()) { Index k = 0; Index n = size(); for (Index i=0; i newValues(size); internal::scoped_array newIndices(size); Index copySize = (std::min)(size, m_size); if (copySize>0) { internal::smart_copy(m_values, m_values+copySize, newValues.ptr()); internal::smart_copy(m_indices, m_indices+copySize, newIndices.ptr()); } std::swap(m_values,newValues.ptr()); std::swap(m_indices,newIndices.ptr()); m_allocatedSize = size; } protected: Scalar* m_values; StorageIndex* m_indices; Index m_size; Index m_allocatedSize; }; } // end namespace internal } // end namespace Eigen #endif // EIGEN_COMPRESSED_STORAGE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2015 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_CONSERVATIVESPARSESPARSEPRODUCT_H #define EIGEN_CONSERVATIVESPARSESPARSEPRODUCT_H namespace Eigen { namespace internal { template static void conservative_sparse_sparse_product_impl(const Lhs& lhs, const Rhs& rhs, ResultType& res, bool sortedInsertion = false) { typedef typename remove_all::type::Scalar LhsScalar; typedef typename remove_all::type::Scalar RhsScalar; typedef typename remove_all::type::Scalar ResScalar; // make sure to call innerSize/outerSize since we fake the storage order. Index rows = lhs.innerSize(); Index cols = rhs.outerSize(); eigen_assert(lhs.outerSize() == rhs.innerSize()); ei_declare_aligned_stack_constructed_variable(bool, mask, rows, 0); ei_declare_aligned_stack_constructed_variable(ResScalar, values, rows, 0); ei_declare_aligned_stack_constructed_variable(Index, indices, rows, 0); std::memset(mask,0,sizeof(bool)*rows); evaluator lhsEval(lhs); evaluator rhsEval(rhs); // estimate the number of non zero entries // given a rhs column containing Y non zeros, we assume that the respective Y columns // of the lhs differs in average of one non zeros, thus the number of non zeros for // the product of a rhs column with the lhs is X+Y where X is the average number of non zero // per column of the lhs. // Therefore, we have nnz(lhs*rhs) = nnz(lhs) + nnz(rhs) Index estimated_nnz_prod = lhsEval.nonZerosEstimate() + rhsEval.nonZerosEstimate(); res.setZero(); res.reserve(Index(estimated_nnz_prod)); // we compute each column of the result, one after the other for (Index j=0; j::InnerIterator rhsIt(rhsEval, j); rhsIt; ++rhsIt) { RhsScalar y = rhsIt.value(); Index k = rhsIt.index(); for (typename evaluator::InnerIterator lhsIt(lhsEval, k); lhsIt; ++lhsIt) { Index i = lhsIt.index(); LhsScalar x = lhsIt.value(); if(!mask[i]) { mask[i] = true; values[i] = x * y; indices[nnz] = i; ++nnz; } else values[i] += x * y; } } if(!sortedInsertion) { // unordered insertion for(Index k=0; k use a quick sort // otherwise => loop through the entire vector // In order to avoid to perform an expensive log2 when the // result is clearly very sparse we use a linear bound up to 200. if((nnz<200 && nnz1) std::sort(indices,indices+nnz); for(Index k=0; k::Flags&RowMajorBit) ? RowMajor : ColMajor, int RhsStorageOrder = (traits::Flags&RowMajorBit) ? RowMajor : ColMajor, int ResStorageOrder = (traits::Flags&RowMajorBit) ? RowMajor : ColMajor> struct conservative_sparse_sparse_product_selector; template struct conservative_sparse_sparse_product_selector { typedef typename remove_all::type LhsCleaned; typedef typename LhsCleaned::Scalar Scalar; static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res) { typedef SparseMatrix RowMajorMatrix; typedef SparseMatrix ColMajorMatrixAux; typedef typename sparse_eval::type ColMajorMatrix; // If the result is tall and thin (in the extreme case a column vector) // then it is faster to sort the coefficients inplace instead of transposing twice. // FIXME, the following heuristic is probably not very good. if(lhs.rows()>rhs.cols()) { ColMajorMatrix resCol(lhs.rows(),rhs.cols()); // perform sorted insertion internal::conservative_sparse_sparse_product_impl(lhs, rhs, resCol, true); res = resCol.markAsRValue(); } else { ColMajorMatrixAux resCol(lhs.rows(),rhs.cols()); // resort to transpose to sort the entries internal::conservative_sparse_sparse_product_impl(lhs, rhs, resCol, false); RowMajorMatrix resRow(resCol); res = resRow.markAsRValue(); } } }; template struct conservative_sparse_sparse_product_selector { static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res) { typedef SparseMatrix RowMajorRhs; typedef SparseMatrix RowMajorRes; RowMajorRhs rhsRow = rhs; RowMajorRes resRow(lhs.rows(), rhs.cols()); internal::conservative_sparse_sparse_product_impl(rhsRow, lhs, resRow); res = resRow; } }; template struct conservative_sparse_sparse_product_selector { static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res) { typedef SparseMatrix RowMajorLhs; typedef SparseMatrix RowMajorRes; RowMajorLhs lhsRow = lhs; RowMajorRes resRow(lhs.rows(), rhs.cols()); internal::conservative_sparse_sparse_product_impl(rhs, lhsRow, resRow); res = resRow; } }; template struct conservative_sparse_sparse_product_selector { static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res) { typedef SparseMatrix RowMajorMatrix; RowMajorMatrix resRow(lhs.rows(), rhs.cols()); internal::conservative_sparse_sparse_product_impl(rhs, lhs, resRow); res = resRow; } }; template struct conservative_sparse_sparse_product_selector { typedef typename traits::type>::Scalar Scalar; static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res) { typedef SparseMatrix ColMajorMatrix; ColMajorMatrix resCol(lhs.rows(), rhs.cols()); internal::conservative_sparse_sparse_product_impl(lhs, rhs, resCol); res = resCol; } }; template struct conservative_sparse_sparse_product_selector { static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res) { typedef SparseMatrix ColMajorLhs; typedef SparseMatrix ColMajorRes; ColMajorLhs lhsCol = lhs; ColMajorRes resCol(lhs.rows(), rhs.cols()); internal::conservative_sparse_sparse_product_impl(lhsCol, rhs, resCol); res = resCol; } }; template struct conservative_sparse_sparse_product_selector { static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res) { typedef SparseMatrix ColMajorRhs; typedef SparseMatrix ColMajorRes; ColMajorRhs rhsCol = rhs; ColMajorRes resCol(lhs.rows(), rhs.cols()); internal::conservative_sparse_sparse_product_impl(lhs, rhsCol, resCol); res = resCol; } }; template struct conservative_sparse_sparse_product_selector { static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res) { typedef SparseMatrix RowMajorMatrix; typedef SparseMatrix ColMajorMatrix; RowMajorMatrix resRow(lhs.rows(),rhs.cols()); internal::conservative_sparse_sparse_product_impl(rhs, lhs, resRow); // sort the non zeros: ColMajorMatrix resCol(resRow); res = resCol; } }; } // end namespace internal namespace internal { template static void sparse_sparse_to_dense_product_impl(const Lhs& lhs, const Rhs& rhs, ResultType& res) { typedef typename remove_all::type::Scalar LhsScalar; typedef typename remove_all::type::Scalar RhsScalar; Index cols = rhs.outerSize(); eigen_assert(lhs.outerSize() == rhs.innerSize()); evaluator lhsEval(lhs); evaluator rhsEval(rhs); for (Index j=0; j::InnerIterator rhsIt(rhsEval, j); rhsIt; ++rhsIt) { RhsScalar y = rhsIt.value(); Index k = rhsIt.index(); for (typename evaluator::InnerIterator lhsIt(lhsEval, k); lhsIt; ++lhsIt) { Index i = lhsIt.index(); LhsScalar x = lhsIt.value(); res.coeffRef(i,j) += x * y; } } } } } // end namespace internal namespace internal { template::Flags&RowMajorBit) ? RowMajor : ColMajor, int RhsStorageOrder = (traits::Flags&RowMajorBit) ? RowMajor : ColMajor> struct sparse_sparse_to_dense_product_selector; template struct sparse_sparse_to_dense_product_selector { static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res) { internal::sparse_sparse_to_dense_product_impl(lhs, rhs, res); } }; template struct sparse_sparse_to_dense_product_selector { static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res) { typedef SparseMatrix ColMajorLhs; ColMajorLhs lhsCol(lhs); internal::sparse_sparse_to_dense_product_impl(lhsCol, rhs, res); } }; template struct sparse_sparse_to_dense_product_selector { static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res) { typedef SparseMatrix ColMajorRhs; ColMajorRhs rhsCol(rhs); internal::sparse_sparse_to_dense_product_impl(lhs, rhsCol, res); } }; template struct sparse_sparse_to_dense_product_selector { static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res) { Transpose trRes(res); internal::sparse_sparse_to_dense_product_impl >(rhs, lhs, trRes); } }; } // end namespace internal } // end namespace Eigen #endif // EIGEN_CONSERVATIVESPARSESPARSEPRODUCT_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/MappedSparseMatrix.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_MAPPED_SPARSEMATRIX_H #define EIGEN_MAPPED_SPARSEMATRIX_H namespace Eigen { /** \deprecated Use Map > * \class MappedSparseMatrix * * \brief Sparse matrix * * \param Scalar_ the scalar type, i.e. the type of the coefficients * * See http://www.netlib.org/linalg/html_templates/node91.html for details on the storage scheme. * */ namespace internal { template struct traits > : traits > {}; } // end namespace internal template class MappedSparseMatrix : public Map > { typedef Map > Base; public: typedef typename Base::StorageIndex StorageIndex; typedef typename Base::Scalar Scalar; inline MappedSparseMatrix(Index rows, Index cols, Index nnz, StorageIndex* outerIndexPtr, StorageIndex* innerIndexPtr, Scalar* valuePtr, StorageIndex* innerNonZeroPtr = 0) : Base(rows, cols, nnz, outerIndexPtr, innerIndexPtr, valuePtr, innerNonZeroPtr) {} /** Empty destructor */ inline ~MappedSparseMatrix() {} }; namespace internal { template struct evaluator > : evaluator > > { typedef MappedSparseMatrix XprType; typedef evaluator > Base; evaluator() : Base() {} explicit evaluator(const XprType &mat) : Base(mat) {} }; } } // end namespace Eigen #endif // EIGEN_MAPPED_SPARSEMATRIX_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseAssign.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSEASSIGN_H #define EIGEN_SPARSEASSIGN_H namespace Eigen { template template Derived& SparseMatrixBase::operator=(const EigenBase &other) { internal::call_assignment_no_alias(derived(), other.derived()); return derived(); } template template Derived& SparseMatrixBase::operator=(const ReturnByValue& other) { // TODO use the evaluator mechanism other.evalTo(derived()); return derived(); } template template inline Derived& SparseMatrixBase::operator=(const SparseMatrixBase& other) { // by default sparse evaluation do not alias, so we can safely bypass the generic call_assignment routine internal::Assignment > ::run(derived(), other.derived(), internal::assign_op()); return derived(); } template inline Derived& SparseMatrixBase::operator=(const Derived& other) { internal::call_assignment_no_alias(derived(), other.derived()); return derived(); } namespace internal { template<> struct storage_kind_to_evaluator_kind { typedef IteratorBased Kind; }; template<> struct storage_kind_to_shape { typedef SparseShape Shape; }; struct Sparse2Sparse {}; struct Sparse2Dense {}; template<> struct AssignmentKind { typedef Sparse2Sparse Kind; }; template<> struct AssignmentKind { typedef Sparse2Sparse Kind; }; template<> struct AssignmentKind { typedef Sparse2Dense Kind; }; template<> struct AssignmentKind { typedef Sparse2Dense Kind; }; template void assign_sparse_to_sparse(DstXprType &dst, const SrcXprType &src) { typedef typename DstXprType::Scalar Scalar; typedef internal::evaluator DstEvaluatorType; typedef internal::evaluator SrcEvaluatorType; SrcEvaluatorType srcEvaluator(src); const bool transpose = (DstEvaluatorType::Flags & RowMajorBit) != (SrcEvaluatorType::Flags & RowMajorBit); const Index outerEvaluationSize = (SrcEvaluatorType::Flags&RowMajorBit) ? src.rows() : src.cols(); if ((!transpose) && src.isRValue()) { // eval without temporary dst.resize(src.rows(), src.cols()); dst.setZero(); dst.reserve((std::min)(src.rows()*src.cols(), (std::max)(src.rows(),src.cols())*2)); for (Index j=0; j::SupportedAccessPatterns & OuterRandomAccessPattern)==OuterRandomAccessPattern) || (!((DstEvaluatorType::Flags & RowMajorBit) != (SrcEvaluatorType::Flags & RowMajorBit)))) && "the transpose operation is supposed to be handled in SparseMatrix::operator="); enum { Flip = (DstEvaluatorType::Flags & RowMajorBit) != (SrcEvaluatorType::Flags & RowMajorBit) }; DstXprType temp(src.rows(), src.cols()); temp.reserve((std::min)(src.rows()*src.cols(), (std::max)(src.rows(),src.cols())*2)); for (Index j=0; j struct Assignment { static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &/*func*/) { assign_sparse_to_sparse(dst.derived(), src.derived()); } }; // Generic Sparse to Dense assignment template< typename DstXprType, typename SrcXprType, typename Functor, typename Weak> struct Assignment { static void run(DstXprType &dst, const SrcXprType &src, const Functor &func) { if(internal::is_same >::value) dst.setZero(); internal::evaluator srcEval(src); resize_if_allowed(dst, src, func); internal::evaluator dstEval(dst); const Index outerEvaluationSize = (internal::evaluator::Flags&RowMajorBit) ? src.rows() : src.cols(); for (Index j=0; j::InnerIterator i(srcEval,j); i; ++i) func.assignCoeff(dstEval.coeffRef(i.row(),i.col()), i.value()); } }; // Specialization for dense ?= dense +/- sparse and dense ?= sparse +/- dense template struct assignment_from_dense_op_sparse { template static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(DstXprType &dst, const SrcXprType &src, const InitialFunc& /*func*/) { #ifdef EIGEN_SPARSE_ASSIGNMENT_FROM_DENSE_OP_SPARSE_PLUGIN EIGEN_SPARSE_ASSIGNMENT_FROM_DENSE_OP_SPARSE_PLUGIN #endif call_assignment_no_alias(dst, src.lhs(), Func1()); call_assignment_no_alias(dst, src.rhs(), Func2()); } // Specialization for dense1 = sparse + dense2; -> dense1 = dense2; dense1 += sparse; template static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::enable_if::Shape,DenseShape>::value>::type run(DstXprType &dst, const CwiseBinaryOp, const Lhs, const Rhs> &src, const internal::assign_op& /*func*/) { #ifdef EIGEN_SPARSE_ASSIGNMENT_FROM_SPARSE_ADD_DENSE_PLUGIN EIGEN_SPARSE_ASSIGNMENT_FROM_SPARSE_ADD_DENSE_PLUGIN #endif // Apply the dense matrix first, then the sparse one. call_assignment_no_alias(dst, src.rhs(), Func1()); call_assignment_no_alias(dst, src.lhs(), Func2()); } // Specialization for dense1 = sparse - dense2; -> dense1 = -dense2; dense1 += sparse; template static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::enable_if::Shape,DenseShape>::value>::type run(DstXprType &dst, const CwiseBinaryOp, const Lhs, const Rhs> &src, const internal::assign_op& /*func*/) { #ifdef EIGEN_SPARSE_ASSIGNMENT_FROM_SPARSE_SUB_DENSE_PLUGIN EIGEN_SPARSE_ASSIGNMENT_FROM_SPARSE_SUB_DENSE_PLUGIN #endif // Apply the dense matrix first, then the sparse one. call_assignment_no_alias(dst, -src.rhs(), Func1()); call_assignment_no_alias(dst, src.lhs(), add_assign_op()); } }; #define EIGEN_CATCH_ASSIGN_DENSE_OP_SPARSE(ASSIGN_OP,BINOP,ASSIGN_OP2) \ template< typename DstXprType, typename Lhs, typename Rhs, typename Scalar> \ struct Assignment, const Lhs, const Rhs>, internal::ASSIGN_OP, \ Sparse2Dense, \ typename internal::enable_if< internal::is_same::Shape,DenseShape>::value \ || internal::is_same::Shape,DenseShape>::value>::type> \ : assignment_from_dense_op_sparse, internal::ASSIGN_OP2 > \ {} EIGEN_CATCH_ASSIGN_DENSE_OP_SPARSE(assign_op, scalar_sum_op,add_assign_op); EIGEN_CATCH_ASSIGN_DENSE_OP_SPARSE(add_assign_op,scalar_sum_op,add_assign_op); EIGEN_CATCH_ASSIGN_DENSE_OP_SPARSE(sub_assign_op,scalar_sum_op,sub_assign_op); EIGEN_CATCH_ASSIGN_DENSE_OP_SPARSE(assign_op, scalar_difference_op,sub_assign_op); EIGEN_CATCH_ASSIGN_DENSE_OP_SPARSE(add_assign_op,scalar_difference_op,sub_assign_op); EIGEN_CATCH_ASSIGN_DENSE_OP_SPARSE(sub_assign_op,scalar_difference_op,add_assign_op); // Specialization for "dst = dec.solve(rhs)" // NOTE we need to specialize it for Sparse2Sparse to avoid ambiguous specialization error template struct Assignment, internal::assign_op, Sparse2Sparse> { typedef Solve SrcXprType; static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &) { Index dstRows = src.rows(); Index dstCols = src.cols(); if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) dst.resize(dstRows, dstCols); src.dec()._solve_impl(src.rhs(), dst); } }; struct Diagonal2Sparse {}; template<> struct AssignmentKind { typedef Diagonal2Sparse Kind; }; template< typename DstXprType, typename SrcXprType, typename Functor> struct Assignment { typedef typename DstXprType::StorageIndex StorageIndex; typedef typename DstXprType::Scalar Scalar; template static void run(SparseMatrix &dst, const SrcXprType &src, const AssignFunc &func) { dst.assignDiagonal(src.diagonal(), func); } template static void run(SparseMatrixBase &dst, const SrcXprType &src, const internal::assign_op &/*func*/) { dst.derived().diagonal() = src.diagonal(); } template static void run(SparseMatrixBase &dst, const SrcXprType &src, const internal::add_assign_op &/*func*/) { dst.derived().diagonal() += src.diagonal(); } template static void run(SparseMatrixBase &dst, const SrcXprType &src, const internal::sub_assign_op &/*func*/) { dst.derived().diagonal() -= src.diagonal(); } }; } // end namespace internal } // end namespace Eigen #endif // EIGEN_SPARSEASSIGN_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseBlock.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSE_BLOCK_H #define EIGEN_SPARSE_BLOCK_H namespace Eigen { // Subset of columns or rows template class BlockImpl : public SparseMatrixBase > { typedef typename internal::remove_all::type _MatrixTypeNested; typedef Block BlockType; public: enum { IsRowMajor = internal::traits::IsRowMajor }; protected: enum { OuterSize = IsRowMajor ? BlockRows : BlockCols }; typedef SparseMatrixBase Base; using Base::convert_index; public: EIGEN_SPARSE_PUBLIC_INTERFACE(BlockType) inline BlockImpl(XprType& xpr, Index i) : m_matrix(xpr), m_outerStart(convert_index(i)), m_outerSize(OuterSize) {} inline BlockImpl(XprType& xpr, Index startRow, Index startCol, Index blockRows, Index blockCols) : m_matrix(xpr), m_outerStart(convert_index(IsRowMajor ? startRow : startCol)), m_outerSize(convert_index(IsRowMajor ? blockRows : blockCols)) {} EIGEN_STRONG_INLINE Index rows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); } EIGEN_STRONG_INLINE Index cols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); } Index nonZeros() const { typedef internal::evaluator EvaluatorType; EvaluatorType matEval(m_matrix); Index nnz = 0; Index end = m_outerStart + m_outerSize.value(); for(Index j=m_outerStart; j::non_const_type m_matrix; Index m_outerStart; const internal::variable_if_dynamic m_outerSize; protected: // Disable assignment with clear error message. // Note that simply removing operator= yields compilation errors with ICC+MSVC template BlockImpl& operator=(const T&) { EIGEN_STATIC_ASSERT(sizeof(T)==0, THIS_SPARSE_BLOCK_SUBEXPRESSION_IS_READ_ONLY); return *this; } }; /*************************************************************************** * specialization for SparseMatrix ***************************************************************************/ namespace internal { template class sparse_matrix_block_impl : public SparseCompressedBase > { typedef typename internal::remove_all::type _MatrixTypeNested; typedef Block BlockType; typedef SparseCompressedBase > Base; using Base::convert_index; public: enum { IsRowMajor = internal::traits::IsRowMajor }; EIGEN_SPARSE_PUBLIC_INTERFACE(BlockType) protected: typedef typename Base::IndexVector IndexVector; enum { OuterSize = IsRowMajor ? BlockRows : BlockCols }; public: inline sparse_matrix_block_impl(SparseMatrixType& xpr, Index i) : m_matrix(xpr), m_outerStart(convert_index(i)), m_outerSize(OuterSize) {} inline sparse_matrix_block_impl(SparseMatrixType& xpr, Index startRow, Index startCol, Index blockRows, Index blockCols) : m_matrix(xpr), m_outerStart(convert_index(IsRowMajor ? startRow : startCol)), m_outerSize(convert_index(IsRowMajor ? blockRows : blockCols)) {} template inline BlockType& operator=(const SparseMatrixBase& other) { typedef typename internal::remove_all::type _NestedMatrixType; _NestedMatrixType& matrix = m_matrix; // This assignment is slow if this vector set is not empty // and/or it is not at the end of the nonzeros of the underlying matrix. // 1 - eval to a temporary to avoid transposition and/or aliasing issues Ref > tmp(other.derived()); eigen_internal_assert(tmp.outerSize()==m_outerSize.value()); // 2 - let's check whether there is enough allocated memory Index nnz = tmp.nonZeros(); Index start = m_outerStart==0 ? 0 : m_matrix.outerIndexPtr()[m_outerStart]; // starting position of the current block Index end = m_matrix.outerIndexPtr()[m_outerStart+m_outerSize.value()]; // ending position of the current block Index block_size = end - start; // available room in the current block Index tail_size = m_matrix.outerIndexPtr()[m_matrix.outerSize()] - end; Index free_size = m_matrix.isCompressed() ? Index(matrix.data().allocatedSize()) + block_size : block_size; Index tmp_start = tmp.outerIndexPtr()[0]; bool update_trailing_pointers = false; if(nnz>free_size) { // realloc manually to reduce copies typename SparseMatrixType::Storage newdata(m_matrix.data().allocatedSize() - block_size + nnz); internal::smart_copy(m_matrix.valuePtr(), m_matrix.valuePtr() + start, newdata.valuePtr()); internal::smart_copy(m_matrix.innerIndexPtr(), m_matrix.innerIndexPtr() + start, newdata.indexPtr()); internal::smart_copy(tmp.valuePtr() + tmp_start, tmp.valuePtr() + tmp_start + nnz, newdata.valuePtr() + start); internal::smart_copy(tmp.innerIndexPtr() + tmp_start, tmp.innerIndexPtr() + tmp_start + nnz, newdata.indexPtr() + start); internal::smart_copy(matrix.valuePtr()+end, matrix.valuePtr()+end + tail_size, newdata.valuePtr()+start+nnz); internal::smart_copy(matrix.innerIndexPtr()+end, matrix.innerIndexPtr()+end + tail_size, newdata.indexPtr()+start+nnz); newdata.resize(m_matrix.outerIndexPtr()[m_matrix.outerSize()] - block_size + nnz); matrix.data().swap(newdata); update_trailing_pointers = true; } else { if(m_matrix.isCompressed() && nnz!=block_size) { // no need to realloc, simply copy the tail at its respective position and insert tmp matrix.data().resize(start + nnz + tail_size); internal::smart_memmove(matrix.valuePtr()+end, matrix.valuePtr() + end+tail_size, matrix.valuePtr() + start+nnz); internal::smart_memmove(matrix.innerIndexPtr()+end, matrix.innerIndexPtr() + end+tail_size, matrix.innerIndexPtr() + start+nnz); update_trailing_pointers = true; } internal::smart_copy(tmp.valuePtr() + tmp_start, tmp.valuePtr() + tmp_start + nnz, matrix.valuePtr() + start); internal::smart_copy(tmp.innerIndexPtr() + tmp_start, tmp.innerIndexPtr() + tmp_start + nnz, matrix.innerIndexPtr() + start); } // update outer index pointers and innerNonZeros if(IsVectorAtCompileTime) { if(!m_matrix.isCompressed()) matrix.innerNonZeroPtr()[m_outerStart] = StorageIndex(nnz); matrix.outerIndexPtr()[m_outerStart] = StorageIndex(start); } else { StorageIndex p = StorageIndex(start); for(Index k=0; k(tmp.innerVector(k).nonZeros()); if(!m_matrix.isCompressed()) matrix.innerNonZeroPtr()[m_outerStart+k] = nnz_k; matrix.outerIndexPtr()[m_outerStart+k] = p; p += nnz_k; } } if(update_trailing_pointers) { StorageIndex offset = internal::convert_index(nnz - block_size); for(Index k = m_outerStart + m_outerSize.value(); k<=matrix.outerSize(); ++k) { matrix.outerIndexPtr()[k] += offset; } } return derived(); } inline BlockType& operator=(const BlockType& other) { return operator=(other); } inline const Scalar* valuePtr() const { return m_matrix.valuePtr(); } inline Scalar* valuePtr() { return m_matrix.valuePtr(); } inline const StorageIndex* innerIndexPtr() const { return m_matrix.innerIndexPtr(); } inline StorageIndex* innerIndexPtr() { return m_matrix.innerIndexPtr(); } inline const StorageIndex* outerIndexPtr() const { return m_matrix.outerIndexPtr() + m_outerStart; } inline StorageIndex* outerIndexPtr() { return m_matrix.outerIndexPtr() + m_outerStart; } inline const StorageIndex* innerNonZeroPtr() const { return isCompressed() ? 0 : (m_matrix.innerNonZeroPtr()+m_outerStart); } inline StorageIndex* innerNonZeroPtr() { return isCompressed() ? 0 : (m_matrix.innerNonZeroPtr()+m_outerStart); } bool isCompressed() const { return m_matrix.innerNonZeroPtr()==0; } inline Scalar& coeffRef(Index row, Index col) { return m_matrix.coeffRef(row + (IsRowMajor ? m_outerStart : 0), col + (IsRowMajor ? 0 : m_outerStart)); } inline const Scalar coeff(Index row, Index col) const { return m_matrix.coeff(row + (IsRowMajor ? m_outerStart : 0), col + (IsRowMajor ? 0 : m_outerStart)); } inline const Scalar coeff(Index index) const { return m_matrix.coeff(IsRowMajor ? m_outerStart : index, IsRowMajor ? index : m_outerStart); } const Scalar& lastCoeff() const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(sparse_matrix_block_impl); eigen_assert(Base::nonZeros()>0); if(m_matrix.isCompressed()) return m_matrix.valuePtr()[m_matrix.outerIndexPtr()[m_outerStart+1]-1]; else return m_matrix.valuePtr()[m_matrix.outerIndexPtr()[m_outerStart]+m_matrix.innerNonZeroPtr()[m_outerStart]-1]; } EIGEN_STRONG_INLINE Index rows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); } EIGEN_STRONG_INLINE Index cols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); } inline const SparseMatrixType& nestedExpression() const { return m_matrix; } inline SparseMatrixType& nestedExpression() { return m_matrix; } Index startRow() const { return IsRowMajor ? m_outerStart : 0; } Index startCol() const { return IsRowMajor ? 0 : m_outerStart; } Index blockRows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); } Index blockCols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); } protected: typename internal::ref_selector::non_const_type m_matrix; Index m_outerStart; const internal::variable_if_dynamic m_outerSize; }; } // namespace internal template class BlockImpl,BlockRows,BlockCols,true,Sparse> : public internal::sparse_matrix_block_impl,BlockRows,BlockCols> { public: typedef StorageIndex_ StorageIndex; typedef SparseMatrix SparseMatrixType; typedef internal::sparse_matrix_block_impl Base; inline BlockImpl(SparseMatrixType& xpr, Index i) : Base(xpr, i) {} inline BlockImpl(SparseMatrixType& xpr, Index startRow, Index startCol, Index blockRows, Index blockCols) : Base(xpr, startRow, startCol, blockRows, blockCols) {} using Base::operator=; }; template class BlockImpl,BlockRows,BlockCols,true,Sparse> : public internal::sparse_matrix_block_impl,BlockRows,BlockCols> { public: typedef StorageIndex_ StorageIndex; typedef const SparseMatrix SparseMatrixType; typedef internal::sparse_matrix_block_impl Base; inline BlockImpl(SparseMatrixType& xpr, Index i) : Base(xpr, i) {} inline BlockImpl(SparseMatrixType& xpr, Index startRow, Index startCol, Index blockRows, Index blockCols) : Base(xpr, startRow, startCol, blockRows, blockCols) {} using Base::operator=; private: template BlockImpl(const SparseMatrixBase& xpr, Index i); template BlockImpl(const SparseMatrixBase& xpr); }; //---------- /** Generic implementation of sparse Block expression. * Real-only. */ template class BlockImpl : public SparseMatrixBase >, internal::no_assignment_operator { typedef Block BlockType; typedef SparseMatrixBase Base; using Base::convert_index; public: enum { IsRowMajor = internal::traits::IsRowMajor }; EIGEN_SPARSE_PUBLIC_INTERFACE(BlockType) typedef typename internal::remove_all::type _MatrixTypeNested; /** Column or Row constructor */ inline BlockImpl(XprType& xpr, Index i) : m_matrix(xpr), m_startRow( (BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) ? convert_index(i) : 0), m_startCol( (BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) ? convert_index(i) : 0), m_blockRows(BlockRows==1 ? 1 : xpr.rows()), m_blockCols(BlockCols==1 ? 1 : xpr.cols()) {} /** Dynamic-size constructor */ inline BlockImpl(XprType& xpr, Index startRow, Index startCol, Index blockRows, Index blockCols) : m_matrix(xpr), m_startRow(convert_index(startRow)), m_startCol(convert_index(startCol)), m_blockRows(convert_index(blockRows)), m_blockCols(convert_index(blockCols)) {} inline Index rows() const { return m_blockRows.value(); } inline Index cols() const { return m_blockCols.value(); } inline Scalar& coeffRef(Index row, Index col) { return m_matrix.coeffRef(row + m_startRow.value(), col + m_startCol.value()); } inline const Scalar coeff(Index row, Index col) const { return m_matrix.coeff(row + m_startRow.value(), col + m_startCol.value()); } inline Scalar& coeffRef(Index index) { return m_matrix.coeffRef(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); } inline const Scalar coeff(Index index) const { return m_matrix.coeff(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); } inline const XprType& nestedExpression() const { return m_matrix; } inline XprType& nestedExpression() { return m_matrix; } Index startRow() const { return m_startRow.value(); } Index startCol() const { return m_startCol.value(); } Index blockRows() const { return m_blockRows.value(); } Index blockCols() const { return m_blockCols.value(); } protected: // friend class internal::GenericSparseBlockInnerIteratorImpl; friend struct internal::unary_evaluator, internal::IteratorBased, Scalar >; Index nonZeros() const { return Dynamic; } typename internal::ref_selector::non_const_type m_matrix; 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; protected: // Disable assignment with clear error message. // Note that simply removing operator= yields compilation errors with ICC+MSVC template BlockImpl& operator=(const T&) { EIGEN_STATIC_ASSERT(sizeof(T)==0, THIS_SPARSE_BLOCK_SUBEXPRESSION_IS_READ_ONLY); return *this; } }; namespace internal { template struct unary_evaluator, IteratorBased > : public evaluator_base > { class InnerVectorInnerIterator; class OuterVectorInnerIterator; public: typedef Block XprType; typedef typename XprType::StorageIndex StorageIndex; typedef typename XprType::Scalar Scalar; enum { IsRowMajor = XprType::IsRowMajor, OuterVector = (BlockCols==1 && ArgType::IsRowMajor) | // FIXME | instead of || to please GCC 4.4.0 stupid warning "suggest parentheses around &&". // revert to || as soon as not needed anymore. (BlockRows==1 && !ArgType::IsRowMajor), CoeffReadCost = evaluator::CoeffReadCost, Flags = XprType::Flags }; typedef typename internal::conditional::type InnerIterator; explicit unary_evaluator(const XprType& op) : m_argImpl(op.nestedExpression()), m_block(op) {} inline Index nonZerosEstimate() const { const Index nnz = m_block.nonZeros(); if(nnz < 0) { // Scale the non-zero estimate for the underlying expression linearly with block size. // Return zero if the underlying block is empty. const Index nested_sz = m_block.nestedExpression().size(); return nested_sz == 0 ? 0 : m_argImpl.nonZerosEstimate() * m_block.size() / nested_sz; } return nnz; } protected: typedef typename evaluator::InnerIterator EvalIterator; evaluator m_argImpl; const XprType &m_block; }; template class unary_evaluator, IteratorBased>::InnerVectorInnerIterator : public EvalIterator { // NOTE MSVC fails to compile if we don't explicitely "import" IsRowMajor from unary_evaluator // because the base class EvalIterator has a private IsRowMajor enum too. (bug #1786) // NOTE We cannot call it IsRowMajor because it would shadow unary_evaluator::IsRowMajor enum { XprIsRowMajor = unary_evaluator::IsRowMajor }; const XprType& m_block; Index m_end; public: EIGEN_STRONG_INLINE InnerVectorInnerIterator(const unary_evaluator& aEval, Index outer) : EvalIterator(aEval.m_argImpl, outer + (XprIsRowMajor ? aEval.m_block.startRow() : aEval.m_block.startCol())), m_block(aEval.m_block), m_end(XprIsRowMajor ? aEval.m_block.startCol()+aEval.m_block.blockCols() : aEval.m_block.startRow()+aEval.m_block.blockRows()) { while( (EvalIterator::operator bool()) && (EvalIterator::index() < (XprIsRowMajor ? m_block.startCol() : m_block.startRow())) ) EvalIterator::operator++(); } inline StorageIndex index() const { return EvalIterator::index() - convert_index(XprIsRowMajor ? m_block.startCol() : m_block.startRow()); } inline Index outer() const { return EvalIterator::outer() - (XprIsRowMajor ? m_block.startRow() : m_block.startCol()); } inline Index row() const { return EvalIterator::row() - m_block.startRow(); } inline Index col() const { return EvalIterator::col() - m_block.startCol(); } inline operator bool() const { return EvalIterator::operator bool() && EvalIterator::index() < m_end; } }; template class unary_evaluator, IteratorBased>::OuterVectorInnerIterator { // NOTE see above enum { XprIsRowMajor = unary_evaluator::IsRowMajor }; const unary_evaluator& m_eval; Index m_outerPos; const Index m_innerIndex; Index m_end; EvalIterator m_it; public: EIGEN_STRONG_INLINE OuterVectorInnerIterator(const unary_evaluator& aEval, Index outer) : m_eval(aEval), m_outerPos( (XprIsRowMajor ? aEval.m_block.startCol() : aEval.m_block.startRow()) ), m_innerIndex(XprIsRowMajor ? aEval.m_block.startRow() : aEval.m_block.startCol()), m_end(XprIsRowMajor ? aEval.m_block.startCol()+aEval.m_block.blockCols() : aEval.m_block.startRow()+aEval.m_block.blockRows()), m_it(m_eval.m_argImpl, m_outerPos) { EIGEN_UNUSED_VARIABLE(outer); eigen_assert(outer==0); while(m_it && m_it.index() < m_innerIndex) ++m_it; if((!m_it) || (m_it.index()!=m_innerIndex)) ++(*this); } inline StorageIndex index() const { return convert_index(m_outerPos - (XprIsRowMajor ? m_eval.m_block.startCol() : m_eval.m_block.startRow())); } inline Index outer() const { return 0; } inline Index row() const { return XprIsRowMajor ? 0 : index(); } inline Index col() const { return XprIsRowMajor ? index() : 0; } inline Scalar value() const { return m_it.value(); } inline Scalar& valueRef() { return m_it.valueRef(); } inline OuterVectorInnerIterator& operator++() { // search next non-zero entry while(++m_outerPos struct unary_evaluator,BlockRows,BlockCols,true>, IteratorBased> : evaluator,BlockRows,BlockCols,true> > > { typedef Block,BlockRows,BlockCols,true> XprType; typedef evaluator > Base; explicit unary_evaluator(const XprType &xpr) : Base(xpr) {} }; template struct unary_evaluator,BlockRows,BlockCols,true>, IteratorBased> : evaluator,BlockRows,BlockCols,true> > > { typedef Block,BlockRows,BlockCols,true> XprType; typedef evaluator > Base; explicit unary_evaluator(const XprType &xpr) : Base(xpr) {} }; } // end namespace internal } // end namespace Eigen #endif // EIGEN_SPARSE_BLOCK_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseColEtree.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. /* * NOTE: This file is the modified version of sp_coletree.c file in SuperLU * -- SuperLU routine (version 3.1) -- * Univ. of California Berkeley, Xerox Palo Alto Research Center, * and Lawrence Berkeley National Lab. * August 1, 2008 * * Copyright (c) 1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY * EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program for any * purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is * granted, provided the above notices are retained, and a notice that * the code was modified is included with the above copyright notice. */ #ifndef SPARSE_COLETREE_H #define SPARSE_COLETREE_H namespace Eigen { namespace internal { /** Find the root of the tree/set containing the vertex i : Use Path halving */ template Index etree_find (Index i, IndexVector& pp) { Index p = pp(i); // Parent Index gp = pp(p); // Grand parent while (gp != p) { pp(i) = gp; // Parent pointer on find path is changed to former grand parent i = gp; p = pp(i); gp = pp(p); } return p; } /** Compute the column elimination tree of a sparse matrix * \param mat The matrix in column-major format. * \param parent The elimination tree * \param firstRowElt The column index of the first element in each row * \param perm The permutation to apply to the column of \b mat */ template int coletree(const MatrixType& mat, IndexVector& parent, IndexVector& firstRowElt, typename MatrixType::StorageIndex *perm=0) { typedef typename MatrixType::StorageIndex StorageIndex; StorageIndex nc = convert_index(mat.cols()); // Number of columns StorageIndex m = convert_index(mat.rows()); StorageIndex diagSize = (std::min)(nc,m); IndexVector root(nc); // root of subtree of etree root.setZero(); IndexVector pp(nc); // disjoint sets pp.setZero(); // Initialize disjoint sets parent.resize(mat.cols()); //Compute first nonzero column in each row firstRowElt.resize(m); firstRowElt.setConstant(nc); firstRowElt.segment(0, diagSize).setLinSpaced(diagSize, 0, diagSize-1); bool found_diag; for (StorageIndex col = 0; col < nc; col++) { StorageIndex pcol = col; if(perm) pcol = perm[col]; for (typename MatrixType::InnerIterator it(mat, pcol); it; ++it) { Index row = it.row(); firstRowElt(row) = (std::min)(firstRowElt(row), col); } } /* Compute etree by Liu's algorithm for symmetric matrices, except use (firstRowElt[r],c) in place of an edge (r,c) of A. Thus each row clique in A'*A is replaced by a star centered at its first vertex, which has the same fill. */ StorageIndex rset, cset, rroot; for (StorageIndex col = 0; col < nc; col++) { found_diag = col>=m; pp(col) = col; cset = col; root(cset) = col; parent(col) = nc; /* The diagonal element is treated here even if it does not exist in the matrix * hence the loop is executed once more */ StorageIndex pcol = col; if(perm) pcol = perm[col]; for (typename MatrixType::InnerIterator it(mat, pcol); it||!found_diag; ++it) { // A sequence of interleaved find and union is performed Index i = col; if(it) i = it.index(); if (i == col) found_diag = true; StorageIndex row = firstRowElt(i); if (row >= col) continue; rset = internal::etree_find(row, pp); // Find the name of the set containing row rroot = root(rset); if (rroot != col) { parent(rroot) = col; pp(cset) = rset; cset = rset; root(cset) = col; } } } return 0; } /** * Depth-first search from vertex n. No recursion. * This routine was contributed by Cédric Doucet, CEDRAT Group, Meylan, France. */ template void nr_etdfs (typename IndexVector::Scalar n, IndexVector& parent, IndexVector& first_kid, IndexVector& next_kid, IndexVector& post, typename IndexVector::Scalar postnum) { typedef typename IndexVector::Scalar StorageIndex; StorageIndex current = n, first, next; while (postnum != n) { // No kid for the current node first = first_kid(current); // no kid for the current node if (first == -1) { // Numbering this node because it has no kid post(current) = postnum++; // looking for the next kid next = next_kid(current); while (next == -1) { // No more kids : back to the parent node current = parent(current); // numbering the parent node post(current) = postnum++; // Get the next kid next = next_kid(current); } // stopping criterion if (postnum == n+1) return; // Updating current node current = next; } else { current = first; } } } /** * \brief Post order a tree * \param n the number of nodes * \param parent Input tree * \param post postordered tree */ template void treePostorder(typename IndexVector::Scalar n, IndexVector& parent, IndexVector& post) { typedef typename IndexVector::Scalar StorageIndex; IndexVector first_kid, next_kid; // Linked list of children StorageIndex postnum; // Allocate storage for working arrays and results first_kid.resize(n+1); next_kid.setZero(n+1); post.setZero(n+1); // Set up structure describing children first_kid.setConstant(-1); for (StorageIndex v = n-1; v >= 0; v--) { StorageIndex dad = parent(v); next_kid(v) = first_kid(dad); first_kid(dad) = v; } // Depth-first search from dummy root vertex #n postnum = 0; internal::nr_etdfs(n, parent, first_kid, next_kid, post, postnum); } } // end namespace internal } // end namespace Eigen #endif // SPARSE_COLETREE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseCompressedBase.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2015 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSE_COMPRESSED_BASE_H #define EIGEN_SPARSE_COMPRESSED_BASE_H namespace Eigen { template class SparseCompressedBase; namespace internal { template struct traits > : traits {}; } // end namespace internal /** \ingroup SparseCore_Module * \class SparseCompressedBase * \brief Common base class for sparse [compressed]-{row|column}-storage format. * * This class defines the common interface for all derived classes implementing the compressed sparse storage format, such as: * - SparseMatrix * - Ref * - Map * */ template class SparseCompressedBase : public SparseMatrixBase { public: typedef SparseMatrixBase Base; EIGEN_SPARSE_PUBLIC_INTERFACE(SparseCompressedBase) using Base::operator=; using Base::IsRowMajor; class InnerIterator; class ReverseInnerIterator; protected: typedef typename Base::IndexVector IndexVector; Eigen::Map innerNonZeros() { return Eigen::Map(innerNonZeroPtr(), isCompressed()?0:derived().outerSize()); } const Eigen::Map innerNonZeros() const { return Eigen::Map(innerNonZeroPtr(), isCompressed()?0:derived().outerSize()); } public: /** \returns the number of non zero coefficients */ inline Index nonZeros() const { if(Derived::IsVectorAtCompileTime && outerIndexPtr()==0) return derived().nonZeros(); else if(isCompressed()) return outerIndexPtr()[derived().outerSize()]-outerIndexPtr()[0]; else if(derived().outerSize()==0) return 0; else return innerNonZeros().sum(); } /** \returns a const pointer to the array of values. * This function is aimed at interoperability with other libraries. * \sa innerIndexPtr(), outerIndexPtr() */ inline const Scalar* valuePtr() const { return derived().valuePtr(); } /** \returns a non-const pointer to the array of values. * This function is aimed at interoperability with other libraries. * \sa innerIndexPtr(), outerIndexPtr() */ inline Scalar* valuePtr() { return derived().valuePtr(); } /** \returns a const pointer to the array of inner indices. * This function is aimed at interoperability with other libraries. * \sa valuePtr(), outerIndexPtr() */ inline const StorageIndex* innerIndexPtr() const { return derived().innerIndexPtr(); } /** \returns a non-const pointer to the array of inner indices. * This function is aimed at interoperability with other libraries. * \sa valuePtr(), outerIndexPtr() */ inline StorageIndex* innerIndexPtr() { return derived().innerIndexPtr(); } /** \returns a const pointer to the array of the starting positions of the inner vectors. * This function is aimed at interoperability with other libraries. * \warning it returns the null pointer 0 for SparseVector * \sa valuePtr(), innerIndexPtr() */ inline const StorageIndex* outerIndexPtr() const { return derived().outerIndexPtr(); } /** \returns a non-const pointer to the array of the starting positions of the inner vectors. * This function is aimed at interoperability with other libraries. * \warning it returns the null pointer 0 for SparseVector * \sa valuePtr(), innerIndexPtr() */ inline StorageIndex* outerIndexPtr() { return derived().outerIndexPtr(); } /** \returns a const pointer to the array of the number of non zeros of the inner vectors. * This function is aimed at interoperability with other libraries. * \warning it returns the null pointer 0 in compressed mode */ inline const StorageIndex* innerNonZeroPtr() const { return derived().innerNonZeroPtr(); } /** \returns a non-const pointer to the array of the number of non zeros of the inner vectors. * This function is aimed at interoperability with other libraries. * \warning it returns the null pointer 0 in compressed mode */ inline StorageIndex* innerNonZeroPtr() { return derived().innerNonZeroPtr(); } /** \returns whether \c *this is in compressed form. */ inline bool isCompressed() const { return innerNonZeroPtr()==0; } /** \returns a read-only view of the stored coefficients as a 1D array expression. * * \warning this method is for \b compressed \b storage \b only, and it will trigger an assertion otherwise. * * \sa valuePtr(), isCompressed() */ const Map > coeffs() const { eigen_assert(isCompressed()); return Array::Map(valuePtr(),nonZeros()); } /** \returns a read-write view of the stored coefficients as a 1D array expression * * \warning this method is for \b compressed \b storage \b only, and it will trigger an assertion otherwise. * * Here is an example: * \include SparseMatrix_coeffs.cpp * and the output is: * \include SparseMatrix_coeffs.out * * \sa valuePtr(), isCompressed() */ Map > coeffs() { eigen_assert(isCompressed()); return Array::Map(valuePtr(),nonZeros()); } protected: /** Default constructor. Do nothing. */ SparseCompressedBase() {} /** \internal return the index of the coeff at (row,col) or just before if it does not exist. * This is an analogue of std::lower_bound. */ internal::LowerBoundIndex lower_bound(Index row, Index col) const { eigen_internal_assert(row>=0 && rowrows() && col>=0 && colcols()); const Index outer = Derived::IsRowMajor ? row : col; const Index inner = Derived::IsRowMajor ? col : row; Index start = this->outerIndexPtr()[outer]; Index end = this->isCompressed() ? this->outerIndexPtr()[outer+1] : this->outerIndexPtr()[outer] + this->innerNonZeroPtr()[outer]; eigen_assert(end>=start && "you are using a non finalized sparse matrix or written coefficient does not exist"); internal::LowerBoundIndex p; p.value = std::lower_bound(this->innerIndexPtr()+start, this->innerIndexPtr()+end,inner) - this->innerIndexPtr(); p.found = (p.valueinnerIndexPtr()[p.value]==inner); return p; } friend struct internal::evaluator >; private: template explicit SparseCompressedBase(const SparseCompressedBase&); }; template class SparseCompressedBase::InnerIterator { public: InnerIterator() : m_values(0), m_indices(0), m_outer(0), m_id(0), m_end(0) {} InnerIterator(const InnerIterator& other) : m_values(other.m_values), m_indices(other.m_indices), m_outer(other.m_outer), m_id(other.m_id), m_end(other.m_end) {} InnerIterator& operator=(const InnerIterator& other) { m_values = other.m_values; m_indices = other.m_indices; const_cast(m_outer).setValue(other.m_outer.value()); m_id = other.m_id; m_end = other.m_end; return *this; } InnerIterator(const SparseCompressedBase& mat, Index outer) : m_values(mat.valuePtr()), m_indices(mat.innerIndexPtr()), m_outer(outer) { if(Derived::IsVectorAtCompileTime && mat.outerIndexPtr()==0) { m_id = 0; m_end = mat.nonZeros(); } else { m_id = mat.outerIndexPtr()[outer]; if(mat.isCompressed()) m_end = mat.outerIndexPtr()[outer+1]; else m_end = m_id + mat.innerNonZeroPtr()[outer]; } } explicit InnerIterator(const SparseCompressedBase& mat) : m_values(mat.valuePtr()), m_indices(mat.innerIndexPtr()), m_outer(0), m_id(0), m_end(mat.nonZeros()) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived); } explicit InnerIterator(const internal::CompressedStorage& data) : m_values(data.valuePtr()), m_indices(data.indexPtr()), m_outer(0), m_id(0), m_end(data.size()) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived); } inline InnerIterator& operator++() { m_id++; return *this; } inline InnerIterator& operator+=(Index i) { m_id += i ; return *this; } inline InnerIterator operator+(Index i) { InnerIterator result = *this; result += i; return result; } inline const Scalar& value() const { return m_values[m_id]; } inline Scalar& valueRef() { return const_cast(m_values[m_id]); } inline StorageIndex index() const { return m_indices[m_id]; } inline Index outer() const { return m_outer.value(); } inline Index row() const { return IsRowMajor ? m_outer.value() : index(); } inline Index col() const { return IsRowMajor ? index() : m_outer.value(); } inline operator bool() const { return (m_id < m_end); } protected: const Scalar* m_values; const StorageIndex* m_indices; typedef internal::variable_if_dynamic OuterType; const OuterType m_outer; Index m_id; Index m_end; private: // If you get here, then you're not using the right InnerIterator type, e.g.: // SparseMatrix A; // SparseMatrix::InnerIterator it(A,0); template InnerIterator(const SparseMatrixBase&, Index outer); }; template class SparseCompressedBase::ReverseInnerIterator { public: ReverseInnerIterator(const SparseCompressedBase& mat, Index outer) : m_values(mat.valuePtr()), m_indices(mat.innerIndexPtr()), m_outer(outer) { if(Derived::IsVectorAtCompileTime && mat.outerIndexPtr()==0) { m_start = 0; m_id = mat.nonZeros(); } else { m_start = mat.outerIndexPtr()[outer]; if(mat.isCompressed()) m_id = mat.outerIndexPtr()[outer+1]; else m_id = m_start + mat.innerNonZeroPtr()[outer]; } } explicit ReverseInnerIterator(const SparseCompressedBase& mat) : m_values(mat.valuePtr()), m_indices(mat.innerIndexPtr()), m_outer(0), m_start(0), m_id(mat.nonZeros()) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived); } explicit ReverseInnerIterator(const internal::CompressedStorage& data) : m_values(data.valuePtr()), m_indices(data.indexPtr()), m_outer(0), m_start(0), m_id(data.size()) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived); } inline ReverseInnerIterator& operator--() { --m_id; return *this; } inline ReverseInnerIterator& operator-=(Index i) { m_id -= i; return *this; } inline ReverseInnerIterator operator-(Index i) { ReverseInnerIterator result = *this; result -= i; return result; } inline const Scalar& value() const { return m_values[m_id-1]; } inline Scalar& valueRef() { return const_cast(m_values[m_id-1]); } inline StorageIndex index() const { return m_indices[m_id-1]; } inline Index outer() const { return m_outer.value(); } inline Index row() const { return IsRowMajor ? m_outer.value() : index(); } inline Index col() const { return IsRowMajor ? index() : m_outer.value(); } inline operator bool() const { return (m_id > m_start); } protected: const Scalar* m_values; const StorageIndex* m_indices; typedef internal::variable_if_dynamic OuterType; const OuterType m_outer; Index m_start; Index m_id; }; namespace internal { template struct evaluator > : evaluator_base { typedef typename Derived::Scalar Scalar; typedef typename Derived::InnerIterator InnerIterator; enum { CoeffReadCost = NumTraits::ReadCost, Flags = Derived::Flags }; evaluator() : m_matrix(0), m_zero(0) { EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); } explicit evaluator(const Derived &mat) : m_matrix(&mat), m_zero(0) { EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); } inline Index nonZerosEstimate() const { return m_matrix->nonZeros(); } operator Derived&() { return m_matrix->const_cast_derived(); } operator const Derived&() const { return *m_matrix; } typedef typename DenseCoeffsBase::CoeffReturnType CoeffReturnType; const Scalar& coeff(Index row, Index col) const { Index p = find(row,col); if(p==Dynamic) return m_zero; else return m_matrix->const_cast_derived().valuePtr()[p]; } Scalar& coeffRef(Index row, Index col) { Index p = find(row,col); eigen_assert(p!=Dynamic && "written coefficient does not exist"); return m_matrix->const_cast_derived().valuePtr()[p]; } protected: Index find(Index row, Index col) const { internal::LowerBoundIndex p = m_matrix->lower_bound(row,col); return p.found ? p.value : Dynamic; } const Derived *m_matrix; const Scalar m_zero; }; } } // end namespace Eigen #endif // EIGEN_SPARSE_COMPRESSED_BASE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSE_CWISE_BINARY_OP_H #define EIGEN_SPARSE_CWISE_BINARY_OP_H namespace Eigen { // Here we have to handle 3 cases: // 1 - sparse op dense // 2 - dense op sparse // 3 - sparse op sparse // We also need to implement a 4th iterator for: // 4 - dense op dense // Finally, we also need to distinguish between the product and other operations : // configuration returned mode // 1 - sparse op dense product sparse // generic dense // 2 - dense op sparse product sparse // generic dense // 3 - sparse op sparse product sparse // generic sparse // 4 - dense op dense product dense // generic dense // // TODO to ease compiler job, we could specialize product/quotient with a scalar // and fallback to cwise-unary evaluator using bind1st_op and bind2nd_op. template class CwiseBinaryOpImpl : public SparseMatrixBase > { public: typedef CwiseBinaryOp Derived; typedef SparseMatrixBase Base; EIGEN_SPARSE_PUBLIC_INTERFACE(Derived) CwiseBinaryOpImpl() { EIGEN_STATIC_ASSERT(( (!internal::is_same::StorageKind, typename internal::traits::StorageKind>::value) || ((internal::evaluator::Flags&RowMajorBit) == (internal::evaluator::Flags&RowMajorBit))), THE_STORAGE_ORDER_OF_BOTH_SIDES_MUST_MATCH); } }; namespace internal { // Generic "sparse OP sparse" template struct binary_sparse_evaluator; template struct binary_evaluator, IteratorBased, IteratorBased> : evaluator_base > { protected: typedef typename evaluator::InnerIterator LhsIterator; typedef typename evaluator::InnerIterator RhsIterator; typedef CwiseBinaryOp XprType; typedef typename traits::Scalar Scalar; typedef typename XprType::StorageIndex StorageIndex; public: class InnerIterator { public: EIGEN_STRONG_INLINE InnerIterator(const binary_evaluator& aEval, Index outer) : m_lhsIter(aEval.m_lhsImpl,outer), m_rhsIter(aEval.m_rhsImpl,outer), m_functor(aEval.m_functor) { this->operator++(); } EIGEN_STRONG_INLINE InnerIterator& operator++() { if (m_lhsIter && m_rhsIter && (m_lhsIter.index() == m_rhsIter.index())) { m_id = m_lhsIter.index(); m_value = m_functor(m_lhsIter.value(), m_rhsIter.value()); ++m_lhsIter; ++m_rhsIter; } else if (m_lhsIter && (!m_rhsIter || (m_lhsIter.index() < m_rhsIter.index()))) { m_id = m_lhsIter.index(); m_value = m_functor(m_lhsIter.value(), Scalar(0)); ++m_lhsIter; } else if (m_rhsIter && (!m_lhsIter || (m_lhsIter.index() > m_rhsIter.index()))) { m_id = m_rhsIter.index(); m_value = m_functor(Scalar(0), m_rhsIter.value()); ++m_rhsIter; } else { m_value = Scalar(0); // this is to avoid a compilation warning m_id = -1; } return *this; } EIGEN_STRONG_INLINE Scalar value() const { return m_value; } EIGEN_STRONG_INLINE StorageIndex index() const { return m_id; } EIGEN_STRONG_INLINE Index outer() const { return m_lhsIter.outer(); } EIGEN_STRONG_INLINE Index row() const { return Lhs::IsRowMajor ? m_lhsIter.row() : index(); } EIGEN_STRONG_INLINE Index col() const { return Lhs::IsRowMajor ? index() : m_lhsIter.col(); } EIGEN_STRONG_INLINE operator bool() const { return m_id>=0; } protected: LhsIterator m_lhsIter; RhsIterator m_rhsIter; const BinaryOp& m_functor; Scalar m_value; StorageIndex m_id; }; enum { CoeffReadCost = int(evaluator::CoeffReadCost) + int(evaluator::CoeffReadCost) + int(functor_traits::Cost), Flags = XprType::Flags }; explicit binary_evaluator(const XprType& xpr) : m_functor(xpr.functor()), m_lhsImpl(xpr.lhs()), m_rhsImpl(xpr.rhs()) { EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); } inline Index nonZerosEstimate() const { return m_lhsImpl.nonZerosEstimate() + m_rhsImpl.nonZerosEstimate(); } protected: const BinaryOp m_functor; evaluator m_lhsImpl; evaluator m_rhsImpl; }; // dense op sparse template struct binary_evaluator, IndexBased, IteratorBased> : evaluator_base > { protected: typedef typename evaluator::InnerIterator RhsIterator; typedef CwiseBinaryOp XprType; typedef typename traits::Scalar Scalar; typedef typename XprType::StorageIndex StorageIndex; public: class InnerIterator { enum { IsRowMajor = (int(Rhs::Flags)&RowMajorBit)==RowMajorBit }; public: EIGEN_STRONG_INLINE InnerIterator(const binary_evaluator& aEval, Index outer) : m_lhsEval(aEval.m_lhsImpl), m_rhsIter(aEval.m_rhsImpl,outer), m_functor(aEval.m_functor), m_value(0), m_id(-1), m_innerSize(aEval.m_expr.rhs().innerSize()) { this->operator++(); } EIGEN_STRONG_INLINE InnerIterator& operator++() { ++m_id; if(m_id &m_lhsEval; RhsIterator m_rhsIter; const BinaryOp& m_functor; Scalar m_value; StorageIndex m_id; StorageIndex m_innerSize; }; enum { CoeffReadCost = int(evaluator::CoeffReadCost) + int(evaluator::CoeffReadCost) + int(functor_traits::Cost), Flags = XprType::Flags }; explicit binary_evaluator(const XprType& xpr) : m_functor(xpr.functor()), m_lhsImpl(xpr.lhs()), m_rhsImpl(xpr.rhs()), m_expr(xpr) { EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); } inline Index nonZerosEstimate() const { return m_expr.size(); } protected: const BinaryOp m_functor; evaluator m_lhsImpl; evaluator m_rhsImpl; const XprType &m_expr; }; // sparse op dense template struct binary_evaluator, IteratorBased, IndexBased> : evaluator_base > { protected: typedef typename evaluator::InnerIterator LhsIterator; typedef CwiseBinaryOp XprType; typedef typename traits::Scalar Scalar; typedef typename XprType::StorageIndex StorageIndex; public: class InnerIterator { enum { IsRowMajor = (int(Lhs::Flags)&RowMajorBit)==RowMajorBit }; public: EIGEN_STRONG_INLINE InnerIterator(const binary_evaluator& aEval, Index outer) : m_lhsIter(aEval.m_lhsImpl,outer), m_rhsEval(aEval.m_rhsImpl), m_functor(aEval.m_functor), m_value(0), m_id(-1), m_innerSize(aEval.m_expr.lhs().innerSize()) { this->operator++(); } EIGEN_STRONG_INLINE InnerIterator& operator++() { ++m_id; if(m_id &m_rhsEval; const BinaryOp& m_functor; Scalar m_value; StorageIndex m_id; StorageIndex m_innerSize; }; enum { CoeffReadCost = int(evaluator::CoeffReadCost) + int(evaluator::CoeffReadCost) + int(functor_traits::Cost), Flags = XprType::Flags }; explicit binary_evaluator(const XprType& xpr) : m_functor(xpr.functor()), m_lhsImpl(xpr.lhs()), m_rhsImpl(xpr.rhs()), m_expr(xpr) { EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); } inline Index nonZerosEstimate() const { return m_expr.size(); } protected: const BinaryOp m_functor; evaluator m_lhsImpl; evaluator m_rhsImpl; const XprType &m_expr; }; template::Kind, typename RhsKind = typename evaluator_traits::Kind, typename LhsScalar = typename traits::Scalar, typename RhsScalar = typename traits::Scalar> struct sparse_conjunction_evaluator; // "sparse .* sparse" template struct binary_evaluator, Lhs, Rhs>, IteratorBased, IteratorBased> : sparse_conjunction_evaluator, Lhs, Rhs> > { typedef CwiseBinaryOp, Lhs, Rhs> XprType; typedef sparse_conjunction_evaluator Base; explicit binary_evaluator(const XprType& xpr) : Base(xpr) {} }; // "dense .* sparse" template struct binary_evaluator, Lhs, Rhs>, IndexBased, IteratorBased> : sparse_conjunction_evaluator, Lhs, Rhs> > { typedef CwiseBinaryOp, Lhs, Rhs> XprType; typedef sparse_conjunction_evaluator Base; explicit binary_evaluator(const XprType& xpr) : Base(xpr) {} }; // "sparse .* dense" template struct binary_evaluator, Lhs, Rhs>, IteratorBased, IndexBased> : sparse_conjunction_evaluator, Lhs, Rhs> > { typedef CwiseBinaryOp, Lhs, Rhs> XprType; typedef sparse_conjunction_evaluator Base; explicit binary_evaluator(const XprType& xpr) : Base(xpr) {} }; // "sparse ./ dense" template struct binary_evaluator, Lhs, Rhs>, IteratorBased, IndexBased> : sparse_conjunction_evaluator, Lhs, Rhs> > { typedef CwiseBinaryOp, Lhs, Rhs> XprType; typedef sparse_conjunction_evaluator Base; explicit binary_evaluator(const XprType& xpr) : Base(xpr) {} }; // "sparse && sparse" template struct binary_evaluator, IteratorBased, IteratorBased> : sparse_conjunction_evaluator > { typedef CwiseBinaryOp XprType; typedef sparse_conjunction_evaluator Base; explicit binary_evaluator(const XprType& xpr) : Base(xpr) {} }; // "dense && sparse" template struct binary_evaluator, IndexBased, IteratorBased> : sparse_conjunction_evaluator > { typedef CwiseBinaryOp XprType; typedef sparse_conjunction_evaluator Base; explicit binary_evaluator(const XprType& xpr) : Base(xpr) {} }; // "sparse && dense" template struct binary_evaluator, IteratorBased, IndexBased> : sparse_conjunction_evaluator > { typedef CwiseBinaryOp XprType; typedef sparse_conjunction_evaluator Base; explicit binary_evaluator(const XprType& xpr) : Base(xpr) {} }; // "sparse ^ sparse" template struct sparse_conjunction_evaluator : evaluator_base { protected: typedef typename XprType::Functor BinaryOp; typedef typename XprType::Lhs LhsArg; typedef typename XprType::Rhs RhsArg; typedef typename evaluator::InnerIterator LhsIterator; typedef typename evaluator::InnerIterator RhsIterator; typedef typename XprType::StorageIndex StorageIndex; typedef typename traits::Scalar Scalar; public: class InnerIterator { public: EIGEN_STRONG_INLINE InnerIterator(const sparse_conjunction_evaluator& aEval, Index outer) : m_lhsIter(aEval.m_lhsImpl,outer), m_rhsIter(aEval.m_rhsImpl,outer), m_functor(aEval.m_functor) { while (m_lhsIter && m_rhsIter && (m_lhsIter.index() != m_rhsIter.index())) { if (m_lhsIter.index() < m_rhsIter.index()) ++m_lhsIter; else ++m_rhsIter; } } EIGEN_STRONG_INLINE InnerIterator& operator++() { ++m_lhsIter; ++m_rhsIter; while (m_lhsIter && m_rhsIter && (m_lhsIter.index() != m_rhsIter.index())) { if (m_lhsIter.index() < m_rhsIter.index()) ++m_lhsIter; else ++m_rhsIter; } return *this; } EIGEN_STRONG_INLINE Scalar value() const { return m_functor(m_lhsIter.value(), m_rhsIter.value()); } EIGEN_STRONG_INLINE StorageIndex index() const { return m_lhsIter.index(); } EIGEN_STRONG_INLINE Index outer() const { return m_lhsIter.outer(); } EIGEN_STRONG_INLINE Index row() const { return m_lhsIter.row(); } EIGEN_STRONG_INLINE Index col() const { return m_lhsIter.col(); } EIGEN_STRONG_INLINE operator bool() const { return (m_lhsIter && m_rhsIter); } protected: LhsIterator m_lhsIter; RhsIterator m_rhsIter; const BinaryOp& m_functor; }; enum { CoeffReadCost = int(evaluator::CoeffReadCost) + int(evaluator::CoeffReadCost) + int(functor_traits::Cost), Flags = XprType::Flags }; explicit sparse_conjunction_evaluator(const XprType& xpr) : m_functor(xpr.functor()), m_lhsImpl(xpr.lhs()), m_rhsImpl(xpr.rhs()) { EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); } inline Index nonZerosEstimate() const { return (std::min)(m_lhsImpl.nonZerosEstimate(), m_rhsImpl.nonZerosEstimate()); } protected: const BinaryOp m_functor; evaluator m_lhsImpl; evaluator m_rhsImpl; }; // "dense ^ sparse" template struct sparse_conjunction_evaluator : evaluator_base { protected: typedef typename XprType::Functor BinaryOp; typedef typename XprType::Lhs LhsArg; typedef typename XprType::Rhs RhsArg; typedef evaluator LhsEvaluator; typedef typename evaluator::InnerIterator RhsIterator; typedef typename XprType::StorageIndex StorageIndex; typedef typename traits::Scalar Scalar; public: class InnerIterator { enum { IsRowMajor = (int(RhsArg::Flags)&RowMajorBit)==RowMajorBit }; public: EIGEN_STRONG_INLINE InnerIterator(const sparse_conjunction_evaluator& aEval, Index outer) : m_lhsEval(aEval.m_lhsImpl), m_rhsIter(aEval.m_rhsImpl,outer), m_functor(aEval.m_functor), m_outer(outer) {} EIGEN_STRONG_INLINE InnerIterator& operator++() { ++m_rhsIter; return *this; } EIGEN_STRONG_INLINE Scalar value() const { return m_functor(m_lhsEval.coeff(IsRowMajor?m_outer:m_rhsIter.index(),IsRowMajor?m_rhsIter.index():m_outer), m_rhsIter.value()); } EIGEN_STRONG_INLINE StorageIndex index() const { return m_rhsIter.index(); } EIGEN_STRONG_INLINE Index outer() const { return m_rhsIter.outer(); } EIGEN_STRONG_INLINE Index row() const { return m_rhsIter.row(); } EIGEN_STRONG_INLINE Index col() const { return m_rhsIter.col(); } EIGEN_STRONG_INLINE operator bool() const { return m_rhsIter; } protected: const LhsEvaluator &m_lhsEval; RhsIterator m_rhsIter; const BinaryOp& m_functor; const Index m_outer; }; enum { CoeffReadCost = int(evaluator::CoeffReadCost) + int(evaluator::CoeffReadCost) + int(functor_traits::Cost), Flags = XprType::Flags }; explicit sparse_conjunction_evaluator(const XprType& xpr) : m_functor(xpr.functor()), m_lhsImpl(xpr.lhs()), m_rhsImpl(xpr.rhs()) { EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); } inline Index nonZerosEstimate() const { return m_rhsImpl.nonZerosEstimate(); } protected: const BinaryOp m_functor; evaluator m_lhsImpl; evaluator m_rhsImpl; }; // "sparse ^ dense" template struct sparse_conjunction_evaluator : evaluator_base { protected: typedef typename XprType::Functor BinaryOp; typedef typename XprType::Lhs LhsArg; typedef typename XprType::Rhs RhsArg; typedef typename evaluator::InnerIterator LhsIterator; typedef evaluator RhsEvaluator; typedef typename XprType::StorageIndex StorageIndex; typedef typename traits::Scalar Scalar; public: class InnerIterator { enum { IsRowMajor = (int(LhsArg::Flags)&RowMajorBit)==RowMajorBit }; public: EIGEN_STRONG_INLINE InnerIterator(const sparse_conjunction_evaluator& aEval, Index outer) : m_lhsIter(aEval.m_lhsImpl,outer), m_rhsEval(aEval.m_rhsImpl), m_functor(aEval.m_functor), m_outer(outer) {} EIGEN_STRONG_INLINE InnerIterator& operator++() { ++m_lhsIter; return *this; } EIGEN_STRONG_INLINE Scalar value() const { return m_functor(m_lhsIter.value(), m_rhsEval.coeff(IsRowMajor?m_outer:m_lhsIter.index(),IsRowMajor?m_lhsIter.index():m_outer)); } EIGEN_STRONG_INLINE StorageIndex index() const { return m_lhsIter.index(); } EIGEN_STRONG_INLINE Index outer() const { return m_lhsIter.outer(); } EIGEN_STRONG_INLINE Index row() const { return m_lhsIter.row(); } EIGEN_STRONG_INLINE Index col() const { return m_lhsIter.col(); } EIGEN_STRONG_INLINE operator bool() const { return m_lhsIter; } protected: LhsIterator m_lhsIter; const evaluator &m_rhsEval; const BinaryOp& m_functor; const Index m_outer; }; enum { CoeffReadCost = int(evaluator::CoeffReadCost) + int(evaluator::CoeffReadCost) + int(functor_traits::Cost), Flags = XprType::Flags }; explicit sparse_conjunction_evaluator(const XprType& xpr) : m_functor(xpr.functor()), m_lhsImpl(xpr.lhs()), m_rhsImpl(xpr.rhs()) { EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); } inline Index nonZerosEstimate() const { return m_lhsImpl.nonZerosEstimate(); } protected: const BinaryOp m_functor; evaluator m_lhsImpl; evaluator m_rhsImpl; }; } /*************************************************************************** * Implementation of SparseMatrixBase and SparseCwise functions/operators ***************************************************************************/ template template Derived& SparseMatrixBase::operator+=(const EigenBase &other) { call_assignment(derived(), other.derived(), internal::add_assign_op()); return derived(); } template template Derived& SparseMatrixBase::operator-=(const EigenBase &other) { call_assignment(derived(), other.derived(), internal::assign_op()); return derived(); } template template EIGEN_STRONG_INLINE Derived & SparseMatrixBase::operator-=(const SparseMatrixBase &other) { return derived() = derived() - other.derived(); } template template EIGEN_STRONG_INLINE Derived & SparseMatrixBase::operator+=(const SparseMatrixBase& other) { return derived() = derived() + other.derived(); } template template Derived& SparseMatrixBase::operator+=(const DiagonalBase& other) { call_assignment_no_alias(derived(), other.derived(), internal::add_assign_op()); return derived(); } template template Derived& SparseMatrixBase::operator-=(const DiagonalBase& other) { call_assignment_no_alias(derived(), other.derived(), internal::sub_assign_op()); return derived(); } template template EIGEN_STRONG_INLINE const typename SparseMatrixBase::template CwiseProductDenseReturnType::Type SparseMatrixBase::cwiseProduct(const MatrixBase &other) const { return typename CwiseProductDenseReturnType::Type(derived(), other.derived()); } template EIGEN_STRONG_INLINE const CwiseBinaryOp, const DenseDerived, const SparseDerived> operator+(const MatrixBase &a, const SparseMatrixBase &b) { return CwiseBinaryOp, const DenseDerived, const SparseDerived>(a.derived(), b.derived()); } template EIGEN_STRONG_INLINE const CwiseBinaryOp, const SparseDerived, const DenseDerived> operator+(const SparseMatrixBase &a, const MatrixBase &b) { return CwiseBinaryOp, const SparseDerived, const DenseDerived>(a.derived(), b.derived()); } template EIGEN_STRONG_INLINE const CwiseBinaryOp, const DenseDerived, const SparseDerived> operator-(const MatrixBase &a, const SparseMatrixBase &b) { return CwiseBinaryOp, const DenseDerived, const SparseDerived>(a.derived(), b.derived()); } template EIGEN_STRONG_INLINE const CwiseBinaryOp, const SparseDerived, const DenseDerived> operator-(const SparseMatrixBase &a, const MatrixBase &b) { return CwiseBinaryOp, const SparseDerived, const DenseDerived>(a.derived(), b.derived()); } } // end namespace Eigen #endif // EIGEN_SPARSE_CWISE_BINARY_OP_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2015 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSE_CWISE_UNARY_OP_H #define EIGEN_SPARSE_CWISE_UNARY_OP_H namespace Eigen { namespace internal { template struct unary_evaluator, IteratorBased> : public evaluator_base > { public: typedef CwiseUnaryOp XprType; class InnerIterator; enum { CoeffReadCost = int(evaluator::CoeffReadCost) + int(functor_traits::Cost), Flags = XprType::Flags }; explicit unary_evaluator(const XprType& op) : m_functor(op.functor()), m_argImpl(op.nestedExpression()) { EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); } inline Index nonZerosEstimate() const { return m_argImpl.nonZerosEstimate(); } protected: typedef typename evaluator::InnerIterator EvalIterator; const UnaryOp m_functor; evaluator m_argImpl; }; template class unary_evaluator, IteratorBased>::InnerIterator : public unary_evaluator, IteratorBased>::EvalIterator { protected: typedef typename XprType::Scalar Scalar; typedef typename unary_evaluator, IteratorBased>::EvalIterator Base; public: EIGEN_STRONG_INLINE InnerIterator(const unary_evaluator& unaryOp, Index outer) : Base(unaryOp.m_argImpl,outer), m_functor(unaryOp.m_functor) {} EIGEN_STRONG_INLINE InnerIterator& operator++() { Base::operator++(); return *this; } EIGEN_STRONG_INLINE Scalar value() const { return m_functor(Base::value()); } protected: const UnaryOp m_functor; private: Scalar& valueRef(); }; template struct unary_evaluator, IteratorBased> : public evaluator_base > { public: typedef CwiseUnaryView XprType; class InnerIterator; enum { CoeffReadCost = int(evaluator::CoeffReadCost) + int(functor_traits::Cost), Flags = XprType::Flags }; explicit unary_evaluator(const XprType& op) : m_functor(op.functor()), m_argImpl(op.nestedExpression()) { EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); } protected: typedef typename evaluator::InnerIterator EvalIterator; const ViewOp m_functor; evaluator m_argImpl; }; template class unary_evaluator, IteratorBased>::InnerIterator : public unary_evaluator, IteratorBased>::EvalIterator { protected: typedef typename XprType::Scalar Scalar; typedef typename unary_evaluator, IteratorBased>::EvalIterator Base; public: EIGEN_STRONG_INLINE InnerIterator(const unary_evaluator& unaryOp, Index outer) : Base(unaryOp.m_argImpl,outer), m_functor(unaryOp.m_functor) {} EIGEN_STRONG_INLINE InnerIterator& operator++() { Base::operator++(); return *this; } EIGEN_STRONG_INLINE Scalar value() const { return m_functor(Base::value()); } EIGEN_STRONG_INLINE Scalar& valueRef() { return m_functor(Base::valueRef()); } protected: const ViewOp m_functor; }; } // end namespace internal template EIGEN_STRONG_INLINE Derived& SparseMatrixBase::operator*=(const Scalar& other) { typedef typename internal::evaluator::InnerIterator EvalIterator; internal::evaluator thisEval(derived()); for (Index j=0; j EIGEN_STRONG_INLINE Derived& SparseMatrixBase::operator/=(const Scalar& other) { typedef typename internal::evaluator::InnerIterator EvalIterator; internal::evaluator thisEval(derived()); for (Index j=0; j // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSEDENSEPRODUCT_H #define EIGEN_SPARSEDENSEPRODUCT_H namespace Eigen { namespace internal { template <> struct product_promote_storage_type { typedef Sparse ret; }; template <> struct product_promote_storage_type { typedef Sparse ret; }; template struct sparse_time_dense_product_impl; template struct sparse_time_dense_product_impl { typedef typename internal::remove_all::type Lhs; typedef typename internal::remove_all::type Rhs; typedef typename internal::remove_all::type Res; typedef typename evaluator::InnerIterator LhsInnerIterator; typedef evaluator LhsEval; static void run(const SparseLhsType& lhs, const DenseRhsType& rhs, DenseResType& res, const typename Res::Scalar& alpha) { LhsEval lhsEval(lhs); Index n = lhs.outerSize(); #ifdef EIGEN_HAS_OPENMP Eigen::initParallel(); Index threads = Eigen::nbThreads(); #endif for(Index c=0; c1 && lhsEval.nonZerosEstimate() > 20000) { #pragma omp parallel for schedule(dynamic,(n+threads*4-1)/(threads*4)) num_threads(threads) for(Index i=0; i let's disable it for now as it is conflicting with generic scalar*matrix and matrix*scalar operators // template // struct ScalarBinaryOpTraits > // { // enum { // Defined = 1 // }; // typedef typename CwiseUnaryOp, T2>::PlainObject ReturnType; // }; template struct sparse_time_dense_product_impl { typedef typename internal::remove_all::type Lhs; typedef typename internal::remove_all::type Rhs; typedef typename internal::remove_all::type Res; typedef evaluator LhsEval; typedef typename LhsEval::InnerIterator LhsInnerIterator; static void run(const SparseLhsType& lhs, const DenseRhsType& rhs, DenseResType& res, const AlphaType& alpha) { LhsEval lhsEval(lhs); for(Index c=0; c::ReturnType rhs_j(alpha * rhs.coeff(j,c)); for(LhsInnerIterator it(lhsEval,j); it ;++it) res.coeffRef(it.index(),c) += it.value() * rhs_j; } } } }; template struct sparse_time_dense_product_impl { typedef typename internal::remove_all::type Lhs; typedef typename internal::remove_all::type Rhs; typedef typename internal::remove_all::type Res; typedef evaluator LhsEval; typedef typename LhsEval::InnerIterator LhsInnerIterator; static void run(const SparseLhsType& lhs, const DenseRhsType& rhs, DenseResType& res, const typename Res::Scalar& alpha) { Index n = lhs.rows(); LhsEval lhsEval(lhs); #ifdef EIGEN_HAS_OPENMP Eigen::initParallel(); Index threads = Eigen::nbThreads(); // This 20000 threshold has been found experimentally on 2D and 3D Poisson problems. // It basically represents the minimal amount of work to be done to be worth it. if(threads>1 && lhsEval.nonZerosEstimate()*rhs.cols() > 20000) { #pragma omp parallel for schedule(dynamic,(n+threads*4-1)/(threads*4)) num_threads(threads) for(Index i=0; i struct sparse_time_dense_product_impl { typedef typename internal::remove_all::type Lhs; typedef typename internal::remove_all::type Rhs; typedef typename internal::remove_all::type Res; typedef typename evaluator::InnerIterator LhsInnerIterator; static void run(const SparseLhsType& lhs, const DenseRhsType& rhs, DenseResType& res, const typename Res::Scalar& alpha) { evaluator lhsEval(lhs); for(Index j=0; j inline void sparse_time_dense_product(const SparseLhsType& lhs, const DenseRhsType& rhs, DenseResType& res, const AlphaType& alpha) { sparse_time_dense_product_impl::run(lhs, rhs, res, alpha); } } // end namespace internal namespace internal { template struct generic_product_impl : generic_product_impl_base > { typedef typename Product::Scalar Scalar; template static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) { typedef typename nested_eval::type LhsNested; typedef typename nested_eval::type RhsNested; LhsNested lhsNested(lhs); RhsNested rhsNested(rhs); internal::sparse_time_dense_product(lhsNested, rhsNested, dst, alpha); } }; template struct generic_product_impl : generic_product_impl {}; template struct generic_product_impl : generic_product_impl_base > { typedef typename Product::Scalar Scalar; template static void scaleAndAddTo(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) { typedef typename nested_eval::type LhsNested; typedef typename nested_eval::type RhsNested; LhsNested lhsNested(lhs); RhsNested rhsNested(rhs); // transpose everything Transpose dstT(dst); internal::sparse_time_dense_product(rhsNested.transpose(), lhsNested.transpose(), dstT, alpha); } }; template struct generic_product_impl : generic_product_impl {}; template struct sparse_dense_outer_product_evaluator { protected: typedef typename conditional::type Lhs1; typedef typename conditional::type ActualRhs; typedef Product ProdXprType; // if the actual left-hand side is a dense vector, // then build a sparse-view so that we can seamlessly iterate over it. typedef typename conditional::StorageKind,Sparse>::value, Lhs1, SparseView >::type ActualLhs; typedef typename conditional::StorageKind,Sparse>::value, Lhs1 const&, SparseView >::type LhsArg; typedef evaluator LhsEval; typedef evaluator RhsEval; typedef typename evaluator::InnerIterator LhsIterator; typedef typename ProdXprType::Scalar Scalar; public: enum { Flags = NeedToTranspose ? RowMajorBit : 0, CoeffReadCost = HugeCost }; class InnerIterator : public LhsIterator { public: InnerIterator(const sparse_dense_outer_product_evaluator &xprEval, Index outer) : LhsIterator(xprEval.m_lhsXprImpl, 0), m_outer(outer), m_empty(false), m_factor(get(xprEval.m_rhsXprImpl, outer, typename internal::traits::StorageKind() )) {} EIGEN_STRONG_INLINE Index outer() const { return m_outer; } EIGEN_STRONG_INLINE Index row() const { return NeedToTranspose ? m_outer : LhsIterator::index(); } EIGEN_STRONG_INLINE Index col() const { return NeedToTranspose ? LhsIterator::index() : m_outer; } EIGEN_STRONG_INLINE Scalar value() const { return LhsIterator::value() * m_factor; } EIGEN_STRONG_INLINE operator bool() const { return LhsIterator::operator bool() && (!m_empty); } protected: Scalar get(const RhsEval &rhs, Index outer, Dense = Dense()) const { return rhs.coeff(outer); } Scalar get(const RhsEval &rhs, Index outer, Sparse = Sparse()) { typename RhsEval::InnerIterator it(rhs, outer); if (it && it.index()==0 && it.value()!=Scalar(0)) return it.value(); m_empty = true; return Scalar(0); } Index m_outer; bool m_empty; Scalar m_factor; }; sparse_dense_outer_product_evaluator(const Lhs1 &lhs, const ActualRhs &rhs) : m_lhs(lhs), m_lhsXprImpl(m_lhs), m_rhsXprImpl(rhs) { EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); } // transpose case sparse_dense_outer_product_evaluator(const ActualRhs &rhs, const Lhs1 &lhs) : m_lhs(lhs), m_lhsXprImpl(m_lhs), m_rhsXprImpl(rhs) { EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); } protected: const LhsArg m_lhs; evaluator m_lhsXprImpl; evaluator m_rhsXprImpl; }; // sparse * dense outer product template struct product_evaluator, OuterProduct, SparseShape, DenseShape> : sparse_dense_outer_product_evaluator { typedef sparse_dense_outer_product_evaluator Base; typedef Product XprType; typedef typename XprType::PlainObject PlainObject; explicit product_evaluator(const XprType& xpr) : Base(xpr.lhs(), xpr.rhs()) {} }; template struct product_evaluator, OuterProduct, DenseShape, SparseShape> : sparse_dense_outer_product_evaluator { typedef sparse_dense_outer_product_evaluator Base; typedef Product XprType; typedef typename XprType::PlainObject PlainObject; explicit product_evaluator(const XprType& xpr) : Base(xpr.lhs(), xpr.rhs()) {} }; } // end namespace internal } // end namespace Eigen #endif // EIGEN_SPARSEDENSEPRODUCT_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseDiagonalProduct.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009-2015 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSE_DIAGONAL_PRODUCT_H #define EIGEN_SPARSE_DIAGONAL_PRODUCT_H namespace Eigen { // The product of a diagonal matrix with a sparse matrix can be easily // implemented using expression template. // We have two consider very different cases: // 1 - diag * row-major sparse // => each inner vector <=> scalar * sparse vector product // => so we can reuse CwiseUnaryOp::InnerIterator // 2 - diag * col-major sparse // => each inner vector <=> densevector * sparse vector cwise product // => again, we can reuse specialization of CwiseBinaryOp::InnerIterator // for that particular case // The two other cases are symmetric. namespace internal { enum { SDP_AsScalarProduct, SDP_AsCwiseProduct }; template struct sparse_diagonal_product_evaluator; template struct product_evaluator, ProductTag, DiagonalShape, SparseShape> : public sparse_diagonal_product_evaluator { typedef Product XprType; enum { CoeffReadCost = HugeCost, Flags = Rhs::Flags&RowMajorBit, Alignment = 0 }; // FIXME CoeffReadCost & Flags typedef sparse_diagonal_product_evaluator Base; explicit product_evaluator(const XprType& xpr) : Base(xpr.rhs(), xpr.lhs().diagonal()) {} }; template struct product_evaluator, ProductTag, SparseShape, DiagonalShape> : public sparse_diagonal_product_evaluator, Lhs::Flags&RowMajorBit?SDP_AsCwiseProduct:SDP_AsScalarProduct> { typedef Product XprType; enum { CoeffReadCost = HugeCost, Flags = Lhs::Flags&RowMajorBit, Alignment = 0 }; // FIXME CoeffReadCost & Flags typedef sparse_diagonal_product_evaluator, Lhs::Flags&RowMajorBit?SDP_AsCwiseProduct:SDP_AsScalarProduct> Base; explicit product_evaluator(const XprType& xpr) : Base(xpr.lhs(), xpr.rhs().diagonal().transpose()) {} }; template struct sparse_diagonal_product_evaluator { protected: typedef typename evaluator::InnerIterator SparseXprInnerIterator; typedef typename SparseXprType::Scalar Scalar; public: class InnerIterator : public SparseXprInnerIterator { public: InnerIterator(const sparse_diagonal_product_evaluator &xprEval, Index outer) : SparseXprInnerIterator(xprEval.m_sparseXprImpl, outer), m_coeff(xprEval.m_diagCoeffImpl.coeff(outer)) {} EIGEN_STRONG_INLINE Scalar value() const { return m_coeff * SparseXprInnerIterator::value(); } protected: typename DiagonalCoeffType::Scalar m_coeff; }; sparse_diagonal_product_evaluator(const SparseXprType &sparseXpr, const DiagonalCoeffType &diagCoeff) : m_sparseXprImpl(sparseXpr), m_diagCoeffImpl(diagCoeff) {} Index nonZerosEstimate() const { return m_sparseXprImpl.nonZerosEstimate(); } protected: evaluator m_sparseXprImpl; evaluator m_diagCoeffImpl; }; template struct sparse_diagonal_product_evaluator { typedef typename SparseXprType::Scalar Scalar; typedef typename SparseXprType::StorageIndex StorageIndex; typedef typename nested_eval::type DiagCoeffNested; class InnerIterator { typedef typename evaluator::InnerIterator SparseXprIter; public: InnerIterator(const sparse_diagonal_product_evaluator &xprEval, Index outer) : m_sparseIter(xprEval.m_sparseXprEval, outer), m_diagCoeffNested(xprEval.m_diagCoeffNested) {} inline Scalar value() const { return m_sparseIter.value() * m_diagCoeffNested.coeff(index()); } inline StorageIndex index() const { return m_sparseIter.index(); } inline Index outer() const { return m_sparseIter.outer(); } inline Index col() const { return SparseXprType::IsRowMajor ? m_sparseIter.index() : m_sparseIter.outer(); } inline Index row() const { return SparseXprType::IsRowMajor ? m_sparseIter.outer() : m_sparseIter.index(); } EIGEN_STRONG_INLINE InnerIterator& operator++() { ++m_sparseIter; return *this; } inline operator bool() const { return m_sparseIter; } protected: SparseXprIter m_sparseIter; DiagCoeffNested m_diagCoeffNested; }; sparse_diagonal_product_evaluator(const SparseXprType &sparseXpr, const DiagCoeffType &diagCoeff) : m_sparseXprEval(sparseXpr), m_diagCoeffNested(diagCoeff) {} Index nonZerosEstimate() const { return m_sparseXprEval.nonZerosEstimate(); } protected: evaluator m_sparseXprEval; DiagCoeffNested m_diagCoeffNested; }; } // end namespace internal } // end namespace Eigen #endif // EIGEN_SPARSE_DIAGONAL_PRODUCT_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseDot.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSE_DOT_H #define EIGEN_SPARSE_DOT_H namespace Eigen { template template typename internal::traits::Scalar SparseMatrixBase::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()); eigen_assert(other.size()>0 && "you are using a non initialized vector"); internal::evaluator thisEval(derived()); typename internal::evaluator::InnerIterator i(thisEval, 0); Scalar res(0); while (i) { res += numext::conj(i.value()) * other.coeff(i.index()); ++i; } return res; } template template typename internal::traits::Scalar SparseMatrixBase::dot(const SparseMatrixBase& 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()); internal::evaluator thisEval(derived()); typename internal::evaluator::InnerIterator i(thisEval, 0); internal::evaluator otherEval(other.derived()); typename internal::evaluator::InnerIterator j(otherEval, 0); Scalar res(0); while (i && j) { if (i.index()==j.index()) { res += numext::conj(i.value()) * j.value(); ++i; ++j; } else if (i.index() inline typename NumTraits::Scalar>::Real SparseMatrixBase::squaredNorm() const { return numext::real((*this).cwiseAbs2().sum()); } template inline typename NumTraits::Scalar>::Real SparseMatrixBase::norm() const { using std::sqrt; return sqrt(squaredNorm()); } template inline typename NumTraits::Scalar>::Real SparseMatrixBase::blueNorm() const { return internal::blueNorm_impl(*this); } } // end namespace Eigen #endif // EIGEN_SPARSE_DOT_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseFuzzy.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSE_FUZZY_H #define EIGEN_SPARSE_FUZZY_H namespace Eigen { template template bool SparseMatrixBase::isApprox(const SparseMatrixBase& other, const RealScalar &prec) const { const typename internal::nested_eval::type actualA(derived()); typename internal::conditional::type, const PlainObject>::type actualB(other.derived()); return (actualA - actualB).squaredNorm() <= prec * prec * numext::mini(actualA.squaredNorm(), actualB.squaredNorm()); } } // end namespace Eigen #endif // EIGEN_SPARSE_FUZZY_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseMap.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2015 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSE_MAP_H #define EIGEN_SPARSE_MAP_H namespace Eigen { namespace internal { template struct traits, Options, StrideType> > : public traits > { typedef SparseMatrix PlainObjectType; typedef traits TraitsBase; enum { Flags = TraitsBase::Flags & (~NestByRefBit) }; }; template struct traits, Options, StrideType> > : public traits > { typedef SparseMatrix PlainObjectType; typedef traits TraitsBase; enum { Flags = TraitsBase::Flags & (~ (NestByRefBit | LvalueBit)) }; }; } // end namespace internal template::has_write_access ? WriteAccessors : ReadOnlyAccessors > class SparseMapBase; /** \ingroup SparseCore_Module * class SparseMapBase * \brief Common base class for Map and Ref instance of sparse matrix and vector. */ template class SparseMapBase : public SparseCompressedBase { public: typedef SparseCompressedBase Base; typedef typename Base::Scalar Scalar; typedef typename Base::StorageIndex StorageIndex; enum { IsRowMajor = Base::IsRowMajor }; using Base::operator=; protected: typedef typename internal::conditional< bool(internal::is_lvalue::value), Scalar *, const Scalar *>::type ScalarPointer; typedef typename internal::conditional< bool(internal::is_lvalue::value), StorageIndex *, const StorageIndex *>::type IndexPointer; Index m_outerSize; Index m_innerSize; Array m_zero_nnz; IndexPointer m_outerIndex; IndexPointer m_innerIndices; ScalarPointer m_values; IndexPointer m_innerNonZeros; public: /** \copydoc SparseMatrixBase::rows() */ inline Index rows() const { return IsRowMajor ? m_outerSize : m_innerSize; } /** \copydoc SparseMatrixBase::cols() */ inline Index cols() const { return IsRowMajor ? m_innerSize : m_outerSize; } /** \copydoc SparseMatrixBase::innerSize() */ inline Index innerSize() const { return m_innerSize; } /** \copydoc SparseMatrixBase::outerSize() */ inline Index outerSize() const { return m_outerSize; } /** \copydoc SparseCompressedBase::nonZeros */ inline Index nonZeros() const { return m_zero_nnz[1]; } /** \copydoc SparseCompressedBase::isCompressed */ bool isCompressed() const { return m_innerNonZeros==0; } //---------------------------------------- // direct access interface /** \copydoc SparseMatrix::valuePtr */ inline const Scalar* valuePtr() const { return m_values; } /** \copydoc SparseMatrix::innerIndexPtr */ inline const StorageIndex* innerIndexPtr() const { return m_innerIndices; } /** \copydoc SparseMatrix::outerIndexPtr */ inline const StorageIndex* outerIndexPtr() const { return m_outerIndex; } /** \copydoc SparseMatrix::innerNonZeroPtr */ inline const StorageIndex* innerNonZeroPtr() const { return m_innerNonZeros; } //---------------------------------------- /** \copydoc SparseMatrix::coeff */ inline Scalar coeff(Index row, Index col) const { const Index outer = IsRowMajor ? row : col; const Index inner = IsRowMajor ? col : row; Index start = m_outerIndex[outer]; Index end = isCompressed() ? m_outerIndex[outer+1] : start + m_innerNonZeros[outer]; if (start==end) return Scalar(0); else if (end>0 && inner==m_innerIndices[end-1]) return m_values[end-1]; // ^^ optimization: let's first check if it is the last coefficient // (very common in high level algorithms) const StorageIndex* r = std::lower_bound(&m_innerIndices[start],&m_innerIndices[end-1],inner); const Index id = r-&m_innerIndices[0]; return ((*r==inner) && (id(nnz)), m_outerIndex(outerIndexPtr), m_innerIndices(innerIndexPtr), m_values(valuePtr), m_innerNonZeros(innerNonZerosPtr) {} // for vectors inline SparseMapBase(Index size, Index nnz, IndexPointer innerIndexPtr, ScalarPointer valuePtr) : m_outerSize(1), m_innerSize(size), m_zero_nnz(0,internal::convert_index(nnz)), m_outerIndex(m_zero_nnz.data()), m_innerIndices(innerIndexPtr), m_values(valuePtr), m_innerNonZeros(0) {} /** Empty destructor */ inline ~SparseMapBase() {} protected: inline SparseMapBase() {} }; /** \ingroup SparseCore_Module * class SparseMapBase * \brief Common base class for writable Map and Ref instance of sparse matrix and vector. */ template class SparseMapBase : public SparseMapBase { typedef MapBase ReadOnlyMapBase; public: typedef SparseMapBase Base; typedef typename Base::Scalar Scalar; typedef typename Base::StorageIndex StorageIndex; enum { IsRowMajor = Base::IsRowMajor }; using Base::operator=; public: //---------------------------------------- // direct access interface using Base::valuePtr; using Base::innerIndexPtr; using Base::outerIndexPtr; using Base::innerNonZeroPtr; /** \copydoc SparseMatrix::valuePtr */ inline Scalar* valuePtr() { return Base::m_values; } /** \copydoc SparseMatrix::innerIndexPtr */ inline StorageIndex* innerIndexPtr() { return Base::m_innerIndices; } /** \copydoc SparseMatrix::outerIndexPtr */ inline StorageIndex* outerIndexPtr() { return Base::m_outerIndex; } /** \copydoc SparseMatrix::innerNonZeroPtr */ inline StorageIndex* innerNonZeroPtr() { return Base::m_innerNonZeros; } //---------------------------------------- /** \copydoc SparseMatrix::coeffRef */ inline Scalar& coeffRef(Index row, Index col) { const Index outer = IsRowMajor ? row : col; const Index inner = IsRowMajor ? col : row; Index start = Base::m_outerIndex[outer]; Index end = Base::isCompressed() ? Base::m_outerIndex[outer+1] : start + Base::m_innerNonZeros[outer]; eigen_assert(end>=start && "you probably called coeffRef on a non finalized matrix"); eigen_assert(end>start && "coeffRef cannot be called on a zero coefficient"); StorageIndex* r = std::lower_bound(&Base::m_innerIndices[start],&Base::m_innerIndices[end],inner); const Index id = r - &Base::m_innerIndices[0]; eigen_assert((*r==inner) && (id(Base::m_values)[id]; } inline SparseMapBase(Index rows, Index cols, Index nnz, StorageIndex* outerIndexPtr, StorageIndex* innerIndexPtr, Scalar* valuePtr, StorageIndex* innerNonZerosPtr = 0) : Base(rows, cols, nnz, outerIndexPtr, innerIndexPtr, valuePtr, innerNonZerosPtr) {} // for vectors inline SparseMapBase(Index size, Index nnz, StorageIndex* innerIndexPtr, Scalar* valuePtr) : Base(size, nnz, innerIndexPtr, valuePtr) {} /** Empty destructor */ inline ~SparseMapBase() {} protected: inline SparseMapBase() {} }; /** \ingroup SparseCore_Module * * \brief Specialization of class Map for SparseMatrix-like storage. * * \tparam SparseMatrixType the equivalent sparse matrix type of the referenced data, it must be a template instance of class SparseMatrix. * * \sa class Map, class SparseMatrix, class Ref */ #ifndef EIGEN_PARSED_BY_DOXYGEN template class Map, Options, StrideType> : public SparseMapBase, Options, StrideType> > #else template class Map : public SparseMapBase #endif { public: typedef SparseMapBase Base; EIGEN_SPARSE_PUBLIC_INTERFACE(Map) enum { IsRowMajor = Base::IsRowMajor }; public: /** Constructs a read-write Map to a sparse matrix of size \a rows x \a cols, containing \a nnz non-zero coefficients, * stored as a sparse format as defined by the pointers \a outerIndexPtr, \a innerIndexPtr, and \a valuePtr. * If the optional parameter \a innerNonZerosPtr is the null pointer, then a standard compressed format is assumed. * * This constructor is available only if \c SparseMatrixType is non-const. * * More details on the expected storage schemes are given in the \ref TutorialSparse "manual pages". */ inline Map(Index rows, Index cols, Index nnz, StorageIndex* outerIndexPtr, StorageIndex* innerIndexPtr, Scalar* valuePtr, StorageIndex* innerNonZerosPtr = 0) : Base(rows, cols, nnz, outerIndexPtr, innerIndexPtr, valuePtr, innerNonZerosPtr) {} #ifndef EIGEN_PARSED_BY_DOXYGEN /** Empty destructor */ inline ~Map() {} }; template class Map, Options, StrideType> : public SparseMapBase, Options, StrideType> > { public: typedef SparseMapBase Base; EIGEN_SPARSE_PUBLIC_INTERFACE(Map) enum { IsRowMajor = Base::IsRowMajor }; public: #endif /** This is the const version of the above constructor. * * This constructor is available only if \c SparseMatrixType is const, e.g.: * \code Map > \endcode */ inline Map(Index rows, Index cols, Index nnz, const StorageIndex* outerIndexPtr, const StorageIndex* innerIndexPtr, const Scalar* valuePtr, const StorageIndex* innerNonZerosPtr = 0) : Base(rows, cols, nnz, outerIndexPtr, innerIndexPtr, valuePtr, innerNonZerosPtr) {} /** Empty destructor */ inline ~Map() {} }; namespace internal { template struct evaluator, Options, StrideType> > : evaluator, Options, StrideType> > > { typedef evaluator, Options, StrideType> > > Base; typedef Map, Options, StrideType> XprType; evaluator() : Base() {} explicit evaluator(const XprType &mat) : Base(mat) {} }; template struct evaluator, Options, StrideType> > : evaluator, Options, StrideType> > > { typedef evaluator, Options, StrideType> > > Base; typedef Map, Options, StrideType> XprType; evaluator() : Base() {} explicit evaluator(const XprType &mat) : Base(mat) {} }; } } // end namespace Eigen #endif // EIGEN_SPARSE_MAP_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseMatrix.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSEMATRIX_H #define EIGEN_SPARSEMATRIX_H namespace Eigen { /** \ingroup SparseCore_Module * * \class SparseMatrix * * \brief A versatible sparse matrix representation * * This class implements a more versatile variants of the common \em compressed row/column storage format. * Each colmun's (resp. row) non zeros are stored as a pair of value with associated row (resp. colmiun) index. * All the non zeros are stored in a single large buffer. Unlike the \em compressed format, there might be extra * space in between the nonzeros of two successive colmuns (resp. rows) such that insertion of new non-zero * can be done with limited memory reallocation and copies. * * A call to the function makeCompressed() turns the matrix into the standard \em compressed format * compatible with many library. * * More details on this storage sceheme are given in the \ref TutorialSparse "manual pages". * * \tparam Scalar_ the scalar type, i.e. the type of the coefficients * \tparam Options_ Union of bit flags controlling the storage scheme. Currently the only possibility * is ColMajor or RowMajor. The default is 0 which means column-major. * \tparam StorageIndex_ the type of the indices. It has to be a \b signed type (e.g., short, int, std::ptrdiff_t). Default is \c int. * * \warning In %Eigen 3.2, the undocumented type \c SparseMatrix::Index was improperly defined as the storage index type (e.g., int), * whereas it is now (starting from %Eigen 3.3) deprecated and always defined as Eigen::Index. * Codes making use of \c SparseMatrix::Index, might thus likely have to be changed to use \c SparseMatrix::StorageIndex instead. * * This class can be extended with the help of the plugin mechanism described on the page * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_SPARSEMATRIX_PLUGIN. */ namespace internal { template struct traits > { typedef Scalar_ Scalar; typedef StorageIndex_ StorageIndex; typedef Sparse StorageKind; typedef MatrixXpr XprKind; enum { RowsAtCompileTime = Dynamic, ColsAtCompileTime = Dynamic, MaxRowsAtCompileTime = Dynamic, MaxColsAtCompileTime = Dynamic, Flags = Options_ | NestByRefBit | LvalueBit | CompressedAccessBit, SupportedAccessPatterns = InnerRandomAccessPattern }; }; template struct traits, DiagIndex> > { typedef SparseMatrix MatrixType; typedef typename ref_selector::type MatrixTypeNested; typedef typename remove_reference::type _MatrixTypeNested; typedef Scalar_ Scalar; typedef Dense StorageKind; typedef StorageIndex_ StorageIndex; typedef MatrixXpr XprKind; enum { RowsAtCompileTime = Dynamic, ColsAtCompileTime = 1, MaxRowsAtCompileTime = Dynamic, MaxColsAtCompileTime = 1, Flags = LvalueBit }; }; template struct traits, DiagIndex> > : public traits, DiagIndex> > { enum { Flags = 0 }; }; } // end namespace internal template class SparseMatrix : public SparseCompressedBase > { typedef SparseCompressedBase Base; using Base::convert_index; friend class SparseVector; template friend struct internal::Assignment; public: using Base::isCompressed; using Base::nonZeros; EIGEN_SPARSE_PUBLIC_INTERFACE(SparseMatrix) using Base::operator+=; using Base::operator-=; typedef MappedSparseMatrix Map; typedef Diagonal DiagonalReturnType; typedef Diagonal ConstDiagonalReturnType; typedef typename Base::InnerIterator InnerIterator; typedef typename Base::ReverseInnerIterator ReverseInnerIterator; using Base::IsRowMajor; typedef internal::CompressedStorage Storage; enum { Options = Options_ }; typedef typename Base::IndexVector IndexVector; typedef typename Base::ScalarVector ScalarVector; protected: typedef SparseMatrix TransposedSparseMatrix; Index m_outerSize; Index m_innerSize; StorageIndex* m_outerIndex; StorageIndex* m_innerNonZeros; // optional, if null then the data is compressed Storage m_data; public: /** \returns the number of rows of the matrix */ inline Index rows() const { return IsRowMajor ? m_outerSize : m_innerSize; } /** \returns the number of columns of the matrix */ inline Index cols() const { return IsRowMajor ? m_innerSize : m_outerSize; } /** \returns the number of rows (resp. columns) of the matrix if the storage order column major (resp. row major) */ inline Index innerSize() const { return m_innerSize; } /** \returns the number of columns (resp. rows) of the matrix if the storage order column major (resp. row major) */ inline Index outerSize() const { return m_outerSize; } /** \returns a const pointer to the array of values. * This function is aimed at interoperability with other libraries. * \sa innerIndexPtr(), outerIndexPtr() */ inline const Scalar* valuePtr() const { return m_data.valuePtr(); } /** \returns a non-const pointer to the array of values. * This function is aimed at interoperability with other libraries. * \sa innerIndexPtr(), outerIndexPtr() */ inline Scalar* valuePtr() { return m_data.valuePtr(); } /** \returns a const pointer to the array of inner indices. * This function is aimed at interoperability with other libraries. * \sa valuePtr(), outerIndexPtr() */ inline const StorageIndex* innerIndexPtr() const { return m_data.indexPtr(); } /** \returns a non-const pointer to the array of inner indices. * This function is aimed at interoperability with other libraries. * \sa valuePtr(), outerIndexPtr() */ inline StorageIndex* innerIndexPtr() { return m_data.indexPtr(); } /** \returns a const pointer to the array of the starting positions of the inner vectors. * This function is aimed at interoperability with other libraries. * \sa valuePtr(), innerIndexPtr() */ inline const StorageIndex* outerIndexPtr() const { return m_outerIndex; } /** \returns a non-const pointer to the array of the starting positions of the inner vectors. * This function is aimed at interoperability with other libraries. * \sa valuePtr(), innerIndexPtr() */ inline StorageIndex* outerIndexPtr() { return m_outerIndex; } /** \returns a const pointer to the array of the number of non zeros of the inner vectors. * This function is aimed at interoperability with other libraries. * \warning it returns the null pointer 0 in compressed mode */ inline const StorageIndex* innerNonZeroPtr() const { return m_innerNonZeros; } /** \returns a non-const pointer to the array of the number of non zeros of the inner vectors. * This function is aimed at interoperability with other libraries. * \warning it returns the null pointer 0 in compressed mode */ inline StorageIndex* innerNonZeroPtr() { return m_innerNonZeros; } /** \internal */ inline Storage& data() { return m_data; } /** \internal */ inline const Storage& data() const { return m_data; } /** \returns the value of the matrix at position \a i, \a j * This function returns Scalar(0) if the element is an explicit \em zero */ inline Scalar coeff(Index row, Index col) const { eigen_assert(row>=0 && row=0 && col=0 && row=0 && col=start && "you probably called coeffRef on a non finalized matrix"); if(end<=start) return insert(row,col); const Index p = m_data.searchLowerIndex(start,end-1,StorageIndex(inner)); if((pinnerSize() non zeros if reserve(Index) has not been called earlier. * In this case, the insertion procedure is optimized for a \e sequential insertion mode where elements are assumed to be * inserted by increasing outer-indices. * * If that's not the case, then it is strongly recommended to either use a triplet-list to assemble the matrix, or to first * call reserve(const SizesType &) to reserve the appropriate number of non-zero elements per inner vector. * * Assuming memory has been appropriately reserved, this function performs a sorted insertion in O(1) * if the elements of each inner vector are inserted in increasing inner index order, and in O(nnz_j) for a random insertion. * */ Scalar& insert(Index row, Index col); public: /** Removes all non zeros but keep allocated memory * * This function does not free the currently allocated memory. To release as much as memory as possible, * call \code mat.data().squeeze(); \endcode after resizing it. * * \sa resize(Index,Index), data() */ inline void setZero() { m_data.clear(); std::fill_n(m_outerIndex, m_outerSize + 1, StorageIndex(0)); if(m_innerNonZeros) { std::fill_n(m_innerNonZeros, m_outerSize, StorageIndex(0)); } } /** Preallocates \a reserveSize non zeros. * * Precondition: the matrix must be in compressed mode. */ inline void reserve(Index reserveSize) { eigen_assert(isCompressed() && "This function does not make sense in non compressed mode."); m_data.reserve(reserveSize); } #ifdef EIGEN_PARSED_BY_DOXYGEN /** Preallocates \a reserveSize[\c j] non zeros for each column (resp. row) \c j. * * This function turns the matrix in non-compressed mode. * * The type \c SizesType must expose the following interface: \code typedef value_type; const value_type& operator[](i) const; \endcode * for \c i in the [0,this->outerSize()[ range. * Typical choices include std::vector, Eigen::VectorXi, Eigen::VectorXi::Constant, etc. */ template inline void reserve(const SizesType& reserveSizes); #else template inline void reserve(const SizesType& reserveSizes, const typename SizesType::value_type& enableif = #if (!EIGEN_COMP_MSVC) || (EIGEN_COMP_MSVC>=1500) // MSVC 2005 fails to compile with this typename typename #endif SizesType::value_type()) { EIGEN_UNUSED_VARIABLE(enableif); reserveInnerVectors(reserveSizes); } #endif // EIGEN_PARSED_BY_DOXYGEN protected: template inline void reserveInnerVectors(const SizesType& reserveSizes) { if(isCompressed()) { Index totalReserveSize = 0; // turn the matrix into non-compressed mode m_innerNonZeros = static_cast(std::malloc(m_outerSize * sizeof(StorageIndex))); if (!m_innerNonZeros) internal::throw_std_bad_alloc(); // temporarily use m_innerSizes to hold the new starting points. StorageIndex* newOuterIndex = m_innerNonZeros; StorageIndex count = 0; for(Index j=0; j=0; --j) { StorageIndex innerNNZ = previousOuterIndex - m_outerIndex[j]; for(Index i=innerNNZ-1; i>=0; --i) { m_data.index(newOuterIndex[j]+i) = m_data.index(m_outerIndex[j]+i); m_data.value(newOuterIndex[j]+i) = m_data.value(m_outerIndex[j]+i); } previousOuterIndex = m_outerIndex[j]; m_outerIndex[j] = newOuterIndex[j]; m_innerNonZeros[j] = innerNNZ; } if(m_outerSize>0) m_outerIndex[m_outerSize] = m_outerIndex[m_outerSize-1] + m_innerNonZeros[m_outerSize-1] + reserveSizes[m_outerSize-1]; m_data.resize(m_outerIndex[m_outerSize]); } else { StorageIndex* newOuterIndex = static_cast(std::malloc((m_outerSize+1)*sizeof(StorageIndex))); if (!newOuterIndex) internal::throw_std_bad_alloc(); StorageIndex count = 0; for(Index j=0; j(reserveSizes[j], alreadyReserved); count += toReserve + m_innerNonZeros[j]; } newOuterIndex[m_outerSize] = count; m_data.resize(count); for(Index j=m_outerSize-1; j>=0; --j) { Index offset = newOuterIndex[j] - m_outerIndex[j]; if(offset>0) { StorageIndex innerNNZ = m_innerNonZeros[j]; for(Index i=innerNNZ-1; i>=0; --i) { m_data.index(newOuterIndex[j]+i) = m_data.index(m_outerIndex[j]+i); m_data.value(newOuterIndex[j]+i) = m_data.value(m_outerIndex[j]+i); } } } std::swap(m_outerIndex, newOuterIndex); std::free(newOuterIndex); } } public: //--- low level purely coherent filling --- /** \internal * \returns a reference to the non zero coefficient at position \a row, \a col assuming that: * - the nonzero does not already exist * - the new coefficient is the last one according to the storage order * * Before filling a given inner vector you must call the statVec(Index) function. * * After an insertion session, you should call the finalize() function. * * \sa insert, insertBackByOuterInner, startVec */ inline Scalar& insertBack(Index row, Index col) { return insertBackByOuterInner(IsRowMajor?row:col, IsRowMajor?col:row); } /** \internal * \sa insertBack, startVec */ inline Scalar& insertBackByOuterInner(Index outer, Index inner) { eigen_assert(Index(m_outerIndex[outer+1]) == m_data.size() && "Invalid ordered insertion (invalid outer index)"); eigen_assert( (m_outerIndex[outer+1]-m_outerIndex[outer]==0 || m_data.index(m_data.size()-1)(m_data.size()); Index i = m_outerSize; // find the last filled column while (i>=0 && m_outerIndex[i]==0) --i; ++i; while (i<=m_outerSize) { m_outerIndex[i] = size; ++i; } } } //--- template void setFromTriplets(const InputIterators& begin, const InputIterators& end); template void setFromTriplets(const InputIterators& begin, const InputIterators& end, DupFunctor dup_func); void sumupDuplicates() { collapseDuplicates(internal::scalar_sum_op()); } template void collapseDuplicates(DupFunctor dup_func = DupFunctor()); //--- /** \internal * same as insert(Index,Index) except that the indices are given relative to the storage order */ Scalar& insertByOuterInner(Index j, Index i) { return insert(IsRowMajor ? j : i, IsRowMajor ? i : j); } /** Turns the matrix into the \em compressed format. */ void makeCompressed() { if(isCompressed()) return; eigen_internal_assert(m_outerIndex!=0 && m_outerSize>0); Index oldStart = m_outerIndex[1]; m_outerIndex[1] = m_innerNonZeros[0]; for(Index j=1; j0) { for(Index k=0; k(std::malloc(m_outerSize * sizeof(StorageIndex))); for (Index i = 0; i < m_outerSize; i++) { m_innerNonZeros[i] = m_outerIndex[i+1] - m_outerIndex[i]; } } /** Suppresses all nonzeros which are \b much \b smaller \b than \a reference under the tolerance \a epsilon */ void prune(const Scalar& reference, const RealScalar& epsilon = NumTraits::dummy_precision()) { prune(default_prunning_func(reference,epsilon)); } /** Turns the matrix into compressed format, and suppresses all nonzeros which do not satisfy the predicate \a keep. * The functor type \a KeepFunc must implement the following function: * \code * bool operator() (const Index& row, const Index& col, const Scalar& value) const; * \endcode * \sa prune(Scalar,RealScalar) */ template void prune(const KeepFunc& keep = KeepFunc()) { // TODO optimize the uncompressed mode to avoid moving and allocating the data twice makeCompressed(); StorageIndex k = 0; for(Index j=0; jrows() == rows && this->cols() == cols) return; // If one dimension is null, then there is nothing to be preserved if(rows==0 || cols==0) return resize(rows,cols); Index innerChange = IsRowMajor ? cols - this->cols() : rows - this->rows(); Index outerChange = IsRowMajor ? rows - this->rows() : cols - this->cols(); StorageIndex newInnerSize = convert_index(IsRowMajor ? cols : rows); // Deals with inner non zeros if (m_innerNonZeros) { // Resize m_innerNonZeros StorageIndex *newInnerNonZeros = static_cast(std::realloc(m_innerNonZeros, (m_outerSize + outerChange) * sizeof(StorageIndex))); if (!newInnerNonZeros) internal::throw_std_bad_alloc(); m_innerNonZeros = newInnerNonZeros; for(Index i=m_outerSize; i(std::malloc((m_outerSize + outerChange) * sizeof(StorageIndex))); if (!m_innerNonZeros) internal::throw_std_bad_alloc(); for(Index i = 0; i < m_outerSize + (std::min)(outerChange, Index(0)); i++) m_innerNonZeros[i] = m_outerIndex[i+1] - m_outerIndex[i]; for(Index i = m_outerSize; i < m_outerSize + outerChange; i++) m_innerNonZeros[i] = 0; } // Change the m_innerNonZeros in case of a decrease of inner size if (m_innerNonZeros && innerChange < 0) { for(Index i = 0; i < m_outerSize + (std::min)(outerChange, Index(0)); i++) { StorageIndex &n = m_innerNonZeros[i]; StorageIndex start = m_outerIndex[i]; while (n > 0 && m_data.index(start+n-1) >= newInnerSize) --n; } } m_innerSize = newInnerSize; // Re-allocate outer index structure if necessary if (outerChange == 0) return; StorageIndex *newOuterIndex = static_cast(std::realloc(m_outerIndex, (m_outerSize + outerChange + 1) * sizeof(StorageIndex))); if (!newOuterIndex) internal::throw_std_bad_alloc(); m_outerIndex = newOuterIndex; if (outerChange > 0) { StorageIndex lastIdx = m_outerSize == 0 ? 0 : m_outerIndex[m_outerSize]; for(Index i=m_outerSize; i(std::malloc((outerSize + 1) * sizeof(StorageIndex))); if (!m_outerIndex) internal::throw_std_bad_alloc(); m_outerSize = outerSize; } if(m_innerNonZeros) { std::free(m_innerNonZeros); m_innerNonZeros = 0; } std::fill_n(m_outerIndex, m_outerSize + 1, StorageIndex(0)); } /** \internal * Resize the nonzero vector to \a size */ void resizeNonZeros(Index size) { m_data.resize(size); } /** \returns a const expression of the diagonal coefficients. */ const ConstDiagonalReturnType diagonal() const { return ConstDiagonalReturnType(*this); } /** \returns a read-write expression of the diagonal coefficients. * \warning If the diagonal entries are written, then all diagonal * entries \b must already exist, otherwise an assertion will be raised. */ DiagonalReturnType diagonal() { return DiagonalReturnType(*this); } /** Default constructor yielding an empty \c 0 \c x \c 0 matrix */ inline SparseMatrix() : m_outerSize(-1), m_innerSize(0), m_outerIndex(0), m_innerNonZeros(0) { check_template_parameters(); resize(0, 0); } /** Constructs a \a rows \c x \a cols empty matrix */ inline SparseMatrix(Index rows, Index cols) : m_outerSize(0), m_innerSize(0), m_outerIndex(0), m_innerNonZeros(0) { check_template_parameters(); resize(rows, cols); } /** Constructs a sparse matrix from the sparse expression \a other */ template inline SparseMatrix(const SparseMatrixBase& other) : m_outerSize(0), m_innerSize(0), m_outerIndex(0), m_innerNonZeros(0) { 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) check_template_parameters(); const bool needToTranspose = (Flags & RowMajorBit) != (internal::evaluator::Flags & RowMajorBit); if (needToTranspose) *this = other.derived(); else { #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN #endif internal::call_assignment_no_alias(*this, other.derived()); } } /** Constructs a sparse matrix from the sparse selfadjoint view \a other */ template inline SparseMatrix(const SparseSelfAdjointView& other) : m_outerSize(0), m_innerSize(0), m_outerIndex(0), m_innerNonZeros(0) { check_template_parameters(); Base::operator=(other); } /** Copy constructor (it performs a deep copy) */ inline SparseMatrix(const SparseMatrix& other) : Base(), m_outerSize(0), m_innerSize(0), m_outerIndex(0), m_innerNonZeros(0) { check_template_parameters(); *this = other.derived(); } /** \brief Copy constructor with in-place evaluation */ template SparseMatrix(const ReturnByValue& other) : Base(), m_outerSize(0), m_innerSize(0), m_outerIndex(0), m_innerNonZeros(0) { check_template_parameters(); initAssignment(other); other.evalTo(*this); } /** \brief Copy constructor with in-place evaluation */ template explicit SparseMatrix(const DiagonalBase& other) : Base(), m_outerSize(0), m_innerSize(0), m_outerIndex(0), m_innerNonZeros(0) { check_template_parameters(); *this = other.derived(); } /** Swaps the content of two sparse matrices of the same type. * This is a fast operation that simply swaps the underlying pointers and parameters. */ inline void swap(SparseMatrix& other) { //EIGEN_DBG_SPARSE(std::cout << "SparseMatrix:: swap\n"); std::swap(m_outerIndex, other.m_outerIndex); std::swap(m_innerSize, other.m_innerSize); std::swap(m_outerSize, other.m_outerSize); std::swap(m_innerNonZeros, other.m_innerNonZeros); m_data.swap(other.m_data); } /** Sets *this to the identity matrix. * This function also turns the matrix into compressed mode, and drop any reserved memory. */ inline void setIdentity() { eigen_assert(rows() == cols() && "ONLY FOR SQUARED MATRICES"); this->m_data.resize(rows()); Eigen::Map(this->m_data.indexPtr(), rows()).setLinSpaced(0, StorageIndex(rows()-1)); Eigen::Map(this->m_data.valuePtr(), rows()).setOnes(); Eigen::Map(this->m_outerIndex, rows()+1).setLinSpaced(0, StorageIndex(rows())); std::free(m_innerNonZeros); m_innerNonZeros = 0; } inline SparseMatrix& operator=(const SparseMatrix& other) { if (other.isRValue()) { swap(other.const_cast_derived()); } else if(this!=&other) { #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN #endif initAssignment(other); if(other.isCompressed()) { internal::smart_copy(other.m_outerIndex, other.m_outerIndex + m_outerSize + 1, m_outerIndex); m_data = other.m_data; } else { Base::operator=(other); } } return *this; } #ifndef EIGEN_PARSED_BY_DOXYGEN template inline SparseMatrix& operator=(const EigenBase& other) { return Base::operator=(other.derived()); } template inline SparseMatrix& operator=(const Product& other); #endif // EIGEN_PARSED_BY_DOXYGEN template EIGEN_DONT_INLINE SparseMatrix& operator=(const SparseMatrixBase& other); friend std::ostream & operator << (std::ostream & s, const SparseMatrix& m) { EIGEN_DBG_SPARSE( s << "Nonzero entries:\n"; if(m.isCompressed()) { for (Index i=0; i&>(m); return s; } /** Destructor */ inline ~SparseMatrix() { std::free(m_outerIndex); std::free(m_innerNonZeros); } /** Overloaded for performance */ Scalar sum() const; # ifdef EIGEN_SPARSEMATRIX_PLUGIN # include EIGEN_SPARSEMATRIX_PLUGIN # endif protected: template void initAssignment(const Other& other) { resize(other.rows(), other.cols()); if(m_innerNonZeros) { std::free(m_innerNonZeros); m_innerNonZeros = 0; } } /** \internal * \sa insert(Index,Index) */ EIGEN_DONT_INLINE Scalar& insertCompressed(Index row, Index col); /** \internal * A vector object that is equal to 0 everywhere but v at the position i */ class SingletonVector { StorageIndex m_index; StorageIndex m_value; public: typedef StorageIndex value_type; SingletonVector(Index i, Index v) : m_index(convert_index(i)), m_value(convert_index(v)) {} StorageIndex operator[](Index i) const { return i==m_index ? m_value : 0; } }; /** \internal * \sa insert(Index,Index) */ EIGEN_DONT_INLINE Scalar& insertUncompressed(Index row, Index col); public: /** \internal * \sa insert(Index,Index) */ EIGEN_STRONG_INLINE Scalar& insertBackUncompressed(Index row, Index col) { const Index outer = IsRowMajor ? row : col; const Index inner = IsRowMajor ? col : row; eigen_assert(!isCompressed()); eigen_assert(m_innerNonZeros[outer]<=(m_outerIndex[outer+1] - m_outerIndex[outer])); Index p = m_outerIndex[outer] + m_innerNonZeros[outer]++; m_data.index(p) = convert_index(inner); return (m_data.value(p) = Scalar(0)); } protected: struct IndexPosPair { IndexPosPair(Index a_i, Index a_p) : i(a_i), p(a_p) {} Index i; Index p; }; /** \internal assign \a diagXpr to the diagonal of \c *this * There are different strategies: * 1 - if *this is overwritten (Func==assign_op) or *this is empty, then we can work treat *this as a dense vector expression. * 2 - otherwise, for each diagonal coeff, * 2.a - if it already exists, then we update it, * 2.b - otherwise, if *this is uncompressed and that the current inner-vector has empty room for at least 1 element, then we perform an in-place insertion. * 2.c - otherwise, we'll have to reallocate and copy everything, so instead of doing so for each new element, it is recorded in a std::vector. * 3 - at the end, if some entries failed to be inserted in-place, then we alloc a new buffer, copy each chunk at the right position, and insert the new elements. * * TODO: some piece of code could be isolated and reused for a general in-place update strategy. * TODO: if we start to defer the insertion of some elements (i.e., case 2.c executed once), * then it *might* be better to disable case 2.b since they will have to be copied anyway. */ template void assignDiagonal(const DiagXpr diagXpr, const Func& assignFunc) { Index n = diagXpr.size(); const bool overwrite = internal::is_same >::value; if(overwrite) { if((this->rows()!=n) || (this->cols()!=n)) this->resize(n, n); } if(m_data.size()==0 || overwrite) { typedef Array ArrayXI; this->makeCompressed(); this->resizeNonZeros(n); Eigen::Map(this->innerIndexPtr(), n).setLinSpaced(0,StorageIndex(n)-1); Eigen::Map(this->outerIndexPtr(), n+1).setLinSpaced(0,StorageIndex(n)); Eigen::Map > values = this->coeffs(); values.setZero(); internal::call_assignment_no_alias(values, diagXpr, assignFunc); } else { bool isComp = isCompressed(); internal::evaluator diaEval(diagXpr); std::vector newEntries; // 1 - try in-place update and record insertion failures for(Index i = 0; ilower_bound(i,i); Index p = lb.value; if(lb.found) { // the coeff already exists assignFunc.assignCoeff(m_data.value(p), diaEval.coeff(i)); } else if((!isComp) && m_innerNonZeros[i] < (m_outerIndex[i+1]-m_outerIndex[i])) { // non compressed mode with local room for inserting one element m_data.moveChunk(p, p+1, m_outerIndex[i]+m_innerNonZeros[i]-p); m_innerNonZeros[i]++; m_data.value(p) = Scalar(0); m_data.index(p) = StorageIndex(i); assignFunc.assignCoeff(m_data.value(p), diaEval.coeff(i)); } else { // defer insertion newEntries.push_back(IndexPosPair(i,p)); } } // 2 - insert deferred entries Index n_entries = Index(newEntries.size()); if(n_entries>0) { Storage newData(m_data.size()+n_entries); Index prev_p = 0; Index prev_i = 0; for(Index k=0; k::IsSigned,THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE); EIGEN_STATIC_ASSERT((Options&(ColMajor|RowMajor))==Options,INVALID_MATRIX_TEMPLATE_PARAMETERS); } struct default_prunning_func { default_prunning_func(const Scalar& ref, const RealScalar& eps) : reference(ref), epsilon(eps) {} inline bool operator() (const Index&, const Index&, const Scalar& value) const { return !internal::isMuchSmallerThan(value, reference, epsilon); } Scalar reference; RealScalar epsilon; }; }; namespace internal { template void set_from_triplets(const InputIterator& begin, const InputIterator& end, SparseMatrixType& mat, DupFunctor dup_func) { enum { IsRowMajor = SparseMatrixType::IsRowMajor }; typedef typename SparseMatrixType::Scalar Scalar; typedef typename SparseMatrixType::StorageIndex StorageIndex; SparseMatrix trMat(mat.rows(),mat.cols()); if(begin!=end) { // pass 1: count the nnz per inner-vector typename SparseMatrixType::IndexVector wi(trMat.outerSize()); wi.setZero(); for(InputIterator it(begin); it!=end; ++it) { eigen_assert(it->row()>=0 && it->row()col()>=0 && it->col()col() : it->row())++; } // pass 2: insert all the elements into trMat trMat.reserve(wi); for(InputIterator it(begin); it!=end; ++it) trMat.insertBackUncompressed(it->row(),it->col()) = it->value(); // pass 3: trMat.collapseDuplicates(dup_func); } // pass 4: transposed copy -> implicit sorting mat = trMat; } } /** Fill the matrix \c *this with the list of \em triplets defined by the iterator range \a begin - \a end. * * A \em triplet is a tuple (i,j,value) defining a non-zero element. * The input list of triplets does not have to be sorted, and can contains duplicated elements. * In any case, the result is a \b sorted and \b compressed sparse matrix where the duplicates have been summed up. * This is a \em O(n) operation, with \em n the number of triplet elements. * The initial contents of \c *this is destroyed. * The matrix \c *this must be properly resized beforehand using the SparseMatrix(Index,Index) constructor, * or the resize(Index,Index) method. The sizes are not extracted from the triplet list. * * The \a InputIterators value_type must provide the following interface: * \code * Scalar value() const; // the value * Scalar row() const; // the row index i * Scalar col() const; // the column index j * \endcode * See for instance the Eigen::Triplet template class. * * Here is a typical usage example: * \code typedef Triplet T; std::vector tripletList; tripletList.reserve(estimation_of_entries); for(...) { // ... tripletList.push_back(T(i,j,v_ij)); } SparseMatrixType m(rows,cols); m.setFromTriplets(tripletList.begin(), tripletList.end()); // m is ready to go! * \endcode * * \warning The list of triplets is read multiple times (at least twice). Therefore, it is not recommended to define * an abstract iterator over a complex data-structure that would be expensive to evaluate. The triplets should rather * be explicitly stored into a std::vector for instance. */ template template void SparseMatrix::setFromTriplets(const InputIterators& begin, const InputIterators& end) { internal::set_from_triplets >(begin, end, *this, internal::scalar_sum_op()); } /** The same as setFromTriplets but when duplicates are met the functor \a dup_func is applied: * \code * value = dup_func(OldValue, NewValue) * \endcode * Here is a C++11 example keeping the latest entry only: * \code * mat.setFromTriplets(triplets.begin(), triplets.end(), [] (const Scalar&,const Scalar &b) { return b; }); * \endcode */ template template void SparseMatrix::setFromTriplets(const InputIterators& begin, const InputIterators& end, DupFunctor dup_func) { internal::set_from_triplets, DupFunctor>(begin, end, *this, dup_func); } /** \internal */ template template void SparseMatrix::collapseDuplicates(DupFunctor dup_func) { eigen_assert(!isCompressed()); // TODO, in practice we should be able to use m_innerNonZeros for that task IndexVector wi(innerSize()); wi.fill(-1); StorageIndex count = 0; // for each inner-vector, wi[inner_index] will hold the position of first element into the index/value buffers for(Index j=0; j=start) { // we already meet this entry => accumulate it m_data.value(wi(i)) = dup_func(m_data.value(wi(i)), m_data.value(k)); } else { m_data.value(count) = m_data.value(k); m_data.index(count) = m_data.index(k); wi(i) = count; ++count; } } m_outerIndex[j] = start; } m_outerIndex[m_outerSize] = count; // turn the matrix into compressed form std::free(m_innerNonZeros); m_innerNonZeros = 0; m_data.resize(m_outerIndex[m_outerSize]); } template template EIGEN_DONT_INLINE SparseMatrix& SparseMatrix::operator=(const SparseMatrixBase& other) { 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) #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN #endif const bool needToTranspose = (Flags & RowMajorBit) != (internal::evaluator::Flags & RowMajorBit); if (needToTranspose) { #ifdef EIGEN_SPARSE_TRANSPOSED_COPY_PLUGIN EIGEN_SPARSE_TRANSPOSED_COPY_PLUGIN #endif // two passes algorithm: // 1 - compute the number of coeffs per dest inner vector // 2 - do the actual copy/eval // Since each coeff of the rhs has to be evaluated twice, let's evaluate it if needed typedef typename internal::nested_eval::type >::type OtherCopy; typedef typename internal::remove_all::type _OtherCopy; typedef internal::evaluator<_OtherCopy> OtherCopyEval; OtherCopy otherCopy(other.derived()); OtherCopyEval otherCopyEval(otherCopy); SparseMatrix dest(other.rows(),other.cols()); Eigen::Map (dest.m_outerIndex,dest.outerSize()).setZero(); // pass 1 // FIXME the above copy could be merged with that pass for (Index j=0; jswap(dest); return *this; } else { if(other.isRValue()) { initAssignment(other.derived()); } // there is no special optimization return Base::operator=(other.derived()); } } template typename SparseMatrix::Scalar& SparseMatrix::insert(Index row, Index col) { eigen_assert(row>=0 && row=0 && col(std::malloc(m_outerSize * sizeof(StorageIndex))); if(!m_innerNonZeros) internal::throw_std_bad_alloc(); std::fill(m_innerNonZeros, m_innerNonZeros + m_outerSize, StorageIndex(0)); // pack all inner-vectors to the end of the pre-allocated space // and allocate the entire free-space to the first inner-vector StorageIndex end = convert_index(m_data.allocatedSize()); for(Index j=1; j<=m_outerSize; ++j) m_outerIndex[j] = end; } else { // turn the matrix into non-compressed mode m_innerNonZeros = static_cast(std::malloc(m_outerSize * sizeof(StorageIndex))); if(!m_innerNonZeros) internal::throw_std_bad_alloc(); for(Index j=0; j=0 && m_innerNonZeros[j]==0) m_outerIndex[j--] = p; // push back the new element ++m_innerNonZeros[outer]; m_data.append(Scalar(0), inner); // check for reallocation if(data_end != m_data.allocatedSize()) { // m_data has been reallocated // -> move remaining inner-vectors back to the end of the free-space // so that the entire free-space is allocated to the current inner-vector. eigen_internal_assert(data_end < m_data.allocatedSize()); StorageIndex new_end = convert_index(m_data.allocatedSize()); for(Index k=outer+1; k<=m_outerSize; ++k) if(m_outerIndex[k]==data_end) m_outerIndex[k] = new_end; } return m_data.value(p); } // Second case: the next inner-vector is packed to the end // and the current inner-vector end match the used-space. if(m_outerIndex[outer+1]==data_end && m_outerIndex[outer]+m_innerNonZeros[outer]==m_data.size()) { eigen_internal_assert(outer+1==m_outerSize || m_innerNonZeros[outer+1]==0); // add space for the new element ++m_innerNonZeros[outer]; m_data.resize(m_data.size()+1); // check for reallocation if(data_end != m_data.allocatedSize()) { // m_data has been reallocated // -> move remaining inner-vectors back to the end of the free-space // so that the entire free-space is allocated to the current inner-vector. eigen_internal_assert(data_end < m_data.allocatedSize()); StorageIndex new_end = convert_index(m_data.allocatedSize()); for(Index k=outer+1; k<=m_outerSize; ++k) if(m_outerIndex[k]==data_end) m_outerIndex[k] = new_end; } // and insert it at the right position (sorted insertion) Index startId = m_outerIndex[outer]; Index p = m_outerIndex[outer]+m_innerNonZeros[outer]-1; while ( (p > startId) && (m_data.index(p-1) > inner) ) { m_data.index(p) = m_data.index(p-1); m_data.value(p) = m_data.value(p-1); --p; } m_data.index(p) = convert_index(inner); return (m_data.value(p) = Scalar(0)); } if(m_data.size() != m_data.allocatedSize()) { // make sure the matrix is compatible to random un-compressed insertion: m_data.resize(m_data.allocatedSize()); this->reserveInnerVectors(Array::Constant(m_outerSize, 2)); } return insertUncompressed(row,col); } template EIGEN_DONT_INLINE typename SparseMatrix::Scalar& SparseMatrix::insertUncompressed(Index row, Index col) { eigen_assert(!isCompressed()); const Index outer = IsRowMajor ? row : col; const StorageIndex inner = convert_index(IsRowMajor ? col : row); Index room = m_outerIndex[outer+1] - m_outerIndex[outer]; StorageIndex innerNNZ = m_innerNonZeros[outer]; if(innerNNZ>=room) { // this inner vector is full, we need to reallocate the whole buffer :( reserve(SingletonVector(outer,std::max(2,innerNNZ))); } Index startId = m_outerIndex[outer]; Index p = startId + m_innerNonZeros[outer]; while ( (p > startId) && (m_data.index(p-1) > inner) ) { m_data.index(p) = m_data.index(p-1); m_data.value(p) = m_data.value(p-1); --p; } eigen_assert((p<=startId || m_data.index(p-1)!=inner) && "you cannot insert an element that already exists, you must call coeffRef to this end"); m_innerNonZeros[outer]++; m_data.index(p) = inner; return (m_data.value(p) = Scalar(0)); } template EIGEN_DONT_INLINE typename SparseMatrix::Scalar& SparseMatrix::insertCompressed(Index row, Index col) { eigen_assert(isCompressed()); const Index outer = IsRowMajor ? row : col; const Index inner = IsRowMajor ? col : row; Index previousOuter = outer; if (m_outerIndex[outer+1]==0) { // we start a new inner vector while (previousOuter>=0 && m_outerIndex[previousOuter]==0) { m_outerIndex[previousOuter] = convert_index(m_data.size()); --previousOuter; } m_outerIndex[outer+1] = m_outerIndex[outer]; } // here we have to handle the tricky case where the outerIndex array // starts with: [ 0 0 0 0 0 1 ...] and we are inserted in, e.g., // the 2nd inner vector... bool isLastVec = (!(previousOuter==-1 && m_data.size()!=0)) && (std::size_t(m_outerIndex[outer+1]) == m_data.size()); std::size_t startId = m_outerIndex[outer]; // FIXME let's make sure sizeof(long int) == sizeof(std::size_t) std::size_t p = m_outerIndex[outer+1]; ++m_outerIndex[outer+1]; double reallocRatio = 1; if (m_data.allocatedSize()<=m_data.size()) { // if there is no preallocated memory, let's reserve a minimum of 32 elements if (m_data.size()==0) { m_data.reserve(32); } else { // we need to reallocate the data, to reduce multiple reallocations // we use a smart resize algorithm based on the current filling ratio // in addition, we use double to avoid integers overflows double nnzEstimate = double(m_outerIndex[outer])*double(m_outerSize)/double(outer+1); reallocRatio = (nnzEstimate-double(m_data.size()))/double(m_data.size()); // furthermore we bound the realloc ratio to: // 1) reduce multiple minor realloc when the matrix is almost filled // 2) avoid to allocate too much memory when the matrix is almost empty reallocRatio = (std::min)((std::max)(reallocRatio,1.5),8.); } } m_data.resize(m_data.size()+1,reallocRatio); if (!isLastVec) { if (previousOuter==-1) { // oops wrong guess. // let's correct the outer offsets for (Index k=0; k<=(outer+1); ++k) m_outerIndex[k] = 0; Index k=outer+1; while(m_outerIndex[k]==0) m_outerIndex[k++] = 1; while (k<=m_outerSize && m_outerIndex[k]!=0) m_outerIndex[k++]++; p = 0; --k; k = m_outerIndex[k]-1; while (k>0) { m_data.index(k) = m_data.index(k-1); m_data.value(k) = m_data.value(k-1); k--; } } else { // we are not inserting into the last inner vec // update outer indices: Index j = outer+2; while (j<=m_outerSize && m_outerIndex[j]!=0) m_outerIndex[j++]++; --j; // shift data of last vecs: Index k = m_outerIndex[j]-1; while (k>=Index(p)) { m_data.index(k) = m_data.index(k-1); m_data.value(k) = m_data.value(k-1); k--; } } } while ( (p > startId) && (m_data.index(p-1) > inner) ) { m_data.index(p) = m_data.index(p-1); m_data.value(p) = m_data.value(p-1); --p; } m_data.index(p) = inner; return (m_data.value(p) = Scalar(0)); } namespace internal { template struct evaluator > : evaluator > > { typedef evaluator > > Base; typedef SparseMatrix SparseMatrixType; evaluator() : Base() {} explicit evaluator(const SparseMatrixType &mat) : Base(mat) {} }; } } // end namespace Eigen #endif // EIGEN_SPARSEMATRIX_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseMatrixBase.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSEMATRIXBASE_H #define EIGEN_SPARSEMATRIXBASE_H namespace Eigen { /** \ingroup SparseCore_Module * * \class SparseMatrixBase * * \brief Base class of any sparse matrices or sparse expressions * * \tparam Derived is the derived type, e.g. a sparse matrix type, or an expression, etc. * * This class can be extended with the help of the plugin mechanism described on the page * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_SPARSEMATRIXBASE_PLUGIN. */ template class SparseMatrixBase : public EigenBase { public: typedef typename internal::traits::Scalar Scalar; /** The numeric type of the expression' coefficients, e.g. float, double, int or std::complex, etc. * * It is an alias for the Scalar type */ typedef Scalar value_type; typedef typename internal::packet_traits::type PacketScalar; typedef typename internal::traits::StorageKind StorageKind; /** The integer type used to \b store indices within a SparseMatrix. * For a \c SparseMatrix it an alias of the third template parameter \c IndexType. */ typedef typename internal::traits::StorageIndex StorageIndex; typedef typename internal::add_const_on_value_type_if_arithmetic< typename internal::packet_traits::type >::type PacketReturnType; typedef SparseMatrixBase StorageBaseType; typedef Matrix IndexVector; typedef Matrix ScalarVector; template Derived& operator=(const EigenBase &other); 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 = RowsAtCompileTime, MaxColsAtCompileTime = ColsAtCompileTime, MaxSizeAtCompileTime = (internal::size_at_compile_time::ret), IsVectorAtCompileTime = RowsAtCompileTime == 1 || ColsAtCompileTime == 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). */ NumDimensions = int(MaxSizeAtCompileTime) == 1 ? 0 : bool(IsVectorAtCompileTime) ? 1 : 2, /**< This value is equal to Tensor::NumDimensions, i.e. 0 for scalars, 1 for vectors, * and 2 for matrices. */ 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 = Flags&RowMajorBit ? 1 : 0, InnerSizeAtCompileTime = int(IsVectorAtCompileTime) ? int(SizeAtCompileTime) : int(IsRowMajor) ? int(ColsAtCompileTime) : int(RowsAtCompileTime), #ifndef EIGEN_PARSED_BY_DOXYGEN _HasDirectAccess = (int(Flags)&DirectAccessBit) ? 1 : 0 // workaround sunCC #endif }; /** \internal the return type of MatrixBase::adjoint() */ typedef typename internal::conditional::IsComplex, CwiseUnaryOp, Eigen::Transpose >, Transpose >::type AdjointReturnType; typedef Transpose TransposeReturnType; typedef typename internal::add_const >::type ConstTransposeReturnType; // FIXME storage order do not match evaluator storage order typedef SparseMatrix PlainObject; #ifndef EIGEN_PARSED_BY_DOXYGEN /** This is the "real scalar" type; if the \a Scalar type is already real numbers * (e.g. int, float or double) then \a RealScalar is just the same as \a Scalar. If * \a Scalar is \a std::complex then RealScalar is \a T. * * \sa class NumTraits */ typedef typename NumTraits::Real RealScalar; /** \internal the return type of coeff() */ typedef typename internal::conditional<_HasDirectAccess, const Scalar&, Scalar>::type CoeffReturnType; /** \internal Represents a matrix with all coefficients equal to one another*/ typedef CwiseNullaryOp,Matrix > ConstantReturnType; /** type of the equivalent dense matrix */ typedef Matrix DenseMatrixType; /** type of the equivalent square matrix */ typedef Matrix SquareMatrixType; inline const Derived& derived() const { return *static_cast(this); } inline Derived& derived() { return *static_cast(this); } inline Derived& const_cast_derived() const { return *static_cast(const_cast(this)); } typedef EigenBase Base; #endif // not EIGEN_PARSED_BY_DOXYGEN #define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::SparseMatrixBase #ifdef EIGEN_PARSED_BY_DOXYGEN #define EIGEN_DOC_UNARY_ADDONS(METHOD,OP) /**

This method does not change the sparsity of \c *this: the OP is applied to explicitly stored coefficients only. \sa SparseCompressedBase::coeffs()

*/ #define EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL /**

\warning This method returns a read-only expression for any sparse matrices. \sa \ref TutorialSparse_SubMatrices "Sparse block operations"

*/ #define EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(COND) /**

\warning This method returns a read-write expression for COND sparse matrices only. Otherwise, the returned expression is read-only. \sa \ref TutorialSparse_SubMatrices "Sparse block operations"

*/ #else #define EIGEN_DOC_UNARY_ADDONS(X,Y) #define EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL #define EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(COND) #endif # include "../plugins/CommonCwiseUnaryOps.h" # include "../plugins/CommonCwiseBinaryOps.h" # include "../plugins/MatrixCwiseUnaryOps.h" # include "../plugins/MatrixCwiseBinaryOps.h" # include "../plugins/BlockMethods.h" # ifdef EIGEN_SPARSEMATRIXBASE_PLUGIN # include EIGEN_SPARSEMATRIXBASE_PLUGIN # endif #undef EIGEN_CURRENT_STORAGE_BASE_CLASS #undef EIGEN_DOC_UNARY_ADDONS #undef EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL #undef EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF /** \returns the number of rows. \sa cols() */ inline Index rows() const { return derived().rows(); } /** \returns the number of columns. \sa rows() */ inline Index cols() const { return derived().cols(); } /** \returns the number of coefficients, which is \a rows()*cols(). * \sa rows(), cols(). */ inline Index size() const { return rows() * cols(); } /** \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. */ inline bool isVector() const { return rows()==1 || cols()==1; } /** \returns the size of the storage major dimension, * i.e., the number of columns for a columns major matrix, and the number of rows otherwise */ Index outerSize() const { return (int(Flags)&RowMajorBit) ? this->rows() : this->cols(); } /** \returns the size of the inner dimension according to the storage order, * i.e., the number of rows for a columns major matrix, and the number of cols otherwise */ Index innerSize() const { return (int(Flags)&RowMajorBit) ? this->cols() : this->rows(); } bool isRValue() const { return m_isRValue; } Derived& markAsRValue() { m_isRValue = true; return derived(); } SparseMatrixBase() : m_isRValue(false) { /* TODO check flags */ } template Derived& operator=(const ReturnByValue& other); template inline Derived& operator=(const SparseMatrixBase& other); inline Derived& operator=(const Derived& other); protected: template inline Derived& assign(const OtherDerived& other); template inline void assignGeneric(const OtherDerived& other); public: friend std::ostream & operator << (std::ostream & s, const SparseMatrixBase& m) { typedef typename Derived::Nested Nested; typedef typename internal::remove_all::type NestedCleaned; if (Flags&RowMajorBit) { Nested nm(m.derived()); internal::evaluator thisEval(nm); for (Index row=0; row::InnerIterator it(thisEval, row); it; ++it) { for ( ; col thisEval(nm); if (m.cols() == 1) { Index row = 0; for (typename internal::evaluator::InnerIterator it(thisEval, 0); it; ++it) { for ( ; row trans = m; s << static_cast >&>(trans); } } return s; } template Derived& operator+=(const SparseMatrixBase& other); template Derived& operator-=(const SparseMatrixBase& other); template Derived& operator+=(const DiagonalBase& other); template Derived& operator-=(const DiagonalBase& other); template Derived& operator+=(const EigenBase &other); template Derived& operator-=(const EigenBase &other); Derived& operator*=(const Scalar& other); Derived& operator/=(const Scalar& other); template struct CwiseProductDenseReturnType { typedef CwiseBinaryOp::Scalar, typename internal::traits::Scalar >::ReturnType>, const Derived, const OtherDerived > Type; }; template EIGEN_STRONG_INLINE const typename CwiseProductDenseReturnType::Type cwiseProduct(const MatrixBase &other) const; // sparse * diagonal template const Product operator*(const DiagonalBase &other) const { return Product(derived(), other.derived()); } // diagonal * sparse template friend const Product operator*(const DiagonalBase &lhs, const SparseMatrixBase& rhs) { return Product(lhs.derived(), rhs.derived()); } // sparse * sparse template const Product operator*(const SparseMatrixBase &other) const; // sparse * dense template const Product operator*(const MatrixBase &other) const { return Product(derived(), other.derived()); } // dense * sparse template friend const Product operator*(const MatrixBase &lhs, const SparseMatrixBase& rhs) { return Product(lhs.derived(), rhs.derived()); } /** \returns an expression of P H P^-1 where H is the matrix represented by \c *this */ SparseSymmetricPermutationProduct twistedBy(const PermutationMatrix& perm) const { return SparseSymmetricPermutationProduct(derived(), perm); } template Derived& operator*=(const SparseMatrixBase& other); template inline const TriangularView triangularView() const; template struct SelfAdjointViewReturnType { typedef SparseSelfAdjointView Type; }; template struct ConstSelfAdjointViewReturnType { typedef const SparseSelfAdjointView Type; }; template inline typename ConstSelfAdjointViewReturnType::Type selfadjointView() const; template inline typename SelfAdjointViewReturnType::Type selfadjointView(); template Scalar dot(const MatrixBase& other) const; template Scalar dot(const SparseMatrixBase& other) const; RealScalar squaredNorm() const; RealScalar norm() const; RealScalar blueNorm() const; TransposeReturnType transpose() { return TransposeReturnType(derived()); } const ConstTransposeReturnType transpose() const { return ConstTransposeReturnType(derived()); } const AdjointReturnType adjoint() const { return AdjointReturnType(transpose()); } DenseMatrixType toDense() const { return DenseMatrixType(derived()); } template bool isApprox(const SparseMatrixBase& other, const RealScalar& prec = NumTraits::dummy_precision()) const; template bool isApprox(const MatrixBase& other, const RealScalar& prec = NumTraits::dummy_precision()) const { return toDense().isApprox(other,prec); } /** \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. */ inline const typename internal::eval::type eval() const { return typename internal::eval::type(derived()); } Scalar sum() const; inline const SparseView pruned(const Scalar& reference = Scalar(0), const RealScalar& epsilon = NumTraits::dummy_precision()) const; protected: bool m_isRValue; static inline StorageIndex convert_index(const Index idx) { return internal::convert_index(idx); } private: template void evalTo(Dest &) const; }; } // end namespace Eigen #endif // EIGEN_SPARSEMATRIXBASE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparsePermutation.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSE_PERMUTATION_H #define EIGEN_SPARSE_PERMUTATION_H // This file implements sparse * permutation products namespace Eigen { namespace internal { template struct permutation_matrix_product { typedef typename nested_eval::type MatrixType; typedef typename remove_all::type MatrixTypeCleaned; typedef typename MatrixTypeCleaned::Scalar Scalar; typedef typename MatrixTypeCleaned::StorageIndex StorageIndex; enum { SrcStorageOrder = MatrixTypeCleaned::Flags&RowMajorBit ? RowMajor : ColMajor, MoveOuter = SrcStorageOrder==RowMajor ? Side==OnTheLeft : Side==OnTheRight }; typedef typename internal::conditional, SparseMatrix >::type ReturnType; template static inline void run(Dest& dst, const PermutationType& perm, const ExpressionType& xpr) { MatrixType mat(xpr); if(MoveOuter) { SparseMatrix tmp(mat.rows(), mat.cols()); Matrix sizes(mat.outerSize()); for(Index j=0; j tmp(mat.rows(), mat.cols()); Matrix sizes(tmp.outerSize()); sizes.setZero(); PermutationMatrix perm_cpy; if((Side==OnTheLeft) ^ Transposed) perm_cpy = perm; else perm_cpy = perm.transpose(); for(Index j=0; j struct product_promote_storage_type { typedef Sparse ret; }; template struct product_promote_storage_type { typedef Sparse ret; }; // TODO, the following two overloads are only needed to define the right temporary type through // typename traits >::ReturnType // whereas it should be correctly handled by traits >::PlainObject template struct product_evaluator, ProductTag, PermutationShape, SparseShape> : public evaluator::ReturnType> { typedef Product XprType; typedef typename permutation_matrix_product::ReturnType PlainObject; typedef evaluator Base; enum { Flags = Base::Flags | EvalBeforeNestingBit }; explicit product_evaluator(const XprType& xpr) : m_result(xpr.rows(), xpr.cols()) { ::new (static_cast(this)) Base(m_result); generic_product_impl::evalTo(m_result, xpr.lhs(), xpr.rhs()); } protected: PlainObject m_result; }; template struct product_evaluator, ProductTag, SparseShape, PermutationShape > : public evaluator::ReturnType> { typedef Product XprType; typedef typename permutation_matrix_product::ReturnType PlainObject; typedef evaluator Base; enum { Flags = Base::Flags | EvalBeforeNestingBit }; explicit product_evaluator(const XprType& xpr) : m_result(xpr.rows(), xpr.cols()) { ::new (static_cast(this)) Base(m_result); generic_product_impl::evalTo(m_result, xpr.lhs(), xpr.rhs()); } protected: PlainObject m_result; }; } // end namespace internal /** \returns the matrix with the permutation applied to the columns */ template inline const Product operator*(const SparseMatrixBase& matrix, const PermutationBase& perm) { return Product(matrix.derived(), perm.derived()); } /** \returns the matrix with the permutation applied to the rows */ template inline const Product operator*( const PermutationBase& perm, const SparseMatrixBase& matrix) { return Product(perm.derived(), matrix.derived()); } /** \returns the matrix with the inverse permutation applied to the columns. */ template inline const Product, AliasFreeProduct> operator*(const SparseMatrixBase& matrix, const InverseImpl& tperm) { return Product, AliasFreeProduct>(matrix.derived(), tperm.derived()); } /** \returns the matrix with the inverse permutation applied to the rows. */ template inline const Product, SparseDerived, AliasFreeProduct> operator*(const InverseImpl& tperm, const SparseMatrixBase& matrix) { return Product, SparseDerived, AliasFreeProduct>(tperm.derived(), matrix.derived()); } } // end namespace Eigen #endif // EIGEN_SPARSE_SELFADJOINTVIEW_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseProduct.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2015 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSEPRODUCT_H #define EIGEN_SPARSEPRODUCT_H namespace Eigen { /** \returns an expression of the product of two sparse matrices. * By default a conservative product preserving the symbolic non zeros is performed. * The automatic pruning of the small values can be achieved by calling the pruned() function * in which case a totally different product algorithm is employed: * \code * C = (A*B).pruned(); // suppress numerical zeros (exact) * C = (A*B).pruned(ref); * C = (A*B).pruned(ref,epsilon); * \endcode * where \c ref is a meaningful non zero reference value. * */ template template inline const Product SparseMatrixBase::operator*(const SparseMatrixBase &other) const { return Product(derived(), other.derived()); } namespace internal { // sparse * sparse template struct generic_product_impl { template static void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) { evalTo(dst, lhs, rhs, typename evaluator_traits::Shape()); } // dense += sparse * sparse template static void addTo(Dest& dst, const ActualLhs& lhs, const Rhs& rhs, typename enable_if::Shape,DenseShape>::value,int*>::type* = 0) { typedef typename nested_eval::type LhsNested; typedef typename nested_eval::type RhsNested; LhsNested lhsNested(lhs); RhsNested rhsNested(rhs); internal::sparse_sparse_to_dense_product_selector::type, typename remove_all::type, Dest>::run(lhsNested,rhsNested,dst); } // dense -= sparse * sparse template static void subTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, typename enable_if::Shape,DenseShape>::value,int*>::type* = 0) { addTo(dst, -lhs, rhs); } protected: // sparse = sparse * sparse template static void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, SparseShape) { typedef typename nested_eval::type LhsNested; typedef typename nested_eval::type RhsNested; LhsNested lhsNested(lhs); RhsNested rhsNested(rhs); internal::conservative_sparse_sparse_product_selector::type, typename remove_all::type, Dest>::run(lhsNested,rhsNested,dst); } // dense = sparse * sparse template static void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, DenseShape) { dst.setZero(); addTo(dst, lhs, rhs); } }; // sparse * sparse-triangular template struct generic_product_impl : public generic_product_impl {}; // sparse-triangular * sparse template struct generic_product_impl : public generic_product_impl {}; // dense = sparse-product (can be sparse*sparse, sparse*perm, etc.) template< typename DstXprType, typename Lhs, typename Rhs> struct Assignment, internal::assign_op::Scalar>, Sparse2Dense> { typedef Product SrcXprType; static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &) { Index dstRows = src.rows(); Index dstCols = src.cols(); if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) dst.resize(dstRows, dstCols); generic_product_impl::evalTo(dst,src.lhs(),src.rhs()); } }; // dense += sparse-product (can be sparse*sparse, sparse*perm, etc.) template< typename DstXprType, typename Lhs, typename Rhs> struct Assignment, internal::add_assign_op::Scalar>, Sparse2Dense> { typedef Product SrcXprType; static void run(DstXprType &dst, const SrcXprType &src, const internal::add_assign_op &) { generic_product_impl::addTo(dst,src.lhs(),src.rhs()); } }; // dense -= sparse-product (can be sparse*sparse, sparse*perm, etc.) template< typename DstXprType, typename Lhs, typename Rhs> struct Assignment, internal::sub_assign_op::Scalar>, Sparse2Dense> { typedef Product SrcXprType; static void run(DstXprType &dst, const SrcXprType &src, const internal::sub_assign_op &) { generic_product_impl::subTo(dst,src.lhs(),src.rhs()); } }; template struct unary_evaluator >, IteratorBased> : public evaluator::PlainObject> { typedef SparseView > XprType; typedef typename XprType::PlainObject PlainObject; typedef evaluator Base; explicit unary_evaluator(const XprType& xpr) : m_result(xpr.rows(), xpr.cols()) { using std::abs; ::new (static_cast(this)) Base(m_result); typedef typename nested_eval::type LhsNested; typedef typename nested_eval::type RhsNested; LhsNested lhsNested(xpr.nestedExpression().lhs()); RhsNested rhsNested(xpr.nestedExpression().rhs()); internal::sparse_sparse_product_with_pruning_selector::type, typename remove_all::type, PlainObject>::run(lhsNested,rhsNested,m_result, abs(xpr.reference())*xpr.epsilon()); } protected: PlainObject m_result; }; } // end namespace internal // sparse matrix = sparse-product (can be sparse*sparse, sparse*perm, etc.) template template SparseMatrix& SparseMatrix::operator=(const Product& src) { // std::cout << "in Assignment : " << DstOptions << "\n"; SparseMatrix dst(src.rows(),src.cols()); internal::generic_product_impl::evalTo(dst,src.lhs(),src.rhs()); this->swap(dst); return *this; } } // end namespace Eigen #endif // EIGEN_SPARSEPRODUCT_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseRedux.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSEREDUX_H #define EIGEN_SPARSEREDUX_H namespace Eigen { template typename internal::traits::Scalar SparseMatrixBase::sum() const { eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); Scalar res(0); internal::evaluator thisEval(derived()); for (Index j=0; j::InnerIterator iter(thisEval,j); iter; ++iter) res += iter.value(); return res; } template typename internal::traits >::Scalar SparseMatrix::sum() const { eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); if(this->isCompressed()) return Matrix::Map(m_data.valuePtr(), m_data.size()).sum(); else return Base::sum(); } template typename internal::traits >::Scalar SparseVector::sum() const { eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); return Matrix::Map(m_data.valuePtr(), m_data.size()).sum(); } } // end namespace Eigen #endif // EIGEN_SPARSEREDUX_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseRef.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2015 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSE_REF_H #define EIGEN_SPARSE_REF_H namespace Eigen { enum { StandardCompressedFormat = 2 /**< used by Ref to specify whether the input storage must be in standard compressed form */ }; namespace internal { template class SparseRefBase; template struct traits, Options_, _StrideType> > : public traits > { typedef SparseMatrix PlainObjectType; enum { Options = Options_, Flags = traits::Flags | CompressedAccessBit | NestByRefBit }; template struct match { enum { StorageOrderMatch = PlainObjectType::IsVectorAtCompileTime || Derived::IsVectorAtCompileTime || ((PlainObjectType::Flags&RowMajorBit)==(Derived::Flags&RowMajorBit)), MatchAtCompileTime = (Derived::Flags&CompressedAccessBit) && StorageOrderMatch }; typedef typename internal::conditional::type type; }; }; template struct traits, Options_, _StrideType> > : public traits, Options_, _StrideType> > { enum { Flags = (traits >::Flags | CompressedAccessBit | NestByRefBit) & ~LvalueBit }; }; template struct traits, Options_, _StrideType> > : public traits > { typedef SparseVector PlainObjectType; enum { Options = Options_, Flags = traits::Flags | CompressedAccessBit | NestByRefBit }; template struct match { enum { MatchAtCompileTime = (Derived::Flags&CompressedAccessBit) && Derived::IsVectorAtCompileTime }; typedef typename internal::conditional::type type; }; }; template struct traits, Options_, _StrideType> > : public traits, Options_, _StrideType> > { enum { Flags = (traits >::Flags | CompressedAccessBit | NestByRefBit) & ~LvalueBit }; }; template struct traits > : public traits {}; template class SparseRefBase : public SparseMapBase { public: typedef SparseMapBase Base; EIGEN_SPARSE_PUBLIC_INTERFACE(SparseRefBase) SparseRefBase() : Base(RowsAtCompileTime==Dynamic?0:RowsAtCompileTime,ColsAtCompileTime==Dynamic?0:ColsAtCompileTime, 0, 0, 0, 0, 0) {} protected: template void construct(Expression& expr) { if(expr.outerIndexPtr()==0) ::new (static_cast(this)) Base(expr.size(), expr.nonZeros(), expr.innerIndexPtr(), expr.valuePtr()); else ::new (static_cast(this)) Base(expr.rows(), expr.cols(), expr.nonZeros(), expr.outerIndexPtr(), expr.innerIndexPtr(), expr.valuePtr(), expr.innerNonZeroPtr()); } }; } // namespace internal /** * \ingroup SparseCore_Module * * \brief A sparse matrix expression referencing an existing sparse expression * * \tparam SparseMatrixType the equivalent sparse matrix type of the referenced data, it must be a template instance of class SparseMatrix. * \tparam Options specifies whether the a standard compressed format is required \c Options is \c #StandardCompressedFormat, or \c 0. * The default is \c 0. * * \sa class Ref */ #ifndef EIGEN_PARSED_BY_DOXYGEN template class Ref, Options, StrideType > : public internal::SparseRefBase, Options, StrideType > > #else template class Ref : public SparseMapBase // yes, that's weird to use Derived here, but that works! #endif { typedef SparseMatrix PlainObjectType; typedef internal::traits Traits; template inline Ref(const SparseMatrix& expr); template inline Ref(const MappedSparseMatrix& expr); public: typedef internal::SparseRefBase Base; EIGEN_SPARSE_PUBLIC_INTERFACE(Ref) #ifndef EIGEN_PARSED_BY_DOXYGEN template inline Ref(SparseMatrix& expr) { EIGEN_STATIC_ASSERT(bool(Traits::template match >::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH); eigen_assert( ((Options & int(StandardCompressedFormat))==0) || (expr.isCompressed()) ); Base::construct(expr.derived()); } template inline Ref(MappedSparseMatrix& expr) { EIGEN_STATIC_ASSERT(bool(Traits::template match >::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH); eigen_assert( ((Options & int(StandardCompressedFormat))==0) || (expr.isCompressed()) ); Base::construct(expr.derived()); } template inline Ref(const SparseCompressedBase& expr) #else /** Implicit constructor from any sparse expression (2D matrix or 1D vector) */ template inline Ref(SparseCompressedBase& expr) #endif { EIGEN_STATIC_ASSERT(bool(internal::is_lvalue::value), THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY); EIGEN_STATIC_ASSERT(bool(Traits::template match::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH); eigen_assert( ((Options & int(StandardCompressedFormat))==0) || (expr.isCompressed()) ); Base::construct(expr.const_cast_derived()); } }; // this is the const ref version template class Ref, Options, StrideType> : public internal::SparseRefBase, Options, StrideType> > { typedef SparseMatrix TPlainObjectType; typedef internal::traits Traits; public: typedef internal::SparseRefBase Base; EIGEN_SPARSE_PUBLIC_INTERFACE(Ref) template inline Ref(const SparseMatrixBase& expr) : m_hasCopy(false) { construct(expr.derived(), typename Traits::template match::type()); } inline Ref(const Ref& other) : Base(other), m_hasCopy(false) { // copy constructor shall not copy the m_object, to avoid unnecessary malloc and copy } template inline Ref(const RefBase& other) : m_hasCopy(false) { construct(other.derived(), typename Traits::template match::type()); } ~Ref() { if(m_hasCopy) { TPlainObjectType* obj = reinterpret_cast(&m_storage); obj->~TPlainObjectType(); } } protected: template void construct(const Expression& expr,internal::true_type) { if((Options & int(StandardCompressedFormat)) && (!expr.isCompressed())) { TPlainObjectType* obj = reinterpret_cast(&m_storage); ::new (obj) TPlainObjectType(expr); m_hasCopy = true; Base::construct(*obj); } else { Base::construct(expr); } } template void construct(const Expression& expr, internal::false_type) { TPlainObjectType* obj = reinterpret_cast(&m_storage); ::new (obj) TPlainObjectType(expr); m_hasCopy = true; Base::construct(*obj); } protected: typename internal::aligned_storage::type m_storage; bool m_hasCopy; }; /** * \ingroup SparseCore_Module * * \brief A sparse vector expression referencing an existing sparse vector expression * * \tparam SparseVectorType the equivalent sparse vector type of the referenced data, it must be a template instance of class SparseVector. * * \sa class Ref */ #ifndef EIGEN_PARSED_BY_DOXYGEN template class Ref, Options, StrideType > : public internal::SparseRefBase, Options, StrideType > > #else template class Ref : public SparseMapBase #endif { typedef SparseVector PlainObjectType; typedef internal::traits Traits; template inline Ref(const SparseVector& expr); public: typedef internal::SparseRefBase Base; EIGEN_SPARSE_PUBLIC_INTERFACE(Ref) #ifndef EIGEN_PARSED_BY_DOXYGEN template inline Ref(SparseVector& expr) { EIGEN_STATIC_ASSERT(bool(Traits::template match >::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH); Base::construct(expr.derived()); } template inline Ref(const SparseCompressedBase& expr) #else /** Implicit constructor from any 1D sparse vector expression */ template inline Ref(SparseCompressedBase& expr) #endif { EIGEN_STATIC_ASSERT(bool(internal::is_lvalue::value), THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY); EIGEN_STATIC_ASSERT(bool(Traits::template match::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH); Base::construct(expr.const_cast_derived()); } }; // this is the const ref version template class Ref, Options, StrideType> : public internal::SparseRefBase, Options, StrideType> > { typedef SparseVector TPlainObjectType; typedef internal::traits Traits; public: typedef internal::SparseRefBase Base; EIGEN_SPARSE_PUBLIC_INTERFACE(Ref) template inline Ref(const SparseMatrixBase& expr) : m_hasCopy(false) { construct(expr.derived(), typename Traits::template match::type()); } inline Ref(const Ref& other) : Base(other), m_hasCopy(false) { // copy constructor shall not copy the m_object, to avoid unnecessary malloc and copy } template inline Ref(const RefBase& other) : m_hasCopy(false) { construct(other.derived(), typename Traits::template match::type()); } ~Ref() { if(m_hasCopy) { TPlainObjectType* obj = reinterpret_cast(&m_storage); obj->~TPlainObjectType(); } } protected: template void construct(const Expression& expr,internal::true_type) { Base::construct(expr); } template void construct(const Expression& expr, internal::false_type) { TPlainObjectType* obj = reinterpret_cast(&m_storage); ::new (obj) TPlainObjectType(expr); m_hasCopy = true; Base::construct(*obj); } protected: typename internal::aligned_storage::type m_storage; bool m_hasCopy; }; namespace internal { // FIXME shall we introduce a general evaluatior_ref that we can specialize for any sparse object once, and thus remove this copy-pasta thing... template struct evaluator, Options, StrideType> > : evaluator, Options, StrideType> > > { typedef evaluator, Options, StrideType> > > Base; typedef Ref, Options, StrideType> XprType; evaluator() : Base() {} explicit evaluator(const XprType &mat) : Base(mat) {} }; template struct evaluator, Options, StrideType> > : evaluator, Options, StrideType> > > { typedef evaluator, Options, StrideType> > > Base; typedef Ref, Options, StrideType> XprType; evaluator() : Base() {} explicit evaluator(const XprType &mat) : Base(mat) {} }; template struct evaluator, Options, StrideType> > : evaluator, Options, StrideType> > > { typedef evaluator, Options, StrideType> > > Base; typedef Ref, Options, StrideType> XprType; evaluator() : Base() {} explicit evaluator(const XprType &mat) : Base(mat) {} }; template struct evaluator, Options, StrideType> > : evaluator, Options, StrideType> > > { typedef evaluator, Options, StrideType> > > Base; typedef Ref, Options, StrideType> XprType; evaluator() : Base() {} explicit evaluator(const XprType &mat) : Base(mat) {} }; } } // end namespace Eigen #endif // EIGEN_SPARSE_REF_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSE_SELFADJOINTVIEW_H #define EIGEN_SPARSE_SELFADJOINTVIEW_H namespace Eigen { /** \ingroup SparseCore_Module * \class SparseSelfAdjointView * * \brief Pseudo expression to manipulate a triangular sparse matrix as a selfadjoint matrix. * * \param MatrixType the type of the dense matrix storing the coefficients * \param Mode can be either \c #Lower or \c #Upper * * This class is an expression of a sefladjoint matrix from a triangular part of a matrix * with given dense storage of the coefficients. It is the return type of MatrixBase::selfadjointView() * and most of the time this is the only way that it is used. * * \sa SparseMatrixBase::selfadjointView() */ namespace internal { template struct traits > : traits { }; template void permute_symm_to_symm(const MatrixType& mat, SparseMatrix& _dest, const typename MatrixType::StorageIndex* perm = 0); template void permute_symm_to_fullsymm(const MatrixType& mat, SparseMatrix& _dest, const typename MatrixType::StorageIndex* perm = 0); } template class SparseSelfAdjointView : public EigenBase > { public: enum { Mode = Mode_, TransposeMode = ((Mode & Upper) ? Lower : 0) | ((Mode & Lower) ? Upper : 0), RowsAtCompileTime = internal::traits::RowsAtCompileTime, ColsAtCompileTime = internal::traits::ColsAtCompileTime }; typedef EigenBase Base; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::StorageIndex StorageIndex; typedef Matrix VectorI; typedef typename internal::ref_selector::non_const_type MatrixTypeNested; typedef typename internal::remove_all::type _MatrixTypeNested; explicit inline SparseSelfAdjointView(MatrixType& matrix) : m_matrix(matrix) { eigen_assert(rows()==cols() && "SelfAdjointView is only for squared matrices"); } inline Index rows() const { return m_matrix.rows(); } inline Index cols() const { return m_matrix.cols(); } /** \internal \returns a reference to the nested matrix */ const _MatrixTypeNested& matrix() const { return m_matrix; } typename internal::remove_reference::type& matrix() { return m_matrix; } /** \returns an expression of the matrix product between a sparse self-adjoint matrix \c *this and a sparse matrix \a rhs. * * Note that there is no algorithmic advantage of performing such a product compared to a general sparse-sparse matrix product. * Indeed, the SparseSelfadjointView operand is first copied into a temporary SparseMatrix before computing the product. */ template Product operator*(const SparseMatrixBase& rhs) const { return Product(*this, rhs.derived()); } /** \returns an expression of the matrix product between a sparse matrix \a lhs and a sparse self-adjoint matrix \a rhs. * * Note that there is no algorithmic advantage of performing such a product compared to a general sparse-sparse matrix product. * Indeed, the SparseSelfadjointView operand is first copied into a temporary SparseMatrix before computing the product. */ template friend Product operator*(const SparseMatrixBase& lhs, const SparseSelfAdjointView& rhs) { return Product(lhs.derived(), rhs); } /** Efficient sparse self-adjoint matrix times dense vector/matrix product */ template Product operator*(const MatrixBase& rhs) const { return Product(*this, rhs.derived()); } /** Efficient dense vector/matrix times sparse self-adjoint matrix product */ template friend Product operator*(const MatrixBase& lhs, const SparseSelfAdjointView& rhs) { return Product(lhs.derived(), rhs); } /** Perform a symmetric rank K update of the selfadjoint matrix \c *this: * \f$ this = this + \alpha ( u u^* ) \f$ where \a u is a vector or matrix. * * \returns a reference to \c *this * * To perform \f$ this = this + \alpha ( u^* u ) \f$ you can simply * call this function with u.adjoint(). */ template SparseSelfAdjointView& rankUpdate(const SparseMatrixBase& u, const Scalar& alpha = Scalar(1)); /** \returns an expression of P H P^-1 */ // TODO implement twists in a more evaluator friendly fashion SparseSymmetricPermutationProduct<_MatrixTypeNested,Mode> twistedBy(const PermutationMatrix& perm) const { return SparseSymmetricPermutationProduct<_MatrixTypeNested,Mode>(m_matrix, perm); } template SparseSelfAdjointView& operator=(const SparseSymmetricPermutationProduct& permutedMatrix) { internal::call_assignment_no_alias_no_transpose(*this, permutedMatrix); return *this; } SparseSelfAdjointView& operator=(const SparseSelfAdjointView& src) { PermutationMatrix pnull; return *this = src.twistedBy(pnull); } // Since we override the copy-assignment operator, we need to explicitly re-declare the copy-constructor EIGEN_DEFAULT_COPY_CONSTRUCTOR(SparseSelfAdjointView) template SparseSelfAdjointView& operator=(const SparseSelfAdjointView& src) { PermutationMatrix pnull; return *this = src.twistedBy(pnull); } 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() && "SparseSelfadjointView::resize() does not actually allow to resize."); } protected: MatrixTypeNested m_matrix; //mutable VectorI m_countPerRow; //mutable VectorI m_countPerCol; private: template void evalTo(Dest &) const; }; /*************************************************************************** * Implementation of SparseMatrixBase methods ***************************************************************************/ template template typename SparseMatrixBase::template ConstSelfAdjointViewReturnType::Type SparseMatrixBase::selfadjointView() const { return SparseSelfAdjointView(derived()); } template template typename SparseMatrixBase::template SelfAdjointViewReturnType::Type SparseMatrixBase::selfadjointView() { return SparseSelfAdjointView(derived()); } /*************************************************************************** * Implementation of SparseSelfAdjointView methods ***************************************************************************/ template template SparseSelfAdjointView& SparseSelfAdjointView::rankUpdate(const SparseMatrixBase& u, const Scalar& alpha) { SparseMatrix tmp = u * u.adjoint(); if(alpha==Scalar(0)) m_matrix = tmp.template triangularView(); else m_matrix += alpha * tmp.template triangularView(); return *this; } namespace internal { // TODO currently a selfadjoint expression has the form SelfAdjointView<.,.> // in the future selfadjoint-ness should be defined by the expression traits // such that Transpose > is valid. (currently TriangularBase::transpose() is overloaded to make it work) template struct evaluator_traits > { typedef typename storage_kind_to_evaluator_kind::Kind Kind; typedef SparseSelfAdjointShape Shape; }; struct SparseSelfAdjoint2Sparse {}; template<> struct AssignmentKind { typedef SparseSelfAdjoint2Sparse Kind; }; template<> struct AssignmentKind { typedef Sparse2Sparse Kind; }; template< typename DstXprType, typename SrcXprType, typename Functor> struct Assignment { typedef typename DstXprType::StorageIndex StorageIndex; typedef internal::assign_op AssignOpType; template static void run(SparseMatrix &dst, const SrcXprType &src, const AssignOpType&/*func*/) { internal::permute_symm_to_fullsymm(src.matrix(), dst); } // FIXME: the handling of += and -= in sparse matrices should be cleanup so that next two overloads could be reduced to: template static void run(SparseMatrix &dst, const SrcXprType &src, const AssignFunc& func) { SparseMatrix tmp(src.rows(),src.cols()); run(tmp, src, AssignOpType()); call_assignment_no_alias_no_transpose(dst, tmp, func); } template static void run(SparseMatrix &dst, const SrcXprType &src, const internal::add_assign_op& /* func */) { SparseMatrix tmp(src.rows(),src.cols()); run(tmp, src, AssignOpType()); dst += tmp; } template static void run(SparseMatrix &dst, const SrcXprType &src, const internal::sub_assign_op& /* func */) { SparseMatrix tmp(src.rows(),src.cols()); run(tmp, src, AssignOpType()); dst -= tmp; } template static void run(DynamicSparseMatrix& dst, const SrcXprType &src, const AssignOpType&/*func*/) { // TODO directly evaluate into dst; SparseMatrix tmp(dst.rows(),dst.cols()); internal::permute_symm_to_fullsymm(src.matrix(), tmp); dst = tmp; } }; } // end namespace internal /*************************************************************************** * Implementation of sparse self-adjoint time dense matrix ***************************************************************************/ namespace internal { template inline void sparse_selfadjoint_time_dense_product(const SparseLhsType& lhs, const DenseRhsType& rhs, DenseResType& res, const AlphaType& alpha) { EIGEN_ONLY_USED_FOR_DEBUG(alpha); typedef typename internal::nested_eval::type SparseLhsTypeNested; typedef typename internal::remove_all::type SparseLhsTypeNestedCleaned; typedef evaluator LhsEval; typedef typename LhsEval::InnerIterator LhsIterator; typedef typename SparseLhsType::Scalar LhsScalar; enum { LhsIsRowMajor = (LhsEval::Flags&RowMajorBit)==RowMajorBit, ProcessFirstHalf = ((Mode&(Upper|Lower))==(Upper|Lower)) || ( (Mode&Upper) && !LhsIsRowMajor) || ( (Mode&Lower) && LhsIsRowMajor), ProcessSecondHalf = !ProcessFirstHalf }; SparseLhsTypeNested lhs_nested(lhs); LhsEval lhsEval(lhs_nested); // work on one column at once for (Index k=0; k::ReturnType rhs_j(alpha*rhs(j,k)); // accumulator for partial scalar product typename DenseResType::Scalar res_j(0); for(; (ProcessFirstHalf ? i && i.index() < j : i) ; ++i) { LhsScalar lhs_ij = i.value(); if(!LhsIsRowMajor) lhs_ij = numext::conj(lhs_ij); res_j += lhs_ij * rhs.coeff(i.index(),k); res(i.index(),k) += numext::conj(lhs_ij) * rhs_j; } res.coeffRef(j,k) += alpha * res_j; // handle diagonal coeff if (ProcessFirstHalf && i && (i.index()==j)) res.coeffRef(j,k) += alpha * i.value() * rhs.coeff(j,k); } } } template struct generic_product_impl : generic_product_impl_base > { template static void scaleAndAddTo(Dest& dst, const LhsView& lhsView, const Rhs& rhs, const typename Dest::Scalar& alpha) { typedef typename LhsView::_MatrixTypeNested Lhs; typedef typename nested_eval::type LhsNested; typedef typename nested_eval::type RhsNested; LhsNested lhsNested(lhsView.matrix()); RhsNested rhsNested(rhs); internal::sparse_selfadjoint_time_dense_product(lhsNested, rhsNested, dst, alpha); } }; template struct generic_product_impl : generic_product_impl_base > { template static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const RhsView& rhsView, const typename Dest::Scalar& alpha) { typedef typename RhsView::_MatrixTypeNested Rhs; typedef typename nested_eval::type LhsNested; typedef typename nested_eval::type RhsNested; LhsNested lhsNested(lhs); RhsNested rhsNested(rhsView.matrix()); // transpose everything Transpose dstT(dst); internal::sparse_selfadjoint_time_dense_product(rhsNested.transpose(), lhsNested.transpose(), dstT, alpha); } }; // NOTE: these two overloads are needed to evaluate the sparse selfadjoint view into a full sparse matrix // TODO: maybe the copy could be handled by generic_product_impl so that these overloads would not be needed anymore template struct product_evaluator, ProductTag, SparseSelfAdjointShape, SparseShape> : public evaluator::PlainObject> { typedef Product XprType; typedef typename XprType::PlainObject PlainObject; typedef evaluator Base; product_evaluator(const XprType& xpr) : m_lhs(xpr.lhs()), m_result(xpr.rows(), xpr.cols()) { ::new (static_cast(this)) Base(m_result); generic_product_impl::evalTo(m_result, m_lhs, xpr.rhs()); } protected: typename Rhs::PlainObject m_lhs; PlainObject m_result; }; template struct product_evaluator, ProductTag, SparseShape, SparseSelfAdjointShape> : public evaluator::PlainObject> { typedef Product XprType; typedef typename XprType::PlainObject PlainObject; typedef evaluator Base; product_evaluator(const XprType& xpr) : m_rhs(xpr.rhs()), m_result(xpr.rows(), xpr.cols()) { ::new (static_cast(this)) Base(m_result); generic_product_impl::evalTo(m_result, xpr.lhs(), m_rhs); } protected: typename Lhs::PlainObject m_rhs; PlainObject m_result; }; } // namespace internal /*************************************************************************** * Implementation of symmetric copies and permutations ***************************************************************************/ namespace internal { template void permute_symm_to_fullsymm(const MatrixType& mat, SparseMatrix& _dest, const typename MatrixType::StorageIndex* perm) { typedef typename MatrixType::StorageIndex StorageIndex; typedef typename MatrixType::Scalar Scalar; typedef SparseMatrix Dest; typedef Matrix VectorI; typedef evaluator MatEval; typedef typename evaluator::InnerIterator MatIterator; MatEval matEval(mat); Dest& dest(_dest.derived()); enum { StorageOrderMatch = int(Dest::IsRowMajor) == int(MatrixType::IsRowMajor) }; Index size = mat.rows(); VectorI count; count.resize(size); count.setZero(); dest.resize(size,size); for(Index j = 0; jc) || ( Mode==Upper && r(it.index()); Index r = it.row(); Index c = it.col(); StorageIndex jp = perm ? perm[j] : j; StorageIndex ip = perm ? perm[i] : i; if(Mode==int(Upper|Lower)) { Index k = count[StorageOrderMatch ? jp : ip]++; dest.innerIndexPtr()[k] = StorageOrderMatch ? ip : jp; dest.valuePtr()[k] = it.value(); } else if(r==c) { Index k = count[ip]++; dest.innerIndexPtr()[k] = ip; dest.valuePtr()[k] = it.value(); } else if(( (Mode&Lower)==Lower && r>c) || ( (Mode&Upper)==Upper && r void permute_symm_to_symm(const MatrixType& mat, SparseMatrix& _dest, const typename MatrixType::StorageIndex* perm) { typedef typename MatrixType::StorageIndex StorageIndex; typedef typename MatrixType::Scalar Scalar; SparseMatrix& dest(_dest.derived()); typedef Matrix VectorI; typedef evaluator MatEval; typedef typename evaluator::InnerIterator MatIterator; enum { SrcOrder = MatrixType::IsRowMajor ? RowMajor : ColMajor, StorageOrderMatch = int(SrcOrder) == int(DstOrder), DstMode = DstOrder==RowMajor ? (DstMode_==Upper ? Lower : Upper) : DstMode_, SrcMode = SrcOrder==RowMajor ? (SrcMode_==Upper ? Lower : Upper) : SrcMode_ }; MatEval matEval(mat); Index size = mat.rows(); VectorI count(size); count.setZero(); dest.resize(size,size); for(StorageIndex j = 0; jj)) continue; StorageIndex ip = perm ? perm[i] : i; count[int(DstMode)==int(Lower) ? (std::min)(ip,jp) : (std::max)(ip,jp)]++; } } dest.outerIndexPtr()[0] = 0; for(Index j=0; jj)) continue; StorageIndex jp = perm ? perm[j] : j; StorageIndex ip = perm? perm[i] : i; Index k = count[int(DstMode)==int(Lower) ? (std::min)(ip,jp) : (std::max)(ip,jp)]++; dest.innerIndexPtr()[k] = int(DstMode)==int(Lower) ? (std::max)(ip,jp) : (std::min)(ip,jp); if(!StorageOrderMatch) std::swap(ip,jp); if( ((int(DstMode)==int(Lower) && ipjp))) dest.valuePtr()[k] = numext::conj(it.value()); else dest.valuePtr()[k] = it.value(); } } } } // TODO implement twists in a more evaluator friendly fashion namespace internal { template struct traits > : traits { }; } template class SparseSymmetricPermutationProduct : public EigenBase > { public: typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::StorageIndex StorageIndex; enum { RowsAtCompileTime = internal::traits::RowsAtCompileTime, ColsAtCompileTime = internal::traits::ColsAtCompileTime }; protected: typedef PermutationMatrix Perm; public: typedef Matrix VectorI; typedef typename MatrixType::Nested MatrixTypeNested; typedef typename internal::remove_all::type NestedExpression; SparseSymmetricPermutationProduct(const MatrixType& mat, const Perm& perm) : m_matrix(mat), m_perm(perm) {} inline Index rows() const { return m_matrix.rows(); } inline Index cols() const { return m_matrix.cols(); } const NestedExpression& matrix() const { return m_matrix; } const Perm& perm() const { return m_perm; } protected: MatrixTypeNested m_matrix; const Perm& m_perm; }; namespace internal { template struct Assignment, internal::assign_op, Sparse2Sparse> { typedef SparseSymmetricPermutationProduct SrcXprType; typedef typename DstXprType::StorageIndex DstIndex; template static void run(SparseMatrix &dst, const SrcXprType &src, const internal::assign_op &) { // internal::permute_symm_to_fullsymm(m_matrix,_dest,m_perm.indices().data()); SparseMatrix tmp; internal::permute_symm_to_fullsymm(src.matrix(),tmp,src.perm().indices().data()); dst = tmp; } template static void run(SparseSelfAdjointView& dst, const SrcXprType &src, const internal::assign_op &) { internal::permute_symm_to_symm(src.matrix(),dst.matrix(),src.perm().indices().data()); } }; } // end namespace internal } // end namespace Eigen #endif // EIGEN_SPARSE_SELFADJOINTVIEW_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseSolverBase.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSESOLVERBASE_H #define EIGEN_SPARSESOLVERBASE_H namespace Eigen { namespace internal { /** \internal * Helper functions to solve with a sparse right-hand-side and result. * The rhs is decomposed into small vertical panels which are solved through dense temporaries. */ template typename enable_if::type solve_sparse_through_dense_panels(const Decomposition &dec, const Rhs& rhs, Dest &dest) { EIGEN_STATIC_ASSERT((Dest::Flags&RowMajorBit)==0,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); typedef typename Dest::Scalar DestScalar; // we process the sparse rhs per block of NbColsAtOnce columns temporarily stored into a dense matrix. static const Index NbColsAtOnce = 4; Index rhsCols = rhs.cols(); Index size = rhs.rows(); // the temporary matrices do not need more columns than NbColsAtOnce: Index tmpCols = (std::min)(rhsCols, NbColsAtOnce); Eigen::Matrix tmp(size,tmpCols); Eigen::Matrix tmpX(size,tmpCols); for(Index k=0; k(rhsCols-k, NbColsAtOnce); tmp.leftCols(actualCols) = rhs.middleCols(k,actualCols); tmpX.leftCols(actualCols) = dec.solve(tmp.leftCols(actualCols)); dest.middleCols(k,actualCols) = tmpX.leftCols(actualCols).sparseView(); } } // Overload for vector as rhs template typename enable_if::type solve_sparse_through_dense_panels(const Decomposition &dec, const Rhs& rhs, Dest &dest) { typedef typename Dest::Scalar DestScalar; Index size = rhs.rows(); Eigen::Matrix rhs_dense(rhs); Eigen::Matrix dest_dense(size); dest_dense = dec.solve(rhs_dense); dest = dest_dense.sparseView(); } } // end namespace internal /** \class SparseSolverBase * \ingroup SparseCore_Module * \brief A base class for sparse solvers * * \tparam Derived the actual type of the solver. * */ template class SparseSolverBase : internal::noncopyable { public: /** Default constructor */ SparseSolverBase() : m_isInitialized(false) {} ~SparseSolverBase() {} Derived& derived() { return *static_cast(this); } const Derived& derived() const { return *static_cast(this); } /** \returns an expression of the solution x of \f$ A x = b \f$ using the current decomposition of A. * * \sa compute() */ template inline const Solve solve(const MatrixBase& b) const { eigen_assert(m_isInitialized && "Solver is not initialized."); eigen_assert(derived().rows()==b.rows() && "solve(): invalid number of rows of the right hand side matrix b"); return Solve(derived(), b.derived()); } /** \returns an expression of the solution x of \f$ A x = b \f$ using the current decomposition of A. * * \sa compute() */ template inline const Solve solve(const SparseMatrixBase& b) const { eigen_assert(m_isInitialized && "Solver is not initialized."); eigen_assert(derived().rows()==b.rows() && "solve(): invalid number of rows of the right hand side matrix b"); return Solve(derived(), b.derived()); } #ifndef EIGEN_PARSED_BY_DOXYGEN /** \internal default implementation of solving with a sparse rhs */ template void _solve_impl(const SparseMatrixBase &b, SparseMatrixBase &dest) const { internal::solve_sparse_through_dense_panels(derived(), b.derived(), dest.derived()); } #endif // EIGEN_PARSED_BY_DOXYGEN protected: mutable bool m_isInitialized; }; } // end namespace Eigen #endif // EIGEN_SPARSESOLVERBASE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseSparseProductWithPruning.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSESPARSEPRODUCTWITHPRUNING_H #define EIGEN_SPARSESPARSEPRODUCTWITHPRUNING_H namespace Eigen { namespace internal { // perform a pseudo in-place sparse * sparse product assuming all matrices are col major template static void sparse_sparse_product_with_pruning_impl(const Lhs& lhs, const Rhs& rhs, ResultType& res, const typename ResultType::RealScalar& tolerance) { // return sparse_sparse_product_with_pruning_impl2(lhs,rhs,res); typedef typename remove_all::type::Scalar RhsScalar; typedef typename remove_all::type::Scalar ResScalar; typedef typename remove_all::type::StorageIndex StorageIndex; // make sure to call innerSize/outerSize since we fake the storage order. Index rows = lhs.innerSize(); Index cols = rhs.outerSize(); //Index size = lhs.outerSize(); eigen_assert(lhs.outerSize() == rhs.innerSize()); // allocate a temporary buffer AmbiVector tempVector(rows); // mimics a resizeByInnerOuter: if(ResultType::IsRowMajor) res.resize(cols, rows); else res.resize(rows, cols); evaluator lhsEval(lhs); evaluator rhsEval(rhs); // estimate the number of non zero entries // given a rhs column containing Y non zeros, we assume that the respective Y columns // of the lhs differs in average of one non zeros, thus the number of non zeros for // the product of a rhs column with the lhs is X+Y where X is the average number of non zero // per column of the lhs. // Therefore, we have nnz(lhs*rhs) = nnz(lhs) + nnz(rhs) Index estimated_nnz_prod = lhsEval.nonZerosEstimate() + rhsEval.nonZerosEstimate(); res.reserve(estimated_nnz_prod); double ratioColRes = double(estimated_nnz_prod)/(double(lhs.rows())*double(rhs.cols())); for (Index j=0; j::InnerIterator rhsIt(rhsEval, j); rhsIt; ++rhsIt) { // FIXME should be written like this: tmp += rhsIt.value() * lhs.col(rhsIt.index()) tempVector.restart(); RhsScalar x = rhsIt.value(); for (typename evaluator::InnerIterator lhsIt(lhsEval, rhsIt.index()); lhsIt; ++lhsIt) { tempVector.coeffRef(lhsIt.index()) += lhsIt.value() * x; } } res.startVec(j); for (typename AmbiVector::Iterator it(tempVector,tolerance); it; ++it) res.insertBackByOuterInner(j,it.index()) = it.value(); } res.finalize(); } template::Flags&RowMajorBit, int RhsStorageOrder = traits::Flags&RowMajorBit, int ResStorageOrder = traits::Flags&RowMajorBit> struct sparse_sparse_product_with_pruning_selector; template struct sparse_sparse_product_with_pruning_selector { typedef typename ResultType::RealScalar RealScalar; static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res, const RealScalar& tolerance) { typename remove_all::type _res(res.rows(), res.cols()); internal::sparse_sparse_product_with_pruning_impl(lhs, rhs, _res, tolerance); res.swap(_res); } }; template struct sparse_sparse_product_with_pruning_selector { typedef typename ResultType::RealScalar RealScalar; static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res, const RealScalar& tolerance) { // we need a col-major matrix to hold the result typedef SparseMatrix SparseTemporaryType; SparseTemporaryType _res(res.rows(), res.cols()); internal::sparse_sparse_product_with_pruning_impl(lhs, rhs, _res, tolerance); res = _res; } }; template struct sparse_sparse_product_with_pruning_selector { typedef typename ResultType::RealScalar RealScalar; static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res, const RealScalar& tolerance) { // let's transpose the product to get a column x column product typename remove_all::type _res(res.rows(), res.cols()); internal::sparse_sparse_product_with_pruning_impl(rhs, lhs, _res, tolerance); res.swap(_res); } }; template struct sparse_sparse_product_with_pruning_selector { typedef typename ResultType::RealScalar RealScalar; static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res, const RealScalar& tolerance) { typedef SparseMatrix ColMajorMatrixLhs; typedef SparseMatrix ColMajorMatrixRhs; ColMajorMatrixLhs colLhs(lhs); ColMajorMatrixRhs colRhs(rhs); internal::sparse_sparse_product_with_pruning_impl(colLhs, colRhs, res, tolerance); // let's transpose the product to get a column x column product // typedef SparseMatrix SparseTemporaryType; // SparseTemporaryType _res(res.cols(), res.rows()); // sparse_sparse_product_with_pruning_impl(rhs, lhs, _res); // res = _res.transpose(); } }; template struct sparse_sparse_product_with_pruning_selector { typedef typename ResultType::RealScalar RealScalar; static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res, const RealScalar& tolerance) { typedef SparseMatrix RowMajorMatrixLhs; RowMajorMatrixLhs rowLhs(lhs); sparse_sparse_product_with_pruning_selector(rowLhs,rhs,res,tolerance); } }; template struct sparse_sparse_product_with_pruning_selector { typedef typename ResultType::RealScalar RealScalar; static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res, const RealScalar& tolerance) { typedef SparseMatrix RowMajorMatrixRhs; RowMajorMatrixRhs rowRhs(rhs); sparse_sparse_product_with_pruning_selector(lhs,rowRhs,res,tolerance); } }; template struct sparse_sparse_product_with_pruning_selector { typedef typename ResultType::RealScalar RealScalar; static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res, const RealScalar& tolerance) { typedef SparseMatrix ColMajorMatrixRhs; ColMajorMatrixRhs colRhs(rhs); internal::sparse_sparse_product_with_pruning_impl(lhs, colRhs, res, tolerance); } }; template struct sparse_sparse_product_with_pruning_selector { typedef typename ResultType::RealScalar RealScalar; static void run(const Lhs& lhs, const Rhs& rhs, ResultType& res, const RealScalar& tolerance) { typedef SparseMatrix ColMajorMatrixLhs; ColMajorMatrixLhs colLhs(lhs); internal::sparse_sparse_product_with_pruning_impl(colLhs, rhs, res, tolerance); } }; } // end namespace internal } // end namespace Eigen #endif // EIGEN_SPARSESPARSEPRODUCTWITHPRUNING_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseTranspose.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2015 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSETRANSPOSE_H #define EIGEN_SPARSETRANSPOSE_H namespace Eigen { namespace internal { template class SparseTransposeImpl : public SparseMatrixBase > {}; template class SparseTransposeImpl : public SparseCompressedBase > { typedef SparseCompressedBase > Base; public: using Base::derived; typedef typename Base::Scalar Scalar; typedef typename Base::StorageIndex StorageIndex; inline Index nonZeros() const { return derived().nestedExpression().nonZeros(); } inline const Scalar* valuePtr() const { return derived().nestedExpression().valuePtr(); } inline const StorageIndex* innerIndexPtr() const { return derived().nestedExpression().innerIndexPtr(); } inline const StorageIndex* outerIndexPtr() const { return derived().nestedExpression().outerIndexPtr(); } inline const StorageIndex* innerNonZeroPtr() const { return derived().nestedExpression().innerNonZeroPtr(); } inline Scalar* valuePtr() { return derived().nestedExpression().valuePtr(); } inline StorageIndex* innerIndexPtr() { return derived().nestedExpression().innerIndexPtr(); } inline StorageIndex* outerIndexPtr() { return derived().nestedExpression().outerIndexPtr(); } inline StorageIndex* innerNonZeroPtr() { return derived().nestedExpression().innerNonZeroPtr(); } }; } template class TransposeImpl : public internal::SparseTransposeImpl { protected: typedef internal::SparseTransposeImpl Base; }; namespace internal { template struct unary_evaluator, IteratorBased> : public evaluator_base > { typedef typename evaluator::InnerIterator EvalIterator; public: typedef Transpose XprType; inline Index nonZerosEstimate() const { return m_argImpl.nonZerosEstimate(); } class InnerIterator : public EvalIterator { public: EIGEN_STRONG_INLINE InnerIterator(const unary_evaluator& unaryOp, Index outer) : EvalIterator(unaryOp.m_argImpl,outer) {} Index row() const { return EvalIterator::col(); } Index col() const { return EvalIterator::row(); } }; enum { CoeffReadCost = evaluator::CoeffReadCost, Flags = XprType::Flags }; explicit unary_evaluator(const XprType& op) :m_argImpl(op.nestedExpression()) {} protected: evaluator m_argImpl; }; } // end namespace internal } // end namespace Eigen #endif // EIGEN_SPARSETRANSPOSE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseTriangularView.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009-2015 Gael Guennebaud // Copyright (C) 2012 Désiré Nuentsa-Wakam // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSE_TRIANGULARVIEW_H #define EIGEN_SPARSE_TRIANGULARVIEW_H namespace Eigen { /** \ingroup SparseCore_Module * * \brief Base class for a triangular part in a \b sparse matrix * * This class is an abstract base class of class TriangularView, and objects of type TriangularViewImpl cannot be instantiated. * It extends class TriangularView with additional methods which are available for sparse expressions only. * * \sa class TriangularView, SparseMatrixBase::triangularView() */ template class TriangularViewImpl : public SparseMatrixBase > { enum { SkipFirst = ((Mode&Lower) && !(MatrixType::Flags&RowMajorBit)) || ((Mode&Upper) && (MatrixType::Flags&RowMajorBit)), SkipLast = !SkipFirst, SkipDiag = (Mode&ZeroDiag) ? 1 : 0, HasUnitDiag = (Mode&UnitDiag) ? 1 : 0 }; typedef TriangularView TriangularViewType; protected: // dummy solve function to make TriangularView happy. void solve() const; typedef SparseMatrixBase Base; public: EIGEN_SPARSE_PUBLIC_INTERFACE(TriangularViewType) typedef typename MatrixType::Nested MatrixTypeNested; typedef typename internal::remove_reference::type MatrixTypeNestedNonRef; typedef typename internal::remove_all::type MatrixTypeNestedCleaned; template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _solve_impl(const RhsType &rhs, DstType &dst) const { if(!(internal::is_same::value && internal::extract_data(dst) == internal::extract_data(rhs))) dst = rhs; this->solveInPlace(dst); } /** Applies the inverse of \c *this to the dense vector or matrix \a other, "in-place" */ template void solveInPlace(MatrixBase& other) const; /** Applies the inverse of \c *this to the sparse vector or matrix \a other, "in-place" */ template void solveInPlace(SparseMatrixBase& other) const; }; namespace internal { template struct unary_evaluator, IteratorBased> : evaluator_base > { typedef TriangularView XprType; protected: typedef typename XprType::Scalar Scalar; typedef typename XprType::StorageIndex StorageIndex; typedef typename evaluator::InnerIterator EvalIterator; enum { SkipFirst = ((Mode&Lower) && !(ArgType::Flags&RowMajorBit)) || ((Mode&Upper) && (ArgType::Flags&RowMajorBit)), SkipLast = !SkipFirst, SkipDiag = (Mode&ZeroDiag) ? 1 : 0, HasUnitDiag = (Mode&UnitDiag) ? 1 : 0 }; public: enum { CoeffReadCost = evaluator::CoeffReadCost, Flags = XprType::Flags }; explicit unary_evaluator(const XprType &xpr) : m_argImpl(xpr.nestedExpression()), m_arg(xpr.nestedExpression()) {} inline Index nonZerosEstimate() const { return m_argImpl.nonZerosEstimate(); } class InnerIterator : public EvalIterator { typedef EvalIterator Base; public: EIGEN_STRONG_INLINE InnerIterator(const unary_evaluator& xprEval, Index outer) : Base(xprEval.m_argImpl,outer), m_returnOne(false), m_containsDiag(Base::outer()index()<=outer : this->index()=Base::outer())) { if((!SkipFirst) && Base::operator bool()) Base::operator++(); m_returnOne = m_containsDiag; } } EIGEN_STRONG_INLINE InnerIterator& operator++() { if(HasUnitDiag && m_returnOne) m_returnOne = false; else { Base::operator++(); if(HasUnitDiag && (!SkipFirst) && ((!Base::operator bool()) || Base::index()>=Base::outer())) { if((!SkipFirst) && Base::operator bool()) Base::operator++(); m_returnOne = m_containsDiag; } } return *this; } EIGEN_STRONG_INLINE operator bool() const { if(HasUnitDiag && m_returnOne) return true; if(SkipFirst) return Base::operator bool(); else { if (SkipDiag) return (Base::operator bool() && this->index() < this->outer()); else return (Base::operator bool() && this->index() <= this->outer()); } } // inline Index row() const { return (ArgType::Flags&RowMajorBit ? Base::outer() : this->index()); } // inline Index col() const { return (ArgType::Flags&RowMajorBit ? this->index() : Base::outer()); } inline StorageIndex index() const { if(HasUnitDiag && m_returnOne) return internal::convert_index(Base::outer()); else return Base::index(); } inline Scalar value() const { if(HasUnitDiag && m_returnOne) return Scalar(1); else return Base::value(); } protected: bool m_returnOne; bool m_containsDiag; private: Scalar& valueRef(); }; protected: evaluator m_argImpl; const ArgType& m_arg; }; } // end namespace internal template template inline const TriangularView SparseMatrixBase::triangularView() const { return TriangularView(derived()); } } // end namespace Eigen #endif // EIGEN_SPARSE_TRIANGULARVIEW_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseUtil.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSEUTIL_H #define EIGEN_SPARSEUTIL_H namespace Eigen { #ifdef NDEBUG #define EIGEN_DBG_SPARSE(X) #else #define EIGEN_DBG_SPARSE(X) X #endif #define EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, Op) \ template \ EIGEN_STRONG_INLINE Derived& operator Op(const Eigen::SparseMatrixBase& other) \ { \ return Base::operator Op(other.derived()); \ } \ EIGEN_STRONG_INLINE Derived& operator Op(const Derived& other) \ { \ return Base::operator Op(other); \ } #define EIGEN_SPARSE_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, Op) \ template \ EIGEN_STRONG_INLINE Derived& operator Op(const Other& scalar) \ { \ return Base::operator Op(scalar); \ } #define EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATORS(Derived) \ EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, =) #define EIGEN_SPARSE_PUBLIC_INTERFACE(Derived) \ EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) const int CoherentAccessPattern = 0x1; const int InnerRandomAccessPattern = 0x2 | CoherentAccessPattern; const int OuterRandomAccessPattern = 0x4 | CoherentAccessPattern; const int RandomAccessPattern = 0x8 | OuterRandomAccessPattern | InnerRandomAccessPattern; template class SparseMatrix; template class DynamicSparseMatrix; template class SparseVector; template class MappedSparseMatrix; template class SparseSelfAdjointView; template class SparseDiagonalProduct; template class SparseView; template class SparseSparseProduct; template class SparseTimeDenseProduct; template class DenseTimeSparseProduct; template class SparseDenseOuterProduct; template struct SparseSparseProductReturnType; template::ColsAtCompileTime,internal::traits::RowsAtCompileTime)> struct DenseSparseProductReturnType; template::ColsAtCompileTime,internal::traits::RowsAtCompileTime)> struct SparseDenseProductReturnType; template class SparseSymmetricPermutationProduct; namespace internal { template struct sparse_eval; template struct eval : sparse_eval::RowsAtCompileTime,traits::ColsAtCompileTime,traits::Flags> {}; template struct sparse_eval { typedef typename traits::Scalar Scalar_; typedef typename traits::StorageIndex StorageIndex_; public: typedef SparseVector type; }; template struct sparse_eval { typedef typename traits::Scalar Scalar_; typedef typename traits::StorageIndex StorageIndex_; public: typedef SparseVector type; }; // TODO this seems almost identical to plain_matrix_type template struct sparse_eval { typedef typename traits::Scalar Scalar_; typedef typename traits::StorageIndex StorageIndex_; enum { Options_ = ((Flags&RowMajorBit)==RowMajorBit) ? RowMajor : ColMajor }; public: typedef SparseMatrix type; }; template struct sparse_eval { typedef typename traits::Scalar Scalar_; public: typedef Matrix type; }; template struct plain_matrix_type { typedef typename traits::Scalar Scalar_; typedef typename traits::StorageIndex StorageIndex_; enum { Options_ = ((evaluator::Flags&RowMajorBit)==RowMajorBit) ? RowMajor : ColMajor }; public: typedef SparseMatrix type; }; template struct plain_object_eval : sparse_eval::RowsAtCompileTime,traits::ColsAtCompileTime, evaluator::Flags> {}; template struct solve_traits { typedef typename sparse_eval::Flags>::type PlainObject; }; template struct generic_xpr_base { typedef SparseMatrixBase type; }; struct SparseTriangularShape { static std::string debugName() { return "SparseTriangularShape"; } }; struct SparseSelfAdjointShape { static std::string debugName() { return "SparseSelfAdjointShape"; } }; template<> struct glue_shapes { typedef SparseSelfAdjointShape type; }; template<> struct glue_shapes { typedef SparseTriangularShape type; }; // return type of SparseCompressedBase::lower_bound; struct LowerBoundIndex { LowerBoundIndex() : value(-1), found(false) {} LowerBoundIndex(Index val, bool ok) : value(val), found(ok) {} Index value; bool found; }; } // end namespace internal /** \ingroup SparseCore_Module * * \class Triplet * * \brief A small structure to hold a non zero as a triplet (i,j,value). * * \sa SparseMatrix::setFromTriplets() */ template::StorageIndex > class Triplet { public: Triplet() : m_row(0), m_col(0), m_value(0) {} Triplet(const StorageIndex& i, const StorageIndex& j, const Scalar& v = Scalar(0)) : m_row(i), m_col(j), m_value(v) {} /** \returns the row index of the element */ const StorageIndex& row() const { return m_row; } /** \returns the column index of the element */ const StorageIndex& col() const { return m_col; } /** \returns the value of the element */ const Scalar& value() const { return m_value; } protected: StorageIndex m_row, m_col; Scalar m_value; }; } // end namespace Eigen #endif // EIGEN_SPARSEUTIL_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseVector.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2015 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSEVECTOR_H #define EIGEN_SPARSEVECTOR_H namespace Eigen { /** \ingroup SparseCore_Module * \class SparseVector * * \brief a sparse vector class * * \tparam Scalar_ the scalar type, i.e. the type of the coefficients * * See http://www.netlib.org/linalg/html_templates/node91.html for details on the storage scheme. * * This class can be extended with the help of the plugin mechanism described on the page * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_SPARSEVECTOR_PLUGIN. */ namespace internal { template struct traits > { typedef Scalar_ Scalar; typedef StorageIndex_ StorageIndex; typedef Sparse StorageKind; typedef MatrixXpr XprKind; enum { IsColVector = (Options_ & RowMajorBit) ? 0 : 1, RowsAtCompileTime = IsColVector ? Dynamic : 1, ColsAtCompileTime = IsColVector ? 1 : Dynamic, MaxRowsAtCompileTime = RowsAtCompileTime, MaxColsAtCompileTime = ColsAtCompileTime, Flags = Options_ | NestByRefBit | LvalueBit | (IsColVector ? 0 : RowMajorBit) | CompressedAccessBit, SupportedAccessPatterns = InnerRandomAccessPattern }; }; // Sparse-Vector-Assignment kinds: enum { SVA_RuntimeSwitch, SVA_Inner, SVA_Outer }; template< typename Dest, typename Src, int AssignmentKind = !bool(Src::IsVectorAtCompileTime) ? SVA_RuntimeSwitch : Src::InnerSizeAtCompileTime==1 ? SVA_Outer : SVA_Inner> struct sparse_vector_assign_selector; } template class SparseVector : public SparseCompressedBase > { typedef SparseCompressedBase Base; using Base::convert_index; public: EIGEN_SPARSE_PUBLIC_INTERFACE(SparseVector) EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(SparseVector, +=) EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(SparseVector, -=) typedef internal::CompressedStorage Storage; enum { IsColVector = internal::traits::IsColVector }; enum { Options = Options_ }; EIGEN_STRONG_INLINE Index rows() const { return IsColVector ? m_size : 1; } EIGEN_STRONG_INLINE Index cols() const { return IsColVector ? 1 : m_size; } EIGEN_STRONG_INLINE Index innerSize() const { return m_size; } EIGEN_STRONG_INLINE Index outerSize() const { return 1; } EIGEN_STRONG_INLINE const Scalar* valuePtr() const { return m_data.valuePtr(); } EIGEN_STRONG_INLINE Scalar* valuePtr() { return m_data.valuePtr(); } EIGEN_STRONG_INLINE const StorageIndex* innerIndexPtr() const { return m_data.indexPtr(); } EIGEN_STRONG_INLINE StorageIndex* innerIndexPtr() { return m_data.indexPtr(); } inline const StorageIndex* outerIndexPtr() const { return 0; } inline StorageIndex* outerIndexPtr() { return 0; } inline const StorageIndex* innerNonZeroPtr() const { return 0; } inline StorageIndex* innerNonZeroPtr() { return 0; } /** \internal */ inline Storage& data() { return m_data; } /** \internal */ inline const Storage& data() const { return m_data; } inline Scalar coeff(Index row, Index col) const { eigen_assert(IsColVector ? (col==0 && row>=0 && row=0 && col=0 && i=0 && row=0 && col=0 && i=0 && row=0 && col=0 && i= startId) && (m_data.index(p) > i) ) { m_data.index(p+1) = m_data.index(p); m_data.value(p+1) = m_data.value(p); --p; } m_data.index(p+1) = convert_index(i); m_data.value(p+1) = 0; return m_data.value(p+1); } /** */ inline void reserve(Index reserveSize) { m_data.reserve(reserveSize); } inline void finalize() {} /** \copydoc SparseMatrix::prune(const Scalar&,const RealScalar&) */ void prune(const Scalar& reference, const RealScalar& epsilon = NumTraits::dummy_precision()) { m_data.prune(reference,epsilon); } /** Resizes the sparse vector to \a rows x \a cols * * This method is provided for compatibility with matrices. * For a column vector, \a cols must be equal to 1. * For a row vector, \a rows must be equal to 1. * * \sa resize(Index) */ void resize(Index rows, Index cols) { eigen_assert((IsColVector ? cols : rows)==1 && "Outer dimension must equal 1"); resize(IsColVector ? rows : cols); } /** Resizes the sparse vector to \a newSize * This method deletes all entries, thus leaving an empty sparse vector * * \sa conservativeResize(), setZero() */ void resize(Index newSize) { m_size = newSize; m_data.clear(); } /** Resizes the sparse vector to \a newSize, while leaving old values untouched. * * If the size of the vector is decreased, then the storage of the out-of bounds coefficients is kept and reserved. * Call .data().squeeze() to free extra memory. * * \sa reserve(), setZero() */ void conservativeResize(Index newSize) { if (newSize < m_size) { Index i = 0; while (i inline SparseVector(const SparseMatrixBase& other) : m_size(0) { #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN #endif check_template_parameters(); *this = other.derived(); } inline SparseVector(const SparseVector& other) : Base(other), m_size(0) { check_template_parameters(); *this = other.derived(); } /** Swaps the values of \c *this and \a other. * Overloaded for performance: this version performs a \em shallow swap by swapping pointers and attributes only. * \sa SparseMatrixBase::swap() */ inline void swap(SparseVector& other) { std::swap(m_size, other.m_size); m_data.swap(other.m_data); } template inline void swap(SparseMatrix& other) { eigen_assert(other.outerSize()==1); std::swap(m_size, other.m_innerSize); m_data.swap(other.m_data); } inline SparseVector& operator=(const SparseVector& other) { if (other.isRValue()) { swap(other.const_cast_derived()); } else { resize(other.size()); m_data = other.m_data; } return *this; } template inline SparseVector& operator=(const SparseMatrixBase& other) { SparseVector tmp(other.size()); internal::sparse_vector_assign_selector::run(tmp,other.derived()); this->swap(tmp); return *this; } #ifndef EIGEN_PARSED_BY_DOXYGEN template inline SparseVector& operator=(const SparseSparseProduct& product) { return Base::operator=(product); } #endif friend std::ostream & operator << (std::ostream & s, const SparseVector& m) { for (Index i=0; i::IsSigned,THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE); EIGEN_STATIC_ASSERT((Options_&(ColMajor|RowMajor))==Options,INVALID_MATRIX_TEMPLATE_PARAMETERS); } Storage m_data; Index m_size; }; namespace internal { template struct evaluator > : evaluator_base > { typedef SparseVector SparseVectorType; typedef evaluator_base Base; typedef typename SparseVectorType::InnerIterator InnerIterator; typedef typename SparseVectorType::ReverseInnerIterator ReverseInnerIterator; enum { CoeffReadCost = NumTraits::ReadCost, Flags = SparseVectorType::Flags }; evaluator() : Base() {} explicit evaluator(const SparseVectorType &mat) : m_matrix(&mat) { EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); } inline Index nonZerosEstimate() const { return m_matrix->nonZeros(); } operator SparseVectorType&() { return m_matrix->const_cast_derived(); } operator const SparseVectorType&() const { return *m_matrix; } const SparseVectorType *m_matrix; }; template< typename Dest, typename Src> struct sparse_vector_assign_selector { static void run(Dest& dst, const Src& src) { eigen_internal_assert(src.innerSize()==src.size()); typedef internal::evaluator SrcEvaluatorType; SrcEvaluatorType srcEval(src); for(typename SrcEvaluatorType::InnerIterator it(srcEval, 0); it; ++it) dst.insert(it.index()) = it.value(); } }; template< typename Dest, typename Src> struct sparse_vector_assign_selector { static void run(Dest& dst, const Src& src) { eigen_internal_assert(src.outerSize()==src.size()); typedef internal::evaluator SrcEvaluatorType; SrcEvaluatorType srcEval(src); for(Index i=0; i struct sparse_vector_assign_selector { static void run(Dest& dst, const Src& src) { if(src.outerSize()==1) sparse_vector_assign_selector::run(dst, src); else sparse_vector_assign_selector::run(dst, src); } }; } } // end namespace Eigen #endif // EIGEN_SPARSEVECTOR_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/SparseView.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2011-2014 Gael Guennebaud // Copyright (C) 2010 Daniel Lowengrub // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSEVIEW_H #define EIGEN_SPARSEVIEW_H namespace Eigen { namespace internal { template struct traits > : traits { typedef typename MatrixType::StorageIndex StorageIndex; typedef Sparse StorageKind; enum { Flags = int(traits::Flags) & (RowMajorBit) }; }; } // end namespace internal /** \ingroup SparseCore_Module * \class SparseView * * \brief Expression of a dense or sparse matrix with zero or too small values removed * * \tparam MatrixType the type of the object of which we are removing the small entries * * This class represents an expression of a given dense or sparse matrix with * entries smaller than \c reference * \c epsilon are removed. * It is the return type of MatrixBase::sparseView() and SparseMatrixBase::pruned() * and most of the time this is the only way it is used. * * \sa MatrixBase::sparseView(), SparseMatrixBase::pruned() */ template class SparseView : public SparseMatrixBase > { typedef typename MatrixType::Nested MatrixTypeNested; typedef typename internal::remove_all::type _MatrixTypeNested; typedef SparseMatrixBase Base; public: EIGEN_SPARSE_PUBLIC_INTERFACE(SparseView) typedef typename internal::remove_all::type NestedExpression; explicit SparseView(const MatrixType& mat, const Scalar& reference = Scalar(0), const RealScalar &epsilon = NumTraits::dummy_precision()) : m_matrix(mat), m_reference(reference), m_epsilon(epsilon) {} inline Index rows() const { return m_matrix.rows(); } inline Index cols() const { return m_matrix.cols(); } inline Index innerSize() const { return m_matrix.innerSize(); } inline Index outerSize() const { return m_matrix.outerSize(); } /** \returns the nested expression */ const typename internal::remove_all::type& nestedExpression() const { return m_matrix; } Scalar reference() const { return m_reference; } RealScalar epsilon() const { return m_epsilon; } protected: MatrixTypeNested m_matrix; Scalar m_reference; RealScalar m_epsilon; }; namespace internal { // TODO find a way to unify the two following variants // This is tricky because implementing an inner iterator on top of an IndexBased evaluator is // not easy because the evaluators do not expose the sizes of the underlying expression. template struct unary_evaluator, IteratorBased> : public evaluator_base > { typedef typename evaluator::InnerIterator EvalIterator; public: typedef SparseView XprType; class InnerIterator : public EvalIterator { protected: typedef typename XprType::Scalar Scalar; public: EIGEN_STRONG_INLINE InnerIterator(const unary_evaluator& sve, Index outer) : EvalIterator(sve.m_argImpl,outer), m_view(sve.m_view) { incrementToNonZero(); } EIGEN_STRONG_INLINE InnerIterator& operator++() { EvalIterator::operator++(); incrementToNonZero(); return *this; } using EvalIterator::value; protected: const XprType &m_view; private: void incrementToNonZero() { while((bool(*this)) && internal::isMuchSmallerThan(value(), m_view.reference(), m_view.epsilon())) { EvalIterator::operator++(); } } }; enum { CoeffReadCost = evaluator::CoeffReadCost, Flags = XprType::Flags }; explicit unary_evaluator(const XprType& xpr) : m_argImpl(xpr.nestedExpression()), m_view(xpr) {} protected: evaluator m_argImpl; const XprType &m_view; }; template struct unary_evaluator, IndexBased> : public evaluator_base > { public: typedef SparseView XprType; protected: enum { IsRowMajor = (XprType::Flags&RowMajorBit)==RowMajorBit }; typedef typename XprType::Scalar Scalar; typedef typename XprType::StorageIndex StorageIndex; public: class InnerIterator { public: EIGEN_STRONG_INLINE InnerIterator(const unary_evaluator& sve, Index outer) : m_sve(sve), m_inner(0), m_outer(outer), m_end(sve.m_view.innerSize()) { incrementToNonZero(); } EIGEN_STRONG_INLINE InnerIterator& operator++() { m_inner++; incrementToNonZero(); return *this; } EIGEN_STRONG_INLINE Scalar value() const { return (IsRowMajor) ? m_sve.m_argImpl.coeff(m_outer, m_inner) : m_sve.m_argImpl.coeff(m_inner, m_outer); } EIGEN_STRONG_INLINE StorageIndex index() const { return m_inner; } inline Index row() const { return IsRowMajor ? m_outer : index(); } inline Index col() const { return IsRowMajor ? index() : m_outer; } EIGEN_STRONG_INLINE operator bool() const { return m_inner < m_end && m_inner>=0; } protected: const unary_evaluator &m_sve; Index m_inner; const Index m_outer; const Index m_end; private: void incrementToNonZero() { while((bool(*this)) && internal::isMuchSmallerThan(value(), m_sve.m_view.reference(), m_sve.m_view.epsilon())) { m_inner++; } } }; enum { CoeffReadCost = evaluator::CoeffReadCost, Flags = XprType::Flags }; explicit unary_evaluator(const XprType& xpr) : m_argImpl(xpr.nestedExpression()), m_view(xpr) {} protected: evaluator m_argImpl; const XprType &m_view; }; } // end namespace internal /** \ingroup SparseCore_Module * * \returns a sparse expression of the dense expression \c *this with values smaller than * \a reference * \a epsilon removed. * * This method is typically used when prototyping to convert a quickly assembled dense Matrix \c D to a SparseMatrix \c S: * \code * MatrixXd D(n,m); * SparseMatrix S; * S = D.sparseView(); // suppress numerical zeros (exact) * S = D.sparseView(reference); * S = D.sparseView(reference,epsilon); * \endcode * where \a reference is a meaningful non zero reference value, * and \a epsilon is a tolerance factor defaulting to NumTraits::dummy_precision(). * * \sa SparseMatrixBase::pruned(), class SparseView */ template const SparseView MatrixBase::sparseView(const Scalar& reference, const typename NumTraits::Real& epsilon) const { return SparseView(derived(), reference, epsilon); } /** \returns an expression of \c *this with values smaller than * \a reference * \a epsilon removed. * * This method is typically used in conjunction with the product of two sparse matrices * to automatically prune the smallest values as follows: * \code * C = (A*B).pruned(); // suppress numerical zeros (exact) * C = (A*B).pruned(ref); * C = (A*B).pruned(ref,epsilon); * \endcode * where \c ref is a meaningful non zero reference value. * */ template const SparseView SparseMatrixBase::pruned(const Scalar& reference, const RealScalar& epsilon) const { return SparseView(derived(), reference, epsilon); } } // end namespace Eigen #endif ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseCore/TriangularSolver.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSETRIANGULARSOLVER_H #define EIGEN_SPARSETRIANGULARSOLVER_H namespace Eigen { namespace internal { template::Flags) & RowMajorBit> struct sparse_solve_triangular_selector; // forward substitution, row-major template struct sparse_solve_triangular_selector { typedef typename Rhs::Scalar Scalar; typedef evaluator LhsEval; typedef typename evaluator::InnerIterator LhsIterator; static void run(const Lhs& lhs, Rhs& other) { LhsEval lhsEval(lhs); for(Index col=0 ; col struct sparse_solve_triangular_selector { typedef typename Rhs::Scalar Scalar; typedef evaluator LhsEval; typedef typename evaluator::InnerIterator LhsIterator; static void run(const Lhs& lhs, Rhs& other) { LhsEval lhsEval(lhs); for(Index col=0 ; col=0 ; --i) { Scalar tmp = other.coeff(i,col); Scalar l_ii(0); LhsIterator it(lhsEval, i); while(it && it.index() struct sparse_solve_triangular_selector { typedef typename Rhs::Scalar Scalar; typedef evaluator LhsEval; typedef typename evaluator::InnerIterator LhsIterator; static void run(const Lhs& lhs, Rhs& other) { LhsEval lhsEval(lhs); for(Index col=0 ; col struct sparse_solve_triangular_selector { typedef typename Rhs::Scalar Scalar; typedef evaluator LhsEval; typedef typename evaluator::InnerIterator LhsIterator; static void run(const Lhs& lhs, Rhs& other) { LhsEval lhsEval(lhs); for(Index col=0 ; col=0; --i) { Scalar& tmp = other.coeffRef(i,col); if (tmp!=Scalar(0)) // optimization when other is actually sparse { if(!(Mode & UnitDiag)) { // TODO replace this by a binary search. make sure the binary search is safe for partially sorted elements LhsIterator it(lhsEval, i); while(it && it.index()!=i) ++it; eigen_assert(it && it.index()==i); other.coeffRef(i,col) /= it.value(); } LhsIterator it(lhsEval, i); for(; it && it.index() template void TriangularViewImpl::solveInPlace(MatrixBase& other) const { eigen_assert(derived().cols() == derived().rows() && derived().cols() == other.rows()); eigen_assert((!(Mode & ZeroDiag)) && bool(Mode & (Upper|Lower))); enum { copy = internal::traits::Flags & RowMajorBit }; typedef typename internal::conditional::type, OtherDerived&>::type OtherCopy; OtherCopy otherCopy(other.derived()); internal::sparse_solve_triangular_selector::type, Mode>::run(derived().nestedExpression(), otherCopy); if (copy) other = otherCopy; } #endif // pure sparse path namespace internal { template struct sparse_solve_triangular_sparse_selector; // forward substitution, col-major template struct sparse_solve_triangular_sparse_selector { typedef typename Rhs::Scalar Scalar; typedef typename promote_index_type::StorageIndex, typename traits::StorageIndex>::type StorageIndex; static void run(const Lhs& lhs, Rhs& other) { const bool IsLower = (UpLo==Lower); AmbiVector tempVector(other.rows()*2); tempVector.setBounds(0,other.rows()); Rhs res(other.rows(), other.cols()); res.reserve(other.nonZeros()); for(Index col=0 ; col=0; i+=IsLower?1:-1) { tempVector.restart(); Scalar& ci = tempVector.coeffRef(i); if (ci!=Scalar(0)) { // find typename Lhs::InnerIterator it(lhs, i); if(!(Mode & UnitDiag)) { if (IsLower) { eigen_assert(it.index()==i); ci /= it.value(); } else ci /= lhs.coeff(i,i); } tempVector.restart(); if (IsLower) { if (it.index()==i) ++it; for(; it; ++it) tempVector.coeffRef(it.index()) -= ci * it.value(); } else { for(; it && it.index()::Iterator it(tempVector/*,1e-12*/); it; ++it) { ++ count; // std::cerr << "fill " << it.index() << ", " << col << "\n"; // std::cout << it.value() << " "; // FIXME use insertBack res.insert(it.index(), col) = it.value(); } // std::cout << "tempVector.nonZeros() == " << int(count) << " / " << (other.rows()) << "\n"; } res.finalize(); other = res.markAsRValue(); } }; } // end namespace internal #ifndef EIGEN_PARSED_BY_DOXYGEN template template void TriangularViewImpl::solveInPlace(SparseMatrixBase& other) const { eigen_assert(derived().cols() == derived().rows() && derived().cols() == other.rows()); eigen_assert( (!(Mode & ZeroDiag)) && bool(Mode & (Upper|Lower))); // enum { copy = internal::traits::Flags & RowMajorBit }; // typedef typename internal::conditional::type, OtherDerived&>::type OtherCopy; // OtherCopy otherCopy(other.derived()); internal::sparse_solve_triangular_sparse_selector::run(derived().nestedExpression(), other.derived()); // if (copy) // other = otherCopy; } #endif } // end namespace Eigen #endif // EIGEN_SPARSETRIANGULARSOLVER_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseLU/SparseLU.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // Copyright (C) 2012-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSE_LU_H #define EIGEN_SPARSE_LU_H namespace Eigen { template > class SparseLU; template struct SparseLUMatrixLReturnType; template struct SparseLUMatrixUReturnType; template class SparseLUTransposeView : public SparseSolverBase > { protected: typedef SparseSolverBase > APIBase; using APIBase::m_isInitialized; public: typedef typename SparseLUType::Scalar Scalar; typedef typename SparseLUType::StorageIndex StorageIndex; typedef typename SparseLUType::MatrixType MatrixType; typedef typename SparseLUType::OrderingType OrderingType; enum { ColsAtCompileTime = MatrixType::ColsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; SparseLUTransposeView() : m_sparseLU(NULL) {} SparseLUTransposeView(const SparseLUTransposeView& view) { this->m_sparseLU = view.m_sparseLU; } void setIsInitialized(const bool isInitialized) {this->m_isInitialized = isInitialized;} void setSparseLU(SparseLUType* sparseLU) {m_sparseLU = sparseLU;} using APIBase::_solve_impl; template bool _solve_impl(const MatrixBase &B, MatrixBase &X_base) const { Dest& X(X_base.derived()); eigen_assert(m_sparseLU->info() == Success && "The matrix should be factorized first"); EIGEN_STATIC_ASSERT((Dest::Flags&RowMajorBit)==0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); // this ugly const_cast_derived() helps to detect aliasing when applying the permutations for(Index j = 0; j < B.cols(); ++j){ X.col(j) = m_sparseLU->colsPermutation() * B.const_cast_derived().col(j); } //Forward substitution with transposed or adjoint of U m_sparseLU->matrixU().template solveTransposedInPlace(X); //Backward substitution with transposed or adjoint of L m_sparseLU->matrixL().template solveTransposedInPlace(X); // Permute back the solution for (Index j = 0; j < B.cols(); ++j) X.col(j) = m_sparseLU->rowsPermutation().transpose() * X.col(j); return true; } inline Index rows() const { return m_sparseLU->rows(); } inline Index cols() const { return m_sparseLU->cols(); } private: SparseLUType *m_sparseLU; SparseLUTransposeView& operator=(const SparseLUTransposeView&); }; /** \ingroup SparseLU_Module * \class SparseLU * * \brief Sparse supernodal LU factorization for general matrices * * This class implements the supernodal LU factorization for general matrices. * It uses the main techniques from the sequential SuperLU package * (http://crd-legacy.lbl.gov/~xiaoye/SuperLU/). It handles transparently real * and complex arithmetic with single and double precision, depending on the * scalar type of your input matrix. * The code has been optimized to provide BLAS-3 operations during supernode-panel updates. * It benefits directly from the built-in high-performant Eigen BLAS routines. * Moreover, when the size of a supernode is very small, the BLAS calls are avoided to * enable a better optimization from the compiler. For best performance, * you should compile it with NDEBUG flag to avoid the numerous bounds checking on vectors. * * An important parameter of this class is the ordering method. It is used to reorder the columns * (and eventually the rows) of the matrix to reduce the number of new elements that are created during * numerical factorization. The cheapest method available is COLAMD. * See \link OrderingMethods_Module the OrderingMethods module \endlink for the list of * built-in and external ordering methods. * * Simple example with key steps * \code * VectorXd x(n), b(n); * SparseMatrix A; * SparseLU, COLAMDOrdering > solver; * // fill A and b; * // Compute the ordering permutation vector from the structural pattern of A * solver.analyzePattern(A); * // Compute the numerical factorization * solver.factorize(A); * //Use the factors to solve the linear system * x = solver.solve(b); * \endcode * * \warning The input matrix A should be in a \b compressed and \b column-major form. * Otherwise an expensive copy will be made. You can call the inexpensive makeCompressed() to get a compressed matrix. * * \note Unlike the initial SuperLU implementation, there is no step to equilibrate the matrix. * For badly scaled matrices, this step can be useful to reduce the pivoting during factorization. * If this is the case for your matrices, you can try the basic scaling method at * "unsupported/Eigen/src/IterativeSolvers/Scaling.h" * * \tparam MatrixType_ The type of the sparse matrix. It must be a column-major SparseMatrix<> * \tparam OrderingType_ The ordering method to use, either AMD, COLAMD or METIS. Default is COLMAD * * \implsparsesolverconcept * * \sa \ref TutorialSparseSolverConcept * \sa \ref OrderingMethods_Module */ template class SparseLU : public SparseSolverBase >, public internal::SparseLUImpl { protected: typedef SparseSolverBase > APIBase; using APIBase::m_isInitialized; public: using APIBase::_solve_impl; typedef MatrixType_ MatrixType; typedef OrderingType_ OrderingType; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef typename MatrixType::StorageIndex StorageIndex; typedef SparseMatrix NCMatrix; typedef internal::MappedSuperNodalMatrix SCMatrix; typedef Matrix ScalarVector; typedef Matrix IndexVector; typedef PermutationMatrix PermutationType; typedef internal::SparseLUImpl Base; enum { ColsAtCompileTime = MatrixType::ColsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; public: SparseLU():m_lastError(""),m_Ustore(0,0,0,0,0,0),m_symmetricmode(false),m_diagpivotthresh(1.0),m_detPermR(1) { initperfvalues(); } explicit SparseLU(const MatrixType& matrix) : m_lastError(""),m_Ustore(0,0,0,0,0,0),m_symmetricmode(false),m_diagpivotthresh(1.0),m_detPermR(1) { initperfvalues(); compute(matrix); } ~SparseLU() { // Free all explicit dynamic pointers } void analyzePattern (const MatrixType& matrix); void factorize (const MatrixType& matrix); void simplicialfactorize(const MatrixType& matrix); /** * Compute the symbolic and numeric factorization of the input sparse matrix. * The input matrix should be in column-major storage. */ void compute (const MatrixType& matrix) { // Analyze analyzePattern(matrix); //Factorize factorize(matrix); } /** \returns an expression of the transposed of the factored matrix. * * A typical usage is to solve for the transposed problem A^T x = b: * \code * solver.compute(A); * x = solver.transpose().solve(b); * \endcode * * \sa adjoint(), solve() */ const SparseLUTransposeView > transpose() { SparseLUTransposeView > transposeView; transposeView.setSparseLU(this); transposeView.setIsInitialized(this->m_isInitialized); return transposeView; } /** \returns an expression of the adjoint of the factored matrix * * A typical usage is to solve for the adjoint problem A' x = b: * \code * solver.compute(A); * x = solver.adjoint().solve(b); * \endcode * * For real scalar types, this function is equivalent to transpose(). * * \sa transpose(), solve() */ const SparseLUTransposeView > adjoint() { SparseLUTransposeView > adjointView; adjointView.setSparseLU(this); adjointView.setIsInitialized(this->m_isInitialized); return adjointView; } inline Index rows() const { return m_mat.rows(); } inline Index cols() const { return m_mat.cols(); } /** Indicate that the pattern of the input matrix is symmetric */ void isSymmetric(bool sym) { m_symmetricmode = sym; } /** \returns an expression of the matrix L, internally stored as supernodes * The only operation available with this expression is the triangular solve * \code * y = b; matrixL().solveInPlace(y); * \endcode */ SparseLUMatrixLReturnType matrixL() const { return SparseLUMatrixLReturnType(m_Lstore); } /** \returns an expression of the matrix U, * The only operation available with this expression is the triangular solve * \code * y = b; matrixU().solveInPlace(y); * \endcode */ SparseLUMatrixUReturnType > matrixU() const { return SparseLUMatrixUReturnType >(m_Lstore, m_Ustore); } /** * \returns a reference to the row matrix permutation \f$ P_r \f$ such that \f$P_r A P_c^T = L U\f$ * \sa colsPermutation() */ inline const PermutationType& rowsPermutation() const { return m_perm_r; } /** * \returns a reference to the column matrix permutation\f$ P_c^T \f$ such that \f$P_r A P_c^T = L U\f$ * \sa rowsPermutation() */ inline const PermutationType& colsPermutation() const { return m_perm_c; } /** Set the threshold used for a diagonal entry to be an acceptable pivot. */ void setPivotThreshold(const RealScalar& thresh) { m_diagpivotthresh = thresh; } #ifdef EIGEN_PARSED_BY_DOXYGEN /** \returns the solution X of \f$ A X = B \f$ using the current decomposition of A. * * \warning the destination matrix X in X = this->solve(B) must be colmun-major. * * \sa compute() */ template inline const Solve solve(const MatrixBase& B) const; #endif // EIGEN_PARSED_BY_DOXYGEN /** \brief Reports whether previous computation was successful. * * \returns \c Success if computation was successful, * \c NumericalIssue if the LU factorization reports a problem, zero diagonal for instance * \c InvalidInput if the input matrix is invalid * * \sa iparm() */ ComputationInfo info() const { eigen_assert(m_isInitialized && "Decomposition is not initialized."); return m_info; } /** * \returns A string describing the type of error */ std::string lastErrorMessage() const { return m_lastError; } template bool _solve_impl(const MatrixBase &B, MatrixBase &X_base) const { Dest& X(X_base.derived()); eigen_assert(m_factorizationIsOk && "The matrix should be factorized first"); EIGEN_STATIC_ASSERT((Dest::Flags&RowMajorBit)==0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); // Permute the right hand side to form X = Pr*B // on return, X is overwritten by the computed solution X.resize(B.rows(),B.cols()); // this ugly const_cast_derived() helps to detect aliasing when applying the permutations for(Index j = 0; j < B.cols(); ++j) X.col(j) = rowsPermutation() * B.const_cast_derived().col(j); //Forward substitution with L this->matrixL().solveInPlace(X); this->matrixU().solveInPlace(X); // Permute back the solution for (Index j = 0; j < B.cols(); ++j) X.col(j) = colsPermutation().inverse() * X.col(j); return true; } /** * \returns the absolute value of the determinant of the matrix of which * *this is the QR decomposition. * * \warning a determinant can be very big or small, so for matrices * of large enough dimension, there is a risk of overflow/underflow. * One way to work around that is to use logAbsDeterminant() instead. * * \sa logAbsDeterminant(), signDeterminant() */ Scalar absDeterminant() { using std::abs; eigen_assert(m_factorizationIsOk && "The matrix should be factorized first."); // Initialize with the determinant of the row matrix Scalar det = Scalar(1.); // Note that the diagonal blocks of U are stored in supernodes, // which are available in the L part :) for (Index j = 0; j < this->cols(); ++j) { for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it) { if(it.index() == j) { det *= abs(it.value()); break; } } } return det; } /** \returns the natural log of the absolute value of the determinant of the matrix * of which **this is the QR decomposition * * \note This method is useful to work around the risk of overflow/underflow that's * inherent to the determinant computation. * * \sa absDeterminant(), signDeterminant() */ Scalar logAbsDeterminant() const { using std::log; using std::abs; eigen_assert(m_factorizationIsOk && "The matrix should be factorized first."); Scalar det = Scalar(0.); for (Index j = 0; j < this->cols(); ++j) { for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it) { if(it.row() < j) continue; if(it.row() == j) { det += log(abs(it.value())); break; } } } return det; } /** \returns A number representing the sign of the determinant * * \sa absDeterminant(), logAbsDeterminant() */ Scalar signDeterminant() { eigen_assert(m_factorizationIsOk && "The matrix should be factorized first."); // Initialize with the determinant of the row matrix Index det = 1; // Note that the diagonal blocks of U are stored in supernodes, // which are available in the L part :) for (Index j = 0; j < this->cols(); ++j) { for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it) { if(it.index() == j) { if(it.value()<0) det = -det; else if(it.value()==0) return 0; break; } } } return det * m_detPermR * m_detPermC; } /** \returns The determinant of the matrix. * * \sa absDeterminant(), logAbsDeterminant() */ Scalar determinant() { eigen_assert(m_factorizationIsOk && "The matrix should be factorized first."); // Initialize with the determinant of the row matrix Scalar det = Scalar(1.); // Note that the diagonal blocks of U are stored in supernodes, // which are available in the L part :) for (Index j = 0; j < this->cols(); ++j) { for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it) { if(it.index() == j) { det *= it.value(); break; } } } return (m_detPermR * m_detPermC) > 0 ? det : -det; } Index nnzL() const { return m_nnzL; }; Index nnzU() const { return m_nnzU; }; protected: // Functions void initperfvalues() { m_perfv.panel_size = 16; m_perfv.relax = 1; m_perfv.maxsuper = 128; m_perfv.rowblk = 16; m_perfv.colblk = 8; m_perfv.fillfactor = 20; } // Variables mutable ComputationInfo m_info; bool m_factorizationIsOk; bool m_analysisIsOk; std::string m_lastError; NCMatrix m_mat; // The input (permuted ) matrix SCMatrix m_Lstore; // The lower triangular matrix (supernodal) MappedSparseMatrix m_Ustore; // The upper triangular matrix PermutationType m_perm_c; // Column permutation PermutationType m_perm_r ; // Row permutation IndexVector m_etree; // Column elimination tree typename Base::GlobalLU_t m_glu; // SparseLU options bool m_symmetricmode; // values for performance internal::perfvalues m_perfv; RealScalar m_diagpivotthresh; // Specifies the threshold used for a diagonal entry to be an acceptable pivot Index m_nnzL, m_nnzU; // Nonzeros in L and U factors Index m_detPermR, m_detPermC; // Determinants of the permutation matrices private: // Disable copy constructor SparseLU (const SparseLU& ); }; // End class SparseLU // Functions needed by the anaysis phase /** * Compute the column permutation to minimize the fill-in * * - Apply this permutation to the input matrix - * * - Compute the column elimination tree on the permuted matrix * * - Postorder the elimination tree and the column permutation * */ template void SparseLU::analyzePattern(const MatrixType& mat) { //TODO It is possible as in SuperLU to compute row and columns scaling vectors to equilibrate the matrix mat. // Firstly, copy the whole input matrix. m_mat = mat; // Compute fill-in ordering OrderingType ord; ord(m_mat,m_perm_c); // Apply the permutation to the column of the input matrix if (m_perm_c.size()) { m_mat.uncompress(); //NOTE: The effect of this command is only to create the InnerNonzeros pointers. FIXME : This vector is filled but not subsequently used. // Then, permute only the column pointers ei_declare_aligned_stack_constructed_variable(StorageIndex,outerIndexPtr,mat.cols()+1,mat.isCompressed()?const_cast(mat.outerIndexPtr()):0); // If the input matrix 'mat' is uncompressed, then the outer-indices do not match the ones of m_mat, and a copy is thus needed. if(!mat.isCompressed()) IndexVector::Map(outerIndexPtr, mat.cols()+1) = IndexVector::Map(m_mat.outerIndexPtr(),mat.cols()+1); // Apply the permutation and compute the nnz per column. for (Index i = 0; i < mat.cols(); i++) { m_mat.outerIndexPtr()[m_perm_c.indices()(i)] = outerIndexPtr[i]; m_mat.innerNonZeroPtr()[m_perm_c.indices()(i)] = outerIndexPtr[i+1] - outerIndexPtr[i]; } } // Compute the column elimination tree of the permuted matrix IndexVector firstRowElt; internal::coletree(m_mat, m_etree,firstRowElt); // In symmetric mode, do not do postorder here if (!m_symmetricmode) { IndexVector post, iwork; // Post order etree internal::treePostorder(StorageIndex(m_mat.cols()), m_etree, post); // Renumber etree in postorder Index m = m_mat.cols(); iwork.resize(m+1); for (Index i = 0; i < m; ++i) iwork(post(i)) = post(m_etree(i)); m_etree = iwork; // Postmultiply A*Pc by post, i.e reorder the matrix according to the postorder of the etree PermutationType post_perm(m); for (Index i = 0; i < m; i++) post_perm.indices()(i) = post(i); // Combine the two permutations : postorder the permutation for future use if(m_perm_c.size()) { m_perm_c = post_perm * m_perm_c; } } // end postordering m_analysisIsOk = true; } // Functions needed by the numerical factorization phase /** * - Numerical factorization * - Interleaved with the symbolic factorization * On exit, info is * * = 0: successful factorization * * > 0: if info = i, and i is * * <= A->ncol: U(i,i) is exactly zero. The factorization has * been completed, but the factor U is exactly singular, * and division by zero will occur if it is used to solve a * system of equations. * * > A->ncol: number of bytes allocated when memory allocation * failure occurred, plus A->ncol. If lwork = -1, it is * the estimated amount of space needed, plus A->ncol. */ template void SparseLU::factorize(const MatrixType& matrix) { using internal::emptyIdxLU; eigen_assert(m_analysisIsOk && "analyzePattern() should be called first"); eigen_assert((matrix.rows() == matrix.cols()) && "Only for squared matrices"); m_isInitialized = true; // Apply the column permutation computed in analyzepattern() // m_mat = matrix * m_perm_c.inverse(); m_mat = matrix; if (m_perm_c.size()) { m_mat.uncompress(); //NOTE: The effect of this command is only to create the InnerNonzeros pointers. //Then, permute only the column pointers const StorageIndex * outerIndexPtr; if (matrix.isCompressed()) outerIndexPtr = matrix.outerIndexPtr(); else { StorageIndex* outerIndexPtr_t = new StorageIndex[matrix.cols()+1]; for(Index i = 0; i <= matrix.cols(); i++) outerIndexPtr_t[i] = m_mat.outerIndexPtr()[i]; outerIndexPtr = outerIndexPtr_t; } for (Index i = 0; i < matrix.cols(); i++) { m_mat.outerIndexPtr()[m_perm_c.indices()(i)] = outerIndexPtr[i]; m_mat.innerNonZeroPtr()[m_perm_c.indices()(i)] = outerIndexPtr[i+1] - outerIndexPtr[i]; } if(!matrix.isCompressed()) delete[] outerIndexPtr; } else { //FIXME This should not be needed if the empty permutation is handled transparently m_perm_c.resize(matrix.cols()); for(StorageIndex i = 0; i < matrix.cols(); ++i) m_perm_c.indices()(i) = i; } Index m = m_mat.rows(); Index n = m_mat.cols(); Index nnz = m_mat.nonZeros(); Index maxpanel = m_perfv.panel_size * m; // Allocate working storage common to the factor routines Index lwork = 0; Index info = Base::memInit(m, n, nnz, lwork, m_perfv.fillfactor, m_perfv.panel_size, m_glu); if (info) { m_lastError = "UNABLE TO ALLOCATE WORKING MEMORY\n\n" ; m_factorizationIsOk = false; return ; } // Set up pointers for integer working arrays IndexVector segrep(m); segrep.setZero(); IndexVector parent(m); parent.setZero(); IndexVector xplore(m); xplore.setZero(); IndexVector repfnz(maxpanel); IndexVector panel_lsub(maxpanel); IndexVector xprune(n); xprune.setZero(); IndexVector marker(m*internal::LUNoMarker); marker.setZero(); repfnz.setConstant(-1); panel_lsub.setConstant(-1); // Set up pointers for scalar working arrays ScalarVector dense; dense.setZero(maxpanel); ScalarVector tempv; tempv.setZero(internal::LUnumTempV(m, m_perfv.panel_size, m_perfv.maxsuper, /*m_perfv.rowblk*/m) ); // Compute the inverse of perm_c PermutationType iperm_c(m_perm_c.inverse()); // Identify initial relaxed snodes IndexVector relax_end(n); if ( m_symmetricmode == true ) Base::heap_relax_snode(n, m_etree, m_perfv.relax, marker, relax_end); else Base::relax_snode(n, m_etree, m_perfv.relax, marker, relax_end); m_perm_r.resize(m); m_perm_r.indices().setConstant(-1); marker.setConstant(-1); m_detPermR = 1; // Record the determinant of the row permutation m_glu.supno(0) = emptyIdxLU; m_glu.xsup.setConstant(0); m_glu.xsup(0) = m_glu.xlsub(0) = m_glu.xusub(0) = m_glu.xlusup(0) = Index(0); // Work on one 'panel' at a time. A panel is one of the following : // (a) a relaxed supernode at the bottom of the etree, or // (b) panel_size contiguous columns, defined by the user Index jcol; Index pivrow; // Pivotal row number in the original row matrix Index nseg1; // Number of segments in U-column above panel row jcol Index nseg; // Number of segments in each U-column Index irep; Index i, k, jj; for (jcol = 0; jcol < n; ) { // Adjust panel size so that a panel won't overlap with the next relaxed snode. Index panel_size = m_perfv.panel_size; // upper bound on panel width for (k = jcol + 1; k < (std::min)(jcol+panel_size, n); k++) { if (relax_end(k) != emptyIdxLU) { panel_size = k - jcol; break; } } if (k == n) panel_size = n - jcol; // Symbolic outer factorization on a panel of columns Base::panel_dfs(m, panel_size, jcol, m_mat, m_perm_r.indices(), nseg1, dense, panel_lsub, segrep, repfnz, xprune, marker, parent, xplore, m_glu); // Numeric sup-panel updates in topological order Base::panel_bmod(m, panel_size, jcol, nseg1, dense, tempv, segrep, repfnz, m_glu); // Sparse LU within the panel, and below the panel diagonal for ( jj = jcol; jj< jcol + panel_size; jj++) { k = (jj - jcol) * m; // Column index for w-wide arrays nseg = nseg1; // begin after all the panel segments //Depth-first-search for the current column VectorBlock panel_lsubk(panel_lsub, k, m); VectorBlock repfnz_k(repfnz, k, m); info = Base::column_dfs(m, jj, m_perm_r.indices(), m_perfv.maxsuper, nseg, panel_lsubk, segrep, repfnz_k, xprune, marker, parent, xplore, m_glu); if ( info ) { m_lastError = "UNABLE TO EXPAND MEMORY IN COLUMN_DFS() "; m_info = NumericalIssue; m_factorizationIsOk = false; return; } // Numeric updates to this column VectorBlock dense_k(dense, k, m); VectorBlock segrep_k(segrep, nseg1, m-nseg1); info = Base::column_bmod(jj, (nseg - nseg1), dense_k, tempv, segrep_k, repfnz_k, jcol, m_glu); if ( info ) { m_lastError = "UNABLE TO EXPAND MEMORY IN COLUMN_BMOD() "; m_info = NumericalIssue; m_factorizationIsOk = false; return; } // Copy the U-segments to ucol(*) info = Base::copy_to_ucol(jj, nseg, segrep, repfnz_k ,m_perm_r.indices(), dense_k, m_glu); if ( info ) { m_lastError = "UNABLE TO EXPAND MEMORY IN COPY_TO_UCOL() "; m_info = NumericalIssue; m_factorizationIsOk = false; return; } // Form the L-segment info = Base::pivotL(jj, m_diagpivotthresh, m_perm_r.indices(), iperm_c.indices(), pivrow, m_glu); if ( info ) { m_lastError = "THE MATRIX IS STRUCTURALLY SINGULAR ... ZERO COLUMN AT "; std::ostringstream returnInfo; returnInfo << info; m_lastError += returnInfo.str(); m_info = NumericalIssue; m_factorizationIsOk = false; return; } // Update the determinant of the row permutation matrix // FIXME: the following test is not correct, we should probably take iperm_c into account and pivrow is not directly the row pivot. if (pivrow != jj) m_detPermR = -m_detPermR; // Prune columns (0:jj-1) using column jj Base::pruneL(jj, m_perm_r.indices(), pivrow, nseg, segrep, repfnz_k, xprune, m_glu); // Reset repfnz for this column for (i = 0; i < nseg; i++) { irep = segrep(i); repfnz_k(irep) = emptyIdxLU; } } // end SparseLU within the panel jcol += panel_size; // Move to the next panel } // end for -- end elimination m_detPermR = m_perm_r.determinant(); m_detPermC = m_perm_c.determinant(); // Count the number of nonzeros in factors Base::countnz(n, m_nnzL, m_nnzU, m_glu); // Apply permutation to the L subscripts Base::fixupL(n, m_perm_r.indices(), m_glu); // Create supernode matrix L m_Lstore.setInfos(m, n, m_glu.lusup, m_glu.xlusup, m_glu.lsub, m_glu.xlsub, m_glu.supno, m_glu.xsup); // Create the column major upper sparse matrix U; new (&m_Ustore) MappedSparseMatrix ( m, n, m_nnzU, m_glu.xusub.data(), m_glu.usub.data(), m_glu.ucol.data() ); m_info = Success; m_factorizationIsOk = true; } template struct SparseLUMatrixLReturnType : internal::no_assignment_operator { typedef typename MappedSupernodalType::Scalar Scalar; explicit SparseLUMatrixLReturnType(const MappedSupernodalType& mapL) : m_mapL(mapL) { } Index rows() const { return m_mapL.rows(); } Index cols() const { return m_mapL.cols(); } template void solveInPlace( MatrixBase &X) const { m_mapL.solveInPlace(X); } template void solveTransposedInPlace( MatrixBase &X) const { m_mapL.template solveTransposedInPlace(X); } const MappedSupernodalType& m_mapL; }; template struct SparseLUMatrixUReturnType : internal::no_assignment_operator { typedef typename MatrixLType::Scalar Scalar; SparseLUMatrixUReturnType(const MatrixLType& mapL, const MatrixUType& mapU) : m_mapL(mapL),m_mapU(mapU) { } Index rows() const { return m_mapL.rows(); } Index cols() const { return m_mapL.cols(); } template void solveInPlace(MatrixBase &X) const { Index nrhs = X.cols(); Index n = X.rows(); // Backward solve with U for (Index k = m_mapL.nsuper(); k >= 0; k--) { Index fsupc = m_mapL.supToCol()[k]; Index lda = m_mapL.colIndexPtr()[fsupc+1] - m_mapL.colIndexPtr()[fsupc]; // leading dimension Index nsupc = m_mapL.supToCol()[k+1] - fsupc; Index luptr = m_mapL.colIndexPtr()[fsupc]; if (nsupc == 1) { for (Index j = 0; j < nrhs; j++) { X(fsupc, j) /= m_mapL.valuePtr()[luptr]; } } else { // FIXME: the following lines should use Block expressions and not Map! Map, 0, OuterStride<> > A( &(m_mapL.valuePtr()[luptr]), nsupc, nsupc, OuterStride<>(lda) ); Map< Matrix, 0, OuterStride<> > U (&(X.coeffRef(fsupc,0)), nsupc, nrhs, OuterStride<>(n) ); U = A.template triangularView().solve(U); } for (Index j = 0; j < nrhs; ++j) { for (Index jcol = fsupc; jcol < fsupc + nsupc; jcol++) { typename MatrixUType::InnerIterator it(m_mapU, jcol); for ( ; it; ++it) { Index irow = it.index(); X(irow, j) -= X(jcol, j) * it.value(); } } } } // End For U-solve } template void solveTransposedInPlace(MatrixBase &X) const { using numext::conj; Index nrhs = X.cols(); Index n = X.rows(); // Forward solve with U for (Index k = 0; k <= m_mapL.nsuper(); k++) { Index fsupc = m_mapL.supToCol()[k]; Index lda = m_mapL.colIndexPtr()[fsupc+1] - m_mapL.colIndexPtr()[fsupc]; // leading dimension Index nsupc = m_mapL.supToCol()[k+1] - fsupc; Index luptr = m_mapL.colIndexPtr()[fsupc]; for (Index j = 0; j < nrhs; ++j) { for (Index jcol = fsupc; jcol < fsupc + nsupc; jcol++) { typename MatrixUType::InnerIterator it(m_mapU, jcol); for ( ; it; ++it) { Index irow = it.index(); X(jcol, j) -= X(irow, j) * (Conjugate? conj(it.value()): it.value()); } } } if (nsupc == 1) { for (Index j = 0; j < nrhs; j++) { X(fsupc, j) /= (Conjugate? conj(m_mapL.valuePtr()[luptr]) : m_mapL.valuePtr()[luptr]); } } else { Map, 0, OuterStride<> > A( &(m_mapL.valuePtr()[luptr]), nsupc, nsupc, OuterStride<>(lda) ); Map< Matrix, 0, OuterStride<> > U (&(X(fsupc,0)), nsupc, nrhs, OuterStride<>(n) ); if(Conjugate) U = A.adjoint().template triangularView().solve(U); else U = A.transpose().template triangularView().solve(U); } }// End For U-solve } const MatrixLType& m_mapL; const MatrixUType& m_mapU; }; } // End namespace Eigen #endif ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseLU/SparseLUImpl.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef SPARSELU_IMPL_H #define SPARSELU_IMPL_H namespace Eigen { namespace internal { /** \ingroup SparseLU_Module * \class SparseLUImpl * Base class for sparseLU */ template class SparseLUImpl { public: typedef Matrix ScalarVector; typedef Matrix IndexVector; typedef Matrix ScalarMatrix; typedef Map > MappedMatrixBlock; typedef typename ScalarVector::RealScalar RealScalar; typedef Ref > BlockScalarVector; typedef Ref > BlockIndexVector; typedef LU_GlobalLU_t GlobalLU_t; typedef SparseMatrix MatrixType; protected: template Index expand(VectorType& vec, Index& length, Index nbElts, Index keep_prev, Index& num_expansions); Index memInit(Index m, Index n, Index annz, Index lwork, Index fillratio, Index panel_size, GlobalLU_t& glu); template Index memXpand(VectorType& vec, Index& maxlen, Index nbElts, MemType memtype, Index& num_expansions); void heap_relax_snode (const Index n, IndexVector& et, const Index relax_columns, IndexVector& descendants, IndexVector& relax_end); void relax_snode (const Index n, IndexVector& et, const Index relax_columns, IndexVector& descendants, IndexVector& relax_end); Index snode_dfs(const Index jcol, const Index kcol,const MatrixType& mat, IndexVector& xprune, IndexVector& marker, GlobalLU_t& glu); Index snode_bmod (const Index jcol, const Index fsupc, ScalarVector& dense, GlobalLU_t& glu); Index pivotL(const Index jcol, const RealScalar& diagpivotthresh, IndexVector& perm_r, IndexVector& iperm_c, Index& pivrow, GlobalLU_t& glu); template void dfs_kernel(const StorageIndex jj, IndexVector& perm_r, Index& nseg, IndexVector& panel_lsub, IndexVector& segrep, Ref repfnz_col, IndexVector& xprune, Ref marker, IndexVector& parent, IndexVector& xplore, GlobalLU_t& glu, Index& nextl_col, Index krow, Traits& traits); void panel_dfs(const Index m, const Index w, const Index jcol, MatrixType& A, IndexVector& perm_r, Index& nseg, ScalarVector& dense, IndexVector& panel_lsub, IndexVector& segrep, IndexVector& repfnz, IndexVector& xprune, IndexVector& marker, IndexVector& parent, IndexVector& xplore, GlobalLU_t& glu); void panel_bmod(const Index m, const Index w, const Index jcol, const Index nseg, ScalarVector& dense, ScalarVector& tempv, IndexVector& segrep, IndexVector& repfnz, GlobalLU_t& glu); Index column_dfs(const Index m, const Index jcol, IndexVector& perm_r, Index maxsuper, Index& nseg, BlockIndexVector lsub_col, IndexVector& segrep, BlockIndexVector repfnz, IndexVector& xprune, IndexVector& marker, IndexVector& parent, IndexVector& xplore, GlobalLU_t& glu); Index column_bmod(const Index jcol, const Index nseg, BlockScalarVector dense, ScalarVector& tempv, BlockIndexVector segrep, BlockIndexVector repfnz, Index fpanelc, GlobalLU_t& glu); Index copy_to_ucol(const Index jcol, const Index nseg, IndexVector& segrep, BlockIndexVector repfnz ,IndexVector& perm_r, BlockScalarVector dense, GlobalLU_t& glu); void pruneL(const Index jcol, const IndexVector& perm_r, const Index pivrow, const Index nseg, const IndexVector& segrep, BlockIndexVector repfnz, IndexVector& xprune, GlobalLU_t& glu); void countnz(const Index n, Index& nnzL, Index& nnzU, GlobalLU_t& glu); void fixupL(const Index n, const IndexVector& perm_r, GlobalLU_t& glu); template friend struct column_dfs_traits; }; } // end namespace internal } // namespace Eigen #endif ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseLU/SparseLU_Memory.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. /* * NOTE: This file is the modified version of [s,d,c,z]memory.c files in SuperLU * -- SuperLU routine (version 3.1) -- * Univ. of California Berkeley, Xerox Palo Alto Research Center, * and Lawrence Berkeley National Lab. * August 1, 2008 * * Copyright (c) 1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY * EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program for any * purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is * granted, provided the above notices are retained, and a notice that * the code was modified is included with the above copyright notice. */ #ifndef EIGEN_SPARSELU_MEMORY #define EIGEN_SPARSELU_MEMORY namespace Eigen { namespace internal { enum { LUNoMarker = 3 }; enum {emptyIdxLU = -1}; inline Index LUnumTempV(Index& m, Index& w, Index& t, Index& b) { return (std::max)(m, (t+b)*w); } template< typename Scalar> inline Index LUTempSpace(Index&m, Index& w) { return (2*w + 4 + LUNoMarker) * m * sizeof(Index) + (w + 1) * m * sizeof(Scalar); } /** * Expand the existing storage to accommodate more fill-ins * \param vec Valid pointer to the vector to allocate or expand * \param[in,out] length At input, contain the current length of the vector that is to be increased. At output, length of the newly allocated vector * \param[in] nbElts Current number of elements in the factors * \param keep_prev 1: use length and do not expand the vector; 0: compute new_len and expand * \param[in,out] num_expansions Number of times the memory has been expanded */ template template Index SparseLUImpl::expand(VectorType& vec, Index& length, Index nbElts, Index keep_prev, Index& num_expansions) { float alpha = 1.5; // Ratio of the memory increase Index new_len; // New size of the allocated memory if(num_expansions == 0 || keep_prev) new_len = length ; // First time allocate requested else new_len = (std::max)(length+1,Index(alpha * length)); VectorType old_vec; // Temporary vector to hold the previous values if (nbElts > 0 ) old_vec = vec.segment(0,nbElts); //Allocate or expand the current vector #ifdef EIGEN_EXCEPTIONS try #endif { vec.resize(new_len); } #ifdef EIGEN_EXCEPTIONS catch(std::bad_alloc& ) #else if(!vec.size()) #endif { if (!num_expansions) { // First time to allocate from LUMemInit() // Let LUMemInit() deals with it. return -1; } if (keep_prev) { // In this case, the memory length should not not be reduced return new_len; } else { // Reduce the size and increase again Index tries = 0; // Number of attempts do { alpha = (alpha + 1)/2; new_len = (std::max)(length+1,Index(alpha * length)); #ifdef EIGEN_EXCEPTIONS try #endif { vec.resize(new_len); } #ifdef EIGEN_EXCEPTIONS catch(std::bad_alloc& ) #else if (!vec.size()) #endif { tries += 1; if ( tries > 10) return new_len; } } while (!vec.size()); } } //Copy the previous values to the newly allocated space if (nbElts > 0) vec.segment(0, nbElts) = old_vec; length = new_len; if(num_expansions) ++num_expansions; return 0; } /** * \brief Allocate various working space for the numerical factorization phase. * \param m number of rows of the input matrix * \param n number of columns * \param annz number of initial nonzeros in the matrix * \param lwork if lwork=-1, this routine returns an estimated size of the required memory * \param glu persistent data to facilitate multiple factors : will be deleted later ?? * \param fillratio estimated ratio of fill in the factors * \param panel_size Size of a panel * \return an estimated size of the required memory if lwork = -1; otherwise, return the size of actually allocated memory when allocation failed, and 0 on success * \note Unlike SuperLU, this routine does not support successive factorization with the same pattern and the same row permutation */ template Index SparseLUImpl::memInit(Index m, Index n, Index annz, Index lwork, Index fillratio, Index panel_size, GlobalLU_t& glu) { Index& num_expansions = glu.num_expansions; //No memory expansions so far num_expansions = 0; glu.nzumax = glu.nzlumax = (std::min)(fillratio * (annz+1) / n, m) * n; // estimated number of nonzeros in U glu.nzlmax = (std::max)(Index(4), fillratio) * (annz+1) / 4; // estimated nnz in L factor // Return the estimated size to the user if necessary Index tempSpace; tempSpace = (2*panel_size + 4 + LUNoMarker) * m * sizeof(Index) + (panel_size + 1) * m * sizeof(Scalar); if (lwork == emptyIdxLU) { Index estimated_size; estimated_size = (5 * n + 5) * sizeof(Index) + tempSpace + (glu.nzlmax + glu.nzumax) * sizeof(Index) + (glu.nzlumax+glu.nzumax) * sizeof(Scalar) + n; return estimated_size; } // Setup the required space // First allocate Integer pointers for L\U factors glu.xsup.resize(n+1); glu.supno.resize(n+1); glu.xlsub.resize(n+1); glu.xlusup.resize(n+1); glu.xusub.resize(n+1); // Reserve memory for L/U factors do { if( (expand(glu.lusup, glu.nzlumax, 0, 0, num_expansions)<0) || (expand(glu.ucol, glu.nzumax, 0, 0, num_expansions)<0) || (expand (glu.lsub, glu.nzlmax, 0, 0, num_expansions)<0) || (expand (glu.usub, glu.nzumax, 0, 1, num_expansions)<0) ) { //Reduce the estimated size and retry glu.nzlumax /= 2; glu.nzumax /= 2; glu.nzlmax /= 2; if (glu.nzlumax < annz ) return glu.nzlumax; } } while (!glu.lusup.size() || !glu.ucol.size() || !glu.lsub.size() || !glu.usub.size()); ++num_expansions; return 0; } // end LuMemInit /** * \brief Expand the existing storage * \param vec vector to expand * \param[in,out] maxlen On input, previous size of vec (Number of elements to copy ). on output, new size * \param nbElts current number of elements in the vector. * \param memtype Type of the element to expand * \param num_expansions Number of expansions * \return 0 on success, > 0 size of the memory allocated so far */ template template Index SparseLUImpl::memXpand(VectorType& vec, Index& maxlen, Index nbElts, MemType memtype, Index& num_expansions) { Index failed_size; if (memtype == USUB) failed_size = this->expand(vec, maxlen, nbElts, 1, num_expansions); else failed_size = this->expand(vec, maxlen, nbElts, 0, num_expansions); if (failed_size) return failed_size; return 0 ; } } // end namespace internal } // end namespace Eigen #endif // EIGEN_SPARSELU_MEMORY ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseLU/SparseLU_Structs.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. /* * NOTE: This file comes from a partly modified version of files slu_[s,d,c,z]defs.h * -- SuperLU routine (version 4.1) -- * Univ. of California Berkeley, Xerox Palo Alto Research Center, * and Lawrence Berkeley National Lab. * November, 2010 * * Global data structures used in LU factorization - * * nsuper: #supernodes = nsuper + 1, numbered [0, nsuper]. * (xsup,supno): supno[i] is the supernode no to which i belongs; * xsup(s) points to the beginning of the s-th supernode. * e.g. supno 0 1 2 2 3 3 3 4 4 4 4 4 (n=12) * xsup 0 1 2 4 7 12 * Note: dfs will be performed on supernode rep. relative to the new * row pivoting ordering * * (xlsub,lsub): lsub[*] contains the compressed subscript of * rectangular supernodes; xlsub[j] points to the starting * location of the j-th column in lsub[*]. Note that xlsub * is indexed by column. * Storage: original row subscripts * * During the course of sparse LU factorization, we also use * (xlsub,lsub) for the purpose of symmetric pruning. For each * supernode {s,s+1,...,t=s+r} with first column s and last * column t, the subscript set * lsub[j], j=xlsub[s], .., xlsub[s+1]-1 * is the structure of column s (i.e. structure of this supernode). * It is used for the storage of numerical values. * Furthermore, * lsub[j], j=xlsub[t], .., xlsub[t+1]-1 * is the structure of the last column t of this supernode. * It is for the purpose of symmetric pruning. Therefore, the * structural subscripts can be rearranged without making physical * interchanges among the numerical values. * * However, if the supernode has only one column, then we * only keep one set of subscripts. For any subscript interchange * performed, similar interchange must be done on the numerical * values. * * The last column structures (for pruning) will be removed * after the numercial LU factorization phase. * * (xlusup,lusup): lusup[*] contains the numerical values of the * rectangular supernodes; xlusup[j] points to the starting * location of the j-th column in storage vector lusup[*] * Note: xlusup is indexed by column. * Each rectangular supernode is stored by column-major * scheme, consistent with Fortran 2-dim array storage. * * (xusub,ucol,usub): ucol[*] stores the numerical values of * U-columns outside the rectangular supernodes. The row * subscript of nonzero ucol[k] is stored in usub[k]. * xusub[i] points to the starting location of column i in ucol. * Storage: new row subscripts; that is subscripts of PA. */ #ifndef EIGEN_LU_STRUCTS #define EIGEN_LU_STRUCTS namespace Eigen { namespace internal { typedef enum {LUSUP, UCOL, LSUB, USUB, LLVL, ULVL} MemType; template struct LU_GlobalLU_t { typedef typename IndexVector::Scalar StorageIndex; IndexVector xsup; //First supernode column ... xsup(s) points to the beginning of the s-th supernode IndexVector supno; // Supernode number corresponding to this column (column to supernode mapping) ScalarVector lusup; // nonzero values of L ordered by columns IndexVector lsub; // Compressed row indices of L rectangular supernodes. IndexVector xlusup; // pointers to the beginning of each column in lusup IndexVector xlsub; // pointers to the beginning of each column in lsub Index nzlmax; // Current max size of lsub Index nzlumax; // Current max size of lusup ScalarVector ucol; // nonzero values of U ordered by columns IndexVector usub; // row indices of U columns in ucol IndexVector xusub; // Pointers to the beginning of each column of U in ucol Index nzumax; // Current max size of ucol Index n; // Number of columns in the matrix Index num_expansions; }; // Values to set for performance struct perfvalues { Index panel_size; // a panel consists of at most consecutive columns Index relax; // To control degree of relaxing supernodes. If the number of nodes (columns) // in a subtree of the elimination tree is less than relax, this subtree is considered // as one supernode regardless of the row structures of those columns Index maxsuper; // The maximum size for a supernode in complete LU Index rowblk; // The minimum row dimension for 2-D blocking to be used; Index colblk; // The minimum column dimension for 2-D blocking to be used; Index fillfactor; // The estimated fills factors for L and U, compared with A }; } // end namespace internal } // end namespace Eigen #endif // EIGEN_LU_STRUCTS ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // Copyright (C) 2012 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSELU_SUPERNODAL_MATRIX_H #define EIGEN_SPARSELU_SUPERNODAL_MATRIX_H namespace Eigen { namespace internal { /** \ingroup SparseLU_Module * \brief a class to manipulate the L supernodal factor from the SparseLU factorization * * This class contain the data to easily store * and manipulate the supernodes during the factorization and solution phase of Sparse LU. * Only the lower triangular matrix has supernodes. * * NOTE : This class corresponds to the SCformat structure in SuperLU * */ /* TODO * InnerIterator as for sparsematrix * SuperInnerIterator to iterate through all supernodes * Function for triangular solve */ template class MappedSuperNodalMatrix { public: typedef Scalar_ Scalar; typedef StorageIndex_ StorageIndex; typedef Matrix IndexVector; typedef Matrix ScalarVector; public: MappedSuperNodalMatrix() { } MappedSuperNodalMatrix(Index m, Index n, ScalarVector& nzval, IndexVector& nzval_colptr, IndexVector& rowind, IndexVector& rowind_colptr, IndexVector& col_to_sup, IndexVector& sup_to_col ) { setInfos(m, n, nzval, nzval_colptr, rowind, rowind_colptr, col_to_sup, sup_to_col); } ~MappedSuperNodalMatrix() { } /** * Set appropriate pointers for the lower triangular supernodal matrix * These infos are available at the end of the numerical factorization * FIXME This class will be modified such that it can be use in the course * of the factorization. */ void setInfos(Index m, Index n, ScalarVector& nzval, IndexVector& nzval_colptr, IndexVector& rowind, IndexVector& rowind_colptr, IndexVector& col_to_sup, IndexVector& sup_to_col ) { m_row = m; m_col = n; m_nzval = nzval.data(); m_nzval_colptr = nzval_colptr.data(); m_rowind = rowind.data(); m_rowind_colptr = rowind_colptr.data(); m_nsuper = col_to_sup(n); m_col_to_sup = col_to_sup.data(); m_sup_to_col = sup_to_col.data(); } /** * Number of rows */ Index rows() const { return m_row; } /** * Number of columns */ Index cols() const { return m_col; } /** * Return the array of nonzero values packed by column * * The size is nnz */ Scalar* valuePtr() { return m_nzval; } const Scalar* valuePtr() const { return m_nzval; } /** * Return the pointers to the beginning of each column in \ref valuePtr() */ StorageIndex* colIndexPtr() { return m_nzval_colptr; } const StorageIndex* colIndexPtr() const { return m_nzval_colptr; } /** * Return the array of compressed row indices of all supernodes */ StorageIndex* rowIndex() { return m_rowind; } const StorageIndex* rowIndex() const { return m_rowind; } /** * Return the location in \em rowvaluePtr() which starts each column */ StorageIndex* rowIndexPtr() { return m_rowind_colptr; } const StorageIndex* rowIndexPtr() const { return m_rowind_colptr; } /** * Return the array of column-to-supernode mapping */ StorageIndex* colToSup() { return m_col_to_sup; } const StorageIndex* colToSup() const { return m_col_to_sup; } /** * Return the array of supernode-to-column mapping */ StorageIndex* supToCol() { return m_sup_to_col; } const StorageIndex* supToCol() const { return m_sup_to_col; } /** * Return the number of supernodes */ Index nsuper() const { return m_nsuper; } class InnerIterator; template void solveInPlace( MatrixBase&X) const; template void solveTransposedInPlace( MatrixBase&X) const; protected: Index m_row; // Number of rows Index m_col; // Number of columns Index m_nsuper; // Number of supernodes Scalar* m_nzval; //array of nonzero values packed by column StorageIndex* m_nzval_colptr; //nzval_colptr[j] Stores the location in nzval[] which starts column j StorageIndex* m_rowind; // Array of compressed row indices of rectangular supernodes StorageIndex* m_rowind_colptr; //rowind_colptr[j] stores the location in rowind[] which starts column j StorageIndex* m_col_to_sup; // col_to_sup[j] is the supernode number to which column j belongs StorageIndex* m_sup_to_col; //sup_to_col[s] points to the starting column of the s-th supernode private : }; /** * \brief InnerIterator class to iterate over nonzero values of the current column in the supernodal matrix L * */ template class MappedSuperNodalMatrix::InnerIterator { public: InnerIterator(const MappedSuperNodalMatrix& mat, Index outer) : m_matrix(mat), m_outer(outer), m_supno(mat.colToSup()[outer]), m_idval(mat.colIndexPtr()[outer]), m_startidval(m_idval), m_endidval(mat.colIndexPtr()[outer+1]), m_idrow(mat.rowIndexPtr()[mat.supToCol()[mat.colToSup()[outer]]]), m_endidrow(mat.rowIndexPtr()[mat.supToCol()[mat.colToSup()[outer]]+1]) {} inline InnerIterator& operator++() { m_idval++; m_idrow++; return *this; } inline Scalar value() const { return m_matrix.valuePtr()[m_idval]; } inline Scalar& valueRef() { return const_cast(m_matrix.valuePtr()[m_idval]); } inline Index index() const { return m_matrix.rowIndex()[m_idrow]; } inline Index row() const { return index(); } inline Index col() const { return m_outer; } inline Index supIndex() const { return m_supno; } inline operator bool() const { return ( (m_idval < m_endidval) && (m_idval >= m_startidval) && (m_idrow < m_endidrow) ); } protected: const MappedSuperNodalMatrix& m_matrix; // Supernodal lower triangular matrix const Index m_outer; // Current column const Index m_supno; // Current SuperNode number Index m_idval; // Index to browse the values in the current column const Index m_startidval; // Start of the column value const Index m_endidval; // End of the column value Index m_idrow; // Index to browse the row indices Index m_endidrow; // End index of row indices of the current column }; /** * \brief Solve with the supernode triangular matrix * */ template template void MappedSuperNodalMatrix::solveInPlace( MatrixBase&X) const { /* Explicit type conversion as the Index type of MatrixBase may be wider than Index */ // eigen_assert(X.rows() <= NumTraits::highest()); // eigen_assert(X.cols() <= NumTraits::highest()); Index n = int(X.rows()); Index nrhs = Index(X.cols()); const Scalar * Lval = valuePtr(); // Nonzero values Matrix work(n, nrhs); // working vector work.setZero(); for (Index k = 0; k <= nsuper(); k ++) { Index fsupc = supToCol()[k]; // First column of the current supernode Index istart = rowIndexPtr()[fsupc]; // Pointer index to the subscript of the current column Index nsupr = rowIndexPtr()[fsupc+1] - istart; // Number of rows in the current supernode Index nsupc = supToCol()[k+1] - fsupc; // Number of columns in the current supernode Index nrow = nsupr - nsupc; // Number of rows in the non-diagonal part of the supernode Index irow; //Current index row if (nsupc == 1 ) { for (Index j = 0; j < nrhs; j++) { InnerIterator it(*this, fsupc); ++it; // Skip the diagonal element for (; it; ++it) { irow = it.row(); X(irow, j) -= X(fsupc, j) * it.value(); } } } else { // The supernode has more than one column Index luptr = colIndexPtr()[fsupc]; Index lda = colIndexPtr()[fsupc+1] - luptr; // Triangular solve Map, 0, OuterStride<> > A( &(Lval[luptr]), nsupc, nsupc, OuterStride<>(lda) ); Map< Matrix, 0, OuterStride<> > U (&(X(fsupc,0)), nsupc, nrhs, OuterStride<>(n) ); U = A.template triangularView().solve(U); // Matrix-vector product new (&A) Map, 0, OuterStride<> > ( &(Lval[luptr+nsupc]), nrow, nsupc, OuterStride<>(lda) ); work.topRows(nrow).noalias() = A * U; //Begin Scatter for (Index j = 0; j < nrhs; j++) { Index iptr = istart + nsupc; for (Index i = 0; i < nrow; i++) { irow = rowIndex()[iptr]; X(irow, j) -= work(i, j); // Scatter operation work(i, j) = Scalar(0); iptr++; } } } } } template template void MappedSuperNodalMatrix::solveTransposedInPlace( MatrixBase&X) const { using numext::conj; Index n = int(X.rows()); Index nrhs = Index(X.cols()); const Scalar * Lval = valuePtr(); // Nonzero values Matrix work(n, nrhs); // working vector work.setZero(); for (Index k = nsuper(); k >= 0; k--) { Index fsupc = supToCol()[k]; // First column of the current supernode Index istart = rowIndexPtr()[fsupc]; // Pointer index to the subscript of the current column Index nsupr = rowIndexPtr()[fsupc+1] - istart; // Number of rows in the current supernode Index nsupc = supToCol()[k+1] - fsupc; // Number of columns in the current supernode Index nrow = nsupr - nsupc; // Number of rows in the non-diagonal part of the supernode Index irow; //Current index row if (nsupc == 1 ) { for (Index j = 0; j < nrhs; j++) { InnerIterator it(*this, fsupc); ++it; // Skip the diagonal element for (; it; ++it) { irow = it.row(); X(fsupc,j) -= X(irow, j) * (Conjugate?conj(it.value()):it.value()); } } } else { // The supernode has more than one column Index luptr = colIndexPtr()[fsupc]; Index lda = colIndexPtr()[fsupc+1] - luptr; //Begin Gather for (Index j = 0; j < nrhs; j++) { Index iptr = istart + nsupc; for (Index i = 0; i < nrow; i++) { irow = rowIndex()[iptr]; work.topRows(nrow)(i,j)= X(irow,j); // Gather operation iptr++; } } // Matrix-vector product with transposed submatrix Map, 0, OuterStride<> > A( &(Lval[luptr+nsupc]), nrow, nsupc, OuterStride<>(lda) ); Map< Matrix, 0, OuterStride<> > U (&(X(fsupc,0)), nsupc, nrhs, OuterStride<>(n) ); if(Conjugate) U = U - A.adjoint() * work.topRows(nrow); else U = U - A.transpose() * work.topRows(nrow); // Triangular solve (of transposed diagonal block) new (&A) Map, 0, OuterStride<> > ( &(Lval[luptr]), nsupc, nsupc, OuterStride<>(lda) ); if(Conjugate) U = A.adjoint().template triangularView().solve(U); else U = A.transpose().template triangularView().solve(U); } } } } // end namespace internal } // end namespace Eigen #endif // EIGEN_SPARSELU_MATRIX_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseLU/SparseLU_Utils.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSELU_UTILS_H #define EIGEN_SPARSELU_UTILS_H namespace Eigen { namespace internal { /** * \brief Count Nonzero elements in the factors */ template void SparseLUImpl::countnz(const Index n, Index& nnzL, Index& nnzU, GlobalLU_t& glu) { nnzL = 0; nnzU = (glu.xusub)(n); Index nsuper = (glu.supno)(n); Index jlen; Index i, j, fsupc; if (n <= 0 ) return; // For each supernode for (i = 0; i <= nsuper; i++) { fsupc = glu.xsup(i); jlen = glu.xlsub(fsupc+1) - glu.xlsub(fsupc); for (j = fsupc; j < glu.xsup(i+1); j++) { nnzL += jlen; nnzU += j - fsupc + 1; jlen--; } } } /** * \brief Fix up the data storage lsub for L-subscripts. * * It removes the subscripts sets for structural pruning, * and applies permutation to the remaining subscripts * */ template void SparseLUImpl::fixupL(const Index n, const IndexVector& perm_r, GlobalLU_t& glu) { Index fsupc, i, j, k, jstart; StorageIndex nextl = 0; Index nsuper = (glu.supno)(n); // For each supernode for (i = 0; i <= nsuper; i++) { fsupc = glu.xsup(i); jstart = glu.xlsub(fsupc); glu.xlsub(fsupc) = nextl; for (j = jstart; j < glu.xlsub(fsupc + 1); j++) { glu.lsub(nextl) = perm_r(glu.lsub(j)); // Now indexed into P*A nextl++; } for (k = fsupc+1; k < glu.xsup(i+1); k++) glu.xlsub(k) = nextl; // other columns in supernode i } glu.xlsub(n) = nextl; } } // end namespace internal } // end namespace Eigen #endif // EIGEN_SPARSELU_UTILS_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseLU/SparseLU_column_bmod.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // Copyright (C) 2012 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. /* * NOTE: This file is the modified version of xcolumn_bmod.c file in SuperLU * -- SuperLU routine (version 3.0) -- * Univ. of California Berkeley, Xerox Palo Alto Research Center, * and Lawrence Berkeley National Lab. * October 15, 2003 * * Copyright (c) 1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY * EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program for any * purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is * granted, provided the above notices are retained, and a notice that * the code was modified is included with the above copyright notice. */ #ifndef SPARSELU_COLUMN_BMOD_H #define SPARSELU_COLUMN_BMOD_H namespace Eigen { namespace internal { /** * \brief Performs numeric block updates (sup-col) in topological order * * \param jcol current column to update * \param nseg Number of segments in the U part * \param dense Store the full representation of the column * \param tempv working array * \param segrep segment representative ... * \param repfnz ??? First nonzero column in each row ??? ... * \param fpanelc First column in the current panel * \param glu Global LU data. * \return 0 - successful return * > 0 - number of bytes allocated when run out of space * */ template Index SparseLUImpl::column_bmod(const Index jcol, const Index nseg, BlockScalarVector dense, ScalarVector& tempv, BlockIndexVector segrep, BlockIndexVector repfnz, Index fpanelc, GlobalLU_t& glu) { Index jsupno, k, ksub, krep, ksupno; Index lptr, nrow, isub, irow, nextlu, new_next, ufirst; Index fsupc, nsupc, nsupr, luptr, kfnz, no_zeros; /* krep = representative of current k-th supernode * fsupc = first supernodal column * nsupc = number of columns in a supernode * nsupr = number of rows in a supernode * luptr = location of supernodal LU-block in storage * kfnz = first nonz in the k-th supernodal segment * no_zeros = no lf leading zeros in a supernodal U-segment */ jsupno = glu.supno(jcol); // For each nonzero supernode segment of U[*,j] in topological order k = nseg - 1; Index d_fsupc; // distance between the first column of the current panel and the // first column of the current snode Index fst_col; // First column within small LU update Index segsize; for (ksub = 0; ksub < nseg; ksub++) { krep = segrep(k); k--; ksupno = glu.supno(krep); if (jsupno != ksupno ) { // outside the rectangular supernode fsupc = glu.xsup(ksupno); fst_col = (std::max)(fsupc, fpanelc); // Distance from the current supernode to the current panel; // d_fsupc = 0 if fsupc > fpanelc d_fsupc = fst_col - fsupc; luptr = glu.xlusup(fst_col) + d_fsupc; lptr = glu.xlsub(fsupc) + d_fsupc; kfnz = repfnz(krep); kfnz = (std::max)(kfnz, fpanelc); segsize = krep - kfnz + 1; nsupc = krep - fst_col + 1; nsupr = glu.xlsub(fsupc+1) - glu.xlsub(fsupc); nrow = nsupr - d_fsupc - nsupc; Index lda = glu.xlusup(fst_col+1) - glu.xlusup(fst_col); // Perform a triangular solver and block update, // then scatter the result of sup-col update to dense no_zeros = kfnz - fst_col; if(segsize==1) LU_kernel_bmod<1>::run(segsize, dense, tempv, glu.lusup, luptr, lda, nrow, glu.lsub, lptr, no_zeros); else LU_kernel_bmod::run(segsize, dense, tempv, glu.lusup, luptr, lda, nrow, glu.lsub, lptr, no_zeros); } // end if jsupno } // end for each segment // Process the supernodal portion of L\U[*,j] nextlu = glu.xlusup(jcol); fsupc = glu.xsup(jsupno); // copy the SPA dense into L\U[*,j] Index mem; new_next = nextlu + glu.xlsub(fsupc + 1) - glu.xlsub(fsupc); Index offset = internal::first_multiple(new_next, internal::packet_traits::size) - new_next; if(offset) new_next += offset; while (new_next > glu.nzlumax ) { mem = memXpand(glu.lusup, glu.nzlumax, nextlu, LUSUP, glu.num_expansions); if (mem) return mem; } for (isub = glu.xlsub(fsupc); isub < glu.xlsub(fsupc+1); isub++) { irow = glu.lsub(isub); glu.lusup(nextlu) = dense(irow); dense(irow) = Scalar(0.0); ++nextlu; } if(offset) { glu.lusup.segment(nextlu,offset).setZero(); nextlu += offset; } glu.xlusup(jcol + 1) = StorageIndex(nextlu); // close L\U(*,jcol); /* For more updates within the panel (also within the current supernode), * should start from the first column of the panel, or the first column * of the supernode, whichever is bigger. There are two cases: * 1) fsupc < fpanelc, then fst_col <-- fpanelc * 2) fsupc >= fpanelc, then fst_col <-- fsupc */ fst_col = (std::max)(fsupc, fpanelc); if (fst_col < jcol) { // Distance between the current supernode and the current panel // d_fsupc = 0 if fsupc >= fpanelc d_fsupc = fst_col - fsupc; lptr = glu.xlsub(fsupc) + d_fsupc; luptr = glu.xlusup(fst_col) + d_fsupc; nsupr = glu.xlsub(fsupc+1) - glu.xlsub(fsupc); // leading dimension nsupc = jcol - fst_col; // excluding jcol nrow = nsupr - d_fsupc - nsupc; // points to the beginning of jcol in snode L\U(jsupno) ufirst = glu.xlusup(jcol) + d_fsupc; Index lda = glu.xlusup(jcol+1) - glu.xlusup(jcol); MappedMatrixBlock A( &(glu.lusup.data()[luptr]), nsupc, nsupc, OuterStride<>(lda) ); VectorBlock u(glu.lusup, ufirst, nsupc); u = A.template triangularView().solve(u); new (&A) MappedMatrixBlock ( &(glu.lusup.data()[luptr+nsupc]), nrow, nsupc, OuterStride<>(lda) ); VectorBlock l(glu.lusup, ufirst+nsupc, nrow); l.noalias() -= A * u; } // End if fst_col return 0; } } // end namespace internal } // end namespace Eigen #endif // SPARSELU_COLUMN_BMOD_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. /* * NOTE: This file is the modified version of [s,d,c,z]column_dfs.c file in SuperLU * -- SuperLU routine (version 2.0) -- * Univ. of California Berkeley, Xerox Palo Alto Research Center, * and Lawrence Berkeley National Lab. * November 15, 1997 * * Copyright (c) 1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY * EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program for any * purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is * granted, provided the above notices are retained, and a notice that * the code was modified is included with the above copyright notice. */ #ifndef SPARSELU_COLUMN_DFS_H #define SPARSELU_COLUMN_DFS_H template class SparseLUImpl; namespace Eigen { namespace internal { template struct column_dfs_traits : no_assignment_operator { typedef typename ScalarVector::Scalar Scalar; typedef typename IndexVector::Scalar StorageIndex; column_dfs_traits(Index jcol, Index& jsuper, typename SparseLUImpl::GlobalLU_t& glu, SparseLUImpl& luImpl) : m_jcol(jcol), m_jsuper_ref(jsuper), m_glu(glu), m_luImpl(luImpl) {} bool update_segrep(Index /*krep*/, Index /*jj*/) { return true; } void mem_expand(IndexVector& lsub, Index& nextl, Index chmark) { if (nextl >= m_glu.nzlmax) m_luImpl.memXpand(lsub, m_glu.nzlmax, nextl, LSUB, m_glu.num_expansions); if (chmark != (m_jcol-1)) m_jsuper_ref = emptyIdxLU; } enum { ExpandMem = true }; Index m_jcol; Index& m_jsuper_ref; typename SparseLUImpl::GlobalLU_t& m_glu; SparseLUImpl& m_luImpl; }; /** * \brief Performs a symbolic factorization on column jcol and decide the supernode boundary * * A supernode representative is the last column of a supernode. * The nonzeros in U[*,j] are segments that end at supernodes representatives. * The routine returns a list of the supernodal representatives * in topological order of the dfs that generates them. * The location of the first nonzero in each supernodal segment * (supernodal entry location) is also returned. * * \param m number of rows in the matrix * \param jcol Current column * \param perm_r Row permutation * \param maxsuper Maximum number of column allowed in a supernode * \param [in,out] nseg Number of segments in current U[*,j] - new segments appended * \param lsub_col defines the rhs vector to start the dfs * \param [in,out] segrep Segment representatives - new segments appended * \param repfnz First nonzero location in each row * \param xprune * \param marker marker[i] == jj, if i was visited during dfs of current column jj; * \param parent * \param xplore working array * \param glu global LU data * \return 0 success * > 0 number of bytes allocated when run out of space * */ template Index SparseLUImpl::column_dfs(const Index m, const Index jcol, IndexVector& perm_r, Index maxsuper, Index& nseg, BlockIndexVector lsub_col, IndexVector& segrep, BlockIndexVector repfnz, IndexVector& xprune, IndexVector& marker, IndexVector& parent, IndexVector& xplore, GlobalLU_t& glu) { Index jsuper = glu.supno(jcol); Index nextl = glu.xlsub(jcol); VectorBlock marker2(marker, 2*m, m); column_dfs_traits traits(jcol, jsuper, glu, *this); // For each nonzero in A(*,jcol) do dfs for (Index k = 0; ((k < m) ? lsub_col[k] != emptyIdxLU : false) ; k++) { Index krow = lsub_col(k); lsub_col(k) = emptyIdxLU; Index kmark = marker2(krow); // krow was visited before, go to the next nonz; if (kmark == jcol) continue; dfs_kernel(StorageIndex(jcol), perm_r, nseg, glu.lsub, segrep, repfnz, xprune, marker2, parent, xplore, glu, nextl, krow, traits); } // for each nonzero ... Index fsupc; StorageIndex nsuper = glu.supno(jcol); StorageIndex jcolp1 = StorageIndex(jcol) + 1; Index jcolm1 = jcol - 1; // check to see if j belongs in the same supernode as j-1 if ( jcol == 0 ) { // Do nothing for column 0 nsuper = glu.supno(0) = 0 ; } else { fsupc = glu.xsup(nsuper); StorageIndex jptr = glu.xlsub(jcol); // Not yet compressed StorageIndex jm1ptr = glu.xlsub(jcolm1); // Use supernodes of type T2 : see SuperLU paper if ( (nextl-jptr != jptr-jm1ptr-1) ) jsuper = emptyIdxLU; // Make sure the number of columns in a supernode doesn't // exceed threshold if ( (jcol - fsupc) >= maxsuper) jsuper = emptyIdxLU; /* If jcol starts a new supernode, reclaim storage space in * glu.lsub from previous supernode. Note we only store * the subscript set of the first and last columns of * a supernode. (first for num values, last for pruning) */ if (jsuper == emptyIdxLU) { // starts a new supernode if ( (fsupc < jcolm1-1) ) { // >= 3 columns in nsuper StorageIndex ito = glu.xlsub(fsupc+1); glu.xlsub(jcolm1) = ito; StorageIndex istop = ito + jptr - jm1ptr; xprune(jcolm1) = istop; // initialize xprune(jcol-1) glu.xlsub(jcol) = istop; for (StorageIndex ifrom = jm1ptr; ifrom < nextl; ++ifrom, ++ito) glu.lsub(ito) = glu.lsub(ifrom); nextl = ito; // = istop + length(jcol) } nsuper++; glu.supno(jcol) = nsuper; } // if a new supernode } // end else: jcol > 0 // Tidy up the pointers before exit glu.xsup(nsuper+1) = jcolp1; glu.supno(jcolp1) = nsuper; xprune(jcol) = StorageIndex(nextl); // Initialize upper bound for pruning glu.xlsub(jcolp1) = StorageIndex(nextl); return 0; } } // end namespace internal } // end namespace Eigen #endif ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. /* * NOTE: This file is the modified version of [s,d,c,z]copy_to_ucol.c file in SuperLU * -- SuperLU routine (version 2.0) -- * Univ. of California Berkeley, Xerox Palo Alto Research Center, * and Lawrence Berkeley National Lab. * November 15, 1997 * * Copyright (c) 1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY * EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program for any * purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is * granted, provided the above notices are retained, and a notice that * the code was modified is included with the above copyright notice. */ #ifndef SPARSELU_COPY_TO_UCOL_H #define SPARSELU_COPY_TO_UCOL_H namespace Eigen { namespace internal { /** * \brief Performs numeric block updates (sup-col) in topological order * * \param jcol current column to update * \param nseg Number of segments in the U part * \param segrep segment representative ... * \param repfnz First nonzero column in each row ... * \param perm_r Row permutation * \param dense Store the full representation of the column * \param glu Global LU data. * \return 0 - successful return * > 0 - number of bytes allocated when run out of space * */ template Index SparseLUImpl::copy_to_ucol(const Index jcol, const Index nseg, IndexVector& segrep, BlockIndexVector repfnz ,IndexVector& perm_r, BlockScalarVector dense, GlobalLU_t& glu) { Index ksub, krep, ksupno; Index jsupno = glu.supno(jcol); // For each nonzero supernode segment of U[*,j] in topological order Index k = nseg - 1, i; StorageIndex nextu = glu.xusub(jcol); Index kfnz, isub, segsize; Index new_next,irow; Index fsupc, mem; for (ksub = 0; ksub < nseg; ksub++) { krep = segrep(k); k--; ksupno = glu.supno(krep); if (jsupno != ksupno ) // should go into ucol(); { kfnz = repfnz(krep); if (kfnz != emptyIdxLU) { // Nonzero U-segment fsupc = glu.xsup(ksupno); isub = glu.xlsub(fsupc) + kfnz - fsupc; segsize = krep - kfnz + 1; new_next = nextu + segsize; while (new_next > glu.nzumax) { mem = memXpand(glu.ucol, glu.nzumax, nextu, UCOL, glu.num_expansions); if (mem) return mem; mem = memXpand(glu.usub, glu.nzumax, nextu, USUB, glu.num_expansions); if (mem) return mem; } for (i = 0; i < segsize; i++) { irow = glu.lsub(isub); glu.usub(nextu) = perm_r(irow); // Unlike the L part, the U part is stored in its final order glu.ucol(nextu) = dense(irow); dense(irow) = Scalar(0.0); nextu++; isub++; } } // end nonzero U-segment } // end if jsupno } // end for each segment glu.xusub(jcol + 1) = nextu; // close U(*,jcol) return 0; } } // namespace internal } // end namespace Eigen #endif // SPARSELU_COPY_TO_UCOL_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSELU_GEMM_KERNEL_H #define EIGEN_SPARSELU_GEMM_KERNEL_H namespace Eigen { namespace internal { /** \internal * A general matrix-matrix product kernel optimized for the SparseLU factorization. * - A, B, and C must be column major * - lda and ldc must be multiples of the respective packet size * - C must have the same alignment as A */ template EIGEN_DONT_INLINE void sparselu_gemm(Index m, Index n, Index d, const Scalar* A, Index lda, const Scalar* B, Index ldb, Scalar* C, Index ldc) { using namespace Eigen::internal; typedef typename packet_traits::type Packet; enum { NumberOfRegisters = EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS, PacketSize = packet_traits::size, PM = 8, // peeling in M RN = 2, // register blocking RK = NumberOfRegisters>=16 ? 4 : 2, // register blocking BM = 4096/sizeof(Scalar), // number of rows of A-C per chunk SM = PM*PacketSize // step along M }; Index d_end = (d/RK)*RK; // number of columns of A (rows of B) suitable for full register blocking Index n_end = (n/RN)*RN; // number of columns of B-C suitable for processing RN columns at once Index i0 = internal::first_default_aligned(A,m); eigen_internal_assert(((lda%PacketSize)==0) && ((ldc%PacketSize)==0) && (i0==internal::first_default_aligned(C,m))); // handle the non aligned rows of A and C without any optimization: for(Index i=0; i(BM, m-ib); // actual number of rows Index actual_b_end1 = (actual_b/SM)*SM; // actual number of rows suitable for peeling Index actual_b_end2 = (actual_b/PacketSize)*PacketSize; // actual number of rows suitable for vectorization // Let's process two columns of B-C at once for(Index j=0; j(Bc0[0]); } { b10 = pset1(Bc0[1]); } if(RK==4) { b20 = pset1(Bc0[2]); } if(RK==4) { b30 = pset1(Bc0[3]); } { b01 = pset1(Bc1[0]); } { b11 = pset1(Bc1[1]); } if(RK==4) { b21 = pset1(Bc1[2]); } if(RK==4) { b31 = pset1(Bc1[3]); } Packet a0, a1, a2, a3, c0, c1, t0, t1; const Scalar* A0 = A+ib+(k+0)*lda; const Scalar* A1 = A+ib+(k+1)*lda; const Scalar* A2 = A+ib+(k+2)*lda; const Scalar* A3 = A+ib+(k+3)*lda; Scalar* C0 = C+ib+(j+0)*ldc; Scalar* C1 = C+ib+(j+1)*ldc; a0 = pload(A0); a1 = pload(A1); if(RK==4) { a2 = pload(A2); a3 = pload(A3); } else { // workaround "may be used uninitialized in this function" warning a2 = a3 = a0; } #define KMADD(c, a, b, tmp) {tmp = b; tmp = pmul(a,tmp); c = padd(c,tmp);} #define WORK(I) \ c0 = pload(C0+i+(I)*PacketSize); \ c1 = pload(C1+i+(I)*PacketSize); \ KMADD(c0, a0, b00, t0) \ KMADD(c1, a0, b01, t1) \ a0 = pload(A0+i+(I+1)*PacketSize); \ KMADD(c0, a1, b10, t0) \ KMADD(c1, a1, b11, t1) \ a1 = pload(A1+i+(I+1)*PacketSize); \ if(RK==4){ KMADD(c0, a2, b20, t0) }\ if(RK==4){ KMADD(c1, a2, b21, t1) }\ if(RK==4){ a2 = pload(A2+i+(I+1)*PacketSize); }\ if(RK==4){ KMADD(c0, a3, b30, t0) }\ if(RK==4){ KMADD(c1, a3, b31, t1) }\ if(RK==4){ a3 = pload(A3+i+(I+1)*PacketSize); }\ pstore(C0+i+(I)*PacketSize, c0); \ pstore(C1+i+(I)*PacketSize, c1) // process rows of A' - C' with aggressive vectorization and peeling for(Index i=0; i0) { const Scalar* Bc0 = B+(n-1)*ldb; for(Index k=0; k(Bc0[0]); b10 = pset1(Bc0[1]); if(RK==4) b20 = pset1(Bc0[2]); if(RK==4) b30 = pset1(Bc0[3]); Packet a0, a1, a2, a3, c0, t0/*, t1*/; const Scalar* A0 = A+ib+(k+0)*lda; const Scalar* A1 = A+ib+(k+1)*lda; const Scalar* A2 = A+ib+(k+2)*lda; const Scalar* A3 = A+ib+(k+3)*lda; Scalar* C0 = C+ib+(n_end)*ldc; a0 = pload(A0); a1 = pload(A1); if(RK==4) { a2 = pload(A2); a3 = pload(A3); } else { // workaround "may be used uninitialized in this function" warning a2 = a3 = a0; } #define WORK(I) \ c0 = pload(C0+i+(I)*PacketSize); \ KMADD(c0, a0, b00, t0) \ a0 = pload(A0+i+(I+1)*PacketSize); \ KMADD(c0, a1, b10, t0) \ a1 = pload(A1+i+(I+1)*PacketSize); \ if(RK==4){ KMADD(c0, a2, b20, t0) }\ if(RK==4){ a2 = pload(A2+i+(I+1)*PacketSize); }\ if(RK==4){ KMADD(c0, a3, b30, t0) }\ if(RK==4){ a3 = pload(A3+i+(I+1)*PacketSize); }\ pstore(C0+i+(I)*PacketSize, c0); // aggressive vectorization and peeling for(Index i=0; i0) { for(Index j=0; j1 ? Aligned : 0 }; typedef Map, Alignment > MapVector; typedef Map, Alignment > ConstMapVector; if(rd==1) MapVector(C+j*ldc+ib,actual_b) += B[0+d_end+j*ldb] * ConstMapVector(A+(d_end+0)*lda+ib, actual_b); else if(rd==2) MapVector(C+j*ldc+ib,actual_b) += B[0+d_end+j*ldb] * ConstMapVector(A+(d_end+0)*lda+ib, actual_b) + B[1+d_end+j*ldb] * ConstMapVector(A+(d_end+1)*lda+ib, actual_b); else MapVector(C+j*ldc+ib,actual_b) += B[0+d_end+j*ldb] * ConstMapVector(A+(d_end+0)*lda+ib, actual_b) + B[1+d_end+j*ldb] * ConstMapVector(A+(d_end+1)*lda+ib, actual_b) + B[2+d_end+j*ldb] * ConstMapVector(A+(d_end+2)*lda+ib, actual_b); } } } // blocking on the rows of A and C } #undef KMADD } // namespace internal } // namespace Eigen #endif // EIGEN_SPARSELU_GEMM_KERNEL_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. /* This file is a modified version of heap_relax_snode.c file in SuperLU * -- SuperLU routine (version 3.0) -- * Univ. of California Berkeley, Xerox Palo Alto Research Center, * and Lawrence Berkeley National Lab. * October 15, 2003 * * Copyright (c) 1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY * EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program for any * purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is * granted, provided the above notices are retained, and a notice that * the code was modified is included with the above copyright notice. */ #ifndef SPARSELU_HEAP_RELAX_SNODE_H #define SPARSELU_HEAP_RELAX_SNODE_H namespace Eigen { namespace internal { /** * \brief Identify the initial relaxed supernodes * * This routine applied to a symmetric elimination tree. * It assumes that the matrix has been reordered according to the postorder of the etree * \param n The number of columns * \param et elimination tree * \param relax_columns Maximum number of columns allowed in a relaxed snode * \param descendants Number of descendants of each node in the etree * \param relax_end last column in a supernode */ template void SparseLUImpl::heap_relax_snode (const Index n, IndexVector& et, const Index relax_columns, IndexVector& descendants, IndexVector& relax_end) { // The etree may not be postordered, but its heap ordered IndexVector post; internal::treePostorder(StorageIndex(n), et, post); // Post order etree IndexVector inv_post(n+1); for (StorageIndex i = 0; i < n+1; ++i) inv_post(post(i)) = i; // inv_post = post.inverse()??? // Renumber etree in postorder IndexVector iwork(n); IndexVector et_save(n+1); for (Index i = 0; i < n; ++i) { iwork(post(i)) = post(et(i)); } et_save = et; // Save the original etree et = iwork; // compute the number of descendants of each node in the etree relax_end.setConstant(emptyIdxLU); Index j, parent; descendants.setZero(); for (j = 0; j < n; j++) { parent = et(j); if (parent != n) // not the dummy root descendants(parent) += descendants(j) + 1; } // Identify the relaxed supernodes by postorder traversal of the etree Index snode_start; // beginning of a snode StorageIndex k; Index nsuper_et_post = 0; // Number of relaxed snodes in postordered etree Index nsuper_et = 0; // Number of relaxed snodes in the original etree StorageIndex l; for (j = 0; j < n; ) { parent = et(j); snode_start = j; while ( parent != n && descendants(parent) < relax_columns ) { j = parent; parent = et(j); } // Found a supernode in postordered etree, j is the last column ++nsuper_et_post; k = StorageIndex(n); for (Index i = snode_start; i <= j; ++i) k = (std::min)(k, inv_post(i)); l = inv_post(j); if ( (l - k) == (j - snode_start) ) // Same number of columns in the snode { // This is also a supernode in the original etree relax_end(k) = l; // Record last column ++nsuper_et; } else { for (Index i = snode_start; i <= j; ++i) { l = inv_post(i); if (descendants(i) == 0) { relax_end(l) = l; ++nsuper_et; } } } j++; // Search for a new leaf while (descendants(j) != 0 && j < n) j++; } // End postorder traversal of the etree // Recover the original etree et = et_save; } } // end namespace internal } // end namespace Eigen #endif // SPARSELU_HEAP_RELAX_SNODE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseLU/SparseLU_kernel_bmod.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // Copyright (C) 2012 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef SPARSELU_KERNEL_BMOD_H #define SPARSELU_KERNEL_BMOD_H namespace Eigen { namespace internal { template struct LU_kernel_bmod { /** \internal * \brief Performs numeric block updates from a given supernode to a single column * * \param segsize Size of the segment (and blocks ) to use for updates * \param[in,out] dense Packed values of the original matrix * \param tempv temporary vector to use for updates * \param lusup array containing the supernodes * \param lda Leading dimension in the supernode * \param nrow Number of rows in the rectangular part of the supernode * \param lsub compressed row subscripts of supernodes * \param lptr pointer to the first column of the current supernode in lsub * \param no_zeros Number of nonzeros elements before the diagonal part of the supernode */ template static EIGEN_DONT_INLINE void run(const Index segsize, BlockScalarVector& dense, ScalarVector& tempv, ScalarVector& lusup, Index& luptr, const Index lda, const Index nrow, IndexVector& lsub, const Index lptr, const Index no_zeros); }; template template EIGEN_DONT_INLINE void LU_kernel_bmod::run(const Index segsize, BlockScalarVector& dense, ScalarVector& tempv, ScalarVector& lusup, Index& luptr, const Index lda, const Index nrow, IndexVector& lsub, const Index lptr, const Index no_zeros) { typedef typename ScalarVector::Scalar Scalar; // First, copy U[*,j] segment from dense(*) to tempv(*) // The result of triangular solve is in tempv[*]; // The result of matric-vector update is in dense[*] Index isub = lptr + no_zeros; Index i; Index irow; for (i = 0; i < ((SegSizeAtCompileTime==Dynamic)?segsize:SegSizeAtCompileTime); i++) { irow = lsub(isub); tempv(i) = dense(irow); ++isub; } // Dense triangular solve -- start effective triangle luptr += lda * no_zeros + no_zeros; // Form Eigen matrix and vector Map, 0, OuterStride<> > A( &(lusup.data()[luptr]), segsize, segsize, OuterStride<>(lda) ); Map > u(tempv.data(), segsize); u = A.template triangularView().solve(u); // Dense matrix-vector product y <-- B*x luptr += segsize; const Index PacketSize = internal::packet_traits::size; Index ldl = internal::first_multiple(nrow, PacketSize); Map, 0, OuterStride<> > B( &(lusup.data()[luptr]), nrow, segsize, OuterStride<>(lda) ); Index aligned_offset = internal::first_default_aligned(tempv.data()+segsize, PacketSize); Index aligned_with_B_offset = (PacketSize-internal::first_default_aligned(B.data(), PacketSize))%PacketSize; Map, 0, OuterStride<> > l(tempv.data()+segsize+aligned_offset+aligned_with_B_offset, nrow, OuterStride<>(ldl) ); l.setZero(); internal::sparselu_gemm(l.rows(), l.cols(), B.cols(), B.data(), B.outerStride(), u.data(), u.outerStride(), l.data(), l.outerStride()); // Scatter tempv[] into SPA dense[] as a temporary storage isub = lptr + no_zeros; for (i = 0; i < ((SegSizeAtCompileTime==Dynamic)?segsize:SegSizeAtCompileTime); i++) { irow = lsub(isub++); dense(irow) = tempv(i); } // Scatter l into SPA dense[] for (i = 0; i < nrow; i++) { irow = lsub(isub++); dense(irow) -= l(i); } } template <> struct LU_kernel_bmod<1> { template static EIGEN_DONT_INLINE void run(const Index /*segsize*/, BlockScalarVector& dense, ScalarVector& /*tempv*/, ScalarVector& lusup, Index& luptr, const Index lda, const Index nrow, IndexVector& lsub, const Index lptr, const Index no_zeros); }; template EIGEN_DONT_INLINE void LU_kernel_bmod<1>::run(const Index /*segsize*/, BlockScalarVector& dense, ScalarVector& /*tempv*/, ScalarVector& lusup, Index& luptr, const Index lda, const Index nrow, IndexVector& lsub, const Index lptr, const Index no_zeros) { typedef typename ScalarVector::Scalar Scalar; typedef typename IndexVector::Scalar StorageIndex; Scalar f = dense(lsub(lptr + no_zeros)); luptr += lda * no_zeros + no_zeros + 1; const Scalar* a(lusup.data() + luptr); const StorageIndex* irow(lsub.data()+lptr + no_zeros + 1); Index i = 0; for (; i+1 < nrow; i+=2) { Index i0 = *(irow++); Index i1 = *(irow++); Scalar a0 = *(a++); Scalar a1 = *(a++); Scalar d0 = dense.coeff(i0); Scalar d1 = dense.coeff(i1); d0 -= f*a0; d1 -= f*a1; dense.coeffRef(i0) = d0; dense.coeffRef(i1) = d1; } if(i // Copyright (C) 2012 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. /* * NOTE: This file is the modified version of [s,d,c,z]panel_bmod.c file in SuperLU * -- SuperLU routine (version 3.0) -- * Univ. of California Berkeley, Xerox Palo Alto Research Center, * and Lawrence Berkeley National Lab. * October 15, 2003 * * Copyright (c) 1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY * EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program for any * purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is * granted, provided the above notices are retained, and a notice that * the code was modified is included with the above copyright notice. */ #ifndef SPARSELU_PANEL_BMOD_H #define SPARSELU_PANEL_BMOD_H namespace Eigen { namespace internal { /** * \brief Performs numeric block updates (sup-panel) in topological order. * * Before entering this routine, the original nonzeros in the panel * were already copied into the spa[m,w] * * \param m number of rows in the matrix * \param w Panel size * \param jcol Starting column of the panel * \param nseg Number of segments in the U part * \param dense Store the full representation of the panel * \param tempv working array * \param segrep segment representative... first row in the segment * \param repfnz First nonzero rows * \param glu Global LU data. * * */ template void SparseLUImpl::panel_bmod(const Index m, const Index w, const Index jcol, const Index nseg, ScalarVector& dense, ScalarVector& tempv, IndexVector& segrep, IndexVector& repfnz, GlobalLU_t& glu) { Index ksub,jj,nextl_col; Index fsupc, nsupc, nsupr, nrow; Index krep, kfnz; Index lptr; // points to the row subscripts of a supernode Index luptr; // ... Index segsize,no_zeros ; // For each nonz supernode segment of U[*,j] in topological order Index k = nseg - 1; const Index PacketSize = internal::packet_traits::size; for (ksub = 0; ksub < nseg; ksub++) { // For each updating supernode /* krep = representative of current k-th supernode * fsupc = first supernodal column * nsupc = number of columns in a supernode * nsupr = number of rows in a supernode */ krep = segrep(k); k--; fsupc = glu.xsup(glu.supno(krep)); nsupc = krep - fsupc + 1; nsupr = glu.xlsub(fsupc+1) - glu.xlsub(fsupc); nrow = nsupr - nsupc; lptr = glu.xlsub(fsupc); // loop over the panel columns to detect the actual number of columns and rows Index u_rows = 0; Index u_cols = 0; for (jj = jcol; jj < jcol + w; jj++) { nextl_col = (jj-jcol) * m; VectorBlock repfnz_col(repfnz, nextl_col, m); // First nonzero column index for each row kfnz = repfnz_col(krep); if ( kfnz == emptyIdxLU ) continue; // skip any zero segment segsize = krep - kfnz + 1; u_cols++; u_rows = (std::max)(segsize,u_rows); } if(nsupc >= 2) { Index ldu = internal::first_multiple(u_rows, PacketSize); Map > U(tempv.data(), u_rows, u_cols, OuterStride<>(ldu)); // gather U Index u_col = 0; for (jj = jcol; jj < jcol + w; jj++) { nextl_col = (jj-jcol) * m; VectorBlock repfnz_col(repfnz, nextl_col, m); // First nonzero column index for each row VectorBlock dense_col(dense, nextl_col, m); // Scatter/gather entire matrix column from/to here kfnz = repfnz_col(krep); if ( kfnz == emptyIdxLU ) continue; // skip any zero segment segsize = krep - kfnz + 1; luptr = glu.xlusup(fsupc); no_zeros = kfnz - fsupc; Index isub = lptr + no_zeros; Index off = u_rows-segsize; for (Index i = 0; i < off; i++) U(i,u_col) = 0; for (Index i = 0; i < segsize; i++) { Index irow = glu.lsub(isub); U(i+off,u_col) = dense_col(irow); ++isub; } u_col++; } // solve U = A^-1 U luptr = glu.xlusup(fsupc); Index lda = glu.xlusup(fsupc+1) - glu.xlusup(fsupc); no_zeros = (krep - u_rows + 1) - fsupc; luptr += lda * no_zeros + no_zeros; MappedMatrixBlock A(glu.lusup.data()+luptr, u_rows, u_rows, OuterStride<>(lda) ); U = A.template triangularView().solve(U); // update luptr += u_rows; MappedMatrixBlock B(glu.lusup.data()+luptr, nrow, u_rows, OuterStride<>(lda) ); eigen_assert(tempv.size()>w*ldu + nrow*w + 1); Index ldl = internal::first_multiple(nrow, PacketSize); Index offset = (PacketSize-internal::first_default_aligned(B.data(), PacketSize)) % PacketSize; MappedMatrixBlock L(tempv.data()+w*ldu+offset, nrow, u_cols, OuterStride<>(ldl)); L.setZero(); internal::sparselu_gemm(L.rows(), L.cols(), B.cols(), B.data(), B.outerStride(), U.data(), U.outerStride(), L.data(), L.outerStride()); // scatter U and L u_col = 0; for (jj = jcol; jj < jcol + w; jj++) { nextl_col = (jj-jcol) * m; VectorBlock repfnz_col(repfnz, nextl_col, m); // First nonzero column index for each row VectorBlock dense_col(dense, nextl_col, m); // Scatter/gather entire matrix column from/to here kfnz = repfnz_col(krep); if ( kfnz == emptyIdxLU ) continue; // skip any zero segment segsize = krep - kfnz + 1; no_zeros = kfnz - fsupc; Index isub = lptr + no_zeros; Index off = u_rows-segsize; for (Index i = 0; i < segsize; i++) { Index irow = glu.lsub(isub++); dense_col(irow) = U.coeff(i+off,u_col); U.coeffRef(i+off,u_col) = 0; } // Scatter l into SPA dense[] for (Index i = 0; i < nrow; i++) { Index irow = glu.lsub(isub++); dense_col(irow) -= L.coeff(i,u_col); L.coeffRef(i,u_col) = 0; } u_col++; } } else // level 2 only { // Sequence through each column in the panel for (jj = jcol; jj < jcol + w; jj++) { nextl_col = (jj-jcol) * m; VectorBlock repfnz_col(repfnz, nextl_col, m); // First nonzero column index for each row VectorBlock dense_col(dense, nextl_col, m); // Scatter/gather entire matrix column from/to here kfnz = repfnz_col(krep); if ( kfnz == emptyIdxLU ) continue; // skip any zero segment segsize = krep - kfnz + 1; luptr = glu.xlusup(fsupc); Index lda = glu.xlusup(fsupc+1)-glu.xlusup(fsupc);// nsupr // Perform a trianglar solve and block update, // then scatter the result of sup-col update to dense[] no_zeros = kfnz - fsupc; if(segsize==1) LU_kernel_bmod<1>::run(segsize, dense_col, tempv, glu.lusup, luptr, lda, nrow, glu.lsub, lptr, no_zeros); else if(segsize==2) LU_kernel_bmod<2>::run(segsize, dense_col, tempv, glu.lusup, luptr, lda, nrow, glu.lsub, lptr, no_zeros); else if(segsize==3) LU_kernel_bmod<3>::run(segsize, dense_col, tempv, glu.lusup, luptr, lda, nrow, glu.lsub, lptr, no_zeros); else LU_kernel_bmod::run(segsize, dense_col, tempv, glu.lusup, luptr, lda, nrow, glu.lsub, lptr, no_zeros); } // End for each column in the panel } } // End for each updating supernode } // end panel bmod } // end namespace internal } // end namespace Eigen #endif // SPARSELU_PANEL_BMOD_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseLU/SparseLU_panel_dfs.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. /* * NOTE: This file is the modified version of [s,d,c,z]panel_dfs.c file in SuperLU * -- SuperLU routine (version 2.0) -- * Univ. of California Berkeley, Xerox Palo Alto Research Center, * and Lawrence Berkeley National Lab. * November 15, 1997 * * Copyright (c) 1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY * EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program for any * purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is * granted, provided the above notices are retained, and a notice that * the code was modified is included with the above copyright notice. */ #ifndef SPARSELU_PANEL_DFS_H #define SPARSELU_PANEL_DFS_H namespace Eigen { namespace internal { template struct panel_dfs_traits { typedef typename IndexVector::Scalar StorageIndex; panel_dfs_traits(Index jcol, StorageIndex* marker) : m_jcol(jcol), m_marker(marker) {} bool update_segrep(Index krep, StorageIndex jj) { if(m_marker[krep] template void SparseLUImpl::dfs_kernel(const StorageIndex jj, IndexVector& perm_r, Index& nseg, IndexVector& panel_lsub, IndexVector& segrep, Ref repfnz_col, IndexVector& xprune, Ref marker, IndexVector& parent, IndexVector& xplore, GlobalLU_t& glu, Index& nextl_col, Index krow, Traits& traits ) { StorageIndex kmark = marker(krow); // For each unmarked krow of jj marker(krow) = jj; StorageIndex kperm = perm_r(krow); if (kperm == emptyIdxLU ) { // krow is in L : place it in structure of L(*, jj) panel_lsub(nextl_col++) = StorageIndex(krow); // krow is indexed into A traits.mem_expand(panel_lsub, nextl_col, kmark); } else { // krow is in U : if its supernode-representative krep // has been explored, update repfnz(*) // krep = supernode representative of the current row StorageIndex krep = glu.xsup(glu.supno(kperm)+1) - 1; // First nonzero element in the current column: StorageIndex myfnz = repfnz_col(krep); if (myfnz != emptyIdxLU ) { // Representative visited before if (myfnz > kperm ) repfnz_col(krep) = kperm; } else { // Otherwise, perform dfs starting at krep StorageIndex oldrep = emptyIdxLU; parent(krep) = oldrep; repfnz_col(krep) = kperm; StorageIndex xdfs = glu.xlsub(krep); Index maxdfs = xprune(krep); StorageIndex kpar; do { // For each unmarked kchild of krep while (xdfs < maxdfs) { StorageIndex kchild = glu.lsub(xdfs); xdfs++; StorageIndex chmark = marker(kchild); if (chmark != jj ) { marker(kchild) = jj; StorageIndex chperm = perm_r(kchild); if (chperm == emptyIdxLU) { // case kchild is in L: place it in L(*, j) panel_lsub(nextl_col++) = kchild; traits.mem_expand(panel_lsub, nextl_col, chmark); } else { // case kchild is in U : // chrep = its supernode-rep. If its rep has been explored, // update its repfnz(*) StorageIndex chrep = glu.xsup(glu.supno(chperm)+1) - 1; myfnz = repfnz_col(chrep); if (myfnz != emptyIdxLU) { // Visited before if (myfnz > chperm) repfnz_col(chrep) = chperm; } else { // Cont. dfs at snode-rep of kchild xplore(krep) = xdfs; oldrep = krep; krep = chrep; // Go deeper down G(L) parent(krep) = oldrep; repfnz_col(krep) = chperm; xdfs = glu.xlsub(krep); maxdfs = xprune(krep); } // end if myfnz != -1 } // end if chperm == -1 } // end if chmark !=jj } // end while xdfs < maxdfs // krow has no more unexplored nbrs : // Place snode-rep krep in postorder DFS, if this // segment is seen for the first time. (Note that // "repfnz(krep)" may change later.) // Baktrack dfs to its parent if(traits.update_segrep(krep,jj)) //if (marker1(krep) < jcol ) { segrep(nseg) = krep; ++nseg; //marker1(krep) = jj; } kpar = parent(krep); // Pop recursion, mimic recursion if (kpar == emptyIdxLU) break; // dfs done krep = kpar; xdfs = xplore(krep); maxdfs = xprune(krep); } while (kpar != emptyIdxLU); // Do until empty stack } // end if (myfnz = -1) } // end if (kperm == -1) } /** * \brief Performs a symbolic factorization on a panel of columns [jcol, jcol+w) * * A supernode representative is the last column of a supernode. * The nonzeros in U[*,j] are segments that end at supernodes representatives * * The routine returns a list of the supernodal representatives * in topological order of the dfs that generates them. This list is * a superset of the topological order of each individual column within * the panel. * The location of the first nonzero in each supernodal segment * (supernodal entry location) is also returned. Each column has * a separate list for this purpose. * * Two markers arrays are used for dfs : * marker[i] == jj, if i was visited during dfs of current column jj; * marker1[i] >= jcol, if i was visited by earlier columns in this panel; * * \param[in] m number of rows in the matrix * \param[in] w Panel size * \param[in] jcol Starting column of the panel * \param[in] A Input matrix in column-major storage * \param[in] perm_r Row permutation * \param[out] nseg Number of U segments * \param[out] dense Accumulate the column vectors of the panel * \param[out] panel_lsub Subscripts of the row in the panel * \param[out] segrep Segment representative i.e first nonzero row of each segment * \param[out] repfnz First nonzero location in each row * \param[out] xprune The pruned elimination tree * \param[out] marker work vector * \param parent The elimination tree * \param xplore work vector * \param glu The global data structure * */ template void SparseLUImpl::panel_dfs(const Index m, const Index w, const Index jcol, MatrixType& A, IndexVector& perm_r, Index& nseg, ScalarVector& dense, IndexVector& panel_lsub, IndexVector& segrep, IndexVector& repfnz, IndexVector& xprune, IndexVector& marker, IndexVector& parent, IndexVector& xplore, GlobalLU_t& glu) { Index nextl_col; // Next available position in panel_lsub[*,jj] // Initialize pointers VectorBlock marker1(marker, m, m); nseg = 0; panel_dfs_traits traits(jcol, marker1.data()); // For each column in the panel for (StorageIndex jj = StorageIndex(jcol); jj < jcol + w; jj++) { nextl_col = (jj - jcol) * m; VectorBlock repfnz_col(repfnz, nextl_col, m); // First nonzero location in each row VectorBlock dense_col(dense,nextl_col, m); // Accumulate a column vector here // For each nnz in A[*, jj] do depth first search for (typename MatrixType::InnerIterator it(A, jj); it; ++it) { Index krow = it.row(); dense_col(krow) = it.value(); StorageIndex kmark = marker(krow); if (kmark == jj) continue; // krow visited before, go to the next nonzero dfs_kernel(jj, perm_r, nseg, panel_lsub, segrep, repfnz_col, xprune, marker, parent, xplore, glu, nextl_col, krow, traits); }// end for nonzeros in column jj } // end for column jj } } // end namespace internal } // end namespace Eigen #endif // SPARSELU_PANEL_DFS_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseLU/SparseLU_pivotL.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. /* * NOTE: This file is the modified version of xpivotL.c file in SuperLU * -- SuperLU routine (version 3.0) -- * Univ. of California Berkeley, Xerox Palo Alto Research Center, * and Lawrence Berkeley National Lab. * October 15, 2003 * * Copyright (c) 1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY * EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program for any * purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is * granted, provided the above notices are retained, and a notice that * the code was modified is included with the above copyright notice. */ #ifndef SPARSELU_PIVOTL_H #define SPARSELU_PIVOTL_H namespace Eigen { namespace internal { /** * \brief Performs the numerical pivotin on the current column of L, and the CDIV operation. * * Pivot policy : * (1) Compute thresh = u * max_(i>=j) abs(A_ij); * (2) IF user specifies pivot row k and abs(A_kj) >= thresh THEN * pivot row = k; * ELSE IF abs(A_jj) >= thresh THEN * pivot row = j; * ELSE * pivot row = m; * * Note: If you absolutely want to use a given pivot order, then set u=0.0. * * \param jcol The current column of L * \param diagpivotthresh diagonal pivoting threshold * \param[in,out] perm_r Row permutation (threshold pivoting) * \param[in] iperm_c column permutation - used to finf diagonal of Pc*A*Pc' * \param[out] pivrow The pivot row * \param glu Global LU data * \return 0 if success, i > 0 if U(i,i) is exactly zero * */ template Index SparseLUImpl::pivotL(const Index jcol, const RealScalar& diagpivotthresh, IndexVector& perm_r, IndexVector& iperm_c, Index& pivrow, GlobalLU_t& glu) { Index fsupc = (glu.xsup)((glu.supno)(jcol)); // First column in the supernode containing the column jcol Index nsupc = jcol - fsupc; // Number of columns in the supernode portion, excluding jcol; nsupc >=0 Index lptr = glu.xlsub(fsupc); // pointer to the starting location of the row subscripts for this supernode portion Index nsupr = glu.xlsub(fsupc+1) - lptr; // Number of rows in the supernode Index lda = glu.xlusup(fsupc+1) - glu.xlusup(fsupc); // leading dimension Scalar* lu_sup_ptr = &(glu.lusup.data()[glu.xlusup(fsupc)]); // Start of the current supernode Scalar* lu_col_ptr = &(glu.lusup.data()[glu.xlusup(jcol)]); // Start of jcol in the supernode StorageIndex* lsub_ptr = &(glu.lsub.data()[lptr]); // Start of row indices of the supernode // Determine the largest abs numerical value for partial pivoting Index diagind = iperm_c(jcol); // diagonal index RealScalar pivmax(-1.0); Index pivptr = nsupc; Index diag = emptyIdxLU; RealScalar rtemp; Index isub, icol, itemp, k; for (isub = nsupc; isub < nsupr; ++isub) { using std::abs; rtemp = abs(lu_col_ptr[isub]); if (rtemp > pivmax) { pivmax = rtemp; pivptr = isub; } if (lsub_ptr[isub] == diagind) diag = isub; } // Test for singularity if ( pivmax <= RealScalar(0.0) ) { // if pivmax == -1, the column is structurally empty, otherwise it is only numerically zero pivrow = pivmax < RealScalar(0.0) ? diagind : lsub_ptr[pivptr]; perm_r(pivrow) = StorageIndex(jcol); return (jcol+1); } RealScalar thresh = diagpivotthresh * pivmax; // Choose appropriate pivotal element { // Test if the diagonal element can be used as a pivot (given the threshold value) if (diag >= 0 ) { // Diagonal element exists using std::abs; rtemp = abs(lu_col_ptr[diag]); if (rtemp != RealScalar(0.0) && rtemp >= thresh) pivptr = diag; } pivrow = lsub_ptr[pivptr]; } // Record pivot row perm_r(pivrow) = StorageIndex(jcol); // Interchange row subscripts if (pivptr != nsupc ) { std::swap( lsub_ptr[pivptr], lsub_ptr[nsupc] ); // Interchange numerical values as well, for the two rows in the whole snode // such that L is indexed the same way as A for (icol = 0; icol <= nsupc; icol++) { itemp = pivptr + icol * lda; std::swap(lu_sup_ptr[itemp], lu_sup_ptr[nsupc + icol * lda]); } } // cdiv operations Scalar temp = Scalar(1.0) / lu_col_ptr[nsupc]; for (k = nsupc+1; k < nsupr; k++) lu_col_ptr[k] *= temp; return 0; } } // end namespace internal } // end namespace Eigen #endif // SPARSELU_PIVOTL_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseLU/SparseLU_pruneL.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. /* * NOTE: This file is the modified version of [s,d,c,z]pruneL.c file in SuperLU * -- SuperLU routine (version 2.0) -- * Univ. of California Berkeley, Xerox Palo Alto Research Center, * and Lawrence Berkeley National Lab. * November 15, 1997 * * Copyright (c) 1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY * EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program for any * purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is * granted, provided the above notices are retained, and a notice that * the code was modified is included with the above copyright notice. */ #ifndef SPARSELU_PRUNEL_H #define SPARSELU_PRUNEL_H namespace Eigen { namespace internal { /** * \brief Prunes the L-structure. * * It prunes the L-structure of supernodes whose L-structure contains the current pivot row "pivrow" * * * \param jcol The current column of L * \param[in] perm_r Row permutation * \param[out] pivrow The pivot row * \param nseg Number of segments * \param segrep * \param repfnz * \param[out] xprune * \param glu Global LU data * */ template void SparseLUImpl::pruneL(const Index jcol, const IndexVector& perm_r, const Index pivrow, const Index nseg, const IndexVector& segrep, BlockIndexVector repfnz, IndexVector& xprune, GlobalLU_t& glu) { // For each supernode-rep irep in U(*,j] Index jsupno = glu.supno(jcol); Index i,irep,irep1; bool movnum, do_prune = false; Index kmin = 0, kmax = 0, minloc, maxloc,krow; for (i = 0; i < nseg; i++) { irep = segrep(i); irep1 = irep + 1; do_prune = false; // Don't prune with a zero U-segment if (repfnz(irep) == emptyIdxLU) continue; // If a snode overlaps with the next panel, then the U-segment // is fragmented into two parts -- irep and irep1. We should let // pruning occur at the rep-column in irep1s snode. if (glu.supno(irep) == glu.supno(irep1) ) continue; // don't prune // If it has not been pruned & it has a nonz in row L(pivrow,i) if (glu.supno(irep) != jsupno ) { if ( xprune (irep) >= glu.xlsub(irep1) ) { kmin = glu.xlsub(irep); kmax = glu.xlsub(irep1) - 1; for (krow = kmin; krow <= kmax; krow++) { if (glu.lsub(krow) == pivrow) { do_prune = true; break; } } } if (do_prune) { // do a quicksort-type partition // movnum=true means that the num values have to be exchanged movnum = false; if (irep == glu.xsup(glu.supno(irep)) ) // Snode of size 1 movnum = true; while (kmin <= kmax) { if (perm_r(glu.lsub(kmax)) == emptyIdxLU) kmax--; else if ( perm_r(glu.lsub(kmin)) != emptyIdxLU) kmin++; else { // kmin below pivrow (not yet pivoted), and kmax // above pivrow: interchange the two suscripts std::swap(glu.lsub(kmin), glu.lsub(kmax)); // If the supernode has only one column, then we // only keep one set of subscripts. For any subscript // intercnahge performed, similar interchange must be // done on the numerical values. if (movnum) { minloc = glu.xlusup(irep) + ( kmin - glu.xlsub(irep) ); maxloc = glu.xlusup(irep) + ( kmax - glu.xlsub(irep) ); std::swap(glu.lusup(minloc), glu.lusup(maxloc)); } kmin++; kmax--; } } // end while xprune(irep) = StorageIndex(kmin); //Pruning } // end if do_prune } // end pruning } // End for each U-segment } } // end namespace internal } // end namespace Eigen #endif // SPARSELU_PRUNEL_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseLU/SparseLU_relax_snode.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. /* This file is a modified version of heap_relax_snode.c file in SuperLU * -- SuperLU routine (version 3.0) -- * Univ. of California Berkeley, Xerox Palo Alto Research Center, * and Lawrence Berkeley National Lab. * October 15, 2003 * * Copyright (c) 1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY * EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program for any * purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is * granted, provided the above notices are retained, and a notice that * the code was modified is included with the above copyright notice. */ #ifndef SPARSELU_RELAX_SNODE_H #define SPARSELU_RELAX_SNODE_H namespace Eigen { namespace internal { /** * \brief Identify the initial relaxed supernodes * * This routine is applied to a column elimination tree. * It assumes that the matrix has been reordered according to the postorder of the etree * \param n the number of columns * \param et elimination tree * \param relax_columns Maximum number of columns allowed in a relaxed snode * \param descendants Number of descendants of each node in the etree * \param relax_end last column in a supernode */ template void SparseLUImpl::relax_snode (const Index n, IndexVector& et, const Index relax_columns, IndexVector& descendants, IndexVector& relax_end) { // compute the number of descendants of each node in the etree Index parent; relax_end.setConstant(emptyIdxLU); descendants.setZero(); for (Index j = 0; j < n; j++) { parent = et(j); if (parent != n) // not the dummy root descendants(parent) += descendants(j) + 1; } // Identify the relaxed supernodes by postorder traversal of the etree Index snode_start; // beginning of a snode for (Index j = 0; j < n; ) { parent = et(j); snode_start = j; while ( parent != n && descendants(parent) < relax_columns ) { j = parent; parent = et(j); } // Found a supernode in postordered etree, j is the last column relax_end(snode_start) = StorageIndex(j); // Record last column j++; // Search for a new leaf while (descendants(j) != 0 && j < n) j++; } // End postorder traversal of the etree } } // end namespace internal } // end namespace Eigen #endif ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SparseQR/SparseQR.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012-2013 Desire Nuentsa // Copyright (C) 2012-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSE_QR_H #define EIGEN_SPARSE_QR_H namespace Eigen { template class SparseQR; template struct SparseQRMatrixQReturnType; template struct SparseQRMatrixQTransposeReturnType; template struct SparseQR_QProduct; namespace internal { template struct traits > { typedef typename SparseQRType::MatrixType ReturnType; typedef typename ReturnType::StorageIndex StorageIndex; typedef typename ReturnType::StorageKind StorageKind; enum { RowsAtCompileTime = Dynamic, ColsAtCompileTime = Dynamic }; }; template struct traits > { typedef typename SparseQRType::MatrixType ReturnType; }; template struct traits > { typedef typename Derived::PlainObject ReturnType; }; } // End namespace internal /** * \ingroup SparseQR_Module * \class SparseQR * \brief Sparse left-looking QR factorization with numerical column pivoting * * This class implements a left-looking QR decomposition of sparse matrices * with numerical column pivoting. * When a column has a norm less than a given tolerance * it is implicitly permuted to the end. The QR factorization thus obtained is * given by A*P = Q*R where R is upper triangular or trapezoidal. * * P is the column permutation which is the product of the fill-reducing and the * numerical permutations. Use colsPermutation() to get it. * * Q is the orthogonal matrix represented as products of Householder reflectors. * Use matrixQ() to get an expression and matrixQ().adjoint() to get the adjoint. * You can then apply it to a vector. * * R is the sparse triangular or trapezoidal matrix. The later occurs when A is rank-deficient. * matrixR().topLeftCorner(rank(), rank()) always returns a triangular factor of full rank. * * \tparam MatrixType_ The type of the sparse matrix A, must be a column-major SparseMatrix<> * \tparam OrderingType_ The fill-reducing ordering method. See the \link OrderingMethods_Module * OrderingMethods \endlink module for the list of built-in and external ordering methods. * * \implsparsesolverconcept * * The numerical pivoting strategy and default threshold are the same as in SuiteSparse QR, and * detailed in the following paper: * * Tim Davis, "Algorithm 915, SuiteSparseQR: Multifrontal Multithreaded Rank-Revealing * Sparse QR Factorization, ACM Trans. on Math. Soft. 38(1), 2011. * * Even though it is qualified as "rank-revealing", this strategy might fail for some * rank deficient problems. When this class is used to solve linear or least-square problems * it is thus strongly recommended to check the accuracy of the computed solution. If it * failed, it usually helps to increase the threshold with setPivotThreshold. * * \warning The input sparse matrix A must be in compressed mode (see SparseMatrix::makeCompressed()). * \warning For complex matrices matrixQ().transpose() will actually return the adjoint matrix. * */ template class SparseQR : public SparseSolverBase > { protected: typedef SparseSolverBase > Base; using Base::m_isInitialized; public: using Base::_solve_impl; typedef MatrixType_ MatrixType; typedef OrderingType_ OrderingType; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef typename MatrixType::StorageIndex StorageIndex; typedef SparseMatrix QRMatrixType; typedef Matrix IndexVector; typedef Matrix ScalarVector; typedef PermutationMatrix PermutationType; enum { ColsAtCompileTime = MatrixType::ColsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; public: SparseQR () : m_analysisIsok(false), m_lastError(""), m_useDefaultThreshold(true),m_isQSorted(false),m_isEtreeOk(false) { } /** Construct a QR factorization of the matrix \a mat. * * \warning The matrix \a mat must be in compressed mode (see SparseMatrix::makeCompressed()). * * \sa compute() */ explicit SparseQR(const MatrixType& mat) : m_analysisIsok(false), m_lastError(""), m_useDefaultThreshold(true),m_isQSorted(false),m_isEtreeOk(false) { compute(mat); } /** Computes the QR factorization of the sparse matrix \a mat. * * \warning The matrix \a mat must be in compressed mode (see SparseMatrix::makeCompressed()). * * \sa analyzePattern(), factorize() */ void compute(const MatrixType& mat) { analyzePattern(mat); factorize(mat); } void analyzePattern(const MatrixType& mat); void factorize(const MatrixType& mat); /** \returns the number of rows of the represented matrix. */ inline Index rows() const { return m_pmat.rows(); } /** \returns the number of columns of the represented matrix. */ inline Index cols() const { return m_pmat.cols();} /** \returns a const reference to the \b sparse upper triangular matrix R of the QR factorization. * \warning The entries of the returned matrix are not sorted. This means that using it in algorithms * expecting sorted entries will fail. This include random coefficient accesses (SpaseMatrix::coeff()), * and coefficient-wise operations. Matrix products and triangular solves are fine though. * * To sort the entries, you can assign it to a row-major matrix, and if a column-major matrix * is required, you can copy it again: * \code * SparseMatrix R = qr.matrixR(); // column-major, not sorted! * SparseMatrix Rr = qr.matrixR(); // row-major, sorted * SparseMatrix Rc = Rr; // column-major, sorted * \endcode */ const QRMatrixType& matrixR() const { return m_R; } /** \returns the number of non linearly dependent columns as determined by the pivoting threshold. * * \sa setPivotThreshold() */ Index rank() const { eigen_assert(m_isInitialized && "The factorization should be called first, use compute()"); return m_nonzeropivots; } /** \returns an expression of the matrix Q as products of sparse Householder reflectors. * The common usage of this function is to apply it to a dense matrix or vector * \code * VectorXd B1, B2; * // Initialize B1 * B2 = matrixQ() * B1; * \endcode * * To get a plain SparseMatrix representation of Q: * \code * SparseMatrix Q; * Q = SparseQR >(A).matrixQ(); * \endcode * Internally, this call simply performs a sparse product between the matrix Q * and a sparse identity matrix. However, due to the fact that the sparse * reflectors are stored unsorted, two transpositions are needed to sort * them before performing the product. */ SparseQRMatrixQReturnType matrixQ() const { return SparseQRMatrixQReturnType(*this); } /** \returns a const reference to the column permutation P that was applied to A such that A*P = Q*R * It is the combination of the fill-in reducing permutation and numerical column pivoting. */ const PermutationType& colsPermutation() const { eigen_assert(m_isInitialized && "Decomposition is not initialized."); return m_outputPerm_c; } /** \returns A string describing the type of error. * This method is provided to ease debugging, not to handle errors. */ std::string lastErrorMessage() const { return m_lastError; } /** \internal */ template bool _solve_impl(const MatrixBase &B, MatrixBase &dest) const { eigen_assert(m_isInitialized && "The factorization should be called first, use compute()"); eigen_assert(this->rows() == B.rows() && "SparseQR::solve() : invalid number of rows in the right hand side matrix"); Index rank = this->rank(); // Compute Q^* * b; typename Dest::PlainObject y, b; y = this->matrixQ().adjoint() * B; b = y; // Solve with the triangular matrix R y.resize((std::max)(cols(),y.rows()),y.cols()); y.topRows(rank) = this->matrixR().topLeftCorner(rank, rank).template triangularView().solve(b.topRows(rank)); y.bottomRows(y.rows()-rank).setZero(); // Apply the column permutation if (m_perm_c.size()) dest = colsPermutation() * y.topRows(cols()); else dest = y.topRows(cols()); m_info = Success; return true; } /** Sets the threshold that is used to determine linearly dependent columns during the factorization. * * In practice, if during the factorization the norm of the column that has to be eliminated is below * this threshold, then the entire column is treated as zero, and it is moved at the end. */ void setPivotThreshold(const RealScalar& threshold) { m_useDefaultThreshold = false; m_threshold = threshold; } /** \returns the solution X of \f$ A X = B \f$ using the current decomposition of A. * * \sa compute() */ template inline const Solve solve(const MatrixBase& B) const { eigen_assert(m_isInitialized && "The factorization should be called first, use compute()"); eigen_assert(this->rows() == B.rows() && "SparseQR::solve() : invalid number of rows in the right hand side matrix"); return Solve(*this, B.derived()); } template inline const Solve solve(const SparseMatrixBase& B) const { eigen_assert(m_isInitialized && "The factorization should be called first, use compute()"); eigen_assert(this->rows() == B.rows() && "SparseQR::solve() : invalid number of rows in the right hand side matrix"); return Solve(*this, B.derived()); } /** \brief Reports whether previous computation was successful. * * \returns \c Success if computation was successful, * \c NumericalIssue if the QR factorization reports a numerical problem * \c InvalidInput if the input matrix is invalid * * \sa iparm() */ ComputationInfo info() const { eigen_assert(m_isInitialized && "Decomposition is not initialized."); return m_info; } /** \internal */ inline void _sort_matrix_Q() { if(this->m_isQSorted) return; // The matrix Q is sorted during the transposition SparseMatrix mQrm(this->m_Q); this->m_Q = mQrm; this->m_isQSorted = true; } protected: bool m_analysisIsok; bool m_factorizationIsok; mutable ComputationInfo m_info; std::string m_lastError; QRMatrixType m_pmat; // Temporary matrix QRMatrixType m_R; // The triangular factor matrix QRMatrixType m_Q; // The orthogonal reflectors ScalarVector m_hcoeffs; // The Householder coefficients PermutationType m_perm_c; // Fill-reducing Column permutation PermutationType m_pivotperm; // The permutation for rank revealing PermutationType m_outputPerm_c; // The final column permutation RealScalar m_threshold; // Threshold to determine null Householder reflections bool m_useDefaultThreshold; // Use default threshold Index m_nonzeropivots; // Number of non zero pivots found IndexVector m_etree; // Column elimination tree IndexVector m_firstRowElt; // First element in each row bool m_isQSorted; // whether Q is sorted or not bool m_isEtreeOk; // whether the elimination tree match the initial input matrix template friend struct SparseQR_QProduct; }; /** \brief Preprocessing step of a QR factorization * * \warning The matrix \a mat must be in compressed mode (see SparseMatrix::makeCompressed()). * * In this step, the fill-reducing permutation is computed and applied to the columns of A * and the column elimination tree is computed as well. Only the sparsity pattern of \a mat is exploited. * * \note In this step it is assumed that there is no empty row in the matrix \a mat. */ template void SparseQR::analyzePattern(const MatrixType& mat) { eigen_assert(mat.isCompressed() && "SparseQR requires a sparse matrix in compressed mode. Call .makeCompressed() before passing it to SparseQR"); // Copy to a column major matrix if the input is rowmajor typename internal::conditional::type matCpy(mat); // Compute the column fill reducing ordering OrderingType ord; ord(matCpy, m_perm_c); Index n = mat.cols(); Index m = mat.rows(); Index diagSize = (std::min)(m,n); if (!m_perm_c.size()) { m_perm_c.resize(n); m_perm_c.indices().setLinSpaced(n, 0,StorageIndex(n-1)); } // Compute the column elimination tree of the permuted matrix m_outputPerm_c = m_perm_c.inverse(); internal::coletree(matCpy, m_etree, m_firstRowElt, m_outputPerm_c.indices().data()); m_isEtreeOk = true; m_R.resize(m, n); m_Q.resize(m, diagSize); // Allocate space for nonzero elements: rough estimation m_R.reserve(2*mat.nonZeros()); //FIXME Get a more accurate estimation through symbolic factorization with the etree m_Q.reserve(2*mat.nonZeros()); m_hcoeffs.resize(diagSize); m_analysisIsok = true; } /** \brief Performs the numerical QR factorization of the input matrix * * The function SparseQR::analyzePattern(const MatrixType&) must have been called beforehand with * a matrix having the same sparsity pattern than \a mat. * * \param mat The sparse column-major matrix */ template void SparseQR::factorize(const MatrixType& mat) { using std::abs; eigen_assert(m_analysisIsok && "analyzePattern() should be called before this step"); StorageIndex m = StorageIndex(mat.rows()); StorageIndex n = StorageIndex(mat.cols()); StorageIndex diagSize = (std::min)(m,n); IndexVector mark((std::max)(m,n)); mark.setConstant(-1); // Record the visited nodes IndexVector Ridx(n), Qidx(m); // Store temporarily the row indexes for the current column of R and Q Index nzcolR, nzcolQ; // Number of nonzero for the current column of R and Q ScalarVector tval(m); // The dense vector used to compute the current column RealScalar pivotThreshold = m_threshold; m_R.setZero(); m_Q.setZero(); m_pmat = mat; if(!m_isEtreeOk) { m_outputPerm_c = m_perm_c.inverse(); internal::coletree(m_pmat, m_etree, m_firstRowElt, m_outputPerm_c.indices().data()); m_isEtreeOk = true; } m_pmat.uncompress(); // To have the innerNonZeroPtr allocated // Apply the fill-in reducing permutation lazily: { // If the input is row major, copy the original column indices, // otherwise directly use the input matrix // IndexVector originalOuterIndicesCpy; const StorageIndex *originalOuterIndices = mat.outerIndexPtr(); if(MatrixType::IsRowMajor) { originalOuterIndicesCpy = IndexVector::Map(m_pmat.outerIndexPtr(),n+1); originalOuterIndices = originalOuterIndicesCpy.data(); } for (int i = 0; i < n; i++) { Index p = m_perm_c.size() ? m_perm_c.indices()(i) : i; m_pmat.outerIndexPtr()[p] = originalOuterIndices[i]; m_pmat.innerNonZeroPtr()[p] = originalOuterIndices[i+1] - originalOuterIndices[i]; } } /* Compute the default threshold as in MatLab, see: * Tim Davis, "Algorithm 915, SuiteSparseQR: Multifrontal Multithreaded Rank-Revealing * Sparse QR Factorization, ACM Trans. on Math. Soft. 38(1), 2011, Page 8:3 */ if(m_useDefaultThreshold) { RealScalar max2Norm = 0.0; for (int j = 0; j < n; j++) max2Norm = numext::maxi(max2Norm, m_pmat.col(j).norm()); if(max2Norm==RealScalar(0)) max2Norm = RealScalar(1); pivotThreshold = 20 * (m + n) * max2Norm * NumTraits::epsilon(); } // Initialize the numerical permutation m_pivotperm.setIdentity(n); StorageIndex nonzeroCol = 0; // Record the number of valid pivots m_Q.startVec(0); // Left looking rank-revealing QR factorization: compute a column of R and Q at a time for (StorageIndex col = 0; col < n; ++col) { mark.setConstant(-1); m_R.startVec(col); mark(nonzeroCol) = col; Qidx(0) = nonzeroCol; nzcolR = 0; nzcolQ = 1; bool found_diag = nonzeroCol>=m; tval.setZero(); // Symbolic factorization: find the nonzero locations of the column k of the factors R and Q, i.e., // all the nodes (with indexes lower than rank) reachable through the column elimination tree (etree) rooted at node k. // Note: if the diagonal entry does not exist, then its contribution must be explicitly added, // thus the trick with found_diag that permits to do one more iteration on the diagonal element if this one has not been found. for (typename QRMatrixType::InnerIterator itp(m_pmat, col); itp || !found_diag; ++itp) { StorageIndex curIdx = nonzeroCol; if(itp) curIdx = StorageIndex(itp.row()); if(curIdx == nonzeroCol) found_diag = true; // Get the nonzeros indexes of the current column of R StorageIndex st = m_firstRowElt(curIdx); // The traversal of the etree starts here if (st < 0 ) { m_lastError = "Empty row found during numerical factorization"; m_info = InvalidInput; return; } // Traverse the etree Index bi = nzcolR; for (; mark(st) != col; st = m_etree(st)) { Ridx(nzcolR) = st; // Add this row to the list, mark(st) = col; // and mark this row as visited nzcolR++; } // Reverse the list to get the topological ordering Index nt = nzcolR-bi; for(Index i = 0; i < nt/2; i++) std::swap(Ridx(bi+i), Ridx(nzcolR-i-1)); // Copy the current (curIdx,pcol) value of the input matrix if(itp) tval(curIdx) = itp.value(); else tval(curIdx) = Scalar(0); // Compute the pattern of Q(:,k) if(curIdx > nonzeroCol && mark(curIdx) != col ) { Qidx(nzcolQ) = curIdx; // Add this row to the pattern of Q, mark(curIdx) = col; // and mark it as visited nzcolQ++; } } // Browse all the indexes of R(:,col) in reverse order for (Index i = nzcolR-1; i >= 0; i--) { Index curIdx = Ridx(i); // Apply the curIdx-th householder vector to the current column (temporarily stored into tval) Scalar tdot(0); // First compute q' * tval tdot = m_Q.col(curIdx).dot(tval); tdot *= m_hcoeffs(curIdx); // Then update tval = tval - q * tau // FIXME: tval -= tdot * m_Q.col(curIdx) should amount to the same (need to check/add support for efficient "dense ?= sparse") for (typename QRMatrixType::InnerIterator itq(m_Q, curIdx); itq; ++itq) tval(itq.row()) -= itq.value() * tdot; // Detect fill-in for the current column of Q if(m_etree(Ridx(i)) == nonzeroCol) { for (typename QRMatrixType::InnerIterator itq(m_Q, curIdx); itq; ++itq) { StorageIndex iQ = StorageIndex(itq.row()); if (mark(iQ) != col) { Qidx(nzcolQ++) = iQ; // Add this row to the pattern of Q, mark(iQ) = col; // and mark it as visited } } } } // End update current column Scalar tau = RealScalar(0); RealScalar beta = 0; if(nonzeroCol < diagSize) { // Compute the Householder reflection that eliminate the current column // FIXME this step should call the Householder module. Scalar c0 = nzcolQ ? tval(Qidx(0)) : Scalar(0); // First, the squared norm of Q((col+1):m, col) RealScalar sqrNorm = 0.; for (Index itq = 1; itq < nzcolQ; ++itq) sqrNorm += numext::abs2(tval(Qidx(itq))); if(sqrNorm == RealScalar(0) && numext::imag(c0) == RealScalar(0)) { beta = numext::real(c0); tval(Qidx(0)) = 1; } else { using std::sqrt; beta = sqrt(numext::abs2(c0) + sqrNorm); if(numext::real(c0) >= RealScalar(0)) beta = -beta; tval(Qidx(0)) = 1; for (Index itq = 1; itq < nzcolQ; ++itq) tval(Qidx(itq)) /= (c0 - beta); tau = numext::conj((beta-c0) / beta); } } // Insert values in R for (Index i = nzcolR-1; i >= 0; i--) { Index curIdx = Ridx(i); if(curIdx < nonzeroCol) { m_R.insertBackByOuterInnerUnordered(col, curIdx) = tval(curIdx); tval(curIdx) = Scalar(0.); } } if(nonzeroCol < diagSize && abs(beta) >= pivotThreshold) { m_R.insertBackByOuterInner(col, nonzeroCol) = beta; // The householder coefficient m_hcoeffs(nonzeroCol) = tau; // Record the householder reflections for (Index itq = 0; itq < nzcolQ; ++itq) { Index iQ = Qidx(itq); m_Q.insertBackByOuterInnerUnordered(nonzeroCol,iQ) = tval(iQ); tval(iQ) = Scalar(0.); } nonzeroCol++; if(nonzeroCol struct SparseQR_QProduct : ReturnByValue > { typedef typename SparseQRType::QRMatrixType MatrixType; typedef typename SparseQRType::Scalar Scalar; // Get the references SparseQR_QProduct(const SparseQRType& qr, const Derived& other, bool transpose) : m_qr(qr),m_other(other),m_transpose(transpose) {} inline Index rows() const { return m_qr.matrixQ().rows(); } inline Index cols() const { return m_other.cols(); } // Assign to a vector template void evalTo(DesType& res) const { Index m = m_qr.rows(); Index n = m_qr.cols(); Index diagSize = (std::min)(m,n); res = m_other; if (m_transpose) { eigen_assert(m_qr.m_Q.rows() == m_other.rows() && "Non conforming object sizes"); //Compute res = Q' * other column by column for(Index j = 0; j < res.cols(); j++){ for (Index k = 0; k < diagSize; k++) { Scalar tau = Scalar(0); tau = m_qr.m_Q.col(k).dot(res.col(j)); if(tau==Scalar(0)) continue; tau = tau * m_qr.m_hcoeffs(k); res.col(j) -= tau * m_qr.m_Q.col(k); } } } else { eigen_assert(m_qr.matrixQ().cols() == m_other.rows() && "Non conforming object sizes"); res.conservativeResize(rows(), cols()); // Compute res = Q * other column by column for(Index j = 0; j < res.cols(); j++) { Index start_k = internal::is_identity::value ? numext::mini(j,diagSize-1) : diagSize-1; for (Index k = start_k; k >=0; k--) { Scalar tau = Scalar(0); tau = m_qr.m_Q.col(k).dot(res.col(j)); if(tau==Scalar(0)) continue; tau = tau * numext::conj(m_qr.m_hcoeffs(k)); res.col(j) -= tau * m_qr.m_Q.col(k); } } } } const SparseQRType& m_qr; const Derived& m_other; bool m_transpose; // TODO this actually means adjoint }; template struct SparseQRMatrixQReturnType : public EigenBase > { typedef typename SparseQRType::Scalar Scalar; typedef Matrix DenseMatrix; enum { RowsAtCompileTime = Dynamic, ColsAtCompileTime = Dynamic }; explicit SparseQRMatrixQReturnType(const SparseQRType& qr) : m_qr(qr) {} template SparseQR_QProduct operator*(const MatrixBase& other) { return SparseQR_QProduct(m_qr,other.derived(),false); } // To use for operations with the adjoint of Q SparseQRMatrixQTransposeReturnType adjoint() const { return SparseQRMatrixQTransposeReturnType(m_qr); } inline Index rows() const { return m_qr.rows(); } inline Index cols() const { return m_qr.rows(); } // To use for operations with the transpose of Q FIXME this is the same as adjoint at the moment SparseQRMatrixQTransposeReturnType transpose() const { return SparseQRMatrixQTransposeReturnType(m_qr); } const SparseQRType& m_qr; }; // TODO this actually represents the adjoint of Q template struct SparseQRMatrixQTransposeReturnType { explicit SparseQRMatrixQTransposeReturnType(const SparseQRType& qr) : m_qr(qr) {} template SparseQR_QProduct operator*(const MatrixBase& other) { return SparseQR_QProduct(m_qr,other.derived(), true); } const SparseQRType& m_qr; }; namespace internal { template struct evaluator_traits > { typedef typename SparseQRType::MatrixType MatrixType; typedef typename storage_kind_to_evaluator_kind::Kind Kind; typedef SparseShape Shape; }; template< typename DstXprType, typename SparseQRType> struct Assignment, internal::assign_op, Sparse2Sparse> { typedef SparseQRMatrixQReturnType SrcXprType; typedef typename DstXprType::Scalar Scalar; typedef typename DstXprType::StorageIndex StorageIndex; static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &/*func*/) { typename DstXprType::PlainObject idMat(src.rows(), src.cols()); idMat.setIdentity(); // Sort the sparse householder reflectors if needed const_cast(&src.m_qr)->_sort_matrix_Q(); dst = SparseQR_QProduct(src.m_qr, idMat, false); } }; template< typename DstXprType, typename SparseQRType> struct Assignment, internal::assign_op, Sparse2Dense> { typedef SparseQRMatrixQReturnType SrcXprType; typedef typename DstXprType::Scalar Scalar; typedef typename DstXprType::StorageIndex StorageIndex; static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &/*func*/) { dst = src.m_qr.matrixQ() * DstXprType::Identity(src.m_qr.rows(), src.m_qr.rows()); } }; } // end namespace internal } // end namespace Eigen #endif ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/StlSupport/StdDeque.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Gael Guennebaud // Copyright (C) 2009 Hauke Heibel // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_STDDEQUE_H #define EIGEN_STDDEQUE_H #include "details.h" /** * This section contains a convenience MACRO which allows an easy specialization of * std::deque such that for data types with alignment issues the correct allocator * is used automatically. */ #define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...) \ namespace std \ { \ template<> \ class deque<__VA_ARGS__, std::allocator<__VA_ARGS__> > \ : public deque<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > \ { \ typedef deque<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > deque_base; \ public: \ typedef __VA_ARGS__ value_type; \ typedef deque_base::allocator_type allocator_type; \ typedef deque_base::size_type size_type; \ typedef deque_base::iterator iterator; \ explicit deque(const allocator_type& a = allocator_type()) : deque_base(a) {} \ template \ deque(InputIterator first, InputIterator last, const allocator_type& a = allocator_type()) : deque_base(first, last, a) {} \ deque(const deque& c) : deque_base(c) {} \ explicit deque(size_type num, const value_type& val = value_type()) : deque_base(num, val) {} \ deque(iterator start_, iterator end_) : deque_base(start_, end_) {} \ deque& operator=(const deque& x) { \ deque_base::operator=(x); \ return *this; \ } \ }; \ } // check whether we really need the std::deque specialization #if !EIGEN_HAS_CXX11_CONTAINERS && !(defined(_GLIBCXX_DEQUE) && (!EIGEN_GNUC_AT_LEAST(4,1))) /* Note that before gcc-4.1 we already have: std::deque::resize(size_type,const T&). */ namespace std { #define EIGEN_STD_DEQUE_SPECIALIZATION_BODY \ public: \ typedef T value_type; \ typedef typename deque_base::allocator_type allocator_type; \ typedef typename deque_base::size_type size_type; \ typedef typename deque_base::iterator iterator; \ typedef typename deque_base::const_iterator const_iterator; \ explicit deque(const allocator_type& a = allocator_type()) : deque_base(a) {} \ template \ deque(InputIterator first, InputIterator last, const allocator_type& a = allocator_type()) \ : deque_base(first, last, a) {} \ deque(const deque& c) : deque_base(c) {} \ explicit deque(size_type num, const value_type& val = value_type()) : deque_base(num, val) {} \ deque(iterator start_, iterator end_) : deque_base(start_, end_) {} \ deque& operator=(const deque& x) { \ deque_base::operator=(x); \ return *this; \ } template class deque > : public deque > { typedef deque > deque_base; EIGEN_STD_DEQUE_SPECIALIZATION_BODY void resize(size_type new_size) { resize(new_size, T()); } #if defined(_DEQUE_) // workaround MSVC std::deque implementation void resize(size_type new_size, const value_type& x) { if (deque_base::size() < new_size) deque_base::_Insert_n(deque_base::end(), new_size - deque_base::size(), x); else if (new_size < deque_base::size()) deque_base::erase(deque_base::begin() + new_size, deque_base::end()); } void push_back(const value_type& x) { deque_base::push_back(x); } void push_front(const value_type& x) { deque_base::push_front(x); } using deque_base::insert; iterator insert(const_iterator position, const value_type& x) { return deque_base::insert(position,x); } void insert(const_iterator position, size_type new_size, const value_type& x) { deque_base::insert(position, new_size, x); } #else // default implementation which should always work. void resize(size_type new_size, const value_type& x) { if (new_size < deque_base::size()) deque_base::erase(deque_base::begin() + new_size, deque_base::end()); else if (new_size > deque_base::size()) deque_base::insert(deque_base::end(), new_size - deque_base::size(), x); } #endif }; } #endif // check whether specialization is actually required #endif // EIGEN_STDDEQUE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/StlSupport/StdList.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Hauke Heibel // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_STDLIST_H #define EIGEN_STDLIST_H #include "details.h" /** * This section contains a convenience MACRO which allows an easy specialization of * std::list such that for data types with alignment issues the correct allocator * is used automatically. */ #define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) \ namespace std \ { \ template<> \ class list<__VA_ARGS__, std::allocator<__VA_ARGS__> > \ : public list<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > \ { \ typedef list<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > list_base; \ public: \ typedef __VA_ARGS__ value_type; \ typedef list_base::allocator_type allocator_type; \ typedef list_base::size_type size_type; \ typedef list_base::iterator iterator; \ explicit list(const allocator_type& a = allocator_type()) : list_base(a) {} \ template \ list(InputIterator first, InputIterator last, const allocator_type& a = allocator_type()) : list_base(first, last, a) {} \ list(const list& c) : list_base(c) {} \ explicit list(size_type num, const value_type& val = value_type()) : list_base(num, val) {} \ list(iterator start_, iterator end_) : list_base(start_, end_) {} \ list& operator=(const list& x) { \ list_base::operator=(x); \ return *this; \ } \ }; \ } // check whether we really need the std::list specialization #if !EIGEN_HAS_CXX11_CONTAINERS && !(defined(_GLIBCXX_LIST) && (!EIGEN_GNUC_AT_LEAST(4,1))) /* Note that before gcc-4.1 we already have: std::list::resize(size_type,const T&). */ namespace std { #define EIGEN_STD_LIST_SPECIALIZATION_BODY \ public: \ typedef T value_type; \ typedef typename list_base::allocator_type allocator_type; \ typedef typename list_base::size_type size_type; \ typedef typename list_base::iterator iterator; \ typedef typename list_base::const_iterator const_iterator; \ explicit list(const allocator_type& a = allocator_type()) : list_base(a) {} \ template \ list(InputIterator first, InputIterator last, const allocator_type& a = allocator_type()) \ : list_base(first, last, a) {} \ list(const list& c) : list_base(c) {} \ explicit list(size_type num, const value_type& val = value_type()) : list_base(num, val) {} \ list(iterator start_, iterator end_) : list_base(start_, end_) {} \ list& operator=(const list& x) { \ list_base::operator=(x); \ return *this; \ } template class list > : public list > { typedef list > list_base; EIGEN_STD_LIST_SPECIALIZATION_BODY void resize(size_type new_size) { resize(new_size, T()); } void resize(size_type new_size, const value_type& x) { if (list_base::size() < new_size) list_base::insert(list_base::end(), new_size - list_base::size(), x); else while (new_size < list_base::size()) list_base::pop_back(); } #if defined(_LIST_) // workaround MSVC std::list implementation void push_back(const value_type& x) { list_base::push_back(x); } using list_base::insert; iterator insert(const_iterator position, const value_type& x) { return list_base::insert(position,x); } void insert(const_iterator position, size_type new_size, const value_type& x) { list_base::insert(position, new_size, x); } #endif }; } #endif // check whether specialization is actually required #endif // EIGEN_STDLIST_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/StlSupport/StdVector.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Gael Guennebaud // Copyright (C) 2009 Hauke Heibel // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_STDVECTOR_H #define EIGEN_STDVECTOR_H #include "details.h" /** * This section contains a convenience MACRO which allows an easy specialization of * std::vector such that for data types with alignment issues the correct allocator * is used automatically. */ #define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) \ namespace std \ { \ template<> \ class vector<__VA_ARGS__, std::allocator<__VA_ARGS__> > \ : public vector<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > \ { \ typedef vector<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > vector_base; \ public: \ typedef __VA_ARGS__ value_type; \ typedef vector_base::allocator_type allocator_type; \ typedef vector_base::size_type size_type; \ typedef vector_base::iterator iterator; \ explicit vector(const allocator_type& a = allocator_type()) : vector_base(a) {} \ template \ vector(InputIterator first, InputIterator last, const allocator_type& a = allocator_type()) : vector_base(first, last, a) {} \ vector(const vector& c) : vector_base(c) {} \ explicit vector(size_type num, const value_type& val = value_type()) : vector_base(num, val) {} \ vector(iterator start_, iterator end_) : vector_base(start_, end_) {} \ vector& operator=(const vector& x) { \ vector_base::operator=(x); \ return *this; \ } \ }; \ } // Don't specialize if containers are implemented according to C++11 #if !EIGEN_HAS_CXX11_CONTAINERS namespace std { #define EIGEN_STD_VECTOR_SPECIALIZATION_BODY \ public: \ typedef T value_type; \ typedef typename vector_base::allocator_type allocator_type; \ typedef typename vector_base::size_type size_type; \ typedef typename vector_base::iterator iterator; \ typedef typename vector_base::const_iterator const_iterator; \ explicit vector(const allocator_type& a = allocator_type()) : vector_base(a) {} \ template \ vector(InputIterator first, InputIterator last, const allocator_type& a = allocator_type()) \ : vector_base(first, last, a) {} \ vector(const vector& c) : vector_base(c) {} \ explicit vector(size_type num, const value_type& val = value_type()) : vector_base(num, val) {} \ vector(iterator start_, iterator end_) : vector_base(start_, end_) {} \ vector& operator=(const vector& x) { \ vector_base::operator=(x); \ return *this; \ } template class vector > : public vector > { typedef vector > vector_base; EIGEN_STD_VECTOR_SPECIALIZATION_BODY void resize(size_type new_size) { resize(new_size, T()); } #if defined(_VECTOR_) // workaround MSVC std::vector implementation void resize(size_type new_size, const value_type& x) { if (vector_base::size() < new_size) vector_base::_Insert_n(vector_base::end(), new_size - vector_base::size(), x); else if (new_size < vector_base::size()) vector_base::erase(vector_base::begin() + new_size, vector_base::end()); } void push_back(const value_type& x) { vector_base::push_back(x); } using vector_base::insert; iterator insert(const_iterator position, const value_type& x) { return vector_base::insert(position,x); } void insert(const_iterator position, size_type new_size, const value_type& x) { vector_base::insert(position, new_size, x); } #elif defined(_GLIBCXX_VECTOR) && (!(EIGEN_GNUC_AT_LEAST(4,1))) /* Note that before gcc-4.1 we already have: std::vector::resize(size_type,const T&). * However, this specialization is still needed to make the above EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION trick to work. */ void resize(size_type new_size, const value_type& x) { vector_base::resize(new_size,x); } #elif defined(_GLIBCXX_VECTOR) && EIGEN_GNUC_AT_LEAST(4,2) // workaround GCC std::vector implementation void resize(size_type new_size, const value_type& x) { if (new_size < vector_base::size()) vector_base::_M_erase_at_end(this->_M_impl._M_start + new_size); else vector_base::insert(vector_base::end(), new_size - vector_base::size(), x); } #else // either GCC 4.1 or non-GCC // default implementation which should always work. void resize(size_type new_size, const value_type& x) { if (new_size < vector_base::size()) vector_base::erase(vector_base::begin() + new_size, vector_base::end()); else if (new_size > vector_base::size()) vector_base::insert(vector_base::end(), new_size - vector_base::size(), x); } #endif }; } #endif // !EIGEN_HAS_CXX11_CONTAINERS #endif // EIGEN_STDVECTOR_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/StlSupport/details.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Gael Guennebaud // Copyright (C) 2009 Hauke Heibel // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_STL_DETAILS_H #define EIGEN_STL_DETAILS_H #ifndef EIGEN_ALIGNED_ALLOCATOR #define EIGEN_ALIGNED_ALLOCATOR Eigen::aligned_allocator #endif namespace Eigen { // This one is needed to prevent reimplementing the whole std::vector. template class aligned_allocator_indirection : public EIGEN_ALIGNED_ALLOCATOR { public: typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; typedef T* pointer; typedef const T* const_pointer; typedef T& reference; typedef const T& const_reference; typedef T value_type; template struct rebind { typedef aligned_allocator_indirection other; }; aligned_allocator_indirection() {} aligned_allocator_indirection(const aligned_allocator_indirection& ) : EIGEN_ALIGNED_ALLOCATOR() {} aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR& ) {} template aligned_allocator_indirection(const aligned_allocator_indirection& ) {} template aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR& ) {} ~aligned_allocator_indirection() {} }; #if EIGEN_COMP_MSVC // sometimes, MSVC detects, at compile time, that the argument x // in std::vector::resize(size_t s,T x) won't be aligned and generate an error // even if this function is never called. Whence this little wrapper. #define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) \ typename Eigen::internal::conditional< \ Eigen::internal::is_arithmetic::value, \ T, \ Eigen::internal::workaround_msvc_stl_support \ >::type namespace internal { template struct workaround_msvc_stl_support : public T { inline workaround_msvc_stl_support() : T() {} inline workaround_msvc_stl_support(const T& other) : T(other) {} inline operator T& () { return *static_cast(this); } inline operator const T& () const { return *static_cast(this); } template inline T& operator=(const OtherT& other) { T::operator=(other); return *this; } inline workaround_msvc_stl_support& operator=(const workaround_msvc_stl_support& other) { T::operator=(other); return *this; } }; } #else #define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) T #endif } #endif // EIGEN_STL_DETAILS_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2015 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SUPERLUSUPPORT_H #define EIGEN_SUPERLUSUPPORT_H namespace Eigen { #if defined(SUPERLU_MAJOR_VERSION) && (SUPERLU_MAJOR_VERSION >= 5) #define DECL_GSSVX(PREFIX,FLOATTYPE,KEYTYPE) \ extern "C" { \ extern void PREFIX##gssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, \ char *, FLOATTYPE *, FLOATTYPE *, SuperMatrix *, SuperMatrix *, \ void *, int, SuperMatrix *, SuperMatrix *, \ FLOATTYPE *, FLOATTYPE *, FLOATTYPE *, FLOATTYPE *, \ GlobalLU_t *, mem_usage_t *, SuperLUStat_t *, int *); \ } \ inline float SuperLU_gssvx(superlu_options_t *options, SuperMatrix *A, \ int *perm_c, int *perm_r, int *etree, char *equed, \ FLOATTYPE *R, FLOATTYPE *C, SuperMatrix *L, \ SuperMatrix *U, void *work, int lwork, \ SuperMatrix *B, SuperMatrix *X, \ FLOATTYPE *recip_pivot_growth, \ FLOATTYPE *rcond, FLOATTYPE *ferr, FLOATTYPE *berr, \ SuperLUStat_t *stats, int *info, KEYTYPE) { \ mem_usage_t mem_usage; \ GlobalLU_t gLU; \ PREFIX##gssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, \ U, work, lwork, B, X, recip_pivot_growth, rcond, \ ferr, berr, &gLU, &mem_usage, stats, info); \ return mem_usage.for_lu; /* bytes used by the factor storage */ \ } #else // version < 5.0 #define DECL_GSSVX(PREFIX,FLOATTYPE,KEYTYPE) \ extern "C" { \ extern void PREFIX##gssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, \ char *, FLOATTYPE *, FLOATTYPE *, SuperMatrix *, SuperMatrix *, \ void *, int, SuperMatrix *, SuperMatrix *, \ FLOATTYPE *, FLOATTYPE *, FLOATTYPE *, FLOATTYPE *, \ mem_usage_t *, SuperLUStat_t *, int *); \ } \ inline float SuperLU_gssvx(superlu_options_t *options, SuperMatrix *A, \ int *perm_c, int *perm_r, int *etree, char *equed, \ FLOATTYPE *R, FLOATTYPE *C, SuperMatrix *L, \ SuperMatrix *U, void *work, int lwork, \ SuperMatrix *B, SuperMatrix *X, \ FLOATTYPE *recip_pivot_growth, \ FLOATTYPE *rcond, FLOATTYPE *ferr, FLOATTYPE *berr, \ SuperLUStat_t *stats, int *info, KEYTYPE) { \ mem_usage_t mem_usage; \ PREFIX##gssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, \ U, work, lwork, B, X, recip_pivot_growth, rcond, \ ferr, berr, &mem_usage, stats, info); \ return mem_usage.for_lu; /* bytes used by the factor storage */ \ } #endif DECL_GSSVX(s,float,float) DECL_GSSVX(c,float,std::complex) DECL_GSSVX(d,double,double) DECL_GSSVX(z,double,std::complex) #ifdef MILU_ALPHA #define EIGEN_SUPERLU_HAS_ILU #endif #ifdef EIGEN_SUPERLU_HAS_ILU // similarly for the incomplete factorization using gsisx #define DECL_GSISX(PREFIX,FLOATTYPE,KEYTYPE) \ extern "C" { \ extern void PREFIX##gsisx(superlu_options_t *, SuperMatrix *, int *, int *, int *, \ char *, FLOATTYPE *, FLOATTYPE *, SuperMatrix *, SuperMatrix *, \ void *, int, SuperMatrix *, SuperMatrix *, FLOATTYPE *, FLOATTYPE *, \ mem_usage_t *, SuperLUStat_t *, int *); \ } \ inline float SuperLU_gsisx(superlu_options_t *options, SuperMatrix *A, \ int *perm_c, int *perm_r, int *etree, char *equed, \ FLOATTYPE *R, FLOATTYPE *C, SuperMatrix *L, \ SuperMatrix *U, void *work, int lwork, \ SuperMatrix *B, SuperMatrix *X, \ FLOATTYPE *recip_pivot_growth, \ FLOATTYPE *rcond, \ SuperLUStat_t *stats, int *info, KEYTYPE) { \ mem_usage_t mem_usage; \ PREFIX##gsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, \ U, work, lwork, B, X, recip_pivot_growth, rcond, \ &mem_usage, stats, info); \ return mem_usage.for_lu; /* bytes used by the factor storage */ \ } DECL_GSISX(s,float,float) DECL_GSISX(c,float,std::complex) DECL_GSISX(d,double,double) DECL_GSISX(z,double,std::complex) #endif template struct SluMatrixMapHelper; /** \internal * * A wrapper class for SuperLU matrices. It supports only compressed sparse matrices * and dense matrices. Supernodal and other fancy format are not supported by this wrapper. * * This wrapper class mainly aims to avoids the need of dynamic allocation of the storage structure. */ struct SluMatrix : SuperMatrix { SluMatrix() { Store = &storage; } SluMatrix(const SluMatrix& other) : SuperMatrix(other) { Store = &storage; storage = other.storage; } SluMatrix& operator=(const SluMatrix& other) { SuperMatrix::operator=(static_cast(other)); Store = &storage; storage = other.storage; return *this; } struct { union {int nnz;int lda;}; void *values; int *innerInd; int *outerInd; } storage; void setStorageType(Stype_t t) { Stype = t; if (t==SLU_NC || t==SLU_NR || t==SLU_DN) Store = &storage; else { eigen_assert(false && "storage type not supported"); Store = 0; } } template void setScalarType() { if (internal::is_same::value) Dtype = SLU_S; else if (internal::is_same::value) Dtype = SLU_D; else if (internal::is_same >::value) Dtype = SLU_C; else if (internal::is_same >::value) Dtype = SLU_Z; else { eigen_assert(false && "Scalar type not supported by SuperLU"); } } template static SluMatrix Map(MatrixBase& _mat) { MatrixType& mat(_mat.derived()); eigen_assert( ((MatrixType::Flags&RowMajorBit)!=RowMajorBit) && "row-major dense matrices are not supported by SuperLU"); SluMatrix res; res.setStorageType(SLU_DN); res.setScalarType(); res.Mtype = SLU_GE; res.nrow = internal::convert_index(mat.rows()); res.ncol = internal::convert_index(mat.cols()); res.storage.lda = internal::convert_index(MatrixType::IsVectorAtCompileTime ? mat.size() : mat.outerStride()); res.storage.values = (void*)(mat.data()); return res; } template static SluMatrix Map(SparseMatrixBase& a_mat) { MatrixType &mat(a_mat.derived()); SluMatrix res; if ((MatrixType::Flags&RowMajorBit)==RowMajorBit) { res.setStorageType(SLU_NR); res.nrow = internal::convert_index(mat.cols()); res.ncol = internal::convert_index(mat.rows()); } else { res.setStorageType(SLU_NC); res.nrow = internal::convert_index(mat.rows()); res.ncol = internal::convert_index(mat.cols()); } res.Mtype = SLU_GE; res.storage.nnz = internal::convert_index(mat.nonZeros()); res.storage.values = mat.valuePtr(); res.storage.innerInd = mat.innerIndexPtr(); res.storage.outerInd = mat.outerIndexPtr(); res.setScalarType(); // FIXME the following is not very accurate if (int(MatrixType::Flags) & int(Upper)) res.Mtype = SLU_TRU; if (int(MatrixType::Flags) & int(Lower)) res.Mtype = SLU_TRL; eigen_assert(((int(MatrixType::Flags) & int(SelfAdjoint))==0) && "SelfAdjoint matrix shape not supported by SuperLU"); return res; } }; template struct SluMatrixMapHelper > { typedef Matrix MatrixType; static void run(MatrixType& mat, SluMatrix& res) { eigen_assert( ((Options&RowMajor)!=RowMajor) && "row-major dense matrices is not supported by SuperLU"); res.setStorageType(SLU_DN); res.setScalarType(); res.Mtype = SLU_GE; res.nrow = mat.rows(); res.ncol = mat.cols(); res.storage.lda = mat.outerStride(); res.storage.values = mat.data(); } }; template struct SluMatrixMapHelper > { typedef Derived MatrixType; static void run(MatrixType& mat, SluMatrix& res) { if ((MatrixType::Flags&RowMajorBit)==RowMajorBit) { res.setStorageType(SLU_NR); res.nrow = mat.cols(); res.ncol = mat.rows(); } else { res.setStorageType(SLU_NC); res.nrow = mat.rows(); res.ncol = mat.cols(); } res.Mtype = SLU_GE; res.storage.nnz = mat.nonZeros(); res.storage.values = mat.valuePtr(); res.storage.innerInd = mat.innerIndexPtr(); res.storage.outerInd = mat.outerIndexPtr(); res.setScalarType(); // FIXME the following is not very accurate if (MatrixType::Flags & Upper) res.Mtype = SLU_TRU; if (MatrixType::Flags & Lower) res.Mtype = SLU_TRL; eigen_assert(((MatrixType::Flags & SelfAdjoint)==0) && "SelfAdjoint matrix shape not supported by SuperLU"); } }; namespace internal { template SluMatrix asSluMatrix(MatrixType& mat) { return SluMatrix::Map(mat); } /** View a Super LU matrix as an Eigen expression */ template MappedSparseMatrix map_superlu(SluMatrix& sluMat) { eigen_assert(((Flags&RowMajor)==RowMajor && sluMat.Stype == SLU_NR) || ((Flags&ColMajor)==ColMajor && sluMat.Stype == SLU_NC)); Index outerSize = (Flags&RowMajor)==RowMajor ? sluMat.ncol : sluMat.nrow; return MappedSparseMatrix( sluMat.nrow, sluMat.ncol, sluMat.storage.outerInd[outerSize], sluMat.storage.outerInd, sluMat.storage.innerInd, reinterpret_cast(sluMat.storage.values) ); } } // end namespace internal /** \ingroup SuperLUSupport_Module * \class SuperLUBase * \brief The base class for the direct and incomplete LU factorization of SuperLU */ template class SuperLUBase : public SparseSolverBase { protected: typedef SparseSolverBase Base; using Base::derived; using Base::m_isInitialized; public: typedef MatrixType_ MatrixType; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef typename MatrixType::StorageIndex StorageIndex; typedef Matrix Vector; typedef Matrix IntRowVectorType; typedef Matrix IntColVectorType; typedef Map > PermutationMap; typedef SparseMatrix LUMatrixType; enum { ColsAtCompileTime = MatrixType::ColsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; public: SuperLUBase() {} ~SuperLUBase() { clearFactors(); } inline Index rows() const { return m_matrix.rows(); } inline Index cols() const { return m_matrix.cols(); } /** \returns a reference to the Super LU option object to configure the Super LU algorithms. */ inline superlu_options_t& options() { return m_sluOptions; } /** \brief Reports whether previous computation was successful. * * \returns \c Success if computation was successful, * \c NumericalIssue if the matrix.appears to be negative. */ ComputationInfo info() const { eigen_assert(m_isInitialized && "Decomposition is not initialized."); return m_info; } /** Computes the sparse Cholesky decomposition of \a matrix */ void compute(const MatrixType& matrix) { derived().analyzePattern(matrix); derived().factorize(matrix); } /** Performs a symbolic decomposition on the sparcity of \a matrix. * * This function is particularly useful when solving for several problems having the same structure. * * \sa factorize() */ void analyzePattern(const MatrixType& /*matrix*/) { m_isInitialized = true; m_info = Success; m_analysisIsOk = true; m_factorizationIsOk = false; } template void dumpMemory(Stream& /*s*/) {} protected: void initFactorization(const MatrixType& a) { set_default_options(&this->m_sluOptions); const Index size = a.rows(); m_matrix = a; m_sluA = internal::asSluMatrix(m_matrix); clearFactors(); m_p.resize(size); m_q.resize(size); m_sluRscale.resize(size); m_sluCscale.resize(size); m_sluEtree.resize(size); // set empty B and X m_sluB.setStorageType(SLU_DN); m_sluB.setScalarType(); m_sluB.Mtype = SLU_GE; m_sluB.storage.values = 0; m_sluB.nrow = 0; m_sluB.ncol = 0; m_sluB.storage.lda = internal::convert_index(size); m_sluX = m_sluB; m_extractedDataAreDirty = true; } void init() { m_info = InvalidInput; m_isInitialized = false; m_sluL.Store = 0; m_sluU.Store = 0; } void extractData() const; void clearFactors() { if(m_sluL.Store) Destroy_SuperNode_Matrix(&m_sluL); if(m_sluU.Store) Destroy_CompCol_Matrix(&m_sluU); m_sluL.Store = 0; m_sluU.Store = 0; memset(&m_sluL,0,sizeof m_sluL); memset(&m_sluU,0,sizeof m_sluU); } // cached data to reduce reallocation, etc. mutable LUMatrixType m_l; mutable LUMatrixType m_u; mutable IntColVectorType m_p; mutable IntRowVectorType m_q; mutable LUMatrixType m_matrix; // copy of the factorized matrix mutable SluMatrix m_sluA; mutable SuperMatrix m_sluL, m_sluU; mutable SluMatrix m_sluB, m_sluX; mutable SuperLUStat_t m_sluStat; mutable superlu_options_t m_sluOptions; mutable std::vector m_sluEtree; mutable Matrix m_sluRscale, m_sluCscale; mutable Matrix m_sluFerr, m_sluBerr; mutable char m_sluEqued; mutable ComputationInfo m_info; int m_factorizationIsOk; int m_analysisIsOk; mutable bool m_extractedDataAreDirty; private: SuperLUBase(SuperLUBase& ) { } }; /** \ingroup SuperLUSupport_Module * \class SuperLU * \brief A sparse direct LU factorization and solver based on the SuperLU library * * This class allows to solve for A.X = B sparse linear problems via a direct LU factorization * using the SuperLU library. The sparse matrix A must be squared and invertible. The vectors or matrices * X and B can be either dense or sparse. * * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> * * \warning This class is only for the 4.x versions of SuperLU. The 3.x and 5.x versions are not supported. * * \implsparsesolverconcept * * \sa \ref TutorialSparseSolverConcept, class SparseLU */ template class SuperLU : public SuperLUBase > { public: typedef SuperLUBase Base; typedef MatrixType_ MatrixType; typedef typename Base::Scalar Scalar; typedef typename Base::RealScalar RealScalar; typedef typename Base::StorageIndex StorageIndex; typedef typename Base::IntRowVectorType IntRowVectorType; typedef typename Base::IntColVectorType IntColVectorType; typedef typename Base::PermutationMap PermutationMap; typedef typename Base::LUMatrixType LUMatrixType; typedef TriangularView LMatrixType; typedef TriangularView UMatrixType; public: using Base::_solve_impl; SuperLU() : Base() { init(); } explicit SuperLU(const MatrixType& matrix) : Base() { init(); Base::compute(matrix); } ~SuperLU() { } /** Performs a symbolic decomposition on the sparcity of \a matrix. * * This function is particularly useful when solving for several problems having the same structure. * * \sa factorize() */ void analyzePattern(const MatrixType& matrix) { m_info = InvalidInput; m_isInitialized = false; Base::analyzePattern(matrix); } /** Performs a numeric decomposition of \a matrix * * The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed. * * \sa analyzePattern() */ void factorize(const MatrixType& matrix); /** \internal */ template void _solve_impl(const MatrixBase &b, MatrixBase &dest) const; inline const LMatrixType& matrixL() const { if (m_extractedDataAreDirty) this->extractData(); return m_l; } inline const UMatrixType& matrixU() const { if (m_extractedDataAreDirty) this->extractData(); return m_u; } inline const IntColVectorType& permutationP() const { if (m_extractedDataAreDirty) this->extractData(); return m_p; } inline const IntRowVectorType& permutationQ() const { if (m_extractedDataAreDirty) this->extractData(); return m_q; } Scalar determinant() const; protected: using Base::m_matrix; using Base::m_sluOptions; using Base::m_sluA; using Base::m_sluB; using Base::m_sluX; using Base::m_p; using Base::m_q; using Base::m_sluEtree; using Base::m_sluEqued; using Base::m_sluRscale; using Base::m_sluCscale; using Base::m_sluL; using Base::m_sluU; using Base::m_sluStat; using Base::m_sluFerr; using Base::m_sluBerr; using Base::m_l; using Base::m_u; using Base::m_analysisIsOk; using Base::m_factorizationIsOk; using Base::m_extractedDataAreDirty; using Base::m_isInitialized; using Base::m_info; void init() { Base::init(); set_default_options(&this->m_sluOptions); m_sluOptions.PrintStat = NO; m_sluOptions.ConditionNumber = NO; m_sluOptions.Trans = NOTRANS; m_sluOptions.ColPerm = COLAMD; } private: SuperLU(SuperLU& ) { } }; template void SuperLU::factorize(const MatrixType& a) { eigen_assert(m_analysisIsOk && "You must first call analyzePattern()"); if(!m_analysisIsOk) { m_info = InvalidInput; return; } this->initFactorization(a); m_sluOptions.ColPerm = COLAMD; int info = 0; RealScalar recip_pivot_growth, rcond; RealScalar ferr, berr; StatInit(&m_sluStat); SuperLU_gssvx(&m_sluOptions, &m_sluA, m_q.data(), m_p.data(), &m_sluEtree[0], &m_sluEqued, &m_sluRscale[0], &m_sluCscale[0], &m_sluL, &m_sluU, NULL, 0, &m_sluB, &m_sluX, &recip_pivot_growth, &rcond, &ferr, &berr, &m_sluStat, &info, Scalar()); StatFree(&m_sluStat); m_extractedDataAreDirty = true; // FIXME how to better check for errors ??? m_info = info == 0 ? Success : NumericalIssue; m_factorizationIsOk = true; } template template void SuperLU::_solve_impl(const MatrixBase &b, MatrixBase& x) const { eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or analyzePattern()/factorize()"); const Index rhsCols = b.cols(); eigen_assert(m_matrix.rows()==b.rows()); m_sluOptions.Trans = NOTRANS; m_sluOptions.Fact = FACTORED; m_sluOptions.IterRefine = NOREFINE; m_sluFerr.resize(rhsCols); m_sluBerr.resize(rhsCols); Ref > b_ref(b); Ref > x_ref(x); m_sluB = SluMatrix::Map(b_ref.const_cast_derived()); m_sluX = SluMatrix::Map(x_ref.const_cast_derived()); typename Rhs::PlainObject b_cpy; if(m_sluEqued!='N') { b_cpy = b; m_sluB = SluMatrix::Map(b_cpy.const_cast_derived()); } StatInit(&m_sluStat); int info = 0; RealScalar recip_pivot_growth, rcond; SuperLU_gssvx(&m_sluOptions, &m_sluA, m_q.data(), m_p.data(), &m_sluEtree[0], &m_sluEqued, &m_sluRscale[0], &m_sluCscale[0], &m_sluL, &m_sluU, NULL, 0, &m_sluB, &m_sluX, &recip_pivot_growth, &rcond, &m_sluFerr[0], &m_sluBerr[0], &m_sluStat, &info, Scalar()); StatFree(&m_sluStat); if(x.derived().data() != x_ref.data()) x = x_ref; m_info = info==0 ? Success : NumericalIssue; } // the code of this extractData() function has been adapted from the SuperLU's Matlab support code, // // Copyright (c) 1994 by Xerox Corporation. All rights reserved. // // THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY // EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. // template void SuperLUBase::extractData() const { eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for extracting factors, you must first call either compute() or analyzePattern()/factorize()"); if (m_extractedDataAreDirty) { int upper; int fsupc, istart, nsupr; int lastl = 0, lastu = 0; SCformat *Lstore = static_cast(m_sluL.Store); NCformat *Ustore = static_cast(m_sluU.Store); Scalar *SNptr; const Index size = m_matrix.rows(); m_l.resize(size,size); m_l.resizeNonZeros(Lstore->nnz); m_u.resize(size,size); m_u.resizeNonZeros(Ustore->nnz); int* Lcol = m_l.outerIndexPtr(); int* Lrow = m_l.innerIndexPtr(); Scalar* Lval = m_l.valuePtr(); int* Ucol = m_u.outerIndexPtr(); int* Urow = m_u.innerIndexPtr(); Scalar* Uval = m_u.valuePtr(); Ucol[0] = 0; Ucol[0] = 0; /* for each supernode */ for (int k = 0; k <= Lstore->nsuper; ++k) { fsupc = L_FST_SUPC(k); istart = L_SUB_START(fsupc); nsupr = L_SUB_START(fsupc+1) - istart; upper = 1; /* for each column in the supernode */ for (int j = fsupc; j < L_FST_SUPC(k+1); ++j) { SNptr = &((Scalar*)Lstore->nzval)[L_NZ_START(j)]; /* Extract U */ for (int i = U_NZ_START(j); i < U_NZ_START(j+1); ++i) { Uval[lastu] = ((Scalar*)Ustore->nzval)[i]; /* Matlab doesn't like explicit zero. */ if (Uval[lastu] != 0.0) Urow[lastu++] = U_SUB(i); } for (int i = 0; i < upper; ++i) { /* upper triangle in the supernode */ Uval[lastu] = SNptr[i]; /* Matlab doesn't like explicit zero. */ if (Uval[lastu] != 0.0) Urow[lastu++] = L_SUB(istart+i); } Ucol[j+1] = lastu; /* Extract L */ Lval[lastl] = 1.0; /* unit diagonal */ Lrow[lastl++] = L_SUB(istart + upper - 1); for (int i = upper; i < nsupr; ++i) { Lval[lastl] = SNptr[i]; /* Matlab doesn't like explicit zero. */ if (Lval[lastl] != 0.0) Lrow[lastl++] = L_SUB(istart+i); } Lcol[j+1] = lastl; ++upper; } /* for j ... */ } /* for k ... */ // squeeze the matrices : m_l.resizeNonZeros(lastl); m_u.resizeNonZeros(lastu); m_extractedDataAreDirty = false; } } template typename SuperLU::Scalar SuperLU::determinant() const { eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for computing the determinant, you must first call either compute() or analyzePattern()/factorize()"); if (m_extractedDataAreDirty) this->extractData(); Scalar det = Scalar(1); for (int j=0; j 0) { int lastId = m_u.outerIndexPtr()[j+1]-1; eigen_assert(m_u.innerIndexPtr()[lastId]<=j); if (m_u.innerIndexPtr()[lastId]==j) det *= m_u.valuePtr()[lastId]; } } if(PermutationMap(m_p.data(),m_p.size()).determinant()*PermutationMap(m_q.data(),m_q.size()).determinant()<0) det = -det; if(m_sluEqued!='N') return det/m_sluRscale.prod()/m_sluCscale.prod(); else return det; } #ifdef EIGEN_PARSED_BY_DOXYGEN #define EIGEN_SUPERLU_HAS_ILU #endif #ifdef EIGEN_SUPERLU_HAS_ILU /** \ingroup SuperLUSupport_Module * \class SuperILU * \brief A sparse direct \b incomplete LU factorization and solver based on the SuperLU library * * This class allows to solve for an approximate solution of A.X = B sparse linear problems via an incomplete LU factorization * using the SuperLU library. This class is aimed to be used as a preconditioner of the iterative linear solvers. * * \warning This class is only for the 4.x versions of SuperLU. The 3.x and 5.x versions are not supported. * * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> * * \implsparsesolverconcept * * \sa \ref TutorialSparseSolverConcept, class IncompleteLUT, class ConjugateGradient, class BiCGSTAB */ template class SuperILU : public SuperLUBase > { public: typedef SuperLUBase Base; typedef MatrixType_ MatrixType; typedef typename Base::Scalar Scalar; typedef typename Base::RealScalar RealScalar; public: using Base::_solve_impl; SuperILU() : Base() { init(); } SuperILU(const MatrixType& matrix) : Base() { init(); Base::compute(matrix); } ~SuperILU() { } /** Performs a symbolic decomposition on the sparcity of \a matrix. * * This function is particularly useful when solving for several problems having the same structure. * * \sa factorize() */ void analyzePattern(const MatrixType& matrix) { Base::analyzePattern(matrix); } /** Performs a numeric decomposition of \a matrix * * The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed. * * \sa analyzePattern() */ void factorize(const MatrixType& matrix); #ifndef EIGEN_PARSED_BY_DOXYGEN /** \internal */ template void _solve_impl(const MatrixBase &b, MatrixBase &dest) const; #endif // EIGEN_PARSED_BY_DOXYGEN protected: using Base::m_matrix; using Base::m_sluOptions; using Base::m_sluA; using Base::m_sluB; using Base::m_sluX; using Base::m_p; using Base::m_q; using Base::m_sluEtree; using Base::m_sluEqued; using Base::m_sluRscale; using Base::m_sluCscale; using Base::m_sluL; using Base::m_sluU; using Base::m_sluStat; using Base::m_sluFerr; using Base::m_sluBerr; using Base::m_l; using Base::m_u; using Base::m_analysisIsOk; using Base::m_factorizationIsOk; using Base::m_extractedDataAreDirty; using Base::m_isInitialized; using Base::m_info; void init() { Base::init(); ilu_set_default_options(&m_sluOptions); m_sluOptions.PrintStat = NO; m_sluOptions.ConditionNumber = NO; m_sluOptions.Trans = NOTRANS; m_sluOptions.ColPerm = MMD_AT_PLUS_A; // no attempt to preserve column sum m_sluOptions.ILU_MILU = SILU; // only basic ILU(k) support -- no direct control over memory consumption // better to use ILU_DropRule = DROP_BASIC | DROP_AREA // and set ILU_FillFactor to max memory growth m_sluOptions.ILU_DropRule = DROP_BASIC; m_sluOptions.ILU_DropTol = NumTraits::dummy_precision()*10; } private: SuperILU(SuperILU& ) { } }; template void SuperILU::factorize(const MatrixType& a) { eigen_assert(m_analysisIsOk && "You must first call analyzePattern()"); if(!m_analysisIsOk) { m_info = InvalidInput; return; } this->initFactorization(a); int info = 0; RealScalar recip_pivot_growth, rcond; StatInit(&m_sluStat); SuperLU_gsisx(&m_sluOptions, &m_sluA, m_q.data(), m_p.data(), &m_sluEtree[0], &m_sluEqued, &m_sluRscale[0], &m_sluCscale[0], &m_sluL, &m_sluU, NULL, 0, &m_sluB, &m_sluX, &recip_pivot_growth, &rcond, &m_sluStat, &info, Scalar()); StatFree(&m_sluStat); // FIXME how to better check for errors ??? m_info = info == 0 ? Success : NumericalIssue; m_factorizationIsOk = true; } #ifndef EIGEN_PARSED_BY_DOXYGEN template template void SuperILU::_solve_impl(const MatrixBase &b, MatrixBase& x) const { eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or analyzePattern()/factorize()"); const int rhsCols = b.cols(); eigen_assert(m_matrix.rows()==b.rows()); m_sluOptions.Trans = NOTRANS; m_sluOptions.Fact = FACTORED; m_sluOptions.IterRefine = NOREFINE; m_sluFerr.resize(rhsCols); m_sluBerr.resize(rhsCols); Ref > b_ref(b); Ref > x_ref(x); m_sluB = SluMatrix::Map(b_ref.const_cast_derived()); m_sluX = SluMatrix::Map(x_ref.const_cast_derived()); typename Rhs::PlainObject b_cpy; if(m_sluEqued!='N') { b_cpy = b; m_sluB = SluMatrix::Map(b_cpy.const_cast_derived()); } int info = 0; RealScalar recip_pivot_growth, rcond; StatInit(&m_sluStat); SuperLU_gsisx(&m_sluOptions, &m_sluA, m_q.data(), m_p.data(), &m_sluEtree[0], &m_sluEqued, &m_sluRscale[0], &m_sluCscale[0], &m_sluL, &m_sluU, NULL, 0, &m_sluB, &m_sluX, &recip_pivot_growth, &rcond, &m_sluStat, &info, Scalar()); StatFree(&m_sluStat); if(x.derived().data() != x_ref.data()) x = x_ref; m_info = info==0 ? Success : NumericalIssue; } #endif #endif } // end namespace Eigen #endif // EIGEN_SUPERLUSUPPORT_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2011 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_UMFPACKSUPPORT_H #define EIGEN_UMFPACKSUPPORT_H // for compatibility with super old version of umfpack, // not sure this is really needed, but this is harmless. #ifndef SuiteSparse_long #ifdef UF_long #define SuiteSparse_long UF_long #else #error neither SuiteSparse_long nor UF_long are defined #endif #endif namespace Eigen { /* TODO extract L, extract U, compute det, etc... */ // generic double/complex wrapper functions: // Defaults inline void umfpack_defaults(double control[UMFPACK_CONTROL], double, int) { umfpack_di_defaults(control); } inline void umfpack_defaults(double control[UMFPACK_CONTROL], std::complex, int) { umfpack_zi_defaults(control); } inline void umfpack_defaults(double control[UMFPACK_CONTROL], double, SuiteSparse_long) { umfpack_dl_defaults(control); } inline void umfpack_defaults(double control[UMFPACK_CONTROL], std::complex, SuiteSparse_long) { umfpack_zl_defaults(control); } // Report info inline void umfpack_report_info(double control[UMFPACK_CONTROL], double info[UMFPACK_INFO], double, int) { umfpack_di_report_info(control, info);} inline void umfpack_report_info(double control[UMFPACK_CONTROL], double info[UMFPACK_INFO], std::complex, int) { umfpack_zi_report_info(control, info);} inline void umfpack_report_info(double control[UMFPACK_CONTROL], double info[UMFPACK_INFO], double, SuiteSparse_long) { umfpack_dl_report_info(control, info);} inline void umfpack_report_info(double control[UMFPACK_CONTROL], double info[UMFPACK_INFO], std::complex, SuiteSparse_long) { umfpack_zl_report_info(control, info);} // Report status inline void umfpack_report_status(double control[UMFPACK_CONTROL], int status, double, int) { umfpack_di_report_status(control, status);} inline void umfpack_report_status(double control[UMFPACK_CONTROL], int status, std::complex, int) { umfpack_zi_report_status(control, status);} inline void umfpack_report_status(double control[UMFPACK_CONTROL], int status, double, SuiteSparse_long) { umfpack_dl_report_status(control, status);} inline void umfpack_report_status(double control[UMFPACK_CONTROL], int status, std::complex, SuiteSparse_long) { umfpack_zl_report_status(control, status);} // report control inline void umfpack_report_control(double control[UMFPACK_CONTROL], double, int) { umfpack_di_report_control(control);} inline void umfpack_report_control(double control[UMFPACK_CONTROL], std::complex, int) { umfpack_zi_report_control(control);} inline void umfpack_report_control(double control[UMFPACK_CONTROL], double, SuiteSparse_long) { umfpack_dl_report_control(control);} inline void umfpack_report_control(double control[UMFPACK_CONTROL], std::complex, SuiteSparse_long) { umfpack_zl_report_control(control);} // Free numeric inline void umfpack_free_numeric(void **Numeric, double, int) { umfpack_di_free_numeric(Numeric); *Numeric = 0; } inline void umfpack_free_numeric(void **Numeric, std::complex, int) { umfpack_zi_free_numeric(Numeric); *Numeric = 0; } inline void umfpack_free_numeric(void **Numeric, double, SuiteSparse_long) { umfpack_dl_free_numeric(Numeric); *Numeric = 0; } inline void umfpack_free_numeric(void **Numeric, std::complex, SuiteSparse_long) { umfpack_zl_free_numeric(Numeric); *Numeric = 0; } // Free symbolic inline void umfpack_free_symbolic(void **Symbolic, double, int) { umfpack_di_free_symbolic(Symbolic); *Symbolic = 0; } inline void umfpack_free_symbolic(void **Symbolic, std::complex, int) { umfpack_zi_free_symbolic(Symbolic); *Symbolic = 0; } inline void umfpack_free_symbolic(void **Symbolic, double, SuiteSparse_long) { umfpack_dl_free_symbolic(Symbolic); *Symbolic = 0; } inline void umfpack_free_symbolic(void **Symbolic, std::complex, SuiteSparse_long) { umfpack_zl_free_symbolic(Symbolic); *Symbolic = 0; } // Symbolic inline int umfpack_symbolic(int n_row,int n_col, const int Ap[], const int Ai[], const double Ax[], void **Symbolic, const double Control [UMFPACK_CONTROL], double Info [UMFPACK_INFO]) { return umfpack_di_symbolic(n_row,n_col,Ap,Ai,Ax,Symbolic,Control,Info); } inline int umfpack_symbolic(int n_row,int n_col, const int Ap[], const int Ai[], const std::complex Ax[], void **Symbolic, const double Control [UMFPACK_CONTROL], double Info [UMFPACK_INFO]) { return umfpack_zi_symbolic(n_row,n_col,Ap,Ai,&numext::real_ref(Ax[0]),0,Symbolic,Control,Info); } inline SuiteSparse_long umfpack_symbolic( SuiteSparse_long n_row,SuiteSparse_long n_col, const SuiteSparse_long Ap[], const SuiteSparse_long Ai[], const double Ax[], void **Symbolic, const double Control [UMFPACK_CONTROL], double Info [UMFPACK_INFO]) { return umfpack_dl_symbolic(n_row,n_col,Ap,Ai,Ax,Symbolic,Control,Info); } inline SuiteSparse_long umfpack_symbolic( SuiteSparse_long n_row,SuiteSparse_long n_col, const SuiteSparse_long Ap[], const SuiteSparse_long Ai[], const std::complex Ax[], void **Symbolic, const double Control [UMFPACK_CONTROL], double Info [UMFPACK_INFO]) { return umfpack_zl_symbolic(n_row,n_col,Ap,Ai,&numext::real_ref(Ax[0]),0,Symbolic,Control,Info); } // Numeric inline int umfpack_numeric( const int Ap[], const int Ai[], const double Ax[], void *Symbolic, void **Numeric, const double Control[UMFPACK_CONTROL],double Info [UMFPACK_INFO]) { return umfpack_di_numeric(Ap,Ai,Ax,Symbolic,Numeric,Control,Info); } inline int umfpack_numeric( const int Ap[], const int Ai[], const std::complex Ax[], void *Symbolic, void **Numeric, const double Control[UMFPACK_CONTROL],double Info [UMFPACK_INFO]) { return umfpack_zi_numeric(Ap,Ai,&numext::real_ref(Ax[0]),0,Symbolic,Numeric,Control,Info); } inline SuiteSparse_long umfpack_numeric(const SuiteSparse_long Ap[], const SuiteSparse_long Ai[], const double Ax[], void *Symbolic, void **Numeric, const double Control[UMFPACK_CONTROL],double Info [UMFPACK_INFO]) { return umfpack_dl_numeric(Ap,Ai,Ax,Symbolic,Numeric,Control,Info); } inline SuiteSparse_long umfpack_numeric(const SuiteSparse_long Ap[], const SuiteSparse_long Ai[], const std::complex Ax[], void *Symbolic, void **Numeric, const double Control[UMFPACK_CONTROL],double Info [UMFPACK_INFO]) { return umfpack_zl_numeric(Ap,Ai,&numext::real_ref(Ax[0]),0,Symbolic,Numeric,Control,Info); } // solve inline int umfpack_solve( int sys, const int Ap[], const int Ai[], const double Ax[], double X[], const double B[], void *Numeric, const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]) { return umfpack_di_solve(sys,Ap,Ai,Ax,X,B,Numeric,Control,Info); } inline int umfpack_solve( int sys, const int Ap[], const int Ai[], const std::complex Ax[], std::complex X[], const std::complex B[], void *Numeric, const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]) { return umfpack_zi_solve(sys,Ap,Ai,&numext::real_ref(Ax[0]),0,&numext::real_ref(X[0]),0,&numext::real_ref(B[0]),0,Numeric,Control,Info); } inline SuiteSparse_long umfpack_solve(int sys, const SuiteSparse_long Ap[], const SuiteSparse_long Ai[], const double Ax[], double X[], const double B[], void *Numeric, const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]) { return umfpack_dl_solve(sys,Ap,Ai,Ax,X,B,Numeric,Control,Info); } inline SuiteSparse_long umfpack_solve(int sys, const SuiteSparse_long Ap[], const SuiteSparse_long Ai[], const std::complex Ax[], std::complex X[], const std::complex B[], void *Numeric, const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]) { return umfpack_zl_solve(sys,Ap,Ai,&numext::real_ref(Ax[0]),0,&numext::real_ref(X[0]),0,&numext::real_ref(B[0]),0,Numeric,Control,Info); } // Get Lunz inline int umfpack_get_lunz(int *lnz, int *unz, int *n_row, int *n_col, int *nz_udiag, void *Numeric, double) { return umfpack_di_get_lunz(lnz,unz,n_row,n_col,nz_udiag,Numeric); } inline int umfpack_get_lunz(int *lnz, int *unz, int *n_row, int *n_col, int *nz_udiag, void *Numeric, std::complex) { return umfpack_zi_get_lunz(lnz,unz,n_row,n_col,nz_udiag,Numeric); } inline SuiteSparse_long umfpack_get_lunz( SuiteSparse_long *lnz, SuiteSparse_long *unz, SuiteSparse_long *n_row, SuiteSparse_long *n_col, SuiteSparse_long *nz_udiag, void *Numeric, double) { return umfpack_dl_get_lunz(lnz,unz,n_row,n_col,nz_udiag,Numeric); } inline SuiteSparse_long umfpack_get_lunz( SuiteSparse_long *lnz, SuiteSparse_long *unz, SuiteSparse_long *n_row, SuiteSparse_long *n_col, SuiteSparse_long *nz_udiag, void *Numeric, std::complex) { return umfpack_zl_get_lunz(lnz,unz,n_row,n_col,nz_udiag,Numeric); } // Get Numeric inline int umfpack_get_numeric(int Lp[], int Lj[], double Lx[], int Up[], int Ui[], double Ux[], int P[], int Q[], double Dx[], int *do_recip, double Rs[], void *Numeric) { return umfpack_di_get_numeric(Lp,Lj,Lx,Up,Ui,Ux,P,Q,Dx,do_recip,Rs,Numeric); } inline int umfpack_get_numeric(int Lp[], int Lj[], std::complex Lx[], int Up[], int Ui[], std::complex Ux[], int P[], int Q[], std::complex Dx[], int *do_recip, double Rs[], void *Numeric) { double& lx0_real = numext::real_ref(Lx[0]); double& ux0_real = numext::real_ref(Ux[0]); double& dx0_real = numext::real_ref(Dx[0]); return umfpack_zi_get_numeric(Lp,Lj,Lx?&lx0_real:0,0,Up,Ui,Ux?&ux0_real:0,0,P,Q, Dx?&dx0_real:0,0,do_recip,Rs,Numeric); } inline SuiteSparse_long umfpack_get_numeric(SuiteSparse_long Lp[], SuiteSparse_long Lj[], double Lx[], SuiteSparse_long Up[], SuiteSparse_long Ui[], double Ux[], SuiteSparse_long P[], SuiteSparse_long Q[], double Dx[], SuiteSparse_long *do_recip, double Rs[], void *Numeric) { return umfpack_dl_get_numeric(Lp,Lj,Lx,Up,Ui,Ux,P,Q,Dx,do_recip,Rs,Numeric); } inline SuiteSparse_long umfpack_get_numeric(SuiteSparse_long Lp[], SuiteSparse_long Lj[], std::complex Lx[], SuiteSparse_long Up[], SuiteSparse_long Ui[], std::complex Ux[], SuiteSparse_long P[], SuiteSparse_long Q[], std::complex Dx[], SuiteSparse_long *do_recip, double Rs[], void *Numeric) { double& lx0_real = numext::real_ref(Lx[0]); double& ux0_real = numext::real_ref(Ux[0]); double& dx0_real = numext::real_ref(Dx[0]); return umfpack_zl_get_numeric(Lp,Lj,Lx?&lx0_real:0,0,Up,Ui,Ux?&ux0_real:0,0,P,Q, Dx?&dx0_real:0,0,do_recip,Rs,Numeric); } // Get Determinant inline int umfpack_get_determinant(double *Mx, double *Ex, void *NumericHandle, double User_Info [UMFPACK_INFO], int) { return umfpack_di_get_determinant(Mx,Ex,NumericHandle,User_Info); } inline int umfpack_get_determinant(std::complex *Mx, double *Ex, void *NumericHandle, double User_Info [UMFPACK_INFO], int) { double& mx_real = numext::real_ref(*Mx); return umfpack_zi_get_determinant(&mx_real,0,Ex,NumericHandle,User_Info); } inline SuiteSparse_long umfpack_get_determinant(double *Mx, double *Ex, void *NumericHandle, double User_Info [UMFPACK_INFO], SuiteSparse_long) { return umfpack_dl_get_determinant(Mx,Ex,NumericHandle,User_Info); } inline SuiteSparse_long umfpack_get_determinant(std::complex *Mx, double *Ex, void *NumericHandle, double User_Info [UMFPACK_INFO], SuiteSparse_long) { double& mx_real = numext::real_ref(*Mx); return umfpack_zl_get_determinant(&mx_real,0,Ex,NumericHandle,User_Info); } /** \ingroup UmfPackSupport_Module * \brief A sparse LU factorization and solver based on UmfPack * * This class allows to solve for A.X = B sparse linear problems via a LU factorization * using the UmfPack library. The sparse matrix A must be squared and full rank. * The vectors or matrices X and B can be either dense or sparse. * * \warning The input matrix A should be in a \b compressed and \b column-major form. * Otherwise an expensive copy will be made. You can call the inexpensive makeCompressed() to get a compressed matrix. * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<> * * \implsparsesolverconcept * * \sa \ref TutorialSparseSolverConcept, class SparseLU */ template class UmfPackLU : public SparseSolverBase > { protected: typedef SparseSolverBase > Base; using Base::m_isInitialized; public: using Base::_solve_impl; typedef MatrixType_ MatrixType; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef typename MatrixType::StorageIndex StorageIndex; typedef Matrix Vector; typedef Matrix IntRowVectorType; typedef Matrix IntColVectorType; typedef SparseMatrix LUMatrixType; typedef SparseMatrix UmfpackMatrixType; typedef Ref UmfpackMatrixRef; enum { ColsAtCompileTime = MatrixType::ColsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; public: typedef Array UmfpackControl; typedef Array UmfpackInfo; UmfPackLU() : m_dummy(0,0), mp_matrix(m_dummy) { init(); } template explicit UmfPackLU(const InputMatrixType& matrix) : mp_matrix(matrix) { init(); compute(matrix); } ~UmfPackLU() { if(m_symbolic) umfpack_free_symbolic(&m_symbolic,Scalar(), StorageIndex()); if(m_numeric) umfpack_free_numeric(&m_numeric,Scalar(), StorageIndex()); } inline Index rows() const { return mp_matrix.rows(); } inline Index cols() const { return mp_matrix.cols(); } /** \brief Reports whether previous computation was successful. * * \returns \c Success if computation was successful, * \c NumericalIssue if the matrix.appears to be negative. */ ComputationInfo info() const { eigen_assert(m_isInitialized && "Decomposition is not initialized."); return m_info; } inline const LUMatrixType& matrixL() const { if (m_extractedDataAreDirty) extractData(); return m_l; } inline const LUMatrixType& matrixU() const { if (m_extractedDataAreDirty) extractData(); return m_u; } inline const IntColVectorType& permutationP() const { if (m_extractedDataAreDirty) extractData(); return m_p; } inline const IntRowVectorType& permutationQ() const { if (m_extractedDataAreDirty) extractData(); return m_q; } /** Computes the sparse Cholesky decomposition of \a matrix * Note that the matrix should be column-major, and in compressed format for best performance. * \sa SparseMatrix::makeCompressed(). */ template void compute(const InputMatrixType& matrix) { if(m_symbolic) umfpack_free_symbolic(&m_symbolic,Scalar(),StorageIndex()); if(m_numeric) umfpack_free_numeric(&m_numeric,Scalar(),StorageIndex()); grab(matrix.derived()); analyzePattern_impl(); factorize_impl(); } /** Performs a symbolic decomposition on the sparcity of \a matrix. * * This function is particularly useful when solving for several problems having the same structure. * * \sa factorize(), compute() */ template void analyzePattern(const InputMatrixType& matrix) { if(m_symbolic) umfpack_free_symbolic(&m_symbolic,Scalar(),StorageIndex()); if(m_numeric) umfpack_free_numeric(&m_numeric,Scalar(),StorageIndex()); grab(matrix.derived()); analyzePattern_impl(); } /** Provides the return status code returned by UmfPack during the numeric * factorization. * * \sa factorize(), compute() */ inline int umfpackFactorizeReturncode() const { eigen_assert(m_numeric && "UmfPackLU: you must first call factorize()"); return m_fact_errorCode; } /** Provides access to the control settings array used by UmfPack. * * If this array contains NaN's, the default values are used. * * See UMFPACK documentation for details. */ inline const UmfpackControl& umfpackControl() const { return m_control; } /** Provides access to the control settings array used by UmfPack. * * If this array contains NaN's, the default values are used. * * See UMFPACK documentation for details. */ inline UmfpackControl& umfpackControl() { return m_control; } /** Performs a numeric decomposition of \a matrix * * The given matrix must has the same sparcity than the matrix on which the pattern anylysis has been performed. * * \sa analyzePattern(), compute() */ template void factorize(const InputMatrixType& matrix) { eigen_assert(m_analysisIsOk && "UmfPackLU: you must first call analyzePattern()"); if(m_numeric) umfpack_free_numeric(&m_numeric,Scalar(),StorageIndex()); grab(matrix.derived()); factorize_impl(); } /** Prints the current UmfPack control settings. * * \sa umfpackControl() */ void printUmfpackControl() { umfpack_report_control(m_control.data(), Scalar(),StorageIndex()); } /** Prints statistics collected by UmfPack. * * \sa analyzePattern(), compute() */ void printUmfpackInfo() { eigen_assert(m_analysisIsOk && "UmfPackLU: you must first call analyzePattern()"); umfpack_report_info(m_control.data(), m_umfpackInfo.data(), Scalar(),StorageIndex()); } /** Prints the status of the previous factorization operation performed by UmfPack (symbolic or numerical factorization). * * \sa analyzePattern(), compute() */ void printUmfpackStatus() { eigen_assert(m_analysisIsOk && "UmfPackLU: you must first call analyzePattern()"); umfpack_report_status(m_control.data(), m_fact_errorCode, Scalar(),StorageIndex()); } /** \internal */ template bool _solve_impl(const MatrixBase &b, MatrixBase &x) const; Scalar determinant() const; void extractData() const; protected: void init() { m_info = InvalidInput; m_isInitialized = false; m_numeric = 0; m_symbolic = 0; m_extractedDataAreDirty = true; umfpack_defaults(m_control.data(), Scalar(),StorageIndex()); } void analyzePattern_impl() { m_fact_errorCode = umfpack_symbolic(internal::convert_index(mp_matrix.rows()), internal::convert_index(mp_matrix.cols()), mp_matrix.outerIndexPtr(), mp_matrix.innerIndexPtr(), mp_matrix.valuePtr(), &m_symbolic, m_control.data(), m_umfpackInfo.data()); m_isInitialized = true; m_info = m_fact_errorCode ? InvalidInput : Success; m_analysisIsOk = true; m_factorizationIsOk = false; m_extractedDataAreDirty = true; } void factorize_impl() { m_fact_errorCode = umfpack_numeric(mp_matrix.outerIndexPtr(), mp_matrix.innerIndexPtr(), mp_matrix.valuePtr(), m_symbolic, &m_numeric, m_control.data(), m_umfpackInfo.data()); m_info = m_fact_errorCode == UMFPACK_OK ? Success : NumericalIssue; m_factorizationIsOk = true; m_extractedDataAreDirty = true; } template void grab(const EigenBase &A) { mp_matrix.~UmfpackMatrixRef(); ::new (&mp_matrix) UmfpackMatrixRef(A.derived()); } void grab(const UmfpackMatrixRef &A) { if(&(A.derived()) != &mp_matrix) { mp_matrix.~UmfpackMatrixRef(); ::new (&mp_matrix) UmfpackMatrixRef(A); } } // cached data to reduce reallocation, etc. mutable LUMatrixType m_l; StorageIndex m_fact_errorCode; UmfpackControl m_control; mutable UmfpackInfo m_umfpackInfo; mutable LUMatrixType m_u; mutable IntColVectorType m_p; mutable IntRowVectorType m_q; UmfpackMatrixType m_dummy; UmfpackMatrixRef mp_matrix; void* m_numeric; void* m_symbolic; mutable ComputationInfo m_info; int m_factorizationIsOk; int m_analysisIsOk; mutable bool m_extractedDataAreDirty; private: UmfPackLU(const UmfPackLU& ) { } }; template void UmfPackLU::extractData() const { if (m_extractedDataAreDirty) { // get size of the data StorageIndex lnz, unz, rows, cols, nz_udiag; umfpack_get_lunz(&lnz, &unz, &rows, &cols, &nz_udiag, m_numeric, Scalar()); // allocate data m_l.resize(rows,(std::min)(rows,cols)); m_l.resizeNonZeros(lnz); m_u.resize((std::min)(rows,cols),cols); m_u.resizeNonZeros(unz); m_p.resize(rows); m_q.resize(cols); // extract umfpack_get_numeric(m_l.outerIndexPtr(), m_l.innerIndexPtr(), m_l.valuePtr(), m_u.outerIndexPtr(), m_u.innerIndexPtr(), m_u.valuePtr(), m_p.data(), m_q.data(), 0, 0, 0, m_numeric); m_extractedDataAreDirty = false; } } template typename UmfPackLU::Scalar UmfPackLU::determinant() const { Scalar det; umfpack_get_determinant(&det, 0, m_numeric, 0, StorageIndex()); return det; } template template bool UmfPackLU::_solve_impl(const MatrixBase &b, MatrixBase &x) const { Index rhsCols = b.cols(); eigen_assert((BDerived::Flags&RowMajorBit)==0 && "UmfPackLU backend does not support non col-major rhs yet"); eigen_assert((XDerived::Flags&RowMajorBit)==0 && "UmfPackLU backend does not support non col-major result yet"); eigen_assert(b.derived().data() != x.derived().data() && " Umfpack does not support inplace solve"); Scalar* x_ptr = 0; Matrix x_tmp; if(x.innerStride()!=1) { x_tmp.resize(x.rows()); x_ptr = x_tmp.data(); } for (int j=0; j // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_MISC_IMAGE_H #define EIGEN_MISC_IMAGE_H namespace Eigen { namespace internal { /** \class image_retval_base * */ template struct traits > { typedef typename DecompositionType::MatrixType MatrixType; typedef Matrix< typename MatrixType::Scalar, MatrixType::RowsAtCompileTime, // the image is a subspace of the destination space, whose // dimension is the number of rows of the original matrix Dynamic, // we don't know at compile time the dimension of the image (the rank) MatrixType::Options, MatrixType::MaxRowsAtCompileTime, // the image matrix will consist of columns from the original matrix, MatrixType::MaxColsAtCompileTime // so it has the same number of rows and at most as many columns. > ReturnType; }; template struct image_retval_base : public ReturnByValue > { typedef DecompositionType_ DecompositionType; typedef typename DecompositionType::MatrixType MatrixType; typedef ReturnByValue Base; image_retval_base(const DecompositionType& dec, const MatrixType& originalMatrix) : m_dec(dec), m_rank(dec.rank()), m_cols(m_rank == 0 ? 1 : m_rank), m_originalMatrix(originalMatrix) {} inline Index rows() const { return m_dec.rows(); } inline Index cols() const { return m_cols; } inline Index rank() const { return m_rank; } inline const DecompositionType& dec() const { return m_dec; } inline const MatrixType& originalMatrix() const { return m_originalMatrix; } template inline void evalTo(Dest& dst) const { static_cast*>(this)->evalTo(dst); } protected: const DecompositionType& m_dec; Index m_rank, m_cols; const MatrixType& m_originalMatrix; }; } // end namespace internal #define EIGEN_MAKE_IMAGE_HELPERS(DecompositionType) \ typedef typename DecompositionType::MatrixType MatrixType; \ typedef typename MatrixType::Scalar Scalar; \ typedef typename MatrixType::RealScalar RealScalar; \ typedef Eigen::internal::image_retval_base Base; \ using Base::dec; \ using Base::originalMatrix; \ using Base::rank; \ using Base::rows; \ using Base::cols; \ image_retval(const DecompositionType& dec, const MatrixType& originalMatrix) \ : Base(dec, originalMatrix) {} } // end namespace Eigen #endif // EIGEN_MISC_IMAGE_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/misc/Kernel.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_MISC_KERNEL_H #define EIGEN_MISC_KERNEL_H namespace Eigen { namespace internal { /** \class kernel_retval_base * */ template struct traits > { typedef typename DecompositionType::MatrixType MatrixType; typedef Matrix< typename MatrixType::Scalar, MatrixType::ColsAtCompileTime, // the number of rows in the "kernel matrix" // is the number of cols of the original matrix // so that the product "matrix * kernel = zero" makes sense Dynamic, // we don't know at compile-time the dimension of the kernel MatrixType::Options, MatrixType::MaxColsAtCompileTime, // see explanation for 2nd template parameter MatrixType::MaxColsAtCompileTime // the kernel is a subspace of the domain space, // whose dimension is the number of columns of the original matrix > ReturnType; }; template struct kernel_retval_base : public ReturnByValue > { typedef DecompositionType_ DecompositionType; typedef ReturnByValue Base; explicit kernel_retval_base(const DecompositionType& dec) : m_dec(dec), m_rank(dec.rank()), m_cols(m_rank==dec.cols() ? 1 : dec.cols() - m_rank) {} inline Index rows() const { return m_dec.cols(); } inline Index cols() const { return m_cols; } inline Index rank() const { return m_rank; } inline const DecompositionType& dec() const { return m_dec; } template inline void evalTo(Dest& dst) const { static_cast*>(this)->evalTo(dst); } protected: const DecompositionType& m_dec; Index m_rank, m_cols; }; } // end namespace internal #define EIGEN_MAKE_KERNEL_HELPERS(DecompositionType) \ typedef typename DecompositionType::MatrixType MatrixType; \ typedef typename MatrixType::Scalar Scalar; \ typedef typename MatrixType::RealScalar RealScalar; \ typedef Eigen::internal::kernel_retval_base Base; \ using Base::dec; \ using Base::rank; \ using Base::rows; \ using Base::cols; \ kernel_retval(const DecompositionType& dec) : Base(dec) {} } // end namespace Eigen #endif // EIGEN_MISC_KERNEL_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/misc/RealSvd2x2.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009-2010 Benoit Jacob // Copyright (C) 2013-2016 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_REALSVD2X2_H #define EIGEN_REALSVD2X2_H namespace Eigen { namespace internal { template void real_2x2_jacobi_svd(const MatrixType& matrix, Index p, Index q, JacobiRotation *j_left, JacobiRotation *j_right) { using std::sqrt; using std::abs; Matrix m; m << numext::real(matrix.coeff(p,p)), numext::real(matrix.coeff(p,q)), numext::real(matrix.coeff(q,p)), numext::real(matrix.coeff(q,q)); JacobiRotation rot1; RealScalar t = m.coeff(0,0) + m.coeff(1,1); RealScalar d = m.coeff(1,0) - m.coeff(0,1); if(abs(d) < (std::numeric_limits::min)()) { rot1.s() = RealScalar(0); rot1.c() = RealScalar(1); } else { // If d!=0, then t/d cannot overflow because the magnitude of the // entries forming d are not too small compared to the ones forming t. RealScalar u = t / d; RealScalar tmp = sqrt(RealScalar(1) + numext::abs2(u)); rot1.s() = RealScalar(1) / tmp; rot1.c() = u / tmp; } m.applyOnTheLeft(0,1,rot1); j_right->makeJacobi(m,0,1); *j_left = rot1 * j_right->transpose(); } } // end namespace internal } // end namespace Eigen #endif // EIGEN_REALSVD2X2_H ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/misc/blas.h ================================================ #ifndef BLAS_H #define BLAS_H #ifdef __cplusplus extern "C" { #endif #define BLASFUNC(FUNC) FUNC##_ #ifdef __WIN64__ typedef long long BLASLONG; typedef unsigned long long BLASULONG; #else typedef long BLASLONG; typedef unsigned long BLASULONG; #endif int BLASFUNC(xerbla)(const char *, int *info, int); float BLASFUNC(sdot) (int *, float *, int *, float *, int *); float BLASFUNC(sdsdot)(int *, float *, float *, int *, float *, int *); double BLASFUNC(dsdot) (int *, float *, int *, float *, int *); double BLASFUNC(ddot) (int *, double *, int *, double *, int *); double BLASFUNC(qdot) (int *, double *, int *, double *, int *); int BLASFUNC(cdotuw) (int *, float *, int *, float *, int *, float*); int BLASFUNC(cdotcw) (int *, float *, int *, float *, int *, float*); int BLASFUNC(zdotuw) (int *, double *, int *, double *, int *, double*); int BLASFUNC(zdotcw) (int *, double *, int *, double *, int *, double*); int BLASFUNC(saxpy) (const int *, const float *, const float *, const int *, float *, const int *); int BLASFUNC(daxpy) (const int *, const double *, const double *, const int *, double *, const int *); int BLASFUNC(qaxpy) (const int *, const double *, const double *, const int *, double *, const int *); int BLASFUNC(caxpy) (const int *, const float *, const float *, const int *, float *, const int *); int BLASFUNC(zaxpy) (const int *, const double *, const double *, const int *, double *, const int *); int BLASFUNC(xaxpy) (const int *, const double *, const double *, const int *, double *, const int *); int BLASFUNC(caxpyc)(const int *, const float *, const float *, const int *, float *, const int *); int BLASFUNC(zaxpyc)(const int *, const double *, const double *, const int *, double *, const int *); int BLASFUNC(xaxpyc)(const int *, const double *, const double *, const int *, double *, const int *); int BLASFUNC(scopy) (int *, float *, int *, float *, int *); int BLASFUNC(dcopy) (int *, double *, int *, double *, int *); int BLASFUNC(qcopy) (int *, double *, int *, double *, int *); int BLASFUNC(ccopy) (int *, float *, int *, float *, int *); int BLASFUNC(zcopy) (int *, double *, int *, double *, int *); int BLASFUNC(xcopy) (int *, double *, int *, double *, int *); int BLASFUNC(sswap) (int *, float *, int *, float *, int *); int BLASFUNC(dswap) (int *, double *, int *, double *, int *); int BLASFUNC(qswap) (int *, double *, int *, double *, int *); int BLASFUNC(cswap) (int *, float *, int *, float *, int *); int BLASFUNC(zswap) (int *, double *, int *, double *, int *); int BLASFUNC(xswap) (int *, double *, int *, double *, int *); float BLASFUNC(sasum) (int *, float *, int *); float BLASFUNC(scasum)(int *, float *, int *); double BLASFUNC(dasum) (int *, double *, int *); double BLASFUNC(qasum) (int *, double *, int *); double BLASFUNC(dzasum)(int *, double *, int *); double BLASFUNC(qxasum)(int *, double *, int *); int BLASFUNC(isamax)(int *, float *, int *); int BLASFUNC(idamax)(int *, double *, int *); int BLASFUNC(iqamax)(int *, double *, int *); int BLASFUNC(icamax)(int *, float *, int *); int BLASFUNC(izamax)(int *, double *, int *); int BLASFUNC(ixamax)(int *, double *, int *); int BLASFUNC(ismax) (int *, float *, int *); int BLASFUNC(idmax) (int *, double *, int *); int BLASFUNC(iqmax) (int *, double *, int *); int BLASFUNC(icmax) (int *, float *, int *); int BLASFUNC(izmax) (int *, double *, int *); int BLASFUNC(ixmax) (int *, double *, int *); int BLASFUNC(isamin)(int *, float *, int *); int BLASFUNC(idamin)(int *, double *, int *); int BLASFUNC(iqamin)(int *, double *, int *); int BLASFUNC(icamin)(int *, float *, int *); int BLASFUNC(izamin)(int *, double *, int *); int BLASFUNC(ixamin)(int *, double *, int *); int BLASFUNC(ismin)(int *, float *, int *); int BLASFUNC(idmin)(int *, double *, int *); int BLASFUNC(iqmin)(int *, double *, int *); int BLASFUNC(icmin)(int *, float *, int *); int BLASFUNC(izmin)(int *, double *, int *); int BLASFUNC(ixmin)(int *, double *, int *); float BLASFUNC(samax) (int *, float *, int *); double BLASFUNC(damax) (int *, double *, int *); double BLASFUNC(qamax) (int *, double *, int *); float BLASFUNC(scamax)(int *, float *, int *); double BLASFUNC(dzamax)(int *, double *, int *); double BLASFUNC(qxamax)(int *, double *, int *); float BLASFUNC(samin) (int *, float *, int *); double BLASFUNC(damin) (int *, double *, int *); double BLASFUNC(qamin) (int *, double *, int *); float BLASFUNC(scamin)(int *, float *, int *); double BLASFUNC(dzamin)(int *, double *, int *); double BLASFUNC(qxamin)(int *, double *, int *); float BLASFUNC(smax) (int *, float *, int *); double BLASFUNC(dmax) (int *, double *, int *); double BLASFUNC(qmax) (int *, double *, int *); float BLASFUNC(scmax) (int *, float *, int *); double BLASFUNC(dzmax) (int *, double *, int *); double BLASFUNC(qxmax) (int *, double *, int *); float BLASFUNC(smin) (int *, float *, int *); double BLASFUNC(dmin) (int *, double *, int *); double BLASFUNC(qmin) (int *, double *, int *); float BLASFUNC(scmin) (int *, float *, int *); double BLASFUNC(dzmin) (int *, double *, int *); double BLASFUNC(qxmin) (int *, double *, int *); int BLASFUNC(sscal) (int *, float *, float *, int *); int BLASFUNC(dscal) (int *, double *, double *, int *); int BLASFUNC(qscal) (int *, double *, double *, int *); int BLASFUNC(cscal) (int *, float *, float *, int *); int BLASFUNC(zscal) (int *, double *, double *, int *); int BLASFUNC(xscal) (int *, double *, double *, int *); int BLASFUNC(csscal)(int *, float *, float *, int *); int BLASFUNC(zdscal)(int *, double *, double *, int *); int BLASFUNC(xqscal)(int *, double *, double *, int *); float BLASFUNC(snrm2) (int *, float *, int *); float BLASFUNC(scnrm2)(int *, float *, int *); double BLASFUNC(dnrm2) (int *, double *, int *); double BLASFUNC(qnrm2) (int *, double *, int *); double BLASFUNC(dznrm2)(int *, double *, int *); double BLASFUNC(qxnrm2)(int *, double *, int *); int BLASFUNC(srot) (int *, float *, int *, float *, int *, float *, float *); int BLASFUNC(drot) (int *, double *, int *, double *, int *, double *, double *); int BLASFUNC(qrot) (int *, double *, int *, double *, int *, double *, double *); int BLASFUNC(csrot) (int *, float *, int *, float *, int *, float *, float *); int BLASFUNC(zdrot) (int *, double *, int *, double *, int *, double *, double *); int BLASFUNC(xqrot) (int *, double *, int *, double *, int *, double *, double *); int BLASFUNC(srotg) (float *, float *, float *, float *); int BLASFUNC(drotg) (double *, double *, double *, double *); int BLASFUNC(qrotg) (double *, double *, double *, double *); int BLASFUNC(crotg) (float *, float *, float *, float *); int BLASFUNC(zrotg) (double *, double *, double *, double *); int BLASFUNC(xrotg) (double *, double *, double *, double *); int BLASFUNC(srotmg)(float *, float *, float *, float *, float *); int BLASFUNC(drotmg)(double *, double *, double *, double *, double *); int BLASFUNC(srotm) (int *, float *, int *, float *, int *, float *); int BLASFUNC(drotm) (int *, double *, int *, double *, int *, double *); int BLASFUNC(qrotm) (int *, double *, int *, double *, int *, double *); /* Level 2 routines */ int BLASFUNC(sger)(int *, int *, float *, float *, int *, float *, int *, float *, int *); int BLASFUNC(dger)(int *, int *, double *, double *, int *, double *, int *, double *, int *); int BLASFUNC(qger)(int *, int *, double *, double *, int *, double *, int *, double *, int *); int BLASFUNC(cgeru)(int *, int *, float *, float *, int *, float *, int *, float *, int *); int BLASFUNC(cgerc)(int *, int *, float *, float *, int *, float *, int *, float *, int *); int BLASFUNC(zgeru)(int *, int *, double *, double *, int *, double *, int *, double *, int *); int BLASFUNC(zgerc)(int *, int *, double *, double *, int *, double *, int *, double *, int *); int BLASFUNC(xgeru)(int *, int *, double *, double *, int *, double *, int *, double *, int *); int BLASFUNC(xgerc)(int *, int *, double *, double *, int *, double *, int *, double *, int *); int BLASFUNC(sgemv)(const char *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *); int BLASFUNC(dgemv)(const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(qgemv)(const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(cgemv)(const char *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *); int BLASFUNC(zgemv)(const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(xgemv)(const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(strsv) (const char *, const char *, const char *, const int *, const float *, const int *, float *, const int *); int BLASFUNC(dtrsv) (const char *, const char *, const char *, const int *, const double *, const int *, double *, const int *); int BLASFUNC(qtrsv) (const char *, const char *, const char *, const int *, const double *, const int *, double *, const int *); int BLASFUNC(ctrsv) (const char *, const char *, const char *, const int *, const float *, const int *, float *, const int *); int BLASFUNC(ztrsv) (const char *, const char *, const char *, const int *, const double *, const int *, double *, const int *); int BLASFUNC(xtrsv) (const char *, const char *, const char *, const int *, const double *, const int *, double *, const int *); int BLASFUNC(stpsv) (char *, char *, char *, int *, float *, float *, int *); int BLASFUNC(dtpsv) (char *, char *, char *, int *, double *, double *, int *); int BLASFUNC(qtpsv) (char *, char *, char *, int *, double *, double *, int *); int BLASFUNC(ctpsv) (char *, char *, char *, int *, float *, float *, int *); int BLASFUNC(ztpsv) (char *, char *, char *, int *, double *, double *, int *); int BLASFUNC(xtpsv) (char *, char *, char *, int *, double *, double *, int *); int BLASFUNC(strmv) (const char *, const char *, const char *, const int *, const float *, const int *, float *, const int *); int BLASFUNC(dtrmv) (const char *, const char *, const char *, const int *, const double *, const int *, double *, const int *); int BLASFUNC(qtrmv) (const char *, const char *, const char *, const int *, const double *, const int *, double *, const int *); int BLASFUNC(ctrmv) (const char *, const char *, const char *, const int *, const float *, const int *, float *, const int *); int BLASFUNC(ztrmv) (const char *, const char *, const char *, const int *, const double *, const int *, double *, const int *); int BLASFUNC(xtrmv) (const char *, const char *, const char *, const int *, const double *, const int *, double *, const int *); int BLASFUNC(stpmv) (char *, char *, char *, int *, float *, float *, int *); int BLASFUNC(dtpmv) (char *, char *, char *, int *, double *, double *, int *); int BLASFUNC(qtpmv) (char *, char *, char *, int *, double *, double *, int *); int BLASFUNC(ctpmv) (char *, char *, char *, int *, float *, float *, int *); int BLASFUNC(ztpmv) (char *, char *, char *, int *, double *, double *, int *); int BLASFUNC(xtpmv) (char *, char *, char *, int *, double *, double *, int *); int BLASFUNC(stbmv) (char *, char *, char *, int *, int *, float *, int *, float *, int *); int BLASFUNC(dtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); int BLASFUNC(qtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); int BLASFUNC(ctbmv) (char *, char *, char *, int *, int *, float *, int *, float *, int *); int BLASFUNC(ztbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); int BLASFUNC(xtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); int BLASFUNC(stbsv) (char *, char *, char *, int *, int *, float *, int *, float *, int *); int BLASFUNC(dtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); int BLASFUNC(qtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); int BLASFUNC(ctbsv) (char *, char *, char *, int *, int *, float *, int *, float *, int *); int BLASFUNC(ztbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); int BLASFUNC(xtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); int BLASFUNC(ssymv) (const char *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *); int BLASFUNC(dsymv) (const char *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(qsymv) (const char *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(sspmv) (char *, int *, float *, float *, float *, int *, float *, float *, int *); int BLASFUNC(dspmv) (char *, int *, double *, double *, double *, int *, double *, double *, int *); int BLASFUNC(qspmv) (char *, int *, double *, double *, double *, int *, double *, double *, int *); int BLASFUNC(ssyr) (const char *, const int *, const float *, const float *, const int *, float *, const int *); int BLASFUNC(dsyr) (const char *, const int *, const double *, const double *, const int *, double *, const int *); int BLASFUNC(qsyr) (const char *, const int *, const double *, const double *, const int *, double *, const int *); int BLASFUNC(ssyr2) (const char *, const int *, const float *, const float *, const int *, const float *, const int *, float *, const int *); int BLASFUNC(dsyr2) (const char *, const int *, const double *, const double *, const int *, const double *, const int *, double *, const int *); int BLASFUNC(qsyr2) (const char *, const int *, const double *, const double *, const int *, const double *, const int *, double *, const int *); int BLASFUNC(csyr2) (const char *, const int *, const float *, const float *, const int *, const float *, const int *, float *, const int *); int BLASFUNC(zsyr2) (const char *, const int *, const double *, const double *, const int *, const double *, const int *, double *, const int *); int BLASFUNC(xsyr2) (const char *, const int *, const double *, const double *, const int *, const double *, const int *, double *, const int *); int BLASFUNC(sspr) (char *, int *, float *, float *, int *, float *); int BLASFUNC(dspr) (char *, int *, double *, double *, int *, double *); int BLASFUNC(qspr) (char *, int *, double *, double *, int *, double *); int BLASFUNC(sspr2) (char *, int *, float *, float *, int *, float *, int *, float *); int BLASFUNC(dspr2) (char *, int *, double *, double *, int *, double *, int *, double *); int BLASFUNC(qspr2) (char *, int *, double *, double *, int *, double *, int *, double *); int BLASFUNC(cspr2) (char *, int *, float *, float *, int *, float *, int *, float *); int BLASFUNC(zspr2) (char *, int *, double *, double *, int *, double *, int *, double *); int BLASFUNC(xspr2) (char *, int *, double *, double *, int *, double *, int *, double *); int BLASFUNC(cher) (char *, int *, float *, float *, int *, float *, int *); int BLASFUNC(zher) (char *, int *, double *, double *, int *, double *, int *); int BLASFUNC(xher) (char *, int *, double *, double *, int *, double *, int *); int BLASFUNC(chpr) (char *, int *, float *, float *, int *, float *); int BLASFUNC(zhpr) (char *, int *, double *, double *, int *, double *); int BLASFUNC(xhpr) (char *, int *, double *, double *, int *, double *); int BLASFUNC(cher2) (char *, int *, float *, float *, int *, float *, int *, float *, int *); int BLASFUNC(zher2) (char *, int *, double *, double *, int *, double *, int *, double *, int *); int BLASFUNC(xher2) (char *, int *, double *, double *, int *, double *, int *, double *, int *); int BLASFUNC(chpr2) (char *, int *, float *, float *, int *, float *, int *, float *); int BLASFUNC(zhpr2) (char *, int *, double *, double *, int *, double *, int *, double *); int BLASFUNC(xhpr2) (char *, int *, double *, double *, int *, double *, int *, double *); int BLASFUNC(chemv) (const char *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *); int BLASFUNC(zhemv) (const char *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(xhemv) (const char *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(chpmv) (char *, int *, float *, float *, float *, int *, float *, float *, int *); int BLASFUNC(zhpmv) (char *, int *, double *, double *, double *, int *, double *, double *, int *); int BLASFUNC(xhpmv) (char *, int *, double *, double *, double *, int *, double *, double *, int *); int BLASFUNC(snorm)(char *, int *, int *, float *, int *); int BLASFUNC(dnorm)(char *, int *, int *, double *, int *); int BLASFUNC(cnorm)(char *, int *, int *, float *, int *); int BLASFUNC(znorm)(char *, int *, int *, double *, int *); int BLASFUNC(sgbmv)(char *, int *, int *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(dgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(qgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(cgbmv)(char *, int *, int *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(xgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(ssbmv)(char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(dsbmv)(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(qsbmv)(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(csbmv)(char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zsbmv)(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(xsbmv)(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(chbmv)(char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zhbmv)(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(xhbmv)(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); /* Level 3 routines */ int BLASFUNC(sgemm)(const char *, const char *, const int *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *); int BLASFUNC(dgemm)(const char *, const char *, const int *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(qgemm)(const char *, const char *, const int *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(cgemm)(const char *, const char *, const int *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *); int BLASFUNC(zgemm)(const char *, const char *, const int *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(xgemm)(const char *, const char *, const int *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(cgemm3m)(char *, char *, int *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zgemm3m)(char *, char *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(xgemm3m)(char *, char *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(sge2mm)(char *, char *, char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(dge2mm)(char *, char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(cge2mm)(char *, char *, char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zge2mm)(char *, char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(strsm)(const char *, const char *, const char *, const char *, const int *, const int *, const float *, const float *, const int *, float *, const int *); int BLASFUNC(dtrsm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *, const double *, const int *, double *, const int *); int BLASFUNC(qtrsm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *, const double *, const int *, double *, const int *); int BLASFUNC(ctrsm)(const char *, const char *, const char *, const char *, const int *, const int *, const float *, const float *, const int *, float *, const int *); int BLASFUNC(ztrsm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *, const double *, const int *, double *, const int *); int BLASFUNC(xtrsm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *, const double *, const int *, double *, const int *); int BLASFUNC(strmm)(const char *, const char *, const char *, const char *, const int *, const int *, const float *, const float *, const int *, float *, const int *); int BLASFUNC(dtrmm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *, const double *, const int *, double *, const int *); int BLASFUNC(qtrmm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *, const double *, const int *, double *, const int *); int BLASFUNC(ctrmm)(const char *, const char *, const char *, const char *, const int *, const int *, const float *, const float *, const int *, float *, const int *); int BLASFUNC(ztrmm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *, const double *, const int *, double *, const int *); int BLASFUNC(xtrmm)(const char *, const char *, const char *, const char *, const int *, const int *, const double *, const double *, const int *, double *, const int *); int BLASFUNC(ssymm)(const char *, const char *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *); int BLASFUNC(dsymm)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(qsymm)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(csymm)(const char *, const char *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *); int BLASFUNC(zsymm)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(xsymm)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(csymm3m)(char *, char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zsymm3m)(char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(xsymm3m)(char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(ssyrk)(const char *, const char *, const int *, const int *, const float *, const float *, const int *, const float *, float *, const int *); int BLASFUNC(dsyrk)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(qsyrk)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(csyrk)(const char *, const char *, const int *, const int *, const float *, const float *, const int *, const float *, float *, const int *); int BLASFUNC(zsyrk)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(xsyrk)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(ssyr2k)(const char *, const char *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *); int BLASFUNC(dsyr2k)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double*, const int *, const double *, double *, const int *); int BLASFUNC(qsyr2k)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double*, const int *, const double *, double *, const int *); int BLASFUNC(csyr2k)(const char *, const char *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *); int BLASFUNC(zsyr2k)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double*, const int *, const double *, double *, const int *); int BLASFUNC(xsyr2k)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double*, const int *, const double *, double *, const int *); int BLASFUNC(chemm)(const char *, const char *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *); int BLASFUNC(zhemm)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(xhemm)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(chemm3m)(char *, char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zhemm3m)(char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(xhemm3m)(char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(cherk)(const char *, const char *, const int *, const int *, const float *, const float *, const int *, const float *, float *, const int *); int BLASFUNC(zherk)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(xherk)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(cher2k)(const char *, const char *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *); int BLASFUNC(zher2k)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(xher2k)(const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(cher2m)(const char *, const char *, const char *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *); int BLASFUNC(zher2m)(const char *, const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double*, const int *, const double *, double *, const int *); int BLASFUNC(xher2m)(const char *, const char *, const char *, const int *, const int *, const double *, const double *, const int *, const double*, const int *, const double *, double *, const int *); #ifdef __cplusplus } #endif #endif ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/misc/lapack.h ================================================ #ifndef LAPACK_H #define LAPACK_H #include "blas.h" #ifdef __cplusplus extern "C" { #endif int BLASFUNC(csymv) (const char *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *); int BLASFUNC(zsymv) (const char *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(xsymv) (const char *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); int BLASFUNC(cspmv) (char *, int *, float *, float *, float *, int *, float *, float *, int *); int BLASFUNC(zspmv) (char *, int *, double *, double *, double *, int *, double *, double *, int *); int BLASFUNC(xspmv) (char *, int *, double *, double *, double *, int *, double *, double *, int *); int BLASFUNC(csyr) (char *, int *, float *, float *, int *, float *, int *); int BLASFUNC(zsyr) (char *, int *, double *, double *, int *, double *, int *); int BLASFUNC(xsyr) (char *, int *, double *, double *, int *, double *, int *); int BLASFUNC(cspr) (char *, int *, float *, float *, int *, float *); int BLASFUNC(zspr) (char *, int *, double *, double *, int *, double *); int BLASFUNC(xspr) (char *, int *, double *, double *, int *, double *); int BLASFUNC(sgemt)(char *, int *, int *, float *, float *, int *, float *, int *); int BLASFUNC(dgemt)(char *, int *, int *, double *, double *, int *, double *, int *); int BLASFUNC(cgemt)(char *, int *, int *, float *, float *, int *, float *, int *); int BLASFUNC(zgemt)(char *, int *, int *, double *, double *, int *, double *, int *); int BLASFUNC(sgema)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, float *, int *); int BLASFUNC(dgema)(char *, char *, int *, int *, double *, double *, int *, double*, double *, int *, double*, int *); int BLASFUNC(cgema)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, float *, int *); int BLASFUNC(zgema)(char *, char *, int *, int *, double *, double *, int *, double*, double *, int *, double*, int *); int BLASFUNC(sgems)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, float *, int *); int BLASFUNC(dgems)(char *, char *, int *, int *, double *, double *, int *, double*, double *, int *, double*, int *); int BLASFUNC(cgems)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, float *, int *); int BLASFUNC(zgems)(char *, char *, int *, int *, double *, double *, int *, double*, double *, int *, double*, int *); int BLASFUNC(sgetf2)(int *, int *, float *, int *, int *, int *); int BLASFUNC(dgetf2)(int *, int *, double *, int *, int *, int *); int BLASFUNC(qgetf2)(int *, int *, double *, int *, int *, int *); int BLASFUNC(cgetf2)(int *, int *, float *, int *, int *, int *); int BLASFUNC(zgetf2)(int *, int *, double *, int *, int *, int *); int BLASFUNC(xgetf2)(int *, int *, double *, int *, int *, int *); int BLASFUNC(sgetrf)(int *, int *, float *, int *, int *, int *); int BLASFUNC(dgetrf)(int *, int *, double *, int *, int *, int *); int BLASFUNC(qgetrf)(int *, int *, double *, int *, int *, int *); int BLASFUNC(cgetrf)(int *, int *, float *, int *, int *, int *); int BLASFUNC(zgetrf)(int *, int *, double *, int *, int *, int *); int BLASFUNC(xgetrf)(int *, int *, double *, int *, int *, int *); int BLASFUNC(slaswp)(int *, float *, int *, int *, int *, int *, int *); int BLASFUNC(dlaswp)(int *, double *, int *, int *, int *, int *, int *); int BLASFUNC(qlaswp)(int *, double *, int *, int *, int *, int *, int *); int BLASFUNC(claswp)(int *, float *, int *, int *, int *, int *, int *); int BLASFUNC(zlaswp)(int *, double *, int *, int *, int *, int *, int *); int BLASFUNC(xlaswp)(int *, double *, int *, int *, int *, int *, int *); int BLASFUNC(sgetrs)(char *, int *, int *, float *, int *, int *, float *, int *, int *); int BLASFUNC(dgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); int BLASFUNC(qgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); int BLASFUNC(cgetrs)(char *, int *, int *, float *, int *, int *, float *, int *, int *); int BLASFUNC(zgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); int BLASFUNC(xgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); int BLASFUNC(sgesv)(int *, int *, float *, int *, int *, float *, int *, int *); int BLASFUNC(dgesv)(int *, int *, double *, int *, int *, double*, int *, int *); int BLASFUNC(qgesv)(int *, int *, double *, int *, int *, double*, int *, int *); int BLASFUNC(cgesv)(int *, int *, float *, int *, int *, float *, int *, int *); int BLASFUNC(zgesv)(int *, int *, double *, int *, int *, double*, int *, int *); int BLASFUNC(xgesv)(int *, int *, double *, int *, int *, double*, int *, int *); int BLASFUNC(spotf2)(char *, int *, float *, int *, int *); int BLASFUNC(dpotf2)(char *, int *, double *, int *, int *); int BLASFUNC(qpotf2)(char *, int *, double *, int *, int *); int BLASFUNC(cpotf2)(char *, int *, float *, int *, int *); int BLASFUNC(zpotf2)(char *, int *, double *, int *, int *); int BLASFUNC(xpotf2)(char *, int *, double *, int *, int *); int BLASFUNC(spotrf)(char *, int *, float *, int *, int *); int BLASFUNC(dpotrf)(char *, int *, double *, int *, int *); int BLASFUNC(qpotrf)(char *, int *, double *, int *, int *); int BLASFUNC(cpotrf)(char *, int *, float *, int *, int *); int BLASFUNC(zpotrf)(char *, int *, double *, int *, int *); int BLASFUNC(xpotrf)(char *, int *, double *, int *, int *); int BLASFUNC(slauu2)(char *, int *, float *, int *, int *); int BLASFUNC(dlauu2)(char *, int *, double *, int *, int *); int BLASFUNC(qlauu2)(char *, int *, double *, int *, int *); int BLASFUNC(clauu2)(char *, int *, float *, int *, int *); int BLASFUNC(zlauu2)(char *, int *, double *, int *, int *); int BLASFUNC(xlauu2)(char *, int *, double *, int *, int *); int BLASFUNC(slauum)(char *, int *, float *, int *, int *); int BLASFUNC(dlauum)(char *, int *, double *, int *, int *); int BLASFUNC(qlauum)(char *, int *, double *, int *, int *); int BLASFUNC(clauum)(char *, int *, float *, int *, int *); int BLASFUNC(zlauum)(char *, int *, double *, int *, int *); int BLASFUNC(xlauum)(char *, int *, double *, int *, int *); int BLASFUNC(strti2)(char *, char *, int *, float *, int *, int *); int BLASFUNC(dtrti2)(char *, char *, int *, double *, int *, int *); int BLASFUNC(qtrti2)(char *, char *, int *, double *, int *, int *); int BLASFUNC(ctrti2)(char *, char *, int *, float *, int *, int *); int BLASFUNC(ztrti2)(char *, char *, int *, double *, int *, int *); int BLASFUNC(xtrti2)(char *, char *, int *, double *, int *, int *); int BLASFUNC(strtri)(char *, char *, int *, float *, int *, int *); int BLASFUNC(dtrtri)(char *, char *, int *, double *, int *, int *); int BLASFUNC(qtrtri)(char *, char *, int *, double *, int *, int *); int BLASFUNC(ctrtri)(char *, char *, int *, float *, int *, int *); int BLASFUNC(ztrtri)(char *, char *, int *, double *, int *, int *); int BLASFUNC(xtrtri)(char *, char *, int *, double *, int *, int *); int BLASFUNC(spotri)(char *, int *, float *, int *, int *); int BLASFUNC(dpotri)(char *, int *, double *, int *, int *); int BLASFUNC(qpotri)(char *, int *, double *, int *, int *); int BLASFUNC(cpotri)(char *, int *, float *, int *, int *); int BLASFUNC(zpotri)(char *, int *, double *, int *, int *); int BLASFUNC(xpotri)(char *, int *, double *, int *, int *); #ifdef __cplusplus } #endif #endif ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/misc/lapacke.h ================================================ /***************************************************************************** Copyright (c) 2010, Intel Corp. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ****************************************************************************** * Contents: Native C interface to LAPACK * Author: Intel Corporation * Generated November, 2011 *****************************************************************************/ #ifndef _MKL_LAPACKE_H_ #ifndef _LAPACKE_H_ #define _LAPACKE_H_ /* * Turn on HAVE_LAPACK_CONFIG_H to redefine C-LAPACK datatypes */ #ifdef HAVE_LAPACK_CONFIG_H #include "lapacke_config.h" #endif #include #ifndef lapack_int #define lapack_int int #endif #ifndef lapack_logical #define lapack_logical lapack_int #endif /* Complex types are structures equivalent to the * Fortran complex types COMPLEX(4) and COMPLEX(8). * * One can also redefine the types with his own types * for example by including in the code definitions like * * #define lapack_complex_float std::complex * #define lapack_complex_double std::complex * * or define these types in the command line: * * -Dlapack_complex_float="std::complex" * -Dlapack_complex_double="std::complex" */ #ifndef LAPACK_COMPLEX_CUSTOM /* Complex type (single precision) */ #ifndef lapack_complex_float #include #define lapack_complex_float float _Complex #endif #ifndef lapack_complex_float_real #define lapack_complex_float_real(z) (creal(z)) #endif #ifndef lapack_complex_float_imag #define lapack_complex_float_imag(z) (cimag(z)) #endif lapack_complex_float lapack_make_complex_float( float re, float im ); /* Complex type (double precision) */ #ifndef lapack_complex_double #include #define lapack_complex_double double _Complex #endif #ifndef lapack_complex_double_real #define lapack_complex_double_real(z) (creal(z)) #endif #ifndef lapack_complex_double_imag #define lapack_complex_double_imag(z) (cimag(z)) #endif lapack_complex_double lapack_make_complex_double( double re, double im ); #endif #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef LAPACKE_malloc #define LAPACKE_malloc( size ) malloc( size ) #endif #ifndef LAPACKE_free #define LAPACKE_free( p ) free( p ) #endif #define LAPACK_C2INT( x ) (lapack_int)(*((float*)&x )) #define LAPACK_Z2INT( x ) (lapack_int)(*((double*)&x )) #define LAPACK_ROW_MAJOR 101 #define LAPACK_COL_MAJOR 102 #define LAPACK_WORK_MEMORY_ERROR -1010 #define LAPACK_TRANSPOSE_MEMORY_ERROR -1011 /* Callback logical functions of one, two, or three arguments are used * to select eigenvalues to sort to the top left of the Schur form. * The value is selected if function returns TRUE (non-zero). */ typedef lapack_logical (*LAPACK_S_SELECT2) ( const float*, const float* ); typedef lapack_logical (*LAPACK_S_SELECT3) ( const float*, const float*, const float* ); typedef lapack_logical (*LAPACK_D_SELECT2) ( const double*, const double* ); typedef lapack_logical (*LAPACK_D_SELECT3) ( const double*, const double*, const double* ); typedef lapack_logical (*LAPACK_C_SELECT1) ( const lapack_complex_float* ); typedef lapack_logical (*LAPACK_C_SELECT2) ( const lapack_complex_float*, const lapack_complex_float* ); typedef lapack_logical (*LAPACK_Z_SELECT1) ( const lapack_complex_double* ); typedef lapack_logical (*LAPACK_Z_SELECT2) ( const lapack_complex_double*, const lapack_complex_double* ); #include "lapacke_mangling.h" #define LAPACK_lsame LAPACK_GLOBAL(lsame,LSAME) lapack_logical LAPACK_lsame( char* ca, char* cb, lapack_int lca, lapack_int lcb ); /* C-LAPACK function prototypes */ lapack_int LAPACKE_sbdsdc( int matrix_order, char uplo, char compq, lapack_int n, float* d, float* e, float* u, lapack_int ldu, float* vt, lapack_int ldvt, float* q, lapack_int* iq ); lapack_int LAPACKE_dbdsdc( int matrix_order, char uplo, char compq, lapack_int n, double* d, double* e, double* u, lapack_int ldu, double* vt, lapack_int ldvt, double* q, lapack_int* iq ); lapack_int LAPACKE_sbdsqr( int matrix_order, char uplo, lapack_int n, lapack_int ncvt, lapack_int nru, lapack_int ncc, float* d, float* e, float* vt, lapack_int ldvt, float* u, lapack_int ldu, float* c, lapack_int ldc ); lapack_int LAPACKE_dbdsqr( int matrix_order, char uplo, lapack_int n, lapack_int ncvt, lapack_int nru, lapack_int ncc, double* d, double* e, double* vt, lapack_int ldvt, double* u, lapack_int ldu, double* c, lapack_int ldc ); lapack_int LAPACKE_cbdsqr( int matrix_order, char uplo, lapack_int n, lapack_int ncvt, lapack_int nru, lapack_int ncc, float* d, float* e, lapack_complex_float* vt, lapack_int ldvt, lapack_complex_float* u, lapack_int ldu, lapack_complex_float* c, lapack_int ldc ); lapack_int LAPACKE_zbdsqr( int matrix_order, char uplo, lapack_int n, lapack_int ncvt, lapack_int nru, lapack_int ncc, double* d, double* e, lapack_complex_double* vt, lapack_int ldvt, lapack_complex_double* u, lapack_int ldu, lapack_complex_double* c, lapack_int ldc ); lapack_int LAPACKE_sdisna( char job, lapack_int m, lapack_int n, const float* d, float* sep ); lapack_int LAPACKE_ddisna( char job, lapack_int m, lapack_int n, const double* d, double* sep ); lapack_int LAPACKE_sgbbrd( int matrix_order, char vect, lapack_int m, lapack_int n, lapack_int ncc, lapack_int kl, lapack_int ku, float* ab, lapack_int ldab, float* d, float* e, float* q, lapack_int ldq, float* pt, lapack_int ldpt, float* c, lapack_int ldc ); lapack_int LAPACKE_dgbbrd( int matrix_order, char vect, lapack_int m, lapack_int n, lapack_int ncc, lapack_int kl, lapack_int ku, double* ab, lapack_int ldab, double* d, double* e, double* q, lapack_int ldq, double* pt, lapack_int ldpt, double* c, lapack_int ldc ); lapack_int LAPACKE_cgbbrd( int matrix_order, char vect, lapack_int m, lapack_int n, lapack_int ncc, lapack_int kl, lapack_int ku, lapack_complex_float* ab, lapack_int ldab, float* d, float* e, lapack_complex_float* q, lapack_int ldq, lapack_complex_float* pt, lapack_int ldpt, lapack_complex_float* c, lapack_int ldc ); lapack_int LAPACKE_zgbbrd( int matrix_order, char vect, lapack_int m, lapack_int n, lapack_int ncc, lapack_int kl, lapack_int ku, lapack_complex_double* ab, lapack_int ldab, double* d, double* e, lapack_complex_double* q, lapack_int ldq, lapack_complex_double* pt, lapack_int ldpt, lapack_complex_double* c, lapack_int ldc ); lapack_int LAPACKE_sgbcon( int matrix_order, char norm, lapack_int n, lapack_int kl, lapack_int ku, const float* ab, lapack_int ldab, const lapack_int* ipiv, float anorm, float* rcond ); lapack_int LAPACKE_dgbcon( int matrix_order, char norm, lapack_int n, lapack_int kl, lapack_int ku, const double* ab, lapack_int ldab, const lapack_int* ipiv, double anorm, double* rcond ); lapack_int LAPACKE_cgbcon( int matrix_order, char norm, lapack_int n, lapack_int kl, lapack_int ku, const lapack_complex_float* ab, lapack_int ldab, const lapack_int* ipiv, float anorm, float* rcond ); lapack_int LAPACKE_zgbcon( int matrix_order, char norm, lapack_int n, lapack_int kl, lapack_int ku, const lapack_complex_double* ab, lapack_int ldab, const lapack_int* ipiv, double anorm, double* rcond ); lapack_int LAPACKE_sgbequ( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const float* ab, lapack_int ldab, float* r, float* c, float* rowcnd, float* colcnd, float* amax ); lapack_int LAPACKE_dgbequ( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const double* ab, lapack_int ldab, double* r, double* c, double* rowcnd, double* colcnd, double* amax ); lapack_int LAPACKE_cgbequ( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const lapack_complex_float* ab, lapack_int ldab, float* r, float* c, float* rowcnd, float* colcnd, float* amax ); lapack_int LAPACKE_zgbequ( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const lapack_complex_double* ab, lapack_int ldab, double* r, double* c, double* rowcnd, double* colcnd, double* amax ); lapack_int LAPACKE_sgbequb( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const float* ab, lapack_int ldab, float* r, float* c, float* rowcnd, float* colcnd, float* amax ); lapack_int LAPACKE_dgbequb( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const double* ab, lapack_int ldab, double* r, double* c, double* rowcnd, double* colcnd, double* amax ); lapack_int LAPACKE_cgbequb( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const lapack_complex_float* ab, lapack_int ldab, float* r, float* c, float* rowcnd, float* colcnd, float* amax ); lapack_int LAPACKE_zgbequb( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const lapack_complex_double* ab, lapack_int ldab, double* r, double* c, double* rowcnd, double* colcnd, double* amax ); lapack_int LAPACKE_sgbrfs( int matrix_order, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const float* ab, lapack_int ldab, const float* afb, lapack_int ldafb, const lapack_int* ipiv, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_dgbrfs( int matrix_order, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const double* ab, lapack_int ldab, const double* afb, lapack_int ldafb, const lapack_int* ipiv, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_cgbrfs( int matrix_order, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const lapack_complex_float* ab, lapack_int ldab, const lapack_complex_float* afb, lapack_int ldafb, const lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_zgbrfs( int matrix_order, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const lapack_complex_double* ab, lapack_int ldab, const lapack_complex_double* afb, lapack_int ldafb, const lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_sgbrfsx( int matrix_order, char trans, char equed, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const float* ab, lapack_int ldab, const float* afb, lapack_int ldafb, const lapack_int* ipiv, const float* r, const float* c, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params ); lapack_int LAPACKE_dgbrfsx( int matrix_order, char trans, char equed, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const double* ab, lapack_int ldab, const double* afb, lapack_int ldafb, const lapack_int* ipiv, const double* r, const double* c, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params ); lapack_int LAPACKE_cgbrfsx( int matrix_order, char trans, char equed, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const lapack_complex_float* ab, lapack_int ldab, const lapack_complex_float* afb, lapack_int ldafb, const lapack_int* ipiv, const float* r, const float* c, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params ); lapack_int LAPACKE_zgbrfsx( int matrix_order, char trans, char equed, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const lapack_complex_double* ab, lapack_int ldab, const lapack_complex_double* afb, lapack_int ldafb, const lapack_int* ipiv, const double* r, const double* c, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params ); lapack_int LAPACKE_sgbsv( int matrix_order, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, float* ab, lapack_int ldab, lapack_int* ipiv, float* b, lapack_int ldb ); lapack_int LAPACKE_dgbsv( int matrix_order, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, double* ab, lapack_int ldab, lapack_int* ipiv, double* b, lapack_int ldb ); lapack_int LAPACKE_cgbsv( int matrix_order, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, lapack_complex_float* ab, lapack_int ldab, lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zgbsv( int matrix_order, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, lapack_complex_double* ab, lapack_int ldab, lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_sgbsvx( int matrix_order, char fact, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, float* ab, lapack_int ldab, float* afb, lapack_int ldafb, lapack_int* ipiv, char* equed, float* r, float* c, float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, float* rpivot ); lapack_int LAPACKE_dgbsvx( int matrix_order, char fact, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, double* ab, lapack_int ldab, double* afb, lapack_int ldafb, lapack_int* ipiv, char* equed, double* r, double* c, double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, double* rpivot ); lapack_int LAPACKE_cgbsvx( int matrix_order, char fact, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, lapack_complex_float* ab, lapack_int ldab, lapack_complex_float* afb, lapack_int ldafb, lapack_int* ipiv, char* equed, float* r, float* c, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, float* rpivot ); lapack_int LAPACKE_zgbsvx( int matrix_order, char fact, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, lapack_complex_double* ab, lapack_int ldab, lapack_complex_double* afb, lapack_int ldafb, lapack_int* ipiv, char* equed, double* r, double* c, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, double* rpivot ); lapack_int LAPACKE_sgbsvxx( int matrix_order, char fact, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, float* ab, lapack_int ldab, float* afb, lapack_int ldafb, lapack_int* ipiv, char* equed, float* r, float* c, float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* rpvgrw, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params ); lapack_int LAPACKE_dgbsvxx( int matrix_order, char fact, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, double* ab, lapack_int ldab, double* afb, lapack_int ldafb, lapack_int* ipiv, char* equed, double* r, double* c, double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* rpvgrw, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params ); lapack_int LAPACKE_cgbsvxx( int matrix_order, char fact, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, lapack_complex_float* ab, lapack_int ldab, lapack_complex_float* afb, lapack_int ldafb, lapack_int* ipiv, char* equed, float* r, float* c, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* rpvgrw, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params ); lapack_int LAPACKE_zgbsvxx( int matrix_order, char fact, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, lapack_complex_double* ab, lapack_int ldab, lapack_complex_double* afb, lapack_int ldafb, lapack_int* ipiv, char* equed, double* r, double* c, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* rpvgrw, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params ); lapack_int LAPACKE_sgbtrf( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, float* ab, lapack_int ldab, lapack_int* ipiv ); lapack_int LAPACKE_dgbtrf( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, double* ab, lapack_int ldab, lapack_int* ipiv ); lapack_int LAPACKE_cgbtrf( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, lapack_complex_float* ab, lapack_int ldab, lapack_int* ipiv ); lapack_int LAPACKE_zgbtrf( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, lapack_complex_double* ab, lapack_int ldab, lapack_int* ipiv ); lapack_int LAPACKE_sgbtrs( int matrix_order, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const float* ab, lapack_int ldab, const lapack_int* ipiv, float* b, lapack_int ldb ); lapack_int LAPACKE_dgbtrs( int matrix_order, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const double* ab, lapack_int ldab, const lapack_int* ipiv, double* b, lapack_int ldb ); lapack_int LAPACKE_cgbtrs( int matrix_order, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const lapack_complex_float* ab, lapack_int ldab, const lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zgbtrs( int matrix_order, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const lapack_complex_double* ab, lapack_int ldab, const lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_sgebak( int matrix_order, char job, char side, lapack_int n, lapack_int ilo, lapack_int ihi, const float* scale, lapack_int m, float* v, lapack_int ldv ); lapack_int LAPACKE_dgebak( int matrix_order, char job, char side, lapack_int n, lapack_int ilo, lapack_int ihi, const double* scale, lapack_int m, double* v, lapack_int ldv ); lapack_int LAPACKE_cgebak( int matrix_order, char job, char side, lapack_int n, lapack_int ilo, lapack_int ihi, const float* scale, lapack_int m, lapack_complex_float* v, lapack_int ldv ); lapack_int LAPACKE_zgebak( int matrix_order, char job, char side, lapack_int n, lapack_int ilo, lapack_int ihi, const double* scale, lapack_int m, lapack_complex_double* v, lapack_int ldv ); lapack_int LAPACKE_sgebal( int matrix_order, char job, lapack_int n, float* a, lapack_int lda, lapack_int* ilo, lapack_int* ihi, float* scale ); lapack_int LAPACKE_dgebal( int matrix_order, char job, lapack_int n, double* a, lapack_int lda, lapack_int* ilo, lapack_int* ihi, double* scale ); lapack_int LAPACKE_cgebal( int matrix_order, char job, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_int* ilo, lapack_int* ihi, float* scale ); lapack_int LAPACKE_zgebal( int matrix_order, char job, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_int* ilo, lapack_int* ihi, double* scale ); lapack_int LAPACKE_sgebrd( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* d, float* e, float* tauq, float* taup ); lapack_int LAPACKE_dgebrd( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* d, double* e, double* tauq, double* taup ); lapack_int LAPACKE_cgebrd( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, float* d, float* e, lapack_complex_float* tauq, lapack_complex_float* taup ); lapack_int LAPACKE_zgebrd( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, double* d, double* e, lapack_complex_double* tauq, lapack_complex_double* taup ); lapack_int LAPACKE_sgecon( int matrix_order, char norm, lapack_int n, const float* a, lapack_int lda, float anorm, float* rcond ); lapack_int LAPACKE_dgecon( int matrix_order, char norm, lapack_int n, const double* a, lapack_int lda, double anorm, double* rcond ); lapack_int LAPACKE_cgecon( int matrix_order, char norm, lapack_int n, const lapack_complex_float* a, lapack_int lda, float anorm, float* rcond ); lapack_int LAPACKE_zgecon( int matrix_order, char norm, lapack_int n, const lapack_complex_double* a, lapack_int lda, double anorm, double* rcond ); lapack_int LAPACKE_sgeequ( int matrix_order, lapack_int m, lapack_int n, const float* a, lapack_int lda, float* r, float* c, float* rowcnd, float* colcnd, float* amax ); lapack_int LAPACKE_dgeequ( int matrix_order, lapack_int m, lapack_int n, const double* a, lapack_int lda, double* r, double* c, double* rowcnd, double* colcnd, double* amax ); lapack_int LAPACKE_cgeequ( int matrix_order, lapack_int m, lapack_int n, const lapack_complex_float* a, lapack_int lda, float* r, float* c, float* rowcnd, float* colcnd, float* amax ); lapack_int LAPACKE_zgeequ( int matrix_order, lapack_int m, lapack_int n, const lapack_complex_double* a, lapack_int lda, double* r, double* c, double* rowcnd, double* colcnd, double* amax ); lapack_int LAPACKE_sgeequb( int matrix_order, lapack_int m, lapack_int n, const float* a, lapack_int lda, float* r, float* c, float* rowcnd, float* colcnd, float* amax ); lapack_int LAPACKE_dgeequb( int matrix_order, lapack_int m, lapack_int n, const double* a, lapack_int lda, double* r, double* c, double* rowcnd, double* colcnd, double* amax ); lapack_int LAPACKE_cgeequb( int matrix_order, lapack_int m, lapack_int n, const lapack_complex_float* a, lapack_int lda, float* r, float* c, float* rowcnd, float* colcnd, float* amax ); lapack_int LAPACKE_zgeequb( int matrix_order, lapack_int m, lapack_int n, const lapack_complex_double* a, lapack_int lda, double* r, double* c, double* rowcnd, double* colcnd, double* amax ); lapack_int LAPACKE_sgees( int matrix_order, char jobvs, char sort, LAPACK_S_SELECT2 select, lapack_int n, float* a, lapack_int lda, lapack_int* sdim, float* wr, float* wi, float* vs, lapack_int ldvs ); lapack_int LAPACKE_dgees( int matrix_order, char jobvs, char sort, LAPACK_D_SELECT2 select, lapack_int n, double* a, lapack_int lda, lapack_int* sdim, double* wr, double* wi, double* vs, lapack_int ldvs ); lapack_int LAPACKE_cgees( int matrix_order, char jobvs, char sort, LAPACK_C_SELECT1 select, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_int* sdim, lapack_complex_float* w, lapack_complex_float* vs, lapack_int ldvs ); lapack_int LAPACKE_zgees( int matrix_order, char jobvs, char sort, LAPACK_Z_SELECT1 select, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_int* sdim, lapack_complex_double* w, lapack_complex_double* vs, lapack_int ldvs ); lapack_int LAPACKE_sgeesx( int matrix_order, char jobvs, char sort, LAPACK_S_SELECT2 select, char sense, lapack_int n, float* a, lapack_int lda, lapack_int* sdim, float* wr, float* wi, float* vs, lapack_int ldvs, float* rconde, float* rcondv ); lapack_int LAPACKE_dgeesx( int matrix_order, char jobvs, char sort, LAPACK_D_SELECT2 select, char sense, lapack_int n, double* a, lapack_int lda, lapack_int* sdim, double* wr, double* wi, double* vs, lapack_int ldvs, double* rconde, double* rcondv ); lapack_int LAPACKE_cgeesx( int matrix_order, char jobvs, char sort, LAPACK_C_SELECT1 select, char sense, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_int* sdim, lapack_complex_float* w, lapack_complex_float* vs, lapack_int ldvs, float* rconde, float* rcondv ); lapack_int LAPACKE_zgeesx( int matrix_order, char jobvs, char sort, LAPACK_Z_SELECT1 select, char sense, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_int* sdim, lapack_complex_double* w, lapack_complex_double* vs, lapack_int ldvs, double* rconde, double* rcondv ); lapack_int LAPACKE_sgeev( int matrix_order, char jobvl, char jobvr, lapack_int n, float* a, lapack_int lda, float* wr, float* wi, float* vl, lapack_int ldvl, float* vr, lapack_int ldvr ); lapack_int LAPACKE_dgeev( int matrix_order, char jobvl, char jobvr, lapack_int n, double* a, lapack_int lda, double* wr, double* wi, double* vl, lapack_int ldvl, double* vr, lapack_int ldvr ); lapack_int LAPACKE_cgeev( int matrix_order, char jobvl, char jobvr, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* w, lapack_complex_float* vl, lapack_int ldvl, lapack_complex_float* vr, lapack_int ldvr ); lapack_int LAPACKE_zgeev( int matrix_order, char jobvl, char jobvr, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* w, lapack_complex_double* vl, lapack_int ldvl, lapack_complex_double* vr, lapack_int ldvr ); lapack_int LAPACKE_sgeevx( int matrix_order, char balanc, char jobvl, char jobvr, char sense, lapack_int n, float* a, lapack_int lda, float* wr, float* wi, float* vl, lapack_int ldvl, float* vr, lapack_int ldvr, lapack_int* ilo, lapack_int* ihi, float* scale, float* abnrm, float* rconde, float* rcondv ); lapack_int LAPACKE_dgeevx( int matrix_order, char balanc, char jobvl, char jobvr, char sense, lapack_int n, double* a, lapack_int lda, double* wr, double* wi, double* vl, lapack_int ldvl, double* vr, lapack_int ldvr, lapack_int* ilo, lapack_int* ihi, double* scale, double* abnrm, double* rconde, double* rcondv ); lapack_int LAPACKE_cgeevx( int matrix_order, char balanc, char jobvl, char jobvr, char sense, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* w, lapack_complex_float* vl, lapack_int ldvl, lapack_complex_float* vr, lapack_int ldvr, lapack_int* ilo, lapack_int* ihi, float* scale, float* abnrm, float* rconde, float* rcondv ); lapack_int LAPACKE_zgeevx( int matrix_order, char balanc, char jobvl, char jobvr, char sense, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* w, lapack_complex_double* vl, lapack_int ldvl, lapack_complex_double* vr, lapack_int ldvr, lapack_int* ilo, lapack_int* ihi, double* scale, double* abnrm, double* rconde, double* rcondv ); lapack_int LAPACKE_sgehrd( int matrix_order, lapack_int n, lapack_int ilo, lapack_int ihi, float* a, lapack_int lda, float* tau ); lapack_int LAPACKE_dgehrd( int matrix_order, lapack_int n, lapack_int ilo, lapack_int ihi, double* a, lapack_int lda, double* tau ); lapack_int LAPACKE_cgehrd( int matrix_order, lapack_int n, lapack_int ilo, lapack_int ihi, lapack_complex_float* a, lapack_int lda, lapack_complex_float* tau ); lapack_int LAPACKE_zgehrd( int matrix_order, lapack_int n, lapack_int ilo, lapack_int ihi, lapack_complex_double* a, lapack_int lda, lapack_complex_double* tau ); lapack_int LAPACKE_sgejsv( int matrix_order, char joba, char jobu, char jobv, char jobr, char jobt, char jobp, lapack_int m, lapack_int n, float* a, lapack_int lda, float* sva, float* u, lapack_int ldu, float* v, lapack_int ldv, float* stat, lapack_int* istat ); lapack_int LAPACKE_dgejsv( int matrix_order, char joba, char jobu, char jobv, char jobr, char jobt, char jobp, lapack_int m, lapack_int n, double* a, lapack_int lda, double* sva, double* u, lapack_int ldu, double* v, lapack_int ldv, double* stat, lapack_int* istat ); lapack_int LAPACKE_sgelq2( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* tau ); lapack_int LAPACKE_dgelq2( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* tau ); lapack_int LAPACKE_cgelq2( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* tau ); lapack_int LAPACKE_zgelq2( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* tau ); lapack_int LAPACKE_sgelqf( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* tau ); lapack_int LAPACKE_dgelqf( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* tau ); lapack_int LAPACKE_cgelqf( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* tau ); lapack_int LAPACKE_zgelqf( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* tau ); lapack_int LAPACKE_sgels( int matrix_order, char trans, lapack_int m, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, float* b, lapack_int ldb ); lapack_int LAPACKE_dgels( int matrix_order, char trans, lapack_int m, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* b, lapack_int ldb ); lapack_int LAPACKE_cgels( int matrix_order, char trans, lapack_int m, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zgels( int matrix_order, char trans, lapack_int m, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_sgelsd( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, float* b, lapack_int ldb, float* s, float rcond, lapack_int* rank ); lapack_int LAPACKE_dgelsd( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* b, lapack_int ldb, double* s, double rcond, lapack_int* rank ); lapack_int LAPACKE_cgelsd( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, float* s, float rcond, lapack_int* rank ); lapack_int LAPACKE_zgelsd( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, double* s, double rcond, lapack_int* rank ); lapack_int LAPACKE_sgelss( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, float* b, lapack_int ldb, float* s, float rcond, lapack_int* rank ); lapack_int LAPACKE_dgelss( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* b, lapack_int ldb, double* s, double rcond, lapack_int* rank ); lapack_int LAPACKE_cgelss( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, float* s, float rcond, lapack_int* rank ); lapack_int LAPACKE_zgelss( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, double* s, double rcond, lapack_int* rank ); lapack_int LAPACKE_sgelsy( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, float* b, lapack_int ldb, lapack_int* jpvt, float rcond, lapack_int* rank ); lapack_int LAPACKE_dgelsy( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* b, lapack_int ldb, lapack_int* jpvt, double rcond, lapack_int* rank ); lapack_int LAPACKE_cgelsy( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_int* jpvt, float rcond, lapack_int* rank ); lapack_int LAPACKE_zgelsy( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_int* jpvt, double rcond, lapack_int* rank ); lapack_int LAPACKE_sgeqlf( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* tau ); lapack_int LAPACKE_dgeqlf( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* tau ); lapack_int LAPACKE_cgeqlf( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* tau ); lapack_int LAPACKE_zgeqlf( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* tau ); lapack_int LAPACKE_sgeqp3( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, lapack_int* jpvt, float* tau ); lapack_int LAPACKE_dgeqp3( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, lapack_int* jpvt, double* tau ); lapack_int LAPACKE_cgeqp3( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_int* jpvt, lapack_complex_float* tau ); lapack_int LAPACKE_zgeqp3( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_int* jpvt, lapack_complex_double* tau ); lapack_int LAPACKE_sgeqpf( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, lapack_int* jpvt, float* tau ); lapack_int LAPACKE_dgeqpf( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, lapack_int* jpvt, double* tau ); lapack_int LAPACKE_cgeqpf( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_int* jpvt, lapack_complex_float* tau ); lapack_int LAPACKE_zgeqpf( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_int* jpvt, lapack_complex_double* tau ); lapack_int LAPACKE_sgeqr2( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* tau ); lapack_int LAPACKE_dgeqr2( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* tau ); lapack_int LAPACKE_cgeqr2( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* tau ); lapack_int LAPACKE_zgeqr2( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* tau ); lapack_int LAPACKE_sgeqrf( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* tau ); lapack_int LAPACKE_dgeqrf( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* tau ); lapack_int LAPACKE_cgeqrf( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* tau ); lapack_int LAPACKE_zgeqrf( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* tau ); lapack_int LAPACKE_sgeqrfp( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* tau ); lapack_int LAPACKE_dgeqrfp( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* tau ); lapack_int LAPACKE_cgeqrfp( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* tau ); lapack_int LAPACKE_zgeqrfp( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* tau ); lapack_int LAPACKE_sgerfs( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, const float* af, lapack_int ldaf, const lapack_int* ipiv, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_dgerfs( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, const double* af, lapack_int ldaf, const lapack_int* ipiv, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_cgerfs( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* af, lapack_int ldaf, const lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_zgerfs( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* af, lapack_int ldaf, const lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_sgerfsx( int matrix_order, char trans, char equed, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, const float* af, lapack_int ldaf, const lapack_int* ipiv, const float* r, const float* c, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params ); lapack_int LAPACKE_dgerfsx( int matrix_order, char trans, char equed, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, const double* af, lapack_int ldaf, const lapack_int* ipiv, const double* r, const double* c, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params ); lapack_int LAPACKE_cgerfsx( int matrix_order, char trans, char equed, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* af, lapack_int ldaf, const lapack_int* ipiv, const float* r, const float* c, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params ); lapack_int LAPACKE_zgerfsx( int matrix_order, char trans, char equed, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* af, lapack_int ldaf, const lapack_int* ipiv, const double* r, const double* c, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params ); lapack_int LAPACKE_sgerqf( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* tau ); lapack_int LAPACKE_dgerqf( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* tau ); lapack_int LAPACKE_cgerqf( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* tau ); lapack_int LAPACKE_zgerqf( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* tau ); lapack_int LAPACKE_sgesdd( int matrix_order, char jobz, lapack_int m, lapack_int n, float* a, lapack_int lda, float* s, float* u, lapack_int ldu, float* vt, lapack_int ldvt ); lapack_int LAPACKE_dgesdd( int matrix_order, char jobz, lapack_int m, lapack_int n, double* a, lapack_int lda, double* s, double* u, lapack_int ldu, double* vt, lapack_int ldvt ); lapack_int LAPACKE_cgesdd( int matrix_order, char jobz, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, float* s, lapack_complex_float* u, lapack_int ldu, lapack_complex_float* vt, lapack_int ldvt ); lapack_int LAPACKE_zgesdd( int matrix_order, char jobz, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, double* s, lapack_complex_double* u, lapack_int ldu, lapack_complex_double* vt, lapack_int ldvt ); lapack_int LAPACKE_sgesv( int matrix_order, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, lapack_int* ipiv, float* b, lapack_int ldb ); lapack_int LAPACKE_dgesv( int matrix_order, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, lapack_int* ipiv, double* b, lapack_int ldb ); lapack_int LAPACKE_cgesv( int matrix_order, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zgesv( int matrix_order, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_dsgesv( int matrix_order, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, lapack_int* ipiv, double* b, lapack_int ldb, double* x, lapack_int ldx, lapack_int* iter ); lapack_int LAPACKE_zcgesv( int matrix_order, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, lapack_int* iter ); lapack_int LAPACKE_sgesvd( int matrix_order, char jobu, char jobvt, lapack_int m, lapack_int n, float* a, lapack_int lda, float* s, float* u, lapack_int ldu, float* vt, lapack_int ldvt, float* superb ); lapack_int LAPACKE_dgesvd( int matrix_order, char jobu, char jobvt, lapack_int m, lapack_int n, double* a, lapack_int lda, double* s, double* u, lapack_int ldu, double* vt, lapack_int ldvt, double* superb ); lapack_int LAPACKE_cgesvd( int matrix_order, char jobu, char jobvt, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, float* s, lapack_complex_float* u, lapack_int ldu, lapack_complex_float* vt, lapack_int ldvt, float* superb ); lapack_int LAPACKE_zgesvd( int matrix_order, char jobu, char jobvt, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, double* s, lapack_complex_double* u, lapack_int ldu, lapack_complex_double* vt, lapack_int ldvt, double* superb ); lapack_int LAPACKE_sgesvj( int matrix_order, char joba, char jobu, char jobv, lapack_int m, lapack_int n, float* a, lapack_int lda, float* sva, lapack_int mv, float* v, lapack_int ldv, float* stat ); lapack_int LAPACKE_dgesvj( int matrix_order, char joba, char jobu, char jobv, lapack_int m, lapack_int n, double* a, lapack_int lda, double* sva, lapack_int mv, double* v, lapack_int ldv, double* stat ); lapack_int LAPACKE_sgesvx( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, float* af, lapack_int ldaf, lapack_int* ipiv, char* equed, float* r, float* c, float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, float* rpivot ); lapack_int LAPACKE_dgesvx( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* af, lapack_int ldaf, lapack_int* ipiv, char* equed, double* r, double* c, double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, double* rpivot ); lapack_int LAPACKE_cgesvx( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* af, lapack_int ldaf, lapack_int* ipiv, char* equed, float* r, float* c, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, float* rpivot ); lapack_int LAPACKE_zgesvx( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* af, lapack_int ldaf, lapack_int* ipiv, char* equed, double* r, double* c, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, double* rpivot ); lapack_int LAPACKE_sgesvxx( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, float* af, lapack_int ldaf, lapack_int* ipiv, char* equed, float* r, float* c, float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* rpvgrw, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params ); lapack_int LAPACKE_dgesvxx( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* af, lapack_int ldaf, lapack_int* ipiv, char* equed, double* r, double* c, double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* rpvgrw, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params ); lapack_int LAPACKE_cgesvxx( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* af, lapack_int ldaf, lapack_int* ipiv, char* equed, float* r, float* c, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* rpvgrw, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params ); lapack_int LAPACKE_zgesvxx( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* af, lapack_int ldaf, lapack_int* ipiv, char* equed, double* r, double* c, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* rpvgrw, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params ); lapack_int LAPACKE_sgetf2( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, lapack_int* ipiv ); lapack_int LAPACKE_dgetf2( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, lapack_int* ipiv ); lapack_int LAPACKE_cgetf2( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_int* ipiv ); lapack_int LAPACKE_zgetf2( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_int* ipiv ); lapack_int LAPACKE_sgetrf( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, lapack_int* ipiv ); lapack_int LAPACKE_dgetrf( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, lapack_int* ipiv ); lapack_int LAPACKE_cgetrf( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_int* ipiv ); lapack_int LAPACKE_zgetrf( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_int* ipiv ); lapack_int LAPACKE_sgetri( int matrix_order, lapack_int n, float* a, lapack_int lda, const lapack_int* ipiv ); lapack_int LAPACKE_dgetri( int matrix_order, lapack_int n, double* a, lapack_int lda, const lapack_int* ipiv ); lapack_int LAPACKE_cgetri( int matrix_order, lapack_int n, lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv ); lapack_int LAPACKE_zgetri( int matrix_order, lapack_int n, lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv ); lapack_int LAPACKE_sgetrs( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, const lapack_int* ipiv, float* b, lapack_int ldb ); lapack_int LAPACKE_dgetrs( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, const lapack_int* ipiv, double* b, lapack_int ldb ); lapack_int LAPACKE_cgetrs( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zgetrs( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_sggbak( int matrix_order, char job, char side, lapack_int n, lapack_int ilo, lapack_int ihi, const float* lscale, const float* rscale, lapack_int m, float* v, lapack_int ldv ); lapack_int LAPACKE_dggbak( int matrix_order, char job, char side, lapack_int n, lapack_int ilo, lapack_int ihi, const double* lscale, const double* rscale, lapack_int m, double* v, lapack_int ldv ); lapack_int LAPACKE_cggbak( int matrix_order, char job, char side, lapack_int n, lapack_int ilo, lapack_int ihi, const float* lscale, const float* rscale, lapack_int m, lapack_complex_float* v, lapack_int ldv ); lapack_int LAPACKE_zggbak( int matrix_order, char job, char side, lapack_int n, lapack_int ilo, lapack_int ihi, const double* lscale, const double* rscale, lapack_int m, lapack_complex_double* v, lapack_int ldv ); lapack_int LAPACKE_sggbal( int matrix_order, char job, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, lapack_int* ilo, lapack_int* ihi, float* lscale, float* rscale ); lapack_int LAPACKE_dggbal( int matrix_order, char job, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, lapack_int* ilo, lapack_int* ihi, double* lscale, double* rscale ); lapack_int LAPACKE_cggbal( int matrix_order, char job, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_int* ilo, lapack_int* ihi, float* lscale, float* rscale ); lapack_int LAPACKE_zggbal( int matrix_order, char job, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_int* ilo, lapack_int* ihi, double* lscale, double* rscale ); lapack_int LAPACKE_sgges( int matrix_order, char jobvsl, char jobvsr, char sort, LAPACK_S_SELECT3 selctg, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, lapack_int* sdim, float* alphar, float* alphai, float* beta, float* vsl, lapack_int ldvsl, float* vsr, lapack_int ldvsr ); lapack_int LAPACKE_dgges( int matrix_order, char jobvsl, char jobvsr, char sort, LAPACK_D_SELECT3 selctg, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, lapack_int* sdim, double* alphar, double* alphai, double* beta, double* vsl, lapack_int ldvsl, double* vsr, lapack_int ldvsr ); lapack_int LAPACKE_cgges( int matrix_order, char jobvsl, char jobvsr, char sort, LAPACK_C_SELECT2 selctg, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_int* sdim, lapack_complex_float* alpha, lapack_complex_float* beta, lapack_complex_float* vsl, lapack_int ldvsl, lapack_complex_float* vsr, lapack_int ldvsr ); lapack_int LAPACKE_zgges( int matrix_order, char jobvsl, char jobvsr, char sort, LAPACK_Z_SELECT2 selctg, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_int* sdim, lapack_complex_double* alpha, lapack_complex_double* beta, lapack_complex_double* vsl, lapack_int ldvsl, lapack_complex_double* vsr, lapack_int ldvsr ); lapack_int LAPACKE_sggesx( int matrix_order, char jobvsl, char jobvsr, char sort, LAPACK_S_SELECT3 selctg, char sense, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, lapack_int* sdim, float* alphar, float* alphai, float* beta, float* vsl, lapack_int ldvsl, float* vsr, lapack_int ldvsr, float* rconde, float* rcondv ); lapack_int LAPACKE_dggesx( int matrix_order, char jobvsl, char jobvsr, char sort, LAPACK_D_SELECT3 selctg, char sense, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, lapack_int* sdim, double* alphar, double* alphai, double* beta, double* vsl, lapack_int ldvsl, double* vsr, lapack_int ldvsr, double* rconde, double* rcondv ); lapack_int LAPACKE_cggesx( int matrix_order, char jobvsl, char jobvsr, char sort, LAPACK_C_SELECT2 selctg, char sense, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_int* sdim, lapack_complex_float* alpha, lapack_complex_float* beta, lapack_complex_float* vsl, lapack_int ldvsl, lapack_complex_float* vsr, lapack_int ldvsr, float* rconde, float* rcondv ); lapack_int LAPACKE_zggesx( int matrix_order, char jobvsl, char jobvsr, char sort, LAPACK_Z_SELECT2 selctg, char sense, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_int* sdim, lapack_complex_double* alpha, lapack_complex_double* beta, lapack_complex_double* vsl, lapack_int ldvsl, lapack_complex_double* vsr, lapack_int ldvsr, double* rconde, double* rcondv ); lapack_int LAPACKE_sggev( int matrix_order, char jobvl, char jobvr, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, float* alphar, float* alphai, float* beta, float* vl, lapack_int ldvl, float* vr, lapack_int ldvr ); lapack_int LAPACKE_dggev( int matrix_order, char jobvl, char jobvr, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, double* alphar, double* alphai, double* beta, double* vl, lapack_int ldvl, double* vr, lapack_int ldvr ); lapack_int LAPACKE_cggev( int matrix_order, char jobvl, char jobvr, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* alpha, lapack_complex_float* beta, lapack_complex_float* vl, lapack_int ldvl, lapack_complex_float* vr, lapack_int ldvr ); lapack_int LAPACKE_zggev( int matrix_order, char jobvl, char jobvr, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* alpha, lapack_complex_double* beta, lapack_complex_double* vl, lapack_int ldvl, lapack_complex_double* vr, lapack_int ldvr ); lapack_int LAPACKE_sggevx( int matrix_order, char balanc, char jobvl, char jobvr, char sense, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, float* alphar, float* alphai, float* beta, float* vl, lapack_int ldvl, float* vr, lapack_int ldvr, lapack_int* ilo, lapack_int* ihi, float* lscale, float* rscale, float* abnrm, float* bbnrm, float* rconde, float* rcondv ); lapack_int LAPACKE_dggevx( int matrix_order, char balanc, char jobvl, char jobvr, char sense, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, double* alphar, double* alphai, double* beta, double* vl, lapack_int ldvl, double* vr, lapack_int ldvr, lapack_int* ilo, lapack_int* ihi, double* lscale, double* rscale, double* abnrm, double* bbnrm, double* rconde, double* rcondv ); lapack_int LAPACKE_cggevx( int matrix_order, char balanc, char jobvl, char jobvr, char sense, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* alpha, lapack_complex_float* beta, lapack_complex_float* vl, lapack_int ldvl, lapack_complex_float* vr, lapack_int ldvr, lapack_int* ilo, lapack_int* ihi, float* lscale, float* rscale, float* abnrm, float* bbnrm, float* rconde, float* rcondv ); lapack_int LAPACKE_zggevx( int matrix_order, char balanc, char jobvl, char jobvr, char sense, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* alpha, lapack_complex_double* beta, lapack_complex_double* vl, lapack_int ldvl, lapack_complex_double* vr, lapack_int ldvr, lapack_int* ilo, lapack_int* ihi, double* lscale, double* rscale, double* abnrm, double* bbnrm, double* rconde, double* rcondv ); lapack_int LAPACKE_sggglm( int matrix_order, lapack_int n, lapack_int m, lapack_int p, float* a, lapack_int lda, float* b, lapack_int ldb, float* d, float* x, float* y ); lapack_int LAPACKE_dggglm( int matrix_order, lapack_int n, lapack_int m, lapack_int p, double* a, lapack_int lda, double* b, lapack_int ldb, double* d, double* x, double* y ); lapack_int LAPACKE_cggglm( int matrix_order, lapack_int n, lapack_int m, lapack_int p, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* d, lapack_complex_float* x, lapack_complex_float* y ); lapack_int LAPACKE_zggglm( int matrix_order, lapack_int n, lapack_int m, lapack_int p, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* d, lapack_complex_double* x, lapack_complex_double* y ); lapack_int LAPACKE_sgghrd( int matrix_order, char compq, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, float* a, lapack_int lda, float* b, lapack_int ldb, float* q, lapack_int ldq, float* z, lapack_int ldz ); lapack_int LAPACKE_dgghrd( int matrix_order, char compq, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, double* a, lapack_int lda, double* b, lapack_int ldb, double* q, lapack_int ldq, double* z, lapack_int ldz ); lapack_int LAPACKE_cgghrd( int matrix_order, char compq, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* q, lapack_int ldq, lapack_complex_float* z, lapack_int ldz ); lapack_int LAPACKE_zgghrd( int matrix_order, char compq, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* q, lapack_int ldq, lapack_complex_double* z, lapack_int ldz ); lapack_int LAPACKE_sgglse( int matrix_order, lapack_int m, lapack_int n, lapack_int p, float* a, lapack_int lda, float* b, lapack_int ldb, float* c, float* d, float* x ); lapack_int LAPACKE_dgglse( int matrix_order, lapack_int m, lapack_int n, lapack_int p, double* a, lapack_int lda, double* b, lapack_int ldb, double* c, double* d, double* x ); lapack_int LAPACKE_cgglse( int matrix_order, lapack_int m, lapack_int n, lapack_int p, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* c, lapack_complex_float* d, lapack_complex_float* x ); lapack_int LAPACKE_zgglse( int matrix_order, lapack_int m, lapack_int n, lapack_int p, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* c, lapack_complex_double* d, lapack_complex_double* x ); lapack_int LAPACKE_sggqrf( int matrix_order, lapack_int n, lapack_int m, lapack_int p, float* a, lapack_int lda, float* taua, float* b, lapack_int ldb, float* taub ); lapack_int LAPACKE_dggqrf( int matrix_order, lapack_int n, lapack_int m, lapack_int p, double* a, lapack_int lda, double* taua, double* b, lapack_int ldb, double* taub ); lapack_int LAPACKE_cggqrf( int matrix_order, lapack_int n, lapack_int m, lapack_int p, lapack_complex_float* a, lapack_int lda, lapack_complex_float* taua, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* taub ); lapack_int LAPACKE_zggqrf( int matrix_order, lapack_int n, lapack_int m, lapack_int p, lapack_complex_double* a, lapack_int lda, lapack_complex_double* taua, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* taub ); lapack_int LAPACKE_sggrqf( int matrix_order, lapack_int m, lapack_int p, lapack_int n, float* a, lapack_int lda, float* taua, float* b, lapack_int ldb, float* taub ); lapack_int LAPACKE_dggrqf( int matrix_order, lapack_int m, lapack_int p, lapack_int n, double* a, lapack_int lda, double* taua, double* b, lapack_int ldb, double* taub ); lapack_int LAPACKE_cggrqf( int matrix_order, lapack_int m, lapack_int p, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* taua, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* taub ); lapack_int LAPACKE_zggrqf( int matrix_order, lapack_int m, lapack_int p, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* taua, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* taub ); lapack_int LAPACKE_sggsvd( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int n, lapack_int p, lapack_int* k, lapack_int* l, float* a, lapack_int lda, float* b, lapack_int ldb, float* alpha, float* beta, float* u, lapack_int ldu, float* v, lapack_int ldv, float* q, lapack_int ldq, lapack_int* iwork ); lapack_int LAPACKE_dggsvd( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int n, lapack_int p, lapack_int* k, lapack_int* l, double* a, lapack_int lda, double* b, lapack_int ldb, double* alpha, double* beta, double* u, lapack_int ldu, double* v, lapack_int ldv, double* q, lapack_int ldq, lapack_int* iwork ); lapack_int LAPACKE_cggsvd( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int n, lapack_int p, lapack_int* k, lapack_int* l, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, float* alpha, float* beta, lapack_complex_float* u, lapack_int ldu, lapack_complex_float* v, lapack_int ldv, lapack_complex_float* q, lapack_int ldq, lapack_int* iwork ); lapack_int LAPACKE_zggsvd( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int n, lapack_int p, lapack_int* k, lapack_int* l, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, double* alpha, double* beta, lapack_complex_double* u, lapack_int ldu, lapack_complex_double* v, lapack_int ldv, lapack_complex_double* q, lapack_int ldq, lapack_int* iwork ); lapack_int LAPACKE_sggsvp( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int p, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, float tola, float tolb, lapack_int* k, lapack_int* l, float* u, lapack_int ldu, float* v, lapack_int ldv, float* q, lapack_int ldq ); lapack_int LAPACKE_dggsvp( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int p, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, double tola, double tolb, lapack_int* k, lapack_int* l, double* u, lapack_int ldu, double* v, lapack_int ldv, double* q, lapack_int ldq ); lapack_int LAPACKE_cggsvp( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int p, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, float tola, float tolb, lapack_int* k, lapack_int* l, lapack_complex_float* u, lapack_int ldu, lapack_complex_float* v, lapack_int ldv, lapack_complex_float* q, lapack_int ldq ); lapack_int LAPACKE_zggsvp( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int p, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, double tola, double tolb, lapack_int* k, lapack_int* l, lapack_complex_double* u, lapack_int ldu, lapack_complex_double* v, lapack_int ldv, lapack_complex_double* q, lapack_int ldq ); lapack_int LAPACKE_sgtcon( char norm, lapack_int n, const float* dl, const float* d, const float* du, const float* du2, const lapack_int* ipiv, float anorm, float* rcond ); lapack_int LAPACKE_dgtcon( char norm, lapack_int n, const double* dl, const double* d, const double* du, const double* du2, const lapack_int* ipiv, double anorm, double* rcond ); lapack_int LAPACKE_cgtcon( char norm, lapack_int n, const lapack_complex_float* dl, const lapack_complex_float* d, const lapack_complex_float* du, const lapack_complex_float* du2, const lapack_int* ipiv, float anorm, float* rcond ); lapack_int LAPACKE_zgtcon( char norm, lapack_int n, const lapack_complex_double* dl, const lapack_complex_double* d, const lapack_complex_double* du, const lapack_complex_double* du2, const lapack_int* ipiv, double anorm, double* rcond ); lapack_int LAPACKE_sgtrfs( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const float* dl, const float* d, const float* du, const float* dlf, const float* df, const float* duf, const float* du2, const lapack_int* ipiv, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_dgtrfs( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const double* dl, const double* d, const double* du, const double* dlf, const double* df, const double* duf, const double* du2, const lapack_int* ipiv, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_cgtrfs( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const lapack_complex_float* dl, const lapack_complex_float* d, const lapack_complex_float* du, const lapack_complex_float* dlf, const lapack_complex_float* df, const lapack_complex_float* duf, const lapack_complex_float* du2, const lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_zgtrfs( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const lapack_complex_double* dl, const lapack_complex_double* d, const lapack_complex_double* du, const lapack_complex_double* dlf, const lapack_complex_double* df, const lapack_complex_double* duf, const lapack_complex_double* du2, const lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_sgtsv( int matrix_order, lapack_int n, lapack_int nrhs, float* dl, float* d, float* du, float* b, lapack_int ldb ); lapack_int LAPACKE_dgtsv( int matrix_order, lapack_int n, lapack_int nrhs, double* dl, double* d, double* du, double* b, lapack_int ldb ); lapack_int LAPACKE_cgtsv( int matrix_order, lapack_int n, lapack_int nrhs, lapack_complex_float* dl, lapack_complex_float* d, lapack_complex_float* du, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zgtsv( int matrix_order, lapack_int n, lapack_int nrhs, lapack_complex_double* dl, lapack_complex_double* d, lapack_complex_double* du, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_sgtsvx( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, const float* dl, const float* d, const float* du, float* dlf, float* df, float* duf, float* du2, lapack_int* ipiv, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* ferr, float* berr ); lapack_int LAPACKE_dgtsvx( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, const double* dl, const double* d, const double* du, double* dlf, double* df, double* duf, double* du2, lapack_int* ipiv, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* ferr, double* berr ); lapack_int LAPACKE_cgtsvx( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, const lapack_complex_float* dl, const lapack_complex_float* d, const lapack_complex_float* du, lapack_complex_float* dlf, lapack_complex_float* df, lapack_complex_float* duf, lapack_complex_float* du2, lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr ); lapack_int LAPACKE_zgtsvx( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, const lapack_complex_double* dl, const lapack_complex_double* d, const lapack_complex_double* du, lapack_complex_double* dlf, lapack_complex_double* df, lapack_complex_double* duf, lapack_complex_double* du2, lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr ); lapack_int LAPACKE_sgttrf( lapack_int n, float* dl, float* d, float* du, float* du2, lapack_int* ipiv ); lapack_int LAPACKE_dgttrf( lapack_int n, double* dl, double* d, double* du, double* du2, lapack_int* ipiv ); lapack_int LAPACKE_cgttrf( lapack_int n, lapack_complex_float* dl, lapack_complex_float* d, lapack_complex_float* du, lapack_complex_float* du2, lapack_int* ipiv ); lapack_int LAPACKE_zgttrf( lapack_int n, lapack_complex_double* dl, lapack_complex_double* d, lapack_complex_double* du, lapack_complex_double* du2, lapack_int* ipiv ); lapack_int LAPACKE_sgttrs( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const float* dl, const float* d, const float* du, const float* du2, const lapack_int* ipiv, float* b, lapack_int ldb ); lapack_int LAPACKE_dgttrs( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const double* dl, const double* d, const double* du, const double* du2, const lapack_int* ipiv, double* b, lapack_int ldb ); lapack_int LAPACKE_cgttrs( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const lapack_complex_float* dl, const lapack_complex_float* d, const lapack_complex_float* du, const lapack_complex_float* du2, const lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zgttrs( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const lapack_complex_double* dl, const lapack_complex_double* d, const lapack_complex_double* du, const lapack_complex_double* du2, const lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_chbev( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int kd, lapack_complex_float* ab, lapack_int ldab, float* w, lapack_complex_float* z, lapack_int ldz ); lapack_int LAPACKE_zhbev( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int kd, lapack_complex_double* ab, lapack_int ldab, double* w, lapack_complex_double* z, lapack_int ldz ); lapack_int LAPACKE_chbevd( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int kd, lapack_complex_float* ab, lapack_int ldab, float* w, lapack_complex_float* z, lapack_int ldz ); lapack_int LAPACKE_zhbevd( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int kd, lapack_complex_double* ab, lapack_int ldab, double* w, lapack_complex_double* z, lapack_int ldz ); lapack_int LAPACKE_chbevx( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_int kd, lapack_complex_float* ab, lapack_int ldab, lapack_complex_float* q, lapack_int ldq, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_zhbevx( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_int kd, lapack_complex_double* ab, lapack_int ldab, lapack_complex_double* q, lapack_int ldq, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_chbgst( int matrix_order, char vect, char uplo, lapack_int n, lapack_int ka, lapack_int kb, lapack_complex_float* ab, lapack_int ldab, const lapack_complex_float* bb, lapack_int ldbb, lapack_complex_float* x, lapack_int ldx ); lapack_int LAPACKE_zhbgst( int matrix_order, char vect, char uplo, lapack_int n, lapack_int ka, lapack_int kb, lapack_complex_double* ab, lapack_int ldab, const lapack_complex_double* bb, lapack_int ldbb, lapack_complex_double* x, lapack_int ldx ); lapack_int LAPACKE_chbgv( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int ka, lapack_int kb, lapack_complex_float* ab, lapack_int ldab, lapack_complex_float* bb, lapack_int ldbb, float* w, lapack_complex_float* z, lapack_int ldz ); lapack_int LAPACKE_zhbgv( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int ka, lapack_int kb, lapack_complex_double* ab, lapack_int ldab, lapack_complex_double* bb, lapack_int ldbb, double* w, lapack_complex_double* z, lapack_int ldz ); lapack_int LAPACKE_chbgvd( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int ka, lapack_int kb, lapack_complex_float* ab, lapack_int ldab, lapack_complex_float* bb, lapack_int ldbb, float* w, lapack_complex_float* z, lapack_int ldz ); lapack_int LAPACKE_zhbgvd( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int ka, lapack_int kb, lapack_complex_double* ab, lapack_int ldab, lapack_complex_double* bb, lapack_int ldbb, double* w, lapack_complex_double* z, lapack_int ldz ); lapack_int LAPACKE_chbgvx( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_int ka, lapack_int kb, lapack_complex_float* ab, lapack_int ldab, lapack_complex_float* bb, lapack_int ldbb, lapack_complex_float* q, lapack_int ldq, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_zhbgvx( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_int ka, lapack_int kb, lapack_complex_double* ab, lapack_int ldab, lapack_complex_double* bb, lapack_int ldbb, lapack_complex_double* q, lapack_int ldq, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_chbtrd( int matrix_order, char vect, char uplo, lapack_int n, lapack_int kd, lapack_complex_float* ab, lapack_int ldab, float* d, float* e, lapack_complex_float* q, lapack_int ldq ); lapack_int LAPACKE_zhbtrd( int matrix_order, char vect, char uplo, lapack_int n, lapack_int kd, lapack_complex_double* ab, lapack_int ldab, double* d, double* e, lapack_complex_double* q, lapack_int ldq ); lapack_int LAPACKE_checon( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, float anorm, float* rcond ); lapack_int LAPACKE_zhecon( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, double anorm, double* rcond ); lapack_int LAPACKE_cheequb( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* a, lapack_int lda, float* s, float* scond, float* amax ); lapack_int LAPACKE_zheequb( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* a, lapack_int lda, double* s, double* scond, double* amax ); lapack_int LAPACKE_cheev( int matrix_order, char jobz, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, float* w ); lapack_int LAPACKE_zheev( int matrix_order, char jobz, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, double* w ); lapack_int LAPACKE_cheevd( int matrix_order, char jobz, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, float* w ); lapack_int LAPACKE_zheevd( int matrix_order, char jobz, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, double* w ); lapack_int LAPACKE_cheevr( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int ldz, lapack_int* isuppz ); lapack_int LAPACKE_zheevr( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int ldz, lapack_int* isuppz ); lapack_int LAPACKE_cheevx( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_zheevx( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_chegst( int matrix_order, lapack_int itype, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, const lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zhegst( int matrix_order, lapack_int itype, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, const lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_chegv( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, float* w ); lapack_int LAPACKE_zhegv( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, double* w ); lapack_int LAPACKE_chegvd( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, float* w ); lapack_int LAPACKE_zhegvd( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, double* w ); lapack_int LAPACKE_chegvx( int matrix_order, lapack_int itype, char jobz, char range, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_zhegvx( int matrix_order, lapack_int itype, char jobz, char range, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_cherfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* af, lapack_int ldaf, const lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_zherfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* af, lapack_int ldaf, const lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_cherfsx( int matrix_order, char uplo, char equed, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* af, lapack_int ldaf, const lapack_int* ipiv, const float* s, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params ); lapack_int LAPACKE_zherfsx( int matrix_order, char uplo, char equed, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* af, lapack_int ldaf, const lapack_int* ipiv, const double* s, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params ); lapack_int LAPACKE_chesv( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zhesv( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_chesvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, lapack_complex_float* af, lapack_int ldaf, lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr ); lapack_int LAPACKE_zhesvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, lapack_complex_double* af, lapack_int ldaf, lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr ); lapack_int LAPACKE_chesvxx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* af, lapack_int ldaf, lapack_int* ipiv, char* equed, float* s, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* rpvgrw, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params ); lapack_int LAPACKE_zhesvxx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* af, lapack_int ldaf, lapack_int* ipiv, char* equed, double* s, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* rpvgrw, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params ); lapack_int LAPACKE_chetrd( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, float* d, float* e, lapack_complex_float* tau ); lapack_int LAPACKE_zhetrd( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, double* d, double* e, lapack_complex_double* tau ); lapack_int LAPACKE_chetrf( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_int* ipiv ); lapack_int LAPACKE_zhetrf( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_int* ipiv ); lapack_int LAPACKE_chetri( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv ); lapack_int LAPACKE_zhetri( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv ); lapack_int LAPACKE_chetrs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zhetrs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_chfrk( int matrix_order, char transr, char uplo, char trans, lapack_int n, lapack_int k, float alpha, const lapack_complex_float* a, lapack_int lda, float beta, lapack_complex_float* c ); lapack_int LAPACKE_zhfrk( int matrix_order, char transr, char uplo, char trans, lapack_int n, lapack_int k, double alpha, const lapack_complex_double* a, lapack_int lda, double beta, lapack_complex_double* c ); lapack_int LAPACKE_shgeqz( int matrix_order, char job, char compq, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, float* h, lapack_int ldh, float* t, lapack_int ldt, float* alphar, float* alphai, float* beta, float* q, lapack_int ldq, float* z, lapack_int ldz ); lapack_int LAPACKE_dhgeqz( int matrix_order, char job, char compq, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, double* h, lapack_int ldh, double* t, lapack_int ldt, double* alphar, double* alphai, double* beta, double* q, lapack_int ldq, double* z, lapack_int ldz ); lapack_int LAPACKE_chgeqz( int matrix_order, char job, char compq, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, lapack_complex_float* h, lapack_int ldh, lapack_complex_float* t, lapack_int ldt, lapack_complex_float* alpha, lapack_complex_float* beta, lapack_complex_float* q, lapack_int ldq, lapack_complex_float* z, lapack_int ldz ); lapack_int LAPACKE_zhgeqz( int matrix_order, char job, char compq, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, lapack_complex_double* h, lapack_int ldh, lapack_complex_double* t, lapack_int ldt, lapack_complex_double* alpha, lapack_complex_double* beta, lapack_complex_double* q, lapack_int ldq, lapack_complex_double* z, lapack_int ldz ); lapack_int LAPACKE_chpcon( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* ap, const lapack_int* ipiv, float anorm, float* rcond ); lapack_int LAPACKE_zhpcon( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* ap, const lapack_int* ipiv, double anorm, double* rcond ); lapack_int LAPACKE_chpev( int matrix_order, char jobz, char uplo, lapack_int n, lapack_complex_float* ap, float* w, lapack_complex_float* z, lapack_int ldz ); lapack_int LAPACKE_zhpev( int matrix_order, char jobz, char uplo, lapack_int n, lapack_complex_double* ap, double* w, lapack_complex_double* z, lapack_int ldz ); lapack_int LAPACKE_chpevd( int matrix_order, char jobz, char uplo, lapack_int n, lapack_complex_float* ap, float* w, lapack_complex_float* z, lapack_int ldz ); lapack_int LAPACKE_zhpevd( int matrix_order, char jobz, char uplo, lapack_int n, lapack_complex_double* ap, double* w, lapack_complex_double* z, lapack_int ldz ); lapack_int LAPACKE_chpevx( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_complex_float* ap, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_zhpevx( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_complex_double* ap, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_chpgst( int matrix_order, lapack_int itype, char uplo, lapack_int n, lapack_complex_float* ap, const lapack_complex_float* bp ); lapack_int LAPACKE_zhpgst( int matrix_order, lapack_int itype, char uplo, lapack_int n, lapack_complex_double* ap, const lapack_complex_double* bp ); lapack_int LAPACKE_chpgv( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, lapack_complex_float* ap, lapack_complex_float* bp, float* w, lapack_complex_float* z, lapack_int ldz ); lapack_int LAPACKE_zhpgv( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, lapack_complex_double* ap, lapack_complex_double* bp, double* w, lapack_complex_double* z, lapack_int ldz ); lapack_int LAPACKE_chpgvd( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, lapack_complex_float* ap, lapack_complex_float* bp, float* w, lapack_complex_float* z, lapack_int ldz ); lapack_int LAPACKE_zhpgvd( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, lapack_complex_double* ap, lapack_complex_double* bp, double* w, lapack_complex_double* z, lapack_int ldz ); lapack_int LAPACKE_chpgvx( int matrix_order, lapack_int itype, char jobz, char range, char uplo, lapack_int n, lapack_complex_float* ap, lapack_complex_float* bp, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_zhpgvx( int matrix_order, lapack_int itype, char jobz, char range, char uplo, lapack_int n, lapack_complex_double* ap, lapack_complex_double* bp, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_chprfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* ap, const lapack_complex_float* afp, const lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_zhprfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* ap, const lapack_complex_double* afp, const lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_chpsv( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* ap, lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zhpsv( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* ap, lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_chpsvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* ap, lapack_complex_float* afp, lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr ); lapack_int LAPACKE_zhpsvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* ap, lapack_complex_double* afp, lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr ); lapack_int LAPACKE_chptrd( int matrix_order, char uplo, lapack_int n, lapack_complex_float* ap, float* d, float* e, lapack_complex_float* tau ); lapack_int LAPACKE_zhptrd( int matrix_order, char uplo, lapack_int n, lapack_complex_double* ap, double* d, double* e, lapack_complex_double* tau ); lapack_int LAPACKE_chptrf( int matrix_order, char uplo, lapack_int n, lapack_complex_float* ap, lapack_int* ipiv ); lapack_int LAPACKE_zhptrf( int matrix_order, char uplo, lapack_int n, lapack_complex_double* ap, lapack_int* ipiv ); lapack_int LAPACKE_chptri( int matrix_order, char uplo, lapack_int n, lapack_complex_float* ap, const lapack_int* ipiv ); lapack_int LAPACKE_zhptri( int matrix_order, char uplo, lapack_int n, lapack_complex_double* ap, const lapack_int* ipiv ); lapack_int LAPACKE_chptrs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* ap, const lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zhptrs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* ap, const lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_shsein( int matrix_order, char job, char eigsrc, char initv, lapack_logical* select, lapack_int n, const float* h, lapack_int ldh, float* wr, const float* wi, float* vl, lapack_int ldvl, float* vr, lapack_int ldvr, lapack_int mm, lapack_int* m, lapack_int* ifaill, lapack_int* ifailr ); lapack_int LAPACKE_dhsein( int matrix_order, char job, char eigsrc, char initv, lapack_logical* select, lapack_int n, const double* h, lapack_int ldh, double* wr, const double* wi, double* vl, lapack_int ldvl, double* vr, lapack_int ldvr, lapack_int mm, lapack_int* m, lapack_int* ifaill, lapack_int* ifailr ); lapack_int LAPACKE_chsein( int matrix_order, char job, char eigsrc, char initv, const lapack_logical* select, lapack_int n, const lapack_complex_float* h, lapack_int ldh, lapack_complex_float* w, lapack_complex_float* vl, lapack_int ldvl, lapack_complex_float* vr, lapack_int ldvr, lapack_int mm, lapack_int* m, lapack_int* ifaill, lapack_int* ifailr ); lapack_int LAPACKE_zhsein( int matrix_order, char job, char eigsrc, char initv, const lapack_logical* select, lapack_int n, const lapack_complex_double* h, lapack_int ldh, lapack_complex_double* w, lapack_complex_double* vl, lapack_int ldvl, lapack_complex_double* vr, lapack_int ldvr, lapack_int mm, lapack_int* m, lapack_int* ifaill, lapack_int* ifailr ); lapack_int LAPACKE_shseqr( int matrix_order, char job, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, float* h, lapack_int ldh, float* wr, float* wi, float* z, lapack_int ldz ); lapack_int LAPACKE_dhseqr( int matrix_order, char job, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, double* h, lapack_int ldh, double* wr, double* wi, double* z, lapack_int ldz ); lapack_int LAPACKE_chseqr( int matrix_order, char job, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, lapack_complex_float* h, lapack_int ldh, lapack_complex_float* w, lapack_complex_float* z, lapack_int ldz ); lapack_int LAPACKE_zhseqr( int matrix_order, char job, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, lapack_complex_double* h, lapack_int ldh, lapack_complex_double* w, lapack_complex_double* z, lapack_int ldz ); lapack_int LAPACKE_clacgv( lapack_int n, lapack_complex_float* x, lapack_int incx ); lapack_int LAPACKE_zlacgv( lapack_int n, lapack_complex_double* x, lapack_int incx ); lapack_int LAPACKE_slacpy( int matrix_order, char uplo, lapack_int m, lapack_int n, const float* a, lapack_int lda, float* b, lapack_int ldb ); lapack_int LAPACKE_dlacpy( int matrix_order, char uplo, lapack_int m, lapack_int n, const double* a, lapack_int lda, double* b, lapack_int ldb ); lapack_int LAPACKE_clacpy( int matrix_order, char uplo, lapack_int m, lapack_int n, const lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zlacpy( int matrix_order, char uplo, lapack_int m, lapack_int n, const lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_zlag2c( int matrix_order, lapack_int m, lapack_int n, const lapack_complex_double* a, lapack_int lda, lapack_complex_float* sa, lapack_int ldsa ); lapack_int LAPACKE_slag2d( int matrix_order, lapack_int m, lapack_int n, const float* sa, lapack_int ldsa, double* a, lapack_int lda ); lapack_int LAPACKE_dlag2s( int matrix_order, lapack_int m, lapack_int n, const double* a, lapack_int lda, float* sa, lapack_int ldsa ); lapack_int LAPACKE_clag2z( int matrix_order, lapack_int m, lapack_int n, const lapack_complex_float* sa, lapack_int ldsa, lapack_complex_double* a, lapack_int lda ); lapack_int LAPACKE_slagge( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const float* d, float* a, lapack_int lda, lapack_int* iseed ); lapack_int LAPACKE_dlagge( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const double* d, double* a, lapack_int lda, lapack_int* iseed ); lapack_int LAPACKE_clagge( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const float* d, lapack_complex_float* a, lapack_int lda, lapack_int* iseed ); lapack_int LAPACKE_zlagge( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const double* d, lapack_complex_double* a, lapack_int lda, lapack_int* iseed ); float LAPACKE_slamch( char cmach ); double LAPACKE_dlamch( char cmach ); float LAPACKE_slange( int matrix_order, char norm, lapack_int m, lapack_int n, const float* a, lapack_int lda ); double LAPACKE_dlange( int matrix_order, char norm, lapack_int m, lapack_int n, const double* a, lapack_int lda ); float LAPACKE_clange( int matrix_order, char norm, lapack_int m, lapack_int n, const lapack_complex_float* a, lapack_int lda ); double LAPACKE_zlange( int matrix_order, char norm, lapack_int m, lapack_int n, const lapack_complex_double* a, lapack_int lda ); float LAPACKE_clanhe( int matrix_order, char norm, char uplo, lapack_int n, const lapack_complex_float* a, lapack_int lda ); double LAPACKE_zlanhe( int matrix_order, char norm, char uplo, lapack_int n, const lapack_complex_double* a, lapack_int lda ); float LAPACKE_slansy( int matrix_order, char norm, char uplo, lapack_int n, const float* a, lapack_int lda ); double LAPACKE_dlansy( int matrix_order, char norm, char uplo, lapack_int n, const double* a, lapack_int lda ); float LAPACKE_clansy( int matrix_order, char norm, char uplo, lapack_int n, const lapack_complex_float* a, lapack_int lda ); double LAPACKE_zlansy( int matrix_order, char norm, char uplo, lapack_int n, const lapack_complex_double* a, lapack_int lda ); float LAPACKE_slantr( int matrix_order, char norm, char uplo, char diag, lapack_int m, lapack_int n, const float* a, lapack_int lda ); double LAPACKE_dlantr( int matrix_order, char norm, char uplo, char diag, lapack_int m, lapack_int n, const double* a, lapack_int lda ); float LAPACKE_clantr( int matrix_order, char norm, char uplo, char diag, lapack_int m, lapack_int n, const lapack_complex_float* a, lapack_int lda ); double LAPACKE_zlantr( int matrix_order, char norm, char uplo, char diag, lapack_int m, lapack_int n, const lapack_complex_double* a, lapack_int lda ); lapack_int LAPACKE_slarfb( int matrix_order, char side, char trans, char direct, char storev, lapack_int m, lapack_int n, lapack_int k, const float* v, lapack_int ldv, const float* t, lapack_int ldt, float* c, lapack_int ldc ); lapack_int LAPACKE_dlarfb( int matrix_order, char side, char trans, char direct, char storev, lapack_int m, lapack_int n, lapack_int k, const double* v, lapack_int ldv, const double* t, lapack_int ldt, double* c, lapack_int ldc ); lapack_int LAPACKE_clarfb( int matrix_order, char side, char trans, char direct, char storev, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_float* v, lapack_int ldv, const lapack_complex_float* t, lapack_int ldt, lapack_complex_float* c, lapack_int ldc ); lapack_int LAPACKE_zlarfb( int matrix_order, char side, char trans, char direct, char storev, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_double* v, lapack_int ldv, const lapack_complex_double* t, lapack_int ldt, lapack_complex_double* c, lapack_int ldc ); lapack_int LAPACKE_slarfg( lapack_int n, float* alpha, float* x, lapack_int incx, float* tau ); lapack_int LAPACKE_dlarfg( lapack_int n, double* alpha, double* x, lapack_int incx, double* tau ); lapack_int LAPACKE_clarfg( lapack_int n, lapack_complex_float* alpha, lapack_complex_float* x, lapack_int incx, lapack_complex_float* tau ); lapack_int LAPACKE_zlarfg( lapack_int n, lapack_complex_double* alpha, lapack_complex_double* x, lapack_int incx, lapack_complex_double* tau ); lapack_int LAPACKE_slarft( int matrix_order, char direct, char storev, lapack_int n, lapack_int k, const float* v, lapack_int ldv, const float* tau, float* t, lapack_int ldt ); lapack_int LAPACKE_dlarft( int matrix_order, char direct, char storev, lapack_int n, lapack_int k, const double* v, lapack_int ldv, const double* tau, double* t, lapack_int ldt ); lapack_int LAPACKE_clarft( int matrix_order, char direct, char storev, lapack_int n, lapack_int k, const lapack_complex_float* v, lapack_int ldv, const lapack_complex_float* tau, lapack_complex_float* t, lapack_int ldt ); lapack_int LAPACKE_zlarft( int matrix_order, char direct, char storev, lapack_int n, lapack_int k, const lapack_complex_double* v, lapack_int ldv, const lapack_complex_double* tau, lapack_complex_double* t, lapack_int ldt ); lapack_int LAPACKE_slarfx( int matrix_order, char side, lapack_int m, lapack_int n, const float* v, float tau, float* c, lapack_int ldc, float* work ); lapack_int LAPACKE_dlarfx( int matrix_order, char side, lapack_int m, lapack_int n, const double* v, double tau, double* c, lapack_int ldc, double* work ); lapack_int LAPACKE_clarfx( int matrix_order, char side, lapack_int m, lapack_int n, const lapack_complex_float* v, lapack_complex_float tau, lapack_complex_float* c, lapack_int ldc, lapack_complex_float* work ); lapack_int LAPACKE_zlarfx( int matrix_order, char side, lapack_int m, lapack_int n, const lapack_complex_double* v, lapack_complex_double tau, lapack_complex_double* c, lapack_int ldc, lapack_complex_double* work ); lapack_int LAPACKE_slarnv( lapack_int idist, lapack_int* iseed, lapack_int n, float* x ); lapack_int LAPACKE_dlarnv( lapack_int idist, lapack_int* iseed, lapack_int n, double* x ); lapack_int LAPACKE_clarnv( lapack_int idist, lapack_int* iseed, lapack_int n, lapack_complex_float* x ); lapack_int LAPACKE_zlarnv( lapack_int idist, lapack_int* iseed, lapack_int n, lapack_complex_double* x ); lapack_int LAPACKE_slaset( int matrix_order, char uplo, lapack_int m, lapack_int n, float alpha, float beta, float* a, lapack_int lda ); lapack_int LAPACKE_dlaset( int matrix_order, char uplo, lapack_int m, lapack_int n, double alpha, double beta, double* a, lapack_int lda ); lapack_int LAPACKE_claset( int matrix_order, char uplo, lapack_int m, lapack_int n, lapack_complex_float alpha, lapack_complex_float beta, lapack_complex_float* a, lapack_int lda ); lapack_int LAPACKE_zlaset( int matrix_order, char uplo, lapack_int m, lapack_int n, lapack_complex_double alpha, lapack_complex_double beta, lapack_complex_double* a, lapack_int lda ); lapack_int LAPACKE_slasrt( char id, lapack_int n, float* d ); lapack_int LAPACKE_dlasrt( char id, lapack_int n, double* d ); lapack_int LAPACKE_slaswp( int matrix_order, lapack_int n, float* a, lapack_int lda, lapack_int k1, lapack_int k2, const lapack_int* ipiv, lapack_int incx ); lapack_int LAPACKE_dlaswp( int matrix_order, lapack_int n, double* a, lapack_int lda, lapack_int k1, lapack_int k2, const lapack_int* ipiv, lapack_int incx ); lapack_int LAPACKE_claswp( int matrix_order, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_int k1, lapack_int k2, const lapack_int* ipiv, lapack_int incx ); lapack_int LAPACKE_zlaswp( int matrix_order, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_int k1, lapack_int k2, const lapack_int* ipiv, lapack_int incx ); lapack_int LAPACKE_slatms( int matrix_order, lapack_int m, lapack_int n, char dist, lapack_int* iseed, char sym, float* d, lapack_int mode, float cond, float dmax, lapack_int kl, lapack_int ku, char pack, float* a, lapack_int lda ); lapack_int LAPACKE_dlatms( int matrix_order, lapack_int m, lapack_int n, char dist, lapack_int* iseed, char sym, double* d, lapack_int mode, double cond, double dmax, lapack_int kl, lapack_int ku, char pack, double* a, lapack_int lda ); lapack_int LAPACKE_clatms( int matrix_order, lapack_int m, lapack_int n, char dist, lapack_int* iseed, char sym, float* d, lapack_int mode, float cond, float dmax, lapack_int kl, lapack_int ku, char pack, lapack_complex_float* a, lapack_int lda ); lapack_int LAPACKE_zlatms( int matrix_order, lapack_int m, lapack_int n, char dist, lapack_int* iseed, char sym, double* d, lapack_int mode, double cond, double dmax, lapack_int kl, lapack_int ku, char pack, lapack_complex_double* a, lapack_int lda ); lapack_int LAPACKE_slauum( int matrix_order, char uplo, lapack_int n, float* a, lapack_int lda ); lapack_int LAPACKE_dlauum( int matrix_order, char uplo, lapack_int n, double* a, lapack_int lda ); lapack_int LAPACKE_clauum( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda ); lapack_int LAPACKE_zlauum( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda ); lapack_int LAPACKE_sopgtr( int matrix_order, char uplo, lapack_int n, const float* ap, const float* tau, float* q, lapack_int ldq ); lapack_int LAPACKE_dopgtr( int matrix_order, char uplo, lapack_int n, const double* ap, const double* tau, double* q, lapack_int ldq ); lapack_int LAPACKE_sopmtr( int matrix_order, char side, char uplo, char trans, lapack_int m, lapack_int n, const float* ap, const float* tau, float* c, lapack_int ldc ); lapack_int LAPACKE_dopmtr( int matrix_order, char side, char uplo, char trans, lapack_int m, lapack_int n, const double* ap, const double* tau, double* c, lapack_int ldc ); lapack_int LAPACKE_sorgbr( int matrix_order, char vect, lapack_int m, lapack_int n, lapack_int k, float* a, lapack_int lda, const float* tau ); lapack_int LAPACKE_dorgbr( int matrix_order, char vect, lapack_int m, lapack_int n, lapack_int k, double* a, lapack_int lda, const double* tau ); lapack_int LAPACKE_sorghr( int matrix_order, lapack_int n, lapack_int ilo, lapack_int ihi, float* a, lapack_int lda, const float* tau ); lapack_int LAPACKE_dorghr( int matrix_order, lapack_int n, lapack_int ilo, lapack_int ihi, double* a, lapack_int lda, const double* tau ); lapack_int LAPACKE_sorglq( int matrix_order, lapack_int m, lapack_int n, lapack_int k, float* a, lapack_int lda, const float* tau ); lapack_int LAPACKE_dorglq( int matrix_order, lapack_int m, lapack_int n, lapack_int k, double* a, lapack_int lda, const double* tau ); lapack_int LAPACKE_sorgql( int matrix_order, lapack_int m, lapack_int n, lapack_int k, float* a, lapack_int lda, const float* tau ); lapack_int LAPACKE_dorgql( int matrix_order, lapack_int m, lapack_int n, lapack_int k, double* a, lapack_int lda, const double* tau ); lapack_int LAPACKE_sorgqr( int matrix_order, lapack_int m, lapack_int n, lapack_int k, float* a, lapack_int lda, const float* tau ); lapack_int LAPACKE_dorgqr( int matrix_order, lapack_int m, lapack_int n, lapack_int k, double* a, lapack_int lda, const double* tau ); lapack_int LAPACKE_sorgrq( int matrix_order, lapack_int m, lapack_int n, lapack_int k, float* a, lapack_int lda, const float* tau ); lapack_int LAPACKE_dorgrq( int matrix_order, lapack_int m, lapack_int n, lapack_int k, double* a, lapack_int lda, const double* tau ); lapack_int LAPACKE_sorgtr( int matrix_order, char uplo, lapack_int n, float* a, lapack_int lda, const float* tau ); lapack_int LAPACKE_dorgtr( int matrix_order, char uplo, lapack_int n, double* a, lapack_int lda, const double* tau ); lapack_int LAPACKE_sormbr( int matrix_order, char vect, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const float* a, lapack_int lda, const float* tau, float* c, lapack_int ldc ); lapack_int LAPACKE_dormbr( int matrix_order, char vect, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const double* a, lapack_int lda, const double* tau, double* c, lapack_int ldc ); lapack_int LAPACKE_sormhr( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int ilo, lapack_int ihi, const float* a, lapack_int lda, const float* tau, float* c, lapack_int ldc ); lapack_int LAPACKE_dormhr( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int ilo, lapack_int ihi, const double* a, lapack_int lda, const double* tau, double* c, lapack_int ldc ); lapack_int LAPACKE_sormlq( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const float* a, lapack_int lda, const float* tau, float* c, lapack_int ldc ); lapack_int LAPACKE_dormlq( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const double* a, lapack_int lda, const double* tau, double* c, lapack_int ldc ); lapack_int LAPACKE_sormql( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const float* a, lapack_int lda, const float* tau, float* c, lapack_int ldc ); lapack_int LAPACKE_dormql( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const double* a, lapack_int lda, const double* tau, double* c, lapack_int ldc ); lapack_int LAPACKE_sormqr( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const float* a, lapack_int lda, const float* tau, float* c, lapack_int ldc ); lapack_int LAPACKE_dormqr( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const double* a, lapack_int lda, const double* tau, double* c, lapack_int ldc ); lapack_int LAPACKE_sormrq( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const float* a, lapack_int lda, const float* tau, float* c, lapack_int ldc ); lapack_int LAPACKE_dormrq( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const double* a, lapack_int lda, const double* tau, double* c, lapack_int ldc ); lapack_int LAPACKE_sormrz( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int l, const float* a, lapack_int lda, const float* tau, float* c, lapack_int ldc ); lapack_int LAPACKE_dormrz( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int l, const double* a, lapack_int lda, const double* tau, double* c, lapack_int ldc ); lapack_int LAPACKE_sormtr( int matrix_order, char side, char uplo, char trans, lapack_int m, lapack_int n, const float* a, lapack_int lda, const float* tau, float* c, lapack_int ldc ); lapack_int LAPACKE_dormtr( int matrix_order, char side, char uplo, char trans, lapack_int m, lapack_int n, const double* a, lapack_int lda, const double* tau, double* c, lapack_int ldc ); lapack_int LAPACKE_spbcon( int matrix_order, char uplo, lapack_int n, lapack_int kd, const float* ab, lapack_int ldab, float anorm, float* rcond ); lapack_int LAPACKE_dpbcon( int matrix_order, char uplo, lapack_int n, lapack_int kd, const double* ab, lapack_int ldab, double anorm, double* rcond ); lapack_int LAPACKE_cpbcon( int matrix_order, char uplo, lapack_int n, lapack_int kd, const lapack_complex_float* ab, lapack_int ldab, float anorm, float* rcond ); lapack_int LAPACKE_zpbcon( int matrix_order, char uplo, lapack_int n, lapack_int kd, const lapack_complex_double* ab, lapack_int ldab, double anorm, double* rcond ); lapack_int LAPACKE_spbequ( int matrix_order, char uplo, lapack_int n, lapack_int kd, const float* ab, lapack_int ldab, float* s, float* scond, float* amax ); lapack_int LAPACKE_dpbequ( int matrix_order, char uplo, lapack_int n, lapack_int kd, const double* ab, lapack_int ldab, double* s, double* scond, double* amax ); lapack_int LAPACKE_cpbequ( int matrix_order, char uplo, lapack_int n, lapack_int kd, const lapack_complex_float* ab, lapack_int ldab, float* s, float* scond, float* amax ); lapack_int LAPACKE_zpbequ( int matrix_order, char uplo, lapack_int n, lapack_int kd, const lapack_complex_double* ab, lapack_int ldab, double* s, double* scond, double* amax ); lapack_int LAPACKE_spbrfs( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, const float* ab, lapack_int ldab, const float* afb, lapack_int ldafb, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_dpbrfs( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, const double* ab, lapack_int ldab, const double* afb, lapack_int ldafb, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_cpbrfs( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, const lapack_complex_float* ab, lapack_int ldab, const lapack_complex_float* afb, lapack_int ldafb, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_zpbrfs( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, const lapack_complex_double* ab, lapack_int ldab, const lapack_complex_double* afb, lapack_int ldafb, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_spbstf( int matrix_order, char uplo, lapack_int n, lapack_int kb, float* bb, lapack_int ldbb ); lapack_int LAPACKE_dpbstf( int matrix_order, char uplo, lapack_int n, lapack_int kb, double* bb, lapack_int ldbb ); lapack_int LAPACKE_cpbstf( int matrix_order, char uplo, lapack_int n, lapack_int kb, lapack_complex_float* bb, lapack_int ldbb ); lapack_int LAPACKE_zpbstf( int matrix_order, char uplo, lapack_int n, lapack_int kb, lapack_complex_double* bb, lapack_int ldbb ); lapack_int LAPACKE_spbsv( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, float* ab, lapack_int ldab, float* b, lapack_int ldb ); lapack_int LAPACKE_dpbsv( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, double* ab, lapack_int ldab, double* b, lapack_int ldb ); lapack_int LAPACKE_cpbsv( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, lapack_complex_float* ab, lapack_int ldab, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zpbsv( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, lapack_complex_double* ab, lapack_int ldab, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_spbsvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, float* ab, lapack_int ldab, float* afb, lapack_int ldafb, char* equed, float* s, float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* ferr, float* berr ); lapack_int LAPACKE_dpbsvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, double* ab, lapack_int ldab, double* afb, lapack_int ldafb, char* equed, double* s, double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* ferr, double* berr ); lapack_int LAPACKE_cpbsvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, lapack_complex_float* ab, lapack_int ldab, lapack_complex_float* afb, lapack_int ldafb, char* equed, float* s, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr ); lapack_int LAPACKE_zpbsvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, lapack_complex_double* ab, lapack_int ldab, lapack_complex_double* afb, lapack_int ldafb, char* equed, double* s, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr ); lapack_int LAPACKE_spbtrf( int matrix_order, char uplo, lapack_int n, lapack_int kd, float* ab, lapack_int ldab ); lapack_int LAPACKE_dpbtrf( int matrix_order, char uplo, lapack_int n, lapack_int kd, double* ab, lapack_int ldab ); lapack_int LAPACKE_cpbtrf( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_complex_float* ab, lapack_int ldab ); lapack_int LAPACKE_zpbtrf( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_complex_double* ab, lapack_int ldab ); lapack_int LAPACKE_spbtrs( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, const float* ab, lapack_int ldab, float* b, lapack_int ldb ); lapack_int LAPACKE_dpbtrs( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, const double* ab, lapack_int ldab, double* b, lapack_int ldb ); lapack_int LAPACKE_cpbtrs( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, const lapack_complex_float* ab, lapack_int ldab, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zpbtrs( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, const lapack_complex_double* ab, lapack_int ldab, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_spftrf( int matrix_order, char transr, char uplo, lapack_int n, float* a ); lapack_int LAPACKE_dpftrf( int matrix_order, char transr, char uplo, lapack_int n, double* a ); lapack_int LAPACKE_cpftrf( int matrix_order, char transr, char uplo, lapack_int n, lapack_complex_float* a ); lapack_int LAPACKE_zpftrf( int matrix_order, char transr, char uplo, lapack_int n, lapack_complex_double* a ); lapack_int LAPACKE_spftri( int matrix_order, char transr, char uplo, lapack_int n, float* a ); lapack_int LAPACKE_dpftri( int matrix_order, char transr, char uplo, lapack_int n, double* a ); lapack_int LAPACKE_cpftri( int matrix_order, char transr, char uplo, lapack_int n, lapack_complex_float* a ); lapack_int LAPACKE_zpftri( int matrix_order, char transr, char uplo, lapack_int n, lapack_complex_double* a ); lapack_int LAPACKE_spftrs( int matrix_order, char transr, char uplo, lapack_int n, lapack_int nrhs, const float* a, float* b, lapack_int ldb ); lapack_int LAPACKE_dpftrs( int matrix_order, char transr, char uplo, lapack_int n, lapack_int nrhs, const double* a, double* b, lapack_int ldb ); lapack_int LAPACKE_cpftrs( int matrix_order, char transr, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zpftrs( int matrix_order, char transr, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_spocon( int matrix_order, char uplo, lapack_int n, const float* a, lapack_int lda, float anorm, float* rcond ); lapack_int LAPACKE_dpocon( int matrix_order, char uplo, lapack_int n, const double* a, lapack_int lda, double anorm, double* rcond ); lapack_int LAPACKE_cpocon( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* a, lapack_int lda, float anorm, float* rcond ); lapack_int LAPACKE_zpocon( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* a, lapack_int lda, double anorm, double* rcond ); lapack_int LAPACKE_spoequ( int matrix_order, lapack_int n, const float* a, lapack_int lda, float* s, float* scond, float* amax ); lapack_int LAPACKE_dpoequ( int matrix_order, lapack_int n, const double* a, lapack_int lda, double* s, double* scond, double* amax ); lapack_int LAPACKE_cpoequ( int matrix_order, lapack_int n, const lapack_complex_float* a, lapack_int lda, float* s, float* scond, float* amax ); lapack_int LAPACKE_zpoequ( int matrix_order, lapack_int n, const lapack_complex_double* a, lapack_int lda, double* s, double* scond, double* amax ); lapack_int LAPACKE_spoequb( int matrix_order, lapack_int n, const float* a, lapack_int lda, float* s, float* scond, float* amax ); lapack_int LAPACKE_dpoequb( int matrix_order, lapack_int n, const double* a, lapack_int lda, double* s, double* scond, double* amax ); lapack_int LAPACKE_cpoequb( int matrix_order, lapack_int n, const lapack_complex_float* a, lapack_int lda, float* s, float* scond, float* amax ); lapack_int LAPACKE_zpoequb( int matrix_order, lapack_int n, const lapack_complex_double* a, lapack_int lda, double* s, double* scond, double* amax ); lapack_int LAPACKE_sporfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, const float* af, lapack_int ldaf, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_dporfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, const double* af, lapack_int ldaf, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_cporfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* af, lapack_int ldaf, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_zporfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* af, lapack_int ldaf, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_sporfsx( int matrix_order, char uplo, char equed, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, const float* af, lapack_int ldaf, const float* s, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params ); lapack_int LAPACKE_dporfsx( int matrix_order, char uplo, char equed, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, const double* af, lapack_int ldaf, const double* s, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params ); lapack_int LAPACKE_cporfsx( int matrix_order, char uplo, char equed, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* af, lapack_int ldaf, const float* s, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params ); lapack_int LAPACKE_zporfsx( int matrix_order, char uplo, char equed, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* af, lapack_int ldaf, const double* s, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params ); lapack_int LAPACKE_sposv( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, float* b, lapack_int ldb ); lapack_int LAPACKE_dposv( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* b, lapack_int ldb ); lapack_int LAPACKE_cposv( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zposv( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_dsposv( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* b, lapack_int ldb, double* x, lapack_int ldx, lapack_int* iter ); lapack_int LAPACKE_zcposv( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, lapack_int* iter ); lapack_int LAPACKE_sposvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, float* af, lapack_int ldaf, char* equed, float* s, float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* ferr, float* berr ); lapack_int LAPACKE_dposvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* af, lapack_int ldaf, char* equed, double* s, double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* ferr, double* berr ); lapack_int LAPACKE_cposvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* af, lapack_int ldaf, char* equed, float* s, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr ); lapack_int LAPACKE_zposvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* af, lapack_int ldaf, char* equed, double* s, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr ); lapack_int LAPACKE_sposvxx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, float* af, lapack_int ldaf, char* equed, float* s, float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* rpvgrw, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params ); lapack_int LAPACKE_dposvxx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* af, lapack_int ldaf, char* equed, double* s, double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* rpvgrw, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params ); lapack_int LAPACKE_cposvxx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* af, lapack_int ldaf, char* equed, float* s, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* rpvgrw, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params ); lapack_int LAPACKE_zposvxx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* af, lapack_int ldaf, char* equed, double* s, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* rpvgrw, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params ); lapack_int LAPACKE_spotrf( int matrix_order, char uplo, lapack_int n, float* a, lapack_int lda ); lapack_int LAPACKE_dpotrf( int matrix_order, char uplo, lapack_int n, double* a, lapack_int lda ); lapack_int LAPACKE_cpotrf( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda ); lapack_int LAPACKE_zpotrf( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda ); lapack_int LAPACKE_spotri( int matrix_order, char uplo, lapack_int n, float* a, lapack_int lda ); lapack_int LAPACKE_dpotri( int matrix_order, char uplo, lapack_int n, double* a, lapack_int lda ); lapack_int LAPACKE_cpotri( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda ); lapack_int LAPACKE_zpotri( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda ); lapack_int LAPACKE_spotrs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, float* b, lapack_int ldb ); lapack_int LAPACKE_dpotrs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, double* b, lapack_int ldb ); lapack_int LAPACKE_cpotrs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zpotrs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_sppcon( int matrix_order, char uplo, lapack_int n, const float* ap, float anorm, float* rcond ); lapack_int LAPACKE_dppcon( int matrix_order, char uplo, lapack_int n, const double* ap, double anorm, double* rcond ); lapack_int LAPACKE_cppcon( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* ap, float anorm, float* rcond ); lapack_int LAPACKE_zppcon( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* ap, double anorm, double* rcond ); lapack_int LAPACKE_sppequ( int matrix_order, char uplo, lapack_int n, const float* ap, float* s, float* scond, float* amax ); lapack_int LAPACKE_dppequ( int matrix_order, char uplo, lapack_int n, const double* ap, double* s, double* scond, double* amax ); lapack_int LAPACKE_cppequ( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* ap, float* s, float* scond, float* amax ); lapack_int LAPACKE_zppequ( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* ap, double* s, double* scond, double* amax ); lapack_int LAPACKE_spprfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const float* ap, const float* afp, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_dpprfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const double* ap, const double* afp, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_cpprfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* ap, const lapack_complex_float* afp, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_zpprfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* ap, const lapack_complex_double* afp, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_sppsv( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, float* ap, float* b, lapack_int ldb ); lapack_int LAPACKE_dppsv( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, double* ap, double* b, lapack_int ldb ); lapack_int LAPACKE_cppsv( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* ap, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zppsv( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* ap, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_sppsvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, float* ap, float* afp, char* equed, float* s, float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* ferr, float* berr ); lapack_int LAPACKE_dppsvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, double* ap, double* afp, char* equed, double* s, double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* ferr, double* berr ); lapack_int LAPACKE_cppsvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* ap, lapack_complex_float* afp, char* equed, float* s, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr ); lapack_int LAPACKE_zppsvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* ap, lapack_complex_double* afp, char* equed, double* s, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr ); lapack_int LAPACKE_spptrf( int matrix_order, char uplo, lapack_int n, float* ap ); lapack_int LAPACKE_dpptrf( int matrix_order, char uplo, lapack_int n, double* ap ); lapack_int LAPACKE_cpptrf( int matrix_order, char uplo, lapack_int n, lapack_complex_float* ap ); lapack_int LAPACKE_zpptrf( int matrix_order, char uplo, lapack_int n, lapack_complex_double* ap ); lapack_int LAPACKE_spptri( int matrix_order, char uplo, lapack_int n, float* ap ); lapack_int LAPACKE_dpptri( int matrix_order, char uplo, lapack_int n, double* ap ); lapack_int LAPACKE_cpptri( int matrix_order, char uplo, lapack_int n, lapack_complex_float* ap ); lapack_int LAPACKE_zpptri( int matrix_order, char uplo, lapack_int n, lapack_complex_double* ap ); lapack_int LAPACKE_spptrs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const float* ap, float* b, lapack_int ldb ); lapack_int LAPACKE_dpptrs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const double* ap, double* b, lapack_int ldb ); lapack_int LAPACKE_cpptrs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* ap, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zpptrs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* ap, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_spstrf( int matrix_order, char uplo, lapack_int n, float* a, lapack_int lda, lapack_int* piv, lapack_int* rank, float tol ); lapack_int LAPACKE_dpstrf( int matrix_order, char uplo, lapack_int n, double* a, lapack_int lda, lapack_int* piv, lapack_int* rank, double tol ); lapack_int LAPACKE_cpstrf( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_int* piv, lapack_int* rank, float tol ); lapack_int LAPACKE_zpstrf( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_int* piv, lapack_int* rank, double tol ); lapack_int LAPACKE_sptcon( lapack_int n, const float* d, const float* e, float anorm, float* rcond ); lapack_int LAPACKE_dptcon( lapack_int n, const double* d, const double* e, double anorm, double* rcond ); lapack_int LAPACKE_cptcon( lapack_int n, const float* d, const lapack_complex_float* e, float anorm, float* rcond ); lapack_int LAPACKE_zptcon( lapack_int n, const double* d, const lapack_complex_double* e, double anorm, double* rcond ); lapack_int LAPACKE_spteqr( int matrix_order, char compz, lapack_int n, float* d, float* e, float* z, lapack_int ldz ); lapack_int LAPACKE_dpteqr( int matrix_order, char compz, lapack_int n, double* d, double* e, double* z, lapack_int ldz ); lapack_int LAPACKE_cpteqr( int matrix_order, char compz, lapack_int n, float* d, float* e, lapack_complex_float* z, lapack_int ldz ); lapack_int LAPACKE_zpteqr( int matrix_order, char compz, lapack_int n, double* d, double* e, lapack_complex_double* z, lapack_int ldz ); lapack_int LAPACKE_sptrfs( int matrix_order, lapack_int n, lapack_int nrhs, const float* d, const float* e, const float* df, const float* ef, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_dptrfs( int matrix_order, lapack_int n, lapack_int nrhs, const double* d, const double* e, const double* df, const double* ef, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_cptrfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const float* d, const lapack_complex_float* e, const float* df, const lapack_complex_float* ef, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_zptrfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const double* d, const lapack_complex_double* e, const double* df, const lapack_complex_double* ef, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_sptsv( int matrix_order, lapack_int n, lapack_int nrhs, float* d, float* e, float* b, lapack_int ldb ); lapack_int LAPACKE_dptsv( int matrix_order, lapack_int n, lapack_int nrhs, double* d, double* e, double* b, lapack_int ldb ); lapack_int LAPACKE_cptsv( int matrix_order, lapack_int n, lapack_int nrhs, float* d, lapack_complex_float* e, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zptsv( int matrix_order, lapack_int n, lapack_int nrhs, double* d, lapack_complex_double* e, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_sptsvx( int matrix_order, char fact, lapack_int n, lapack_int nrhs, const float* d, const float* e, float* df, float* ef, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* ferr, float* berr ); lapack_int LAPACKE_dptsvx( int matrix_order, char fact, lapack_int n, lapack_int nrhs, const double* d, const double* e, double* df, double* ef, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* ferr, double* berr ); lapack_int LAPACKE_cptsvx( int matrix_order, char fact, lapack_int n, lapack_int nrhs, const float* d, const lapack_complex_float* e, float* df, lapack_complex_float* ef, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr ); lapack_int LAPACKE_zptsvx( int matrix_order, char fact, lapack_int n, lapack_int nrhs, const double* d, const lapack_complex_double* e, double* df, lapack_complex_double* ef, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr ); lapack_int LAPACKE_spttrf( lapack_int n, float* d, float* e ); lapack_int LAPACKE_dpttrf( lapack_int n, double* d, double* e ); lapack_int LAPACKE_cpttrf( lapack_int n, float* d, lapack_complex_float* e ); lapack_int LAPACKE_zpttrf( lapack_int n, double* d, lapack_complex_double* e ); lapack_int LAPACKE_spttrs( int matrix_order, lapack_int n, lapack_int nrhs, const float* d, const float* e, float* b, lapack_int ldb ); lapack_int LAPACKE_dpttrs( int matrix_order, lapack_int n, lapack_int nrhs, const double* d, const double* e, double* b, lapack_int ldb ); lapack_int LAPACKE_cpttrs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const float* d, const lapack_complex_float* e, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zpttrs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const double* d, const lapack_complex_double* e, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_ssbev( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int kd, float* ab, lapack_int ldab, float* w, float* z, lapack_int ldz ); lapack_int LAPACKE_dsbev( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int kd, double* ab, lapack_int ldab, double* w, double* z, lapack_int ldz ); lapack_int LAPACKE_ssbevd( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int kd, float* ab, lapack_int ldab, float* w, float* z, lapack_int ldz ); lapack_int LAPACKE_dsbevd( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int kd, double* ab, lapack_int ldab, double* w, double* z, lapack_int ldz ); lapack_int LAPACKE_ssbevx( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_int kd, float* ab, lapack_int ldab, float* q, lapack_int ldq, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, float* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_dsbevx( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_int kd, double* ab, lapack_int ldab, double* q, lapack_int ldq, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, double* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_ssbgst( int matrix_order, char vect, char uplo, lapack_int n, lapack_int ka, lapack_int kb, float* ab, lapack_int ldab, const float* bb, lapack_int ldbb, float* x, lapack_int ldx ); lapack_int LAPACKE_dsbgst( int matrix_order, char vect, char uplo, lapack_int n, lapack_int ka, lapack_int kb, double* ab, lapack_int ldab, const double* bb, lapack_int ldbb, double* x, lapack_int ldx ); lapack_int LAPACKE_ssbgv( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int ka, lapack_int kb, float* ab, lapack_int ldab, float* bb, lapack_int ldbb, float* w, float* z, lapack_int ldz ); lapack_int LAPACKE_dsbgv( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int ka, lapack_int kb, double* ab, lapack_int ldab, double* bb, lapack_int ldbb, double* w, double* z, lapack_int ldz ); lapack_int LAPACKE_ssbgvd( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int ka, lapack_int kb, float* ab, lapack_int ldab, float* bb, lapack_int ldbb, float* w, float* z, lapack_int ldz ); lapack_int LAPACKE_dsbgvd( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int ka, lapack_int kb, double* ab, lapack_int ldab, double* bb, lapack_int ldbb, double* w, double* z, lapack_int ldz ); lapack_int LAPACKE_ssbgvx( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_int ka, lapack_int kb, float* ab, lapack_int ldab, float* bb, lapack_int ldbb, float* q, lapack_int ldq, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, float* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_dsbgvx( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_int ka, lapack_int kb, double* ab, lapack_int ldab, double* bb, lapack_int ldbb, double* q, lapack_int ldq, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, double* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_ssbtrd( int matrix_order, char vect, char uplo, lapack_int n, lapack_int kd, float* ab, lapack_int ldab, float* d, float* e, float* q, lapack_int ldq ); lapack_int LAPACKE_dsbtrd( int matrix_order, char vect, char uplo, lapack_int n, lapack_int kd, double* ab, lapack_int ldab, double* d, double* e, double* q, lapack_int ldq ); lapack_int LAPACKE_ssfrk( int matrix_order, char transr, char uplo, char trans, lapack_int n, lapack_int k, float alpha, const float* a, lapack_int lda, float beta, float* c ); lapack_int LAPACKE_dsfrk( int matrix_order, char transr, char uplo, char trans, lapack_int n, lapack_int k, double alpha, const double* a, lapack_int lda, double beta, double* c ); lapack_int LAPACKE_sspcon( int matrix_order, char uplo, lapack_int n, const float* ap, const lapack_int* ipiv, float anorm, float* rcond ); lapack_int LAPACKE_dspcon( int matrix_order, char uplo, lapack_int n, const double* ap, const lapack_int* ipiv, double anorm, double* rcond ); lapack_int LAPACKE_cspcon( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* ap, const lapack_int* ipiv, float anorm, float* rcond ); lapack_int LAPACKE_zspcon( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* ap, const lapack_int* ipiv, double anorm, double* rcond ); lapack_int LAPACKE_sspev( int matrix_order, char jobz, char uplo, lapack_int n, float* ap, float* w, float* z, lapack_int ldz ); lapack_int LAPACKE_dspev( int matrix_order, char jobz, char uplo, lapack_int n, double* ap, double* w, double* z, lapack_int ldz ); lapack_int LAPACKE_sspevd( int matrix_order, char jobz, char uplo, lapack_int n, float* ap, float* w, float* z, lapack_int ldz ); lapack_int LAPACKE_dspevd( int matrix_order, char jobz, char uplo, lapack_int n, double* ap, double* w, double* z, lapack_int ldz ); lapack_int LAPACKE_sspevx( int matrix_order, char jobz, char range, char uplo, lapack_int n, float* ap, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, float* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_dspevx( int matrix_order, char jobz, char range, char uplo, lapack_int n, double* ap, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, double* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_sspgst( int matrix_order, lapack_int itype, char uplo, lapack_int n, float* ap, const float* bp ); lapack_int LAPACKE_dspgst( int matrix_order, lapack_int itype, char uplo, lapack_int n, double* ap, const double* bp ); lapack_int LAPACKE_sspgv( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, float* ap, float* bp, float* w, float* z, lapack_int ldz ); lapack_int LAPACKE_dspgv( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, double* ap, double* bp, double* w, double* z, lapack_int ldz ); lapack_int LAPACKE_sspgvd( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, float* ap, float* bp, float* w, float* z, lapack_int ldz ); lapack_int LAPACKE_dspgvd( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, double* ap, double* bp, double* w, double* z, lapack_int ldz ); lapack_int LAPACKE_sspgvx( int matrix_order, lapack_int itype, char jobz, char range, char uplo, lapack_int n, float* ap, float* bp, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, float* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_dspgvx( int matrix_order, lapack_int itype, char jobz, char range, char uplo, lapack_int n, double* ap, double* bp, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, double* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_ssprfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const float* ap, const float* afp, const lapack_int* ipiv, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_dsprfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const double* ap, const double* afp, const lapack_int* ipiv, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_csprfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* ap, const lapack_complex_float* afp, const lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_zsprfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* ap, const lapack_complex_double* afp, const lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_sspsv( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, float* ap, lapack_int* ipiv, float* b, lapack_int ldb ); lapack_int LAPACKE_dspsv( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, double* ap, lapack_int* ipiv, double* b, lapack_int ldb ); lapack_int LAPACKE_cspsv( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* ap, lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zspsv( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* ap, lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_sspsvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const float* ap, float* afp, lapack_int* ipiv, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* ferr, float* berr ); lapack_int LAPACKE_dspsvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const double* ap, double* afp, lapack_int* ipiv, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* ferr, double* berr ); lapack_int LAPACKE_cspsvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* ap, lapack_complex_float* afp, lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr ); lapack_int LAPACKE_zspsvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* ap, lapack_complex_double* afp, lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr ); lapack_int LAPACKE_ssptrd( int matrix_order, char uplo, lapack_int n, float* ap, float* d, float* e, float* tau ); lapack_int LAPACKE_dsptrd( int matrix_order, char uplo, lapack_int n, double* ap, double* d, double* e, double* tau ); lapack_int LAPACKE_ssptrf( int matrix_order, char uplo, lapack_int n, float* ap, lapack_int* ipiv ); lapack_int LAPACKE_dsptrf( int matrix_order, char uplo, lapack_int n, double* ap, lapack_int* ipiv ); lapack_int LAPACKE_csptrf( int matrix_order, char uplo, lapack_int n, lapack_complex_float* ap, lapack_int* ipiv ); lapack_int LAPACKE_zsptrf( int matrix_order, char uplo, lapack_int n, lapack_complex_double* ap, lapack_int* ipiv ); lapack_int LAPACKE_ssptri( int matrix_order, char uplo, lapack_int n, float* ap, const lapack_int* ipiv ); lapack_int LAPACKE_dsptri( int matrix_order, char uplo, lapack_int n, double* ap, const lapack_int* ipiv ); lapack_int LAPACKE_csptri( int matrix_order, char uplo, lapack_int n, lapack_complex_float* ap, const lapack_int* ipiv ); lapack_int LAPACKE_zsptri( int matrix_order, char uplo, lapack_int n, lapack_complex_double* ap, const lapack_int* ipiv ); lapack_int LAPACKE_ssptrs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const float* ap, const lapack_int* ipiv, float* b, lapack_int ldb ); lapack_int LAPACKE_dsptrs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const double* ap, const lapack_int* ipiv, double* b, lapack_int ldb ); lapack_int LAPACKE_csptrs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* ap, const lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zsptrs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* ap, const lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_sstebz( char range, char order, lapack_int n, float vl, float vu, lapack_int il, lapack_int iu, float abstol, const float* d, const float* e, lapack_int* m, lapack_int* nsplit, float* w, lapack_int* iblock, lapack_int* isplit ); lapack_int LAPACKE_dstebz( char range, char order, lapack_int n, double vl, double vu, lapack_int il, lapack_int iu, double abstol, const double* d, const double* e, lapack_int* m, lapack_int* nsplit, double* w, lapack_int* iblock, lapack_int* isplit ); lapack_int LAPACKE_sstedc( int matrix_order, char compz, lapack_int n, float* d, float* e, float* z, lapack_int ldz ); lapack_int LAPACKE_dstedc( int matrix_order, char compz, lapack_int n, double* d, double* e, double* z, lapack_int ldz ); lapack_int LAPACKE_cstedc( int matrix_order, char compz, lapack_int n, float* d, float* e, lapack_complex_float* z, lapack_int ldz ); lapack_int LAPACKE_zstedc( int matrix_order, char compz, lapack_int n, double* d, double* e, lapack_complex_double* z, lapack_int ldz ); lapack_int LAPACKE_sstegr( int matrix_order, char jobz, char range, lapack_int n, float* d, float* e, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, float* z, lapack_int ldz, lapack_int* isuppz ); lapack_int LAPACKE_dstegr( int matrix_order, char jobz, char range, lapack_int n, double* d, double* e, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, double* z, lapack_int ldz, lapack_int* isuppz ); lapack_int LAPACKE_cstegr( int matrix_order, char jobz, char range, lapack_int n, float* d, float* e, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int ldz, lapack_int* isuppz ); lapack_int LAPACKE_zstegr( int matrix_order, char jobz, char range, lapack_int n, double* d, double* e, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int ldz, lapack_int* isuppz ); lapack_int LAPACKE_sstein( int matrix_order, lapack_int n, const float* d, const float* e, lapack_int m, const float* w, const lapack_int* iblock, const lapack_int* isplit, float* z, lapack_int ldz, lapack_int* ifailv ); lapack_int LAPACKE_dstein( int matrix_order, lapack_int n, const double* d, const double* e, lapack_int m, const double* w, const lapack_int* iblock, const lapack_int* isplit, double* z, lapack_int ldz, lapack_int* ifailv ); lapack_int LAPACKE_cstein( int matrix_order, lapack_int n, const float* d, const float* e, lapack_int m, const float* w, const lapack_int* iblock, const lapack_int* isplit, lapack_complex_float* z, lapack_int ldz, lapack_int* ifailv ); lapack_int LAPACKE_zstein( int matrix_order, lapack_int n, const double* d, const double* e, lapack_int m, const double* w, const lapack_int* iblock, const lapack_int* isplit, lapack_complex_double* z, lapack_int ldz, lapack_int* ifailv ); lapack_int LAPACKE_sstemr( int matrix_order, char jobz, char range, lapack_int n, float* d, float* e, float vl, float vu, lapack_int il, lapack_int iu, lapack_int* m, float* w, float* z, lapack_int ldz, lapack_int nzc, lapack_int* isuppz, lapack_logical* tryrac ); lapack_int LAPACKE_dstemr( int matrix_order, char jobz, char range, lapack_int n, double* d, double* e, double vl, double vu, lapack_int il, lapack_int iu, lapack_int* m, double* w, double* z, lapack_int ldz, lapack_int nzc, lapack_int* isuppz, lapack_logical* tryrac ); lapack_int LAPACKE_cstemr( int matrix_order, char jobz, char range, lapack_int n, float* d, float* e, float vl, float vu, lapack_int il, lapack_int iu, lapack_int* m, float* w, lapack_complex_float* z, lapack_int ldz, lapack_int nzc, lapack_int* isuppz, lapack_logical* tryrac ); lapack_int LAPACKE_zstemr( int matrix_order, char jobz, char range, lapack_int n, double* d, double* e, double vl, double vu, lapack_int il, lapack_int iu, lapack_int* m, double* w, lapack_complex_double* z, lapack_int ldz, lapack_int nzc, lapack_int* isuppz, lapack_logical* tryrac ); lapack_int LAPACKE_ssteqr( int matrix_order, char compz, lapack_int n, float* d, float* e, float* z, lapack_int ldz ); lapack_int LAPACKE_dsteqr( int matrix_order, char compz, lapack_int n, double* d, double* e, double* z, lapack_int ldz ); lapack_int LAPACKE_csteqr( int matrix_order, char compz, lapack_int n, float* d, float* e, lapack_complex_float* z, lapack_int ldz ); lapack_int LAPACKE_zsteqr( int matrix_order, char compz, lapack_int n, double* d, double* e, lapack_complex_double* z, lapack_int ldz ); lapack_int LAPACKE_ssterf( lapack_int n, float* d, float* e ); lapack_int LAPACKE_dsterf( lapack_int n, double* d, double* e ); lapack_int LAPACKE_sstev( int matrix_order, char jobz, lapack_int n, float* d, float* e, float* z, lapack_int ldz ); lapack_int LAPACKE_dstev( int matrix_order, char jobz, lapack_int n, double* d, double* e, double* z, lapack_int ldz ); lapack_int LAPACKE_sstevd( int matrix_order, char jobz, lapack_int n, float* d, float* e, float* z, lapack_int ldz ); lapack_int LAPACKE_dstevd( int matrix_order, char jobz, lapack_int n, double* d, double* e, double* z, lapack_int ldz ); lapack_int LAPACKE_sstevr( int matrix_order, char jobz, char range, lapack_int n, float* d, float* e, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, float* z, lapack_int ldz, lapack_int* isuppz ); lapack_int LAPACKE_dstevr( int matrix_order, char jobz, char range, lapack_int n, double* d, double* e, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, double* z, lapack_int ldz, lapack_int* isuppz ); lapack_int LAPACKE_sstevx( int matrix_order, char jobz, char range, lapack_int n, float* d, float* e, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, float* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_dstevx( int matrix_order, char jobz, char range, lapack_int n, double* d, double* e, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, double* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_ssycon( int matrix_order, char uplo, lapack_int n, const float* a, lapack_int lda, const lapack_int* ipiv, float anorm, float* rcond ); lapack_int LAPACKE_dsycon( int matrix_order, char uplo, lapack_int n, const double* a, lapack_int lda, const lapack_int* ipiv, double anorm, double* rcond ); lapack_int LAPACKE_csycon( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, float anorm, float* rcond ); lapack_int LAPACKE_zsycon( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, double anorm, double* rcond ); lapack_int LAPACKE_ssyequb( int matrix_order, char uplo, lapack_int n, const float* a, lapack_int lda, float* s, float* scond, float* amax ); lapack_int LAPACKE_dsyequb( int matrix_order, char uplo, lapack_int n, const double* a, lapack_int lda, double* s, double* scond, double* amax ); lapack_int LAPACKE_csyequb( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* a, lapack_int lda, float* s, float* scond, float* amax ); lapack_int LAPACKE_zsyequb( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* a, lapack_int lda, double* s, double* scond, double* amax ); lapack_int LAPACKE_ssyev( int matrix_order, char jobz, char uplo, lapack_int n, float* a, lapack_int lda, float* w ); lapack_int LAPACKE_dsyev( int matrix_order, char jobz, char uplo, lapack_int n, double* a, lapack_int lda, double* w ); lapack_int LAPACKE_ssyevd( int matrix_order, char jobz, char uplo, lapack_int n, float* a, lapack_int lda, float* w ); lapack_int LAPACKE_dsyevd( int matrix_order, char jobz, char uplo, lapack_int n, double* a, lapack_int lda, double* w ); lapack_int LAPACKE_ssyevr( int matrix_order, char jobz, char range, char uplo, lapack_int n, float* a, lapack_int lda, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, float* z, lapack_int ldz, lapack_int* isuppz ); lapack_int LAPACKE_dsyevr( int matrix_order, char jobz, char range, char uplo, lapack_int n, double* a, lapack_int lda, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, double* z, lapack_int ldz, lapack_int* isuppz ); lapack_int LAPACKE_ssyevx( int matrix_order, char jobz, char range, char uplo, lapack_int n, float* a, lapack_int lda, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, float* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_dsyevx( int matrix_order, char jobz, char range, char uplo, lapack_int n, double* a, lapack_int lda, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, double* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_ssygst( int matrix_order, lapack_int itype, char uplo, lapack_int n, float* a, lapack_int lda, const float* b, lapack_int ldb ); lapack_int LAPACKE_dsygst( int matrix_order, lapack_int itype, char uplo, lapack_int n, double* a, lapack_int lda, const double* b, lapack_int ldb ); lapack_int LAPACKE_ssygv( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, float* w ); lapack_int LAPACKE_dsygv( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, double* w ); lapack_int LAPACKE_ssygvd( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, float* w ); lapack_int LAPACKE_dsygvd( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, double* w ); lapack_int LAPACKE_ssygvx( int matrix_order, lapack_int itype, char jobz, char range, char uplo, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, float* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_dsygvx( int matrix_order, lapack_int itype, char jobz, char range, char uplo, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, double* z, lapack_int ldz, lapack_int* ifail ); lapack_int LAPACKE_ssyrfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, const float* af, lapack_int ldaf, const lapack_int* ipiv, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_dsyrfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, const double* af, lapack_int ldaf, const lapack_int* ipiv, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_csyrfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* af, lapack_int ldaf, const lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_zsyrfs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* af, lapack_int ldaf, const lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_ssyrfsx( int matrix_order, char uplo, char equed, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, const float* af, lapack_int ldaf, const lapack_int* ipiv, const float* s, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params ); lapack_int LAPACKE_dsyrfsx( int matrix_order, char uplo, char equed, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, const double* af, lapack_int ldaf, const lapack_int* ipiv, const double* s, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params ); lapack_int LAPACKE_csyrfsx( int matrix_order, char uplo, char equed, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* af, lapack_int ldaf, const lapack_int* ipiv, const float* s, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params ); lapack_int LAPACKE_zsyrfsx( int matrix_order, char uplo, char equed, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* af, lapack_int ldaf, const lapack_int* ipiv, const double* s, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params ); lapack_int LAPACKE_ssysv( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, lapack_int* ipiv, float* b, lapack_int ldb ); lapack_int LAPACKE_dsysv( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, lapack_int* ipiv, double* b, lapack_int ldb ); lapack_int LAPACKE_csysv( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zsysv( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_ssysvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, float* af, lapack_int ldaf, lapack_int* ipiv, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* ferr, float* berr ); lapack_int LAPACKE_dsysvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, double* af, lapack_int ldaf, lapack_int* ipiv, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* ferr, double* berr ); lapack_int LAPACKE_csysvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, lapack_complex_float* af, lapack_int ldaf, lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr ); lapack_int LAPACKE_zsysvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, lapack_complex_double* af, lapack_int ldaf, lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr ); lapack_int LAPACKE_ssysvxx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, float* af, lapack_int ldaf, lapack_int* ipiv, char* equed, float* s, float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* rpvgrw, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params ); lapack_int LAPACKE_dsysvxx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* af, lapack_int ldaf, lapack_int* ipiv, char* equed, double* s, double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* rpvgrw, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params ); lapack_int LAPACKE_csysvxx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* af, lapack_int ldaf, lapack_int* ipiv, char* equed, float* s, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* rpvgrw, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params ); lapack_int LAPACKE_zsysvxx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* af, lapack_int ldaf, lapack_int* ipiv, char* equed, double* s, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* rpvgrw, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params ); lapack_int LAPACKE_ssytrd( int matrix_order, char uplo, lapack_int n, float* a, lapack_int lda, float* d, float* e, float* tau ); lapack_int LAPACKE_dsytrd( int matrix_order, char uplo, lapack_int n, double* a, lapack_int lda, double* d, double* e, double* tau ); lapack_int LAPACKE_ssytrf( int matrix_order, char uplo, lapack_int n, float* a, lapack_int lda, lapack_int* ipiv ); lapack_int LAPACKE_dsytrf( int matrix_order, char uplo, lapack_int n, double* a, lapack_int lda, lapack_int* ipiv ); lapack_int LAPACKE_csytrf( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_int* ipiv ); lapack_int LAPACKE_zsytrf( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_int* ipiv ); lapack_int LAPACKE_ssytri( int matrix_order, char uplo, lapack_int n, float* a, lapack_int lda, const lapack_int* ipiv ); lapack_int LAPACKE_dsytri( int matrix_order, char uplo, lapack_int n, double* a, lapack_int lda, const lapack_int* ipiv ); lapack_int LAPACKE_csytri( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv ); lapack_int LAPACKE_zsytri( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv ); lapack_int LAPACKE_ssytrs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, const lapack_int* ipiv, float* b, lapack_int ldb ); lapack_int LAPACKE_dsytrs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, const lapack_int* ipiv, double* b, lapack_int ldb ); lapack_int LAPACKE_csytrs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zsytrs( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_stbcon( int matrix_order, char norm, char uplo, char diag, lapack_int n, lapack_int kd, const float* ab, lapack_int ldab, float* rcond ); lapack_int LAPACKE_dtbcon( int matrix_order, char norm, char uplo, char diag, lapack_int n, lapack_int kd, const double* ab, lapack_int ldab, double* rcond ); lapack_int LAPACKE_ctbcon( int matrix_order, char norm, char uplo, char diag, lapack_int n, lapack_int kd, const lapack_complex_float* ab, lapack_int ldab, float* rcond ); lapack_int LAPACKE_ztbcon( int matrix_order, char norm, char uplo, char diag, lapack_int n, lapack_int kd, const lapack_complex_double* ab, lapack_int ldab, double* rcond ); lapack_int LAPACKE_stbrfs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int kd, lapack_int nrhs, const float* ab, lapack_int ldab, const float* b, lapack_int ldb, const float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_dtbrfs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int kd, lapack_int nrhs, const double* ab, lapack_int ldab, const double* b, lapack_int ldb, const double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_ctbrfs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int kd, lapack_int nrhs, const lapack_complex_float* ab, lapack_int ldab, const lapack_complex_float* b, lapack_int ldb, const lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_ztbrfs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int kd, lapack_int nrhs, const lapack_complex_double* ab, lapack_int ldab, const lapack_complex_double* b, lapack_int ldb, const lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_stbtrs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int kd, lapack_int nrhs, const float* ab, lapack_int ldab, float* b, lapack_int ldb ); lapack_int LAPACKE_dtbtrs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int kd, lapack_int nrhs, const double* ab, lapack_int ldab, double* b, lapack_int ldb ); lapack_int LAPACKE_ctbtrs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int kd, lapack_int nrhs, const lapack_complex_float* ab, lapack_int ldab, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_ztbtrs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int kd, lapack_int nrhs, const lapack_complex_double* ab, lapack_int ldab, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_stfsm( int matrix_order, char transr, char side, char uplo, char trans, char diag, lapack_int m, lapack_int n, float alpha, const float* a, float* b, lapack_int ldb ); lapack_int LAPACKE_dtfsm( int matrix_order, char transr, char side, char uplo, char trans, char diag, lapack_int m, lapack_int n, double alpha, const double* a, double* b, lapack_int ldb ); lapack_int LAPACKE_ctfsm( int matrix_order, char transr, char side, char uplo, char trans, char diag, lapack_int m, lapack_int n, lapack_complex_float alpha, const lapack_complex_float* a, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_ztfsm( int matrix_order, char transr, char side, char uplo, char trans, char diag, lapack_int m, lapack_int n, lapack_complex_double alpha, const lapack_complex_double* a, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_stftri( int matrix_order, char transr, char uplo, char diag, lapack_int n, float* a ); lapack_int LAPACKE_dtftri( int matrix_order, char transr, char uplo, char diag, lapack_int n, double* a ); lapack_int LAPACKE_ctftri( int matrix_order, char transr, char uplo, char diag, lapack_int n, lapack_complex_float* a ); lapack_int LAPACKE_ztftri( int matrix_order, char transr, char uplo, char diag, lapack_int n, lapack_complex_double* a ); lapack_int LAPACKE_stfttp( int matrix_order, char transr, char uplo, lapack_int n, const float* arf, float* ap ); lapack_int LAPACKE_dtfttp( int matrix_order, char transr, char uplo, lapack_int n, const double* arf, double* ap ); lapack_int LAPACKE_ctfttp( int matrix_order, char transr, char uplo, lapack_int n, const lapack_complex_float* arf, lapack_complex_float* ap ); lapack_int LAPACKE_ztfttp( int matrix_order, char transr, char uplo, lapack_int n, const lapack_complex_double* arf, lapack_complex_double* ap ); lapack_int LAPACKE_stfttr( int matrix_order, char transr, char uplo, lapack_int n, const float* arf, float* a, lapack_int lda ); lapack_int LAPACKE_dtfttr( int matrix_order, char transr, char uplo, lapack_int n, const double* arf, double* a, lapack_int lda ); lapack_int LAPACKE_ctfttr( int matrix_order, char transr, char uplo, lapack_int n, const lapack_complex_float* arf, lapack_complex_float* a, lapack_int lda ); lapack_int LAPACKE_ztfttr( int matrix_order, char transr, char uplo, lapack_int n, const lapack_complex_double* arf, lapack_complex_double* a, lapack_int lda ); lapack_int LAPACKE_stgevc( int matrix_order, char side, char howmny, const lapack_logical* select, lapack_int n, const float* s, lapack_int lds, const float* p, lapack_int ldp, float* vl, lapack_int ldvl, float* vr, lapack_int ldvr, lapack_int mm, lapack_int* m ); lapack_int LAPACKE_dtgevc( int matrix_order, char side, char howmny, const lapack_logical* select, lapack_int n, const double* s, lapack_int lds, const double* p, lapack_int ldp, double* vl, lapack_int ldvl, double* vr, lapack_int ldvr, lapack_int mm, lapack_int* m ); lapack_int LAPACKE_ctgevc( int matrix_order, char side, char howmny, const lapack_logical* select, lapack_int n, const lapack_complex_float* s, lapack_int lds, const lapack_complex_float* p, lapack_int ldp, lapack_complex_float* vl, lapack_int ldvl, lapack_complex_float* vr, lapack_int ldvr, lapack_int mm, lapack_int* m ); lapack_int LAPACKE_ztgevc( int matrix_order, char side, char howmny, const lapack_logical* select, lapack_int n, const lapack_complex_double* s, lapack_int lds, const lapack_complex_double* p, lapack_int ldp, lapack_complex_double* vl, lapack_int ldvl, lapack_complex_double* vr, lapack_int ldvr, lapack_int mm, lapack_int* m ); lapack_int LAPACKE_stgexc( int matrix_order, lapack_logical wantq, lapack_logical wantz, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, float* q, lapack_int ldq, float* z, lapack_int ldz, lapack_int* ifst, lapack_int* ilst ); lapack_int LAPACKE_dtgexc( int matrix_order, lapack_logical wantq, lapack_logical wantz, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, double* q, lapack_int ldq, double* z, lapack_int ldz, lapack_int* ifst, lapack_int* ilst ); lapack_int LAPACKE_ctgexc( int matrix_order, lapack_logical wantq, lapack_logical wantz, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* q, lapack_int ldq, lapack_complex_float* z, lapack_int ldz, lapack_int ifst, lapack_int ilst ); lapack_int LAPACKE_ztgexc( int matrix_order, lapack_logical wantq, lapack_logical wantz, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* q, lapack_int ldq, lapack_complex_double* z, lapack_int ldz, lapack_int ifst, lapack_int ilst ); lapack_int LAPACKE_stgsen( int matrix_order, lapack_int ijob, lapack_logical wantq, lapack_logical wantz, const lapack_logical* select, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, float* alphar, float* alphai, float* beta, float* q, lapack_int ldq, float* z, lapack_int ldz, lapack_int* m, float* pl, float* pr, float* dif ); lapack_int LAPACKE_dtgsen( int matrix_order, lapack_int ijob, lapack_logical wantq, lapack_logical wantz, const lapack_logical* select, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, double* alphar, double* alphai, double* beta, double* q, lapack_int ldq, double* z, lapack_int ldz, lapack_int* m, double* pl, double* pr, double* dif ); lapack_int LAPACKE_ctgsen( int matrix_order, lapack_int ijob, lapack_logical wantq, lapack_logical wantz, const lapack_logical* select, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* alpha, lapack_complex_float* beta, lapack_complex_float* q, lapack_int ldq, lapack_complex_float* z, lapack_int ldz, lapack_int* m, float* pl, float* pr, float* dif ); lapack_int LAPACKE_ztgsen( int matrix_order, lapack_int ijob, lapack_logical wantq, lapack_logical wantz, const lapack_logical* select, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* alpha, lapack_complex_double* beta, lapack_complex_double* q, lapack_int ldq, lapack_complex_double* z, lapack_int ldz, lapack_int* m, double* pl, double* pr, double* dif ); lapack_int LAPACKE_stgsja( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int p, lapack_int n, lapack_int k, lapack_int l, float* a, lapack_int lda, float* b, lapack_int ldb, float tola, float tolb, float* alpha, float* beta, float* u, lapack_int ldu, float* v, lapack_int ldv, float* q, lapack_int ldq, lapack_int* ncycle ); lapack_int LAPACKE_dtgsja( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int p, lapack_int n, lapack_int k, lapack_int l, double* a, lapack_int lda, double* b, lapack_int ldb, double tola, double tolb, double* alpha, double* beta, double* u, lapack_int ldu, double* v, lapack_int ldv, double* q, lapack_int ldq, lapack_int* ncycle ); lapack_int LAPACKE_ctgsja( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int p, lapack_int n, lapack_int k, lapack_int l, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, float tola, float tolb, float* alpha, float* beta, lapack_complex_float* u, lapack_int ldu, lapack_complex_float* v, lapack_int ldv, lapack_complex_float* q, lapack_int ldq, lapack_int* ncycle ); lapack_int LAPACKE_ztgsja( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int p, lapack_int n, lapack_int k, lapack_int l, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, double tola, double tolb, double* alpha, double* beta, lapack_complex_double* u, lapack_int ldu, lapack_complex_double* v, lapack_int ldv, lapack_complex_double* q, lapack_int ldq, lapack_int* ncycle ); lapack_int LAPACKE_stgsna( int matrix_order, char job, char howmny, const lapack_logical* select, lapack_int n, const float* a, lapack_int lda, const float* b, lapack_int ldb, const float* vl, lapack_int ldvl, const float* vr, lapack_int ldvr, float* s, float* dif, lapack_int mm, lapack_int* m ); lapack_int LAPACKE_dtgsna( int matrix_order, char job, char howmny, const lapack_logical* select, lapack_int n, const double* a, lapack_int lda, const double* b, lapack_int ldb, const double* vl, lapack_int ldvl, const double* vr, lapack_int ldvr, double* s, double* dif, lapack_int mm, lapack_int* m ); lapack_int LAPACKE_ctgsna( int matrix_order, char job, char howmny, const lapack_logical* select, lapack_int n, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* b, lapack_int ldb, const lapack_complex_float* vl, lapack_int ldvl, const lapack_complex_float* vr, lapack_int ldvr, float* s, float* dif, lapack_int mm, lapack_int* m ); lapack_int LAPACKE_ztgsna( int matrix_order, char job, char howmny, const lapack_logical* select, lapack_int n, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* b, lapack_int ldb, const lapack_complex_double* vl, lapack_int ldvl, const lapack_complex_double* vr, lapack_int ldvr, double* s, double* dif, lapack_int mm, lapack_int* m ); lapack_int LAPACKE_stgsyl( int matrix_order, char trans, lapack_int ijob, lapack_int m, lapack_int n, const float* a, lapack_int lda, const float* b, lapack_int ldb, float* c, lapack_int ldc, const float* d, lapack_int ldd, const float* e, lapack_int lde, float* f, lapack_int ldf, float* scale, float* dif ); lapack_int LAPACKE_dtgsyl( int matrix_order, char trans, lapack_int ijob, lapack_int m, lapack_int n, const double* a, lapack_int lda, const double* b, lapack_int ldb, double* c, lapack_int ldc, const double* d, lapack_int ldd, const double* e, lapack_int lde, double* f, lapack_int ldf, double* scale, double* dif ); lapack_int LAPACKE_ctgsyl( int matrix_order, char trans, lapack_int ijob, lapack_int m, lapack_int n, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* c, lapack_int ldc, const lapack_complex_float* d, lapack_int ldd, const lapack_complex_float* e, lapack_int lde, lapack_complex_float* f, lapack_int ldf, float* scale, float* dif ); lapack_int LAPACKE_ztgsyl( int matrix_order, char trans, lapack_int ijob, lapack_int m, lapack_int n, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* c, lapack_int ldc, const lapack_complex_double* d, lapack_int ldd, const lapack_complex_double* e, lapack_int lde, lapack_complex_double* f, lapack_int ldf, double* scale, double* dif ); lapack_int LAPACKE_stpcon( int matrix_order, char norm, char uplo, char diag, lapack_int n, const float* ap, float* rcond ); lapack_int LAPACKE_dtpcon( int matrix_order, char norm, char uplo, char diag, lapack_int n, const double* ap, double* rcond ); lapack_int LAPACKE_ctpcon( int matrix_order, char norm, char uplo, char diag, lapack_int n, const lapack_complex_float* ap, float* rcond ); lapack_int LAPACKE_ztpcon( int matrix_order, char norm, char uplo, char diag, lapack_int n, const lapack_complex_double* ap, double* rcond ); lapack_int LAPACKE_stprfs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const float* ap, const float* b, lapack_int ldb, const float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_dtprfs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const double* ap, const double* b, lapack_int ldb, const double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_ctprfs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const lapack_complex_float* ap, const lapack_complex_float* b, lapack_int ldb, const lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_ztprfs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const lapack_complex_double* ap, const lapack_complex_double* b, lapack_int ldb, const lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_stptri( int matrix_order, char uplo, char diag, lapack_int n, float* ap ); lapack_int LAPACKE_dtptri( int matrix_order, char uplo, char diag, lapack_int n, double* ap ); lapack_int LAPACKE_ctptri( int matrix_order, char uplo, char diag, lapack_int n, lapack_complex_float* ap ); lapack_int LAPACKE_ztptri( int matrix_order, char uplo, char diag, lapack_int n, lapack_complex_double* ap ); lapack_int LAPACKE_stptrs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const float* ap, float* b, lapack_int ldb ); lapack_int LAPACKE_dtptrs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const double* ap, double* b, lapack_int ldb ); lapack_int LAPACKE_ctptrs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const lapack_complex_float* ap, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_ztptrs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const lapack_complex_double* ap, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_stpttf( int matrix_order, char transr, char uplo, lapack_int n, const float* ap, float* arf ); lapack_int LAPACKE_dtpttf( int matrix_order, char transr, char uplo, lapack_int n, const double* ap, double* arf ); lapack_int LAPACKE_ctpttf( int matrix_order, char transr, char uplo, lapack_int n, const lapack_complex_float* ap, lapack_complex_float* arf ); lapack_int LAPACKE_ztpttf( int matrix_order, char transr, char uplo, lapack_int n, const lapack_complex_double* ap, lapack_complex_double* arf ); lapack_int LAPACKE_stpttr( int matrix_order, char uplo, lapack_int n, const float* ap, float* a, lapack_int lda ); lapack_int LAPACKE_dtpttr( int matrix_order, char uplo, lapack_int n, const double* ap, double* a, lapack_int lda ); lapack_int LAPACKE_ctpttr( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* ap, lapack_complex_float* a, lapack_int lda ); lapack_int LAPACKE_ztpttr( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* ap, lapack_complex_double* a, lapack_int lda ); lapack_int LAPACKE_strcon( int matrix_order, char norm, char uplo, char diag, lapack_int n, const float* a, lapack_int lda, float* rcond ); lapack_int LAPACKE_dtrcon( int matrix_order, char norm, char uplo, char diag, lapack_int n, const double* a, lapack_int lda, double* rcond ); lapack_int LAPACKE_ctrcon( int matrix_order, char norm, char uplo, char diag, lapack_int n, const lapack_complex_float* a, lapack_int lda, float* rcond ); lapack_int LAPACKE_ztrcon( int matrix_order, char norm, char uplo, char diag, lapack_int n, const lapack_complex_double* a, lapack_int lda, double* rcond ); lapack_int LAPACKE_strevc( int matrix_order, char side, char howmny, lapack_logical* select, lapack_int n, const float* t, lapack_int ldt, float* vl, lapack_int ldvl, float* vr, lapack_int ldvr, lapack_int mm, lapack_int* m ); lapack_int LAPACKE_dtrevc( int matrix_order, char side, char howmny, lapack_logical* select, lapack_int n, const double* t, lapack_int ldt, double* vl, lapack_int ldvl, double* vr, lapack_int ldvr, lapack_int mm, lapack_int* m ); lapack_int LAPACKE_ctrevc( int matrix_order, char side, char howmny, const lapack_logical* select, lapack_int n, lapack_complex_float* t, lapack_int ldt, lapack_complex_float* vl, lapack_int ldvl, lapack_complex_float* vr, lapack_int ldvr, lapack_int mm, lapack_int* m ); lapack_int LAPACKE_ztrevc( int matrix_order, char side, char howmny, const lapack_logical* select, lapack_int n, lapack_complex_double* t, lapack_int ldt, lapack_complex_double* vl, lapack_int ldvl, lapack_complex_double* vr, lapack_int ldvr, lapack_int mm, lapack_int* m ); lapack_int LAPACKE_strexc( int matrix_order, char compq, lapack_int n, float* t, lapack_int ldt, float* q, lapack_int ldq, lapack_int* ifst, lapack_int* ilst ); lapack_int LAPACKE_dtrexc( int matrix_order, char compq, lapack_int n, double* t, lapack_int ldt, double* q, lapack_int ldq, lapack_int* ifst, lapack_int* ilst ); lapack_int LAPACKE_ctrexc( int matrix_order, char compq, lapack_int n, lapack_complex_float* t, lapack_int ldt, lapack_complex_float* q, lapack_int ldq, lapack_int ifst, lapack_int ilst ); lapack_int LAPACKE_ztrexc( int matrix_order, char compq, lapack_int n, lapack_complex_double* t, lapack_int ldt, lapack_complex_double* q, lapack_int ldq, lapack_int ifst, lapack_int ilst ); lapack_int LAPACKE_strrfs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, const float* b, lapack_int ldb, const float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_dtrrfs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, const double* b, lapack_int ldb, const double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_ctrrfs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* b, lapack_int ldb, const lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr ); lapack_int LAPACKE_ztrrfs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* b, lapack_int ldb, const lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr ); lapack_int LAPACKE_strsen( int matrix_order, char job, char compq, const lapack_logical* select, lapack_int n, float* t, lapack_int ldt, float* q, lapack_int ldq, float* wr, float* wi, lapack_int* m, float* s, float* sep ); lapack_int LAPACKE_dtrsen( int matrix_order, char job, char compq, const lapack_logical* select, lapack_int n, double* t, lapack_int ldt, double* q, lapack_int ldq, double* wr, double* wi, lapack_int* m, double* s, double* sep ); lapack_int LAPACKE_ctrsen( int matrix_order, char job, char compq, const lapack_logical* select, lapack_int n, lapack_complex_float* t, lapack_int ldt, lapack_complex_float* q, lapack_int ldq, lapack_complex_float* w, lapack_int* m, float* s, float* sep ); lapack_int LAPACKE_ztrsen( int matrix_order, char job, char compq, const lapack_logical* select, lapack_int n, lapack_complex_double* t, lapack_int ldt, lapack_complex_double* q, lapack_int ldq, lapack_complex_double* w, lapack_int* m, double* s, double* sep ); lapack_int LAPACKE_strsna( int matrix_order, char job, char howmny, const lapack_logical* select, lapack_int n, const float* t, lapack_int ldt, const float* vl, lapack_int ldvl, const float* vr, lapack_int ldvr, float* s, float* sep, lapack_int mm, lapack_int* m ); lapack_int LAPACKE_dtrsna( int matrix_order, char job, char howmny, const lapack_logical* select, lapack_int n, const double* t, lapack_int ldt, const double* vl, lapack_int ldvl, const double* vr, lapack_int ldvr, double* s, double* sep, lapack_int mm, lapack_int* m ); lapack_int LAPACKE_ctrsna( int matrix_order, char job, char howmny, const lapack_logical* select, lapack_int n, const lapack_complex_float* t, lapack_int ldt, const lapack_complex_float* vl, lapack_int ldvl, const lapack_complex_float* vr, lapack_int ldvr, float* s, float* sep, lapack_int mm, lapack_int* m ); lapack_int LAPACKE_ztrsna( int matrix_order, char job, char howmny, const lapack_logical* select, lapack_int n, const lapack_complex_double* t, lapack_int ldt, const lapack_complex_double* vl, lapack_int ldvl, const lapack_complex_double* vr, lapack_int ldvr, double* s, double* sep, lapack_int mm, lapack_int* m ); lapack_int LAPACKE_strsyl( int matrix_order, char trana, char tranb, lapack_int isgn, lapack_int m, lapack_int n, const float* a, lapack_int lda, const float* b, lapack_int ldb, float* c, lapack_int ldc, float* scale ); lapack_int LAPACKE_dtrsyl( int matrix_order, char trana, char tranb, lapack_int isgn, lapack_int m, lapack_int n, const double* a, lapack_int lda, const double* b, lapack_int ldb, double* c, lapack_int ldc, double* scale ); lapack_int LAPACKE_ctrsyl( int matrix_order, char trana, char tranb, lapack_int isgn, lapack_int m, lapack_int n, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* c, lapack_int ldc, float* scale ); lapack_int LAPACKE_ztrsyl( int matrix_order, char trana, char tranb, lapack_int isgn, lapack_int m, lapack_int n, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* c, lapack_int ldc, double* scale ); lapack_int LAPACKE_strtri( int matrix_order, char uplo, char diag, lapack_int n, float* a, lapack_int lda ); lapack_int LAPACKE_dtrtri( int matrix_order, char uplo, char diag, lapack_int n, double* a, lapack_int lda ); lapack_int LAPACKE_ctrtri( int matrix_order, char uplo, char diag, lapack_int n, lapack_complex_float* a, lapack_int lda ); lapack_int LAPACKE_ztrtri( int matrix_order, char uplo, char diag, lapack_int n, lapack_complex_double* a, lapack_int lda ); lapack_int LAPACKE_strtrs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, float* b, lapack_int ldb ); lapack_int LAPACKE_dtrtrs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, double* b, lapack_int ldb ); lapack_int LAPACKE_ctrtrs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_ztrtrs( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_strttf( int matrix_order, char transr, char uplo, lapack_int n, const float* a, lapack_int lda, float* arf ); lapack_int LAPACKE_dtrttf( int matrix_order, char transr, char uplo, lapack_int n, const double* a, lapack_int lda, double* arf ); lapack_int LAPACKE_ctrttf( int matrix_order, char transr, char uplo, lapack_int n, const lapack_complex_float* a, lapack_int lda, lapack_complex_float* arf ); lapack_int LAPACKE_ztrttf( int matrix_order, char transr, char uplo, lapack_int n, const lapack_complex_double* a, lapack_int lda, lapack_complex_double* arf ); lapack_int LAPACKE_strttp( int matrix_order, char uplo, lapack_int n, const float* a, lapack_int lda, float* ap ); lapack_int LAPACKE_dtrttp( int matrix_order, char uplo, lapack_int n, const double* a, lapack_int lda, double* ap ); lapack_int LAPACKE_ctrttp( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* a, lapack_int lda, lapack_complex_float* ap ); lapack_int LAPACKE_ztrttp( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* a, lapack_int lda, lapack_complex_double* ap ); lapack_int LAPACKE_stzrzf( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* tau ); lapack_int LAPACKE_dtzrzf( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* tau ); lapack_int LAPACKE_ctzrzf( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* tau ); lapack_int LAPACKE_ztzrzf( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* tau ); lapack_int LAPACKE_cungbr( int matrix_order, char vect, lapack_int m, lapack_int n, lapack_int k, lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau ); lapack_int LAPACKE_zungbr( int matrix_order, char vect, lapack_int m, lapack_int n, lapack_int k, lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau ); lapack_int LAPACKE_cunghr( int matrix_order, lapack_int n, lapack_int ilo, lapack_int ihi, lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau ); lapack_int LAPACKE_zunghr( int matrix_order, lapack_int n, lapack_int ilo, lapack_int ihi, lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau ); lapack_int LAPACKE_cunglq( int matrix_order, lapack_int m, lapack_int n, lapack_int k, lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau ); lapack_int LAPACKE_zunglq( int matrix_order, lapack_int m, lapack_int n, lapack_int k, lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau ); lapack_int LAPACKE_cungql( int matrix_order, lapack_int m, lapack_int n, lapack_int k, lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau ); lapack_int LAPACKE_zungql( int matrix_order, lapack_int m, lapack_int n, lapack_int k, lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau ); lapack_int LAPACKE_cungqr( int matrix_order, lapack_int m, lapack_int n, lapack_int k, lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau ); lapack_int LAPACKE_zungqr( int matrix_order, lapack_int m, lapack_int n, lapack_int k, lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau ); lapack_int LAPACKE_cungrq( int matrix_order, lapack_int m, lapack_int n, lapack_int k, lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau ); lapack_int LAPACKE_zungrq( int matrix_order, lapack_int m, lapack_int n, lapack_int k, lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau ); lapack_int LAPACKE_cungtr( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau ); lapack_int LAPACKE_zungtr( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau ); lapack_int LAPACKE_cunmbr( int matrix_order, char vect, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int ldc ); lapack_int LAPACKE_zunmbr( int matrix_order, char vect, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int ldc ); lapack_int LAPACKE_cunmhr( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int ilo, lapack_int ihi, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int ldc ); lapack_int LAPACKE_zunmhr( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int ilo, lapack_int ihi, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int ldc ); lapack_int LAPACKE_cunmlq( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int ldc ); lapack_int LAPACKE_zunmlq( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int ldc ); lapack_int LAPACKE_cunmql( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int ldc ); lapack_int LAPACKE_zunmql( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int ldc ); lapack_int LAPACKE_cunmqr( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int ldc ); lapack_int LAPACKE_zunmqr( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int ldc ); lapack_int LAPACKE_cunmrq( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int ldc ); lapack_int LAPACKE_zunmrq( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int ldc ); lapack_int LAPACKE_cunmrz( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int l, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int ldc ); lapack_int LAPACKE_zunmrz( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int l, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int ldc ); lapack_int LAPACKE_cunmtr( int matrix_order, char side, char uplo, char trans, lapack_int m, lapack_int n, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int ldc ); lapack_int LAPACKE_zunmtr( int matrix_order, char side, char uplo, char trans, lapack_int m, lapack_int n, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int ldc ); lapack_int LAPACKE_cupgtr( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* ap, const lapack_complex_float* tau, lapack_complex_float* q, lapack_int ldq ); lapack_int LAPACKE_zupgtr( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* ap, const lapack_complex_double* tau, lapack_complex_double* q, lapack_int ldq ); lapack_int LAPACKE_cupmtr( int matrix_order, char side, char uplo, char trans, lapack_int m, lapack_int n, const lapack_complex_float* ap, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int ldc ); lapack_int LAPACKE_zupmtr( int matrix_order, char side, char uplo, char trans, lapack_int m, lapack_int n, const lapack_complex_double* ap, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int ldc ); lapack_int LAPACKE_sbdsdc_work( int matrix_order, char uplo, char compq, lapack_int n, float* d, float* e, float* u, lapack_int ldu, float* vt, lapack_int ldvt, float* q, lapack_int* iq, float* work, lapack_int* iwork ); lapack_int LAPACKE_dbdsdc_work( int matrix_order, char uplo, char compq, lapack_int n, double* d, double* e, double* u, lapack_int ldu, double* vt, lapack_int ldvt, double* q, lapack_int* iq, double* work, lapack_int* iwork ); lapack_int LAPACKE_sbdsqr_work( int matrix_order, char uplo, lapack_int n, lapack_int ncvt, lapack_int nru, lapack_int ncc, float* d, float* e, float* vt, lapack_int ldvt, float* u, lapack_int ldu, float* c, lapack_int ldc, float* work ); lapack_int LAPACKE_dbdsqr_work( int matrix_order, char uplo, lapack_int n, lapack_int ncvt, lapack_int nru, lapack_int ncc, double* d, double* e, double* vt, lapack_int ldvt, double* u, lapack_int ldu, double* c, lapack_int ldc, double* work ); lapack_int LAPACKE_cbdsqr_work( int matrix_order, char uplo, lapack_int n, lapack_int ncvt, lapack_int nru, lapack_int ncc, float* d, float* e, lapack_complex_float* vt, lapack_int ldvt, lapack_complex_float* u, lapack_int ldu, lapack_complex_float* c, lapack_int ldc, float* work ); lapack_int LAPACKE_zbdsqr_work( int matrix_order, char uplo, lapack_int n, lapack_int ncvt, lapack_int nru, lapack_int ncc, double* d, double* e, lapack_complex_double* vt, lapack_int ldvt, lapack_complex_double* u, lapack_int ldu, lapack_complex_double* c, lapack_int ldc, double* work ); lapack_int LAPACKE_sdisna_work( char job, lapack_int m, lapack_int n, const float* d, float* sep ); lapack_int LAPACKE_ddisna_work( char job, lapack_int m, lapack_int n, const double* d, double* sep ); lapack_int LAPACKE_sgbbrd_work( int matrix_order, char vect, lapack_int m, lapack_int n, lapack_int ncc, lapack_int kl, lapack_int ku, float* ab, lapack_int ldab, float* d, float* e, float* q, lapack_int ldq, float* pt, lapack_int ldpt, float* c, lapack_int ldc, float* work ); lapack_int LAPACKE_dgbbrd_work( int matrix_order, char vect, lapack_int m, lapack_int n, lapack_int ncc, lapack_int kl, lapack_int ku, double* ab, lapack_int ldab, double* d, double* e, double* q, lapack_int ldq, double* pt, lapack_int ldpt, double* c, lapack_int ldc, double* work ); lapack_int LAPACKE_cgbbrd_work( int matrix_order, char vect, lapack_int m, lapack_int n, lapack_int ncc, lapack_int kl, lapack_int ku, lapack_complex_float* ab, lapack_int ldab, float* d, float* e, lapack_complex_float* q, lapack_int ldq, lapack_complex_float* pt, lapack_int ldpt, lapack_complex_float* c, lapack_int ldc, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zgbbrd_work( int matrix_order, char vect, lapack_int m, lapack_int n, lapack_int ncc, lapack_int kl, lapack_int ku, lapack_complex_double* ab, lapack_int ldab, double* d, double* e, lapack_complex_double* q, lapack_int ldq, lapack_complex_double* pt, lapack_int ldpt, lapack_complex_double* c, lapack_int ldc, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_sgbcon_work( int matrix_order, char norm, lapack_int n, lapack_int kl, lapack_int ku, const float* ab, lapack_int ldab, const lapack_int* ipiv, float anorm, float* rcond, float* work, lapack_int* iwork ); lapack_int LAPACKE_dgbcon_work( int matrix_order, char norm, lapack_int n, lapack_int kl, lapack_int ku, const double* ab, lapack_int ldab, const lapack_int* ipiv, double anorm, double* rcond, double* work, lapack_int* iwork ); lapack_int LAPACKE_cgbcon_work( int matrix_order, char norm, lapack_int n, lapack_int kl, lapack_int ku, const lapack_complex_float* ab, lapack_int ldab, const lapack_int* ipiv, float anorm, float* rcond, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zgbcon_work( int matrix_order, char norm, lapack_int n, lapack_int kl, lapack_int ku, const lapack_complex_double* ab, lapack_int ldab, const lapack_int* ipiv, double anorm, double* rcond, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_sgbequ_work( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const float* ab, lapack_int ldab, float* r, float* c, float* rowcnd, float* colcnd, float* amax ); lapack_int LAPACKE_dgbequ_work( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const double* ab, lapack_int ldab, double* r, double* c, double* rowcnd, double* colcnd, double* amax ); lapack_int LAPACKE_cgbequ_work( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const lapack_complex_float* ab, lapack_int ldab, float* r, float* c, float* rowcnd, float* colcnd, float* amax ); lapack_int LAPACKE_zgbequ_work( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const lapack_complex_double* ab, lapack_int ldab, double* r, double* c, double* rowcnd, double* colcnd, double* amax ); lapack_int LAPACKE_sgbequb_work( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const float* ab, lapack_int ldab, float* r, float* c, float* rowcnd, float* colcnd, float* amax ); lapack_int LAPACKE_dgbequb_work( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const double* ab, lapack_int ldab, double* r, double* c, double* rowcnd, double* colcnd, double* amax ); lapack_int LAPACKE_cgbequb_work( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const lapack_complex_float* ab, lapack_int ldab, float* r, float* c, float* rowcnd, float* colcnd, float* amax ); lapack_int LAPACKE_zgbequb_work( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const lapack_complex_double* ab, lapack_int ldab, double* r, double* c, double* rowcnd, double* colcnd, double* amax ); lapack_int LAPACKE_sgbrfs_work( int matrix_order, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const float* ab, lapack_int ldab, const float* afb, lapack_int ldafb, const lapack_int* ipiv, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* ferr, float* berr, float* work, lapack_int* iwork ); lapack_int LAPACKE_dgbrfs_work( int matrix_order, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const double* ab, lapack_int ldab, const double* afb, lapack_int ldafb, const lapack_int* ipiv, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* ferr, double* berr, double* work, lapack_int* iwork ); lapack_int LAPACKE_cgbrfs_work( int matrix_order, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const lapack_complex_float* ab, lapack_int ldab, const lapack_complex_float* afb, lapack_int ldafb, const lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zgbrfs_work( int matrix_order, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const lapack_complex_double* ab, lapack_int ldab, const lapack_complex_double* afb, lapack_int ldafb, const lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_sgbrfsx_work( int matrix_order, char trans, char equed, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const float* ab, lapack_int ldab, const float* afb, lapack_int ldafb, const lapack_int* ipiv, const float* r, const float* c, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params, float* work, lapack_int* iwork ); lapack_int LAPACKE_dgbrfsx_work( int matrix_order, char trans, char equed, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const double* ab, lapack_int ldab, const double* afb, lapack_int ldafb, const lapack_int* ipiv, const double* r, const double* c, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params, double* work, lapack_int* iwork ); lapack_int LAPACKE_cgbrfsx_work( int matrix_order, char trans, char equed, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const lapack_complex_float* ab, lapack_int ldab, const lapack_complex_float* afb, lapack_int ldafb, const lapack_int* ipiv, const float* r, const float* c, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zgbrfsx_work( int matrix_order, char trans, char equed, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const lapack_complex_double* ab, lapack_int ldab, const lapack_complex_double* afb, lapack_int ldafb, const lapack_int* ipiv, const double* r, const double* c, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_sgbsv_work( int matrix_order, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, float* ab, lapack_int ldab, lapack_int* ipiv, float* b, lapack_int ldb ); lapack_int LAPACKE_dgbsv_work( int matrix_order, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, double* ab, lapack_int ldab, lapack_int* ipiv, double* b, lapack_int ldb ); lapack_int LAPACKE_cgbsv_work( int matrix_order, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, lapack_complex_float* ab, lapack_int ldab, lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zgbsv_work( int matrix_order, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, lapack_complex_double* ab, lapack_int ldab, lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_sgbsvx_work( int matrix_order, char fact, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, float* ab, lapack_int ldab, float* afb, lapack_int ldafb, lapack_int* ipiv, char* equed, float* r, float* c, float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, float* work, lapack_int* iwork ); lapack_int LAPACKE_dgbsvx_work( int matrix_order, char fact, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, double* ab, lapack_int ldab, double* afb, lapack_int ldafb, lapack_int* ipiv, char* equed, double* r, double* c, double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, double* work, lapack_int* iwork ); lapack_int LAPACKE_cgbsvx_work( int matrix_order, char fact, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, lapack_complex_float* ab, lapack_int ldab, lapack_complex_float* afb, lapack_int ldafb, lapack_int* ipiv, char* equed, float* r, float* c, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zgbsvx_work( int matrix_order, char fact, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, lapack_complex_double* ab, lapack_int ldab, lapack_complex_double* afb, lapack_int ldafb, lapack_int* ipiv, char* equed, double* r, double* c, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_sgbsvxx_work( int matrix_order, char fact, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, float* ab, lapack_int ldab, float* afb, lapack_int ldafb, lapack_int* ipiv, char* equed, float* r, float* c, float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* rpvgrw, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params, float* work, lapack_int* iwork ); lapack_int LAPACKE_dgbsvxx_work( int matrix_order, char fact, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, double* ab, lapack_int ldab, double* afb, lapack_int ldafb, lapack_int* ipiv, char* equed, double* r, double* c, double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* rpvgrw, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params, double* work, lapack_int* iwork ); lapack_int LAPACKE_cgbsvxx_work( int matrix_order, char fact, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, lapack_complex_float* ab, lapack_int ldab, lapack_complex_float* afb, lapack_int ldafb, lapack_int* ipiv, char* equed, float* r, float* c, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* rpvgrw, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zgbsvxx_work( int matrix_order, char fact, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, lapack_complex_double* ab, lapack_int ldab, lapack_complex_double* afb, lapack_int ldafb, lapack_int* ipiv, char* equed, double* r, double* c, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* rpvgrw, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_sgbtrf_work( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, float* ab, lapack_int ldab, lapack_int* ipiv ); lapack_int LAPACKE_dgbtrf_work( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, double* ab, lapack_int ldab, lapack_int* ipiv ); lapack_int LAPACKE_cgbtrf_work( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, lapack_complex_float* ab, lapack_int ldab, lapack_int* ipiv ); lapack_int LAPACKE_zgbtrf_work( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, lapack_complex_double* ab, lapack_int ldab, lapack_int* ipiv ); lapack_int LAPACKE_sgbtrs_work( int matrix_order, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const float* ab, lapack_int ldab, const lapack_int* ipiv, float* b, lapack_int ldb ); lapack_int LAPACKE_dgbtrs_work( int matrix_order, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const double* ab, lapack_int ldab, const lapack_int* ipiv, double* b, lapack_int ldb ); lapack_int LAPACKE_cgbtrs_work( int matrix_order, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const lapack_complex_float* ab, lapack_int ldab, const lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zgbtrs_work( int matrix_order, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const lapack_complex_double* ab, lapack_int ldab, const lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_sgebak_work( int matrix_order, char job, char side, lapack_int n, lapack_int ilo, lapack_int ihi, const float* scale, lapack_int m, float* v, lapack_int ldv ); lapack_int LAPACKE_dgebak_work( int matrix_order, char job, char side, lapack_int n, lapack_int ilo, lapack_int ihi, const double* scale, lapack_int m, double* v, lapack_int ldv ); lapack_int LAPACKE_cgebak_work( int matrix_order, char job, char side, lapack_int n, lapack_int ilo, lapack_int ihi, const float* scale, lapack_int m, lapack_complex_float* v, lapack_int ldv ); lapack_int LAPACKE_zgebak_work( int matrix_order, char job, char side, lapack_int n, lapack_int ilo, lapack_int ihi, const double* scale, lapack_int m, lapack_complex_double* v, lapack_int ldv ); lapack_int LAPACKE_sgebal_work( int matrix_order, char job, lapack_int n, float* a, lapack_int lda, lapack_int* ilo, lapack_int* ihi, float* scale ); lapack_int LAPACKE_dgebal_work( int matrix_order, char job, lapack_int n, double* a, lapack_int lda, lapack_int* ilo, lapack_int* ihi, double* scale ); lapack_int LAPACKE_cgebal_work( int matrix_order, char job, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_int* ilo, lapack_int* ihi, float* scale ); lapack_int LAPACKE_zgebal_work( int matrix_order, char job, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_int* ilo, lapack_int* ihi, double* scale ); lapack_int LAPACKE_sgebrd_work( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* d, float* e, float* tauq, float* taup, float* work, lapack_int lwork ); lapack_int LAPACKE_dgebrd_work( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* d, double* e, double* tauq, double* taup, double* work, lapack_int lwork ); lapack_int LAPACKE_cgebrd_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, float* d, float* e, lapack_complex_float* tauq, lapack_complex_float* taup, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zgebrd_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, double* d, double* e, lapack_complex_double* tauq, lapack_complex_double* taup, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_sgecon_work( int matrix_order, char norm, lapack_int n, const float* a, lapack_int lda, float anorm, float* rcond, float* work, lapack_int* iwork ); lapack_int LAPACKE_dgecon_work( int matrix_order, char norm, lapack_int n, const double* a, lapack_int lda, double anorm, double* rcond, double* work, lapack_int* iwork ); lapack_int LAPACKE_cgecon_work( int matrix_order, char norm, lapack_int n, const lapack_complex_float* a, lapack_int lda, float anorm, float* rcond, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zgecon_work( int matrix_order, char norm, lapack_int n, const lapack_complex_double* a, lapack_int lda, double anorm, double* rcond, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_sgeequ_work( int matrix_order, lapack_int m, lapack_int n, const float* a, lapack_int lda, float* r, float* c, float* rowcnd, float* colcnd, float* amax ); lapack_int LAPACKE_dgeequ_work( int matrix_order, lapack_int m, lapack_int n, const double* a, lapack_int lda, double* r, double* c, double* rowcnd, double* colcnd, double* amax ); lapack_int LAPACKE_cgeequ_work( int matrix_order, lapack_int m, lapack_int n, const lapack_complex_float* a, lapack_int lda, float* r, float* c, float* rowcnd, float* colcnd, float* amax ); lapack_int LAPACKE_zgeequ_work( int matrix_order, lapack_int m, lapack_int n, const lapack_complex_double* a, lapack_int lda, double* r, double* c, double* rowcnd, double* colcnd, double* amax ); lapack_int LAPACKE_sgeequb_work( int matrix_order, lapack_int m, lapack_int n, const float* a, lapack_int lda, float* r, float* c, float* rowcnd, float* colcnd, float* amax ); lapack_int LAPACKE_dgeequb_work( int matrix_order, lapack_int m, lapack_int n, const double* a, lapack_int lda, double* r, double* c, double* rowcnd, double* colcnd, double* amax ); lapack_int LAPACKE_cgeequb_work( int matrix_order, lapack_int m, lapack_int n, const lapack_complex_float* a, lapack_int lda, float* r, float* c, float* rowcnd, float* colcnd, float* amax ); lapack_int LAPACKE_zgeequb_work( int matrix_order, lapack_int m, lapack_int n, const lapack_complex_double* a, lapack_int lda, double* r, double* c, double* rowcnd, double* colcnd, double* amax ); lapack_int LAPACKE_sgees_work( int matrix_order, char jobvs, char sort, LAPACK_S_SELECT2 select, lapack_int n, float* a, lapack_int lda, lapack_int* sdim, float* wr, float* wi, float* vs, lapack_int ldvs, float* work, lapack_int lwork, lapack_logical* bwork ); lapack_int LAPACKE_dgees_work( int matrix_order, char jobvs, char sort, LAPACK_D_SELECT2 select, lapack_int n, double* a, lapack_int lda, lapack_int* sdim, double* wr, double* wi, double* vs, lapack_int ldvs, double* work, lapack_int lwork, lapack_logical* bwork ); lapack_int LAPACKE_cgees_work( int matrix_order, char jobvs, char sort, LAPACK_C_SELECT1 select, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_int* sdim, lapack_complex_float* w, lapack_complex_float* vs, lapack_int ldvs, lapack_complex_float* work, lapack_int lwork, float* rwork, lapack_logical* bwork ); lapack_int LAPACKE_zgees_work( int matrix_order, char jobvs, char sort, LAPACK_Z_SELECT1 select, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_int* sdim, lapack_complex_double* w, lapack_complex_double* vs, lapack_int ldvs, lapack_complex_double* work, lapack_int lwork, double* rwork, lapack_logical* bwork ); lapack_int LAPACKE_sgeesx_work( int matrix_order, char jobvs, char sort, LAPACK_S_SELECT2 select, char sense, lapack_int n, float* a, lapack_int lda, lapack_int* sdim, float* wr, float* wi, float* vs, lapack_int ldvs, float* rconde, float* rcondv, float* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork, lapack_logical* bwork ); lapack_int LAPACKE_dgeesx_work( int matrix_order, char jobvs, char sort, LAPACK_D_SELECT2 select, char sense, lapack_int n, double* a, lapack_int lda, lapack_int* sdim, double* wr, double* wi, double* vs, lapack_int ldvs, double* rconde, double* rcondv, double* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork, lapack_logical* bwork ); lapack_int LAPACKE_cgeesx_work( int matrix_order, char jobvs, char sort, LAPACK_C_SELECT1 select, char sense, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_int* sdim, lapack_complex_float* w, lapack_complex_float* vs, lapack_int ldvs, float* rconde, float* rcondv, lapack_complex_float* work, lapack_int lwork, float* rwork, lapack_logical* bwork ); lapack_int LAPACKE_zgeesx_work( int matrix_order, char jobvs, char sort, LAPACK_Z_SELECT1 select, char sense, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_int* sdim, lapack_complex_double* w, lapack_complex_double* vs, lapack_int ldvs, double* rconde, double* rcondv, lapack_complex_double* work, lapack_int lwork, double* rwork, lapack_logical* bwork ); lapack_int LAPACKE_sgeev_work( int matrix_order, char jobvl, char jobvr, lapack_int n, float* a, lapack_int lda, float* wr, float* wi, float* vl, lapack_int ldvl, float* vr, lapack_int ldvr, float* work, lapack_int lwork ); lapack_int LAPACKE_dgeev_work( int matrix_order, char jobvl, char jobvr, lapack_int n, double* a, lapack_int lda, double* wr, double* wi, double* vl, lapack_int ldvl, double* vr, lapack_int ldvr, double* work, lapack_int lwork ); lapack_int LAPACKE_cgeev_work( int matrix_order, char jobvl, char jobvr, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* w, lapack_complex_float* vl, lapack_int ldvl, lapack_complex_float* vr, lapack_int ldvr, lapack_complex_float* work, lapack_int lwork, float* rwork ); lapack_int LAPACKE_zgeev_work( int matrix_order, char jobvl, char jobvr, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* w, lapack_complex_double* vl, lapack_int ldvl, lapack_complex_double* vr, lapack_int ldvr, lapack_complex_double* work, lapack_int lwork, double* rwork ); lapack_int LAPACKE_sgeevx_work( int matrix_order, char balanc, char jobvl, char jobvr, char sense, lapack_int n, float* a, lapack_int lda, float* wr, float* wi, float* vl, lapack_int ldvl, float* vr, lapack_int ldvr, lapack_int* ilo, lapack_int* ihi, float* scale, float* abnrm, float* rconde, float* rcondv, float* work, lapack_int lwork, lapack_int* iwork ); lapack_int LAPACKE_dgeevx_work( int matrix_order, char balanc, char jobvl, char jobvr, char sense, lapack_int n, double* a, lapack_int lda, double* wr, double* wi, double* vl, lapack_int ldvl, double* vr, lapack_int ldvr, lapack_int* ilo, lapack_int* ihi, double* scale, double* abnrm, double* rconde, double* rcondv, double* work, lapack_int lwork, lapack_int* iwork ); lapack_int LAPACKE_cgeevx_work( int matrix_order, char balanc, char jobvl, char jobvr, char sense, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* w, lapack_complex_float* vl, lapack_int ldvl, lapack_complex_float* vr, lapack_int ldvr, lapack_int* ilo, lapack_int* ihi, float* scale, float* abnrm, float* rconde, float* rcondv, lapack_complex_float* work, lapack_int lwork, float* rwork ); lapack_int LAPACKE_zgeevx_work( int matrix_order, char balanc, char jobvl, char jobvr, char sense, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* w, lapack_complex_double* vl, lapack_int ldvl, lapack_complex_double* vr, lapack_int ldvr, lapack_int* ilo, lapack_int* ihi, double* scale, double* abnrm, double* rconde, double* rcondv, lapack_complex_double* work, lapack_int lwork, double* rwork ); lapack_int LAPACKE_sgehrd_work( int matrix_order, lapack_int n, lapack_int ilo, lapack_int ihi, float* a, lapack_int lda, float* tau, float* work, lapack_int lwork ); lapack_int LAPACKE_dgehrd_work( int matrix_order, lapack_int n, lapack_int ilo, lapack_int ihi, double* a, lapack_int lda, double* tau, double* work, lapack_int lwork ); lapack_int LAPACKE_cgehrd_work( int matrix_order, lapack_int n, lapack_int ilo, lapack_int ihi, lapack_complex_float* a, lapack_int lda, lapack_complex_float* tau, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zgehrd_work( int matrix_order, lapack_int n, lapack_int ilo, lapack_int ihi, lapack_complex_double* a, lapack_int lda, lapack_complex_double* tau, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_sgejsv_work( int matrix_order, char joba, char jobu, char jobv, char jobr, char jobt, char jobp, lapack_int m, lapack_int n, float* a, lapack_int lda, float* sva, float* u, lapack_int ldu, float* v, lapack_int ldv, float* work, lapack_int lwork, lapack_int* iwork ); lapack_int LAPACKE_dgejsv_work( int matrix_order, char joba, char jobu, char jobv, char jobr, char jobt, char jobp, lapack_int m, lapack_int n, double* a, lapack_int lda, double* sva, double* u, lapack_int ldu, double* v, lapack_int ldv, double* work, lapack_int lwork, lapack_int* iwork ); lapack_int LAPACKE_sgelq2_work( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* tau, float* work ); lapack_int LAPACKE_dgelq2_work( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* tau, double* work ); lapack_int LAPACKE_cgelq2_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* tau, lapack_complex_float* work ); lapack_int LAPACKE_zgelq2_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* tau, lapack_complex_double* work ); lapack_int LAPACKE_sgelqf_work( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* tau, float* work, lapack_int lwork ); lapack_int LAPACKE_dgelqf_work( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* tau, double* work, lapack_int lwork ); lapack_int LAPACKE_cgelqf_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* tau, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zgelqf_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* tau, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_sgels_work( int matrix_order, char trans, lapack_int m, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, float* b, lapack_int ldb, float* work, lapack_int lwork ); lapack_int LAPACKE_dgels_work( int matrix_order, char trans, lapack_int m, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* b, lapack_int ldb, double* work, lapack_int lwork ); lapack_int LAPACKE_cgels_work( int matrix_order, char trans, lapack_int m, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zgels_work( int matrix_order, char trans, lapack_int m, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_sgelsd_work( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, float* b, lapack_int ldb, float* s, float rcond, lapack_int* rank, float* work, lapack_int lwork, lapack_int* iwork ); lapack_int LAPACKE_dgelsd_work( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* b, lapack_int ldb, double* s, double rcond, lapack_int* rank, double* work, lapack_int lwork, lapack_int* iwork ); lapack_int LAPACKE_cgelsd_work( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, float* s, float rcond, lapack_int* rank, lapack_complex_float* work, lapack_int lwork, float* rwork, lapack_int* iwork ); lapack_int LAPACKE_zgelsd_work( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, double* s, double rcond, lapack_int* rank, lapack_complex_double* work, lapack_int lwork, double* rwork, lapack_int* iwork ); lapack_int LAPACKE_sgelss_work( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, float* b, lapack_int ldb, float* s, float rcond, lapack_int* rank, float* work, lapack_int lwork ); lapack_int LAPACKE_dgelss_work( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* b, lapack_int ldb, double* s, double rcond, lapack_int* rank, double* work, lapack_int lwork ); lapack_int LAPACKE_cgelss_work( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, float* s, float rcond, lapack_int* rank, lapack_complex_float* work, lapack_int lwork, float* rwork ); lapack_int LAPACKE_zgelss_work( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, double* s, double rcond, lapack_int* rank, lapack_complex_double* work, lapack_int lwork, double* rwork ); lapack_int LAPACKE_sgelsy_work( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, float* b, lapack_int ldb, lapack_int* jpvt, float rcond, lapack_int* rank, float* work, lapack_int lwork ); lapack_int LAPACKE_dgelsy_work( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* b, lapack_int ldb, lapack_int* jpvt, double rcond, lapack_int* rank, double* work, lapack_int lwork ); lapack_int LAPACKE_cgelsy_work( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_int* jpvt, float rcond, lapack_int* rank, lapack_complex_float* work, lapack_int lwork, float* rwork ); lapack_int LAPACKE_zgelsy_work( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_int* jpvt, double rcond, lapack_int* rank, lapack_complex_double* work, lapack_int lwork, double* rwork ); lapack_int LAPACKE_sgeqlf_work( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* tau, float* work, lapack_int lwork ); lapack_int LAPACKE_dgeqlf_work( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* tau, double* work, lapack_int lwork ); lapack_int LAPACKE_cgeqlf_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* tau, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zgeqlf_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* tau, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_sgeqp3_work( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, lapack_int* jpvt, float* tau, float* work, lapack_int lwork ); lapack_int LAPACKE_dgeqp3_work( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, lapack_int* jpvt, double* tau, double* work, lapack_int lwork ); lapack_int LAPACKE_cgeqp3_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_int* jpvt, lapack_complex_float* tau, lapack_complex_float* work, lapack_int lwork, float* rwork ); lapack_int LAPACKE_zgeqp3_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_int* jpvt, lapack_complex_double* tau, lapack_complex_double* work, lapack_int lwork, double* rwork ); lapack_int LAPACKE_sgeqpf_work( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, lapack_int* jpvt, float* tau, float* work ); lapack_int LAPACKE_dgeqpf_work( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, lapack_int* jpvt, double* tau, double* work ); lapack_int LAPACKE_cgeqpf_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_int* jpvt, lapack_complex_float* tau, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zgeqpf_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_int* jpvt, lapack_complex_double* tau, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_sgeqr2_work( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* tau, float* work ); lapack_int LAPACKE_dgeqr2_work( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* tau, double* work ); lapack_int LAPACKE_cgeqr2_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* tau, lapack_complex_float* work ); lapack_int LAPACKE_zgeqr2_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* tau, lapack_complex_double* work ); lapack_int LAPACKE_sgeqrf_work( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* tau, float* work, lapack_int lwork ); lapack_int LAPACKE_dgeqrf_work( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* tau, double* work, lapack_int lwork ); lapack_int LAPACKE_cgeqrf_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* tau, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zgeqrf_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* tau, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_sgeqrfp_work( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* tau, float* work, lapack_int lwork ); lapack_int LAPACKE_dgeqrfp_work( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* tau, double* work, lapack_int lwork ); lapack_int LAPACKE_cgeqrfp_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* tau, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zgeqrfp_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* tau, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_sgerfs_work( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, const float* af, lapack_int ldaf, const lapack_int* ipiv, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* ferr, float* berr, float* work, lapack_int* iwork ); lapack_int LAPACKE_dgerfs_work( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, const double* af, lapack_int ldaf, const lapack_int* ipiv, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* ferr, double* berr, double* work, lapack_int* iwork ); lapack_int LAPACKE_cgerfs_work( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* af, lapack_int ldaf, const lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zgerfs_work( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* af, lapack_int ldaf, const lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_sgerfsx_work( int matrix_order, char trans, char equed, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, const float* af, lapack_int ldaf, const lapack_int* ipiv, const float* r, const float* c, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params, float* work, lapack_int* iwork ); lapack_int LAPACKE_dgerfsx_work( int matrix_order, char trans, char equed, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, const double* af, lapack_int ldaf, const lapack_int* ipiv, const double* r, const double* c, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params, double* work, lapack_int* iwork ); lapack_int LAPACKE_cgerfsx_work( int matrix_order, char trans, char equed, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* af, lapack_int ldaf, const lapack_int* ipiv, const float* r, const float* c, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zgerfsx_work( int matrix_order, char trans, char equed, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* af, lapack_int ldaf, const lapack_int* ipiv, const double* r, const double* c, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_sgerqf_work( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* tau, float* work, lapack_int lwork ); lapack_int LAPACKE_dgerqf_work( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* tau, double* work, lapack_int lwork ); lapack_int LAPACKE_cgerqf_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* tau, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zgerqf_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* tau, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_sgesdd_work( int matrix_order, char jobz, lapack_int m, lapack_int n, float* a, lapack_int lda, float* s, float* u, lapack_int ldu, float* vt, lapack_int ldvt, float* work, lapack_int lwork, lapack_int* iwork ); lapack_int LAPACKE_dgesdd_work( int matrix_order, char jobz, lapack_int m, lapack_int n, double* a, lapack_int lda, double* s, double* u, lapack_int ldu, double* vt, lapack_int ldvt, double* work, lapack_int lwork, lapack_int* iwork ); lapack_int LAPACKE_cgesdd_work( int matrix_order, char jobz, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, float* s, lapack_complex_float* u, lapack_int ldu, lapack_complex_float* vt, lapack_int ldvt, lapack_complex_float* work, lapack_int lwork, float* rwork, lapack_int* iwork ); lapack_int LAPACKE_zgesdd_work( int matrix_order, char jobz, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, double* s, lapack_complex_double* u, lapack_int ldu, lapack_complex_double* vt, lapack_int ldvt, lapack_complex_double* work, lapack_int lwork, double* rwork, lapack_int* iwork ); lapack_int LAPACKE_sgesv_work( int matrix_order, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, lapack_int* ipiv, float* b, lapack_int ldb ); lapack_int LAPACKE_dgesv_work( int matrix_order, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, lapack_int* ipiv, double* b, lapack_int ldb ); lapack_int LAPACKE_cgesv_work( int matrix_order, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zgesv_work( int matrix_order, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_dsgesv_work( int matrix_order, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, lapack_int* ipiv, double* b, lapack_int ldb, double* x, lapack_int ldx, double* work, float* swork, lapack_int* iter ); lapack_int LAPACKE_zcgesv_work( int matrix_order, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, lapack_complex_double* work, lapack_complex_float* swork, double* rwork, lapack_int* iter ); lapack_int LAPACKE_sgesvd_work( int matrix_order, char jobu, char jobvt, lapack_int m, lapack_int n, float* a, lapack_int lda, float* s, float* u, lapack_int ldu, float* vt, lapack_int ldvt, float* work, lapack_int lwork ); lapack_int LAPACKE_dgesvd_work( int matrix_order, char jobu, char jobvt, lapack_int m, lapack_int n, double* a, lapack_int lda, double* s, double* u, lapack_int ldu, double* vt, lapack_int ldvt, double* work, lapack_int lwork ); lapack_int LAPACKE_cgesvd_work( int matrix_order, char jobu, char jobvt, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, float* s, lapack_complex_float* u, lapack_int ldu, lapack_complex_float* vt, lapack_int ldvt, lapack_complex_float* work, lapack_int lwork, float* rwork ); lapack_int LAPACKE_zgesvd_work( int matrix_order, char jobu, char jobvt, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, double* s, lapack_complex_double* u, lapack_int ldu, lapack_complex_double* vt, lapack_int ldvt, lapack_complex_double* work, lapack_int lwork, double* rwork ); lapack_int LAPACKE_sgesvj_work( int matrix_order, char joba, char jobu, char jobv, lapack_int m, lapack_int n, float* a, lapack_int lda, float* sva, lapack_int mv, float* v, lapack_int ldv, float* work, lapack_int lwork ); lapack_int LAPACKE_dgesvj_work( int matrix_order, char joba, char jobu, char jobv, lapack_int m, lapack_int n, double* a, lapack_int lda, double* sva, lapack_int mv, double* v, lapack_int ldv, double* work, lapack_int lwork ); lapack_int LAPACKE_sgesvx_work( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, float* af, lapack_int ldaf, lapack_int* ipiv, char* equed, float* r, float* c, float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, float* work, lapack_int* iwork ); lapack_int LAPACKE_dgesvx_work( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* af, lapack_int ldaf, lapack_int* ipiv, char* equed, double* r, double* c, double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, double* work, lapack_int* iwork ); lapack_int LAPACKE_cgesvx_work( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* af, lapack_int ldaf, lapack_int* ipiv, char* equed, float* r, float* c, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zgesvx_work( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* af, lapack_int ldaf, lapack_int* ipiv, char* equed, double* r, double* c, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_sgesvxx_work( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, float* af, lapack_int ldaf, lapack_int* ipiv, char* equed, float* r, float* c, float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* rpvgrw, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params, float* work, lapack_int* iwork ); lapack_int LAPACKE_dgesvxx_work( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* af, lapack_int ldaf, lapack_int* ipiv, char* equed, double* r, double* c, double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* rpvgrw, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params, double* work, lapack_int* iwork ); lapack_int LAPACKE_cgesvxx_work( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* af, lapack_int ldaf, lapack_int* ipiv, char* equed, float* r, float* c, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* rpvgrw, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zgesvxx_work( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* af, lapack_int ldaf, lapack_int* ipiv, char* equed, double* r, double* c, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* rpvgrw, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_sgetf2_work( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, lapack_int* ipiv ); lapack_int LAPACKE_dgetf2_work( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, lapack_int* ipiv ); lapack_int LAPACKE_cgetf2_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_int* ipiv ); lapack_int LAPACKE_zgetf2_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_int* ipiv ); lapack_int LAPACKE_sgetrf_work( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, lapack_int* ipiv ); lapack_int LAPACKE_dgetrf_work( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, lapack_int* ipiv ); lapack_int LAPACKE_cgetrf_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_int* ipiv ); lapack_int LAPACKE_zgetrf_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_int* ipiv ); lapack_int LAPACKE_sgetri_work( int matrix_order, lapack_int n, float* a, lapack_int lda, const lapack_int* ipiv, float* work, lapack_int lwork ); lapack_int LAPACKE_dgetri_work( int matrix_order, lapack_int n, double* a, lapack_int lda, const lapack_int* ipiv, double* work, lapack_int lwork ); lapack_int LAPACKE_cgetri_work( int matrix_order, lapack_int n, lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zgetri_work( int matrix_order, lapack_int n, lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_sgetrs_work( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, const lapack_int* ipiv, float* b, lapack_int ldb ); lapack_int LAPACKE_dgetrs_work( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, const lapack_int* ipiv, double* b, lapack_int ldb ); lapack_int LAPACKE_cgetrs_work( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zgetrs_work( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_sggbak_work( int matrix_order, char job, char side, lapack_int n, lapack_int ilo, lapack_int ihi, const float* lscale, const float* rscale, lapack_int m, float* v, lapack_int ldv ); lapack_int LAPACKE_dggbak_work( int matrix_order, char job, char side, lapack_int n, lapack_int ilo, lapack_int ihi, const double* lscale, const double* rscale, lapack_int m, double* v, lapack_int ldv ); lapack_int LAPACKE_cggbak_work( int matrix_order, char job, char side, lapack_int n, lapack_int ilo, lapack_int ihi, const float* lscale, const float* rscale, lapack_int m, lapack_complex_float* v, lapack_int ldv ); lapack_int LAPACKE_zggbak_work( int matrix_order, char job, char side, lapack_int n, lapack_int ilo, lapack_int ihi, const double* lscale, const double* rscale, lapack_int m, lapack_complex_double* v, lapack_int ldv ); lapack_int LAPACKE_sggbal_work( int matrix_order, char job, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, lapack_int* ilo, lapack_int* ihi, float* lscale, float* rscale, float* work ); lapack_int LAPACKE_dggbal_work( int matrix_order, char job, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, lapack_int* ilo, lapack_int* ihi, double* lscale, double* rscale, double* work ); lapack_int LAPACKE_cggbal_work( int matrix_order, char job, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_int* ilo, lapack_int* ihi, float* lscale, float* rscale, float* work ); lapack_int LAPACKE_zggbal_work( int matrix_order, char job, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_int* ilo, lapack_int* ihi, double* lscale, double* rscale, double* work ); lapack_int LAPACKE_sgges_work( int matrix_order, char jobvsl, char jobvsr, char sort, LAPACK_S_SELECT3 selctg, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, lapack_int* sdim, float* alphar, float* alphai, float* beta, float* vsl, lapack_int ldvsl, float* vsr, lapack_int ldvsr, float* work, lapack_int lwork, lapack_logical* bwork ); lapack_int LAPACKE_dgges_work( int matrix_order, char jobvsl, char jobvsr, char sort, LAPACK_D_SELECT3 selctg, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, lapack_int* sdim, double* alphar, double* alphai, double* beta, double* vsl, lapack_int ldvsl, double* vsr, lapack_int ldvsr, double* work, lapack_int lwork, lapack_logical* bwork ); lapack_int LAPACKE_cgges_work( int matrix_order, char jobvsl, char jobvsr, char sort, LAPACK_C_SELECT2 selctg, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_int* sdim, lapack_complex_float* alpha, lapack_complex_float* beta, lapack_complex_float* vsl, lapack_int ldvsl, lapack_complex_float* vsr, lapack_int ldvsr, lapack_complex_float* work, lapack_int lwork, float* rwork, lapack_logical* bwork ); lapack_int LAPACKE_zgges_work( int matrix_order, char jobvsl, char jobvsr, char sort, LAPACK_Z_SELECT2 selctg, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_int* sdim, lapack_complex_double* alpha, lapack_complex_double* beta, lapack_complex_double* vsl, lapack_int ldvsl, lapack_complex_double* vsr, lapack_int ldvsr, lapack_complex_double* work, lapack_int lwork, double* rwork, lapack_logical* bwork ); lapack_int LAPACKE_sggesx_work( int matrix_order, char jobvsl, char jobvsr, char sort, LAPACK_S_SELECT3 selctg, char sense, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, lapack_int* sdim, float* alphar, float* alphai, float* beta, float* vsl, lapack_int ldvsl, float* vsr, lapack_int ldvsr, float* rconde, float* rcondv, float* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork, lapack_logical* bwork ); lapack_int LAPACKE_dggesx_work( int matrix_order, char jobvsl, char jobvsr, char sort, LAPACK_D_SELECT3 selctg, char sense, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, lapack_int* sdim, double* alphar, double* alphai, double* beta, double* vsl, lapack_int ldvsl, double* vsr, lapack_int ldvsr, double* rconde, double* rcondv, double* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork, lapack_logical* bwork ); lapack_int LAPACKE_cggesx_work( int matrix_order, char jobvsl, char jobvsr, char sort, LAPACK_C_SELECT2 selctg, char sense, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_int* sdim, lapack_complex_float* alpha, lapack_complex_float* beta, lapack_complex_float* vsl, lapack_int ldvsl, lapack_complex_float* vsr, lapack_int ldvsr, float* rconde, float* rcondv, lapack_complex_float* work, lapack_int lwork, float* rwork, lapack_int* iwork, lapack_int liwork, lapack_logical* bwork ); lapack_int LAPACKE_zggesx_work( int matrix_order, char jobvsl, char jobvsr, char sort, LAPACK_Z_SELECT2 selctg, char sense, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_int* sdim, lapack_complex_double* alpha, lapack_complex_double* beta, lapack_complex_double* vsl, lapack_int ldvsl, lapack_complex_double* vsr, lapack_int ldvsr, double* rconde, double* rcondv, lapack_complex_double* work, lapack_int lwork, double* rwork, lapack_int* iwork, lapack_int liwork, lapack_logical* bwork ); lapack_int LAPACKE_sggev_work( int matrix_order, char jobvl, char jobvr, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, float* alphar, float* alphai, float* beta, float* vl, lapack_int ldvl, float* vr, lapack_int ldvr, float* work, lapack_int lwork ); lapack_int LAPACKE_dggev_work( int matrix_order, char jobvl, char jobvr, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, double* alphar, double* alphai, double* beta, double* vl, lapack_int ldvl, double* vr, lapack_int ldvr, double* work, lapack_int lwork ); lapack_int LAPACKE_cggev_work( int matrix_order, char jobvl, char jobvr, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* alpha, lapack_complex_float* beta, lapack_complex_float* vl, lapack_int ldvl, lapack_complex_float* vr, lapack_int ldvr, lapack_complex_float* work, lapack_int lwork, float* rwork ); lapack_int LAPACKE_zggev_work( int matrix_order, char jobvl, char jobvr, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* alpha, lapack_complex_double* beta, lapack_complex_double* vl, lapack_int ldvl, lapack_complex_double* vr, lapack_int ldvr, lapack_complex_double* work, lapack_int lwork, double* rwork ); lapack_int LAPACKE_sggevx_work( int matrix_order, char balanc, char jobvl, char jobvr, char sense, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, float* alphar, float* alphai, float* beta, float* vl, lapack_int ldvl, float* vr, lapack_int ldvr, lapack_int* ilo, lapack_int* ihi, float* lscale, float* rscale, float* abnrm, float* bbnrm, float* rconde, float* rcondv, float* work, lapack_int lwork, lapack_int* iwork, lapack_logical* bwork ); lapack_int LAPACKE_dggevx_work( int matrix_order, char balanc, char jobvl, char jobvr, char sense, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, double* alphar, double* alphai, double* beta, double* vl, lapack_int ldvl, double* vr, lapack_int ldvr, lapack_int* ilo, lapack_int* ihi, double* lscale, double* rscale, double* abnrm, double* bbnrm, double* rconde, double* rcondv, double* work, lapack_int lwork, lapack_int* iwork, lapack_logical* bwork ); lapack_int LAPACKE_cggevx_work( int matrix_order, char balanc, char jobvl, char jobvr, char sense, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* alpha, lapack_complex_float* beta, lapack_complex_float* vl, lapack_int ldvl, lapack_complex_float* vr, lapack_int ldvr, lapack_int* ilo, lapack_int* ihi, float* lscale, float* rscale, float* abnrm, float* bbnrm, float* rconde, float* rcondv, lapack_complex_float* work, lapack_int lwork, float* rwork, lapack_int* iwork, lapack_logical* bwork ); lapack_int LAPACKE_zggevx_work( int matrix_order, char balanc, char jobvl, char jobvr, char sense, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* alpha, lapack_complex_double* beta, lapack_complex_double* vl, lapack_int ldvl, lapack_complex_double* vr, lapack_int ldvr, lapack_int* ilo, lapack_int* ihi, double* lscale, double* rscale, double* abnrm, double* bbnrm, double* rconde, double* rcondv, lapack_complex_double* work, lapack_int lwork, double* rwork, lapack_int* iwork, lapack_logical* bwork ); lapack_int LAPACKE_sggglm_work( int matrix_order, lapack_int n, lapack_int m, lapack_int p, float* a, lapack_int lda, float* b, lapack_int ldb, float* d, float* x, float* y, float* work, lapack_int lwork ); lapack_int LAPACKE_dggglm_work( int matrix_order, lapack_int n, lapack_int m, lapack_int p, double* a, lapack_int lda, double* b, lapack_int ldb, double* d, double* x, double* y, double* work, lapack_int lwork ); lapack_int LAPACKE_cggglm_work( int matrix_order, lapack_int n, lapack_int m, lapack_int p, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* d, lapack_complex_float* x, lapack_complex_float* y, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zggglm_work( int matrix_order, lapack_int n, lapack_int m, lapack_int p, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* d, lapack_complex_double* x, lapack_complex_double* y, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_sgghrd_work( int matrix_order, char compq, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, float* a, lapack_int lda, float* b, lapack_int ldb, float* q, lapack_int ldq, float* z, lapack_int ldz ); lapack_int LAPACKE_dgghrd_work( int matrix_order, char compq, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, double* a, lapack_int lda, double* b, lapack_int ldb, double* q, lapack_int ldq, double* z, lapack_int ldz ); lapack_int LAPACKE_cgghrd_work( int matrix_order, char compq, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* q, lapack_int ldq, lapack_complex_float* z, lapack_int ldz ); lapack_int LAPACKE_zgghrd_work( int matrix_order, char compq, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* q, lapack_int ldq, lapack_complex_double* z, lapack_int ldz ); lapack_int LAPACKE_sgglse_work( int matrix_order, lapack_int m, lapack_int n, lapack_int p, float* a, lapack_int lda, float* b, lapack_int ldb, float* c, float* d, float* x, float* work, lapack_int lwork ); lapack_int LAPACKE_dgglse_work( int matrix_order, lapack_int m, lapack_int n, lapack_int p, double* a, lapack_int lda, double* b, lapack_int ldb, double* c, double* d, double* x, double* work, lapack_int lwork ); lapack_int LAPACKE_cgglse_work( int matrix_order, lapack_int m, lapack_int n, lapack_int p, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* c, lapack_complex_float* d, lapack_complex_float* x, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zgglse_work( int matrix_order, lapack_int m, lapack_int n, lapack_int p, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* c, lapack_complex_double* d, lapack_complex_double* x, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_sggqrf_work( int matrix_order, lapack_int n, lapack_int m, lapack_int p, float* a, lapack_int lda, float* taua, float* b, lapack_int ldb, float* taub, float* work, lapack_int lwork ); lapack_int LAPACKE_dggqrf_work( int matrix_order, lapack_int n, lapack_int m, lapack_int p, double* a, lapack_int lda, double* taua, double* b, lapack_int ldb, double* taub, double* work, lapack_int lwork ); lapack_int LAPACKE_cggqrf_work( int matrix_order, lapack_int n, lapack_int m, lapack_int p, lapack_complex_float* a, lapack_int lda, lapack_complex_float* taua, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* taub, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zggqrf_work( int matrix_order, lapack_int n, lapack_int m, lapack_int p, lapack_complex_double* a, lapack_int lda, lapack_complex_double* taua, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* taub, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_sggrqf_work( int matrix_order, lapack_int m, lapack_int p, lapack_int n, float* a, lapack_int lda, float* taua, float* b, lapack_int ldb, float* taub, float* work, lapack_int lwork ); lapack_int LAPACKE_dggrqf_work( int matrix_order, lapack_int m, lapack_int p, lapack_int n, double* a, lapack_int lda, double* taua, double* b, lapack_int ldb, double* taub, double* work, lapack_int lwork ); lapack_int LAPACKE_cggrqf_work( int matrix_order, lapack_int m, lapack_int p, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* taua, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* taub, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zggrqf_work( int matrix_order, lapack_int m, lapack_int p, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* taua, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* taub, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_sggsvd_work( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int n, lapack_int p, lapack_int* k, lapack_int* l, float* a, lapack_int lda, float* b, lapack_int ldb, float* alpha, float* beta, float* u, lapack_int ldu, float* v, lapack_int ldv, float* q, lapack_int ldq, float* work, lapack_int* iwork ); lapack_int LAPACKE_dggsvd_work( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int n, lapack_int p, lapack_int* k, lapack_int* l, double* a, lapack_int lda, double* b, lapack_int ldb, double* alpha, double* beta, double* u, lapack_int ldu, double* v, lapack_int ldv, double* q, lapack_int ldq, double* work, lapack_int* iwork ); lapack_int LAPACKE_cggsvd_work( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int n, lapack_int p, lapack_int* k, lapack_int* l, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, float* alpha, float* beta, lapack_complex_float* u, lapack_int ldu, lapack_complex_float* v, lapack_int ldv, lapack_complex_float* q, lapack_int ldq, lapack_complex_float* work, float* rwork, lapack_int* iwork ); lapack_int LAPACKE_zggsvd_work( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int n, lapack_int p, lapack_int* k, lapack_int* l, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, double* alpha, double* beta, lapack_complex_double* u, lapack_int ldu, lapack_complex_double* v, lapack_int ldv, lapack_complex_double* q, lapack_int ldq, lapack_complex_double* work, double* rwork, lapack_int* iwork ); lapack_int LAPACKE_sggsvp_work( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int p, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, float tola, float tolb, lapack_int* k, lapack_int* l, float* u, lapack_int ldu, float* v, lapack_int ldv, float* q, lapack_int ldq, lapack_int* iwork, float* tau, float* work ); lapack_int LAPACKE_dggsvp_work( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int p, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, double tola, double tolb, lapack_int* k, lapack_int* l, double* u, lapack_int ldu, double* v, lapack_int ldv, double* q, lapack_int ldq, lapack_int* iwork, double* tau, double* work ); lapack_int LAPACKE_cggsvp_work( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int p, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, float tola, float tolb, lapack_int* k, lapack_int* l, lapack_complex_float* u, lapack_int ldu, lapack_complex_float* v, lapack_int ldv, lapack_complex_float* q, lapack_int ldq, lapack_int* iwork, float* rwork, lapack_complex_float* tau, lapack_complex_float* work ); lapack_int LAPACKE_zggsvp_work( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int p, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, double tola, double tolb, lapack_int* k, lapack_int* l, lapack_complex_double* u, lapack_int ldu, lapack_complex_double* v, lapack_int ldv, lapack_complex_double* q, lapack_int ldq, lapack_int* iwork, double* rwork, lapack_complex_double* tau, lapack_complex_double* work ); lapack_int LAPACKE_sgtcon_work( char norm, lapack_int n, const float* dl, const float* d, const float* du, const float* du2, const lapack_int* ipiv, float anorm, float* rcond, float* work, lapack_int* iwork ); lapack_int LAPACKE_dgtcon_work( char norm, lapack_int n, const double* dl, const double* d, const double* du, const double* du2, const lapack_int* ipiv, double anorm, double* rcond, double* work, lapack_int* iwork ); lapack_int LAPACKE_cgtcon_work( char norm, lapack_int n, const lapack_complex_float* dl, const lapack_complex_float* d, const lapack_complex_float* du, const lapack_complex_float* du2, const lapack_int* ipiv, float anorm, float* rcond, lapack_complex_float* work ); lapack_int LAPACKE_zgtcon_work( char norm, lapack_int n, const lapack_complex_double* dl, const lapack_complex_double* d, const lapack_complex_double* du, const lapack_complex_double* du2, const lapack_int* ipiv, double anorm, double* rcond, lapack_complex_double* work ); lapack_int LAPACKE_sgtrfs_work( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const float* dl, const float* d, const float* du, const float* dlf, const float* df, const float* duf, const float* du2, const lapack_int* ipiv, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* ferr, float* berr, float* work, lapack_int* iwork ); lapack_int LAPACKE_dgtrfs_work( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const double* dl, const double* d, const double* du, const double* dlf, const double* df, const double* duf, const double* du2, const lapack_int* ipiv, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* ferr, double* berr, double* work, lapack_int* iwork ); lapack_int LAPACKE_cgtrfs_work( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const lapack_complex_float* dl, const lapack_complex_float* d, const lapack_complex_float* du, const lapack_complex_float* dlf, const lapack_complex_float* df, const lapack_complex_float* duf, const lapack_complex_float* du2, const lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zgtrfs_work( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const lapack_complex_double* dl, const lapack_complex_double* d, const lapack_complex_double* du, const lapack_complex_double* dlf, const lapack_complex_double* df, const lapack_complex_double* duf, const lapack_complex_double* du2, const lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_sgtsv_work( int matrix_order, lapack_int n, lapack_int nrhs, float* dl, float* d, float* du, float* b, lapack_int ldb ); lapack_int LAPACKE_dgtsv_work( int matrix_order, lapack_int n, lapack_int nrhs, double* dl, double* d, double* du, double* b, lapack_int ldb ); lapack_int LAPACKE_cgtsv_work( int matrix_order, lapack_int n, lapack_int nrhs, lapack_complex_float* dl, lapack_complex_float* d, lapack_complex_float* du, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zgtsv_work( int matrix_order, lapack_int n, lapack_int nrhs, lapack_complex_double* dl, lapack_complex_double* d, lapack_complex_double* du, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_sgtsvx_work( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, const float* dl, const float* d, const float* du, float* dlf, float* df, float* duf, float* du2, lapack_int* ipiv, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, float* work, lapack_int* iwork ); lapack_int LAPACKE_dgtsvx_work( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, const double* dl, const double* d, const double* du, double* dlf, double* df, double* duf, double* du2, lapack_int* ipiv, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, double* work, lapack_int* iwork ); lapack_int LAPACKE_cgtsvx_work( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, const lapack_complex_float* dl, const lapack_complex_float* d, const lapack_complex_float* du, lapack_complex_float* dlf, lapack_complex_float* df, lapack_complex_float* duf, lapack_complex_float* du2, lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zgtsvx_work( int matrix_order, char fact, char trans, lapack_int n, lapack_int nrhs, const lapack_complex_double* dl, const lapack_complex_double* d, const lapack_complex_double* du, lapack_complex_double* dlf, lapack_complex_double* df, lapack_complex_double* duf, lapack_complex_double* du2, lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_sgttrf_work( lapack_int n, float* dl, float* d, float* du, float* du2, lapack_int* ipiv ); lapack_int LAPACKE_dgttrf_work( lapack_int n, double* dl, double* d, double* du, double* du2, lapack_int* ipiv ); lapack_int LAPACKE_cgttrf_work( lapack_int n, lapack_complex_float* dl, lapack_complex_float* d, lapack_complex_float* du, lapack_complex_float* du2, lapack_int* ipiv ); lapack_int LAPACKE_zgttrf_work( lapack_int n, lapack_complex_double* dl, lapack_complex_double* d, lapack_complex_double* du, lapack_complex_double* du2, lapack_int* ipiv ); lapack_int LAPACKE_sgttrs_work( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const float* dl, const float* d, const float* du, const float* du2, const lapack_int* ipiv, float* b, lapack_int ldb ); lapack_int LAPACKE_dgttrs_work( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const double* dl, const double* d, const double* du, const double* du2, const lapack_int* ipiv, double* b, lapack_int ldb ); lapack_int LAPACKE_cgttrs_work( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const lapack_complex_float* dl, const lapack_complex_float* d, const lapack_complex_float* du, const lapack_complex_float* du2, const lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zgttrs_work( int matrix_order, char trans, lapack_int n, lapack_int nrhs, const lapack_complex_double* dl, const lapack_complex_double* d, const lapack_complex_double* du, const lapack_complex_double* du2, const lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_chbev_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int kd, lapack_complex_float* ab, lapack_int ldab, float* w, lapack_complex_float* z, lapack_int ldz, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zhbev_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int kd, lapack_complex_double* ab, lapack_int ldab, double* w, lapack_complex_double* z, lapack_int ldz, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_chbevd_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int kd, lapack_complex_float* ab, lapack_int ldab, float* w, lapack_complex_float* z, lapack_int ldz, lapack_complex_float* work, lapack_int lwork, float* rwork, lapack_int lrwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_zhbevd_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int kd, lapack_complex_double* ab, lapack_int ldab, double* w, lapack_complex_double* z, lapack_int ldz, lapack_complex_double* work, lapack_int lwork, double* rwork, lapack_int lrwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_chbevx_work( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_int kd, lapack_complex_float* ab, lapack_int ldab, lapack_complex_float* q, lapack_int ldq, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int ldz, lapack_complex_float* work, float* rwork, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_zhbevx_work( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_int kd, lapack_complex_double* ab, lapack_int ldab, lapack_complex_double* q, lapack_int ldq, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int ldz, lapack_complex_double* work, double* rwork, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_chbgst_work( int matrix_order, char vect, char uplo, lapack_int n, lapack_int ka, lapack_int kb, lapack_complex_float* ab, lapack_int ldab, const lapack_complex_float* bb, lapack_int ldbb, lapack_complex_float* x, lapack_int ldx, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zhbgst_work( int matrix_order, char vect, char uplo, lapack_int n, lapack_int ka, lapack_int kb, lapack_complex_double* ab, lapack_int ldab, const lapack_complex_double* bb, lapack_int ldbb, lapack_complex_double* x, lapack_int ldx, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_chbgv_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int ka, lapack_int kb, lapack_complex_float* ab, lapack_int ldab, lapack_complex_float* bb, lapack_int ldbb, float* w, lapack_complex_float* z, lapack_int ldz, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zhbgv_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int ka, lapack_int kb, lapack_complex_double* ab, lapack_int ldab, lapack_complex_double* bb, lapack_int ldbb, double* w, lapack_complex_double* z, lapack_int ldz, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_chbgvd_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int ka, lapack_int kb, lapack_complex_float* ab, lapack_int ldab, lapack_complex_float* bb, lapack_int ldbb, float* w, lapack_complex_float* z, lapack_int ldz, lapack_complex_float* work, lapack_int lwork, float* rwork, lapack_int lrwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_zhbgvd_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int ka, lapack_int kb, lapack_complex_double* ab, lapack_int ldab, lapack_complex_double* bb, lapack_int ldbb, double* w, lapack_complex_double* z, lapack_int ldz, lapack_complex_double* work, lapack_int lwork, double* rwork, lapack_int lrwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_chbgvx_work( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_int ka, lapack_int kb, lapack_complex_float* ab, lapack_int ldab, lapack_complex_float* bb, lapack_int ldbb, lapack_complex_float* q, lapack_int ldq, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int ldz, lapack_complex_float* work, float* rwork, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_zhbgvx_work( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_int ka, lapack_int kb, lapack_complex_double* ab, lapack_int ldab, lapack_complex_double* bb, lapack_int ldbb, lapack_complex_double* q, lapack_int ldq, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int ldz, lapack_complex_double* work, double* rwork, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_chbtrd_work( int matrix_order, char vect, char uplo, lapack_int n, lapack_int kd, lapack_complex_float* ab, lapack_int ldab, float* d, float* e, lapack_complex_float* q, lapack_int ldq, lapack_complex_float* work ); lapack_int LAPACKE_zhbtrd_work( int matrix_order, char vect, char uplo, lapack_int n, lapack_int kd, lapack_complex_double* ab, lapack_int ldab, double* d, double* e, lapack_complex_double* q, lapack_int ldq, lapack_complex_double* work ); lapack_int LAPACKE_checon_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, float anorm, float* rcond, lapack_complex_float* work ); lapack_int LAPACKE_zhecon_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, double anorm, double* rcond, lapack_complex_double* work ); lapack_int LAPACKE_cheequb_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* a, lapack_int lda, float* s, float* scond, float* amax, lapack_complex_float* work ); lapack_int LAPACKE_zheequb_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* a, lapack_int lda, double* s, double* scond, double* amax, lapack_complex_double* work ); lapack_int LAPACKE_cheev_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, float* w, lapack_complex_float* work, lapack_int lwork, float* rwork ); lapack_int LAPACKE_zheev_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, double* w, lapack_complex_double* work, lapack_int lwork, double* rwork ); lapack_int LAPACKE_cheevd_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, float* w, lapack_complex_float* work, lapack_int lwork, float* rwork, lapack_int lrwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_zheevd_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, double* w, lapack_complex_double* work, lapack_int lwork, double* rwork, lapack_int lrwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_cheevr_work( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int ldz, lapack_int* isuppz, lapack_complex_float* work, lapack_int lwork, float* rwork, lapack_int lrwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_zheevr_work( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int ldz, lapack_int* isuppz, lapack_complex_double* work, lapack_int lwork, double* rwork, lapack_int lrwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_cheevx_work( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int ldz, lapack_complex_float* work, lapack_int lwork, float* rwork, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_zheevx_work( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int ldz, lapack_complex_double* work, lapack_int lwork, double* rwork, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_chegst_work( int matrix_order, lapack_int itype, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, const lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zhegst_work( int matrix_order, lapack_int itype, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, const lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_chegv_work( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, float* w, lapack_complex_float* work, lapack_int lwork, float* rwork ); lapack_int LAPACKE_zhegv_work( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, double* w, lapack_complex_double* work, lapack_int lwork, double* rwork ); lapack_int LAPACKE_chegvd_work( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, float* w, lapack_complex_float* work, lapack_int lwork, float* rwork, lapack_int lrwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_zhegvd_work( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, double* w, lapack_complex_double* work, lapack_int lwork, double* rwork, lapack_int lrwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_chegvx_work( int matrix_order, lapack_int itype, char jobz, char range, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int ldz, lapack_complex_float* work, lapack_int lwork, float* rwork, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_zhegvx_work( int matrix_order, lapack_int itype, char jobz, char range, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int ldz, lapack_complex_double* work, lapack_int lwork, double* rwork, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_cherfs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* af, lapack_int ldaf, const lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zherfs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* af, lapack_int ldaf, const lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_cherfsx_work( int matrix_order, char uplo, char equed, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* af, lapack_int ldaf, const lapack_int* ipiv, const float* s, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zherfsx_work( int matrix_order, char uplo, char equed, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* af, lapack_int ldaf, const lapack_int* ipiv, const double* s, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_chesv_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zhesv_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_chesvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, lapack_complex_float* af, lapack_int ldaf, lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, lapack_complex_float* work, lapack_int lwork, float* rwork ); lapack_int LAPACKE_zhesvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, lapack_complex_double* af, lapack_int ldaf, lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, lapack_complex_double* work, lapack_int lwork, double* rwork ); lapack_int LAPACKE_chesvxx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* af, lapack_int ldaf, lapack_int* ipiv, char* equed, float* s, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* rpvgrw, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zhesvxx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* af, lapack_int ldaf, lapack_int* ipiv, char* equed, double* s, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* rpvgrw, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_chetrd_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, float* d, float* e, lapack_complex_float* tau, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zhetrd_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, double* d, double* e, lapack_complex_double* tau, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_chetrf_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_int* ipiv, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zhetrf_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_int* ipiv, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_chetri_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_float* work ); lapack_int LAPACKE_zhetri_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_double* work ); lapack_int LAPACKE_chetrs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zhetrs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_chfrk_work( int matrix_order, char transr, char uplo, char trans, lapack_int n, lapack_int k, float alpha, const lapack_complex_float* a, lapack_int lda, float beta, lapack_complex_float* c ); lapack_int LAPACKE_zhfrk_work( int matrix_order, char transr, char uplo, char trans, lapack_int n, lapack_int k, double alpha, const lapack_complex_double* a, lapack_int lda, double beta, lapack_complex_double* c ); lapack_int LAPACKE_shgeqz_work( int matrix_order, char job, char compq, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, float* h, lapack_int ldh, float* t, lapack_int ldt, float* alphar, float* alphai, float* beta, float* q, lapack_int ldq, float* z, lapack_int ldz, float* work, lapack_int lwork ); lapack_int LAPACKE_dhgeqz_work( int matrix_order, char job, char compq, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, double* h, lapack_int ldh, double* t, lapack_int ldt, double* alphar, double* alphai, double* beta, double* q, lapack_int ldq, double* z, lapack_int ldz, double* work, lapack_int lwork ); lapack_int LAPACKE_chgeqz_work( int matrix_order, char job, char compq, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, lapack_complex_float* h, lapack_int ldh, lapack_complex_float* t, lapack_int ldt, lapack_complex_float* alpha, lapack_complex_float* beta, lapack_complex_float* q, lapack_int ldq, lapack_complex_float* z, lapack_int ldz, lapack_complex_float* work, lapack_int lwork, float* rwork ); lapack_int LAPACKE_zhgeqz_work( int matrix_order, char job, char compq, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, lapack_complex_double* h, lapack_int ldh, lapack_complex_double* t, lapack_int ldt, lapack_complex_double* alpha, lapack_complex_double* beta, lapack_complex_double* q, lapack_int ldq, lapack_complex_double* z, lapack_int ldz, lapack_complex_double* work, lapack_int lwork, double* rwork ); lapack_int LAPACKE_chpcon_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* ap, const lapack_int* ipiv, float anorm, float* rcond, lapack_complex_float* work ); lapack_int LAPACKE_zhpcon_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* ap, const lapack_int* ipiv, double anorm, double* rcond, lapack_complex_double* work ); lapack_int LAPACKE_chpev_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_complex_float* ap, float* w, lapack_complex_float* z, lapack_int ldz, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zhpev_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_complex_double* ap, double* w, lapack_complex_double* z, lapack_int ldz, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_chpevd_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_complex_float* ap, float* w, lapack_complex_float* z, lapack_int ldz, lapack_complex_float* work, lapack_int lwork, float* rwork, lapack_int lrwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_zhpevd_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_complex_double* ap, double* w, lapack_complex_double* z, lapack_int ldz, lapack_complex_double* work, lapack_int lwork, double* rwork, lapack_int lrwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_chpevx_work( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_complex_float* ap, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int ldz, lapack_complex_float* work, float* rwork, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_zhpevx_work( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_complex_double* ap, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int ldz, lapack_complex_double* work, double* rwork, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_chpgst_work( int matrix_order, lapack_int itype, char uplo, lapack_int n, lapack_complex_float* ap, const lapack_complex_float* bp ); lapack_int LAPACKE_zhpgst_work( int matrix_order, lapack_int itype, char uplo, lapack_int n, lapack_complex_double* ap, const lapack_complex_double* bp ); lapack_int LAPACKE_chpgv_work( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, lapack_complex_float* ap, lapack_complex_float* bp, float* w, lapack_complex_float* z, lapack_int ldz, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zhpgv_work( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, lapack_complex_double* ap, lapack_complex_double* bp, double* w, lapack_complex_double* z, lapack_int ldz, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_chpgvd_work( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, lapack_complex_float* ap, lapack_complex_float* bp, float* w, lapack_complex_float* z, lapack_int ldz, lapack_complex_float* work, lapack_int lwork, float* rwork, lapack_int lrwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_zhpgvd_work( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, lapack_complex_double* ap, lapack_complex_double* bp, double* w, lapack_complex_double* z, lapack_int ldz, lapack_complex_double* work, lapack_int lwork, double* rwork, lapack_int lrwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_chpgvx_work( int matrix_order, lapack_int itype, char jobz, char range, char uplo, lapack_int n, lapack_complex_float* ap, lapack_complex_float* bp, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int ldz, lapack_complex_float* work, float* rwork, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_zhpgvx_work( int matrix_order, lapack_int itype, char jobz, char range, char uplo, lapack_int n, lapack_complex_double* ap, lapack_complex_double* bp, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int ldz, lapack_complex_double* work, double* rwork, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_chprfs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* ap, const lapack_complex_float* afp, const lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zhprfs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* ap, const lapack_complex_double* afp, const lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_chpsv_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* ap, lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zhpsv_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* ap, lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_chpsvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* ap, lapack_complex_float* afp, lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zhpsvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* ap, lapack_complex_double* afp, lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_chptrd_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* ap, float* d, float* e, lapack_complex_float* tau ); lapack_int LAPACKE_zhptrd_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* ap, double* d, double* e, lapack_complex_double* tau ); lapack_int LAPACKE_chptrf_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* ap, lapack_int* ipiv ); lapack_int LAPACKE_zhptrf_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* ap, lapack_int* ipiv ); lapack_int LAPACKE_chptri_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* ap, const lapack_int* ipiv, lapack_complex_float* work ); lapack_int LAPACKE_zhptri_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* ap, const lapack_int* ipiv, lapack_complex_double* work ); lapack_int LAPACKE_chptrs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* ap, const lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zhptrs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* ap, const lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_shsein_work( int matrix_order, char job, char eigsrc, char initv, lapack_logical* select, lapack_int n, const float* h, lapack_int ldh, float* wr, const float* wi, float* vl, lapack_int ldvl, float* vr, lapack_int ldvr, lapack_int mm, lapack_int* m, float* work, lapack_int* ifaill, lapack_int* ifailr ); lapack_int LAPACKE_dhsein_work( int matrix_order, char job, char eigsrc, char initv, lapack_logical* select, lapack_int n, const double* h, lapack_int ldh, double* wr, const double* wi, double* vl, lapack_int ldvl, double* vr, lapack_int ldvr, lapack_int mm, lapack_int* m, double* work, lapack_int* ifaill, lapack_int* ifailr ); lapack_int LAPACKE_chsein_work( int matrix_order, char job, char eigsrc, char initv, const lapack_logical* select, lapack_int n, const lapack_complex_float* h, lapack_int ldh, lapack_complex_float* w, lapack_complex_float* vl, lapack_int ldvl, lapack_complex_float* vr, lapack_int ldvr, lapack_int mm, lapack_int* m, lapack_complex_float* work, float* rwork, lapack_int* ifaill, lapack_int* ifailr ); lapack_int LAPACKE_zhsein_work( int matrix_order, char job, char eigsrc, char initv, const lapack_logical* select, lapack_int n, const lapack_complex_double* h, lapack_int ldh, lapack_complex_double* w, lapack_complex_double* vl, lapack_int ldvl, lapack_complex_double* vr, lapack_int ldvr, lapack_int mm, lapack_int* m, lapack_complex_double* work, double* rwork, lapack_int* ifaill, lapack_int* ifailr ); lapack_int LAPACKE_shseqr_work( int matrix_order, char job, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, float* h, lapack_int ldh, float* wr, float* wi, float* z, lapack_int ldz, float* work, lapack_int lwork ); lapack_int LAPACKE_dhseqr_work( int matrix_order, char job, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, double* h, lapack_int ldh, double* wr, double* wi, double* z, lapack_int ldz, double* work, lapack_int lwork ); lapack_int LAPACKE_chseqr_work( int matrix_order, char job, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, lapack_complex_float* h, lapack_int ldh, lapack_complex_float* w, lapack_complex_float* z, lapack_int ldz, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zhseqr_work( int matrix_order, char job, char compz, lapack_int n, lapack_int ilo, lapack_int ihi, lapack_complex_double* h, lapack_int ldh, lapack_complex_double* w, lapack_complex_double* z, lapack_int ldz, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_clacgv_work( lapack_int n, lapack_complex_float* x, lapack_int incx ); lapack_int LAPACKE_zlacgv_work( lapack_int n, lapack_complex_double* x, lapack_int incx ); lapack_int LAPACKE_slacpy_work( int matrix_order, char uplo, lapack_int m, lapack_int n, const float* a, lapack_int lda, float* b, lapack_int ldb ); lapack_int LAPACKE_dlacpy_work( int matrix_order, char uplo, lapack_int m, lapack_int n, const double* a, lapack_int lda, double* b, lapack_int ldb ); lapack_int LAPACKE_clacpy_work( int matrix_order, char uplo, lapack_int m, lapack_int n, const lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zlacpy_work( int matrix_order, char uplo, lapack_int m, lapack_int n, const lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_zlag2c_work( int matrix_order, lapack_int m, lapack_int n, const lapack_complex_double* a, lapack_int lda, lapack_complex_float* sa, lapack_int ldsa ); lapack_int LAPACKE_slag2d_work( int matrix_order, lapack_int m, lapack_int n, const float* sa, lapack_int ldsa, double* a, lapack_int lda ); lapack_int LAPACKE_dlag2s_work( int matrix_order, lapack_int m, lapack_int n, const double* a, lapack_int lda, float* sa, lapack_int ldsa ); lapack_int LAPACKE_clag2z_work( int matrix_order, lapack_int m, lapack_int n, const lapack_complex_float* sa, lapack_int ldsa, lapack_complex_double* a, lapack_int lda ); lapack_int LAPACKE_slagge_work( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const float* d, float* a, lapack_int lda, lapack_int* iseed, float* work ); lapack_int LAPACKE_dlagge_work( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const double* d, double* a, lapack_int lda, lapack_int* iseed, double* work ); lapack_int LAPACKE_clagge_work( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const float* d, lapack_complex_float* a, lapack_int lda, lapack_int* iseed, lapack_complex_float* work ); lapack_int LAPACKE_zlagge_work( int matrix_order, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const double* d, lapack_complex_double* a, lapack_int lda, lapack_int* iseed, lapack_complex_double* work ); lapack_int LAPACKE_claghe_work( int matrix_order, lapack_int n, lapack_int k, const float* d, lapack_complex_float* a, lapack_int lda, lapack_int* iseed, lapack_complex_float* work ); lapack_int LAPACKE_zlaghe_work( int matrix_order, lapack_int n, lapack_int k, const double* d, lapack_complex_double* a, lapack_int lda, lapack_int* iseed, lapack_complex_double* work ); lapack_int LAPACKE_slagsy_work( int matrix_order, lapack_int n, lapack_int k, const float* d, float* a, lapack_int lda, lapack_int* iseed, float* work ); lapack_int LAPACKE_dlagsy_work( int matrix_order, lapack_int n, lapack_int k, const double* d, double* a, lapack_int lda, lapack_int* iseed, double* work ); lapack_int LAPACKE_clagsy_work( int matrix_order, lapack_int n, lapack_int k, const float* d, lapack_complex_float* a, lapack_int lda, lapack_int* iseed, lapack_complex_float* work ); lapack_int LAPACKE_zlagsy_work( int matrix_order, lapack_int n, lapack_int k, const double* d, lapack_complex_double* a, lapack_int lda, lapack_int* iseed, lapack_complex_double* work ); lapack_int LAPACKE_slapmr_work( int matrix_order, lapack_logical forwrd, lapack_int m, lapack_int n, float* x, lapack_int ldx, lapack_int* k ); lapack_int LAPACKE_dlapmr_work( int matrix_order, lapack_logical forwrd, lapack_int m, lapack_int n, double* x, lapack_int ldx, lapack_int* k ); lapack_int LAPACKE_clapmr_work( int matrix_order, lapack_logical forwrd, lapack_int m, lapack_int n, lapack_complex_float* x, lapack_int ldx, lapack_int* k ); lapack_int LAPACKE_zlapmr_work( int matrix_order, lapack_logical forwrd, lapack_int m, lapack_int n, lapack_complex_double* x, lapack_int ldx, lapack_int* k ); lapack_int LAPACKE_slartgp_work( float f, float g, float* cs, float* sn, float* r ); lapack_int LAPACKE_dlartgp_work( double f, double g, double* cs, double* sn, double* r ); lapack_int LAPACKE_slartgs_work( float x, float y, float sigma, float* cs, float* sn ); lapack_int LAPACKE_dlartgs_work( double x, double y, double sigma, double* cs, double* sn ); float LAPACKE_slapy2_work( float x, float y ); double LAPACKE_dlapy2_work( double x, double y ); float LAPACKE_slapy3_work( float x, float y, float z ); double LAPACKE_dlapy3_work( double x, double y, double z ); float LAPACKE_slamch_work( char cmach ); double LAPACKE_dlamch_work( char cmach ); float LAPACKE_slange_work( int matrix_order, char norm, lapack_int m, lapack_int n, const float* a, lapack_int lda, float* work ); double LAPACKE_dlange_work( int matrix_order, char norm, lapack_int m, lapack_int n, const double* a, lapack_int lda, double* work ); float LAPACKE_clange_work( int matrix_order, char norm, lapack_int m, lapack_int n, const lapack_complex_float* a, lapack_int lda, float* work ); double LAPACKE_zlange_work( int matrix_order, char norm, lapack_int m, lapack_int n, const lapack_complex_double* a, lapack_int lda, double* work ); float LAPACKE_clanhe_work( int matrix_order, char norm, char uplo, lapack_int n, const lapack_complex_float* a, lapack_int lda, float* work ); double LAPACKE_zlanhe_work( int matrix_order, char norm, char uplo, lapack_int n, const lapack_complex_double* a, lapack_int lda, double* work ); float LAPACKE_slansy_work( int matrix_order, char norm, char uplo, lapack_int n, const float* a, lapack_int lda, float* work ); double LAPACKE_dlansy_work( int matrix_order, char norm, char uplo, lapack_int n, const double* a, lapack_int lda, double* work ); float LAPACKE_clansy_work( int matrix_order, char norm, char uplo, lapack_int n, const lapack_complex_float* a, lapack_int lda, float* work ); double LAPACKE_zlansy_work( int matrix_order, char norm, char uplo, lapack_int n, const lapack_complex_double* a, lapack_int lda, double* work ); float LAPACKE_slantr_work( int matrix_order, char norm, char uplo, char diag, lapack_int m, lapack_int n, const float* a, lapack_int lda, float* work ); double LAPACKE_dlantr_work( int matrix_order, char norm, char uplo, char diag, lapack_int m, lapack_int n, const double* a, lapack_int lda, double* work ); float LAPACKE_clantr_work( int matrix_order, char norm, char uplo, char diag, lapack_int m, lapack_int n, const lapack_complex_float* a, lapack_int lda, float* work ); double LAPACKE_zlantr_work( int matrix_order, char norm, char uplo, char diag, lapack_int m, lapack_int n, const lapack_complex_double* a, lapack_int lda, double* work ); lapack_int LAPACKE_slarfb_work( int matrix_order, char side, char trans, char direct, char storev, lapack_int m, lapack_int n, lapack_int k, const float* v, lapack_int ldv, const float* t, lapack_int ldt, float* c, lapack_int ldc, float* work, lapack_int ldwork ); lapack_int LAPACKE_dlarfb_work( int matrix_order, char side, char trans, char direct, char storev, lapack_int m, lapack_int n, lapack_int k, const double* v, lapack_int ldv, const double* t, lapack_int ldt, double* c, lapack_int ldc, double* work, lapack_int ldwork ); lapack_int LAPACKE_clarfb_work( int matrix_order, char side, char trans, char direct, char storev, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_float* v, lapack_int ldv, const lapack_complex_float* t, lapack_int ldt, lapack_complex_float* c, lapack_int ldc, lapack_complex_float* work, lapack_int ldwork ); lapack_int LAPACKE_zlarfb_work( int matrix_order, char side, char trans, char direct, char storev, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_double* v, lapack_int ldv, const lapack_complex_double* t, lapack_int ldt, lapack_complex_double* c, lapack_int ldc, lapack_complex_double* work, lapack_int ldwork ); lapack_int LAPACKE_slarfg_work( lapack_int n, float* alpha, float* x, lapack_int incx, float* tau ); lapack_int LAPACKE_dlarfg_work( lapack_int n, double* alpha, double* x, lapack_int incx, double* tau ); lapack_int LAPACKE_clarfg_work( lapack_int n, lapack_complex_float* alpha, lapack_complex_float* x, lapack_int incx, lapack_complex_float* tau ); lapack_int LAPACKE_zlarfg_work( lapack_int n, lapack_complex_double* alpha, lapack_complex_double* x, lapack_int incx, lapack_complex_double* tau ); lapack_int LAPACKE_slarft_work( int matrix_order, char direct, char storev, lapack_int n, lapack_int k, const float* v, lapack_int ldv, const float* tau, float* t, lapack_int ldt ); lapack_int LAPACKE_dlarft_work( int matrix_order, char direct, char storev, lapack_int n, lapack_int k, const double* v, lapack_int ldv, const double* tau, double* t, lapack_int ldt ); lapack_int LAPACKE_clarft_work( int matrix_order, char direct, char storev, lapack_int n, lapack_int k, const lapack_complex_float* v, lapack_int ldv, const lapack_complex_float* tau, lapack_complex_float* t, lapack_int ldt ); lapack_int LAPACKE_zlarft_work( int matrix_order, char direct, char storev, lapack_int n, lapack_int k, const lapack_complex_double* v, lapack_int ldv, const lapack_complex_double* tau, lapack_complex_double* t, lapack_int ldt ); lapack_int LAPACKE_slarfx_work( int matrix_order, char side, lapack_int m, lapack_int n, const float* v, float tau, float* c, lapack_int ldc, float* work ); lapack_int LAPACKE_dlarfx_work( int matrix_order, char side, lapack_int m, lapack_int n, const double* v, double tau, double* c, lapack_int ldc, double* work ); lapack_int LAPACKE_clarfx_work( int matrix_order, char side, lapack_int m, lapack_int n, const lapack_complex_float* v, lapack_complex_float tau, lapack_complex_float* c, lapack_int ldc, lapack_complex_float* work ); lapack_int LAPACKE_zlarfx_work( int matrix_order, char side, lapack_int m, lapack_int n, const lapack_complex_double* v, lapack_complex_double tau, lapack_complex_double* c, lapack_int ldc, lapack_complex_double* work ); lapack_int LAPACKE_slarnv_work( lapack_int idist, lapack_int* iseed, lapack_int n, float* x ); lapack_int LAPACKE_dlarnv_work( lapack_int idist, lapack_int* iseed, lapack_int n, double* x ); lapack_int LAPACKE_clarnv_work( lapack_int idist, lapack_int* iseed, lapack_int n, lapack_complex_float* x ); lapack_int LAPACKE_zlarnv_work( lapack_int idist, lapack_int* iseed, lapack_int n, lapack_complex_double* x ); lapack_int LAPACKE_slaset_work( int matrix_order, char uplo, lapack_int m, lapack_int n, float alpha, float beta, float* a, lapack_int lda ); lapack_int LAPACKE_dlaset_work( int matrix_order, char uplo, lapack_int m, lapack_int n, double alpha, double beta, double* a, lapack_int lda ); lapack_int LAPACKE_claset_work( int matrix_order, char uplo, lapack_int m, lapack_int n, lapack_complex_float alpha, lapack_complex_float beta, lapack_complex_float* a, lapack_int lda ); lapack_int LAPACKE_zlaset_work( int matrix_order, char uplo, lapack_int m, lapack_int n, lapack_complex_double alpha, lapack_complex_double beta, lapack_complex_double* a, lapack_int lda ); lapack_int LAPACKE_slasrt_work( char id, lapack_int n, float* d ); lapack_int LAPACKE_dlasrt_work( char id, lapack_int n, double* d ); lapack_int LAPACKE_slaswp_work( int matrix_order, lapack_int n, float* a, lapack_int lda, lapack_int k1, lapack_int k2, const lapack_int* ipiv, lapack_int incx ); lapack_int LAPACKE_dlaswp_work( int matrix_order, lapack_int n, double* a, lapack_int lda, lapack_int k1, lapack_int k2, const lapack_int* ipiv, lapack_int incx ); lapack_int LAPACKE_claswp_work( int matrix_order, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_int k1, lapack_int k2, const lapack_int* ipiv, lapack_int incx ); lapack_int LAPACKE_zlaswp_work( int matrix_order, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_int k1, lapack_int k2, const lapack_int* ipiv, lapack_int incx ); lapack_int LAPACKE_slatms_work( int matrix_order, lapack_int m, lapack_int n, char dist, lapack_int* iseed, char sym, float* d, lapack_int mode, float cond, float dmax, lapack_int kl, lapack_int ku, char pack, float* a, lapack_int lda, float* work ); lapack_int LAPACKE_dlatms_work( int matrix_order, lapack_int m, lapack_int n, char dist, lapack_int* iseed, char sym, double* d, lapack_int mode, double cond, double dmax, lapack_int kl, lapack_int ku, char pack, double* a, lapack_int lda, double* work ); lapack_int LAPACKE_clatms_work( int matrix_order, lapack_int m, lapack_int n, char dist, lapack_int* iseed, char sym, float* d, lapack_int mode, float cond, float dmax, lapack_int kl, lapack_int ku, char pack, lapack_complex_float* a, lapack_int lda, lapack_complex_float* work ); lapack_int LAPACKE_zlatms_work( int matrix_order, lapack_int m, lapack_int n, char dist, lapack_int* iseed, char sym, double* d, lapack_int mode, double cond, double dmax, lapack_int kl, lapack_int ku, char pack, lapack_complex_double* a, lapack_int lda, lapack_complex_double* work ); lapack_int LAPACKE_slauum_work( int matrix_order, char uplo, lapack_int n, float* a, lapack_int lda ); lapack_int LAPACKE_dlauum_work( int matrix_order, char uplo, lapack_int n, double* a, lapack_int lda ); lapack_int LAPACKE_clauum_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda ); lapack_int LAPACKE_zlauum_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda ); lapack_int LAPACKE_sopgtr_work( int matrix_order, char uplo, lapack_int n, const float* ap, const float* tau, float* q, lapack_int ldq, float* work ); lapack_int LAPACKE_dopgtr_work( int matrix_order, char uplo, lapack_int n, const double* ap, const double* tau, double* q, lapack_int ldq, double* work ); lapack_int LAPACKE_sopmtr_work( int matrix_order, char side, char uplo, char trans, lapack_int m, lapack_int n, const float* ap, const float* tau, float* c, lapack_int ldc, float* work ); lapack_int LAPACKE_dopmtr_work( int matrix_order, char side, char uplo, char trans, lapack_int m, lapack_int n, const double* ap, const double* tau, double* c, lapack_int ldc, double* work ); lapack_int LAPACKE_sorgbr_work( int matrix_order, char vect, lapack_int m, lapack_int n, lapack_int k, float* a, lapack_int lda, const float* tau, float* work, lapack_int lwork ); lapack_int LAPACKE_dorgbr_work( int matrix_order, char vect, lapack_int m, lapack_int n, lapack_int k, double* a, lapack_int lda, const double* tau, double* work, lapack_int lwork ); lapack_int LAPACKE_sorghr_work( int matrix_order, lapack_int n, lapack_int ilo, lapack_int ihi, float* a, lapack_int lda, const float* tau, float* work, lapack_int lwork ); lapack_int LAPACKE_dorghr_work( int matrix_order, lapack_int n, lapack_int ilo, lapack_int ihi, double* a, lapack_int lda, const double* tau, double* work, lapack_int lwork ); lapack_int LAPACKE_sorglq_work( int matrix_order, lapack_int m, lapack_int n, lapack_int k, float* a, lapack_int lda, const float* tau, float* work, lapack_int lwork ); lapack_int LAPACKE_dorglq_work( int matrix_order, lapack_int m, lapack_int n, lapack_int k, double* a, lapack_int lda, const double* tau, double* work, lapack_int lwork ); lapack_int LAPACKE_sorgql_work( int matrix_order, lapack_int m, lapack_int n, lapack_int k, float* a, lapack_int lda, const float* tau, float* work, lapack_int lwork ); lapack_int LAPACKE_dorgql_work( int matrix_order, lapack_int m, lapack_int n, lapack_int k, double* a, lapack_int lda, const double* tau, double* work, lapack_int lwork ); lapack_int LAPACKE_sorgqr_work( int matrix_order, lapack_int m, lapack_int n, lapack_int k, float* a, lapack_int lda, const float* tau, float* work, lapack_int lwork ); lapack_int LAPACKE_dorgqr_work( int matrix_order, lapack_int m, lapack_int n, lapack_int k, double* a, lapack_int lda, const double* tau, double* work, lapack_int lwork ); lapack_int LAPACKE_sorgrq_work( int matrix_order, lapack_int m, lapack_int n, lapack_int k, float* a, lapack_int lda, const float* tau, float* work, lapack_int lwork ); lapack_int LAPACKE_dorgrq_work( int matrix_order, lapack_int m, lapack_int n, lapack_int k, double* a, lapack_int lda, const double* tau, double* work, lapack_int lwork ); lapack_int LAPACKE_sorgtr_work( int matrix_order, char uplo, lapack_int n, float* a, lapack_int lda, const float* tau, float* work, lapack_int lwork ); lapack_int LAPACKE_dorgtr_work( int matrix_order, char uplo, lapack_int n, double* a, lapack_int lda, const double* tau, double* work, lapack_int lwork ); lapack_int LAPACKE_sormbr_work( int matrix_order, char vect, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const float* a, lapack_int lda, const float* tau, float* c, lapack_int ldc, float* work, lapack_int lwork ); lapack_int LAPACKE_dormbr_work( int matrix_order, char vect, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const double* a, lapack_int lda, const double* tau, double* c, lapack_int ldc, double* work, lapack_int lwork ); lapack_int LAPACKE_sormhr_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int ilo, lapack_int ihi, const float* a, lapack_int lda, const float* tau, float* c, lapack_int ldc, float* work, lapack_int lwork ); lapack_int LAPACKE_dormhr_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int ilo, lapack_int ihi, const double* a, lapack_int lda, const double* tau, double* c, lapack_int ldc, double* work, lapack_int lwork ); lapack_int LAPACKE_sormlq_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const float* a, lapack_int lda, const float* tau, float* c, lapack_int ldc, float* work, lapack_int lwork ); lapack_int LAPACKE_dormlq_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const double* a, lapack_int lda, const double* tau, double* c, lapack_int ldc, double* work, lapack_int lwork ); lapack_int LAPACKE_sormql_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const float* a, lapack_int lda, const float* tau, float* c, lapack_int ldc, float* work, lapack_int lwork ); lapack_int LAPACKE_dormql_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const double* a, lapack_int lda, const double* tau, double* c, lapack_int ldc, double* work, lapack_int lwork ); lapack_int LAPACKE_sormqr_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const float* a, lapack_int lda, const float* tau, float* c, lapack_int ldc, float* work, lapack_int lwork ); lapack_int LAPACKE_dormqr_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const double* a, lapack_int lda, const double* tau, double* c, lapack_int ldc, double* work, lapack_int lwork ); lapack_int LAPACKE_sormrq_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const float* a, lapack_int lda, const float* tau, float* c, lapack_int ldc, float* work, lapack_int lwork ); lapack_int LAPACKE_dormrq_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const double* a, lapack_int lda, const double* tau, double* c, lapack_int ldc, double* work, lapack_int lwork ); lapack_int LAPACKE_sormrz_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int l, const float* a, lapack_int lda, const float* tau, float* c, lapack_int ldc, float* work, lapack_int lwork ); lapack_int LAPACKE_dormrz_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int l, const double* a, lapack_int lda, const double* tau, double* c, lapack_int ldc, double* work, lapack_int lwork ); lapack_int LAPACKE_sormtr_work( int matrix_order, char side, char uplo, char trans, lapack_int m, lapack_int n, const float* a, lapack_int lda, const float* tau, float* c, lapack_int ldc, float* work, lapack_int lwork ); lapack_int LAPACKE_dormtr_work( int matrix_order, char side, char uplo, char trans, lapack_int m, lapack_int n, const double* a, lapack_int lda, const double* tau, double* c, lapack_int ldc, double* work, lapack_int lwork ); lapack_int LAPACKE_spbcon_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, const float* ab, lapack_int ldab, float anorm, float* rcond, float* work, lapack_int* iwork ); lapack_int LAPACKE_dpbcon_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, const double* ab, lapack_int ldab, double anorm, double* rcond, double* work, lapack_int* iwork ); lapack_int LAPACKE_cpbcon_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, const lapack_complex_float* ab, lapack_int ldab, float anorm, float* rcond, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zpbcon_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, const lapack_complex_double* ab, lapack_int ldab, double anorm, double* rcond, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_spbequ_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, const float* ab, lapack_int ldab, float* s, float* scond, float* amax ); lapack_int LAPACKE_dpbequ_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, const double* ab, lapack_int ldab, double* s, double* scond, double* amax ); lapack_int LAPACKE_cpbequ_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, const lapack_complex_float* ab, lapack_int ldab, float* s, float* scond, float* amax ); lapack_int LAPACKE_zpbequ_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, const lapack_complex_double* ab, lapack_int ldab, double* s, double* scond, double* amax ); lapack_int LAPACKE_spbrfs_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, const float* ab, lapack_int ldab, const float* afb, lapack_int ldafb, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* ferr, float* berr, float* work, lapack_int* iwork ); lapack_int LAPACKE_dpbrfs_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, const double* ab, lapack_int ldab, const double* afb, lapack_int ldafb, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* ferr, double* berr, double* work, lapack_int* iwork ); lapack_int LAPACKE_cpbrfs_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, const lapack_complex_float* ab, lapack_int ldab, const lapack_complex_float* afb, lapack_int ldafb, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zpbrfs_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, const lapack_complex_double* ab, lapack_int ldab, const lapack_complex_double* afb, lapack_int ldafb, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_spbstf_work( int matrix_order, char uplo, lapack_int n, lapack_int kb, float* bb, lapack_int ldbb ); lapack_int LAPACKE_dpbstf_work( int matrix_order, char uplo, lapack_int n, lapack_int kb, double* bb, lapack_int ldbb ); lapack_int LAPACKE_cpbstf_work( int matrix_order, char uplo, lapack_int n, lapack_int kb, lapack_complex_float* bb, lapack_int ldbb ); lapack_int LAPACKE_zpbstf_work( int matrix_order, char uplo, lapack_int n, lapack_int kb, lapack_complex_double* bb, lapack_int ldbb ); lapack_int LAPACKE_spbsv_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, float* ab, lapack_int ldab, float* b, lapack_int ldb ); lapack_int LAPACKE_dpbsv_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, double* ab, lapack_int ldab, double* b, lapack_int ldb ); lapack_int LAPACKE_cpbsv_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, lapack_complex_float* ab, lapack_int ldab, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zpbsv_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, lapack_complex_double* ab, lapack_int ldab, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_spbsvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, float* ab, lapack_int ldab, float* afb, lapack_int ldafb, char* equed, float* s, float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, float* work, lapack_int* iwork ); lapack_int LAPACKE_dpbsvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, double* ab, lapack_int ldab, double* afb, lapack_int ldafb, char* equed, double* s, double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, double* work, lapack_int* iwork ); lapack_int LAPACKE_cpbsvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, lapack_complex_float* ab, lapack_int ldab, lapack_complex_float* afb, lapack_int ldafb, char* equed, float* s, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zpbsvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, lapack_complex_double* ab, lapack_int ldab, lapack_complex_double* afb, lapack_int ldafb, char* equed, double* s, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_spbtrf_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, float* ab, lapack_int ldab ); lapack_int LAPACKE_dpbtrf_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, double* ab, lapack_int ldab ); lapack_int LAPACKE_cpbtrf_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_complex_float* ab, lapack_int ldab ); lapack_int LAPACKE_zpbtrf_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_complex_double* ab, lapack_int ldab ); lapack_int LAPACKE_spbtrs_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, const float* ab, lapack_int ldab, float* b, lapack_int ldb ); lapack_int LAPACKE_dpbtrs_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, const double* ab, lapack_int ldab, double* b, lapack_int ldb ); lapack_int LAPACKE_cpbtrs_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, const lapack_complex_float* ab, lapack_int ldab, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zpbtrs_work( int matrix_order, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, const lapack_complex_double* ab, lapack_int ldab, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_spftrf_work( int matrix_order, char transr, char uplo, lapack_int n, float* a ); lapack_int LAPACKE_dpftrf_work( int matrix_order, char transr, char uplo, lapack_int n, double* a ); lapack_int LAPACKE_cpftrf_work( int matrix_order, char transr, char uplo, lapack_int n, lapack_complex_float* a ); lapack_int LAPACKE_zpftrf_work( int matrix_order, char transr, char uplo, lapack_int n, lapack_complex_double* a ); lapack_int LAPACKE_spftri_work( int matrix_order, char transr, char uplo, lapack_int n, float* a ); lapack_int LAPACKE_dpftri_work( int matrix_order, char transr, char uplo, lapack_int n, double* a ); lapack_int LAPACKE_cpftri_work( int matrix_order, char transr, char uplo, lapack_int n, lapack_complex_float* a ); lapack_int LAPACKE_zpftri_work( int matrix_order, char transr, char uplo, lapack_int n, lapack_complex_double* a ); lapack_int LAPACKE_spftrs_work( int matrix_order, char transr, char uplo, lapack_int n, lapack_int nrhs, const float* a, float* b, lapack_int ldb ); lapack_int LAPACKE_dpftrs_work( int matrix_order, char transr, char uplo, lapack_int n, lapack_int nrhs, const double* a, double* b, lapack_int ldb ); lapack_int LAPACKE_cpftrs_work( int matrix_order, char transr, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zpftrs_work( int matrix_order, char transr, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_spocon_work( int matrix_order, char uplo, lapack_int n, const float* a, lapack_int lda, float anorm, float* rcond, float* work, lapack_int* iwork ); lapack_int LAPACKE_dpocon_work( int matrix_order, char uplo, lapack_int n, const double* a, lapack_int lda, double anorm, double* rcond, double* work, lapack_int* iwork ); lapack_int LAPACKE_cpocon_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* a, lapack_int lda, float anorm, float* rcond, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zpocon_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* a, lapack_int lda, double anorm, double* rcond, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_spoequ_work( int matrix_order, lapack_int n, const float* a, lapack_int lda, float* s, float* scond, float* amax ); lapack_int LAPACKE_dpoequ_work( int matrix_order, lapack_int n, const double* a, lapack_int lda, double* s, double* scond, double* amax ); lapack_int LAPACKE_cpoequ_work( int matrix_order, lapack_int n, const lapack_complex_float* a, lapack_int lda, float* s, float* scond, float* amax ); lapack_int LAPACKE_zpoequ_work( int matrix_order, lapack_int n, const lapack_complex_double* a, lapack_int lda, double* s, double* scond, double* amax ); lapack_int LAPACKE_spoequb_work( int matrix_order, lapack_int n, const float* a, lapack_int lda, float* s, float* scond, float* amax ); lapack_int LAPACKE_dpoequb_work( int matrix_order, lapack_int n, const double* a, lapack_int lda, double* s, double* scond, double* amax ); lapack_int LAPACKE_cpoequb_work( int matrix_order, lapack_int n, const lapack_complex_float* a, lapack_int lda, float* s, float* scond, float* amax ); lapack_int LAPACKE_zpoequb_work( int matrix_order, lapack_int n, const lapack_complex_double* a, lapack_int lda, double* s, double* scond, double* amax ); lapack_int LAPACKE_sporfs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, const float* af, lapack_int ldaf, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* ferr, float* berr, float* work, lapack_int* iwork ); lapack_int LAPACKE_dporfs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, const double* af, lapack_int ldaf, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* ferr, double* berr, double* work, lapack_int* iwork ); lapack_int LAPACKE_cporfs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* af, lapack_int ldaf, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zporfs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* af, lapack_int ldaf, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_sporfsx_work( int matrix_order, char uplo, char equed, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, const float* af, lapack_int ldaf, const float* s, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params, float* work, lapack_int* iwork ); lapack_int LAPACKE_dporfsx_work( int matrix_order, char uplo, char equed, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, const double* af, lapack_int ldaf, const double* s, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params, double* work, lapack_int* iwork ); lapack_int LAPACKE_cporfsx_work( int matrix_order, char uplo, char equed, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* af, lapack_int ldaf, const float* s, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zporfsx_work( int matrix_order, char uplo, char equed, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* af, lapack_int ldaf, const double* s, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_sposv_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, float* b, lapack_int ldb ); lapack_int LAPACKE_dposv_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* b, lapack_int ldb ); lapack_int LAPACKE_cposv_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zposv_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_dsposv_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* b, lapack_int ldb, double* x, lapack_int ldx, double* work, float* swork, lapack_int* iter ); lapack_int LAPACKE_zcposv_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, lapack_complex_double* work, lapack_complex_float* swork, double* rwork, lapack_int* iter ); lapack_int LAPACKE_sposvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, float* af, lapack_int ldaf, char* equed, float* s, float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, float* work, lapack_int* iwork ); lapack_int LAPACKE_dposvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* af, lapack_int ldaf, char* equed, double* s, double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, double* work, lapack_int* iwork ); lapack_int LAPACKE_cposvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* af, lapack_int ldaf, char* equed, float* s, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zposvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* af, lapack_int ldaf, char* equed, double* s, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_sposvxx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, float* af, lapack_int ldaf, char* equed, float* s, float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* rpvgrw, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params, float* work, lapack_int* iwork ); lapack_int LAPACKE_dposvxx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* af, lapack_int ldaf, char* equed, double* s, double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* rpvgrw, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params, double* work, lapack_int* iwork ); lapack_int LAPACKE_cposvxx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* af, lapack_int ldaf, char* equed, float* s, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* rpvgrw, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zposvxx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* af, lapack_int ldaf, char* equed, double* s, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* rpvgrw, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_spotrf_work( int matrix_order, char uplo, lapack_int n, float* a, lapack_int lda ); lapack_int LAPACKE_dpotrf_work( int matrix_order, char uplo, lapack_int n, double* a, lapack_int lda ); lapack_int LAPACKE_cpotrf_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda ); lapack_int LAPACKE_zpotrf_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda ); lapack_int LAPACKE_spotri_work( int matrix_order, char uplo, lapack_int n, float* a, lapack_int lda ); lapack_int LAPACKE_dpotri_work( int matrix_order, char uplo, lapack_int n, double* a, lapack_int lda ); lapack_int LAPACKE_cpotri_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda ); lapack_int LAPACKE_zpotri_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda ); lapack_int LAPACKE_spotrs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, float* b, lapack_int ldb ); lapack_int LAPACKE_dpotrs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, double* b, lapack_int ldb ); lapack_int LAPACKE_cpotrs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zpotrs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_sppcon_work( int matrix_order, char uplo, lapack_int n, const float* ap, float anorm, float* rcond, float* work, lapack_int* iwork ); lapack_int LAPACKE_dppcon_work( int matrix_order, char uplo, lapack_int n, const double* ap, double anorm, double* rcond, double* work, lapack_int* iwork ); lapack_int LAPACKE_cppcon_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* ap, float anorm, float* rcond, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zppcon_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* ap, double anorm, double* rcond, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_sppequ_work( int matrix_order, char uplo, lapack_int n, const float* ap, float* s, float* scond, float* amax ); lapack_int LAPACKE_dppequ_work( int matrix_order, char uplo, lapack_int n, const double* ap, double* s, double* scond, double* amax ); lapack_int LAPACKE_cppequ_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* ap, float* s, float* scond, float* amax ); lapack_int LAPACKE_zppequ_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* ap, double* s, double* scond, double* amax ); lapack_int LAPACKE_spprfs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const float* ap, const float* afp, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* ferr, float* berr, float* work, lapack_int* iwork ); lapack_int LAPACKE_dpprfs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const double* ap, const double* afp, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* ferr, double* berr, double* work, lapack_int* iwork ); lapack_int LAPACKE_cpprfs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* ap, const lapack_complex_float* afp, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zpprfs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* ap, const lapack_complex_double* afp, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_sppsv_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, float* ap, float* b, lapack_int ldb ); lapack_int LAPACKE_dppsv_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, double* ap, double* b, lapack_int ldb ); lapack_int LAPACKE_cppsv_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* ap, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zppsv_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* ap, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_sppsvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, float* ap, float* afp, char* equed, float* s, float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, float* work, lapack_int* iwork ); lapack_int LAPACKE_dppsvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, double* ap, double* afp, char* equed, double* s, double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, double* work, lapack_int* iwork ); lapack_int LAPACKE_cppsvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* ap, lapack_complex_float* afp, char* equed, float* s, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zppsvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* ap, lapack_complex_double* afp, char* equed, double* s, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_spptrf_work( int matrix_order, char uplo, lapack_int n, float* ap ); lapack_int LAPACKE_dpptrf_work( int matrix_order, char uplo, lapack_int n, double* ap ); lapack_int LAPACKE_cpptrf_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* ap ); lapack_int LAPACKE_zpptrf_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* ap ); lapack_int LAPACKE_spptri_work( int matrix_order, char uplo, lapack_int n, float* ap ); lapack_int LAPACKE_dpptri_work( int matrix_order, char uplo, lapack_int n, double* ap ); lapack_int LAPACKE_cpptri_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* ap ); lapack_int LAPACKE_zpptri_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* ap ); lapack_int LAPACKE_spptrs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const float* ap, float* b, lapack_int ldb ); lapack_int LAPACKE_dpptrs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const double* ap, double* b, lapack_int ldb ); lapack_int LAPACKE_cpptrs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* ap, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zpptrs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* ap, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_spstrf_work( int matrix_order, char uplo, lapack_int n, float* a, lapack_int lda, lapack_int* piv, lapack_int* rank, float tol, float* work ); lapack_int LAPACKE_dpstrf_work( int matrix_order, char uplo, lapack_int n, double* a, lapack_int lda, lapack_int* piv, lapack_int* rank, double tol, double* work ); lapack_int LAPACKE_cpstrf_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_int* piv, lapack_int* rank, float tol, float* work ); lapack_int LAPACKE_zpstrf_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_int* piv, lapack_int* rank, double tol, double* work ); lapack_int LAPACKE_sptcon_work( lapack_int n, const float* d, const float* e, float anorm, float* rcond, float* work ); lapack_int LAPACKE_dptcon_work( lapack_int n, const double* d, const double* e, double anorm, double* rcond, double* work ); lapack_int LAPACKE_cptcon_work( lapack_int n, const float* d, const lapack_complex_float* e, float anorm, float* rcond, float* work ); lapack_int LAPACKE_zptcon_work( lapack_int n, const double* d, const lapack_complex_double* e, double anorm, double* rcond, double* work ); lapack_int LAPACKE_spteqr_work( int matrix_order, char compz, lapack_int n, float* d, float* e, float* z, lapack_int ldz, float* work ); lapack_int LAPACKE_dpteqr_work( int matrix_order, char compz, lapack_int n, double* d, double* e, double* z, lapack_int ldz, double* work ); lapack_int LAPACKE_cpteqr_work( int matrix_order, char compz, lapack_int n, float* d, float* e, lapack_complex_float* z, lapack_int ldz, float* work ); lapack_int LAPACKE_zpteqr_work( int matrix_order, char compz, lapack_int n, double* d, double* e, lapack_complex_double* z, lapack_int ldz, double* work ); lapack_int LAPACKE_sptrfs_work( int matrix_order, lapack_int n, lapack_int nrhs, const float* d, const float* e, const float* df, const float* ef, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* ferr, float* berr, float* work ); lapack_int LAPACKE_dptrfs_work( int matrix_order, lapack_int n, lapack_int nrhs, const double* d, const double* e, const double* df, const double* ef, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* ferr, double* berr, double* work ); lapack_int LAPACKE_cptrfs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const float* d, const lapack_complex_float* e, const float* df, const lapack_complex_float* ef, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zptrfs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const double* d, const lapack_complex_double* e, const double* df, const lapack_complex_double* ef, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_sptsv_work( int matrix_order, lapack_int n, lapack_int nrhs, float* d, float* e, float* b, lapack_int ldb ); lapack_int LAPACKE_dptsv_work( int matrix_order, lapack_int n, lapack_int nrhs, double* d, double* e, double* b, lapack_int ldb ); lapack_int LAPACKE_cptsv_work( int matrix_order, lapack_int n, lapack_int nrhs, float* d, lapack_complex_float* e, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zptsv_work( int matrix_order, lapack_int n, lapack_int nrhs, double* d, lapack_complex_double* e, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_sptsvx_work( int matrix_order, char fact, lapack_int n, lapack_int nrhs, const float* d, const float* e, float* df, float* ef, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, float* work ); lapack_int LAPACKE_dptsvx_work( int matrix_order, char fact, lapack_int n, lapack_int nrhs, const double* d, const double* e, double* df, double* ef, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, double* work ); lapack_int LAPACKE_cptsvx_work( int matrix_order, char fact, lapack_int n, lapack_int nrhs, const float* d, const lapack_complex_float* e, float* df, lapack_complex_float* ef, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zptsvx_work( int matrix_order, char fact, lapack_int n, lapack_int nrhs, const double* d, const lapack_complex_double* e, double* df, lapack_complex_double* ef, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_spttrf_work( lapack_int n, float* d, float* e ); lapack_int LAPACKE_dpttrf_work( lapack_int n, double* d, double* e ); lapack_int LAPACKE_cpttrf_work( lapack_int n, float* d, lapack_complex_float* e ); lapack_int LAPACKE_zpttrf_work( lapack_int n, double* d, lapack_complex_double* e ); lapack_int LAPACKE_spttrs_work( int matrix_order, lapack_int n, lapack_int nrhs, const float* d, const float* e, float* b, lapack_int ldb ); lapack_int LAPACKE_dpttrs_work( int matrix_order, lapack_int n, lapack_int nrhs, const double* d, const double* e, double* b, lapack_int ldb ); lapack_int LAPACKE_cpttrs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const float* d, const lapack_complex_float* e, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zpttrs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const double* d, const lapack_complex_double* e, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_ssbev_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int kd, float* ab, lapack_int ldab, float* w, float* z, lapack_int ldz, float* work ); lapack_int LAPACKE_dsbev_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int kd, double* ab, lapack_int ldab, double* w, double* z, lapack_int ldz, double* work ); lapack_int LAPACKE_ssbevd_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int kd, float* ab, lapack_int ldab, float* w, float* z, lapack_int ldz, float* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_dsbevd_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int kd, double* ab, lapack_int ldab, double* w, double* z, lapack_int ldz, double* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_ssbevx_work( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_int kd, float* ab, lapack_int ldab, float* q, lapack_int ldq, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, float* z, lapack_int ldz, float* work, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_dsbevx_work( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_int kd, double* ab, lapack_int ldab, double* q, lapack_int ldq, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, double* z, lapack_int ldz, double* work, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_ssbgst_work( int matrix_order, char vect, char uplo, lapack_int n, lapack_int ka, lapack_int kb, float* ab, lapack_int ldab, const float* bb, lapack_int ldbb, float* x, lapack_int ldx, float* work ); lapack_int LAPACKE_dsbgst_work( int matrix_order, char vect, char uplo, lapack_int n, lapack_int ka, lapack_int kb, double* ab, lapack_int ldab, const double* bb, lapack_int ldbb, double* x, lapack_int ldx, double* work ); lapack_int LAPACKE_ssbgv_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int ka, lapack_int kb, float* ab, lapack_int ldab, float* bb, lapack_int ldbb, float* w, float* z, lapack_int ldz, float* work ); lapack_int LAPACKE_dsbgv_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int ka, lapack_int kb, double* ab, lapack_int ldab, double* bb, lapack_int ldbb, double* w, double* z, lapack_int ldz, double* work ); lapack_int LAPACKE_ssbgvd_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int ka, lapack_int kb, float* ab, lapack_int ldab, float* bb, lapack_int ldbb, float* w, float* z, lapack_int ldz, float* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_dsbgvd_work( int matrix_order, char jobz, char uplo, lapack_int n, lapack_int ka, lapack_int kb, double* ab, lapack_int ldab, double* bb, lapack_int ldbb, double* w, double* z, lapack_int ldz, double* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_ssbgvx_work( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_int ka, lapack_int kb, float* ab, lapack_int ldab, float* bb, lapack_int ldbb, float* q, lapack_int ldq, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, float* z, lapack_int ldz, float* work, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_dsbgvx_work( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_int ka, lapack_int kb, double* ab, lapack_int ldab, double* bb, lapack_int ldbb, double* q, lapack_int ldq, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, double* z, lapack_int ldz, double* work, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_ssbtrd_work( int matrix_order, char vect, char uplo, lapack_int n, lapack_int kd, float* ab, lapack_int ldab, float* d, float* e, float* q, lapack_int ldq, float* work ); lapack_int LAPACKE_dsbtrd_work( int matrix_order, char vect, char uplo, lapack_int n, lapack_int kd, double* ab, lapack_int ldab, double* d, double* e, double* q, lapack_int ldq, double* work ); lapack_int LAPACKE_ssfrk_work( int matrix_order, char transr, char uplo, char trans, lapack_int n, lapack_int k, float alpha, const float* a, lapack_int lda, float beta, float* c ); lapack_int LAPACKE_dsfrk_work( int matrix_order, char transr, char uplo, char trans, lapack_int n, lapack_int k, double alpha, const double* a, lapack_int lda, double beta, double* c ); lapack_int LAPACKE_sspcon_work( int matrix_order, char uplo, lapack_int n, const float* ap, const lapack_int* ipiv, float anorm, float* rcond, float* work, lapack_int* iwork ); lapack_int LAPACKE_dspcon_work( int matrix_order, char uplo, lapack_int n, const double* ap, const lapack_int* ipiv, double anorm, double* rcond, double* work, lapack_int* iwork ); lapack_int LAPACKE_cspcon_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* ap, const lapack_int* ipiv, float anorm, float* rcond, lapack_complex_float* work ); lapack_int LAPACKE_zspcon_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* ap, const lapack_int* ipiv, double anorm, double* rcond, lapack_complex_double* work ); lapack_int LAPACKE_sspev_work( int matrix_order, char jobz, char uplo, lapack_int n, float* ap, float* w, float* z, lapack_int ldz, float* work ); lapack_int LAPACKE_dspev_work( int matrix_order, char jobz, char uplo, lapack_int n, double* ap, double* w, double* z, lapack_int ldz, double* work ); lapack_int LAPACKE_sspevd_work( int matrix_order, char jobz, char uplo, lapack_int n, float* ap, float* w, float* z, lapack_int ldz, float* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_dspevd_work( int matrix_order, char jobz, char uplo, lapack_int n, double* ap, double* w, double* z, lapack_int ldz, double* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_sspevx_work( int matrix_order, char jobz, char range, char uplo, lapack_int n, float* ap, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, float* z, lapack_int ldz, float* work, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_dspevx_work( int matrix_order, char jobz, char range, char uplo, lapack_int n, double* ap, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, double* z, lapack_int ldz, double* work, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_sspgst_work( int matrix_order, lapack_int itype, char uplo, lapack_int n, float* ap, const float* bp ); lapack_int LAPACKE_dspgst_work( int matrix_order, lapack_int itype, char uplo, lapack_int n, double* ap, const double* bp ); lapack_int LAPACKE_sspgv_work( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, float* ap, float* bp, float* w, float* z, lapack_int ldz, float* work ); lapack_int LAPACKE_dspgv_work( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, double* ap, double* bp, double* w, double* z, lapack_int ldz, double* work ); lapack_int LAPACKE_sspgvd_work( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, float* ap, float* bp, float* w, float* z, lapack_int ldz, float* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_dspgvd_work( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, double* ap, double* bp, double* w, double* z, lapack_int ldz, double* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_sspgvx_work( int matrix_order, lapack_int itype, char jobz, char range, char uplo, lapack_int n, float* ap, float* bp, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, float* z, lapack_int ldz, float* work, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_dspgvx_work( int matrix_order, lapack_int itype, char jobz, char range, char uplo, lapack_int n, double* ap, double* bp, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, double* z, lapack_int ldz, double* work, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_ssprfs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const float* ap, const float* afp, const lapack_int* ipiv, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* ferr, float* berr, float* work, lapack_int* iwork ); lapack_int LAPACKE_dsprfs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const double* ap, const double* afp, const lapack_int* ipiv, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* ferr, double* berr, double* work, lapack_int* iwork ); lapack_int LAPACKE_csprfs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* ap, const lapack_complex_float* afp, const lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zsprfs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* ap, const lapack_complex_double* afp, const lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_sspsv_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, float* ap, lapack_int* ipiv, float* b, lapack_int ldb ); lapack_int LAPACKE_dspsv_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, double* ap, lapack_int* ipiv, double* b, lapack_int ldb ); lapack_int LAPACKE_cspsv_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* ap, lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zspsv_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* ap, lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_sspsvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const float* ap, float* afp, lapack_int* ipiv, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, float* work, lapack_int* iwork ); lapack_int LAPACKE_dspsvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const double* ap, double* afp, lapack_int* ipiv, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, double* work, lapack_int* iwork ); lapack_int LAPACKE_cspsvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* ap, lapack_complex_float* afp, lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zspsvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* ap, lapack_complex_double* afp, lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_ssptrd_work( int matrix_order, char uplo, lapack_int n, float* ap, float* d, float* e, float* tau ); lapack_int LAPACKE_dsptrd_work( int matrix_order, char uplo, lapack_int n, double* ap, double* d, double* e, double* tau ); lapack_int LAPACKE_ssptrf_work( int matrix_order, char uplo, lapack_int n, float* ap, lapack_int* ipiv ); lapack_int LAPACKE_dsptrf_work( int matrix_order, char uplo, lapack_int n, double* ap, lapack_int* ipiv ); lapack_int LAPACKE_csptrf_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* ap, lapack_int* ipiv ); lapack_int LAPACKE_zsptrf_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* ap, lapack_int* ipiv ); lapack_int LAPACKE_ssptri_work( int matrix_order, char uplo, lapack_int n, float* ap, const lapack_int* ipiv, float* work ); lapack_int LAPACKE_dsptri_work( int matrix_order, char uplo, lapack_int n, double* ap, const lapack_int* ipiv, double* work ); lapack_int LAPACKE_csptri_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* ap, const lapack_int* ipiv, lapack_complex_float* work ); lapack_int LAPACKE_zsptri_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* ap, const lapack_int* ipiv, lapack_complex_double* work ); lapack_int LAPACKE_ssptrs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const float* ap, const lapack_int* ipiv, float* b, lapack_int ldb ); lapack_int LAPACKE_dsptrs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const double* ap, const lapack_int* ipiv, double* b, lapack_int ldb ); lapack_int LAPACKE_csptrs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* ap, const lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zsptrs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* ap, const lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_sstebz_work( char range, char order, lapack_int n, float vl, float vu, lapack_int il, lapack_int iu, float abstol, const float* d, const float* e, lapack_int* m, lapack_int* nsplit, float* w, lapack_int* iblock, lapack_int* isplit, float* work, lapack_int* iwork ); lapack_int LAPACKE_dstebz_work( char range, char order, lapack_int n, double vl, double vu, lapack_int il, lapack_int iu, double abstol, const double* d, const double* e, lapack_int* m, lapack_int* nsplit, double* w, lapack_int* iblock, lapack_int* isplit, double* work, lapack_int* iwork ); lapack_int LAPACKE_sstedc_work( int matrix_order, char compz, lapack_int n, float* d, float* e, float* z, lapack_int ldz, float* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_dstedc_work( int matrix_order, char compz, lapack_int n, double* d, double* e, double* z, lapack_int ldz, double* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_cstedc_work( int matrix_order, char compz, lapack_int n, float* d, float* e, lapack_complex_float* z, lapack_int ldz, lapack_complex_float* work, lapack_int lwork, float* rwork, lapack_int lrwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_zstedc_work( int matrix_order, char compz, lapack_int n, double* d, double* e, lapack_complex_double* z, lapack_int ldz, lapack_complex_double* work, lapack_int lwork, double* rwork, lapack_int lrwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_sstegr_work( int matrix_order, char jobz, char range, lapack_int n, float* d, float* e, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, float* z, lapack_int ldz, lapack_int* isuppz, float* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_dstegr_work( int matrix_order, char jobz, char range, lapack_int n, double* d, double* e, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, double* z, lapack_int ldz, lapack_int* isuppz, double* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_cstegr_work( int matrix_order, char jobz, char range, lapack_int n, float* d, float* e, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int ldz, lapack_int* isuppz, float* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_zstegr_work( int matrix_order, char jobz, char range, lapack_int n, double* d, double* e, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int ldz, lapack_int* isuppz, double* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_sstein_work( int matrix_order, lapack_int n, const float* d, const float* e, lapack_int m, const float* w, const lapack_int* iblock, const lapack_int* isplit, float* z, lapack_int ldz, float* work, lapack_int* iwork, lapack_int* ifailv ); lapack_int LAPACKE_dstein_work( int matrix_order, lapack_int n, const double* d, const double* e, lapack_int m, const double* w, const lapack_int* iblock, const lapack_int* isplit, double* z, lapack_int ldz, double* work, lapack_int* iwork, lapack_int* ifailv ); lapack_int LAPACKE_cstein_work( int matrix_order, lapack_int n, const float* d, const float* e, lapack_int m, const float* w, const lapack_int* iblock, const lapack_int* isplit, lapack_complex_float* z, lapack_int ldz, float* work, lapack_int* iwork, lapack_int* ifailv ); lapack_int LAPACKE_zstein_work( int matrix_order, lapack_int n, const double* d, const double* e, lapack_int m, const double* w, const lapack_int* iblock, const lapack_int* isplit, lapack_complex_double* z, lapack_int ldz, double* work, lapack_int* iwork, lapack_int* ifailv ); lapack_int LAPACKE_sstemr_work( int matrix_order, char jobz, char range, lapack_int n, float* d, float* e, float vl, float vu, lapack_int il, lapack_int iu, lapack_int* m, float* w, float* z, lapack_int ldz, lapack_int nzc, lapack_int* isuppz, lapack_logical* tryrac, float* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_dstemr_work( int matrix_order, char jobz, char range, lapack_int n, double* d, double* e, double vl, double vu, lapack_int il, lapack_int iu, lapack_int* m, double* w, double* z, lapack_int ldz, lapack_int nzc, lapack_int* isuppz, lapack_logical* tryrac, double* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_cstemr_work( int matrix_order, char jobz, char range, lapack_int n, float* d, float* e, float vl, float vu, lapack_int il, lapack_int iu, lapack_int* m, float* w, lapack_complex_float* z, lapack_int ldz, lapack_int nzc, lapack_int* isuppz, lapack_logical* tryrac, float* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_zstemr_work( int matrix_order, char jobz, char range, lapack_int n, double* d, double* e, double vl, double vu, lapack_int il, lapack_int iu, lapack_int* m, double* w, lapack_complex_double* z, lapack_int ldz, lapack_int nzc, lapack_int* isuppz, lapack_logical* tryrac, double* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_ssteqr_work( int matrix_order, char compz, lapack_int n, float* d, float* e, float* z, lapack_int ldz, float* work ); lapack_int LAPACKE_dsteqr_work( int matrix_order, char compz, lapack_int n, double* d, double* e, double* z, lapack_int ldz, double* work ); lapack_int LAPACKE_csteqr_work( int matrix_order, char compz, lapack_int n, float* d, float* e, lapack_complex_float* z, lapack_int ldz, float* work ); lapack_int LAPACKE_zsteqr_work( int matrix_order, char compz, lapack_int n, double* d, double* e, lapack_complex_double* z, lapack_int ldz, double* work ); lapack_int LAPACKE_ssterf_work( lapack_int n, float* d, float* e ); lapack_int LAPACKE_dsterf_work( lapack_int n, double* d, double* e ); lapack_int LAPACKE_sstev_work( int matrix_order, char jobz, lapack_int n, float* d, float* e, float* z, lapack_int ldz, float* work ); lapack_int LAPACKE_dstev_work( int matrix_order, char jobz, lapack_int n, double* d, double* e, double* z, lapack_int ldz, double* work ); lapack_int LAPACKE_sstevd_work( int matrix_order, char jobz, lapack_int n, float* d, float* e, float* z, lapack_int ldz, float* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_dstevd_work( int matrix_order, char jobz, lapack_int n, double* d, double* e, double* z, lapack_int ldz, double* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_sstevr_work( int matrix_order, char jobz, char range, lapack_int n, float* d, float* e, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, float* z, lapack_int ldz, lapack_int* isuppz, float* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_dstevr_work( int matrix_order, char jobz, char range, lapack_int n, double* d, double* e, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, double* z, lapack_int ldz, lapack_int* isuppz, double* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_sstevx_work( int matrix_order, char jobz, char range, lapack_int n, float* d, float* e, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, float* z, lapack_int ldz, float* work, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_dstevx_work( int matrix_order, char jobz, char range, lapack_int n, double* d, double* e, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, double* z, lapack_int ldz, double* work, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_ssycon_work( int matrix_order, char uplo, lapack_int n, const float* a, lapack_int lda, const lapack_int* ipiv, float anorm, float* rcond, float* work, lapack_int* iwork ); lapack_int LAPACKE_dsycon_work( int matrix_order, char uplo, lapack_int n, const double* a, lapack_int lda, const lapack_int* ipiv, double anorm, double* rcond, double* work, lapack_int* iwork ); lapack_int LAPACKE_csycon_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, float anorm, float* rcond, lapack_complex_float* work ); lapack_int LAPACKE_zsycon_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, double anorm, double* rcond, lapack_complex_double* work ); lapack_int LAPACKE_ssyequb_work( int matrix_order, char uplo, lapack_int n, const float* a, lapack_int lda, float* s, float* scond, float* amax, float* work ); lapack_int LAPACKE_dsyequb_work( int matrix_order, char uplo, lapack_int n, const double* a, lapack_int lda, double* s, double* scond, double* amax, double* work ); lapack_int LAPACKE_csyequb_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* a, lapack_int lda, float* s, float* scond, float* amax, lapack_complex_float* work ); lapack_int LAPACKE_zsyequb_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* a, lapack_int lda, double* s, double* scond, double* amax, lapack_complex_double* work ); lapack_int LAPACKE_ssyev_work( int matrix_order, char jobz, char uplo, lapack_int n, float* a, lapack_int lda, float* w, float* work, lapack_int lwork ); lapack_int LAPACKE_dsyev_work( int matrix_order, char jobz, char uplo, lapack_int n, double* a, lapack_int lda, double* w, double* work, lapack_int lwork ); lapack_int LAPACKE_ssyevd_work( int matrix_order, char jobz, char uplo, lapack_int n, float* a, lapack_int lda, float* w, float* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_dsyevd_work( int matrix_order, char jobz, char uplo, lapack_int n, double* a, lapack_int lda, double* w, double* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_ssyevr_work( int matrix_order, char jobz, char range, char uplo, lapack_int n, float* a, lapack_int lda, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, float* z, lapack_int ldz, lapack_int* isuppz, float* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_dsyevr_work( int matrix_order, char jobz, char range, char uplo, lapack_int n, double* a, lapack_int lda, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, double* z, lapack_int ldz, lapack_int* isuppz, double* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_ssyevx_work( int matrix_order, char jobz, char range, char uplo, lapack_int n, float* a, lapack_int lda, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, float* z, lapack_int ldz, float* work, lapack_int lwork, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_dsyevx_work( int matrix_order, char jobz, char range, char uplo, lapack_int n, double* a, lapack_int lda, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, double* z, lapack_int ldz, double* work, lapack_int lwork, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_ssygst_work( int matrix_order, lapack_int itype, char uplo, lapack_int n, float* a, lapack_int lda, const float* b, lapack_int ldb ); lapack_int LAPACKE_dsygst_work( int matrix_order, lapack_int itype, char uplo, lapack_int n, double* a, lapack_int lda, const double* b, lapack_int ldb ); lapack_int LAPACKE_ssygv_work( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, float* w, float* work, lapack_int lwork ); lapack_int LAPACKE_dsygv_work( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, double* w, double* work, lapack_int lwork ); lapack_int LAPACKE_ssygvd_work( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, float* w, float* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_dsygvd_work( int matrix_order, lapack_int itype, char jobz, char uplo, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, double* w, double* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_ssygvx_work( int matrix_order, lapack_int itype, char jobz, char range, char uplo, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, float* z, lapack_int ldz, float* work, lapack_int lwork, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_dsygvx_work( int matrix_order, lapack_int itype, char jobz, char range, char uplo, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, double* z, lapack_int ldz, double* work, lapack_int lwork, lapack_int* iwork, lapack_int* ifail ); lapack_int LAPACKE_ssyrfs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, const float* af, lapack_int ldaf, const lapack_int* ipiv, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* ferr, float* berr, float* work, lapack_int* iwork ); lapack_int LAPACKE_dsyrfs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, const double* af, lapack_int ldaf, const lapack_int* ipiv, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* ferr, double* berr, double* work, lapack_int* iwork ); lapack_int LAPACKE_csyrfs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* af, lapack_int ldaf, const lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zsyrfs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* af, lapack_int ldaf, const lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_ssyrfsx_work( int matrix_order, char uplo, char equed, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, const float* af, lapack_int ldaf, const lapack_int* ipiv, const float* s, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params, float* work, lapack_int* iwork ); lapack_int LAPACKE_dsyrfsx_work( int matrix_order, char uplo, char equed, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, const double* af, lapack_int ldaf, const lapack_int* ipiv, const double* s, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params, double* work, lapack_int* iwork ); lapack_int LAPACKE_csyrfsx_work( int matrix_order, char uplo, char equed, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* af, lapack_int ldaf, const lapack_int* ipiv, const float* s, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zsyrfsx_work( int matrix_order, char uplo, char equed, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* af, lapack_int ldaf, const lapack_int* ipiv, const double* s, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_ssysv_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, lapack_int* ipiv, float* b, lapack_int ldb, float* work, lapack_int lwork ); lapack_int LAPACKE_dsysv_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, lapack_int* ipiv, double* b, lapack_int ldb, double* work, lapack_int lwork ); lapack_int LAPACKE_csysv_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zsysv_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_ssysvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, float* af, lapack_int ldaf, lapack_int* ipiv, const float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, float* work, lapack_int lwork, lapack_int* iwork ); lapack_int LAPACKE_dsysvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, double* af, lapack_int ldaf, lapack_int* ipiv, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, double* work, lapack_int lwork, lapack_int* iwork ); lapack_int LAPACKE_csysvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, lapack_complex_float* af, lapack_int ldaf, lapack_int* ipiv, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr, lapack_complex_float* work, lapack_int lwork, float* rwork ); lapack_int LAPACKE_zsysvx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, lapack_complex_double* af, lapack_int ldaf, lapack_int* ipiv, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, lapack_complex_double* work, lapack_int lwork, double* rwork ); lapack_int LAPACKE_ssysvxx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, float* af, lapack_int ldaf, lapack_int* ipiv, char* equed, float* s, float* b, lapack_int ldb, float* x, lapack_int ldx, float* rcond, float* rpvgrw, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params, float* work, lapack_int* iwork ); lapack_int LAPACKE_dsysvxx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* af, lapack_int ldaf, lapack_int* ipiv, char* equed, double* s, double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* rpvgrw, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params, double* work, lapack_int* iwork ); lapack_int LAPACKE_csysvxx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* af, lapack_int ldaf, lapack_int* ipiv, char* equed, float* s, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* rpvgrw, float* berr, lapack_int n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int nparams, float* params, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_zsysvxx_work( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* af, lapack_int ldaf, lapack_int* ipiv, char* equed, double* s, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* x, lapack_int ldx, double* rcond, double* rpvgrw, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_ssytrd_work( int matrix_order, char uplo, lapack_int n, float* a, lapack_int lda, float* d, float* e, float* tau, float* work, lapack_int lwork ); lapack_int LAPACKE_dsytrd_work( int matrix_order, char uplo, lapack_int n, double* a, lapack_int lda, double* d, double* e, double* tau, double* work, lapack_int lwork ); lapack_int LAPACKE_ssytrf_work( int matrix_order, char uplo, lapack_int n, float* a, lapack_int lda, lapack_int* ipiv, float* work, lapack_int lwork ); lapack_int LAPACKE_dsytrf_work( int matrix_order, char uplo, lapack_int n, double* a, lapack_int lda, lapack_int* ipiv, double* work, lapack_int lwork ); lapack_int LAPACKE_csytrf_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_int* ipiv, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zsytrf_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_int* ipiv, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_ssytri_work( int matrix_order, char uplo, lapack_int n, float* a, lapack_int lda, const lapack_int* ipiv, float* work ); lapack_int LAPACKE_dsytri_work( int matrix_order, char uplo, lapack_int n, double* a, lapack_int lda, const lapack_int* ipiv, double* work ); lapack_int LAPACKE_csytri_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_float* work ); lapack_int LAPACKE_zsytri_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_double* work ); lapack_int LAPACKE_ssytrs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, const lapack_int* ipiv, float* b, lapack_int ldb ); lapack_int LAPACKE_dsytrs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, const lapack_int* ipiv, double* b, lapack_int ldb ); lapack_int LAPACKE_csytrs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_zsytrs_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_stbcon_work( int matrix_order, char norm, char uplo, char diag, lapack_int n, lapack_int kd, const float* ab, lapack_int ldab, float* rcond, float* work, lapack_int* iwork ); lapack_int LAPACKE_dtbcon_work( int matrix_order, char norm, char uplo, char diag, lapack_int n, lapack_int kd, const double* ab, lapack_int ldab, double* rcond, double* work, lapack_int* iwork ); lapack_int LAPACKE_ctbcon_work( int matrix_order, char norm, char uplo, char diag, lapack_int n, lapack_int kd, const lapack_complex_float* ab, lapack_int ldab, float* rcond, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_ztbcon_work( int matrix_order, char norm, char uplo, char diag, lapack_int n, lapack_int kd, const lapack_complex_double* ab, lapack_int ldab, double* rcond, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_stbrfs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int kd, lapack_int nrhs, const float* ab, lapack_int ldab, const float* b, lapack_int ldb, const float* x, lapack_int ldx, float* ferr, float* berr, float* work, lapack_int* iwork ); lapack_int LAPACKE_dtbrfs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int kd, lapack_int nrhs, const double* ab, lapack_int ldab, const double* b, lapack_int ldb, const double* x, lapack_int ldx, double* ferr, double* berr, double* work, lapack_int* iwork ); lapack_int LAPACKE_ctbrfs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int kd, lapack_int nrhs, const lapack_complex_float* ab, lapack_int ldab, const lapack_complex_float* b, lapack_int ldb, const lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_ztbrfs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int kd, lapack_int nrhs, const lapack_complex_double* ab, lapack_int ldab, const lapack_complex_double* b, lapack_int ldb, const lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_stbtrs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int kd, lapack_int nrhs, const float* ab, lapack_int ldab, float* b, lapack_int ldb ); lapack_int LAPACKE_dtbtrs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int kd, lapack_int nrhs, const double* ab, lapack_int ldab, double* b, lapack_int ldb ); lapack_int LAPACKE_ctbtrs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int kd, lapack_int nrhs, const lapack_complex_float* ab, lapack_int ldab, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_ztbtrs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int kd, lapack_int nrhs, const lapack_complex_double* ab, lapack_int ldab, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_stfsm_work( int matrix_order, char transr, char side, char uplo, char trans, char diag, lapack_int m, lapack_int n, float alpha, const float* a, float* b, lapack_int ldb ); lapack_int LAPACKE_dtfsm_work( int matrix_order, char transr, char side, char uplo, char trans, char diag, lapack_int m, lapack_int n, double alpha, const double* a, double* b, lapack_int ldb ); lapack_int LAPACKE_ctfsm_work( int matrix_order, char transr, char side, char uplo, char trans, char diag, lapack_int m, lapack_int n, lapack_complex_float alpha, const lapack_complex_float* a, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_ztfsm_work( int matrix_order, char transr, char side, char uplo, char trans, char diag, lapack_int m, lapack_int n, lapack_complex_double alpha, const lapack_complex_double* a, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_stftri_work( int matrix_order, char transr, char uplo, char diag, lapack_int n, float* a ); lapack_int LAPACKE_dtftri_work( int matrix_order, char transr, char uplo, char diag, lapack_int n, double* a ); lapack_int LAPACKE_ctftri_work( int matrix_order, char transr, char uplo, char diag, lapack_int n, lapack_complex_float* a ); lapack_int LAPACKE_ztftri_work( int matrix_order, char transr, char uplo, char diag, lapack_int n, lapack_complex_double* a ); lapack_int LAPACKE_stfttp_work( int matrix_order, char transr, char uplo, lapack_int n, const float* arf, float* ap ); lapack_int LAPACKE_dtfttp_work( int matrix_order, char transr, char uplo, lapack_int n, const double* arf, double* ap ); lapack_int LAPACKE_ctfttp_work( int matrix_order, char transr, char uplo, lapack_int n, const lapack_complex_float* arf, lapack_complex_float* ap ); lapack_int LAPACKE_ztfttp_work( int matrix_order, char transr, char uplo, lapack_int n, const lapack_complex_double* arf, lapack_complex_double* ap ); lapack_int LAPACKE_stfttr_work( int matrix_order, char transr, char uplo, lapack_int n, const float* arf, float* a, lapack_int lda ); lapack_int LAPACKE_dtfttr_work( int matrix_order, char transr, char uplo, lapack_int n, const double* arf, double* a, lapack_int lda ); lapack_int LAPACKE_ctfttr_work( int matrix_order, char transr, char uplo, lapack_int n, const lapack_complex_float* arf, lapack_complex_float* a, lapack_int lda ); lapack_int LAPACKE_ztfttr_work( int matrix_order, char transr, char uplo, lapack_int n, const lapack_complex_double* arf, lapack_complex_double* a, lapack_int lda ); lapack_int LAPACKE_stgevc_work( int matrix_order, char side, char howmny, const lapack_logical* select, lapack_int n, const float* s, lapack_int lds, const float* p, lapack_int ldp, float* vl, lapack_int ldvl, float* vr, lapack_int ldvr, lapack_int mm, lapack_int* m, float* work ); lapack_int LAPACKE_dtgevc_work( int matrix_order, char side, char howmny, const lapack_logical* select, lapack_int n, const double* s, lapack_int lds, const double* p, lapack_int ldp, double* vl, lapack_int ldvl, double* vr, lapack_int ldvr, lapack_int mm, lapack_int* m, double* work ); lapack_int LAPACKE_ctgevc_work( int matrix_order, char side, char howmny, const lapack_logical* select, lapack_int n, const lapack_complex_float* s, lapack_int lds, const lapack_complex_float* p, lapack_int ldp, lapack_complex_float* vl, lapack_int ldvl, lapack_complex_float* vr, lapack_int ldvr, lapack_int mm, lapack_int* m, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_ztgevc_work( int matrix_order, char side, char howmny, const lapack_logical* select, lapack_int n, const lapack_complex_double* s, lapack_int lds, const lapack_complex_double* p, lapack_int ldp, lapack_complex_double* vl, lapack_int ldvl, lapack_complex_double* vr, lapack_int ldvr, lapack_int mm, lapack_int* m, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_stgexc_work( int matrix_order, lapack_logical wantq, lapack_logical wantz, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, float* q, lapack_int ldq, float* z, lapack_int ldz, lapack_int* ifst, lapack_int* ilst, float* work, lapack_int lwork ); lapack_int LAPACKE_dtgexc_work( int matrix_order, lapack_logical wantq, lapack_logical wantz, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, double* q, lapack_int ldq, double* z, lapack_int ldz, lapack_int* ifst, lapack_int* ilst, double* work, lapack_int lwork ); lapack_int LAPACKE_ctgexc_work( int matrix_order, lapack_logical wantq, lapack_logical wantz, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* q, lapack_int ldq, lapack_complex_float* z, lapack_int ldz, lapack_int ifst, lapack_int ilst ); lapack_int LAPACKE_ztgexc_work( int matrix_order, lapack_logical wantq, lapack_logical wantz, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* q, lapack_int ldq, lapack_complex_double* z, lapack_int ldz, lapack_int ifst, lapack_int ilst ); lapack_int LAPACKE_stgsen_work( int matrix_order, lapack_int ijob, lapack_logical wantq, lapack_logical wantz, const lapack_logical* select, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, float* alphar, float* alphai, float* beta, float* q, lapack_int ldq, float* z, lapack_int ldz, lapack_int* m, float* pl, float* pr, float* dif, float* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_dtgsen_work( int matrix_order, lapack_int ijob, lapack_logical wantq, lapack_logical wantz, const lapack_logical* select, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, double* alphar, double* alphai, double* beta, double* q, lapack_int ldq, double* z, lapack_int ldz, lapack_int* m, double* pl, double* pr, double* dif, double* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_ctgsen_work( int matrix_order, lapack_int ijob, lapack_logical wantq, lapack_logical wantz, const lapack_logical* select, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* alpha, lapack_complex_float* beta, lapack_complex_float* q, lapack_int ldq, lapack_complex_float* z, lapack_int ldz, lapack_int* m, float* pl, float* pr, float* dif, lapack_complex_float* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_ztgsen_work( int matrix_order, lapack_int ijob, lapack_logical wantq, lapack_logical wantz, const lapack_logical* select, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* alpha, lapack_complex_double* beta, lapack_complex_double* q, lapack_int ldq, lapack_complex_double* z, lapack_int ldz, lapack_int* m, double* pl, double* pr, double* dif, lapack_complex_double* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_stgsja_work( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int p, lapack_int n, lapack_int k, lapack_int l, float* a, lapack_int lda, float* b, lapack_int ldb, float tola, float tolb, float* alpha, float* beta, float* u, lapack_int ldu, float* v, lapack_int ldv, float* q, lapack_int ldq, float* work, lapack_int* ncycle ); lapack_int LAPACKE_dtgsja_work( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int p, lapack_int n, lapack_int k, lapack_int l, double* a, lapack_int lda, double* b, lapack_int ldb, double tola, double tolb, double* alpha, double* beta, double* u, lapack_int ldu, double* v, lapack_int ldv, double* q, lapack_int ldq, double* work, lapack_int* ncycle ); lapack_int LAPACKE_ctgsja_work( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int p, lapack_int n, lapack_int k, lapack_int l, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, float tola, float tolb, float* alpha, float* beta, lapack_complex_float* u, lapack_int ldu, lapack_complex_float* v, lapack_int ldv, lapack_complex_float* q, lapack_int ldq, lapack_complex_float* work, lapack_int* ncycle ); lapack_int LAPACKE_ztgsja_work( int matrix_order, char jobu, char jobv, char jobq, lapack_int m, lapack_int p, lapack_int n, lapack_int k, lapack_int l, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, double tola, double tolb, double* alpha, double* beta, lapack_complex_double* u, lapack_int ldu, lapack_complex_double* v, lapack_int ldv, lapack_complex_double* q, lapack_int ldq, lapack_complex_double* work, lapack_int* ncycle ); lapack_int LAPACKE_stgsna_work( int matrix_order, char job, char howmny, const lapack_logical* select, lapack_int n, const float* a, lapack_int lda, const float* b, lapack_int ldb, const float* vl, lapack_int ldvl, const float* vr, lapack_int ldvr, float* s, float* dif, lapack_int mm, lapack_int* m, float* work, lapack_int lwork, lapack_int* iwork ); lapack_int LAPACKE_dtgsna_work( int matrix_order, char job, char howmny, const lapack_logical* select, lapack_int n, const double* a, lapack_int lda, const double* b, lapack_int ldb, const double* vl, lapack_int ldvl, const double* vr, lapack_int ldvr, double* s, double* dif, lapack_int mm, lapack_int* m, double* work, lapack_int lwork, lapack_int* iwork ); lapack_int LAPACKE_ctgsna_work( int matrix_order, char job, char howmny, const lapack_logical* select, lapack_int n, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* b, lapack_int ldb, const lapack_complex_float* vl, lapack_int ldvl, const lapack_complex_float* vr, lapack_int ldvr, float* s, float* dif, lapack_int mm, lapack_int* m, lapack_complex_float* work, lapack_int lwork, lapack_int* iwork ); lapack_int LAPACKE_ztgsna_work( int matrix_order, char job, char howmny, const lapack_logical* select, lapack_int n, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* b, lapack_int ldb, const lapack_complex_double* vl, lapack_int ldvl, const lapack_complex_double* vr, lapack_int ldvr, double* s, double* dif, lapack_int mm, lapack_int* m, lapack_complex_double* work, lapack_int lwork, lapack_int* iwork ); lapack_int LAPACKE_stgsyl_work( int matrix_order, char trans, lapack_int ijob, lapack_int m, lapack_int n, const float* a, lapack_int lda, const float* b, lapack_int ldb, float* c, lapack_int ldc, const float* d, lapack_int ldd, const float* e, lapack_int lde, float* f, lapack_int ldf, float* scale, float* dif, float* work, lapack_int lwork, lapack_int* iwork ); lapack_int LAPACKE_dtgsyl_work( int matrix_order, char trans, lapack_int ijob, lapack_int m, lapack_int n, const double* a, lapack_int lda, const double* b, lapack_int ldb, double* c, lapack_int ldc, const double* d, lapack_int ldd, const double* e, lapack_int lde, double* f, lapack_int ldf, double* scale, double* dif, double* work, lapack_int lwork, lapack_int* iwork ); lapack_int LAPACKE_ctgsyl_work( int matrix_order, char trans, lapack_int ijob, lapack_int m, lapack_int n, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* c, lapack_int ldc, const lapack_complex_float* d, lapack_int ldd, const lapack_complex_float* e, lapack_int lde, lapack_complex_float* f, lapack_int ldf, float* scale, float* dif, lapack_complex_float* work, lapack_int lwork, lapack_int* iwork ); lapack_int LAPACKE_ztgsyl_work( int matrix_order, char trans, lapack_int ijob, lapack_int m, lapack_int n, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* c, lapack_int ldc, const lapack_complex_double* d, lapack_int ldd, const lapack_complex_double* e, lapack_int lde, lapack_complex_double* f, lapack_int ldf, double* scale, double* dif, lapack_complex_double* work, lapack_int lwork, lapack_int* iwork ); lapack_int LAPACKE_stpcon_work( int matrix_order, char norm, char uplo, char diag, lapack_int n, const float* ap, float* rcond, float* work, lapack_int* iwork ); lapack_int LAPACKE_dtpcon_work( int matrix_order, char norm, char uplo, char diag, lapack_int n, const double* ap, double* rcond, double* work, lapack_int* iwork ); lapack_int LAPACKE_ctpcon_work( int matrix_order, char norm, char uplo, char diag, lapack_int n, const lapack_complex_float* ap, float* rcond, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_ztpcon_work( int matrix_order, char norm, char uplo, char diag, lapack_int n, const lapack_complex_double* ap, double* rcond, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_stprfs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const float* ap, const float* b, lapack_int ldb, const float* x, lapack_int ldx, float* ferr, float* berr, float* work, lapack_int* iwork ); lapack_int LAPACKE_dtprfs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const double* ap, const double* b, lapack_int ldb, const double* x, lapack_int ldx, double* ferr, double* berr, double* work, lapack_int* iwork ); lapack_int LAPACKE_ctprfs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const lapack_complex_float* ap, const lapack_complex_float* b, lapack_int ldb, const lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_ztprfs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const lapack_complex_double* ap, const lapack_complex_double* b, lapack_int ldb, const lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_stptri_work( int matrix_order, char uplo, char diag, lapack_int n, float* ap ); lapack_int LAPACKE_dtptri_work( int matrix_order, char uplo, char diag, lapack_int n, double* ap ); lapack_int LAPACKE_ctptri_work( int matrix_order, char uplo, char diag, lapack_int n, lapack_complex_float* ap ); lapack_int LAPACKE_ztptri_work( int matrix_order, char uplo, char diag, lapack_int n, lapack_complex_double* ap ); lapack_int LAPACKE_stptrs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const float* ap, float* b, lapack_int ldb ); lapack_int LAPACKE_dtptrs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const double* ap, double* b, lapack_int ldb ); lapack_int LAPACKE_ctptrs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const lapack_complex_float* ap, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_ztptrs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const lapack_complex_double* ap, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_stpttf_work( int matrix_order, char transr, char uplo, lapack_int n, const float* ap, float* arf ); lapack_int LAPACKE_dtpttf_work( int matrix_order, char transr, char uplo, lapack_int n, const double* ap, double* arf ); lapack_int LAPACKE_ctpttf_work( int matrix_order, char transr, char uplo, lapack_int n, const lapack_complex_float* ap, lapack_complex_float* arf ); lapack_int LAPACKE_ztpttf_work( int matrix_order, char transr, char uplo, lapack_int n, const lapack_complex_double* ap, lapack_complex_double* arf ); lapack_int LAPACKE_stpttr_work( int matrix_order, char uplo, lapack_int n, const float* ap, float* a, lapack_int lda ); lapack_int LAPACKE_dtpttr_work( int matrix_order, char uplo, lapack_int n, const double* ap, double* a, lapack_int lda ); lapack_int LAPACKE_ctpttr_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* ap, lapack_complex_float* a, lapack_int lda ); lapack_int LAPACKE_ztpttr_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* ap, lapack_complex_double* a, lapack_int lda ); lapack_int LAPACKE_strcon_work( int matrix_order, char norm, char uplo, char diag, lapack_int n, const float* a, lapack_int lda, float* rcond, float* work, lapack_int* iwork ); lapack_int LAPACKE_dtrcon_work( int matrix_order, char norm, char uplo, char diag, lapack_int n, const double* a, lapack_int lda, double* rcond, double* work, lapack_int* iwork ); lapack_int LAPACKE_ctrcon_work( int matrix_order, char norm, char uplo, char diag, lapack_int n, const lapack_complex_float* a, lapack_int lda, float* rcond, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_ztrcon_work( int matrix_order, char norm, char uplo, char diag, lapack_int n, const lapack_complex_double* a, lapack_int lda, double* rcond, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_strevc_work( int matrix_order, char side, char howmny, lapack_logical* select, lapack_int n, const float* t, lapack_int ldt, float* vl, lapack_int ldvl, float* vr, lapack_int ldvr, lapack_int mm, lapack_int* m, float* work ); lapack_int LAPACKE_dtrevc_work( int matrix_order, char side, char howmny, lapack_logical* select, lapack_int n, const double* t, lapack_int ldt, double* vl, lapack_int ldvl, double* vr, lapack_int ldvr, lapack_int mm, lapack_int* m, double* work ); lapack_int LAPACKE_ctrevc_work( int matrix_order, char side, char howmny, const lapack_logical* select, lapack_int n, lapack_complex_float* t, lapack_int ldt, lapack_complex_float* vl, lapack_int ldvl, lapack_complex_float* vr, lapack_int ldvr, lapack_int mm, lapack_int* m, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_ztrevc_work( int matrix_order, char side, char howmny, const lapack_logical* select, lapack_int n, lapack_complex_double* t, lapack_int ldt, lapack_complex_double* vl, lapack_int ldvl, lapack_complex_double* vr, lapack_int ldvr, lapack_int mm, lapack_int* m, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_strexc_work( int matrix_order, char compq, lapack_int n, float* t, lapack_int ldt, float* q, lapack_int ldq, lapack_int* ifst, lapack_int* ilst, float* work ); lapack_int LAPACKE_dtrexc_work( int matrix_order, char compq, lapack_int n, double* t, lapack_int ldt, double* q, lapack_int ldq, lapack_int* ifst, lapack_int* ilst, double* work ); lapack_int LAPACKE_ctrexc_work( int matrix_order, char compq, lapack_int n, lapack_complex_float* t, lapack_int ldt, lapack_complex_float* q, lapack_int ldq, lapack_int ifst, lapack_int ilst ); lapack_int LAPACKE_ztrexc_work( int matrix_order, char compq, lapack_int n, lapack_complex_double* t, lapack_int ldt, lapack_complex_double* q, lapack_int ldq, lapack_int ifst, lapack_int ilst ); lapack_int LAPACKE_strrfs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, const float* b, lapack_int ldb, const float* x, lapack_int ldx, float* ferr, float* berr, float* work, lapack_int* iwork ); lapack_int LAPACKE_dtrrfs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, const double* b, lapack_int ldb, const double* x, lapack_int ldx, double* ferr, double* berr, double* work, lapack_int* iwork ); lapack_int LAPACKE_ctrrfs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* b, lapack_int ldb, const lapack_complex_float* x, lapack_int ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork ); lapack_int LAPACKE_ztrrfs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* b, lapack_int ldb, const lapack_complex_double* x, lapack_int ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork ); lapack_int LAPACKE_strsen_work( int matrix_order, char job, char compq, const lapack_logical* select, lapack_int n, float* t, lapack_int ldt, float* q, lapack_int ldq, float* wr, float* wi, lapack_int* m, float* s, float* sep, float* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_dtrsen_work( int matrix_order, char job, char compq, const lapack_logical* select, lapack_int n, double* t, lapack_int ldt, double* q, lapack_int ldq, double* wr, double* wi, lapack_int* m, double* s, double* sep, double* work, lapack_int lwork, lapack_int* iwork, lapack_int liwork ); lapack_int LAPACKE_ctrsen_work( int matrix_order, char job, char compq, const lapack_logical* select, lapack_int n, lapack_complex_float* t, lapack_int ldt, lapack_complex_float* q, lapack_int ldq, lapack_complex_float* w, lapack_int* m, float* s, float* sep, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_ztrsen_work( int matrix_order, char job, char compq, const lapack_logical* select, lapack_int n, lapack_complex_double* t, lapack_int ldt, lapack_complex_double* q, lapack_int ldq, lapack_complex_double* w, lapack_int* m, double* s, double* sep, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_strsna_work( int matrix_order, char job, char howmny, const lapack_logical* select, lapack_int n, const float* t, lapack_int ldt, const float* vl, lapack_int ldvl, const float* vr, lapack_int ldvr, float* s, float* sep, lapack_int mm, lapack_int* m, float* work, lapack_int ldwork, lapack_int* iwork ); lapack_int LAPACKE_dtrsna_work( int matrix_order, char job, char howmny, const lapack_logical* select, lapack_int n, const double* t, lapack_int ldt, const double* vl, lapack_int ldvl, const double* vr, lapack_int ldvr, double* s, double* sep, lapack_int mm, lapack_int* m, double* work, lapack_int ldwork, lapack_int* iwork ); lapack_int LAPACKE_ctrsna_work( int matrix_order, char job, char howmny, const lapack_logical* select, lapack_int n, const lapack_complex_float* t, lapack_int ldt, const lapack_complex_float* vl, lapack_int ldvl, const lapack_complex_float* vr, lapack_int ldvr, float* s, float* sep, lapack_int mm, lapack_int* m, lapack_complex_float* work, lapack_int ldwork, float* rwork ); lapack_int LAPACKE_ztrsna_work( int matrix_order, char job, char howmny, const lapack_logical* select, lapack_int n, const lapack_complex_double* t, lapack_int ldt, const lapack_complex_double* vl, lapack_int ldvl, const lapack_complex_double* vr, lapack_int ldvr, double* s, double* sep, lapack_int mm, lapack_int* m, lapack_complex_double* work, lapack_int ldwork, double* rwork ); lapack_int LAPACKE_strsyl_work( int matrix_order, char trana, char tranb, lapack_int isgn, lapack_int m, lapack_int n, const float* a, lapack_int lda, const float* b, lapack_int ldb, float* c, lapack_int ldc, float* scale ); lapack_int LAPACKE_dtrsyl_work( int matrix_order, char trana, char tranb, lapack_int isgn, lapack_int m, lapack_int n, const double* a, lapack_int lda, const double* b, lapack_int ldb, double* c, lapack_int ldc, double* scale ); lapack_int LAPACKE_ctrsyl_work( int matrix_order, char trana, char tranb, lapack_int isgn, lapack_int m, lapack_int n, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* b, lapack_int ldb, lapack_complex_float* c, lapack_int ldc, float* scale ); lapack_int LAPACKE_ztrsyl_work( int matrix_order, char trana, char tranb, lapack_int isgn, lapack_int m, lapack_int n, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* b, lapack_int ldb, lapack_complex_double* c, lapack_int ldc, double* scale ); lapack_int LAPACKE_strtri_work( int matrix_order, char uplo, char diag, lapack_int n, float* a, lapack_int lda ); lapack_int LAPACKE_dtrtri_work( int matrix_order, char uplo, char diag, lapack_int n, double* a, lapack_int lda ); lapack_int LAPACKE_ctrtri_work( int matrix_order, char uplo, char diag, lapack_int n, lapack_complex_float* a, lapack_int lda ); lapack_int LAPACKE_ztrtri_work( int matrix_order, char uplo, char diag, lapack_int n, lapack_complex_double* a, lapack_int lda ); lapack_int LAPACKE_strtrs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, float* b, lapack_int ldb ); lapack_int LAPACKE_dtrtrs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, double* b, lapack_int ldb ); lapack_int LAPACKE_ctrtrs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_ztrtrs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_strttf_work( int matrix_order, char transr, char uplo, lapack_int n, const float* a, lapack_int lda, float* arf ); lapack_int LAPACKE_dtrttf_work( int matrix_order, char transr, char uplo, lapack_int n, const double* a, lapack_int lda, double* arf ); lapack_int LAPACKE_ctrttf_work( int matrix_order, char transr, char uplo, lapack_int n, const lapack_complex_float* a, lapack_int lda, lapack_complex_float* arf ); lapack_int LAPACKE_ztrttf_work( int matrix_order, char transr, char uplo, lapack_int n, const lapack_complex_double* a, lapack_int lda, lapack_complex_double* arf ); lapack_int LAPACKE_strttp_work( int matrix_order, char uplo, lapack_int n, const float* a, lapack_int lda, float* ap ); lapack_int LAPACKE_dtrttp_work( int matrix_order, char uplo, lapack_int n, const double* a, lapack_int lda, double* ap ); lapack_int LAPACKE_ctrttp_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* a, lapack_int lda, lapack_complex_float* ap ); lapack_int LAPACKE_ztrttp_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* a, lapack_int lda, lapack_complex_double* ap ); lapack_int LAPACKE_stzrzf_work( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* tau, float* work, lapack_int lwork ); lapack_int LAPACKE_dtzrzf_work( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* tau, double* work, lapack_int lwork ); lapack_int LAPACKE_ctzrzf_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* tau, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_ztzrzf_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* tau, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_cungbr_work( int matrix_order, char vect, lapack_int m, lapack_int n, lapack_int k, lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zungbr_work( int matrix_order, char vect, lapack_int m, lapack_int n, lapack_int k, lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_cunghr_work( int matrix_order, lapack_int n, lapack_int ilo, lapack_int ihi, lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zunghr_work( int matrix_order, lapack_int n, lapack_int ilo, lapack_int ihi, lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_cunglq_work( int matrix_order, lapack_int m, lapack_int n, lapack_int k, lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zunglq_work( int matrix_order, lapack_int m, lapack_int n, lapack_int k, lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_cungql_work( int matrix_order, lapack_int m, lapack_int n, lapack_int k, lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zungql_work( int matrix_order, lapack_int m, lapack_int n, lapack_int k, lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_cungqr_work( int matrix_order, lapack_int m, lapack_int n, lapack_int k, lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zungqr_work( int matrix_order, lapack_int m, lapack_int n, lapack_int k, lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_cungrq_work( int matrix_order, lapack_int m, lapack_int n, lapack_int k, lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zungrq_work( int matrix_order, lapack_int m, lapack_int n, lapack_int k, lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_cungtr_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zungtr_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_cunmbr_work( int matrix_order, char vect, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int ldc, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zunmbr_work( int matrix_order, char vect, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int ldc, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_cunmhr_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int ilo, lapack_int ihi, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int ldc, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zunmhr_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int ilo, lapack_int ihi, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int ldc, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_cunmlq_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int ldc, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zunmlq_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int ldc, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_cunmql_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int ldc, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zunmql_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int ldc, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_cunmqr_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int ldc, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zunmqr_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int ldc, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_cunmrq_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int ldc, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zunmrq_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int ldc, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_cunmrz_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int l, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int ldc, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zunmrz_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int l, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int ldc, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_cunmtr_work( int matrix_order, char side, char uplo, char trans, lapack_int m, lapack_int n, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int ldc, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_zunmtr_work( int matrix_order, char side, char uplo, char trans, lapack_int m, lapack_int n, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int ldc, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_cupgtr_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_float* ap, const lapack_complex_float* tau, lapack_complex_float* q, lapack_int ldq, lapack_complex_float* work ); lapack_int LAPACKE_zupgtr_work( int matrix_order, char uplo, lapack_int n, const lapack_complex_double* ap, const lapack_complex_double* tau, lapack_complex_double* q, lapack_int ldq, lapack_complex_double* work ); lapack_int LAPACKE_cupmtr_work( int matrix_order, char side, char uplo, char trans, lapack_int m, lapack_int n, const lapack_complex_float* ap, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int ldc, lapack_complex_float* work ); lapack_int LAPACKE_zupmtr_work( int matrix_order, char side, char uplo, char trans, lapack_int m, lapack_int n, const lapack_complex_double* ap, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int ldc, lapack_complex_double* work ); lapack_int LAPACKE_claghe( int matrix_order, lapack_int n, lapack_int k, const float* d, lapack_complex_float* a, lapack_int lda, lapack_int* iseed ); lapack_int LAPACKE_zlaghe( int matrix_order, lapack_int n, lapack_int k, const double* d, lapack_complex_double* a, lapack_int lda, lapack_int* iseed ); lapack_int LAPACKE_slagsy( int matrix_order, lapack_int n, lapack_int k, const float* d, float* a, lapack_int lda, lapack_int* iseed ); lapack_int LAPACKE_dlagsy( int matrix_order, lapack_int n, lapack_int k, const double* d, double* a, lapack_int lda, lapack_int* iseed ); lapack_int LAPACKE_clagsy( int matrix_order, lapack_int n, lapack_int k, const float* d, lapack_complex_float* a, lapack_int lda, lapack_int* iseed ); lapack_int LAPACKE_zlagsy( int matrix_order, lapack_int n, lapack_int k, const double* d, lapack_complex_double* a, lapack_int lda, lapack_int* iseed ); lapack_int LAPACKE_slapmr( int matrix_order, lapack_logical forwrd, lapack_int m, lapack_int n, float* x, lapack_int ldx, lapack_int* k ); lapack_int LAPACKE_dlapmr( int matrix_order, lapack_logical forwrd, lapack_int m, lapack_int n, double* x, lapack_int ldx, lapack_int* k ); lapack_int LAPACKE_clapmr( int matrix_order, lapack_logical forwrd, lapack_int m, lapack_int n, lapack_complex_float* x, lapack_int ldx, lapack_int* k ); lapack_int LAPACKE_zlapmr( int matrix_order, lapack_logical forwrd, lapack_int m, lapack_int n, lapack_complex_double* x, lapack_int ldx, lapack_int* k ); float LAPACKE_slapy2( float x, float y ); double LAPACKE_dlapy2( double x, double y ); float LAPACKE_slapy3( float x, float y, float z ); double LAPACKE_dlapy3( double x, double y, double z ); lapack_int LAPACKE_slartgp( float f, float g, float* cs, float* sn, float* r ); lapack_int LAPACKE_dlartgp( double f, double g, double* cs, double* sn, double* r ); lapack_int LAPACKE_slartgs( float x, float y, float sigma, float* cs, float* sn ); lapack_int LAPACKE_dlartgs( double x, double y, double sigma, double* cs, double* sn ); //LAPACK 3.3.0 lapack_int LAPACKE_cbbcsd( int matrix_order, char jobu1, char jobu2, char jobv1t, char jobv2t, char trans, lapack_int m, lapack_int p, lapack_int q, float* theta, float* phi, lapack_complex_float* u1, lapack_int ldu1, lapack_complex_float* u2, lapack_int ldu2, lapack_complex_float* v1t, lapack_int ldv1t, lapack_complex_float* v2t, lapack_int ldv2t, float* b11d, float* b11e, float* b12d, float* b12e, float* b21d, float* b21e, float* b22d, float* b22e ); lapack_int LAPACKE_cbbcsd_work( int matrix_order, char jobu1, char jobu2, char jobv1t, char jobv2t, char trans, lapack_int m, lapack_int p, lapack_int q, float* theta, float* phi, lapack_complex_float* u1, lapack_int ldu1, lapack_complex_float* u2, lapack_int ldu2, lapack_complex_float* v1t, lapack_int ldv1t, lapack_complex_float* v2t, lapack_int ldv2t, float* b11d, float* b11e, float* b12d, float* b12e, float* b21d, float* b21e, float* b22d, float* b22e, float* rwork, lapack_int lrwork ); lapack_int LAPACKE_cheswapr( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int i1, lapack_int i2 ); lapack_int LAPACKE_cheswapr_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int i1, lapack_int i2 ); lapack_int LAPACKE_chetri2( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv ); lapack_int LAPACKE_chetri2_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_chetri2x( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, lapack_int nb ); lapack_int LAPACKE_chetri2x_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_float* work, lapack_int nb ); lapack_int LAPACKE_chetrs2( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_chetrs2_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* work ); lapack_int LAPACKE_csyconv( int matrix_order, char uplo, char way, lapack_int n, lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv ); lapack_int LAPACKE_csyconv_work( int matrix_order, char uplo, char way, lapack_int n, lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_float* work ); lapack_int LAPACKE_csyswapr( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int i1, lapack_int i2 ); lapack_int LAPACKE_csyswapr_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int i1, lapack_int i2 ); lapack_int LAPACKE_csytri2( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv ); lapack_int LAPACKE_csytri2_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_csytri2x( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, lapack_int nb ); lapack_int LAPACKE_csytri2x_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_float* work, lapack_int nb ); lapack_int LAPACKE_csytrs2( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_csytrs2_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_float* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* work ); lapack_int LAPACKE_cunbdb( int matrix_order, char trans, char signs, lapack_int m, lapack_int p, lapack_int q, lapack_complex_float* x11, lapack_int ldx11, lapack_complex_float* x12, lapack_int ldx12, lapack_complex_float* x21, lapack_int ldx21, lapack_complex_float* x22, lapack_int ldx22, float* theta, float* phi, lapack_complex_float* taup1, lapack_complex_float* taup2, lapack_complex_float* tauq1, lapack_complex_float* tauq2 ); lapack_int LAPACKE_cunbdb_work( int matrix_order, char trans, char signs, lapack_int m, lapack_int p, lapack_int q, lapack_complex_float* x11, lapack_int ldx11, lapack_complex_float* x12, lapack_int ldx12, lapack_complex_float* x21, lapack_int ldx21, lapack_complex_float* x22, lapack_int ldx22, float* theta, float* phi, lapack_complex_float* taup1, lapack_complex_float* taup2, lapack_complex_float* tauq1, lapack_complex_float* tauq2, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_cuncsd( int matrix_order, char jobu1, char jobu2, char jobv1t, char jobv2t, char trans, char signs, lapack_int m, lapack_int p, lapack_int q, lapack_complex_float* x11, lapack_int ldx11, lapack_complex_float* x12, lapack_int ldx12, lapack_complex_float* x21, lapack_int ldx21, lapack_complex_float* x22, lapack_int ldx22, float* theta, lapack_complex_float* u1, lapack_int ldu1, lapack_complex_float* u2, lapack_int ldu2, lapack_complex_float* v1t, lapack_int ldv1t, lapack_complex_float* v2t, lapack_int ldv2t ); lapack_int LAPACKE_cuncsd_work( int matrix_order, char jobu1, char jobu2, char jobv1t, char jobv2t, char trans, char signs, lapack_int m, lapack_int p, lapack_int q, lapack_complex_float* x11, lapack_int ldx11, lapack_complex_float* x12, lapack_int ldx12, lapack_complex_float* x21, lapack_int ldx21, lapack_complex_float* x22, lapack_int ldx22, float* theta, lapack_complex_float* u1, lapack_int ldu1, lapack_complex_float* u2, lapack_int ldu2, lapack_complex_float* v1t, lapack_int ldv1t, lapack_complex_float* v2t, lapack_int ldv2t, lapack_complex_float* work, lapack_int lwork, float* rwork, lapack_int lrwork, lapack_int* iwork ); lapack_int LAPACKE_dbbcsd( int matrix_order, char jobu1, char jobu2, char jobv1t, char jobv2t, char trans, lapack_int m, lapack_int p, lapack_int q, double* theta, double* phi, double* u1, lapack_int ldu1, double* u2, lapack_int ldu2, double* v1t, lapack_int ldv1t, double* v2t, lapack_int ldv2t, double* b11d, double* b11e, double* b12d, double* b12e, double* b21d, double* b21e, double* b22d, double* b22e ); lapack_int LAPACKE_dbbcsd_work( int matrix_order, char jobu1, char jobu2, char jobv1t, char jobv2t, char trans, lapack_int m, lapack_int p, lapack_int q, double* theta, double* phi, double* u1, lapack_int ldu1, double* u2, lapack_int ldu2, double* v1t, lapack_int ldv1t, double* v2t, lapack_int ldv2t, double* b11d, double* b11e, double* b12d, double* b12e, double* b21d, double* b21e, double* b22d, double* b22e, double* work, lapack_int lwork ); lapack_int LAPACKE_dorbdb( int matrix_order, char trans, char signs, lapack_int m, lapack_int p, lapack_int q, double* x11, lapack_int ldx11, double* x12, lapack_int ldx12, double* x21, lapack_int ldx21, double* x22, lapack_int ldx22, double* theta, double* phi, double* taup1, double* taup2, double* tauq1, double* tauq2 ); lapack_int LAPACKE_dorbdb_work( int matrix_order, char trans, char signs, lapack_int m, lapack_int p, lapack_int q, double* x11, lapack_int ldx11, double* x12, lapack_int ldx12, double* x21, lapack_int ldx21, double* x22, lapack_int ldx22, double* theta, double* phi, double* taup1, double* taup2, double* tauq1, double* tauq2, double* work, lapack_int lwork ); lapack_int LAPACKE_dorcsd( int matrix_order, char jobu1, char jobu2, char jobv1t, char jobv2t, char trans, char signs, lapack_int m, lapack_int p, lapack_int q, double* x11, lapack_int ldx11, double* x12, lapack_int ldx12, double* x21, lapack_int ldx21, double* x22, lapack_int ldx22, double* theta, double* u1, lapack_int ldu1, double* u2, lapack_int ldu2, double* v1t, lapack_int ldv1t, double* v2t, lapack_int ldv2t ); lapack_int LAPACKE_dorcsd_work( int matrix_order, char jobu1, char jobu2, char jobv1t, char jobv2t, char trans, char signs, lapack_int m, lapack_int p, lapack_int q, double* x11, lapack_int ldx11, double* x12, lapack_int ldx12, double* x21, lapack_int ldx21, double* x22, lapack_int ldx22, double* theta, double* u1, lapack_int ldu1, double* u2, lapack_int ldu2, double* v1t, lapack_int ldv1t, double* v2t, lapack_int ldv2t, double* work, lapack_int lwork, lapack_int* iwork ); lapack_int LAPACKE_dsyconv( int matrix_order, char uplo, char way, lapack_int n, double* a, lapack_int lda, const lapack_int* ipiv ); lapack_int LAPACKE_dsyconv_work( int matrix_order, char uplo, char way, lapack_int n, double* a, lapack_int lda, const lapack_int* ipiv, double* work ); lapack_int LAPACKE_dsyswapr( int matrix_order, char uplo, lapack_int n, double* a, lapack_int i1, lapack_int i2 ); lapack_int LAPACKE_dsyswapr_work( int matrix_order, char uplo, lapack_int n, double* a, lapack_int i1, lapack_int i2 ); lapack_int LAPACKE_dsytri2( int matrix_order, char uplo, lapack_int n, double* a, lapack_int lda, const lapack_int* ipiv ); lapack_int LAPACKE_dsytri2_work( int matrix_order, char uplo, lapack_int n, double* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_dsytri2x( int matrix_order, char uplo, lapack_int n, double* a, lapack_int lda, const lapack_int* ipiv, lapack_int nb ); lapack_int LAPACKE_dsytri2x_work( int matrix_order, char uplo, lapack_int n, double* a, lapack_int lda, const lapack_int* ipiv, double* work, lapack_int nb ); lapack_int LAPACKE_dsytrs2( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, const lapack_int* ipiv, double* b, lapack_int ldb ); lapack_int LAPACKE_dsytrs2_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const double* a, lapack_int lda, const lapack_int* ipiv, double* b, lapack_int ldb, double* work ); lapack_int LAPACKE_sbbcsd( int matrix_order, char jobu1, char jobu2, char jobv1t, char jobv2t, char trans, lapack_int m, lapack_int p, lapack_int q, float* theta, float* phi, float* u1, lapack_int ldu1, float* u2, lapack_int ldu2, float* v1t, lapack_int ldv1t, float* v2t, lapack_int ldv2t, float* b11d, float* b11e, float* b12d, float* b12e, float* b21d, float* b21e, float* b22d, float* b22e ); lapack_int LAPACKE_sbbcsd_work( int matrix_order, char jobu1, char jobu2, char jobv1t, char jobv2t, char trans, lapack_int m, lapack_int p, lapack_int q, float* theta, float* phi, float* u1, lapack_int ldu1, float* u2, lapack_int ldu2, float* v1t, lapack_int ldv1t, float* v2t, lapack_int ldv2t, float* b11d, float* b11e, float* b12d, float* b12e, float* b21d, float* b21e, float* b22d, float* b22e, float* work, lapack_int lwork ); lapack_int LAPACKE_sorbdb( int matrix_order, char trans, char signs, lapack_int m, lapack_int p, lapack_int q, float* x11, lapack_int ldx11, float* x12, lapack_int ldx12, float* x21, lapack_int ldx21, float* x22, lapack_int ldx22, float* theta, float* phi, float* taup1, float* taup2, float* tauq1, float* tauq2 ); lapack_int LAPACKE_sorbdb_work( int matrix_order, char trans, char signs, lapack_int m, lapack_int p, lapack_int q, float* x11, lapack_int ldx11, float* x12, lapack_int ldx12, float* x21, lapack_int ldx21, float* x22, lapack_int ldx22, float* theta, float* phi, float* taup1, float* taup2, float* tauq1, float* tauq2, float* work, lapack_int lwork ); lapack_int LAPACKE_sorcsd( int matrix_order, char jobu1, char jobu2, char jobv1t, char jobv2t, char trans, char signs, lapack_int m, lapack_int p, lapack_int q, float* x11, lapack_int ldx11, float* x12, lapack_int ldx12, float* x21, lapack_int ldx21, float* x22, lapack_int ldx22, float* theta, float* u1, lapack_int ldu1, float* u2, lapack_int ldu2, float* v1t, lapack_int ldv1t, float* v2t, lapack_int ldv2t ); lapack_int LAPACKE_sorcsd_work( int matrix_order, char jobu1, char jobu2, char jobv1t, char jobv2t, char trans, char signs, lapack_int m, lapack_int p, lapack_int q, float* x11, lapack_int ldx11, float* x12, lapack_int ldx12, float* x21, lapack_int ldx21, float* x22, lapack_int ldx22, float* theta, float* u1, lapack_int ldu1, float* u2, lapack_int ldu2, float* v1t, lapack_int ldv1t, float* v2t, lapack_int ldv2t, float* work, lapack_int lwork, lapack_int* iwork ); lapack_int LAPACKE_ssyconv( int matrix_order, char uplo, char way, lapack_int n, float* a, lapack_int lda, const lapack_int* ipiv ); lapack_int LAPACKE_ssyconv_work( int matrix_order, char uplo, char way, lapack_int n, float* a, lapack_int lda, const lapack_int* ipiv, float* work ); lapack_int LAPACKE_ssyswapr( int matrix_order, char uplo, lapack_int n, float* a, lapack_int i1, lapack_int i2 ); lapack_int LAPACKE_ssyswapr_work( int matrix_order, char uplo, lapack_int n, float* a, lapack_int i1, lapack_int i2 ); lapack_int LAPACKE_ssytri2( int matrix_order, char uplo, lapack_int n, float* a, lapack_int lda, const lapack_int* ipiv ); lapack_int LAPACKE_ssytri2_work( int matrix_order, char uplo, lapack_int n, float* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_float* work, lapack_int lwork ); lapack_int LAPACKE_ssytri2x( int matrix_order, char uplo, lapack_int n, float* a, lapack_int lda, const lapack_int* ipiv, lapack_int nb ); lapack_int LAPACKE_ssytri2x_work( int matrix_order, char uplo, lapack_int n, float* a, lapack_int lda, const lapack_int* ipiv, float* work, lapack_int nb ); lapack_int LAPACKE_ssytrs2( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, const lapack_int* ipiv, float* b, lapack_int ldb ); lapack_int LAPACKE_ssytrs2_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const float* a, lapack_int lda, const lapack_int* ipiv, float* b, lapack_int ldb, float* work ); lapack_int LAPACKE_zbbcsd( int matrix_order, char jobu1, char jobu2, char jobv1t, char jobv2t, char trans, lapack_int m, lapack_int p, lapack_int q, double* theta, double* phi, lapack_complex_double* u1, lapack_int ldu1, lapack_complex_double* u2, lapack_int ldu2, lapack_complex_double* v1t, lapack_int ldv1t, lapack_complex_double* v2t, lapack_int ldv2t, double* b11d, double* b11e, double* b12d, double* b12e, double* b21d, double* b21e, double* b22d, double* b22e ); lapack_int LAPACKE_zbbcsd_work( int matrix_order, char jobu1, char jobu2, char jobv1t, char jobv2t, char trans, lapack_int m, lapack_int p, lapack_int q, double* theta, double* phi, lapack_complex_double* u1, lapack_int ldu1, lapack_complex_double* u2, lapack_int ldu2, lapack_complex_double* v1t, lapack_int ldv1t, lapack_complex_double* v2t, lapack_int ldv2t, double* b11d, double* b11e, double* b12d, double* b12e, double* b21d, double* b21e, double* b22d, double* b22e, double* rwork, lapack_int lrwork ); lapack_int LAPACKE_zheswapr( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int i1, lapack_int i2 ); lapack_int LAPACKE_zheswapr_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int i1, lapack_int i2 ); lapack_int LAPACKE_zhetri2( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv ); lapack_int LAPACKE_zhetri2_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_zhetri2x( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, lapack_int nb ); lapack_int LAPACKE_zhetri2x_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_double* work, lapack_int nb ); lapack_int LAPACKE_zhetrs2( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_zhetrs2_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* work ); lapack_int LAPACKE_zsyconv( int matrix_order, char uplo, char way, lapack_int n, lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv ); lapack_int LAPACKE_zsyconv_work( int matrix_order, char uplo, char way, lapack_int n, lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_double* work ); lapack_int LAPACKE_zsyswapr( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int i1, lapack_int i2 ); lapack_int LAPACKE_zsyswapr_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int i1, lapack_int i2 ); lapack_int LAPACKE_zsytri2( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv ); lapack_int LAPACKE_zsytri2_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_zsytri2x( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, lapack_int nb ); lapack_int LAPACKE_zsytri2x_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_double* work, lapack_int nb ); lapack_int LAPACKE_zsytrs2( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_zsytrs2_work( int matrix_order, char uplo, lapack_int n, lapack_int nrhs, const lapack_complex_double* a, lapack_int lda, const lapack_int* ipiv, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* work ); lapack_int LAPACKE_zunbdb( int matrix_order, char trans, char signs, lapack_int m, lapack_int p, lapack_int q, lapack_complex_double* x11, lapack_int ldx11, lapack_complex_double* x12, lapack_int ldx12, lapack_complex_double* x21, lapack_int ldx21, lapack_complex_double* x22, lapack_int ldx22, double* theta, double* phi, lapack_complex_double* taup1, lapack_complex_double* taup2, lapack_complex_double* tauq1, lapack_complex_double* tauq2 ); lapack_int LAPACKE_zunbdb_work( int matrix_order, char trans, char signs, lapack_int m, lapack_int p, lapack_int q, lapack_complex_double* x11, lapack_int ldx11, lapack_complex_double* x12, lapack_int ldx12, lapack_complex_double* x21, lapack_int ldx21, lapack_complex_double* x22, lapack_int ldx22, double* theta, double* phi, lapack_complex_double* taup1, lapack_complex_double* taup2, lapack_complex_double* tauq1, lapack_complex_double* tauq2, lapack_complex_double* work, lapack_int lwork ); lapack_int LAPACKE_zuncsd( int matrix_order, char jobu1, char jobu2, char jobv1t, char jobv2t, char trans, char signs, lapack_int m, lapack_int p, lapack_int q, lapack_complex_double* x11, lapack_int ldx11, lapack_complex_double* x12, lapack_int ldx12, lapack_complex_double* x21, lapack_int ldx21, lapack_complex_double* x22, lapack_int ldx22, double* theta, lapack_complex_double* u1, lapack_int ldu1, lapack_complex_double* u2, lapack_int ldu2, lapack_complex_double* v1t, lapack_int ldv1t, lapack_complex_double* v2t, lapack_int ldv2t ); lapack_int LAPACKE_zuncsd_work( int matrix_order, char jobu1, char jobu2, char jobv1t, char jobv2t, char trans, char signs, lapack_int m, lapack_int p, lapack_int q, lapack_complex_double* x11, lapack_int ldx11, lapack_complex_double* x12, lapack_int ldx12, lapack_complex_double* x21, lapack_int ldx21, lapack_complex_double* x22, lapack_int ldx22, double* theta, lapack_complex_double* u1, lapack_int ldu1, lapack_complex_double* u2, lapack_int ldu2, lapack_complex_double* v1t, lapack_int ldv1t, lapack_complex_double* v2t, lapack_int ldv2t, lapack_complex_double* work, lapack_int lwork, double* rwork, lapack_int lrwork, lapack_int* iwork ); //LAPACK 3.4.0 lapack_int LAPACKE_sgemqrt( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int nb, const float* v, lapack_int ldv, const float* t, lapack_int ldt, float* c, lapack_int ldc ); lapack_int LAPACKE_dgemqrt( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int nb, const double* v, lapack_int ldv, const double* t, lapack_int ldt, double* c, lapack_int ldc ); lapack_int LAPACKE_cgemqrt( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int nb, const lapack_complex_float* v, lapack_int ldv, const lapack_complex_float* t, lapack_int ldt, lapack_complex_float* c, lapack_int ldc ); lapack_int LAPACKE_zgemqrt( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int nb, const lapack_complex_double* v, lapack_int ldv, const lapack_complex_double* t, lapack_int ldt, lapack_complex_double* c, lapack_int ldc ); lapack_int LAPACKE_sgeqrt( int matrix_order, lapack_int m, lapack_int n, lapack_int nb, float* a, lapack_int lda, float* t, lapack_int ldt ); lapack_int LAPACKE_dgeqrt( int matrix_order, lapack_int m, lapack_int n, lapack_int nb, double* a, lapack_int lda, double* t, lapack_int ldt ); lapack_int LAPACKE_cgeqrt( int matrix_order, lapack_int m, lapack_int n, lapack_int nb, lapack_complex_float* a, lapack_int lda, lapack_complex_float* t, lapack_int ldt ); lapack_int LAPACKE_zgeqrt( int matrix_order, lapack_int m, lapack_int n, lapack_int nb, lapack_complex_double* a, lapack_int lda, lapack_complex_double* t, lapack_int ldt ); lapack_int LAPACKE_sgeqrt2( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* t, lapack_int ldt ); lapack_int LAPACKE_dgeqrt2( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* t, lapack_int ldt ); lapack_int LAPACKE_cgeqrt2( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* t, lapack_int ldt ); lapack_int LAPACKE_zgeqrt2( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* t, lapack_int ldt ); lapack_int LAPACKE_sgeqrt3( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* t, lapack_int ldt ); lapack_int LAPACKE_dgeqrt3( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* t, lapack_int ldt ); lapack_int LAPACKE_cgeqrt3( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* t, lapack_int ldt ); lapack_int LAPACKE_zgeqrt3( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* t, lapack_int ldt ); lapack_int LAPACKE_stpmqrt( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int l, lapack_int nb, const float* v, lapack_int ldv, const float* t, lapack_int ldt, float* a, lapack_int lda, float* b, lapack_int ldb ); lapack_int LAPACKE_dtpmqrt( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int l, lapack_int nb, const double* v, lapack_int ldv, const double* t, lapack_int ldt, double* a, lapack_int lda, double* b, lapack_int ldb ); lapack_int LAPACKE_ctpmqrt( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int l, lapack_int nb, const lapack_complex_float* v, lapack_int ldv, const lapack_complex_float* t, lapack_int ldt, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb ); lapack_int LAPACKE_ztpmqrt( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int l, lapack_int nb, const lapack_complex_double* v, lapack_int ldv, const lapack_complex_double* t, lapack_int ldt, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb ); lapack_int LAPACKE_dtpqrt( int matrix_order, lapack_int m, lapack_int n, lapack_int l, lapack_int nb, double* a, lapack_int lda, double* b, lapack_int ldb, double* t, lapack_int ldt ); lapack_int LAPACKE_ctpqrt( int matrix_order, lapack_int m, lapack_int n, lapack_int l, lapack_int nb, lapack_complex_float* a, lapack_int lda, lapack_complex_float* t, lapack_complex_float* b, lapack_int ldb, lapack_int ldt ); lapack_int LAPACKE_ztpqrt( int matrix_order, lapack_int m, lapack_int n, lapack_int l, lapack_int nb, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* t, lapack_int ldt ); lapack_int LAPACKE_stpqrt2( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, float* t, lapack_int ldt ); lapack_int LAPACKE_dtpqrt2( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, double* t, lapack_int ldt ); lapack_int LAPACKE_ctpqrt2( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* t, lapack_int ldt ); lapack_int LAPACKE_ztpqrt2( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* t, lapack_int ldt ); lapack_int LAPACKE_stprfb( int matrix_order, char side, char trans, char direct, char storev, lapack_int m, lapack_int n, lapack_int k, lapack_int l, const float* v, lapack_int ldv, const float* t, lapack_int ldt, float* a, lapack_int lda, float* b, lapack_int ldb, lapack_int myldwork ); lapack_int LAPACKE_dtprfb( int matrix_order, char side, char trans, char direct, char storev, lapack_int m, lapack_int n, lapack_int k, lapack_int l, const double* v, lapack_int ldv, const double* t, lapack_int ldt, double* a, lapack_int lda, double* b, lapack_int ldb, lapack_int myldwork ); lapack_int LAPACKE_ctprfb( int matrix_order, char side, char trans, char direct, char storev, lapack_int m, lapack_int n, lapack_int k, lapack_int l, const lapack_complex_float* v, lapack_int ldv, const lapack_complex_float* t, lapack_int ldt, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_int myldwork ); lapack_int LAPACKE_ztprfb( int matrix_order, char side, char trans, char direct, char storev, lapack_int m, lapack_int n, lapack_int k, lapack_int l, const lapack_complex_double* v, lapack_int ldv, const lapack_complex_double* t, lapack_int ldt, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_int myldwork ); lapack_int LAPACKE_sgemqrt_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int nb, const float* v, lapack_int ldv, const float* t, lapack_int ldt, float* c, lapack_int ldc, float* work ); lapack_int LAPACKE_dgemqrt_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int nb, const double* v, lapack_int ldv, const double* t, lapack_int ldt, double* c, lapack_int ldc, double* work ); lapack_int LAPACKE_cgemqrt_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int nb, const lapack_complex_float* v, lapack_int ldv, const lapack_complex_float* t, lapack_int ldt, lapack_complex_float* c, lapack_int ldc, lapack_complex_float* work ); lapack_int LAPACKE_zgemqrt_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int nb, const lapack_complex_double* v, lapack_int ldv, const lapack_complex_double* t, lapack_int ldt, lapack_complex_double* c, lapack_int ldc, lapack_complex_double* work ); lapack_int LAPACKE_sgeqrt_work( int matrix_order, lapack_int m, lapack_int n, lapack_int nb, float* a, lapack_int lda, float* t, lapack_int ldt, float* work ); lapack_int LAPACKE_dgeqrt_work( int matrix_order, lapack_int m, lapack_int n, lapack_int nb, double* a, lapack_int lda, double* t, lapack_int ldt, double* work ); lapack_int LAPACKE_cgeqrt_work( int matrix_order, lapack_int m, lapack_int n, lapack_int nb, lapack_complex_float* a, lapack_int lda, lapack_complex_float* t, lapack_int ldt, lapack_complex_float* work ); lapack_int LAPACKE_zgeqrt_work( int matrix_order, lapack_int m, lapack_int n, lapack_int nb, lapack_complex_double* a, lapack_int lda, lapack_complex_double* t, lapack_int ldt, lapack_complex_double* work ); lapack_int LAPACKE_sgeqrt2_work( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* t, lapack_int ldt ); lapack_int LAPACKE_dgeqrt2_work( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* t, lapack_int ldt ); lapack_int LAPACKE_cgeqrt2_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* t, lapack_int ldt ); lapack_int LAPACKE_zgeqrt2_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* t, lapack_int ldt ); lapack_int LAPACKE_sgeqrt3_work( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* t, lapack_int ldt ); lapack_int LAPACKE_dgeqrt3_work( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* t, lapack_int ldt ); lapack_int LAPACKE_cgeqrt3_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* t, lapack_int ldt ); lapack_int LAPACKE_zgeqrt3_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* t, lapack_int ldt ); lapack_int LAPACKE_stpmqrt_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int l, lapack_int nb, const float* v, lapack_int ldv, const float* t, lapack_int ldt, float* a, lapack_int lda, float* b, lapack_int ldb, float* work ); lapack_int LAPACKE_dtpmqrt_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int l, lapack_int nb, const double* v, lapack_int ldv, const double* t, lapack_int ldt, double* a, lapack_int lda, double* b, lapack_int ldb, double* work ); lapack_int LAPACKE_ctpmqrt_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int l, lapack_int nb, const lapack_complex_float* v, lapack_int ldv, const lapack_complex_float* t, lapack_int ldt, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* work ); lapack_int LAPACKE_ztpmqrt_work( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, lapack_int l, lapack_int nb, const lapack_complex_double* v, lapack_int ldv, const lapack_complex_double* t, lapack_int ldt, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* work ); lapack_int LAPACKE_dtpqrt_work( int matrix_order, lapack_int m, lapack_int n, lapack_int l, lapack_int nb, double* a, lapack_int lda, double* b, lapack_int ldb, double* t, lapack_int ldt, double* work ); lapack_int LAPACKE_ctpqrt_work( int matrix_order, lapack_int m, lapack_int n, lapack_int l, lapack_int nb, lapack_complex_float* a, lapack_int lda, lapack_complex_float* t, lapack_complex_float* b, lapack_int ldb, lapack_int ldt, lapack_complex_float* work ); lapack_int LAPACKE_ztpqrt_work( int matrix_order, lapack_int m, lapack_int n, lapack_int l, lapack_int nb, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* t, lapack_int ldt, lapack_complex_double* work ); lapack_int LAPACKE_stpqrt2_work( int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, float* t, lapack_int ldt ); lapack_int LAPACKE_dtpqrt2_work( int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, double* t, lapack_int ldt ); lapack_int LAPACKE_ctpqrt2_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* t, lapack_int ldt ); lapack_int LAPACKE_ztpqrt2_work( int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* t, lapack_int ldt ); lapack_int LAPACKE_stprfb_work( int matrix_order, char side, char trans, char direct, char storev, lapack_int m, lapack_int n, lapack_int k, lapack_int l, const float* v, lapack_int ldv, const float* t, lapack_int ldt, float* a, lapack_int lda, float* b, lapack_int ldb, const float* mywork, lapack_int myldwork ); lapack_int LAPACKE_dtprfb_work( int matrix_order, char side, char trans, char direct, char storev, lapack_int m, lapack_int n, lapack_int k, lapack_int l, const double* v, lapack_int ldv, const double* t, lapack_int ldt, double* a, lapack_int lda, double* b, lapack_int ldb, const double* mywork, lapack_int myldwork ); lapack_int LAPACKE_ctprfb_work( int matrix_order, char side, char trans, char direct, char storev, lapack_int m, lapack_int n, lapack_int k, lapack_int l, const lapack_complex_float* v, lapack_int ldv, const lapack_complex_float* t, lapack_int ldt, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, const float* mywork, lapack_int myldwork ); lapack_int LAPACKE_ztprfb_work( int matrix_order, char side, char trans, char direct, char storev, lapack_int m, lapack_int n, lapack_int k, lapack_int l, const lapack_complex_double* v, lapack_int ldv, const lapack_complex_double* t, lapack_int ldt, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, const double* mywork, lapack_int myldwork ); //LAPACK 3.X.X lapack_int LAPACKE_csyr( int matrix_order, char uplo, lapack_int n, lapack_complex_float alpha, const lapack_complex_float* x, lapack_int incx, lapack_complex_float* a, lapack_int lda ); lapack_int LAPACKE_zsyr( int matrix_order, char uplo, lapack_int n, lapack_complex_double alpha, const lapack_complex_double* x, lapack_int incx, lapack_complex_double* a, lapack_int lda ); lapack_int LAPACKE_csyr_work( int matrix_order, char uplo, lapack_int n, lapack_complex_float alpha, const lapack_complex_float* x, lapack_int incx, lapack_complex_float* a, lapack_int lda ); lapack_int LAPACKE_zsyr_work( int matrix_order, char uplo, lapack_int n, lapack_complex_double alpha, const lapack_complex_double* x, lapack_int incx, lapack_complex_double* a, lapack_int lda ); #define LAPACK_sgetrf LAPACK_GLOBAL(sgetrf,SGETRF) #define LAPACK_dgetrf LAPACK_GLOBAL(dgetrf,DGETRF) #define LAPACK_cgetrf LAPACK_GLOBAL(cgetrf,CGETRF) #define LAPACK_zgetrf LAPACK_GLOBAL(zgetrf,ZGETRF) #define LAPACK_sgbtrf LAPACK_GLOBAL(sgbtrf,SGBTRF) #define LAPACK_dgbtrf LAPACK_GLOBAL(dgbtrf,DGBTRF) #define LAPACK_cgbtrf LAPACK_GLOBAL(cgbtrf,CGBTRF) #define LAPACK_zgbtrf LAPACK_GLOBAL(zgbtrf,ZGBTRF) #define LAPACK_sgttrf LAPACK_GLOBAL(sgttrf,SGTTRF) #define LAPACK_dgttrf LAPACK_GLOBAL(dgttrf,DGTTRF) #define LAPACK_cgttrf LAPACK_GLOBAL(cgttrf,CGTTRF) #define LAPACK_zgttrf LAPACK_GLOBAL(zgttrf,ZGTTRF) #define LAPACK_spotrf LAPACK_GLOBAL(spotrf,SPOTRF) #define LAPACK_dpotrf LAPACK_GLOBAL(dpotrf,DPOTRF) #define LAPACK_cpotrf LAPACK_GLOBAL(cpotrf,CPOTRF) #define LAPACK_zpotrf LAPACK_GLOBAL(zpotrf,ZPOTRF) #define LAPACK_dpstrf LAPACK_GLOBAL(dpstrf,DPSTRF) #define LAPACK_spstrf LAPACK_GLOBAL(spstrf,SPSTRF) #define LAPACK_zpstrf LAPACK_GLOBAL(zpstrf,ZPSTRF) #define LAPACK_cpstrf LAPACK_GLOBAL(cpstrf,CPSTRF) #define LAPACK_dpftrf LAPACK_GLOBAL(dpftrf,DPFTRF) #define LAPACK_spftrf LAPACK_GLOBAL(spftrf,SPFTRF) #define LAPACK_zpftrf LAPACK_GLOBAL(zpftrf,ZPFTRF) #define LAPACK_cpftrf LAPACK_GLOBAL(cpftrf,CPFTRF) #define LAPACK_spptrf LAPACK_GLOBAL(spptrf,SPPTRF) #define LAPACK_dpptrf LAPACK_GLOBAL(dpptrf,DPPTRF) #define LAPACK_cpptrf LAPACK_GLOBAL(cpptrf,CPPTRF) #define LAPACK_zpptrf LAPACK_GLOBAL(zpptrf,ZPPTRF) #define LAPACK_spbtrf LAPACK_GLOBAL(spbtrf,SPBTRF) #define LAPACK_dpbtrf LAPACK_GLOBAL(dpbtrf,DPBTRF) #define LAPACK_cpbtrf LAPACK_GLOBAL(cpbtrf,CPBTRF) #define LAPACK_zpbtrf LAPACK_GLOBAL(zpbtrf,ZPBTRF) #define LAPACK_spttrf LAPACK_GLOBAL(spttrf,SPTTRF) #define LAPACK_dpttrf LAPACK_GLOBAL(dpttrf,DPTTRF) #define LAPACK_cpttrf LAPACK_GLOBAL(cpttrf,CPTTRF) #define LAPACK_zpttrf LAPACK_GLOBAL(zpttrf,ZPTTRF) #define LAPACK_ssytrf LAPACK_GLOBAL(ssytrf,SSYTRF) #define LAPACK_dsytrf LAPACK_GLOBAL(dsytrf,DSYTRF) #define LAPACK_csytrf LAPACK_GLOBAL(csytrf,CSYTRF) #define LAPACK_zsytrf LAPACK_GLOBAL(zsytrf,ZSYTRF) #define LAPACK_chetrf LAPACK_GLOBAL(chetrf,CHETRF) #define LAPACK_zhetrf LAPACK_GLOBAL(zhetrf,ZHETRF) #define LAPACK_ssptrf LAPACK_GLOBAL(ssptrf,SSPTRF) #define LAPACK_dsptrf LAPACK_GLOBAL(dsptrf,DSPTRF) #define LAPACK_csptrf LAPACK_GLOBAL(csptrf,CSPTRF) #define LAPACK_zsptrf LAPACK_GLOBAL(zsptrf,ZSPTRF) #define LAPACK_chptrf LAPACK_GLOBAL(chptrf,CHPTRF) #define LAPACK_zhptrf LAPACK_GLOBAL(zhptrf,ZHPTRF) #define LAPACK_sgetrs LAPACK_GLOBAL(sgetrs,SGETRS) #define LAPACK_dgetrs LAPACK_GLOBAL(dgetrs,DGETRS) #define LAPACK_cgetrs LAPACK_GLOBAL(cgetrs,CGETRS) #define LAPACK_zgetrs LAPACK_GLOBAL(zgetrs,ZGETRS) #define LAPACK_sgbtrs LAPACK_GLOBAL(sgbtrs,SGBTRS) #define LAPACK_dgbtrs LAPACK_GLOBAL(dgbtrs,DGBTRS) #define LAPACK_cgbtrs LAPACK_GLOBAL(cgbtrs,CGBTRS) #define LAPACK_zgbtrs LAPACK_GLOBAL(zgbtrs,ZGBTRS) #define LAPACK_sgttrs LAPACK_GLOBAL(sgttrs,SGTTRS) #define LAPACK_dgttrs LAPACK_GLOBAL(dgttrs,DGTTRS) #define LAPACK_cgttrs LAPACK_GLOBAL(cgttrs,CGTTRS) #define LAPACK_zgttrs LAPACK_GLOBAL(zgttrs,ZGTTRS) #define LAPACK_spotrs LAPACK_GLOBAL(spotrs,SPOTRS) #define LAPACK_dpotrs LAPACK_GLOBAL(dpotrs,DPOTRS) #define LAPACK_cpotrs LAPACK_GLOBAL(cpotrs,CPOTRS) #define LAPACK_zpotrs LAPACK_GLOBAL(zpotrs,ZPOTRS) #define LAPACK_dpftrs LAPACK_GLOBAL(dpftrs,DPFTRS) #define LAPACK_spftrs LAPACK_GLOBAL(spftrs,SPFTRS) #define LAPACK_zpftrs LAPACK_GLOBAL(zpftrs,ZPFTRS) #define LAPACK_cpftrs LAPACK_GLOBAL(cpftrs,CPFTRS) #define LAPACK_spptrs LAPACK_GLOBAL(spptrs,SPPTRS) #define LAPACK_dpptrs LAPACK_GLOBAL(dpptrs,DPPTRS) #define LAPACK_cpptrs LAPACK_GLOBAL(cpptrs,CPPTRS) #define LAPACK_zpptrs LAPACK_GLOBAL(zpptrs,ZPPTRS) #define LAPACK_spbtrs LAPACK_GLOBAL(spbtrs,SPBTRS) #define LAPACK_dpbtrs LAPACK_GLOBAL(dpbtrs,DPBTRS) #define LAPACK_cpbtrs LAPACK_GLOBAL(cpbtrs,CPBTRS) #define LAPACK_zpbtrs LAPACK_GLOBAL(zpbtrs,ZPBTRS) #define LAPACK_spttrs LAPACK_GLOBAL(spttrs,SPTTRS) #define LAPACK_dpttrs LAPACK_GLOBAL(dpttrs,DPTTRS) #define LAPACK_cpttrs LAPACK_GLOBAL(cpttrs,CPTTRS) #define LAPACK_zpttrs LAPACK_GLOBAL(zpttrs,ZPTTRS) #define LAPACK_ssytrs LAPACK_GLOBAL(ssytrs,SSYTRS) #define LAPACK_dsytrs LAPACK_GLOBAL(dsytrs,DSYTRS) #define LAPACK_csytrs LAPACK_GLOBAL(csytrs,CSYTRS) #define LAPACK_zsytrs LAPACK_GLOBAL(zsytrs,ZSYTRS) #define LAPACK_chetrs LAPACK_GLOBAL(chetrs,CHETRS) #define LAPACK_zhetrs LAPACK_GLOBAL(zhetrs,ZHETRS) #define LAPACK_ssptrs LAPACK_GLOBAL(ssptrs,SSPTRS) #define LAPACK_dsptrs LAPACK_GLOBAL(dsptrs,DSPTRS) #define LAPACK_csptrs LAPACK_GLOBAL(csptrs,CSPTRS) #define LAPACK_zsptrs LAPACK_GLOBAL(zsptrs,ZSPTRS) #define LAPACK_chptrs LAPACK_GLOBAL(chptrs,CHPTRS) #define LAPACK_zhptrs LAPACK_GLOBAL(zhptrs,ZHPTRS) #define LAPACK_strtrs LAPACK_GLOBAL(strtrs,STRTRS) #define LAPACK_dtrtrs LAPACK_GLOBAL(dtrtrs,DTRTRS) #define LAPACK_ctrtrs LAPACK_GLOBAL(ctrtrs,CTRTRS) #define LAPACK_ztrtrs LAPACK_GLOBAL(ztrtrs,ZTRTRS) #define LAPACK_stptrs LAPACK_GLOBAL(stptrs,STPTRS) #define LAPACK_dtptrs LAPACK_GLOBAL(dtptrs,DTPTRS) #define LAPACK_ctptrs LAPACK_GLOBAL(ctptrs,CTPTRS) #define LAPACK_ztptrs LAPACK_GLOBAL(ztptrs,ZTPTRS) #define LAPACK_stbtrs LAPACK_GLOBAL(stbtrs,STBTRS) #define LAPACK_dtbtrs LAPACK_GLOBAL(dtbtrs,DTBTRS) #define LAPACK_ctbtrs LAPACK_GLOBAL(ctbtrs,CTBTRS) #define LAPACK_ztbtrs LAPACK_GLOBAL(ztbtrs,ZTBTRS) #define LAPACK_sgecon LAPACK_GLOBAL(sgecon,SGECON) #define LAPACK_dgecon LAPACK_GLOBAL(dgecon,DGECON) #define LAPACK_cgecon LAPACK_GLOBAL(cgecon,CGECON) #define LAPACK_zgecon LAPACK_GLOBAL(zgecon,ZGECON) #define LAPACK_sgbcon LAPACK_GLOBAL(sgbcon,SGBCON) #define LAPACK_dgbcon LAPACK_GLOBAL(dgbcon,DGBCON) #define LAPACK_cgbcon LAPACK_GLOBAL(cgbcon,CGBCON) #define LAPACK_zgbcon LAPACK_GLOBAL(zgbcon,ZGBCON) #define LAPACK_sgtcon LAPACK_GLOBAL(sgtcon,SGTCON) #define LAPACK_dgtcon LAPACK_GLOBAL(dgtcon,DGTCON) #define LAPACK_cgtcon LAPACK_GLOBAL(cgtcon,CGTCON) #define LAPACK_zgtcon LAPACK_GLOBAL(zgtcon,ZGTCON) #define LAPACK_spocon LAPACK_GLOBAL(spocon,SPOCON) #define LAPACK_dpocon LAPACK_GLOBAL(dpocon,DPOCON) #define LAPACK_cpocon LAPACK_GLOBAL(cpocon,CPOCON) #define LAPACK_zpocon LAPACK_GLOBAL(zpocon,ZPOCON) #define LAPACK_sppcon LAPACK_GLOBAL(sppcon,SPPCON) #define LAPACK_dppcon LAPACK_GLOBAL(dppcon,DPPCON) #define LAPACK_cppcon LAPACK_GLOBAL(cppcon,CPPCON) #define LAPACK_zppcon LAPACK_GLOBAL(zppcon,ZPPCON) #define LAPACK_spbcon LAPACK_GLOBAL(spbcon,SPBCON) #define LAPACK_dpbcon LAPACK_GLOBAL(dpbcon,DPBCON) #define LAPACK_cpbcon LAPACK_GLOBAL(cpbcon,CPBCON) #define LAPACK_zpbcon LAPACK_GLOBAL(zpbcon,ZPBCON) #define LAPACK_sptcon LAPACK_GLOBAL(sptcon,SPTCON) #define LAPACK_dptcon LAPACK_GLOBAL(dptcon,DPTCON) #define LAPACK_cptcon LAPACK_GLOBAL(cptcon,CPTCON) #define LAPACK_zptcon LAPACK_GLOBAL(zptcon,ZPTCON) #define LAPACK_ssycon LAPACK_GLOBAL(ssycon,SSYCON) #define LAPACK_dsycon LAPACK_GLOBAL(dsycon,DSYCON) #define LAPACK_csycon LAPACK_GLOBAL(csycon,CSYCON) #define LAPACK_zsycon LAPACK_GLOBAL(zsycon,ZSYCON) #define LAPACK_checon LAPACK_GLOBAL(checon,CHECON) #define LAPACK_zhecon LAPACK_GLOBAL(zhecon,ZHECON) #define LAPACK_sspcon LAPACK_GLOBAL(sspcon,SSPCON) #define LAPACK_dspcon LAPACK_GLOBAL(dspcon,DSPCON) #define LAPACK_cspcon LAPACK_GLOBAL(cspcon,CSPCON) #define LAPACK_zspcon LAPACK_GLOBAL(zspcon,ZSPCON) #define LAPACK_chpcon LAPACK_GLOBAL(chpcon,CHPCON) #define LAPACK_zhpcon LAPACK_GLOBAL(zhpcon,ZHPCON) #define LAPACK_strcon LAPACK_GLOBAL(strcon,STRCON) #define LAPACK_dtrcon LAPACK_GLOBAL(dtrcon,DTRCON) #define LAPACK_ctrcon LAPACK_GLOBAL(ctrcon,CTRCON) #define LAPACK_ztrcon LAPACK_GLOBAL(ztrcon,ZTRCON) #define LAPACK_stpcon LAPACK_GLOBAL(stpcon,STPCON) #define LAPACK_dtpcon LAPACK_GLOBAL(dtpcon,DTPCON) #define LAPACK_ctpcon LAPACK_GLOBAL(ctpcon,CTPCON) #define LAPACK_ztpcon LAPACK_GLOBAL(ztpcon,ZTPCON) #define LAPACK_stbcon LAPACK_GLOBAL(stbcon,STBCON) #define LAPACK_dtbcon LAPACK_GLOBAL(dtbcon,DTBCON) #define LAPACK_ctbcon LAPACK_GLOBAL(ctbcon,CTBCON) #define LAPACK_ztbcon LAPACK_GLOBAL(ztbcon,ZTBCON) #define LAPACK_sgerfs LAPACK_GLOBAL(sgerfs,SGERFS) #define LAPACK_dgerfs LAPACK_GLOBAL(dgerfs,DGERFS) #define LAPACK_cgerfs LAPACK_GLOBAL(cgerfs,CGERFS) #define LAPACK_zgerfs LAPACK_GLOBAL(zgerfs,ZGERFS) #define LAPACK_dgerfsx LAPACK_GLOBAL(dgerfsx,DGERFSX) #define LAPACK_sgerfsx LAPACK_GLOBAL(sgerfsx,SGERFSX) #define LAPACK_zgerfsx LAPACK_GLOBAL(zgerfsx,ZGERFSX) #define LAPACK_cgerfsx LAPACK_GLOBAL(cgerfsx,CGERFSX) #define LAPACK_sgbrfs LAPACK_GLOBAL(sgbrfs,SGBRFS) #define LAPACK_dgbrfs LAPACK_GLOBAL(dgbrfs,DGBRFS) #define LAPACK_cgbrfs LAPACK_GLOBAL(cgbrfs,CGBRFS) #define LAPACK_zgbrfs LAPACK_GLOBAL(zgbrfs,ZGBRFS) #define LAPACK_dgbrfsx LAPACK_GLOBAL(dgbrfsx,DGBRFSX) #define LAPACK_sgbrfsx LAPACK_GLOBAL(sgbrfsx,SGBRFSX) #define LAPACK_zgbrfsx LAPACK_GLOBAL(zgbrfsx,ZGBRFSX) #define LAPACK_cgbrfsx LAPACK_GLOBAL(cgbrfsx,CGBRFSX) #define LAPACK_sgtrfs LAPACK_GLOBAL(sgtrfs,SGTRFS) #define LAPACK_dgtrfs LAPACK_GLOBAL(dgtrfs,DGTRFS) #define LAPACK_cgtrfs LAPACK_GLOBAL(cgtrfs,CGTRFS) #define LAPACK_zgtrfs LAPACK_GLOBAL(zgtrfs,ZGTRFS) #define LAPACK_sporfs LAPACK_GLOBAL(sporfs,SPORFS) #define LAPACK_dporfs LAPACK_GLOBAL(dporfs,DPORFS) #define LAPACK_cporfs LAPACK_GLOBAL(cporfs,CPORFS) #define LAPACK_zporfs LAPACK_GLOBAL(zporfs,ZPORFS) #define LAPACK_dporfsx LAPACK_GLOBAL(dporfsx,DPORFSX) #define LAPACK_sporfsx LAPACK_GLOBAL(sporfsx,SPORFSX) #define LAPACK_zporfsx LAPACK_GLOBAL(zporfsx,ZPORFSX) #define LAPACK_cporfsx LAPACK_GLOBAL(cporfsx,CPORFSX) #define LAPACK_spprfs LAPACK_GLOBAL(spprfs,SPPRFS) #define LAPACK_dpprfs LAPACK_GLOBAL(dpprfs,DPPRFS) #define LAPACK_cpprfs LAPACK_GLOBAL(cpprfs,CPPRFS) #define LAPACK_zpprfs LAPACK_GLOBAL(zpprfs,ZPPRFS) #define LAPACK_spbrfs LAPACK_GLOBAL(spbrfs,SPBRFS) #define LAPACK_dpbrfs LAPACK_GLOBAL(dpbrfs,DPBRFS) #define LAPACK_cpbrfs LAPACK_GLOBAL(cpbrfs,CPBRFS) #define LAPACK_zpbrfs LAPACK_GLOBAL(zpbrfs,ZPBRFS) #define LAPACK_sptrfs LAPACK_GLOBAL(sptrfs,SPTRFS) #define LAPACK_dptrfs LAPACK_GLOBAL(dptrfs,DPTRFS) #define LAPACK_cptrfs LAPACK_GLOBAL(cptrfs,CPTRFS) #define LAPACK_zptrfs LAPACK_GLOBAL(zptrfs,ZPTRFS) #define LAPACK_ssyrfs LAPACK_GLOBAL(ssyrfs,SSYRFS) #define LAPACK_dsyrfs LAPACK_GLOBAL(dsyrfs,DSYRFS) #define LAPACK_csyrfs LAPACK_GLOBAL(csyrfs,CSYRFS) #define LAPACK_zsyrfs LAPACK_GLOBAL(zsyrfs,ZSYRFS) #define LAPACK_dsyrfsx LAPACK_GLOBAL(dsyrfsx,DSYRFSX) #define LAPACK_ssyrfsx LAPACK_GLOBAL(ssyrfsx,SSYRFSX) #define LAPACK_zsyrfsx LAPACK_GLOBAL(zsyrfsx,ZSYRFSX) #define LAPACK_csyrfsx LAPACK_GLOBAL(csyrfsx,CSYRFSX) #define LAPACK_cherfs LAPACK_GLOBAL(cherfs,CHERFS) #define LAPACK_zherfs LAPACK_GLOBAL(zherfs,ZHERFS) #define LAPACK_zherfsx LAPACK_GLOBAL(zherfsx,ZHERFSX) #define LAPACK_cherfsx LAPACK_GLOBAL(cherfsx,CHERFSX) #define LAPACK_ssprfs LAPACK_GLOBAL(ssprfs,SSPRFS) #define LAPACK_dsprfs LAPACK_GLOBAL(dsprfs,DSPRFS) #define LAPACK_csprfs LAPACK_GLOBAL(csprfs,CSPRFS) #define LAPACK_zsprfs LAPACK_GLOBAL(zsprfs,ZSPRFS) #define LAPACK_chprfs LAPACK_GLOBAL(chprfs,CHPRFS) #define LAPACK_zhprfs LAPACK_GLOBAL(zhprfs,ZHPRFS) #define LAPACK_strrfs LAPACK_GLOBAL(strrfs,STRRFS) #define LAPACK_dtrrfs LAPACK_GLOBAL(dtrrfs,DTRRFS) #define LAPACK_ctrrfs LAPACK_GLOBAL(ctrrfs,CTRRFS) #define LAPACK_ztrrfs LAPACK_GLOBAL(ztrrfs,ZTRRFS) #define LAPACK_stprfs LAPACK_GLOBAL(stprfs,STPRFS) #define LAPACK_dtprfs LAPACK_GLOBAL(dtprfs,DTPRFS) #define LAPACK_ctprfs LAPACK_GLOBAL(ctprfs,CTPRFS) #define LAPACK_ztprfs LAPACK_GLOBAL(ztprfs,ZTPRFS) #define LAPACK_stbrfs LAPACK_GLOBAL(stbrfs,STBRFS) #define LAPACK_dtbrfs LAPACK_GLOBAL(dtbrfs,DTBRFS) #define LAPACK_ctbrfs LAPACK_GLOBAL(ctbrfs,CTBRFS) #define LAPACK_ztbrfs LAPACK_GLOBAL(ztbrfs,ZTBRFS) #define LAPACK_sgetri LAPACK_GLOBAL(sgetri,SGETRI) #define LAPACK_dgetri LAPACK_GLOBAL(dgetri,DGETRI) #define LAPACK_cgetri LAPACK_GLOBAL(cgetri,CGETRI) #define LAPACK_zgetri LAPACK_GLOBAL(zgetri,ZGETRI) #define LAPACK_spotri LAPACK_GLOBAL(spotri,SPOTRI) #define LAPACK_dpotri LAPACK_GLOBAL(dpotri,DPOTRI) #define LAPACK_cpotri LAPACK_GLOBAL(cpotri,CPOTRI) #define LAPACK_zpotri LAPACK_GLOBAL(zpotri,ZPOTRI) #define LAPACK_dpftri LAPACK_GLOBAL(dpftri,DPFTRI) #define LAPACK_spftri LAPACK_GLOBAL(spftri,SPFTRI) #define LAPACK_zpftri LAPACK_GLOBAL(zpftri,ZPFTRI) #define LAPACK_cpftri LAPACK_GLOBAL(cpftri,CPFTRI) #define LAPACK_spptri LAPACK_GLOBAL(spptri,SPPTRI) #define LAPACK_dpptri LAPACK_GLOBAL(dpptri,DPPTRI) #define LAPACK_cpptri LAPACK_GLOBAL(cpptri,CPPTRI) #define LAPACK_zpptri LAPACK_GLOBAL(zpptri,ZPPTRI) #define LAPACK_ssytri LAPACK_GLOBAL(ssytri,SSYTRI) #define LAPACK_dsytri LAPACK_GLOBAL(dsytri,DSYTRI) #define LAPACK_csytri LAPACK_GLOBAL(csytri,CSYTRI) #define LAPACK_zsytri LAPACK_GLOBAL(zsytri,ZSYTRI) #define LAPACK_chetri LAPACK_GLOBAL(chetri,CHETRI) #define LAPACK_zhetri LAPACK_GLOBAL(zhetri,ZHETRI) #define LAPACK_ssptri LAPACK_GLOBAL(ssptri,SSPTRI) #define LAPACK_dsptri LAPACK_GLOBAL(dsptri,DSPTRI) #define LAPACK_csptri LAPACK_GLOBAL(csptri,CSPTRI) #define LAPACK_zsptri LAPACK_GLOBAL(zsptri,ZSPTRI) #define LAPACK_chptri LAPACK_GLOBAL(chptri,CHPTRI) #define LAPACK_zhptri LAPACK_GLOBAL(zhptri,ZHPTRI) #define LAPACK_strtri LAPACK_GLOBAL(strtri,STRTRI) #define LAPACK_dtrtri LAPACK_GLOBAL(dtrtri,DTRTRI) #define LAPACK_ctrtri LAPACK_GLOBAL(ctrtri,CTRTRI) #define LAPACK_ztrtri LAPACK_GLOBAL(ztrtri,ZTRTRI) #define LAPACK_dtftri LAPACK_GLOBAL(dtftri,DTFTRI) #define LAPACK_stftri LAPACK_GLOBAL(stftri,STFTRI) #define LAPACK_ztftri LAPACK_GLOBAL(ztftri,ZTFTRI) #define LAPACK_ctftri LAPACK_GLOBAL(ctftri,CTFTRI) #define LAPACK_stptri LAPACK_GLOBAL(stptri,STPTRI) #define LAPACK_dtptri LAPACK_GLOBAL(dtptri,DTPTRI) #define LAPACK_ctptri LAPACK_GLOBAL(ctptri,CTPTRI) #define LAPACK_ztptri LAPACK_GLOBAL(ztptri,ZTPTRI) #define LAPACK_sgeequ LAPACK_GLOBAL(sgeequ,SGEEQU) #define LAPACK_dgeequ LAPACK_GLOBAL(dgeequ,DGEEQU) #define LAPACK_cgeequ LAPACK_GLOBAL(cgeequ,CGEEQU) #define LAPACK_zgeequ LAPACK_GLOBAL(zgeequ,ZGEEQU) #define LAPACK_dgeequb LAPACK_GLOBAL(dgeequb,DGEEQUB) #define LAPACK_sgeequb LAPACK_GLOBAL(sgeequb,SGEEQUB) #define LAPACK_zgeequb LAPACK_GLOBAL(zgeequb,ZGEEQUB) #define LAPACK_cgeequb LAPACK_GLOBAL(cgeequb,CGEEQUB) #define LAPACK_sgbequ LAPACK_GLOBAL(sgbequ,SGBEQU) #define LAPACK_dgbequ LAPACK_GLOBAL(dgbequ,DGBEQU) #define LAPACK_cgbequ LAPACK_GLOBAL(cgbequ,CGBEQU) #define LAPACK_zgbequ LAPACK_GLOBAL(zgbequ,ZGBEQU) #define LAPACK_dgbequb LAPACK_GLOBAL(dgbequb,DGBEQUB) #define LAPACK_sgbequb LAPACK_GLOBAL(sgbequb,SGBEQUB) #define LAPACK_zgbequb LAPACK_GLOBAL(zgbequb,ZGBEQUB) #define LAPACK_cgbequb LAPACK_GLOBAL(cgbequb,CGBEQUB) #define LAPACK_spoequ LAPACK_GLOBAL(spoequ,SPOEQU) #define LAPACK_dpoequ LAPACK_GLOBAL(dpoequ,DPOEQU) #define LAPACK_cpoequ LAPACK_GLOBAL(cpoequ,CPOEQU) #define LAPACK_zpoequ LAPACK_GLOBAL(zpoequ,ZPOEQU) #define LAPACK_dpoequb LAPACK_GLOBAL(dpoequb,DPOEQUB) #define LAPACK_spoequb LAPACK_GLOBAL(spoequb,SPOEQUB) #define LAPACK_zpoequb LAPACK_GLOBAL(zpoequb,ZPOEQUB) #define LAPACK_cpoequb LAPACK_GLOBAL(cpoequb,CPOEQUB) #define LAPACK_sppequ LAPACK_GLOBAL(sppequ,SPPEQU) #define LAPACK_dppequ LAPACK_GLOBAL(dppequ,DPPEQU) #define LAPACK_cppequ LAPACK_GLOBAL(cppequ,CPPEQU) #define LAPACK_zppequ LAPACK_GLOBAL(zppequ,ZPPEQU) #define LAPACK_spbequ LAPACK_GLOBAL(spbequ,SPBEQU) #define LAPACK_dpbequ LAPACK_GLOBAL(dpbequ,DPBEQU) #define LAPACK_cpbequ LAPACK_GLOBAL(cpbequ,CPBEQU) #define LAPACK_zpbequ LAPACK_GLOBAL(zpbequ,ZPBEQU) #define LAPACK_dsyequb LAPACK_GLOBAL(dsyequb,DSYEQUB) #define LAPACK_ssyequb LAPACK_GLOBAL(ssyequb,SSYEQUB) #define LAPACK_zsyequb LAPACK_GLOBAL(zsyequb,ZSYEQUB) #define LAPACK_csyequb LAPACK_GLOBAL(csyequb,CSYEQUB) #define LAPACK_zheequb LAPACK_GLOBAL(zheequb,ZHEEQUB) #define LAPACK_cheequb LAPACK_GLOBAL(cheequb,CHEEQUB) #define LAPACK_sgesv LAPACK_GLOBAL(sgesv,SGESV) #define LAPACK_dgesv LAPACK_GLOBAL(dgesv,DGESV) #define LAPACK_cgesv LAPACK_GLOBAL(cgesv,CGESV) #define LAPACK_zgesv LAPACK_GLOBAL(zgesv,ZGESV) #define LAPACK_dsgesv LAPACK_GLOBAL(dsgesv,DSGESV) #define LAPACK_zcgesv LAPACK_GLOBAL(zcgesv,ZCGESV) #define LAPACK_sgesvx LAPACK_GLOBAL(sgesvx,SGESVX) #define LAPACK_dgesvx LAPACK_GLOBAL(dgesvx,DGESVX) #define LAPACK_cgesvx LAPACK_GLOBAL(cgesvx,CGESVX) #define LAPACK_zgesvx LAPACK_GLOBAL(zgesvx,ZGESVX) #define LAPACK_dgesvxx LAPACK_GLOBAL(dgesvxx,DGESVXX) #define LAPACK_sgesvxx LAPACK_GLOBAL(sgesvxx,SGESVXX) #define LAPACK_zgesvxx LAPACK_GLOBAL(zgesvxx,ZGESVXX) #define LAPACK_cgesvxx LAPACK_GLOBAL(cgesvxx,CGESVXX) #define LAPACK_sgbsv LAPACK_GLOBAL(sgbsv,SGBSV) #define LAPACK_dgbsv LAPACK_GLOBAL(dgbsv,DGBSV) #define LAPACK_cgbsv LAPACK_GLOBAL(cgbsv,CGBSV) #define LAPACK_zgbsv LAPACK_GLOBAL(zgbsv,ZGBSV) #define LAPACK_sgbsvx LAPACK_GLOBAL(sgbsvx,SGBSVX) #define LAPACK_dgbsvx LAPACK_GLOBAL(dgbsvx,DGBSVX) #define LAPACK_cgbsvx LAPACK_GLOBAL(cgbsvx,CGBSVX) #define LAPACK_zgbsvx LAPACK_GLOBAL(zgbsvx,ZGBSVX) #define LAPACK_dgbsvxx LAPACK_GLOBAL(dgbsvxx,DGBSVXX) #define LAPACK_sgbsvxx LAPACK_GLOBAL(sgbsvxx,SGBSVXX) #define LAPACK_zgbsvxx LAPACK_GLOBAL(zgbsvxx,ZGBSVXX) #define LAPACK_cgbsvxx LAPACK_GLOBAL(cgbsvxx,CGBSVXX) #define LAPACK_sgtsv LAPACK_GLOBAL(sgtsv,SGTSV) #define LAPACK_dgtsv LAPACK_GLOBAL(dgtsv,DGTSV) #define LAPACK_cgtsv LAPACK_GLOBAL(cgtsv,CGTSV) #define LAPACK_zgtsv LAPACK_GLOBAL(zgtsv,ZGTSV) #define LAPACK_sgtsvx LAPACK_GLOBAL(sgtsvx,SGTSVX) #define LAPACK_dgtsvx LAPACK_GLOBAL(dgtsvx,DGTSVX) #define LAPACK_cgtsvx LAPACK_GLOBAL(cgtsvx,CGTSVX) #define LAPACK_zgtsvx LAPACK_GLOBAL(zgtsvx,ZGTSVX) #define LAPACK_sposv LAPACK_GLOBAL(sposv,SPOSV) #define LAPACK_dposv LAPACK_GLOBAL(dposv,DPOSV) #define LAPACK_cposv LAPACK_GLOBAL(cposv,CPOSV) #define LAPACK_zposv LAPACK_GLOBAL(zposv,ZPOSV) #define LAPACK_dsposv LAPACK_GLOBAL(dsposv,DSPOSV) #define LAPACK_zcposv LAPACK_GLOBAL(zcposv,ZCPOSV) #define LAPACK_sposvx LAPACK_GLOBAL(sposvx,SPOSVX) #define LAPACK_dposvx LAPACK_GLOBAL(dposvx,DPOSVX) #define LAPACK_cposvx LAPACK_GLOBAL(cposvx,CPOSVX) #define LAPACK_zposvx LAPACK_GLOBAL(zposvx,ZPOSVX) #define LAPACK_dposvxx LAPACK_GLOBAL(dposvxx,DPOSVXX) #define LAPACK_sposvxx LAPACK_GLOBAL(sposvxx,SPOSVXX) #define LAPACK_zposvxx LAPACK_GLOBAL(zposvxx,ZPOSVXX) #define LAPACK_cposvxx LAPACK_GLOBAL(cposvxx,CPOSVXX) #define LAPACK_sppsv LAPACK_GLOBAL(sppsv,SPPSV) #define LAPACK_dppsv LAPACK_GLOBAL(dppsv,DPPSV) #define LAPACK_cppsv LAPACK_GLOBAL(cppsv,CPPSV) #define LAPACK_zppsv LAPACK_GLOBAL(zppsv,ZPPSV) #define LAPACK_sppsvx LAPACK_GLOBAL(sppsvx,SPPSVX) #define LAPACK_dppsvx LAPACK_GLOBAL(dppsvx,DPPSVX) #define LAPACK_cppsvx LAPACK_GLOBAL(cppsvx,CPPSVX) #define LAPACK_zppsvx LAPACK_GLOBAL(zppsvx,ZPPSVX) #define LAPACK_spbsv LAPACK_GLOBAL(spbsv,SPBSV) #define LAPACK_dpbsv LAPACK_GLOBAL(dpbsv,DPBSV) #define LAPACK_cpbsv LAPACK_GLOBAL(cpbsv,CPBSV) #define LAPACK_zpbsv LAPACK_GLOBAL(zpbsv,ZPBSV) #define LAPACK_spbsvx LAPACK_GLOBAL(spbsvx,SPBSVX) #define LAPACK_dpbsvx LAPACK_GLOBAL(dpbsvx,DPBSVX) #define LAPACK_cpbsvx LAPACK_GLOBAL(cpbsvx,CPBSVX) #define LAPACK_zpbsvx LAPACK_GLOBAL(zpbsvx,ZPBSVX) #define LAPACK_sptsv LAPACK_GLOBAL(sptsv,SPTSV) #define LAPACK_dptsv LAPACK_GLOBAL(dptsv,DPTSV) #define LAPACK_cptsv LAPACK_GLOBAL(cptsv,CPTSV) #define LAPACK_zptsv LAPACK_GLOBAL(zptsv,ZPTSV) #define LAPACK_sptsvx LAPACK_GLOBAL(sptsvx,SPTSVX) #define LAPACK_dptsvx LAPACK_GLOBAL(dptsvx,DPTSVX) #define LAPACK_cptsvx LAPACK_GLOBAL(cptsvx,CPTSVX) #define LAPACK_zptsvx LAPACK_GLOBAL(zptsvx,ZPTSVX) #define LAPACK_ssysv LAPACK_GLOBAL(ssysv,SSYSV) #define LAPACK_dsysv LAPACK_GLOBAL(dsysv,DSYSV) #define LAPACK_csysv LAPACK_GLOBAL(csysv,CSYSV) #define LAPACK_zsysv LAPACK_GLOBAL(zsysv,ZSYSV) #define LAPACK_ssysvx LAPACK_GLOBAL(ssysvx,SSYSVX) #define LAPACK_dsysvx LAPACK_GLOBAL(dsysvx,DSYSVX) #define LAPACK_csysvx LAPACK_GLOBAL(csysvx,CSYSVX) #define LAPACK_zsysvx LAPACK_GLOBAL(zsysvx,ZSYSVX) #define LAPACK_dsysvxx LAPACK_GLOBAL(dsysvxx,DSYSVXX) #define LAPACK_ssysvxx LAPACK_GLOBAL(ssysvxx,SSYSVXX) #define LAPACK_zsysvxx LAPACK_GLOBAL(zsysvxx,ZSYSVXX) #define LAPACK_csysvxx LAPACK_GLOBAL(csysvxx,CSYSVXX) #define LAPACK_chesv LAPACK_GLOBAL(chesv,CHESV) #define LAPACK_zhesv LAPACK_GLOBAL(zhesv,ZHESV) #define LAPACK_chesvx LAPACK_GLOBAL(chesvx,CHESVX) #define LAPACK_zhesvx LAPACK_GLOBAL(zhesvx,ZHESVX) #define LAPACK_zhesvxx LAPACK_GLOBAL(zhesvxx,ZHESVXX) #define LAPACK_chesvxx LAPACK_GLOBAL(chesvxx,CHESVXX) #define LAPACK_sspsv LAPACK_GLOBAL(sspsv,SSPSV) #define LAPACK_dspsv LAPACK_GLOBAL(dspsv,DSPSV) #define LAPACK_cspsv LAPACK_GLOBAL(cspsv,CSPSV) #define LAPACK_zspsv LAPACK_GLOBAL(zspsv,ZSPSV) #define LAPACK_sspsvx LAPACK_GLOBAL(sspsvx,SSPSVX) #define LAPACK_dspsvx LAPACK_GLOBAL(dspsvx,DSPSVX) #define LAPACK_cspsvx LAPACK_GLOBAL(cspsvx,CSPSVX) #define LAPACK_zspsvx LAPACK_GLOBAL(zspsvx,ZSPSVX) #define LAPACK_chpsv LAPACK_GLOBAL(chpsv,CHPSV) #define LAPACK_zhpsv LAPACK_GLOBAL(zhpsv,ZHPSV) #define LAPACK_chpsvx LAPACK_GLOBAL(chpsvx,CHPSVX) #define LAPACK_zhpsvx LAPACK_GLOBAL(zhpsvx,ZHPSVX) #define LAPACK_sgeqrf LAPACK_GLOBAL(sgeqrf,SGEQRF) #define LAPACK_dgeqrf LAPACK_GLOBAL(dgeqrf,DGEQRF) #define LAPACK_cgeqrf LAPACK_GLOBAL(cgeqrf,CGEQRF) #define LAPACK_zgeqrf LAPACK_GLOBAL(zgeqrf,ZGEQRF) #define LAPACK_sgeqpf LAPACK_GLOBAL(sgeqpf,SGEQPF) #define LAPACK_dgeqpf LAPACK_GLOBAL(dgeqpf,DGEQPF) #define LAPACK_cgeqpf LAPACK_GLOBAL(cgeqpf,CGEQPF) #define LAPACK_zgeqpf LAPACK_GLOBAL(zgeqpf,ZGEQPF) #define LAPACK_sgeqp3 LAPACK_GLOBAL(sgeqp3,SGEQP3) #define LAPACK_dgeqp3 LAPACK_GLOBAL(dgeqp3,DGEQP3) #define LAPACK_cgeqp3 LAPACK_GLOBAL(cgeqp3,CGEQP3) #define LAPACK_zgeqp3 LAPACK_GLOBAL(zgeqp3,ZGEQP3) #define LAPACK_sorgqr LAPACK_GLOBAL(sorgqr,SORGQR) #define LAPACK_dorgqr LAPACK_GLOBAL(dorgqr,DORGQR) #define LAPACK_sormqr LAPACK_GLOBAL(sormqr,SORMQR) #define LAPACK_dormqr LAPACK_GLOBAL(dormqr,DORMQR) #define LAPACK_cungqr LAPACK_GLOBAL(cungqr,CUNGQR) #define LAPACK_zungqr LAPACK_GLOBAL(zungqr,ZUNGQR) #define LAPACK_cunmqr LAPACK_GLOBAL(cunmqr,CUNMQR) #define LAPACK_zunmqr LAPACK_GLOBAL(zunmqr,ZUNMQR) #define LAPACK_sgelqf LAPACK_GLOBAL(sgelqf,SGELQF) #define LAPACK_dgelqf LAPACK_GLOBAL(dgelqf,DGELQF) #define LAPACK_cgelqf LAPACK_GLOBAL(cgelqf,CGELQF) #define LAPACK_zgelqf LAPACK_GLOBAL(zgelqf,ZGELQF) #define LAPACK_sorglq LAPACK_GLOBAL(sorglq,SORGLQ) #define LAPACK_dorglq LAPACK_GLOBAL(dorglq,DORGLQ) #define LAPACK_sormlq LAPACK_GLOBAL(sormlq,SORMLQ) #define LAPACK_dormlq LAPACK_GLOBAL(dormlq,DORMLQ) #define LAPACK_cunglq LAPACK_GLOBAL(cunglq,CUNGLQ) #define LAPACK_zunglq LAPACK_GLOBAL(zunglq,ZUNGLQ) #define LAPACK_cunmlq LAPACK_GLOBAL(cunmlq,CUNMLQ) #define LAPACK_zunmlq LAPACK_GLOBAL(zunmlq,ZUNMLQ) #define LAPACK_sgeqlf LAPACK_GLOBAL(sgeqlf,SGEQLF) #define LAPACK_dgeqlf LAPACK_GLOBAL(dgeqlf,DGEQLF) #define LAPACK_cgeqlf LAPACK_GLOBAL(cgeqlf,CGEQLF) #define LAPACK_zgeqlf LAPACK_GLOBAL(zgeqlf,ZGEQLF) #define LAPACK_sorgql LAPACK_GLOBAL(sorgql,SORGQL) #define LAPACK_dorgql LAPACK_GLOBAL(dorgql,DORGQL) #define LAPACK_cungql LAPACK_GLOBAL(cungql,CUNGQL) #define LAPACK_zungql LAPACK_GLOBAL(zungql,ZUNGQL) #define LAPACK_sormql LAPACK_GLOBAL(sormql,SORMQL) #define LAPACK_dormql LAPACK_GLOBAL(dormql,DORMQL) #define LAPACK_cunmql LAPACK_GLOBAL(cunmql,CUNMQL) #define LAPACK_zunmql LAPACK_GLOBAL(zunmql,ZUNMQL) #define LAPACK_sgerqf LAPACK_GLOBAL(sgerqf,SGERQF) #define LAPACK_dgerqf LAPACK_GLOBAL(dgerqf,DGERQF) #define LAPACK_cgerqf LAPACK_GLOBAL(cgerqf,CGERQF) #define LAPACK_zgerqf LAPACK_GLOBAL(zgerqf,ZGERQF) #define LAPACK_sorgrq LAPACK_GLOBAL(sorgrq,SORGRQ) #define LAPACK_dorgrq LAPACK_GLOBAL(dorgrq,DORGRQ) #define LAPACK_cungrq LAPACK_GLOBAL(cungrq,CUNGRQ) #define LAPACK_zungrq LAPACK_GLOBAL(zungrq,ZUNGRQ) #define LAPACK_sormrq LAPACK_GLOBAL(sormrq,SORMRQ) #define LAPACK_dormrq LAPACK_GLOBAL(dormrq,DORMRQ) #define LAPACK_cunmrq LAPACK_GLOBAL(cunmrq,CUNMRQ) #define LAPACK_zunmrq LAPACK_GLOBAL(zunmrq,ZUNMRQ) #define LAPACK_stzrzf LAPACK_GLOBAL(stzrzf,STZRZF) #define LAPACK_dtzrzf LAPACK_GLOBAL(dtzrzf,DTZRZF) #define LAPACK_ctzrzf LAPACK_GLOBAL(ctzrzf,CTZRZF) #define LAPACK_ztzrzf LAPACK_GLOBAL(ztzrzf,ZTZRZF) #define LAPACK_sormrz LAPACK_GLOBAL(sormrz,SORMRZ) #define LAPACK_dormrz LAPACK_GLOBAL(dormrz,DORMRZ) #define LAPACK_cunmrz LAPACK_GLOBAL(cunmrz,CUNMRZ) #define LAPACK_zunmrz LAPACK_GLOBAL(zunmrz,ZUNMRZ) #define LAPACK_sggqrf LAPACK_GLOBAL(sggqrf,SGGQRF) #define LAPACK_dggqrf LAPACK_GLOBAL(dggqrf,DGGQRF) #define LAPACK_cggqrf LAPACK_GLOBAL(cggqrf,CGGQRF) #define LAPACK_zggqrf LAPACK_GLOBAL(zggqrf,ZGGQRF) #define LAPACK_sggrqf LAPACK_GLOBAL(sggrqf,SGGRQF) #define LAPACK_dggrqf LAPACK_GLOBAL(dggrqf,DGGRQF) #define LAPACK_cggrqf LAPACK_GLOBAL(cggrqf,CGGRQF) #define LAPACK_zggrqf LAPACK_GLOBAL(zggrqf,ZGGRQF) #define LAPACK_sgebrd LAPACK_GLOBAL(sgebrd,SGEBRD) #define LAPACK_dgebrd LAPACK_GLOBAL(dgebrd,DGEBRD) #define LAPACK_cgebrd LAPACK_GLOBAL(cgebrd,CGEBRD) #define LAPACK_zgebrd LAPACK_GLOBAL(zgebrd,ZGEBRD) #define LAPACK_sgbbrd LAPACK_GLOBAL(sgbbrd,SGBBRD) #define LAPACK_dgbbrd LAPACK_GLOBAL(dgbbrd,DGBBRD) #define LAPACK_cgbbrd LAPACK_GLOBAL(cgbbrd,CGBBRD) #define LAPACK_zgbbrd LAPACK_GLOBAL(zgbbrd,ZGBBRD) #define LAPACK_sorgbr LAPACK_GLOBAL(sorgbr,SORGBR) #define LAPACK_dorgbr LAPACK_GLOBAL(dorgbr,DORGBR) #define LAPACK_sormbr LAPACK_GLOBAL(sormbr,SORMBR) #define LAPACK_dormbr LAPACK_GLOBAL(dormbr,DORMBR) #define LAPACK_cungbr LAPACK_GLOBAL(cungbr,CUNGBR) #define LAPACK_zungbr LAPACK_GLOBAL(zungbr,ZUNGBR) #define LAPACK_cunmbr LAPACK_GLOBAL(cunmbr,CUNMBR) #define LAPACK_zunmbr LAPACK_GLOBAL(zunmbr,ZUNMBR) #define LAPACK_sbdsqr LAPACK_GLOBAL(sbdsqr,SBDSQR) #define LAPACK_dbdsqr LAPACK_GLOBAL(dbdsqr,DBDSQR) #define LAPACK_cbdsqr LAPACK_GLOBAL(cbdsqr,CBDSQR) #define LAPACK_zbdsqr LAPACK_GLOBAL(zbdsqr,ZBDSQR) #define LAPACK_sbdsdc LAPACK_GLOBAL(sbdsdc,SBDSDC) #define LAPACK_dbdsdc LAPACK_GLOBAL(dbdsdc,DBDSDC) #define LAPACK_ssytrd LAPACK_GLOBAL(ssytrd,SSYTRD) #define LAPACK_dsytrd LAPACK_GLOBAL(dsytrd,DSYTRD) #define LAPACK_sorgtr LAPACK_GLOBAL(sorgtr,SORGTR) #define LAPACK_dorgtr LAPACK_GLOBAL(dorgtr,DORGTR) #define LAPACK_sormtr LAPACK_GLOBAL(sormtr,SORMTR) #define LAPACK_dormtr LAPACK_GLOBAL(dormtr,DORMTR) #define LAPACK_chetrd LAPACK_GLOBAL(chetrd,CHETRD) #define LAPACK_zhetrd LAPACK_GLOBAL(zhetrd,ZHETRD) #define LAPACK_cungtr LAPACK_GLOBAL(cungtr,CUNGTR) #define LAPACK_zungtr LAPACK_GLOBAL(zungtr,ZUNGTR) #define LAPACK_cunmtr LAPACK_GLOBAL(cunmtr,CUNMTR) #define LAPACK_zunmtr LAPACK_GLOBAL(zunmtr,ZUNMTR) #define LAPACK_ssptrd LAPACK_GLOBAL(ssptrd,SSPTRD) #define LAPACK_dsptrd LAPACK_GLOBAL(dsptrd,DSPTRD) #define LAPACK_sopgtr LAPACK_GLOBAL(sopgtr,SOPGTR) #define LAPACK_dopgtr LAPACK_GLOBAL(dopgtr,DOPGTR) #define LAPACK_sopmtr LAPACK_GLOBAL(sopmtr,SOPMTR) #define LAPACK_dopmtr LAPACK_GLOBAL(dopmtr,DOPMTR) #define LAPACK_chptrd LAPACK_GLOBAL(chptrd,CHPTRD) #define LAPACK_zhptrd LAPACK_GLOBAL(zhptrd,ZHPTRD) #define LAPACK_cupgtr LAPACK_GLOBAL(cupgtr,CUPGTR) #define LAPACK_zupgtr LAPACK_GLOBAL(zupgtr,ZUPGTR) #define LAPACK_cupmtr LAPACK_GLOBAL(cupmtr,CUPMTR) #define LAPACK_zupmtr LAPACK_GLOBAL(zupmtr,ZUPMTR) #define LAPACK_ssbtrd LAPACK_GLOBAL(ssbtrd,SSBTRD) #define LAPACK_dsbtrd LAPACK_GLOBAL(dsbtrd,DSBTRD) #define LAPACK_chbtrd LAPACK_GLOBAL(chbtrd,CHBTRD) #define LAPACK_zhbtrd LAPACK_GLOBAL(zhbtrd,ZHBTRD) #define LAPACK_ssterf LAPACK_GLOBAL(ssterf,SSTERF) #define LAPACK_dsterf LAPACK_GLOBAL(dsterf,DSTERF) #define LAPACK_ssteqr LAPACK_GLOBAL(ssteqr,SSTEQR) #define LAPACK_dsteqr LAPACK_GLOBAL(dsteqr,DSTEQR) #define LAPACK_csteqr LAPACK_GLOBAL(csteqr,CSTEQR) #define LAPACK_zsteqr LAPACK_GLOBAL(zsteqr,ZSTEQR) #define LAPACK_sstemr LAPACK_GLOBAL(sstemr,SSTEMR) #define LAPACK_dstemr LAPACK_GLOBAL(dstemr,DSTEMR) #define LAPACK_cstemr LAPACK_GLOBAL(cstemr,CSTEMR) #define LAPACK_zstemr LAPACK_GLOBAL(zstemr,ZSTEMR) #define LAPACK_sstedc LAPACK_GLOBAL(sstedc,SSTEDC) #define LAPACK_dstedc LAPACK_GLOBAL(dstedc,DSTEDC) #define LAPACK_cstedc LAPACK_GLOBAL(cstedc,CSTEDC) #define LAPACK_zstedc LAPACK_GLOBAL(zstedc,ZSTEDC) #define LAPACK_sstegr LAPACK_GLOBAL(sstegr,SSTEGR) #define LAPACK_dstegr LAPACK_GLOBAL(dstegr,DSTEGR) #define LAPACK_cstegr LAPACK_GLOBAL(cstegr,CSTEGR) #define LAPACK_zstegr LAPACK_GLOBAL(zstegr,ZSTEGR) #define LAPACK_spteqr LAPACK_GLOBAL(spteqr,SPTEQR) #define LAPACK_dpteqr LAPACK_GLOBAL(dpteqr,DPTEQR) #define LAPACK_cpteqr LAPACK_GLOBAL(cpteqr,CPTEQR) #define LAPACK_zpteqr LAPACK_GLOBAL(zpteqr,ZPTEQR) #define LAPACK_sstebz LAPACK_GLOBAL(sstebz,SSTEBZ) #define LAPACK_dstebz LAPACK_GLOBAL(dstebz,DSTEBZ) #define LAPACK_sstein LAPACK_GLOBAL(sstein,SSTEIN) #define LAPACK_dstein LAPACK_GLOBAL(dstein,DSTEIN) #define LAPACK_cstein LAPACK_GLOBAL(cstein,CSTEIN) #define LAPACK_zstein LAPACK_GLOBAL(zstein,ZSTEIN) #define LAPACK_sdisna LAPACK_GLOBAL(sdisna,SDISNA) #define LAPACK_ddisna LAPACK_GLOBAL(ddisna,DDISNA) #define LAPACK_ssygst LAPACK_GLOBAL(ssygst,SSYGST) #define LAPACK_dsygst LAPACK_GLOBAL(dsygst,DSYGST) #define LAPACK_chegst LAPACK_GLOBAL(chegst,CHEGST) #define LAPACK_zhegst LAPACK_GLOBAL(zhegst,ZHEGST) #define LAPACK_sspgst LAPACK_GLOBAL(sspgst,SSPGST) #define LAPACK_dspgst LAPACK_GLOBAL(dspgst,DSPGST) #define LAPACK_chpgst LAPACK_GLOBAL(chpgst,CHPGST) #define LAPACK_zhpgst LAPACK_GLOBAL(zhpgst,ZHPGST) #define LAPACK_ssbgst LAPACK_GLOBAL(ssbgst,SSBGST) #define LAPACK_dsbgst LAPACK_GLOBAL(dsbgst,DSBGST) #define LAPACK_chbgst LAPACK_GLOBAL(chbgst,CHBGST) #define LAPACK_zhbgst LAPACK_GLOBAL(zhbgst,ZHBGST) #define LAPACK_spbstf LAPACK_GLOBAL(spbstf,SPBSTF) #define LAPACK_dpbstf LAPACK_GLOBAL(dpbstf,DPBSTF) #define LAPACK_cpbstf LAPACK_GLOBAL(cpbstf,CPBSTF) #define LAPACK_zpbstf LAPACK_GLOBAL(zpbstf,ZPBSTF) #define LAPACK_sgehrd LAPACK_GLOBAL(sgehrd,SGEHRD) #define LAPACK_dgehrd LAPACK_GLOBAL(dgehrd,DGEHRD) #define LAPACK_cgehrd LAPACK_GLOBAL(cgehrd,CGEHRD) #define LAPACK_zgehrd LAPACK_GLOBAL(zgehrd,ZGEHRD) #define LAPACK_sorghr LAPACK_GLOBAL(sorghr,SORGHR) #define LAPACK_dorghr LAPACK_GLOBAL(dorghr,DORGHR) #define LAPACK_sormhr LAPACK_GLOBAL(sormhr,SORMHR) #define LAPACK_dormhr LAPACK_GLOBAL(dormhr,DORMHR) #define LAPACK_cunghr LAPACK_GLOBAL(cunghr,CUNGHR) #define LAPACK_zunghr LAPACK_GLOBAL(zunghr,ZUNGHR) #define LAPACK_cunmhr LAPACK_GLOBAL(cunmhr,CUNMHR) #define LAPACK_zunmhr LAPACK_GLOBAL(zunmhr,ZUNMHR) #define LAPACK_sgebal LAPACK_GLOBAL(sgebal,SGEBAL) #define LAPACK_dgebal LAPACK_GLOBAL(dgebal,DGEBAL) #define LAPACK_cgebal LAPACK_GLOBAL(cgebal,CGEBAL) #define LAPACK_zgebal LAPACK_GLOBAL(zgebal,ZGEBAL) #define LAPACK_sgebak LAPACK_GLOBAL(sgebak,SGEBAK) #define LAPACK_dgebak LAPACK_GLOBAL(dgebak,DGEBAK) #define LAPACK_cgebak LAPACK_GLOBAL(cgebak,CGEBAK) #define LAPACK_zgebak LAPACK_GLOBAL(zgebak,ZGEBAK) #define LAPACK_shseqr LAPACK_GLOBAL(shseqr,SHSEQR) #define LAPACK_dhseqr LAPACK_GLOBAL(dhseqr,DHSEQR) #define LAPACK_chseqr LAPACK_GLOBAL(chseqr,CHSEQR) #define LAPACK_zhseqr LAPACK_GLOBAL(zhseqr,ZHSEQR) #define LAPACK_shsein LAPACK_GLOBAL(shsein,SHSEIN) #define LAPACK_dhsein LAPACK_GLOBAL(dhsein,DHSEIN) #define LAPACK_chsein LAPACK_GLOBAL(chsein,CHSEIN) #define LAPACK_zhsein LAPACK_GLOBAL(zhsein,ZHSEIN) #define LAPACK_strevc LAPACK_GLOBAL(strevc,STREVC) #define LAPACK_dtrevc LAPACK_GLOBAL(dtrevc,DTREVC) #define LAPACK_ctrevc LAPACK_GLOBAL(ctrevc,CTREVC) #define LAPACK_ztrevc LAPACK_GLOBAL(ztrevc,ZTREVC) #define LAPACK_strsna LAPACK_GLOBAL(strsna,STRSNA) #define LAPACK_dtrsna LAPACK_GLOBAL(dtrsna,DTRSNA) #define LAPACK_ctrsna LAPACK_GLOBAL(ctrsna,CTRSNA) #define LAPACK_ztrsna LAPACK_GLOBAL(ztrsna,ZTRSNA) #define LAPACK_strexc LAPACK_GLOBAL(strexc,STREXC) #define LAPACK_dtrexc LAPACK_GLOBAL(dtrexc,DTREXC) #define LAPACK_ctrexc LAPACK_GLOBAL(ctrexc,CTREXC) #define LAPACK_ztrexc LAPACK_GLOBAL(ztrexc,ZTREXC) #define LAPACK_strsen LAPACK_GLOBAL(strsen,STRSEN) #define LAPACK_dtrsen LAPACK_GLOBAL(dtrsen,DTRSEN) #define LAPACK_ctrsen LAPACK_GLOBAL(ctrsen,CTRSEN) #define LAPACK_ztrsen LAPACK_GLOBAL(ztrsen,ZTRSEN) #define LAPACK_strsyl LAPACK_GLOBAL(strsyl,STRSYL) #define LAPACK_dtrsyl LAPACK_GLOBAL(dtrsyl,DTRSYL) #define LAPACK_ctrsyl LAPACK_GLOBAL(ctrsyl,CTRSYL) #define LAPACK_ztrsyl LAPACK_GLOBAL(ztrsyl,ZTRSYL) #define LAPACK_sgghrd LAPACK_GLOBAL(sgghrd,SGGHRD) #define LAPACK_dgghrd LAPACK_GLOBAL(dgghrd,DGGHRD) #define LAPACK_cgghrd LAPACK_GLOBAL(cgghrd,CGGHRD) #define LAPACK_zgghrd LAPACK_GLOBAL(zgghrd,ZGGHRD) #define LAPACK_sggbal LAPACK_GLOBAL(sggbal,SGGBAL) #define LAPACK_dggbal LAPACK_GLOBAL(dggbal,DGGBAL) #define LAPACK_cggbal LAPACK_GLOBAL(cggbal,CGGBAL) #define LAPACK_zggbal LAPACK_GLOBAL(zggbal,ZGGBAL) #define LAPACK_sggbak LAPACK_GLOBAL(sggbak,SGGBAK) #define LAPACK_dggbak LAPACK_GLOBAL(dggbak,DGGBAK) #define LAPACK_cggbak LAPACK_GLOBAL(cggbak,CGGBAK) #define LAPACK_zggbak LAPACK_GLOBAL(zggbak,ZGGBAK) #define LAPACK_shgeqz LAPACK_GLOBAL(shgeqz,SHGEQZ) #define LAPACK_dhgeqz LAPACK_GLOBAL(dhgeqz,DHGEQZ) #define LAPACK_chgeqz LAPACK_GLOBAL(chgeqz,CHGEQZ) #define LAPACK_zhgeqz LAPACK_GLOBAL(zhgeqz,ZHGEQZ) #define LAPACK_stgevc LAPACK_GLOBAL(stgevc,STGEVC) #define LAPACK_dtgevc LAPACK_GLOBAL(dtgevc,DTGEVC) #define LAPACK_ctgevc LAPACK_GLOBAL(ctgevc,CTGEVC) #define LAPACK_ztgevc LAPACK_GLOBAL(ztgevc,ZTGEVC) #define LAPACK_stgexc LAPACK_GLOBAL(stgexc,STGEXC) #define LAPACK_dtgexc LAPACK_GLOBAL(dtgexc,DTGEXC) #define LAPACK_ctgexc LAPACK_GLOBAL(ctgexc,CTGEXC) #define LAPACK_ztgexc LAPACK_GLOBAL(ztgexc,ZTGEXC) #define LAPACK_stgsen LAPACK_GLOBAL(stgsen,STGSEN) #define LAPACK_dtgsen LAPACK_GLOBAL(dtgsen,DTGSEN) #define LAPACK_ctgsen LAPACK_GLOBAL(ctgsen,CTGSEN) #define LAPACK_ztgsen LAPACK_GLOBAL(ztgsen,ZTGSEN) #define LAPACK_stgsyl LAPACK_GLOBAL(stgsyl,STGSYL) #define LAPACK_dtgsyl LAPACK_GLOBAL(dtgsyl,DTGSYL) #define LAPACK_ctgsyl LAPACK_GLOBAL(ctgsyl,CTGSYL) #define LAPACK_ztgsyl LAPACK_GLOBAL(ztgsyl,ZTGSYL) #define LAPACK_stgsna LAPACK_GLOBAL(stgsna,STGSNA) #define LAPACK_dtgsna LAPACK_GLOBAL(dtgsna,DTGSNA) #define LAPACK_ctgsna LAPACK_GLOBAL(ctgsna,CTGSNA) #define LAPACK_ztgsna LAPACK_GLOBAL(ztgsna,ZTGSNA) #define LAPACK_sggsvp LAPACK_GLOBAL(sggsvp,SGGSVP) #define LAPACK_dggsvp LAPACK_GLOBAL(dggsvp,DGGSVP) #define LAPACK_cggsvp LAPACK_GLOBAL(cggsvp,CGGSVP) #define LAPACK_zggsvp LAPACK_GLOBAL(zggsvp,ZGGSVP) #define LAPACK_stgsja LAPACK_GLOBAL(stgsja,STGSJA) #define LAPACK_dtgsja LAPACK_GLOBAL(dtgsja,DTGSJA) #define LAPACK_ctgsja LAPACK_GLOBAL(ctgsja,CTGSJA) #define LAPACK_ztgsja LAPACK_GLOBAL(ztgsja,ZTGSJA) #define LAPACK_sgels LAPACK_GLOBAL(sgels,SGELS) #define LAPACK_dgels LAPACK_GLOBAL(dgels,DGELS) #define LAPACK_cgels LAPACK_GLOBAL(cgels,CGELS) #define LAPACK_zgels LAPACK_GLOBAL(zgels,ZGELS) #define LAPACK_sgelsy LAPACK_GLOBAL(sgelsy,SGELSY) #define LAPACK_dgelsy LAPACK_GLOBAL(dgelsy,DGELSY) #define LAPACK_cgelsy LAPACK_GLOBAL(cgelsy,CGELSY) #define LAPACK_zgelsy LAPACK_GLOBAL(zgelsy,ZGELSY) #define LAPACK_sgelss LAPACK_GLOBAL(sgelss,SGELSS) #define LAPACK_dgelss LAPACK_GLOBAL(dgelss,DGELSS) #define LAPACK_cgelss LAPACK_GLOBAL(cgelss,CGELSS) #define LAPACK_zgelss LAPACK_GLOBAL(zgelss,ZGELSS) #define LAPACK_sgelsd LAPACK_GLOBAL(sgelsd,SGELSD) #define LAPACK_dgelsd LAPACK_GLOBAL(dgelsd,DGELSD) #define LAPACK_cgelsd LAPACK_GLOBAL(cgelsd,CGELSD) #define LAPACK_zgelsd LAPACK_GLOBAL(zgelsd,ZGELSD) #define LAPACK_sgglse LAPACK_GLOBAL(sgglse,SGGLSE) #define LAPACK_dgglse LAPACK_GLOBAL(dgglse,DGGLSE) #define LAPACK_cgglse LAPACK_GLOBAL(cgglse,CGGLSE) #define LAPACK_zgglse LAPACK_GLOBAL(zgglse,ZGGLSE) #define LAPACK_sggglm LAPACK_GLOBAL(sggglm,SGGGLM) #define LAPACK_dggglm LAPACK_GLOBAL(dggglm,DGGGLM) #define LAPACK_cggglm LAPACK_GLOBAL(cggglm,CGGGLM) #define LAPACK_zggglm LAPACK_GLOBAL(zggglm,ZGGGLM) #define LAPACK_ssyev LAPACK_GLOBAL(ssyev,SSYEV) #define LAPACK_dsyev LAPACK_GLOBAL(dsyev,DSYEV) #define LAPACK_cheev LAPACK_GLOBAL(cheev,CHEEV) #define LAPACK_zheev LAPACK_GLOBAL(zheev,ZHEEV) #define LAPACK_ssyevd LAPACK_GLOBAL(ssyevd,SSYEVD) #define LAPACK_dsyevd LAPACK_GLOBAL(dsyevd,DSYEVD) #define LAPACK_cheevd LAPACK_GLOBAL(cheevd,CHEEVD) #define LAPACK_zheevd LAPACK_GLOBAL(zheevd,ZHEEVD) #define LAPACK_ssyevx LAPACK_GLOBAL(ssyevx,SSYEVX) #define LAPACK_dsyevx LAPACK_GLOBAL(dsyevx,DSYEVX) #define LAPACK_cheevx LAPACK_GLOBAL(cheevx,CHEEVX) #define LAPACK_zheevx LAPACK_GLOBAL(zheevx,ZHEEVX) #define LAPACK_ssyevr LAPACK_GLOBAL(ssyevr,SSYEVR) #define LAPACK_dsyevr LAPACK_GLOBAL(dsyevr,DSYEVR) #define LAPACK_cheevr LAPACK_GLOBAL(cheevr,CHEEVR) #define LAPACK_zheevr LAPACK_GLOBAL(zheevr,ZHEEVR) #define LAPACK_sspev LAPACK_GLOBAL(sspev,SSPEV) #define LAPACK_dspev LAPACK_GLOBAL(dspev,DSPEV) #define LAPACK_chpev LAPACK_GLOBAL(chpev,CHPEV) #define LAPACK_zhpev LAPACK_GLOBAL(zhpev,ZHPEV) #define LAPACK_sspevd LAPACK_GLOBAL(sspevd,SSPEVD) #define LAPACK_dspevd LAPACK_GLOBAL(dspevd,DSPEVD) #define LAPACK_chpevd LAPACK_GLOBAL(chpevd,CHPEVD) #define LAPACK_zhpevd LAPACK_GLOBAL(zhpevd,ZHPEVD) #define LAPACK_sspevx LAPACK_GLOBAL(sspevx,SSPEVX) #define LAPACK_dspevx LAPACK_GLOBAL(dspevx,DSPEVX) #define LAPACK_chpevx LAPACK_GLOBAL(chpevx,CHPEVX) #define LAPACK_zhpevx LAPACK_GLOBAL(zhpevx,ZHPEVX) #define LAPACK_ssbev LAPACK_GLOBAL(ssbev,SSBEV) #define LAPACK_dsbev LAPACK_GLOBAL(dsbev,DSBEV) #define LAPACK_chbev LAPACK_GLOBAL(chbev,CHBEV) #define LAPACK_zhbev LAPACK_GLOBAL(zhbev,ZHBEV) #define LAPACK_ssbevd LAPACK_GLOBAL(ssbevd,SSBEVD) #define LAPACK_dsbevd LAPACK_GLOBAL(dsbevd,DSBEVD) #define LAPACK_chbevd LAPACK_GLOBAL(chbevd,CHBEVD) #define LAPACK_zhbevd LAPACK_GLOBAL(zhbevd,ZHBEVD) #define LAPACK_ssbevx LAPACK_GLOBAL(ssbevx,SSBEVX) #define LAPACK_dsbevx LAPACK_GLOBAL(dsbevx,DSBEVX) #define LAPACK_chbevx LAPACK_GLOBAL(chbevx,CHBEVX) #define LAPACK_zhbevx LAPACK_GLOBAL(zhbevx,ZHBEVX) #define LAPACK_sstev LAPACK_GLOBAL(sstev,SSTEV) #define LAPACK_dstev LAPACK_GLOBAL(dstev,DSTEV) #define LAPACK_sstevd LAPACK_GLOBAL(sstevd,SSTEVD) #define LAPACK_dstevd LAPACK_GLOBAL(dstevd,DSTEVD) #define LAPACK_sstevx LAPACK_GLOBAL(sstevx,SSTEVX) #define LAPACK_dstevx LAPACK_GLOBAL(dstevx,DSTEVX) #define LAPACK_sstevr LAPACK_GLOBAL(sstevr,SSTEVR) #define LAPACK_dstevr LAPACK_GLOBAL(dstevr,DSTEVR) #define LAPACK_sgees LAPACK_GLOBAL(sgees,SGEES) #define LAPACK_dgees LAPACK_GLOBAL(dgees,DGEES) #define LAPACK_cgees LAPACK_GLOBAL(cgees,CGEES) #define LAPACK_zgees LAPACK_GLOBAL(zgees,ZGEES) #define LAPACK_sgeesx LAPACK_GLOBAL(sgeesx,SGEESX) #define LAPACK_dgeesx LAPACK_GLOBAL(dgeesx,DGEESX) #define LAPACK_cgeesx LAPACK_GLOBAL(cgeesx,CGEESX) #define LAPACK_zgeesx LAPACK_GLOBAL(zgeesx,ZGEESX) #define LAPACK_sgeev LAPACK_GLOBAL(sgeev,SGEEV) #define LAPACK_dgeev LAPACK_GLOBAL(dgeev,DGEEV) #define LAPACK_cgeev LAPACK_GLOBAL(cgeev,CGEEV) #define LAPACK_zgeev LAPACK_GLOBAL(zgeev,ZGEEV) #define LAPACK_sgeevx LAPACK_GLOBAL(sgeevx,SGEEVX) #define LAPACK_dgeevx LAPACK_GLOBAL(dgeevx,DGEEVX) #define LAPACK_cgeevx LAPACK_GLOBAL(cgeevx,CGEEVX) #define LAPACK_zgeevx LAPACK_GLOBAL(zgeevx,ZGEEVX) #define LAPACK_sgesvd LAPACK_GLOBAL(sgesvd,SGESVD) #define LAPACK_dgesvd LAPACK_GLOBAL(dgesvd,DGESVD) #define LAPACK_cgesvd LAPACK_GLOBAL(cgesvd,CGESVD) #define LAPACK_zgesvd LAPACK_GLOBAL(zgesvd,ZGESVD) #define LAPACK_sgesdd LAPACK_GLOBAL(sgesdd,SGESDD) #define LAPACK_dgesdd LAPACK_GLOBAL(dgesdd,DGESDD) #define LAPACK_cgesdd LAPACK_GLOBAL(cgesdd,CGESDD) #define LAPACK_zgesdd LAPACK_GLOBAL(zgesdd,ZGESDD) #define LAPACK_dgejsv LAPACK_GLOBAL(dgejsv,DGEJSV) #define LAPACK_sgejsv LAPACK_GLOBAL(sgejsv,SGEJSV) #define LAPACK_dgesvj LAPACK_GLOBAL(dgesvj,DGESVJ) #define LAPACK_sgesvj LAPACK_GLOBAL(sgesvj,SGESVJ) #define LAPACK_sggsvd LAPACK_GLOBAL(sggsvd,SGGSVD) #define LAPACK_dggsvd LAPACK_GLOBAL(dggsvd,DGGSVD) #define LAPACK_cggsvd LAPACK_GLOBAL(cggsvd,CGGSVD) #define LAPACK_zggsvd LAPACK_GLOBAL(zggsvd,ZGGSVD) #define LAPACK_ssygv LAPACK_GLOBAL(ssygv,SSYGV) #define LAPACK_dsygv LAPACK_GLOBAL(dsygv,DSYGV) #define LAPACK_chegv LAPACK_GLOBAL(chegv,CHEGV) #define LAPACK_zhegv LAPACK_GLOBAL(zhegv,ZHEGV) #define LAPACK_ssygvd LAPACK_GLOBAL(ssygvd,SSYGVD) #define LAPACK_dsygvd LAPACK_GLOBAL(dsygvd,DSYGVD) #define LAPACK_chegvd LAPACK_GLOBAL(chegvd,CHEGVD) #define LAPACK_zhegvd LAPACK_GLOBAL(zhegvd,ZHEGVD) #define LAPACK_ssygvx LAPACK_GLOBAL(ssygvx,SSYGVX) #define LAPACK_dsygvx LAPACK_GLOBAL(dsygvx,DSYGVX) #define LAPACK_chegvx LAPACK_GLOBAL(chegvx,CHEGVX) #define LAPACK_zhegvx LAPACK_GLOBAL(zhegvx,ZHEGVX) #define LAPACK_sspgv LAPACK_GLOBAL(sspgv,SSPGV) #define LAPACK_dspgv LAPACK_GLOBAL(dspgv,DSPGV) #define LAPACK_chpgv LAPACK_GLOBAL(chpgv,CHPGV) #define LAPACK_zhpgv LAPACK_GLOBAL(zhpgv,ZHPGV) #define LAPACK_sspgvd LAPACK_GLOBAL(sspgvd,SSPGVD) #define LAPACK_dspgvd LAPACK_GLOBAL(dspgvd,DSPGVD) #define LAPACK_chpgvd LAPACK_GLOBAL(chpgvd,CHPGVD) #define LAPACK_zhpgvd LAPACK_GLOBAL(zhpgvd,ZHPGVD) #define LAPACK_sspgvx LAPACK_GLOBAL(sspgvx,SSPGVX) #define LAPACK_dspgvx LAPACK_GLOBAL(dspgvx,DSPGVX) #define LAPACK_chpgvx LAPACK_GLOBAL(chpgvx,CHPGVX) #define LAPACK_zhpgvx LAPACK_GLOBAL(zhpgvx,ZHPGVX) #define LAPACK_ssbgv LAPACK_GLOBAL(ssbgv,SSBGV) #define LAPACK_dsbgv LAPACK_GLOBAL(dsbgv,DSBGV) #define LAPACK_chbgv LAPACK_GLOBAL(chbgv,CHBGV) #define LAPACK_zhbgv LAPACK_GLOBAL(zhbgv,ZHBGV) #define LAPACK_ssbgvd LAPACK_GLOBAL(ssbgvd,SSBGVD) #define LAPACK_dsbgvd LAPACK_GLOBAL(dsbgvd,DSBGVD) #define LAPACK_chbgvd LAPACK_GLOBAL(chbgvd,CHBGVD) #define LAPACK_zhbgvd LAPACK_GLOBAL(zhbgvd,ZHBGVD) #define LAPACK_ssbgvx LAPACK_GLOBAL(ssbgvx,SSBGVX) #define LAPACK_dsbgvx LAPACK_GLOBAL(dsbgvx,DSBGVX) #define LAPACK_chbgvx LAPACK_GLOBAL(chbgvx,CHBGVX) #define LAPACK_zhbgvx LAPACK_GLOBAL(zhbgvx,ZHBGVX) #define LAPACK_sgges LAPACK_GLOBAL(sgges,SGGES) #define LAPACK_dgges LAPACK_GLOBAL(dgges,DGGES) #define LAPACK_cgges LAPACK_GLOBAL(cgges,CGGES) #define LAPACK_zgges LAPACK_GLOBAL(zgges,ZGGES) #define LAPACK_sggesx LAPACK_GLOBAL(sggesx,SGGESX) #define LAPACK_dggesx LAPACK_GLOBAL(dggesx,DGGESX) #define LAPACK_cggesx LAPACK_GLOBAL(cggesx,CGGESX) #define LAPACK_zggesx LAPACK_GLOBAL(zggesx,ZGGESX) #define LAPACK_sggev LAPACK_GLOBAL(sggev,SGGEV) #define LAPACK_dggev LAPACK_GLOBAL(dggev,DGGEV) #define LAPACK_cggev LAPACK_GLOBAL(cggev,CGGEV) #define LAPACK_zggev LAPACK_GLOBAL(zggev,ZGGEV) #define LAPACK_sggevx LAPACK_GLOBAL(sggevx,SGGEVX) #define LAPACK_dggevx LAPACK_GLOBAL(dggevx,DGGEVX) #define LAPACK_cggevx LAPACK_GLOBAL(cggevx,CGGEVX) #define LAPACK_zggevx LAPACK_GLOBAL(zggevx,ZGGEVX) #define LAPACK_dsfrk LAPACK_GLOBAL(dsfrk,DSFRK) #define LAPACK_ssfrk LAPACK_GLOBAL(ssfrk,SSFRK) #define LAPACK_zhfrk LAPACK_GLOBAL(zhfrk,ZHFRK) #define LAPACK_chfrk LAPACK_GLOBAL(chfrk,CHFRK) #define LAPACK_dtfsm LAPACK_GLOBAL(dtfsm,DTFSM) #define LAPACK_stfsm LAPACK_GLOBAL(stfsm,STFSM) #define LAPACK_ztfsm LAPACK_GLOBAL(ztfsm,ZTFSM) #define LAPACK_ctfsm LAPACK_GLOBAL(ctfsm,CTFSM) #define LAPACK_dtfttp LAPACK_GLOBAL(dtfttp,DTFTTP) #define LAPACK_stfttp LAPACK_GLOBAL(stfttp,STFTTP) #define LAPACK_ztfttp LAPACK_GLOBAL(ztfttp,ZTFTTP) #define LAPACK_ctfttp LAPACK_GLOBAL(ctfttp,CTFTTP) #define LAPACK_dtfttr LAPACK_GLOBAL(dtfttr,DTFTTR) #define LAPACK_stfttr LAPACK_GLOBAL(stfttr,STFTTR) #define LAPACK_ztfttr LAPACK_GLOBAL(ztfttr,ZTFTTR) #define LAPACK_ctfttr LAPACK_GLOBAL(ctfttr,CTFTTR) #define LAPACK_dtpttf LAPACK_GLOBAL(dtpttf,DTPTTF) #define LAPACK_stpttf LAPACK_GLOBAL(stpttf,STPTTF) #define LAPACK_ztpttf LAPACK_GLOBAL(ztpttf,ZTPTTF) #define LAPACK_ctpttf LAPACK_GLOBAL(ctpttf,CTPTTF) #define LAPACK_dtpttr LAPACK_GLOBAL(dtpttr,DTPTTR) #define LAPACK_stpttr LAPACK_GLOBAL(stpttr,STPTTR) #define LAPACK_ztpttr LAPACK_GLOBAL(ztpttr,ZTPTTR) #define LAPACK_ctpttr LAPACK_GLOBAL(ctpttr,CTPTTR) #define LAPACK_dtrttf LAPACK_GLOBAL(dtrttf,DTRTTF) #define LAPACK_strttf LAPACK_GLOBAL(strttf,STRTTF) #define LAPACK_ztrttf LAPACK_GLOBAL(ztrttf,ZTRTTF) #define LAPACK_ctrttf LAPACK_GLOBAL(ctrttf,CTRTTF) #define LAPACK_dtrttp LAPACK_GLOBAL(dtrttp,DTRTTP) #define LAPACK_strttp LAPACK_GLOBAL(strttp,STRTTP) #define LAPACK_ztrttp LAPACK_GLOBAL(ztrttp,ZTRTTP) #define LAPACK_ctrttp LAPACK_GLOBAL(ctrttp,CTRTTP) #define LAPACK_sgeqrfp LAPACK_GLOBAL(sgeqrfp,SGEQRFP) #define LAPACK_dgeqrfp LAPACK_GLOBAL(dgeqrfp,DGEQRFP) #define LAPACK_cgeqrfp LAPACK_GLOBAL(cgeqrfp,CGEQRFP) #define LAPACK_zgeqrfp LAPACK_GLOBAL(zgeqrfp,ZGEQRFP) #define LAPACK_clacgv LAPACK_GLOBAL(clacgv,CLACGV) #define LAPACK_zlacgv LAPACK_GLOBAL(zlacgv,ZLACGV) #define LAPACK_slarnv LAPACK_GLOBAL(slarnv,SLARNV) #define LAPACK_dlarnv LAPACK_GLOBAL(dlarnv,DLARNV) #define LAPACK_clarnv LAPACK_GLOBAL(clarnv,CLARNV) #define LAPACK_zlarnv LAPACK_GLOBAL(zlarnv,ZLARNV) #define LAPACK_sgeqr2 LAPACK_GLOBAL(sgeqr2,SGEQR2) #define LAPACK_dgeqr2 LAPACK_GLOBAL(dgeqr2,DGEQR2) #define LAPACK_cgeqr2 LAPACK_GLOBAL(cgeqr2,CGEQR2) #define LAPACK_zgeqr2 LAPACK_GLOBAL(zgeqr2,ZGEQR2) #define LAPACK_slacpy LAPACK_GLOBAL(slacpy,SLACPY) #define LAPACK_dlacpy LAPACK_GLOBAL(dlacpy,DLACPY) #define LAPACK_clacpy LAPACK_GLOBAL(clacpy,CLACPY) #define LAPACK_zlacpy LAPACK_GLOBAL(zlacpy,ZLACPY) #define LAPACK_sgetf2 LAPACK_GLOBAL(sgetf2,SGETF2) #define LAPACK_dgetf2 LAPACK_GLOBAL(dgetf2,DGETF2) #define LAPACK_cgetf2 LAPACK_GLOBAL(cgetf2,CGETF2) #define LAPACK_zgetf2 LAPACK_GLOBAL(zgetf2,ZGETF2) #define LAPACK_slaswp LAPACK_GLOBAL(slaswp,SLASWP) #define LAPACK_dlaswp LAPACK_GLOBAL(dlaswp,DLASWP) #define LAPACK_claswp LAPACK_GLOBAL(claswp,CLASWP) #define LAPACK_zlaswp LAPACK_GLOBAL(zlaswp,ZLASWP) #define LAPACK_slange LAPACK_GLOBAL(slange,SLANGE) #define LAPACK_dlange LAPACK_GLOBAL(dlange,DLANGE) #define LAPACK_clange LAPACK_GLOBAL(clange,CLANGE) #define LAPACK_zlange LAPACK_GLOBAL(zlange,ZLANGE) #define LAPACK_clanhe LAPACK_GLOBAL(clanhe,CLANHE) #define LAPACK_zlanhe LAPACK_GLOBAL(zlanhe,ZLANHE) #define LAPACK_slansy LAPACK_GLOBAL(slansy,SLANSY) #define LAPACK_dlansy LAPACK_GLOBAL(dlansy,DLANSY) #define LAPACK_clansy LAPACK_GLOBAL(clansy,CLANSY) #define LAPACK_zlansy LAPACK_GLOBAL(zlansy,ZLANSY) #define LAPACK_slantr LAPACK_GLOBAL(slantr,SLANTR) #define LAPACK_dlantr LAPACK_GLOBAL(dlantr,DLANTR) #define LAPACK_clantr LAPACK_GLOBAL(clantr,CLANTR) #define LAPACK_zlantr LAPACK_GLOBAL(zlantr,ZLANTR) #define LAPACK_slamch LAPACK_GLOBAL(slamch,SLAMCH) #define LAPACK_dlamch LAPACK_GLOBAL(dlamch,DLAMCH) #define LAPACK_sgelq2 LAPACK_GLOBAL(sgelq2,SGELQ2) #define LAPACK_dgelq2 LAPACK_GLOBAL(dgelq2,DGELQ2) #define LAPACK_cgelq2 LAPACK_GLOBAL(cgelq2,CGELQ2) #define LAPACK_zgelq2 LAPACK_GLOBAL(zgelq2,ZGELQ2) #define LAPACK_slarfb LAPACK_GLOBAL(slarfb,SLARFB) #define LAPACK_dlarfb LAPACK_GLOBAL(dlarfb,DLARFB) #define LAPACK_clarfb LAPACK_GLOBAL(clarfb,CLARFB) #define LAPACK_zlarfb LAPACK_GLOBAL(zlarfb,ZLARFB) #define LAPACK_slarfg LAPACK_GLOBAL(slarfg,SLARFG) #define LAPACK_dlarfg LAPACK_GLOBAL(dlarfg,DLARFG) #define LAPACK_clarfg LAPACK_GLOBAL(clarfg,CLARFG) #define LAPACK_zlarfg LAPACK_GLOBAL(zlarfg,ZLARFG) #define LAPACK_slarft LAPACK_GLOBAL(slarft,SLARFT) #define LAPACK_dlarft LAPACK_GLOBAL(dlarft,DLARFT) #define LAPACK_clarft LAPACK_GLOBAL(clarft,CLARFT) #define LAPACK_zlarft LAPACK_GLOBAL(zlarft,ZLARFT) #define LAPACK_slarfx LAPACK_GLOBAL(slarfx,SLARFX) #define LAPACK_dlarfx LAPACK_GLOBAL(dlarfx,DLARFX) #define LAPACK_clarfx LAPACK_GLOBAL(clarfx,CLARFX) #define LAPACK_zlarfx LAPACK_GLOBAL(zlarfx,ZLARFX) #define LAPACK_slatms LAPACK_GLOBAL(slatms,SLATMS) #define LAPACK_dlatms LAPACK_GLOBAL(dlatms,DLATMS) #define LAPACK_clatms LAPACK_GLOBAL(clatms,CLATMS) #define LAPACK_zlatms LAPACK_GLOBAL(zlatms,ZLATMS) #define LAPACK_slag2d LAPACK_GLOBAL(slag2d,SLAG2D) #define LAPACK_dlag2s LAPACK_GLOBAL(dlag2s,DLAG2S) #define LAPACK_clag2z LAPACK_GLOBAL(clag2z,CLAG2Z) #define LAPACK_zlag2c LAPACK_GLOBAL(zlag2c,ZLAG2C) #define LAPACK_slauum LAPACK_GLOBAL(slauum,SLAUUM) #define LAPACK_dlauum LAPACK_GLOBAL(dlauum,DLAUUM) #define LAPACK_clauum LAPACK_GLOBAL(clauum,CLAUUM) #define LAPACK_zlauum LAPACK_GLOBAL(zlauum,ZLAUUM) #define LAPACK_slagge LAPACK_GLOBAL(slagge,SLAGGE) #define LAPACK_dlagge LAPACK_GLOBAL(dlagge,DLAGGE) #define LAPACK_clagge LAPACK_GLOBAL(clagge,CLAGGE) #define LAPACK_zlagge LAPACK_GLOBAL(zlagge,ZLAGGE) #define LAPACK_slaset LAPACK_GLOBAL(slaset,SLASET) #define LAPACK_dlaset LAPACK_GLOBAL(dlaset,DLASET) #define LAPACK_claset LAPACK_GLOBAL(claset,CLASET) #define LAPACK_zlaset LAPACK_GLOBAL(zlaset,ZLASET) #define LAPACK_slasrt LAPACK_GLOBAL(slasrt,SLASRT) #define LAPACK_dlasrt LAPACK_GLOBAL(dlasrt,DLASRT) #define LAPACK_slagsy LAPACK_GLOBAL(slagsy,SLAGSY) #define LAPACK_dlagsy LAPACK_GLOBAL(dlagsy,DLAGSY) #define LAPACK_clagsy LAPACK_GLOBAL(clagsy,CLAGSY) #define LAPACK_zlagsy LAPACK_GLOBAL(zlagsy,ZLAGSY) #define LAPACK_claghe LAPACK_GLOBAL(claghe,CLAGHE) #define LAPACK_zlaghe LAPACK_GLOBAL(zlaghe,ZLAGHE) #define LAPACK_slapmr LAPACK_GLOBAL(slapmr,SLAPMR) #define LAPACK_dlapmr LAPACK_GLOBAL(dlapmr,DLAPMR) #define LAPACK_clapmr LAPACK_GLOBAL(clapmr,CLAPMR) #define LAPACK_zlapmr LAPACK_GLOBAL(zlapmr,ZLAPMR) #define LAPACK_slapy2 LAPACK_GLOBAL(slapy2,SLAPY2) #define LAPACK_dlapy2 LAPACK_GLOBAL(dlapy2,DLAPY2) #define LAPACK_slapy3 LAPACK_GLOBAL(slapy3,SLAPY3) #define LAPACK_dlapy3 LAPACK_GLOBAL(dlapy3,DLAPY3) #define LAPACK_slartgp LAPACK_GLOBAL(slartgp,SLARTGP) #define LAPACK_dlartgp LAPACK_GLOBAL(dlartgp,DLARTGP) #define LAPACK_slartgs LAPACK_GLOBAL(slartgs,SLARTGS) #define LAPACK_dlartgs LAPACK_GLOBAL(dlartgs,DLARTGS) // LAPACK 3.3.0 #define LAPACK_cbbcsd LAPACK_GLOBAL(cbbcsd,CBBCSD) #define LAPACK_cheswapr LAPACK_GLOBAL(cheswapr,CHESWAPR) #define LAPACK_chetri2 LAPACK_GLOBAL(chetri2,CHETRI2) #define LAPACK_chetri2x LAPACK_GLOBAL(chetri2x,CHETRI2X) #define LAPACK_chetrs2 LAPACK_GLOBAL(chetrs2,CHETRS2) #define LAPACK_csyconv LAPACK_GLOBAL(csyconv,CSYCONV) #define LAPACK_csyswapr LAPACK_GLOBAL(csyswapr,CSYSWAPR) #define LAPACK_csytri2 LAPACK_GLOBAL(csytri2,CSYTRI2) #define LAPACK_csytri2x LAPACK_GLOBAL(csytri2x,CSYTRI2X) #define LAPACK_csytrs2 LAPACK_GLOBAL(csytrs2,CSYTRS2) #define LAPACK_cunbdb LAPACK_GLOBAL(cunbdb,CUNBDB) #define LAPACK_cuncsd LAPACK_GLOBAL(cuncsd,CUNCSD) #define LAPACK_dbbcsd LAPACK_GLOBAL(dbbcsd,DBBCSD) #define LAPACK_dorbdb LAPACK_GLOBAL(dorbdb,DORBDB) #define LAPACK_dorcsd LAPACK_GLOBAL(dorcsd,DORCSD) #define LAPACK_dsyconv LAPACK_GLOBAL(dsyconv,DSYCONV) #define LAPACK_dsyswapr LAPACK_GLOBAL(dsyswapr,DSYSWAPR) #define LAPACK_dsytri2 LAPACK_GLOBAL(dsytri2,DSYTRI2) #define LAPACK_dsytri2x LAPACK_GLOBAL(dsytri2x,DSYTRI2X) #define LAPACK_dsytrs2 LAPACK_GLOBAL(dsytrs2,DSYTRS2) #define LAPACK_sbbcsd LAPACK_GLOBAL(sbbcsd,SBBCSD) #define LAPACK_sorbdb LAPACK_GLOBAL(sorbdb,SORBDB) #define LAPACK_sorcsd LAPACK_GLOBAL(sorcsd,SORCSD) #define LAPACK_ssyconv LAPACK_GLOBAL(ssyconv,SSYCONV) #define LAPACK_ssyswapr LAPACK_GLOBAL(ssyswapr,SSYSWAPR) #define LAPACK_ssytri2 LAPACK_GLOBAL(ssytri2,SSYTRI2) #define LAPACK_ssytri2x LAPACK_GLOBAL(ssytri2x,SSYTRI2X) #define LAPACK_ssytrs2 LAPACK_GLOBAL(ssytrs2,SSYTRS2) #define LAPACK_zbbcsd LAPACK_GLOBAL(zbbcsd,ZBBCSD) #define LAPACK_zheswapr LAPACK_GLOBAL(zheswapr,ZHESWAPR) #define LAPACK_zhetri2 LAPACK_GLOBAL(zhetri2,ZHETRI2) #define LAPACK_zhetri2x LAPACK_GLOBAL(zhetri2x,ZHETRI2X) #define LAPACK_zhetrs2 LAPACK_GLOBAL(zhetrs2,ZHETRS2) #define LAPACK_zsyconv LAPACK_GLOBAL(zsyconv,ZSYCONV) #define LAPACK_zsyswapr LAPACK_GLOBAL(zsyswapr,ZSYSWAPR) #define LAPACK_zsytri2 LAPACK_GLOBAL(zsytri2,ZSYTRI2) #define LAPACK_zsytri2x LAPACK_GLOBAL(zsytri2x,ZSYTRI2X) #define LAPACK_zsytrs2 LAPACK_GLOBAL(zsytrs2,ZSYTRS2) #define LAPACK_zunbdb LAPACK_GLOBAL(zunbdb,ZUNBDB) #define LAPACK_zuncsd LAPACK_GLOBAL(zuncsd,ZUNCSD) // LAPACK 3.4.0 #define LAPACK_sgemqrt LAPACK_GLOBAL(sgemqrt,SGEMQRT) #define LAPACK_dgemqrt LAPACK_GLOBAL(dgemqrt,DGEMQRT) #define LAPACK_cgemqrt LAPACK_GLOBAL(cgemqrt,CGEMQRT) #define LAPACK_zgemqrt LAPACK_GLOBAL(zgemqrt,ZGEMQRT) #define LAPACK_sgeqrt LAPACK_GLOBAL(sgeqrt,SGEQRT) #define LAPACK_dgeqrt LAPACK_GLOBAL(dgeqrt,DGEQRT) #define LAPACK_cgeqrt LAPACK_GLOBAL(cgeqrt,CGEQRT) #define LAPACK_zgeqrt LAPACK_GLOBAL(zgeqrt,ZGEQRT) #define LAPACK_sgeqrt2 LAPACK_GLOBAL(sgeqrt2,SGEQRT2) #define LAPACK_dgeqrt2 LAPACK_GLOBAL(dgeqrt2,DGEQRT2) #define LAPACK_cgeqrt2 LAPACK_GLOBAL(cgeqrt2,CGEQRT2) #define LAPACK_zgeqrt2 LAPACK_GLOBAL(zgeqrt2,ZGEQRT2) #define LAPACK_sgeqrt3 LAPACK_GLOBAL(sgeqrt3,SGEQRT3) #define LAPACK_dgeqrt3 LAPACK_GLOBAL(dgeqrt3,DGEQRT3) #define LAPACK_cgeqrt3 LAPACK_GLOBAL(cgeqrt3,CGEQRT3) #define LAPACK_zgeqrt3 LAPACK_GLOBAL(zgeqrt3,ZGEQRT3) #define LAPACK_stpmqrt LAPACK_GLOBAL(stpmqrt,STPMQRT) #define LAPACK_dtpmqrt LAPACK_GLOBAL(dtpmqrt,DTPMQRT) #define LAPACK_ctpmqrt LAPACK_GLOBAL(ctpmqrt,CTPMQRT) #define LAPACK_ztpmqrt LAPACK_GLOBAL(ztpmqrt,ZTPMQRT) #define LAPACK_dtpqrt LAPACK_GLOBAL(dtpqrt,DTPQRT) #define LAPACK_ctpqrt LAPACK_GLOBAL(ctpqrt,CTPQRT) #define LAPACK_ztpqrt LAPACK_GLOBAL(ztpqrt,ZTPQRT) #define LAPACK_stpqrt2 LAPACK_GLOBAL(stpqrt2,STPQRT2) #define LAPACK_dtpqrt2 LAPACK_GLOBAL(dtpqrt2,DTPQRT2) #define LAPACK_ctpqrt2 LAPACK_GLOBAL(ctpqrt2,CTPQRT2) #define LAPACK_ztpqrt2 LAPACK_GLOBAL(ztpqrt2,ZTPQRT2) #define LAPACK_stprfb LAPACK_GLOBAL(stprfb,STPRFB) #define LAPACK_dtprfb LAPACK_GLOBAL(dtprfb,DTPRFB) #define LAPACK_ctprfb LAPACK_GLOBAL(ctprfb,CTPRFB) #define LAPACK_ztprfb LAPACK_GLOBAL(ztprfb,ZTPRFB) // LAPACK 3.X.X #define LAPACK_csyr LAPACK_GLOBAL(csyr,CSYR) #define LAPACK_zsyr LAPACK_GLOBAL(zsyr,ZSYR) void LAPACK_sgetrf( lapack_int* m, lapack_int* n, float* a, lapack_int* lda, lapack_int* ipiv, lapack_int *info ); void LAPACK_dgetrf( lapack_int* m, lapack_int* n, double* a, lapack_int* lda, lapack_int* ipiv, lapack_int *info ); void LAPACK_cgetrf( lapack_int* m, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_int* ipiv, lapack_int *info ); void LAPACK_zgetrf( lapack_int* m, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_int* ipiv, lapack_int *info ); void LAPACK_sgbtrf( lapack_int* m, lapack_int* n, lapack_int* kl, lapack_int* ku, float* ab, lapack_int* ldab, lapack_int* ipiv, lapack_int *info ); void LAPACK_dgbtrf( lapack_int* m, lapack_int* n, lapack_int* kl, lapack_int* ku, double* ab, lapack_int* ldab, lapack_int* ipiv, lapack_int *info ); void LAPACK_cgbtrf( lapack_int* m, lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_complex_float* ab, lapack_int* ldab, lapack_int* ipiv, lapack_int *info ); void LAPACK_zgbtrf( lapack_int* m, lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_complex_double* ab, lapack_int* ldab, lapack_int* ipiv, lapack_int *info ); void LAPACK_sgttrf( lapack_int* n, float* dl, float* d, float* du, float* du2, lapack_int* ipiv, lapack_int *info ); void LAPACK_dgttrf( lapack_int* n, double* dl, double* d, double* du, double* du2, lapack_int* ipiv, lapack_int *info ); void LAPACK_cgttrf( lapack_int* n, lapack_complex_float* dl, lapack_complex_float* d, lapack_complex_float* du, lapack_complex_float* du2, lapack_int* ipiv, lapack_int *info ); void LAPACK_zgttrf( lapack_int* n, lapack_complex_double* dl, lapack_complex_double* d, lapack_complex_double* du, lapack_complex_double* du2, lapack_int* ipiv, lapack_int *info ); void LAPACK_spotrf( char* uplo, lapack_int* n, float* a, lapack_int* lda, lapack_int *info ); void LAPACK_dpotrf( char* uplo, lapack_int* n, double* a, lapack_int* lda, lapack_int *info ); void LAPACK_cpotrf( char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_int *info ); void LAPACK_zpotrf( char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_int *info ); void LAPACK_dpstrf( char* uplo, lapack_int* n, double* a, lapack_int* lda, lapack_int* piv, lapack_int* rank, double* tol, double* work, lapack_int *info ); void LAPACK_spstrf( char* uplo, lapack_int* n, float* a, lapack_int* lda, lapack_int* piv, lapack_int* rank, float* tol, float* work, lapack_int *info ); void LAPACK_zpstrf( char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_int* piv, lapack_int* rank, double* tol, double* work, lapack_int *info ); void LAPACK_cpstrf( char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_int* piv, lapack_int* rank, float* tol, float* work, lapack_int *info ); void LAPACK_dpftrf( char* transr, char* uplo, lapack_int* n, double* a, lapack_int *info ); void LAPACK_spftrf( char* transr, char* uplo, lapack_int* n, float* a, lapack_int *info ); void LAPACK_zpftrf( char* transr, char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int *info ); void LAPACK_cpftrf( char* transr, char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int *info ); void LAPACK_spptrf( char* uplo, lapack_int* n, float* ap, lapack_int *info ); void LAPACK_dpptrf( char* uplo, lapack_int* n, double* ap, lapack_int *info ); void LAPACK_cpptrf( char* uplo, lapack_int* n, lapack_complex_float* ap, lapack_int *info ); void LAPACK_zpptrf( char* uplo, lapack_int* n, lapack_complex_double* ap, lapack_int *info ); void LAPACK_spbtrf( char* uplo, lapack_int* n, lapack_int* kd, float* ab, lapack_int* ldab, lapack_int *info ); void LAPACK_dpbtrf( char* uplo, lapack_int* n, lapack_int* kd, double* ab, lapack_int* ldab, lapack_int *info ); void LAPACK_cpbtrf( char* uplo, lapack_int* n, lapack_int* kd, lapack_complex_float* ab, lapack_int* ldab, lapack_int *info ); void LAPACK_zpbtrf( char* uplo, lapack_int* n, lapack_int* kd, lapack_complex_double* ab, lapack_int* ldab, lapack_int *info ); void LAPACK_spttrf( lapack_int* n, float* d, float* e, lapack_int *info ); void LAPACK_dpttrf( lapack_int* n, double* d, double* e, lapack_int *info ); void LAPACK_cpttrf( lapack_int* n, float* d, lapack_complex_float* e, lapack_int *info ); void LAPACK_zpttrf( lapack_int* n, double* d, lapack_complex_double* e, lapack_int *info ); void LAPACK_ssytrf( char* uplo, lapack_int* n, float* a, lapack_int* lda, lapack_int* ipiv, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dsytrf( char* uplo, lapack_int* n, double* a, lapack_int* lda, lapack_int* ipiv, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_csytrf( char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_int* ipiv, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zsytrf( char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_int* ipiv, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_chetrf( char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_int* ipiv, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zhetrf( char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_int* ipiv, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_ssptrf( char* uplo, lapack_int* n, float* ap, lapack_int* ipiv, lapack_int *info ); void LAPACK_dsptrf( char* uplo, lapack_int* n, double* ap, lapack_int* ipiv, lapack_int *info ); void LAPACK_csptrf( char* uplo, lapack_int* n, lapack_complex_float* ap, lapack_int* ipiv, lapack_int *info ); void LAPACK_zsptrf( char* uplo, lapack_int* n, lapack_complex_double* ap, lapack_int* ipiv, lapack_int *info ); void LAPACK_chptrf( char* uplo, lapack_int* n, lapack_complex_float* ap, lapack_int* ipiv, lapack_int *info ); void LAPACK_zhptrf( char* uplo, lapack_int* n, lapack_complex_double* ap, lapack_int* ipiv, lapack_int *info ); void LAPACK_sgetrs( char* trans, lapack_int* n, lapack_int* nrhs, const float* a, lapack_int* lda, const lapack_int* ipiv, float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dgetrs( char* trans, lapack_int* n, lapack_int* nrhs, const double* a, lapack_int* lda, const lapack_int* ipiv, double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_cgetrs( char* trans, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_zgetrs( char* trans, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_sgbtrs( char* trans, lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, const float* ab, lapack_int* ldab, const lapack_int* ipiv, float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dgbtrs( char* trans, lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, const double* ab, lapack_int* ldab, const lapack_int* ipiv, double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_cgbtrs( char* trans, lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, const lapack_complex_float* ab, lapack_int* ldab, const lapack_int* ipiv, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_zgbtrs( char* trans, lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, const lapack_complex_double* ab, lapack_int* ldab, const lapack_int* ipiv, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_sgttrs( char* trans, lapack_int* n, lapack_int* nrhs, const float* dl, const float* d, const float* du, const float* du2, const lapack_int* ipiv, float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dgttrs( char* trans, lapack_int* n, lapack_int* nrhs, const double* dl, const double* d, const double* du, const double* du2, const lapack_int* ipiv, double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_cgttrs( char* trans, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* dl, const lapack_complex_float* d, const lapack_complex_float* du, const lapack_complex_float* du2, const lapack_int* ipiv, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_zgttrs( char* trans, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* dl, const lapack_complex_double* d, const lapack_complex_double* du, const lapack_complex_double* du2, const lapack_int* ipiv, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_spotrs( char* uplo, lapack_int* n, lapack_int* nrhs, const float* a, lapack_int* lda, float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dpotrs( char* uplo, lapack_int* n, lapack_int* nrhs, const double* a, lapack_int* lda, double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_cpotrs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_zpotrs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dpftrs( char* transr, char* uplo, lapack_int* n, lapack_int* nrhs, const double* a, double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_spftrs( char* transr, char* uplo, lapack_int* n, lapack_int* nrhs, const float* a, float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_zpftrs( char* transr, char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* a, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_cpftrs( char* transr, char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* a, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_spptrs( char* uplo, lapack_int* n, lapack_int* nrhs, const float* ap, float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dpptrs( char* uplo, lapack_int* n, lapack_int* nrhs, const double* ap, double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_cpptrs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* ap, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_zpptrs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* ap, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_spbtrs( char* uplo, lapack_int* n, lapack_int* kd, lapack_int* nrhs, const float* ab, lapack_int* ldab, float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dpbtrs( char* uplo, lapack_int* n, lapack_int* kd, lapack_int* nrhs, const double* ab, lapack_int* ldab, double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_cpbtrs( char* uplo, lapack_int* n, lapack_int* kd, lapack_int* nrhs, const lapack_complex_float* ab, lapack_int* ldab, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_zpbtrs( char* uplo, lapack_int* n, lapack_int* kd, lapack_int* nrhs, const lapack_complex_double* ab, lapack_int* ldab, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_spttrs( lapack_int* n, lapack_int* nrhs, const float* d, const float* e, float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dpttrs( lapack_int* n, lapack_int* nrhs, const double* d, const double* e, double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_cpttrs( char* uplo, lapack_int* n, lapack_int* nrhs, const float* d, const lapack_complex_float* e, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_zpttrs( char* uplo, lapack_int* n, lapack_int* nrhs, const double* d, const lapack_complex_double* e, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_ssytrs( char* uplo, lapack_int* n, lapack_int* nrhs, const float* a, lapack_int* lda, const lapack_int* ipiv, float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dsytrs( char* uplo, lapack_int* n, lapack_int* nrhs, const double* a, lapack_int* lda, const lapack_int* ipiv, double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_csytrs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_zsytrs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_chetrs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_zhetrs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_ssptrs( char* uplo, lapack_int* n, lapack_int* nrhs, const float* ap, const lapack_int* ipiv, float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dsptrs( char* uplo, lapack_int* n, lapack_int* nrhs, const double* ap, const lapack_int* ipiv, double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_csptrs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* ap, const lapack_int* ipiv, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_zsptrs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* ap, const lapack_int* ipiv, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_chptrs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* ap, const lapack_int* ipiv, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_zhptrs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* ap, const lapack_int* ipiv, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_strtrs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* nrhs, const float* a, lapack_int* lda, float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dtrtrs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* nrhs, const double* a, lapack_int* lda, double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_ctrtrs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_ztrtrs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_stptrs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* nrhs, const float* ap, float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dtptrs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* nrhs, const double* ap, double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_ctptrs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* ap, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_ztptrs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* ap, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_stbtrs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* kd, lapack_int* nrhs, const float* ab, lapack_int* ldab, float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dtbtrs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* kd, lapack_int* nrhs, const double* ab, lapack_int* ldab, double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_ctbtrs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* kd, lapack_int* nrhs, const lapack_complex_float* ab, lapack_int* ldab, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_ztbtrs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* kd, lapack_int* nrhs, const lapack_complex_double* ab, lapack_int* ldab, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_sgecon( char* norm, lapack_int* n, const float* a, lapack_int* lda, float* anorm, float* rcond, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dgecon( char* norm, lapack_int* n, const double* a, lapack_int* lda, double* anorm, double* rcond, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_cgecon( char* norm, lapack_int* n, const lapack_complex_float* a, lapack_int* lda, float* anorm, float* rcond, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zgecon( char* norm, lapack_int* n, const lapack_complex_double* a, lapack_int* lda, double* anorm, double* rcond, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_sgbcon( char* norm, lapack_int* n, lapack_int* kl, lapack_int* ku, const float* ab, lapack_int* ldab, const lapack_int* ipiv, float* anorm, float* rcond, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dgbcon( char* norm, lapack_int* n, lapack_int* kl, lapack_int* ku, const double* ab, lapack_int* ldab, const lapack_int* ipiv, double* anorm, double* rcond, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_cgbcon( char* norm, lapack_int* n, lapack_int* kl, lapack_int* ku, const lapack_complex_float* ab, lapack_int* ldab, const lapack_int* ipiv, float* anorm, float* rcond, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zgbcon( char* norm, lapack_int* n, lapack_int* kl, lapack_int* ku, const lapack_complex_double* ab, lapack_int* ldab, const lapack_int* ipiv, double* anorm, double* rcond, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_sgtcon( char* norm, lapack_int* n, const float* dl, const float* d, const float* du, const float* du2, const lapack_int* ipiv, float* anorm, float* rcond, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dgtcon( char* norm, lapack_int* n, const double* dl, const double* d, const double* du, const double* du2, const lapack_int* ipiv, double* anorm, double* rcond, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_cgtcon( char* norm, lapack_int* n, const lapack_complex_float* dl, const lapack_complex_float* d, const lapack_complex_float* du, const lapack_complex_float* du2, const lapack_int* ipiv, float* anorm, float* rcond, lapack_complex_float* work, lapack_int *info ); void LAPACK_zgtcon( char* norm, lapack_int* n, const lapack_complex_double* dl, const lapack_complex_double* d, const lapack_complex_double* du, const lapack_complex_double* du2, const lapack_int* ipiv, double* anorm, double* rcond, lapack_complex_double* work, lapack_int *info ); void LAPACK_spocon( char* uplo, lapack_int* n, const float* a, lapack_int* lda, float* anorm, float* rcond, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dpocon( char* uplo, lapack_int* n, const double* a, lapack_int* lda, double* anorm, double* rcond, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_cpocon( char* uplo, lapack_int* n, const lapack_complex_float* a, lapack_int* lda, float* anorm, float* rcond, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zpocon( char* uplo, lapack_int* n, const lapack_complex_double* a, lapack_int* lda, double* anorm, double* rcond, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_sppcon( char* uplo, lapack_int* n, const float* ap, float* anorm, float* rcond, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dppcon( char* uplo, lapack_int* n, const double* ap, double* anorm, double* rcond, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_cppcon( char* uplo, lapack_int* n, const lapack_complex_float* ap, float* anorm, float* rcond, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zppcon( char* uplo, lapack_int* n, const lapack_complex_double* ap, double* anorm, double* rcond, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_spbcon( char* uplo, lapack_int* n, lapack_int* kd, const float* ab, lapack_int* ldab, float* anorm, float* rcond, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dpbcon( char* uplo, lapack_int* n, lapack_int* kd, const double* ab, lapack_int* ldab, double* anorm, double* rcond, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_cpbcon( char* uplo, lapack_int* n, lapack_int* kd, const lapack_complex_float* ab, lapack_int* ldab, float* anorm, float* rcond, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zpbcon( char* uplo, lapack_int* n, lapack_int* kd, const lapack_complex_double* ab, lapack_int* ldab, double* anorm, double* rcond, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_sptcon( lapack_int* n, const float* d, const float* e, float* anorm, float* rcond, float* work, lapack_int *info ); void LAPACK_dptcon( lapack_int* n, const double* d, const double* e, double* anorm, double* rcond, double* work, lapack_int *info ); void LAPACK_cptcon( lapack_int* n, const float* d, const lapack_complex_float* e, float* anorm, float* rcond, float* work, lapack_int *info ); void LAPACK_zptcon( lapack_int* n, const double* d, const lapack_complex_double* e, double* anorm, double* rcond, double* work, lapack_int *info ); void LAPACK_ssycon( char* uplo, lapack_int* n, const float* a, lapack_int* lda, const lapack_int* ipiv, float* anorm, float* rcond, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dsycon( char* uplo, lapack_int* n, const double* a, lapack_int* lda, const lapack_int* ipiv, double* anorm, double* rcond, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_csycon( char* uplo, lapack_int* n, const lapack_complex_float* a, lapack_int* lda, const lapack_int* ipiv, float* anorm, float* rcond, lapack_complex_float* work, lapack_int *info ); void LAPACK_zsycon( char* uplo, lapack_int* n, const lapack_complex_double* a, lapack_int* lda, const lapack_int* ipiv, double* anorm, double* rcond, lapack_complex_double* work, lapack_int *info ); void LAPACK_checon( char* uplo, lapack_int* n, const lapack_complex_float* a, lapack_int* lda, const lapack_int* ipiv, float* anorm, float* rcond, lapack_complex_float* work, lapack_int *info ); void LAPACK_zhecon( char* uplo, lapack_int* n, const lapack_complex_double* a, lapack_int* lda, const lapack_int* ipiv, double* anorm, double* rcond, lapack_complex_double* work, lapack_int *info ); void LAPACK_sspcon( char* uplo, lapack_int* n, const float* ap, const lapack_int* ipiv, float* anorm, float* rcond, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dspcon( char* uplo, lapack_int* n, const double* ap, const lapack_int* ipiv, double* anorm, double* rcond, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_cspcon( char* uplo, lapack_int* n, const lapack_complex_float* ap, const lapack_int* ipiv, float* anorm, float* rcond, lapack_complex_float* work, lapack_int *info ); void LAPACK_zspcon( char* uplo, lapack_int* n, const lapack_complex_double* ap, const lapack_int* ipiv, double* anorm, double* rcond, lapack_complex_double* work, lapack_int *info ); void LAPACK_chpcon( char* uplo, lapack_int* n, const lapack_complex_float* ap, const lapack_int* ipiv, float* anorm, float* rcond, lapack_complex_float* work, lapack_int *info ); void LAPACK_zhpcon( char* uplo, lapack_int* n, const lapack_complex_double* ap, const lapack_int* ipiv, double* anorm, double* rcond, lapack_complex_double* work, lapack_int *info ); void LAPACK_strcon( char* norm, char* uplo, char* diag, lapack_int* n, const float* a, lapack_int* lda, float* rcond, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dtrcon( char* norm, char* uplo, char* diag, lapack_int* n, const double* a, lapack_int* lda, double* rcond, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_ctrcon( char* norm, char* uplo, char* diag, lapack_int* n, const lapack_complex_float* a, lapack_int* lda, float* rcond, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_ztrcon( char* norm, char* uplo, char* diag, lapack_int* n, const lapack_complex_double* a, lapack_int* lda, double* rcond, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_stpcon( char* norm, char* uplo, char* diag, lapack_int* n, const float* ap, float* rcond, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dtpcon( char* norm, char* uplo, char* diag, lapack_int* n, const double* ap, double* rcond, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_ctpcon( char* norm, char* uplo, char* diag, lapack_int* n, const lapack_complex_float* ap, float* rcond, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_ztpcon( char* norm, char* uplo, char* diag, lapack_int* n, const lapack_complex_double* ap, double* rcond, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_stbcon( char* norm, char* uplo, char* diag, lapack_int* n, lapack_int* kd, const float* ab, lapack_int* ldab, float* rcond, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dtbcon( char* norm, char* uplo, char* diag, lapack_int* n, lapack_int* kd, const double* ab, lapack_int* ldab, double* rcond, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_ctbcon( char* norm, char* uplo, char* diag, lapack_int* n, lapack_int* kd, const lapack_complex_float* ab, lapack_int* ldab, float* rcond, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_ztbcon( char* norm, char* uplo, char* diag, lapack_int* n, lapack_int* kd, const lapack_complex_double* ab, lapack_int* ldab, double* rcond, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_sgerfs( char* trans, lapack_int* n, lapack_int* nrhs, const float* a, lapack_int* lda, const float* af, lapack_int* ldaf, const lapack_int* ipiv, const float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* ferr, float* berr, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dgerfs( char* trans, lapack_int* n, lapack_int* nrhs, const double* a, lapack_int* lda, const double* af, lapack_int* ldaf, const lapack_int* ipiv, const double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* ferr, double* berr, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_cgerfs( char* trans, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* af, lapack_int* ldaf, const lapack_int* ipiv, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zgerfs( char* trans, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* af, lapack_int* ldaf, const lapack_int* ipiv, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_dgerfsx( char* trans, char* equed, lapack_int* n, lapack_int* nrhs, const double* a, lapack_int* lda, const double* af, lapack_int* ldaf, const lapack_int* ipiv, const double* r, const double* c, const double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* rcond, double* berr, lapack_int* n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int* nparams, double* params, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_sgerfsx( char* trans, char* equed, lapack_int* n, lapack_int* nrhs, const float* a, lapack_int* lda, const float* af, lapack_int* ldaf, const lapack_int* ipiv, const float* r, const float* c, const float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* rcond, float* berr, lapack_int* n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int* nparams, float* params, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_zgerfsx( char* trans, char* equed, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* af, lapack_int* ldaf, const lapack_int* ipiv, const double* r, const double* c, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* rcond, double* berr, lapack_int* n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int* nparams, double* params, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_cgerfsx( char* trans, char* equed, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* af, lapack_int* ldaf, const lapack_int* ipiv, const float* r, const float* c, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* rcond, float* berr, lapack_int* n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int* nparams, float* params, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_sgbrfs( char* trans, lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, const float* ab, lapack_int* ldab, const float* afb, lapack_int* ldafb, const lapack_int* ipiv, const float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* ferr, float* berr, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dgbrfs( char* trans, lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, const double* ab, lapack_int* ldab, const double* afb, lapack_int* ldafb, const lapack_int* ipiv, const double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* ferr, double* berr, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_cgbrfs( char* trans, lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, const lapack_complex_float* ab, lapack_int* ldab, const lapack_complex_float* afb, lapack_int* ldafb, const lapack_int* ipiv, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zgbrfs( char* trans, lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, const lapack_complex_double* ab, lapack_int* ldab, const lapack_complex_double* afb, lapack_int* ldafb, const lapack_int* ipiv, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_dgbrfsx( char* trans, char* equed, lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, const double* ab, lapack_int* ldab, const double* afb, lapack_int* ldafb, const lapack_int* ipiv, const double* r, const double* c, const double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* rcond, double* berr, lapack_int* n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int* nparams, double* params, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_sgbrfsx( char* trans, char* equed, lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, const float* ab, lapack_int* ldab, const float* afb, lapack_int* ldafb, const lapack_int* ipiv, const float* r, const float* c, const float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* rcond, float* berr, lapack_int* n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int* nparams, float* params, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_zgbrfsx( char* trans, char* equed, lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, const lapack_complex_double* ab, lapack_int* ldab, const lapack_complex_double* afb, lapack_int* ldafb, const lapack_int* ipiv, const double* r, const double* c, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* rcond, double* berr, lapack_int* n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int* nparams, double* params, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_cgbrfsx( char* trans, char* equed, lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, const lapack_complex_float* ab, lapack_int* ldab, const lapack_complex_float* afb, lapack_int* ldafb, const lapack_int* ipiv, const float* r, const float* c, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* rcond, float* berr, lapack_int* n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int* nparams, float* params, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_sgtrfs( char* trans, lapack_int* n, lapack_int* nrhs, const float* dl, const float* d, const float* du, const float* dlf, const float* df, const float* duf, const float* du2, const lapack_int* ipiv, const float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* ferr, float* berr, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dgtrfs( char* trans, lapack_int* n, lapack_int* nrhs, const double* dl, const double* d, const double* du, const double* dlf, const double* df, const double* duf, const double* du2, const lapack_int* ipiv, const double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* ferr, double* berr, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_cgtrfs( char* trans, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* dl, const lapack_complex_float* d, const lapack_complex_float* du, const lapack_complex_float* dlf, const lapack_complex_float* df, const lapack_complex_float* duf, const lapack_complex_float* du2, const lapack_int* ipiv, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zgtrfs( char* trans, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* dl, const lapack_complex_double* d, const lapack_complex_double* du, const lapack_complex_double* dlf, const lapack_complex_double* df, const lapack_complex_double* duf, const lapack_complex_double* du2, const lapack_int* ipiv, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_sporfs( char* uplo, lapack_int* n, lapack_int* nrhs, const float* a, lapack_int* lda, const float* af, lapack_int* ldaf, const float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* ferr, float* berr, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dporfs( char* uplo, lapack_int* n, lapack_int* nrhs, const double* a, lapack_int* lda, const double* af, lapack_int* ldaf, const double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* ferr, double* berr, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_cporfs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* af, lapack_int* ldaf, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zporfs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* af, lapack_int* ldaf, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_dporfsx( char* uplo, char* equed, lapack_int* n, lapack_int* nrhs, const double* a, lapack_int* lda, const double* af, lapack_int* ldaf, const double* s, const double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* rcond, double* berr, lapack_int* n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int* nparams, double* params, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_sporfsx( char* uplo, char* equed, lapack_int* n, lapack_int* nrhs, const float* a, lapack_int* lda, const float* af, lapack_int* ldaf, const float* s, const float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* rcond, float* berr, lapack_int* n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int* nparams, float* params, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_zporfsx( char* uplo, char* equed, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* af, lapack_int* ldaf, const double* s, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* rcond, double* berr, lapack_int* n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int* nparams, double* params, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_cporfsx( char* uplo, char* equed, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* af, lapack_int* ldaf, const float* s, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* rcond, float* berr, lapack_int* n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int* nparams, float* params, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_spprfs( char* uplo, lapack_int* n, lapack_int* nrhs, const float* ap, const float* afp, const float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* ferr, float* berr, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dpprfs( char* uplo, lapack_int* n, lapack_int* nrhs, const double* ap, const double* afp, const double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* ferr, double* berr, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_cpprfs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* ap, const lapack_complex_float* afp, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zpprfs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* ap, const lapack_complex_double* afp, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_spbrfs( char* uplo, lapack_int* n, lapack_int* kd, lapack_int* nrhs, const float* ab, lapack_int* ldab, const float* afb, lapack_int* ldafb, const float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* ferr, float* berr, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dpbrfs( char* uplo, lapack_int* n, lapack_int* kd, lapack_int* nrhs, const double* ab, lapack_int* ldab, const double* afb, lapack_int* ldafb, const double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* ferr, double* berr, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_cpbrfs( char* uplo, lapack_int* n, lapack_int* kd, lapack_int* nrhs, const lapack_complex_float* ab, lapack_int* ldab, const lapack_complex_float* afb, lapack_int* ldafb, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zpbrfs( char* uplo, lapack_int* n, lapack_int* kd, lapack_int* nrhs, const lapack_complex_double* ab, lapack_int* ldab, const lapack_complex_double* afb, lapack_int* ldafb, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_sptrfs( lapack_int* n, lapack_int* nrhs, const float* d, const float* e, const float* df, const float* ef, const float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* ferr, float* berr, float* work, lapack_int *info ); void LAPACK_dptrfs( lapack_int* n, lapack_int* nrhs, const double* d, const double* e, const double* df, const double* ef, const double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* ferr, double* berr, double* work, lapack_int *info ); void LAPACK_cptrfs( char* uplo, lapack_int* n, lapack_int* nrhs, const float* d, const lapack_complex_float* e, const float* df, const lapack_complex_float* ef, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zptrfs( char* uplo, lapack_int* n, lapack_int* nrhs, const double* d, const lapack_complex_double* e, const double* df, const lapack_complex_double* ef, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_ssyrfs( char* uplo, lapack_int* n, lapack_int* nrhs, const float* a, lapack_int* lda, const float* af, lapack_int* ldaf, const lapack_int* ipiv, const float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* ferr, float* berr, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dsyrfs( char* uplo, lapack_int* n, lapack_int* nrhs, const double* a, lapack_int* lda, const double* af, lapack_int* ldaf, const lapack_int* ipiv, const double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* ferr, double* berr, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_csyrfs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* af, lapack_int* ldaf, const lapack_int* ipiv, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zsyrfs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* af, lapack_int* ldaf, const lapack_int* ipiv, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_dsyrfsx( char* uplo, char* equed, lapack_int* n, lapack_int* nrhs, const double* a, lapack_int* lda, const double* af, lapack_int* ldaf, const lapack_int* ipiv, const double* s, const double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* rcond, double* berr, lapack_int* n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int* nparams, double* params, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_ssyrfsx( char* uplo, char* equed, lapack_int* n, lapack_int* nrhs, const float* a, lapack_int* lda, const float* af, lapack_int* ldaf, const lapack_int* ipiv, const float* s, const float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* rcond, float* berr, lapack_int* n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int* nparams, float* params, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_zsyrfsx( char* uplo, char* equed, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* af, lapack_int* ldaf, const lapack_int* ipiv, const double* s, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* rcond, double* berr, lapack_int* n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int* nparams, double* params, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_csyrfsx( char* uplo, char* equed, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* af, lapack_int* ldaf, const lapack_int* ipiv, const float* s, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* rcond, float* berr, lapack_int* n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int* nparams, float* params, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_cherfs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* af, lapack_int* ldaf, const lapack_int* ipiv, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zherfs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* af, lapack_int* ldaf, const lapack_int* ipiv, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_zherfsx( char* uplo, char* equed, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* af, lapack_int* ldaf, const lapack_int* ipiv, const double* s, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* rcond, double* berr, lapack_int* n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int* nparams, double* params, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_cherfsx( char* uplo, char* equed, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* af, lapack_int* ldaf, const lapack_int* ipiv, const float* s, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* rcond, float* berr, lapack_int* n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int* nparams, float* params, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_ssprfs( char* uplo, lapack_int* n, lapack_int* nrhs, const float* ap, const float* afp, const lapack_int* ipiv, const float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* ferr, float* berr, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dsprfs( char* uplo, lapack_int* n, lapack_int* nrhs, const double* ap, const double* afp, const lapack_int* ipiv, const double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* ferr, double* berr, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_csprfs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* ap, const lapack_complex_float* afp, const lapack_int* ipiv, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zsprfs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* ap, const lapack_complex_double* afp, const lapack_int* ipiv, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_chprfs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* ap, const lapack_complex_float* afp, const lapack_int* ipiv, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zhprfs( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* ap, const lapack_complex_double* afp, const lapack_int* ipiv, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_strrfs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* nrhs, const float* a, lapack_int* lda, const float* b, lapack_int* ldb, const float* x, lapack_int* ldx, float* ferr, float* berr, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dtrrfs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* nrhs, const double* a, lapack_int* lda, const double* b, lapack_int* ldb, const double* x, lapack_int* ldx, double* ferr, double* berr, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_ctrrfs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* b, lapack_int* ldb, const lapack_complex_float* x, lapack_int* ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_ztrrfs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* b, lapack_int* ldb, const lapack_complex_double* x, lapack_int* ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_stprfs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* nrhs, const float* ap, const float* b, lapack_int* ldb, const float* x, lapack_int* ldx, float* ferr, float* berr, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dtprfs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* nrhs, const double* ap, const double* b, lapack_int* ldb, const double* x, lapack_int* ldx, double* ferr, double* berr, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_ctprfs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* ap, const lapack_complex_float* b, lapack_int* ldb, const lapack_complex_float* x, lapack_int* ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_ztprfs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* ap, const lapack_complex_double* b, lapack_int* ldb, const lapack_complex_double* x, lapack_int* ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_stbrfs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* kd, lapack_int* nrhs, const float* ab, lapack_int* ldab, const float* b, lapack_int* ldb, const float* x, lapack_int* ldx, float* ferr, float* berr, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dtbrfs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* kd, lapack_int* nrhs, const double* ab, lapack_int* ldab, const double* b, lapack_int* ldb, const double* x, lapack_int* ldx, double* ferr, double* berr, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_ctbrfs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* kd, lapack_int* nrhs, const lapack_complex_float* ab, lapack_int* ldab, const lapack_complex_float* b, lapack_int* ldb, const lapack_complex_float* x, lapack_int* ldx, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_ztbrfs( char* uplo, char* trans, char* diag, lapack_int* n, lapack_int* kd, lapack_int* nrhs, const lapack_complex_double* ab, lapack_int* ldab, const lapack_complex_double* b, lapack_int* ldb, const lapack_complex_double* x, lapack_int* ldx, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_sgetri( lapack_int* n, float* a, lapack_int* lda, const lapack_int* ipiv, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dgetri( lapack_int* n, double* a, lapack_int* lda, const lapack_int* ipiv, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cgetri( lapack_int* n, lapack_complex_float* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zgetri( lapack_int* n, lapack_complex_double* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_spotri( char* uplo, lapack_int* n, float* a, lapack_int* lda, lapack_int *info ); void LAPACK_dpotri( char* uplo, lapack_int* n, double* a, lapack_int* lda, lapack_int *info ); void LAPACK_cpotri( char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_int *info ); void LAPACK_zpotri( char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_int *info ); void LAPACK_dpftri( char* transr, char* uplo, lapack_int* n, double* a, lapack_int *info ); void LAPACK_spftri( char* transr, char* uplo, lapack_int* n, float* a, lapack_int *info ); void LAPACK_zpftri( char* transr, char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int *info ); void LAPACK_cpftri( char* transr, char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int *info ); void LAPACK_spptri( char* uplo, lapack_int* n, float* ap, lapack_int *info ); void LAPACK_dpptri( char* uplo, lapack_int* n, double* ap, lapack_int *info ); void LAPACK_cpptri( char* uplo, lapack_int* n, lapack_complex_float* ap, lapack_int *info ); void LAPACK_zpptri( char* uplo, lapack_int* n, lapack_complex_double* ap, lapack_int *info ); void LAPACK_ssytri( char* uplo, lapack_int* n, float* a, lapack_int* lda, const lapack_int* ipiv, float* work, lapack_int *info ); void LAPACK_dsytri( char* uplo, lapack_int* n, double* a, lapack_int* lda, const lapack_int* ipiv, double* work, lapack_int *info ); void LAPACK_csytri( char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_float* work, lapack_int *info ); void LAPACK_zsytri( char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_double* work, lapack_int *info ); void LAPACK_chetri( char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_float* work, lapack_int *info ); void LAPACK_zhetri( char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_double* work, lapack_int *info ); void LAPACK_ssptri( char* uplo, lapack_int* n, float* ap, const lapack_int* ipiv, float* work, lapack_int *info ); void LAPACK_dsptri( char* uplo, lapack_int* n, double* ap, const lapack_int* ipiv, double* work, lapack_int *info ); void LAPACK_csptri( char* uplo, lapack_int* n, lapack_complex_float* ap, const lapack_int* ipiv, lapack_complex_float* work, lapack_int *info ); void LAPACK_zsptri( char* uplo, lapack_int* n, lapack_complex_double* ap, const lapack_int* ipiv, lapack_complex_double* work, lapack_int *info ); void LAPACK_chptri( char* uplo, lapack_int* n, lapack_complex_float* ap, const lapack_int* ipiv, lapack_complex_float* work, lapack_int *info ); void LAPACK_zhptri( char* uplo, lapack_int* n, lapack_complex_double* ap, const lapack_int* ipiv, lapack_complex_double* work, lapack_int *info ); void LAPACK_strtri( char* uplo, char* diag, lapack_int* n, float* a, lapack_int* lda, lapack_int *info ); void LAPACK_dtrtri( char* uplo, char* diag, lapack_int* n, double* a, lapack_int* lda, lapack_int *info ); void LAPACK_ctrtri( char* uplo, char* diag, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_int *info ); void LAPACK_ztrtri( char* uplo, char* diag, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_int *info ); void LAPACK_dtftri( char* transr, char* uplo, char* diag, lapack_int* n, double* a, lapack_int *info ); void LAPACK_stftri( char* transr, char* uplo, char* diag, lapack_int* n, float* a, lapack_int *info ); void LAPACK_ztftri( char* transr, char* uplo, char* diag, lapack_int* n, lapack_complex_double* a, lapack_int *info ); void LAPACK_ctftri( char* transr, char* uplo, char* diag, lapack_int* n, lapack_complex_float* a, lapack_int *info ); void LAPACK_stptri( char* uplo, char* diag, lapack_int* n, float* ap, lapack_int *info ); void LAPACK_dtptri( char* uplo, char* diag, lapack_int* n, double* ap, lapack_int *info ); void LAPACK_ctptri( char* uplo, char* diag, lapack_int* n, lapack_complex_float* ap, lapack_int *info ); void LAPACK_ztptri( char* uplo, char* diag, lapack_int* n, lapack_complex_double* ap, lapack_int *info ); void LAPACK_sgeequ( lapack_int* m, lapack_int* n, const float* a, lapack_int* lda, float* r, float* c, float* rowcnd, float* colcnd, float* amax, lapack_int *info ); void LAPACK_dgeequ( lapack_int* m, lapack_int* n, const double* a, lapack_int* lda, double* r, double* c, double* rowcnd, double* colcnd, double* amax, lapack_int *info ); void LAPACK_cgeequ( lapack_int* m, lapack_int* n, const lapack_complex_float* a, lapack_int* lda, float* r, float* c, float* rowcnd, float* colcnd, float* amax, lapack_int *info ); void LAPACK_zgeequ( lapack_int* m, lapack_int* n, const lapack_complex_double* a, lapack_int* lda, double* r, double* c, double* rowcnd, double* colcnd, double* amax, lapack_int *info ); void LAPACK_dgeequb( lapack_int* m, lapack_int* n, const double* a, lapack_int* lda, double* r, double* c, double* rowcnd, double* colcnd, double* amax, lapack_int *info ); void LAPACK_sgeequb( lapack_int* m, lapack_int* n, const float* a, lapack_int* lda, float* r, float* c, float* rowcnd, float* colcnd, float* amax, lapack_int *info ); void LAPACK_zgeequb( lapack_int* m, lapack_int* n, const lapack_complex_double* a, lapack_int* lda, double* r, double* c, double* rowcnd, double* colcnd, double* amax, lapack_int *info ); void LAPACK_cgeequb( lapack_int* m, lapack_int* n, const lapack_complex_float* a, lapack_int* lda, float* r, float* c, float* rowcnd, float* colcnd, float* amax, lapack_int *info ); void LAPACK_sgbequ( lapack_int* m, lapack_int* n, lapack_int* kl, lapack_int* ku, const float* ab, lapack_int* ldab, float* r, float* c, float* rowcnd, float* colcnd, float* amax, lapack_int *info ); void LAPACK_dgbequ( lapack_int* m, lapack_int* n, lapack_int* kl, lapack_int* ku, const double* ab, lapack_int* ldab, double* r, double* c, double* rowcnd, double* colcnd, double* amax, lapack_int *info ); void LAPACK_cgbequ( lapack_int* m, lapack_int* n, lapack_int* kl, lapack_int* ku, const lapack_complex_float* ab, lapack_int* ldab, float* r, float* c, float* rowcnd, float* colcnd, float* amax, lapack_int *info ); void LAPACK_zgbequ( lapack_int* m, lapack_int* n, lapack_int* kl, lapack_int* ku, const lapack_complex_double* ab, lapack_int* ldab, double* r, double* c, double* rowcnd, double* colcnd, double* amax, lapack_int *info ); void LAPACK_dgbequb( lapack_int* m, lapack_int* n, lapack_int* kl, lapack_int* ku, const double* ab, lapack_int* ldab, double* r, double* c, double* rowcnd, double* colcnd, double* amax, lapack_int *info ); void LAPACK_sgbequb( lapack_int* m, lapack_int* n, lapack_int* kl, lapack_int* ku, const float* ab, lapack_int* ldab, float* r, float* c, float* rowcnd, float* colcnd, float* amax, lapack_int *info ); void LAPACK_zgbequb( lapack_int* m, lapack_int* n, lapack_int* kl, lapack_int* ku, const lapack_complex_double* ab, lapack_int* ldab, double* r, double* c, double* rowcnd, double* colcnd, double* amax, lapack_int *info ); void LAPACK_cgbequb( lapack_int* m, lapack_int* n, lapack_int* kl, lapack_int* ku, const lapack_complex_float* ab, lapack_int* ldab, float* r, float* c, float* rowcnd, float* colcnd, float* amax, lapack_int *info ); void LAPACK_spoequ( lapack_int* n, const float* a, lapack_int* lda, float* s, float* scond, float* amax, lapack_int *info ); void LAPACK_dpoequ( lapack_int* n, const double* a, lapack_int* lda, double* s, double* scond, double* amax, lapack_int *info ); void LAPACK_cpoequ( lapack_int* n, const lapack_complex_float* a, lapack_int* lda, float* s, float* scond, float* amax, lapack_int *info ); void LAPACK_zpoequ( lapack_int* n, const lapack_complex_double* a, lapack_int* lda, double* s, double* scond, double* amax, lapack_int *info ); void LAPACK_dpoequb( lapack_int* n, const double* a, lapack_int* lda, double* s, double* scond, double* amax, lapack_int *info ); void LAPACK_spoequb( lapack_int* n, const float* a, lapack_int* lda, float* s, float* scond, float* amax, lapack_int *info ); void LAPACK_zpoequb( lapack_int* n, const lapack_complex_double* a, lapack_int* lda, double* s, double* scond, double* amax, lapack_int *info ); void LAPACK_cpoequb( lapack_int* n, const lapack_complex_float* a, lapack_int* lda, float* s, float* scond, float* amax, lapack_int *info ); void LAPACK_sppequ( char* uplo, lapack_int* n, const float* ap, float* s, float* scond, float* amax, lapack_int *info ); void LAPACK_dppequ( char* uplo, lapack_int* n, const double* ap, double* s, double* scond, double* amax, lapack_int *info ); void LAPACK_cppequ( char* uplo, lapack_int* n, const lapack_complex_float* ap, float* s, float* scond, float* amax, lapack_int *info ); void LAPACK_zppequ( char* uplo, lapack_int* n, const lapack_complex_double* ap, double* s, double* scond, double* amax, lapack_int *info ); void LAPACK_spbequ( char* uplo, lapack_int* n, lapack_int* kd, const float* ab, lapack_int* ldab, float* s, float* scond, float* amax, lapack_int *info ); void LAPACK_dpbequ( char* uplo, lapack_int* n, lapack_int* kd, const double* ab, lapack_int* ldab, double* s, double* scond, double* amax, lapack_int *info ); void LAPACK_cpbequ( char* uplo, lapack_int* n, lapack_int* kd, const lapack_complex_float* ab, lapack_int* ldab, float* s, float* scond, float* amax, lapack_int *info ); void LAPACK_zpbequ( char* uplo, lapack_int* n, lapack_int* kd, const lapack_complex_double* ab, lapack_int* ldab, double* s, double* scond, double* amax, lapack_int *info ); void LAPACK_dsyequb( char* uplo, lapack_int* n, const double* a, lapack_int* lda, double* s, double* scond, double* amax, double* work, lapack_int *info ); void LAPACK_ssyequb( char* uplo, lapack_int* n, const float* a, lapack_int* lda, float* s, float* scond, float* amax, float* work, lapack_int *info ); void LAPACK_zsyequb( char* uplo, lapack_int* n, const lapack_complex_double* a, lapack_int* lda, double* s, double* scond, double* amax, lapack_complex_double* work, lapack_int *info ); void LAPACK_csyequb( char* uplo, lapack_int* n, const lapack_complex_float* a, lapack_int* lda, float* s, float* scond, float* amax, lapack_complex_float* work, lapack_int *info ); void LAPACK_zheequb( char* uplo, lapack_int* n, const lapack_complex_double* a, lapack_int* lda, double* s, double* scond, double* amax, lapack_complex_double* work, lapack_int *info ); void LAPACK_cheequb( char* uplo, lapack_int* n, const lapack_complex_float* a, lapack_int* lda, float* s, float* scond, float* amax, lapack_complex_float* work, lapack_int *info ); void LAPACK_sgesv( lapack_int* n, lapack_int* nrhs, float* a, lapack_int* lda, lapack_int* ipiv, float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dgesv( lapack_int* n, lapack_int* nrhs, double* a, lapack_int* lda, lapack_int* ipiv, double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_cgesv( lapack_int* n, lapack_int* nrhs, lapack_complex_float* a, lapack_int* lda, lapack_int* ipiv, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_zgesv( lapack_int* n, lapack_int* nrhs, lapack_complex_double* a, lapack_int* lda, lapack_int* ipiv, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dsgesv( lapack_int* n, lapack_int* nrhs, double* a, lapack_int* lda, lapack_int* ipiv, double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* work, float* swork, lapack_int* iter, lapack_int *info ); void LAPACK_zcgesv( lapack_int* n, lapack_int* nrhs, lapack_complex_double* a, lapack_int* lda, lapack_int* ipiv, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, lapack_complex_double* work, lapack_complex_float* swork, double* rwork, lapack_int* iter, lapack_int *info ); void LAPACK_sgesvx( char* fact, char* trans, lapack_int* n, lapack_int* nrhs, float* a, lapack_int* lda, float* af, lapack_int* ldaf, lapack_int* ipiv, char* equed, float* r, float* c, float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* rcond, float* ferr, float* berr, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dgesvx( char* fact, char* trans, lapack_int* n, lapack_int* nrhs, double* a, lapack_int* lda, double* af, lapack_int* ldaf, lapack_int* ipiv, char* equed, double* r, double* c, double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* rcond, double* ferr, double* berr, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_cgesvx( char* fact, char* trans, lapack_int* n, lapack_int* nrhs, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* af, lapack_int* ldaf, lapack_int* ipiv, char* equed, float* r, float* c, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* rcond, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zgesvx( char* fact, char* trans, lapack_int* n, lapack_int* nrhs, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* af, lapack_int* ldaf, lapack_int* ipiv, char* equed, double* r, double* c, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* rcond, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_dgesvxx( char* fact, char* trans, lapack_int* n, lapack_int* nrhs, double* a, lapack_int* lda, double* af, lapack_int* ldaf, lapack_int* ipiv, char* equed, double* r, double* c, double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* rcond, double* rpvgrw, double* berr, lapack_int* n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int* nparams, double* params, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_sgesvxx( char* fact, char* trans, lapack_int* n, lapack_int* nrhs, float* a, lapack_int* lda, float* af, lapack_int* ldaf, lapack_int* ipiv, char* equed, float* r, float* c, float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* rcond, float* rpvgrw, float* berr, lapack_int* n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int* nparams, float* params, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_zgesvxx( char* fact, char* trans, lapack_int* n, lapack_int* nrhs, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* af, lapack_int* ldaf, lapack_int* ipiv, char* equed, double* r, double* c, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* rcond, double* rpvgrw, double* berr, lapack_int* n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int* nparams, double* params, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_cgesvxx( char* fact, char* trans, lapack_int* n, lapack_int* nrhs, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* af, lapack_int* ldaf, lapack_int* ipiv, char* equed, float* r, float* c, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* rcond, float* rpvgrw, float* berr, lapack_int* n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int* nparams, float* params, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_sgbsv( lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, float* ab, lapack_int* ldab, lapack_int* ipiv, float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dgbsv( lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, double* ab, lapack_int* ldab, lapack_int* ipiv, double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_cgbsv( lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, lapack_complex_float* ab, lapack_int* ldab, lapack_int* ipiv, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_zgbsv( lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, lapack_complex_double* ab, lapack_int* ldab, lapack_int* ipiv, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_sgbsvx( char* fact, char* trans, lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, float* ab, lapack_int* ldab, float* afb, lapack_int* ldafb, lapack_int* ipiv, char* equed, float* r, float* c, float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* rcond, float* ferr, float* berr, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dgbsvx( char* fact, char* trans, lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, double* ab, lapack_int* ldab, double* afb, lapack_int* ldafb, lapack_int* ipiv, char* equed, double* r, double* c, double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* rcond, double* ferr, double* berr, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_cgbsvx( char* fact, char* trans, lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, lapack_complex_float* ab, lapack_int* ldab, lapack_complex_float* afb, lapack_int* ldafb, lapack_int* ipiv, char* equed, float* r, float* c, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* rcond, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zgbsvx( char* fact, char* trans, lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, lapack_complex_double* ab, lapack_int* ldab, lapack_complex_double* afb, lapack_int* ldafb, lapack_int* ipiv, char* equed, double* r, double* c, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* rcond, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_dgbsvxx( char* fact, char* trans, lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, double* ab, lapack_int* ldab, double* afb, lapack_int* ldafb, lapack_int* ipiv, char* equed, double* r, double* c, double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* rcond, double* rpvgrw, double* berr, lapack_int* n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int* nparams, double* params, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_sgbsvxx( char* fact, char* trans, lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, float* ab, lapack_int* ldab, float* afb, lapack_int* ldafb, lapack_int* ipiv, char* equed, float* r, float* c, float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* rcond, float* rpvgrw, float* berr, lapack_int* n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int* nparams, float* params, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_zgbsvxx( char* fact, char* trans, lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, lapack_complex_double* ab, lapack_int* ldab, lapack_complex_double* afb, lapack_int* ldafb, lapack_int* ipiv, char* equed, double* r, double* c, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* rcond, double* rpvgrw, double* berr, lapack_int* n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int* nparams, double* params, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_cgbsvxx( char* fact, char* trans, lapack_int* n, lapack_int* kl, lapack_int* ku, lapack_int* nrhs, lapack_complex_float* ab, lapack_int* ldab, lapack_complex_float* afb, lapack_int* ldafb, lapack_int* ipiv, char* equed, float* r, float* c, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* rcond, float* rpvgrw, float* berr, lapack_int* n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int* nparams, float* params, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_sgtsv( lapack_int* n, lapack_int* nrhs, float* dl, float* d, float* du, float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dgtsv( lapack_int* n, lapack_int* nrhs, double* dl, double* d, double* du, double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_cgtsv( lapack_int* n, lapack_int* nrhs, lapack_complex_float* dl, lapack_complex_float* d, lapack_complex_float* du, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_zgtsv( lapack_int* n, lapack_int* nrhs, lapack_complex_double* dl, lapack_complex_double* d, lapack_complex_double* du, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_sgtsvx( char* fact, char* trans, lapack_int* n, lapack_int* nrhs, const float* dl, const float* d, const float* du, float* dlf, float* df, float* duf, float* du2, lapack_int* ipiv, const float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* rcond, float* ferr, float* berr, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dgtsvx( char* fact, char* trans, lapack_int* n, lapack_int* nrhs, const double* dl, const double* d, const double* du, double* dlf, double* df, double* duf, double* du2, lapack_int* ipiv, const double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* rcond, double* ferr, double* berr, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_cgtsvx( char* fact, char* trans, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* dl, const lapack_complex_float* d, const lapack_complex_float* du, lapack_complex_float* dlf, lapack_complex_float* df, lapack_complex_float* duf, lapack_complex_float* du2, lapack_int* ipiv, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* rcond, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zgtsvx( char* fact, char* trans, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* dl, const lapack_complex_double* d, const lapack_complex_double* du, lapack_complex_double* dlf, lapack_complex_double* df, lapack_complex_double* duf, lapack_complex_double* du2, lapack_int* ipiv, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* rcond, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_sposv( char* uplo, lapack_int* n, lapack_int* nrhs, float* a, lapack_int* lda, float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dposv( char* uplo, lapack_int* n, lapack_int* nrhs, double* a, lapack_int* lda, double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_cposv( char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_zposv( char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dsposv( char* uplo, lapack_int* n, lapack_int* nrhs, double* a, lapack_int* lda, double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* work, float* swork, lapack_int* iter, lapack_int *info ); void LAPACK_zcposv( char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, lapack_complex_double* work, lapack_complex_float* swork, double* rwork, lapack_int* iter, lapack_int *info ); void LAPACK_sposvx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, float* a, lapack_int* lda, float* af, lapack_int* ldaf, char* equed, float* s, float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* rcond, float* ferr, float* berr, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dposvx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, double* a, lapack_int* lda, double* af, lapack_int* ldaf, char* equed, double* s, double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* rcond, double* ferr, double* berr, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_cposvx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* af, lapack_int* ldaf, char* equed, float* s, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* rcond, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zposvx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* af, lapack_int* ldaf, char* equed, double* s, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* rcond, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_dposvxx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, double* a, lapack_int* lda, double* af, lapack_int* ldaf, char* equed, double* s, double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* rcond, double* rpvgrw, double* berr, lapack_int* n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int* nparams, double* params, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_sposvxx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, float* a, lapack_int* lda, float* af, lapack_int* ldaf, char* equed, float* s, float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* rcond, float* rpvgrw, float* berr, lapack_int* n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int* nparams, float* params, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_zposvxx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* af, lapack_int* ldaf, char* equed, double* s, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* rcond, double* rpvgrw, double* berr, lapack_int* n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int* nparams, double* params, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_cposvxx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* af, lapack_int* ldaf, char* equed, float* s, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* rcond, float* rpvgrw, float* berr, lapack_int* n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int* nparams, float* params, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_sppsv( char* uplo, lapack_int* n, lapack_int* nrhs, float* ap, float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dppsv( char* uplo, lapack_int* n, lapack_int* nrhs, double* ap, double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_cppsv( char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_float* ap, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_zppsv( char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_double* ap, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_sppsvx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, float* ap, float* afp, char* equed, float* s, float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* rcond, float* ferr, float* berr, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dppsvx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, double* ap, double* afp, char* equed, double* s, double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* rcond, double* ferr, double* berr, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_cppsvx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_float* ap, lapack_complex_float* afp, char* equed, float* s, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* rcond, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zppsvx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_double* ap, lapack_complex_double* afp, char* equed, double* s, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* rcond, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_spbsv( char* uplo, lapack_int* n, lapack_int* kd, lapack_int* nrhs, float* ab, lapack_int* ldab, float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dpbsv( char* uplo, lapack_int* n, lapack_int* kd, lapack_int* nrhs, double* ab, lapack_int* ldab, double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_cpbsv( char* uplo, lapack_int* n, lapack_int* kd, lapack_int* nrhs, lapack_complex_float* ab, lapack_int* ldab, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_zpbsv( char* uplo, lapack_int* n, lapack_int* kd, lapack_int* nrhs, lapack_complex_double* ab, lapack_int* ldab, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_spbsvx( char* fact, char* uplo, lapack_int* n, lapack_int* kd, lapack_int* nrhs, float* ab, lapack_int* ldab, float* afb, lapack_int* ldafb, char* equed, float* s, float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* rcond, float* ferr, float* berr, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dpbsvx( char* fact, char* uplo, lapack_int* n, lapack_int* kd, lapack_int* nrhs, double* ab, lapack_int* ldab, double* afb, lapack_int* ldafb, char* equed, double* s, double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* rcond, double* ferr, double* berr, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_cpbsvx( char* fact, char* uplo, lapack_int* n, lapack_int* kd, lapack_int* nrhs, lapack_complex_float* ab, lapack_int* ldab, lapack_complex_float* afb, lapack_int* ldafb, char* equed, float* s, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* rcond, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zpbsvx( char* fact, char* uplo, lapack_int* n, lapack_int* kd, lapack_int* nrhs, lapack_complex_double* ab, lapack_int* ldab, lapack_complex_double* afb, lapack_int* ldafb, char* equed, double* s, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* rcond, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_sptsv( lapack_int* n, lapack_int* nrhs, float* d, float* e, float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dptsv( lapack_int* n, lapack_int* nrhs, double* d, double* e, double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_cptsv( lapack_int* n, lapack_int* nrhs, float* d, lapack_complex_float* e, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_zptsv( lapack_int* n, lapack_int* nrhs, double* d, lapack_complex_double* e, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_sptsvx( char* fact, lapack_int* n, lapack_int* nrhs, const float* d, const float* e, float* df, float* ef, const float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* rcond, float* ferr, float* berr, float* work, lapack_int *info ); void LAPACK_dptsvx( char* fact, lapack_int* n, lapack_int* nrhs, const double* d, const double* e, double* df, double* ef, const double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* rcond, double* ferr, double* berr, double* work, lapack_int *info ); void LAPACK_cptsvx( char* fact, lapack_int* n, lapack_int* nrhs, const float* d, const lapack_complex_float* e, float* df, lapack_complex_float* ef, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* rcond, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zptsvx( char* fact, lapack_int* n, lapack_int* nrhs, const double* d, const lapack_complex_double* e, double* df, lapack_complex_double* ef, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* rcond, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_ssysv( char* uplo, lapack_int* n, lapack_int* nrhs, float* a, lapack_int* lda, lapack_int* ipiv, float* b, lapack_int* ldb, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dsysv( char* uplo, lapack_int* n, lapack_int* nrhs, double* a, lapack_int* lda, lapack_int* ipiv, double* b, lapack_int* ldb, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_csysv( char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_float* a, lapack_int* lda, lapack_int* ipiv, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zsysv( char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_double* a, lapack_int* lda, lapack_int* ipiv, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_ssysvx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, const float* a, lapack_int* lda, float* af, lapack_int* ldaf, lapack_int* ipiv, const float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* rcond, float* ferr, float* berr, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int *info ); void LAPACK_dsysvx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, const double* a, lapack_int* lda, double* af, lapack_int* ldaf, lapack_int* ipiv, const double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* rcond, double* ferr, double* berr, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int *info ); void LAPACK_csysvx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* a, lapack_int* lda, lapack_complex_float* af, lapack_int* ldaf, lapack_int* ipiv, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* rcond, float* ferr, float* berr, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int *info ); void LAPACK_zsysvx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* a, lapack_int* lda, lapack_complex_double* af, lapack_int* ldaf, lapack_int* ipiv, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* rcond, double* ferr, double* berr, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int *info ); void LAPACK_dsysvxx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, double* a, lapack_int* lda, double* af, lapack_int* ldaf, lapack_int* ipiv, char* equed, double* s, double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* rcond, double* rpvgrw, double* berr, lapack_int* n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int* nparams, double* params, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_ssysvxx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, float* a, lapack_int* lda, float* af, lapack_int* ldaf, lapack_int* ipiv, char* equed, float* s, float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* rcond, float* rpvgrw, float* berr, lapack_int* n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int* nparams, float* params, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_zsysvxx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* af, lapack_int* ldaf, lapack_int* ipiv, char* equed, double* s, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* rcond, double* rpvgrw, double* berr, lapack_int* n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int* nparams, double* params, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_csysvxx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* af, lapack_int* ldaf, lapack_int* ipiv, char* equed, float* s, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* rcond, float* rpvgrw, float* berr, lapack_int* n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int* nparams, float* params, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_chesv( char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_float* a, lapack_int* lda, lapack_int* ipiv, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zhesv( char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_double* a, lapack_int* lda, lapack_int* ipiv, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_chesvx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* a, lapack_int* lda, lapack_complex_float* af, lapack_int* ldaf, lapack_int* ipiv, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* rcond, float* ferr, float* berr, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int *info ); void LAPACK_zhesvx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* a, lapack_int* lda, lapack_complex_double* af, lapack_int* ldaf, lapack_int* ipiv, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* rcond, double* ferr, double* berr, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int *info ); void LAPACK_zhesvxx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* af, lapack_int* ldaf, lapack_int* ipiv, char* equed, double* s, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* rcond, double* rpvgrw, double* berr, lapack_int* n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int* nparams, double* params, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_chesvxx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* af, lapack_int* ldaf, lapack_int* ipiv, char* equed, float* s, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* rcond, float* rpvgrw, float* berr, lapack_int* n_err_bnds, float* err_bnds_norm, float* err_bnds_comp, lapack_int* nparams, float* params, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_sspsv( char* uplo, lapack_int* n, lapack_int* nrhs, float* ap, lapack_int* ipiv, float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dspsv( char* uplo, lapack_int* n, lapack_int* nrhs, double* ap, lapack_int* ipiv, double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_cspsv( char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_float* ap, lapack_int* ipiv, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_zspsv( char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_double* ap, lapack_int* ipiv, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_sspsvx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, const float* ap, float* afp, lapack_int* ipiv, const float* b, lapack_int* ldb, float* x, lapack_int* ldx, float* rcond, float* ferr, float* berr, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dspsvx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, const double* ap, double* afp, lapack_int* ipiv, const double* b, lapack_int* ldb, double* x, lapack_int* ldx, double* rcond, double* ferr, double* berr, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_cspsvx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* ap, lapack_complex_float* afp, lapack_int* ipiv, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* rcond, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zspsvx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* ap, lapack_complex_double* afp, lapack_int* ipiv, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* rcond, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_chpsv( char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_float* ap, lapack_int* ipiv, lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_zhpsv( char* uplo, lapack_int* n, lapack_int* nrhs, lapack_complex_double* ap, lapack_int* ipiv, lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_chpsvx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* ap, lapack_complex_float* afp, lapack_int* ipiv, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* x, lapack_int* ldx, float* rcond, float* ferr, float* berr, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zhpsvx( char* fact, char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* ap, lapack_complex_double* afp, lapack_int* ipiv, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* x, lapack_int* ldx, double* rcond, double* ferr, double* berr, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_sgeqrf( lapack_int* m, lapack_int* n, float* a, lapack_int* lda, float* tau, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dgeqrf( lapack_int* m, lapack_int* n, double* a, lapack_int* lda, double* tau, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cgeqrf( lapack_int* m, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* tau, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zgeqrf( lapack_int* m, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* tau, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sgeqpf( lapack_int* m, lapack_int* n, float* a, lapack_int* lda, lapack_int* jpvt, float* tau, float* work, lapack_int *info ); void LAPACK_dgeqpf( lapack_int* m, lapack_int* n, double* a, lapack_int* lda, lapack_int* jpvt, double* tau, double* work, lapack_int *info ); void LAPACK_cgeqpf( lapack_int* m, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_int* jpvt, lapack_complex_float* tau, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zgeqpf( lapack_int* m, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_int* jpvt, lapack_complex_double* tau, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_sgeqp3( lapack_int* m, lapack_int* n, float* a, lapack_int* lda, lapack_int* jpvt, float* tau, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dgeqp3( lapack_int* m, lapack_int* n, double* a, lapack_int* lda, lapack_int* jpvt, double* tau, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cgeqp3( lapack_int* m, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_int* jpvt, lapack_complex_float* tau, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int *info ); void LAPACK_zgeqp3( lapack_int* m, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_int* jpvt, lapack_complex_double* tau, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int *info ); void LAPACK_sorgqr( lapack_int* m, lapack_int* n, lapack_int* k, float* a, lapack_int* lda, const float* tau, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dorgqr( lapack_int* m, lapack_int* n, lapack_int* k, double* a, lapack_int* lda, const double* tau, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sormqr( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, const float* a, lapack_int* lda, const float* tau, float* c, lapack_int* ldc, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dormqr( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, const double* a, lapack_int* lda, const double* tau, double* c, lapack_int* ldc, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cungqr( lapack_int* m, lapack_int* n, lapack_int* k, lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* tau, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zungqr( lapack_int* m, lapack_int* n, lapack_int* k, lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* tau, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cunmqr( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, const lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int* ldc, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zunmqr( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, const lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int* ldc, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sgelqf( lapack_int* m, lapack_int* n, float* a, lapack_int* lda, float* tau, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dgelqf( lapack_int* m, lapack_int* n, double* a, lapack_int* lda, double* tau, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cgelqf( lapack_int* m, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* tau, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zgelqf( lapack_int* m, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* tau, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sorglq( lapack_int* m, lapack_int* n, lapack_int* k, float* a, lapack_int* lda, const float* tau, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dorglq( lapack_int* m, lapack_int* n, lapack_int* k, double* a, lapack_int* lda, const double* tau, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sormlq( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, const float* a, lapack_int* lda, const float* tau, float* c, lapack_int* ldc, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dormlq( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, const double* a, lapack_int* lda, const double* tau, double* c, lapack_int* ldc, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cunglq( lapack_int* m, lapack_int* n, lapack_int* k, lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* tau, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zunglq( lapack_int* m, lapack_int* n, lapack_int* k, lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* tau, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cunmlq( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, const lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int* ldc, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zunmlq( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, const lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int* ldc, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sgeqlf( lapack_int* m, lapack_int* n, float* a, lapack_int* lda, float* tau, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dgeqlf( lapack_int* m, lapack_int* n, double* a, lapack_int* lda, double* tau, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cgeqlf( lapack_int* m, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* tau, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zgeqlf( lapack_int* m, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* tau, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sorgql( lapack_int* m, lapack_int* n, lapack_int* k, float* a, lapack_int* lda, const float* tau, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dorgql( lapack_int* m, lapack_int* n, lapack_int* k, double* a, lapack_int* lda, const double* tau, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cungql( lapack_int* m, lapack_int* n, lapack_int* k, lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* tau, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zungql( lapack_int* m, lapack_int* n, lapack_int* k, lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* tau, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sormql( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, const float* a, lapack_int* lda, const float* tau, float* c, lapack_int* ldc, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dormql( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, const double* a, lapack_int* lda, const double* tau, double* c, lapack_int* ldc, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cunmql( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, const lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int* ldc, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zunmql( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, const lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int* ldc, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sgerqf( lapack_int* m, lapack_int* n, float* a, lapack_int* lda, float* tau, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dgerqf( lapack_int* m, lapack_int* n, double* a, lapack_int* lda, double* tau, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cgerqf( lapack_int* m, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* tau, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zgerqf( lapack_int* m, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* tau, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sorgrq( lapack_int* m, lapack_int* n, lapack_int* k, float* a, lapack_int* lda, const float* tau, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dorgrq( lapack_int* m, lapack_int* n, lapack_int* k, double* a, lapack_int* lda, const double* tau, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cungrq( lapack_int* m, lapack_int* n, lapack_int* k, lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* tau, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zungrq( lapack_int* m, lapack_int* n, lapack_int* k, lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* tau, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sormrq( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, const float* a, lapack_int* lda, const float* tau, float* c, lapack_int* ldc, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dormrq( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, const double* a, lapack_int* lda, const double* tau, double* c, lapack_int* ldc, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cunmrq( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, const lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int* ldc, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zunmrq( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, const lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int* ldc, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_stzrzf( lapack_int* m, lapack_int* n, float* a, lapack_int* lda, float* tau, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dtzrzf( lapack_int* m, lapack_int* n, double* a, lapack_int* lda, double* tau, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_ctzrzf( lapack_int* m, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* tau, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_ztzrzf( lapack_int* m, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* tau, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sormrz( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, lapack_int* l, const float* a, lapack_int* lda, const float* tau, float* c, lapack_int* ldc, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dormrz( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, lapack_int* l, const double* a, lapack_int* lda, const double* tau, double* c, lapack_int* ldc, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cunmrz( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, lapack_int* l, const lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int* ldc, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zunmrz( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, lapack_int* l, const lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int* ldc, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sggqrf( lapack_int* n, lapack_int* m, lapack_int* p, float* a, lapack_int* lda, float* taua, float* b, lapack_int* ldb, float* taub, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dggqrf( lapack_int* n, lapack_int* m, lapack_int* p, double* a, lapack_int* lda, double* taua, double* b, lapack_int* ldb, double* taub, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cggqrf( lapack_int* n, lapack_int* m, lapack_int* p, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* taua, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* taub, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zggqrf( lapack_int* n, lapack_int* m, lapack_int* p, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* taua, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* taub, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sggrqf( lapack_int* m, lapack_int* p, lapack_int* n, float* a, lapack_int* lda, float* taua, float* b, lapack_int* ldb, float* taub, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dggrqf( lapack_int* m, lapack_int* p, lapack_int* n, double* a, lapack_int* lda, double* taua, double* b, lapack_int* ldb, double* taub, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cggrqf( lapack_int* m, lapack_int* p, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* taua, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* taub, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zggrqf( lapack_int* m, lapack_int* p, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* taua, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* taub, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sgebrd( lapack_int* m, lapack_int* n, float* a, lapack_int* lda, float* d, float* e, float* tauq, float* taup, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dgebrd( lapack_int* m, lapack_int* n, double* a, lapack_int* lda, double* d, double* e, double* tauq, double* taup, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cgebrd( lapack_int* m, lapack_int* n, lapack_complex_float* a, lapack_int* lda, float* d, float* e, lapack_complex_float* tauq, lapack_complex_float* taup, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zgebrd( lapack_int* m, lapack_int* n, lapack_complex_double* a, lapack_int* lda, double* d, double* e, lapack_complex_double* tauq, lapack_complex_double* taup, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sgbbrd( char* vect, lapack_int* m, lapack_int* n, lapack_int* ncc, lapack_int* kl, lapack_int* ku, float* ab, lapack_int* ldab, float* d, float* e, float* q, lapack_int* ldq, float* pt, lapack_int* ldpt, float* c, lapack_int* ldc, float* work, lapack_int *info ); void LAPACK_dgbbrd( char* vect, lapack_int* m, lapack_int* n, lapack_int* ncc, lapack_int* kl, lapack_int* ku, double* ab, lapack_int* ldab, double* d, double* e, double* q, lapack_int* ldq, double* pt, lapack_int* ldpt, double* c, lapack_int* ldc, double* work, lapack_int *info ); void LAPACK_cgbbrd( char* vect, lapack_int* m, lapack_int* n, lapack_int* ncc, lapack_int* kl, lapack_int* ku, lapack_complex_float* ab, lapack_int* ldab, float* d, float* e, lapack_complex_float* q, lapack_int* ldq, lapack_complex_float* pt, lapack_int* ldpt, lapack_complex_float* c, lapack_int* ldc, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zgbbrd( char* vect, lapack_int* m, lapack_int* n, lapack_int* ncc, lapack_int* kl, lapack_int* ku, lapack_complex_double* ab, lapack_int* ldab, double* d, double* e, lapack_complex_double* q, lapack_int* ldq, lapack_complex_double* pt, lapack_int* ldpt, lapack_complex_double* c, lapack_int* ldc, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_sorgbr( char* vect, lapack_int* m, lapack_int* n, lapack_int* k, float* a, lapack_int* lda, const float* tau, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dorgbr( char* vect, lapack_int* m, lapack_int* n, lapack_int* k, double* a, lapack_int* lda, const double* tau, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sormbr( char* vect, char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, const float* a, lapack_int* lda, const float* tau, float* c, lapack_int* ldc, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dormbr( char* vect, char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, const double* a, lapack_int* lda, const double* tau, double* c, lapack_int* ldc, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cungbr( char* vect, lapack_int* m, lapack_int* n, lapack_int* k, lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* tau, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zungbr( char* vect, lapack_int* m, lapack_int* n, lapack_int* k, lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* tau, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cunmbr( char* vect, char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, const lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int* ldc, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zunmbr( char* vect, char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, const lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int* ldc, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sbdsqr( char* uplo, lapack_int* n, lapack_int* ncvt, lapack_int* nru, lapack_int* ncc, float* d, float* e, float* vt, lapack_int* ldvt, float* u, lapack_int* ldu, float* c, lapack_int* ldc, float* work, lapack_int *info ); void LAPACK_dbdsqr( char* uplo, lapack_int* n, lapack_int* ncvt, lapack_int* nru, lapack_int* ncc, double* d, double* e, double* vt, lapack_int* ldvt, double* u, lapack_int* ldu, double* c, lapack_int* ldc, double* work, lapack_int *info ); void LAPACK_cbdsqr( char* uplo, lapack_int* n, lapack_int* ncvt, lapack_int* nru, lapack_int* ncc, float* d, float* e, lapack_complex_float* vt, lapack_int* ldvt, lapack_complex_float* u, lapack_int* ldu, lapack_complex_float* c, lapack_int* ldc, float* work, lapack_int *info ); void LAPACK_zbdsqr( char* uplo, lapack_int* n, lapack_int* ncvt, lapack_int* nru, lapack_int* ncc, double* d, double* e, lapack_complex_double* vt, lapack_int* ldvt, lapack_complex_double* u, lapack_int* ldu, lapack_complex_double* c, lapack_int* ldc, double* work, lapack_int *info ); void LAPACK_sbdsdc( char* uplo, char* compq, lapack_int* n, float* d, float* e, float* u, lapack_int* ldu, float* vt, lapack_int* ldvt, float* q, lapack_int* iq, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dbdsdc( char* uplo, char* compq, lapack_int* n, double* d, double* e, double* u, lapack_int* ldu, double* vt, lapack_int* ldvt, double* q, lapack_int* iq, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_ssytrd( char* uplo, lapack_int* n, float* a, lapack_int* lda, float* d, float* e, float* tau, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dsytrd( char* uplo, lapack_int* n, double* a, lapack_int* lda, double* d, double* e, double* tau, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sorgtr( char* uplo, lapack_int* n, float* a, lapack_int* lda, const float* tau, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dorgtr( char* uplo, lapack_int* n, double* a, lapack_int* lda, const double* tau, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sormtr( char* side, char* uplo, char* trans, lapack_int* m, lapack_int* n, const float* a, lapack_int* lda, const float* tau, float* c, lapack_int* ldc, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dormtr( char* side, char* uplo, char* trans, lapack_int* m, lapack_int* n, const double* a, lapack_int* lda, const double* tau, double* c, lapack_int* ldc, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_chetrd( char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* lda, float* d, float* e, lapack_complex_float* tau, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zhetrd( char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* lda, double* d, double* e, lapack_complex_double* tau, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cungtr( char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* tau, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zungtr( char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* tau, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cunmtr( char* side, char* uplo, char* trans, lapack_int* m, lapack_int* n, const lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int* ldc, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zunmtr( char* side, char* uplo, char* trans, lapack_int* m, lapack_int* n, const lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int* ldc, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_ssptrd( char* uplo, lapack_int* n, float* ap, float* d, float* e, float* tau, lapack_int *info ); void LAPACK_dsptrd( char* uplo, lapack_int* n, double* ap, double* d, double* e, double* tau, lapack_int *info ); void LAPACK_sopgtr( char* uplo, lapack_int* n, const float* ap, const float* tau, float* q, lapack_int* ldq, float* work, lapack_int *info ); void LAPACK_dopgtr( char* uplo, lapack_int* n, const double* ap, const double* tau, double* q, lapack_int* ldq, double* work, lapack_int *info ); void LAPACK_sopmtr( char* side, char* uplo, char* trans, lapack_int* m, lapack_int* n, const float* ap, const float* tau, float* c, lapack_int* ldc, float* work, lapack_int *info ); void LAPACK_dopmtr( char* side, char* uplo, char* trans, lapack_int* m, lapack_int* n, const double* ap, const double* tau, double* c, lapack_int* ldc, double* work, lapack_int *info ); void LAPACK_chptrd( char* uplo, lapack_int* n, lapack_complex_float* ap, float* d, float* e, lapack_complex_float* tau, lapack_int *info ); void LAPACK_zhptrd( char* uplo, lapack_int* n, lapack_complex_double* ap, double* d, double* e, lapack_complex_double* tau, lapack_int *info ); void LAPACK_cupgtr( char* uplo, lapack_int* n, const lapack_complex_float* ap, const lapack_complex_float* tau, lapack_complex_float* q, lapack_int* ldq, lapack_complex_float* work, lapack_int *info ); void LAPACK_zupgtr( char* uplo, lapack_int* n, const lapack_complex_double* ap, const lapack_complex_double* tau, lapack_complex_double* q, lapack_int* ldq, lapack_complex_double* work, lapack_int *info ); void LAPACK_cupmtr( char* side, char* uplo, char* trans, lapack_int* m, lapack_int* n, const lapack_complex_float* ap, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int* ldc, lapack_complex_float* work, lapack_int *info ); void LAPACK_zupmtr( char* side, char* uplo, char* trans, lapack_int* m, lapack_int* n, const lapack_complex_double* ap, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int* ldc, lapack_complex_double* work, lapack_int *info ); void LAPACK_ssbtrd( char* vect, char* uplo, lapack_int* n, lapack_int* kd, float* ab, lapack_int* ldab, float* d, float* e, float* q, lapack_int* ldq, float* work, lapack_int *info ); void LAPACK_dsbtrd( char* vect, char* uplo, lapack_int* n, lapack_int* kd, double* ab, lapack_int* ldab, double* d, double* e, double* q, lapack_int* ldq, double* work, lapack_int *info ); void LAPACK_chbtrd( char* vect, char* uplo, lapack_int* n, lapack_int* kd, lapack_complex_float* ab, lapack_int* ldab, float* d, float* e, lapack_complex_float* q, lapack_int* ldq, lapack_complex_float* work, lapack_int *info ); void LAPACK_zhbtrd( char* vect, char* uplo, lapack_int* n, lapack_int* kd, lapack_complex_double* ab, lapack_int* ldab, double* d, double* e, lapack_complex_double* q, lapack_int* ldq, lapack_complex_double* work, lapack_int *info ); void LAPACK_ssterf( lapack_int* n, float* d, float* e, lapack_int *info ); void LAPACK_dsterf( lapack_int* n, double* d, double* e, lapack_int *info ); void LAPACK_ssteqr( char* compz, lapack_int* n, float* d, float* e, float* z, lapack_int* ldz, float* work, lapack_int *info ); void LAPACK_dsteqr( char* compz, lapack_int* n, double* d, double* e, double* z, lapack_int* ldz, double* work, lapack_int *info ); void LAPACK_csteqr( char* compz, lapack_int* n, float* d, float* e, lapack_complex_float* z, lapack_int* ldz, float* work, lapack_int *info ); void LAPACK_zsteqr( char* compz, lapack_int* n, double* d, double* e, lapack_complex_double* z, lapack_int* ldz, double* work, lapack_int *info ); void LAPACK_sstemr( char* jobz, char* range, lapack_int* n, float* d, float* e, float* vl, float* vu, lapack_int* il, lapack_int* iu, lapack_int* m, float* w, float* z, lapack_int* ldz, lapack_int* nzc, lapack_int* isuppz, lapack_logical* tryrac, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_dstemr( char* jobz, char* range, lapack_int* n, double* d, double* e, double* vl, double* vu, lapack_int* il, lapack_int* iu, lapack_int* m, double* w, double* z, lapack_int* ldz, lapack_int* nzc, lapack_int* isuppz, lapack_logical* tryrac, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_cstemr( char* jobz, char* range, lapack_int* n, float* d, float* e, float* vl, float* vu, lapack_int* il, lapack_int* iu, lapack_int* m, float* w, lapack_complex_float* z, lapack_int* ldz, lapack_int* nzc, lapack_int* isuppz, lapack_logical* tryrac, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_zstemr( char* jobz, char* range, lapack_int* n, double* d, double* e, double* vl, double* vu, lapack_int* il, lapack_int* iu, lapack_int* m, double* w, lapack_complex_double* z, lapack_int* ldz, lapack_int* nzc, lapack_int* isuppz, lapack_logical* tryrac, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_sstedc( char* compz, lapack_int* n, float* d, float* e, float* z, lapack_int* ldz, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_dstedc( char* compz, lapack_int* n, double* d, double* e, double* z, lapack_int* ldz, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_cstedc( char* compz, lapack_int* n, float* d, float* e, lapack_complex_float* z, lapack_int* ldz, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int* lrwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_zstedc( char* compz, lapack_int* n, double* d, double* e, lapack_complex_double* z, lapack_int* ldz, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int* lrwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_sstegr( char* jobz, char* range, lapack_int* n, float* d, float* e, float* vl, float* vu, lapack_int* il, lapack_int* iu, float* abstol, lapack_int* m, float* w, float* z, lapack_int* ldz, lapack_int* isuppz, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_dstegr( char* jobz, char* range, lapack_int* n, double* d, double* e, double* vl, double* vu, lapack_int* il, lapack_int* iu, double* abstol, lapack_int* m, double* w, double* z, lapack_int* ldz, lapack_int* isuppz, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_cstegr( char* jobz, char* range, lapack_int* n, float* d, float* e, float* vl, float* vu, lapack_int* il, lapack_int* iu, float* abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int* ldz, lapack_int* isuppz, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_zstegr( char* jobz, char* range, lapack_int* n, double* d, double* e, double* vl, double* vu, lapack_int* il, lapack_int* iu, double* abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int* ldz, lapack_int* isuppz, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_spteqr( char* compz, lapack_int* n, float* d, float* e, float* z, lapack_int* ldz, float* work, lapack_int *info ); void LAPACK_dpteqr( char* compz, lapack_int* n, double* d, double* e, double* z, lapack_int* ldz, double* work, lapack_int *info ); void LAPACK_cpteqr( char* compz, lapack_int* n, float* d, float* e, lapack_complex_float* z, lapack_int* ldz, float* work, lapack_int *info ); void LAPACK_zpteqr( char* compz, lapack_int* n, double* d, double* e, lapack_complex_double* z, lapack_int* ldz, double* work, lapack_int *info ); void LAPACK_sstebz( char* range, char* order, lapack_int* n, float* vl, float* vu, lapack_int* il, lapack_int* iu, float* abstol, const float* d, const float* e, lapack_int* m, lapack_int* nsplit, float* w, lapack_int* iblock, lapack_int* isplit, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dstebz( char* range, char* order, lapack_int* n, double* vl, double* vu, lapack_int* il, lapack_int* iu, double* abstol, const double* d, const double* e, lapack_int* m, lapack_int* nsplit, double* w, lapack_int* iblock, lapack_int* isplit, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_sstein( lapack_int* n, const float* d, const float* e, lapack_int* m, const float* w, const lapack_int* iblock, const lapack_int* isplit, float* z, lapack_int* ldz, float* work, lapack_int* iwork, lapack_int* ifailv, lapack_int *info ); void LAPACK_dstein( lapack_int* n, const double* d, const double* e, lapack_int* m, const double* w, const lapack_int* iblock, const lapack_int* isplit, double* z, lapack_int* ldz, double* work, lapack_int* iwork, lapack_int* ifailv, lapack_int *info ); void LAPACK_cstein( lapack_int* n, const float* d, const float* e, lapack_int* m, const float* w, const lapack_int* iblock, const lapack_int* isplit, lapack_complex_float* z, lapack_int* ldz, float* work, lapack_int* iwork, lapack_int* ifailv, lapack_int *info ); void LAPACK_zstein( lapack_int* n, const double* d, const double* e, lapack_int* m, const double* w, const lapack_int* iblock, const lapack_int* isplit, lapack_complex_double* z, lapack_int* ldz, double* work, lapack_int* iwork, lapack_int* ifailv, lapack_int *info ); void LAPACK_sdisna( char* job, lapack_int* m, lapack_int* n, const float* d, float* sep, lapack_int *info ); void LAPACK_ddisna( char* job, lapack_int* m, lapack_int* n, const double* d, double* sep, lapack_int *info ); void LAPACK_ssygst( lapack_int* itype, char* uplo, lapack_int* n, float* a, lapack_int* lda, const float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_dsygst( lapack_int* itype, char* uplo, lapack_int* n, double* a, lapack_int* lda, const double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_chegst( lapack_int* itype, char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* b, lapack_int* ldb, lapack_int *info ); void LAPACK_zhegst( lapack_int* itype, char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* b, lapack_int* ldb, lapack_int *info ); void LAPACK_sspgst( lapack_int* itype, char* uplo, lapack_int* n, float* ap, const float* bp, lapack_int *info ); void LAPACK_dspgst( lapack_int* itype, char* uplo, lapack_int* n, double* ap, const double* bp, lapack_int *info ); void LAPACK_chpgst( lapack_int* itype, char* uplo, lapack_int* n, lapack_complex_float* ap, const lapack_complex_float* bp, lapack_int *info ); void LAPACK_zhpgst( lapack_int* itype, char* uplo, lapack_int* n, lapack_complex_double* ap, const lapack_complex_double* bp, lapack_int *info ); void LAPACK_ssbgst( char* vect, char* uplo, lapack_int* n, lapack_int* ka, lapack_int* kb, float* ab, lapack_int* ldab, const float* bb, lapack_int* ldbb, float* x, lapack_int* ldx, float* work, lapack_int *info ); void LAPACK_dsbgst( char* vect, char* uplo, lapack_int* n, lapack_int* ka, lapack_int* kb, double* ab, lapack_int* ldab, const double* bb, lapack_int* ldbb, double* x, lapack_int* ldx, double* work, lapack_int *info ); void LAPACK_chbgst( char* vect, char* uplo, lapack_int* n, lapack_int* ka, lapack_int* kb, lapack_complex_float* ab, lapack_int* ldab, const lapack_complex_float* bb, lapack_int* ldbb, lapack_complex_float* x, lapack_int* ldx, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zhbgst( char* vect, char* uplo, lapack_int* n, lapack_int* ka, lapack_int* kb, lapack_complex_double* ab, lapack_int* ldab, const lapack_complex_double* bb, lapack_int* ldbb, lapack_complex_double* x, lapack_int* ldx, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_spbstf( char* uplo, lapack_int* n, lapack_int* kb, float* bb, lapack_int* ldbb, lapack_int *info ); void LAPACK_dpbstf( char* uplo, lapack_int* n, lapack_int* kb, double* bb, lapack_int* ldbb, lapack_int *info ); void LAPACK_cpbstf( char* uplo, lapack_int* n, lapack_int* kb, lapack_complex_float* bb, lapack_int* ldbb, lapack_int *info ); void LAPACK_zpbstf( char* uplo, lapack_int* n, lapack_int* kb, lapack_complex_double* bb, lapack_int* ldbb, lapack_int *info ); void LAPACK_sgehrd( lapack_int* n, lapack_int* ilo, lapack_int* ihi, float* a, lapack_int* lda, float* tau, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dgehrd( lapack_int* n, lapack_int* ilo, lapack_int* ihi, double* a, lapack_int* lda, double* tau, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cgehrd( lapack_int* n, lapack_int* ilo, lapack_int* ihi, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* tau, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zgehrd( lapack_int* n, lapack_int* ilo, lapack_int* ihi, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* tau, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sorghr( lapack_int* n, lapack_int* ilo, lapack_int* ihi, float* a, lapack_int* lda, const float* tau, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dorghr( lapack_int* n, lapack_int* ilo, lapack_int* ihi, double* a, lapack_int* lda, const double* tau, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sormhr( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* ilo, lapack_int* ihi, const float* a, lapack_int* lda, const float* tau, float* c, lapack_int* ldc, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dormhr( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* ilo, lapack_int* ihi, const double* a, lapack_int* lda, const double* tau, double* c, lapack_int* ldc, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cunghr( lapack_int* n, lapack_int* ilo, lapack_int* ihi, lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* tau, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zunghr( lapack_int* n, lapack_int* ilo, lapack_int* ihi, lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* tau, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cunmhr( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* ilo, lapack_int* ihi, const lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* tau, lapack_complex_float* c, lapack_int* ldc, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zunmhr( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* ilo, lapack_int* ihi, const lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* tau, lapack_complex_double* c, lapack_int* ldc, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sgebal( char* job, lapack_int* n, float* a, lapack_int* lda, lapack_int* ilo, lapack_int* ihi, float* scale, lapack_int *info ); void LAPACK_dgebal( char* job, lapack_int* n, double* a, lapack_int* lda, lapack_int* ilo, lapack_int* ihi, double* scale, lapack_int *info ); void LAPACK_cgebal( char* job, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_int* ilo, lapack_int* ihi, float* scale, lapack_int *info ); void LAPACK_zgebal( char* job, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_int* ilo, lapack_int* ihi, double* scale, lapack_int *info ); void LAPACK_sgebak( char* job, char* side, lapack_int* n, lapack_int* ilo, lapack_int* ihi, const float* scale, lapack_int* m, float* v, lapack_int* ldv, lapack_int *info ); void LAPACK_dgebak( char* job, char* side, lapack_int* n, lapack_int* ilo, lapack_int* ihi, const double* scale, lapack_int* m, double* v, lapack_int* ldv, lapack_int *info ); void LAPACK_cgebak( char* job, char* side, lapack_int* n, lapack_int* ilo, lapack_int* ihi, const float* scale, lapack_int* m, lapack_complex_float* v, lapack_int* ldv, lapack_int *info ); void LAPACK_zgebak( char* job, char* side, lapack_int* n, lapack_int* ilo, lapack_int* ihi, const double* scale, lapack_int* m, lapack_complex_double* v, lapack_int* ldv, lapack_int *info ); void LAPACK_shseqr( char* job, char* compz, lapack_int* n, lapack_int* ilo, lapack_int* ihi, float* h, lapack_int* ldh, float* wr, float* wi, float* z, lapack_int* ldz, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dhseqr( char* job, char* compz, lapack_int* n, lapack_int* ilo, lapack_int* ihi, double* h, lapack_int* ldh, double* wr, double* wi, double* z, lapack_int* ldz, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_chseqr( char* job, char* compz, lapack_int* n, lapack_int* ilo, lapack_int* ihi, lapack_complex_float* h, lapack_int* ldh, lapack_complex_float* w, lapack_complex_float* z, lapack_int* ldz, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zhseqr( char* job, char* compz, lapack_int* n, lapack_int* ilo, lapack_int* ihi, lapack_complex_double* h, lapack_int* ldh, lapack_complex_double* w, lapack_complex_double* z, lapack_int* ldz, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_shsein( char* job, char* eigsrc, char* initv, lapack_logical* select, lapack_int* n, const float* h, lapack_int* ldh, float* wr, const float* wi, float* vl, lapack_int* ldvl, float* vr, lapack_int* ldvr, lapack_int* mm, lapack_int* m, float* work, lapack_int* ifaill, lapack_int* ifailr, lapack_int *info ); void LAPACK_dhsein( char* job, char* eigsrc, char* initv, lapack_logical* select, lapack_int* n, const double* h, lapack_int* ldh, double* wr, const double* wi, double* vl, lapack_int* ldvl, double* vr, lapack_int* ldvr, lapack_int* mm, lapack_int* m, double* work, lapack_int* ifaill, lapack_int* ifailr, lapack_int *info ); void LAPACK_chsein( char* job, char* eigsrc, char* initv, const lapack_logical* select, lapack_int* n, const lapack_complex_float* h, lapack_int* ldh, lapack_complex_float* w, lapack_complex_float* vl, lapack_int* ldvl, lapack_complex_float* vr, lapack_int* ldvr, lapack_int* mm, lapack_int* m, lapack_complex_float* work, float* rwork, lapack_int* ifaill, lapack_int* ifailr, lapack_int *info ); void LAPACK_zhsein( char* job, char* eigsrc, char* initv, const lapack_logical* select, lapack_int* n, const lapack_complex_double* h, lapack_int* ldh, lapack_complex_double* w, lapack_complex_double* vl, lapack_int* ldvl, lapack_complex_double* vr, lapack_int* ldvr, lapack_int* mm, lapack_int* m, lapack_complex_double* work, double* rwork, lapack_int* ifaill, lapack_int* ifailr, lapack_int *info ); void LAPACK_strevc( char* side, char* howmny, lapack_logical* select, lapack_int* n, const float* t, lapack_int* ldt, float* vl, lapack_int* ldvl, float* vr, lapack_int* ldvr, lapack_int* mm, lapack_int* m, float* work, lapack_int *info ); void LAPACK_dtrevc( char* side, char* howmny, lapack_logical* select, lapack_int* n, const double* t, lapack_int* ldt, double* vl, lapack_int* ldvl, double* vr, lapack_int* ldvr, lapack_int* mm, lapack_int* m, double* work, lapack_int *info ); void LAPACK_ctrevc( char* side, char* howmny, const lapack_logical* select, lapack_int* n, lapack_complex_float* t, lapack_int* ldt, lapack_complex_float* vl, lapack_int* ldvl, lapack_complex_float* vr, lapack_int* ldvr, lapack_int* mm, lapack_int* m, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_ztrevc( char* side, char* howmny, const lapack_logical* select, lapack_int* n, lapack_complex_double* t, lapack_int* ldt, lapack_complex_double* vl, lapack_int* ldvl, lapack_complex_double* vr, lapack_int* ldvr, lapack_int* mm, lapack_int* m, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_strsna( char* job, char* howmny, const lapack_logical* select, lapack_int* n, const float* t, lapack_int* ldt, const float* vl, lapack_int* ldvl, const float* vr, lapack_int* ldvr, float* s, float* sep, lapack_int* mm, lapack_int* m, float* work, lapack_int* ldwork, lapack_int* iwork, lapack_int *info ); void LAPACK_dtrsna( char* job, char* howmny, const lapack_logical* select, lapack_int* n, const double* t, lapack_int* ldt, const double* vl, lapack_int* ldvl, const double* vr, lapack_int* ldvr, double* s, double* sep, lapack_int* mm, lapack_int* m, double* work, lapack_int* ldwork, lapack_int* iwork, lapack_int *info ); void LAPACK_ctrsna( char* job, char* howmny, const lapack_logical* select, lapack_int* n, const lapack_complex_float* t, lapack_int* ldt, const lapack_complex_float* vl, lapack_int* ldvl, const lapack_complex_float* vr, lapack_int* ldvr, float* s, float* sep, lapack_int* mm, lapack_int* m, lapack_complex_float* work, lapack_int* ldwork, float* rwork, lapack_int *info ); void LAPACK_ztrsna( char* job, char* howmny, const lapack_logical* select, lapack_int* n, const lapack_complex_double* t, lapack_int* ldt, const lapack_complex_double* vl, lapack_int* ldvl, const lapack_complex_double* vr, lapack_int* ldvr, double* s, double* sep, lapack_int* mm, lapack_int* m, lapack_complex_double* work, lapack_int* ldwork, double* rwork, lapack_int *info ); void LAPACK_strexc( char* compq, lapack_int* n, float* t, lapack_int* ldt, float* q, lapack_int* ldq, lapack_int* ifst, lapack_int* ilst, float* work, lapack_int *info ); void LAPACK_dtrexc( char* compq, lapack_int* n, double* t, lapack_int* ldt, double* q, lapack_int* ldq, lapack_int* ifst, lapack_int* ilst, double* work, lapack_int *info ); void LAPACK_ctrexc( char* compq, lapack_int* n, lapack_complex_float* t, lapack_int* ldt, lapack_complex_float* q, lapack_int* ldq, lapack_int* ifst, lapack_int* ilst, lapack_int *info ); void LAPACK_ztrexc( char* compq, lapack_int* n, lapack_complex_double* t, lapack_int* ldt, lapack_complex_double* q, lapack_int* ldq, lapack_int* ifst, lapack_int* ilst, lapack_int *info ); void LAPACK_strsen( char* job, char* compq, const lapack_logical* select, lapack_int* n, float* t, lapack_int* ldt, float* q, lapack_int* ldq, float* wr, float* wi, lapack_int* m, float* s, float* sep, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_dtrsen( char* job, char* compq, const lapack_logical* select, lapack_int* n, double* t, lapack_int* ldt, double* q, lapack_int* ldq, double* wr, double* wi, lapack_int* m, double* s, double* sep, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_ctrsen( char* job, char* compq, const lapack_logical* select, lapack_int* n, lapack_complex_float* t, lapack_int* ldt, lapack_complex_float* q, lapack_int* ldq, lapack_complex_float* w, lapack_int* m, float* s, float* sep, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_ztrsen( char* job, char* compq, const lapack_logical* select, lapack_int* n, lapack_complex_double* t, lapack_int* ldt, lapack_complex_double* q, lapack_int* ldq, lapack_complex_double* w, lapack_int* m, double* s, double* sep, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_strsyl( char* trana, char* tranb, lapack_int* isgn, lapack_int* m, lapack_int* n, const float* a, lapack_int* lda, const float* b, lapack_int* ldb, float* c, lapack_int* ldc, float* scale, lapack_int *info ); void LAPACK_dtrsyl( char* trana, char* tranb, lapack_int* isgn, lapack_int* m, lapack_int* n, const double* a, lapack_int* lda, const double* b, lapack_int* ldb, double* c, lapack_int* ldc, double* scale, lapack_int *info ); void LAPACK_ctrsyl( char* trana, char* tranb, lapack_int* isgn, lapack_int* m, lapack_int* n, const lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* c, lapack_int* ldc, float* scale, lapack_int *info ); void LAPACK_ztrsyl( char* trana, char* tranb, lapack_int* isgn, lapack_int* m, lapack_int* n, const lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* c, lapack_int* ldc, double* scale, lapack_int *info ); void LAPACK_sgghrd( char* compq, char* compz, lapack_int* n, lapack_int* ilo, lapack_int* ihi, float* a, lapack_int* lda, float* b, lapack_int* ldb, float* q, lapack_int* ldq, float* z, lapack_int* ldz, lapack_int *info ); void LAPACK_dgghrd( char* compq, char* compz, lapack_int* n, lapack_int* ilo, lapack_int* ihi, double* a, lapack_int* lda, double* b, lapack_int* ldb, double* q, lapack_int* ldq, double* z, lapack_int* ldz, lapack_int *info ); void LAPACK_cgghrd( char* compq, char* compz, lapack_int* n, lapack_int* ilo, lapack_int* ihi, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* q, lapack_int* ldq, lapack_complex_float* z, lapack_int* ldz, lapack_int *info ); void LAPACK_zgghrd( char* compq, char* compz, lapack_int* n, lapack_int* ilo, lapack_int* ihi, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* q, lapack_int* ldq, lapack_complex_double* z, lapack_int* ldz, lapack_int *info ); void LAPACK_sggbal( char* job, lapack_int* n, float* a, lapack_int* lda, float* b, lapack_int* ldb, lapack_int* ilo, lapack_int* ihi, float* lscale, float* rscale, float* work, lapack_int *info ); void LAPACK_dggbal( char* job, lapack_int* n, double* a, lapack_int* lda, double* b, lapack_int* ldb, lapack_int* ilo, lapack_int* ihi, double* lscale, double* rscale, double* work, lapack_int *info ); void LAPACK_cggbal( char* job, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, lapack_int* ilo, lapack_int* ihi, float* lscale, float* rscale, float* work, lapack_int *info ); void LAPACK_zggbal( char* job, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, lapack_int* ilo, lapack_int* ihi, double* lscale, double* rscale, double* work, lapack_int *info ); void LAPACK_sggbak( char* job, char* side, lapack_int* n, lapack_int* ilo, lapack_int* ihi, const float* lscale, const float* rscale, lapack_int* m, float* v, lapack_int* ldv, lapack_int *info ); void LAPACK_dggbak( char* job, char* side, lapack_int* n, lapack_int* ilo, lapack_int* ihi, const double* lscale, const double* rscale, lapack_int* m, double* v, lapack_int* ldv, lapack_int *info ); void LAPACK_cggbak( char* job, char* side, lapack_int* n, lapack_int* ilo, lapack_int* ihi, const float* lscale, const float* rscale, lapack_int* m, lapack_complex_float* v, lapack_int* ldv, lapack_int *info ); void LAPACK_zggbak( char* job, char* side, lapack_int* n, lapack_int* ilo, lapack_int* ihi, const double* lscale, const double* rscale, lapack_int* m, lapack_complex_double* v, lapack_int* ldv, lapack_int *info ); void LAPACK_shgeqz( char* job, char* compq, char* compz, lapack_int* n, lapack_int* ilo, lapack_int* ihi, float* h, lapack_int* ldh, float* t, lapack_int* ldt, float* alphar, float* alphai, float* beta, float* q, lapack_int* ldq, float* z, lapack_int* ldz, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dhgeqz( char* job, char* compq, char* compz, lapack_int* n, lapack_int* ilo, lapack_int* ihi, double* h, lapack_int* ldh, double* t, lapack_int* ldt, double* alphar, double* alphai, double* beta, double* q, lapack_int* ldq, double* z, lapack_int* ldz, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_chgeqz( char* job, char* compq, char* compz, lapack_int* n, lapack_int* ilo, lapack_int* ihi, lapack_complex_float* h, lapack_int* ldh, lapack_complex_float* t, lapack_int* ldt, lapack_complex_float* alpha, lapack_complex_float* beta, lapack_complex_float* q, lapack_int* ldq, lapack_complex_float* z, lapack_int* ldz, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int *info ); void LAPACK_zhgeqz( char* job, char* compq, char* compz, lapack_int* n, lapack_int* ilo, lapack_int* ihi, lapack_complex_double* h, lapack_int* ldh, lapack_complex_double* t, lapack_int* ldt, lapack_complex_double* alpha, lapack_complex_double* beta, lapack_complex_double* q, lapack_int* ldq, lapack_complex_double* z, lapack_int* ldz, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int *info ); void LAPACK_stgevc( char* side, char* howmny, const lapack_logical* select, lapack_int* n, const float* s, lapack_int* lds, const float* p, lapack_int* ldp, float* vl, lapack_int* ldvl, float* vr, lapack_int* ldvr, lapack_int* mm, lapack_int* m, float* work, lapack_int *info ); void LAPACK_dtgevc( char* side, char* howmny, const lapack_logical* select, lapack_int* n, const double* s, lapack_int* lds, const double* p, lapack_int* ldp, double* vl, lapack_int* ldvl, double* vr, lapack_int* ldvr, lapack_int* mm, lapack_int* m, double* work, lapack_int *info ); void LAPACK_ctgevc( char* side, char* howmny, const lapack_logical* select, lapack_int* n, const lapack_complex_float* s, lapack_int* lds, const lapack_complex_float* p, lapack_int* ldp, lapack_complex_float* vl, lapack_int* ldvl, lapack_complex_float* vr, lapack_int* ldvr, lapack_int* mm, lapack_int* m, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_ztgevc( char* side, char* howmny, const lapack_logical* select, lapack_int* n, const lapack_complex_double* s, lapack_int* lds, const lapack_complex_double* p, lapack_int* ldp, lapack_complex_double* vl, lapack_int* ldvl, lapack_complex_double* vr, lapack_int* ldvr, lapack_int* mm, lapack_int* m, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_stgexc( lapack_logical* wantq, lapack_logical* wantz, lapack_int* n, float* a, lapack_int* lda, float* b, lapack_int* ldb, float* q, lapack_int* ldq, float* z, lapack_int* ldz, lapack_int* ifst, lapack_int* ilst, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dtgexc( lapack_logical* wantq, lapack_logical* wantz, lapack_int* n, double* a, lapack_int* lda, double* b, lapack_int* ldb, double* q, lapack_int* ldq, double* z, lapack_int* ldz, lapack_int* ifst, lapack_int* ilst, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_ctgexc( lapack_logical* wantq, lapack_logical* wantz, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* q, lapack_int* ldq, lapack_complex_float* z, lapack_int* ldz, lapack_int* ifst, lapack_int* ilst, lapack_int *info ); void LAPACK_ztgexc( lapack_logical* wantq, lapack_logical* wantz, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* q, lapack_int* ldq, lapack_complex_double* z, lapack_int* ldz, lapack_int* ifst, lapack_int* ilst, lapack_int *info ); void LAPACK_stgsen( lapack_int* ijob, lapack_logical* wantq, lapack_logical* wantz, const lapack_logical* select, lapack_int* n, float* a, lapack_int* lda, float* b, lapack_int* ldb, float* alphar, float* alphai, float* beta, float* q, lapack_int* ldq, float* z, lapack_int* ldz, lapack_int* m, float* pl, float* pr, float* dif, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_dtgsen( lapack_int* ijob, lapack_logical* wantq, lapack_logical* wantz, const lapack_logical* select, lapack_int* n, double* a, lapack_int* lda, double* b, lapack_int* ldb, double* alphar, double* alphai, double* beta, double* q, lapack_int* ldq, double* z, lapack_int* ldz, lapack_int* m, double* pl, double* pr, double* dif, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_ctgsen( lapack_int* ijob, lapack_logical* wantq, lapack_logical* wantz, const lapack_logical* select, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* alpha, lapack_complex_float* beta, lapack_complex_float* q, lapack_int* ldq, lapack_complex_float* z, lapack_int* ldz, lapack_int* m, float* pl, float* pr, float* dif, lapack_complex_float* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_ztgsen( lapack_int* ijob, lapack_logical* wantq, lapack_logical* wantz, const lapack_logical* select, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* alpha, lapack_complex_double* beta, lapack_complex_double* q, lapack_int* ldq, lapack_complex_double* z, lapack_int* ldz, lapack_int* m, double* pl, double* pr, double* dif, lapack_complex_double* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_stgsyl( char* trans, lapack_int* ijob, lapack_int* m, lapack_int* n, const float* a, lapack_int* lda, const float* b, lapack_int* ldb, float* c, lapack_int* ldc, const float* d, lapack_int* ldd, const float* e, lapack_int* lde, float* f, lapack_int* ldf, float* scale, float* dif, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int *info ); void LAPACK_dtgsyl( char* trans, lapack_int* ijob, lapack_int* m, lapack_int* n, const double* a, lapack_int* lda, const double* b, lapack_int* ldb, double* c, lapack_int* ldc, const double* d, lapack_int* ldd, const double* e, lapack_int* lde, double* f, lapack_int* ldf, double* scale, double* dif, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int *info ); void LAPACK_ctgsyl( char* trans, lapack_int* ijob, lapack_int* m, lapack_int* n, const lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* c, lapack_int* ldc, const lapack_complex_float* d, lapack_int* ldd, const lapack_complex_float* e, lapack_int* lde, lapack_complex_float* f, lapack_int* ldf, float* scale, float* dif, lapack_complex_float* work, lapack_int* lwork, lapack_int* iwork, lapack_int *info ); void LAPACK_ztgsyl( char* trans, lapack_int* ijob, lapack_int* m, lapack_int* n, const lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* c, lapack_int* ldc, const lapack_complex_double* d, lapack_int* ldd, const lapack_complex_double* e, lapack_int* lde, lapack_complex_double* f, lapack_int* ldf, double* scale, double* dif, lapack_complex_double* work, lapack_int* lwork, lapack_int* iwork, lapack_int *info ); void LAPACK_stgsna( char* job, char* howmny, const lapack_logical* select, lapack_int* n, const float* a, lapack_int* lda, const float* b, lapack_int* ldb, const float* vl, lapack_int* ldvl, const float* vr, lapack_int* ldvr, float* s, float* dif, lapack_int* mm, lapack_int* m, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int *info ); void LAPACK_dtgsna( char* job, char* howmny, const lapack_logical* select, lapack_int* n, const double* a, lapack_int* lda, const double* b, lapack_int* ldb, const double* vl, lapack_int* ldvl, const double* vr, lapack_int* ldvr, double* s, double* dif, lapack_int* mm, lapack_int* m, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int *info ); void LAPACK_ctgsna( char* job, char* howmny, const lapack_logical* select, lapack_int* n, const lapack_complex_float* a, lapack_int* lda, const lapack_complex_float* b, lapack_int* ldb, const lapack_complex_float* vl, lapack_int* ldvl, const lapack_complex_float* vr, lapack_int* ldvr, float* s, float* dif, lapack_int* mm, lapack_int* m, lapack_complex_float* work, lapack_int* lwork, lapack_int* iwork, lapack_int *info ); void LAPACK_ztgsna( char* job, char* howmny, const lapack_logical* select, lapack_int* n, const lapack_complex_double* a, lapack_int* lda, const lapack_complex_double* b, lapack_int* ldb, const lapack_complex_double* vl, lapack_int* ldvl, const lapack_complex_double* vr, lapack_int* ldvr, double* s, double* dif, lapack_int* mm, lapack_int* m, lapack_complex_double* work, lapack_int* lwork, lapack_int* iwork, lapack_int *info ); void LAPACK_sggsvp( char* jobu, char* jobv, char* jobq, lapack_int* m, lapack_int* p, lapack_int* n, float* a, lapack_int* lda, float* b, lapack_int* ldb, float* tola, float* tolb, lapack_int* k, lapack_int* l, float* u, lapack_int* ldu, float* v, lapack_int* ldv, float* q, lapack_int* ldq, lapack_int* iwork, float* tau, float* work, lapack_int *info ); void LAPACK_dggsvp( char* jobu, char* jobv, char* jobq, lapack_int* m, lapack_int* p, lapack_int* n, double* a, lapack_int* lda, double* b, lapack_int* ldb, double* tola, double* tolb, lapack_int* k, lapack_int* l, double* u, lapack_int* ldu, double* v, lapack_int* ldv, double* q, lapack_int* ldq, lapack_int* iwork, double* tau, double* work, lapack_int *info ); void LAPACK_cggsvp( char* jobu, char* jobv, char* jobq, lapack_int* m, lapack_int* p, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, float* tola, float* tolb, lapack_int* k, lapack_int* l, lapack_complex_float* u, lapack_int* ldu, lapack_complex_float* v, lapack_int* ldv, lapack_complex_float* q, lapack_int* ldq, lapack_int* iwork, float* rwork, lapack_complex_float* tau, lapack_complex_float* work, lapack_int *info ); void LAPACK_zggsvp( char* jobu, char* jobv, char* jobq, lapack_int* m, lapack_int* p, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, double* tola, double* tolb, lapack_int* k, lapack_int* l, lapack_complex_double* u, lapack_int* ldu, lapack_complex_double* v, lapack_int* ldv, lapack_complex_double* q, lapack_int* ldq, lapack_int* iwork, double* rwork, lapack_complex_double* tau, lapack_complex_double* work, lapack_int *info ); void LAPACK_stgsja( char* jobu, char* jobv, char* jobq, lapack_int* m, lapack_int* p, lapack_int* n, lapack_int* k, lapack_int* l, float* a, lapack_int* lda, float* b, lapack_int* ldb, float* tola, float* tolb, float* alpha, float* beta, float* u, lapack_int* ldu, float* v, lapack_int* ldv, float* q, lapack_int* ldq, float* work, lapack_int* ncycle, lapack_int *info ); void LAPACK_dtgsja( char* jobu, char* jobv, char* jobq, lapack_int* m, lapack_int* p, lapack_int* n, lapack_int* k, lapack_int* l, double* a, lapack_int* lda, double* b, lapack_int* ldb, double* tola, double* tolb, double* alpha, double* beta, double* u, lapack_int* ldu, double* v, lapack_int* ldv, double* q, lapack_int* ldq, double* work, lapack_int* ncycle, lapack_int *info ); void LAPACK_ctgsja( char* jobu, char* jobv, char* jobq, lapack_int* m, lapack_int* p, lapack_int* n, lapack_int* k, lapack_int* l, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, float* tola, float* tolb, float* alpha, float* beta, lapack_complex_float* u, lapack_int* ldu, lapack_complex_float* v, lapack_int* ldv, lapack_complex_float* q, lapack_int* ldq, lapack_complex_float* work, lapack_int* ncycle, lapack_int *info ); void LAPACK_ztgsja( char* jobu, char* jobv, char* jobq, lapack_int* m, lapack_int* p, lapack_int* n, lapack_int* k, lapack_int* l, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, double* tola, double* tolb, double* alpha, double* beta, lapack_complex_double* u, lapack_int* ldu, lapack_complex_double* v, lapack_int* ldv, lapack_complex_double* q, lapack_int* ldq, lapack_complex_double* work, lapack_int* ncycle, lapack_int *info ); void LAPACK_sgels( char* trans, lapack_int* m, lapack_int* n, lapack_int* nrhs, float* a, lapack_int* lda, float* b, lapack_int* ldb, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dgels( char* trans, lapack_int* m, lapack_int* n, lapack_int* nrhs, double* a, lapack_int* lda, double* b, lapack_int* ldb, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cgels( char* trans, lapack_int* m, lapack_int* n, lapack_int* nrhs, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zgels( char* trans, lapack_int* m, lapack_int* n, lapack_int* nrhs, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sgelsy( lapack_int* m, lapack_int* n, lapack_int* nrhs, float* a, lapack_int* lda, float* b, lapack_int* ldb, lapack_int* jpvt, float* rcond, lapack_int* rank, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dgelsy( lapack_int* m, lapack_int* n, lapack_int* nrhs, double* a, lapack_int* lda, double* b, lapack_int* ldb, lapack_int* jpvt, double* rcond, lapack_int* rank, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cgelsy( lapack_int* m, lapack_int* n, lapack_int* nrhs, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, lapack_int* jpvt, float* rcond, lapack_int* rank, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int *info ); void LAPACK_zgelsy( lapack_int* m, lapack_int* n, lapack_int* nrhs, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, lapack_int* jpvt, double* rcond, lapack_int* rank, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int *info ); void LAPACK_sgelss( lapack_int* m, lapack_int* n, lapack_int* nrhs, float* a, lapack_int* lda, float* b, lapack_int* ldb, float* s, float* rcond, lapack_int* rank, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dgelss( lapack_int* m, lapack_int* n, lapack_int* nrhs, double* a, lapack_int* lda, double* b, lapack_int* ldb, double* s, double* rcond, lapack_int* rank, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cgelss( lapack_int* m, lapack_int* n, lapack_int* nrhs, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, float* s, float* rcond, lapack_int* rank, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int *info ); void LAPACK_zgelss( lapack_int* m, lapack_int* n, lapack_int* nrhs, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, double* s, double* rcond, lapack_int* rank, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int *info ); void LAPACK_sgelsd( lapack_int* m, lapack_int* n, lapack_int* nrhs, float* a, lapack_int* lda, float* b, lapack_int* ldb, float* s, float* rcond, lapack_int* rank, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int *info ); void LAPACK_dgelsd( lapack_int* m, lapack_int* n, lapack_int* nrhs, double* a, lapack_int* lda, double* b, lapack_int* ldb, double* s, double* rcond, lapack_int* rank, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int *info ); void LAPACK_cgelsd( lapack_int* m, lapack_int* n, lapack_int* nrhs, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, float* s, float* rcond, lapack_int* rank, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int* iwork, lapack_int *info ); void LAPACK_zgelsd( lapack_int* m, lapack_int* n, lapack_int* nrhs, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, double* s, double* rcond, lapack_int* rank, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int* iwork, lapack_int *info ); void LAPACK_sgglse( lapack_int* m, lapack_int* n, lapack_int* p, float* a, lapack_int* lda, float* b, lapack_int* ldb, float* c, float* d, float* x, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dgglse( lapack_int* m, lapack_int* n, lapack_int* p, double* a, lapack_int* lda, double* b, lapack_int* ldb, double* c, double* d, double* x, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cgglse( lapack_int* m, lapack_int* n, lapack_int* p, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* c, lapack_complex_float* d, lapack_complex_float* x, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zgglse( lapack_int* m, lapack_int* n, lapack_int* p, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* c, lapack_complex_double* d, lapack_complex_double* x, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sggglm( lapack_int* n, lapack_int* m, lapack_int* p, float* a, lapack_int* lda, float* b, lapack_int* ldb, float* d, float* x, float* y, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dggglm( lapack_int* n, lapack_int* m, lapack_int* p, double* a, lapack_int* lda, double* b, lapack_int* ldb, double* d, double* x, double* y, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cggglm( lapack_int* n, lapack_int* m, lapack_int* p, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* d, lapack_complex_float* x, lapack_complex_float* y, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zggglm( lapack_int* n, lapack_int* m, lapack_int* p, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* d, lapack_complex_double* x, lapack_complex_double* y, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_ssyev( char* jobz, char* uplo, lapack_int* n, float* a, lapack_int* lda, float* w, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dsyev( char* jobz, char* uplo, lapack_int* n, double* a, lapack_int* lda, double* w, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cheev( char* jobz, char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* lda, float* w, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int *info ); void LAPACK_zheev( char* jobz, char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* lda, double* w, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int *info ); void LAPACK_ssyevd( char* jobz, char* uplo, lapack_int* n, float* a, lapack_int* lda, float* w, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_dsyevd( char* jobz, char* uplo, lapack_int* n, double* a, lapack_int* lda, double* w, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_cheevd( char* jobz, char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* lda, float* w, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int* lrwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_zheevd( char* jobz, char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* lda, double* w, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int* lrwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_ssyevx( char* jobz, char* range, char* uplo, lapack_int* n, float* a, lapack_int* lda, float* vl, float* vu, lapack_int* il, lapack_int* iu, float* abstol, lapack_int* m, float* w, float* z, lapack_int* ldz, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_dsyevx( char* jobz, char* range, char* uplo, lapack_int* n, double* a, lapack_int* lda, double* vl, double* vu, lapack_int* il, lapack_int* iu, double* abstol, lapack_int* m, double* w, double* z, lapack_int* ldz, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_cheevx( char* jobz, char* range, char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* lda, float* vl, float* vu, lapack_int* il, lapack_int* iu, float* abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int* ldz, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_zheevx( char* jobz, char* range, char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* lda, double* vl, double* vu, lapack_int* il, lapack_int* iu, double* abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int* ldz, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_ssyevr( char* jobz, char* range, char* uplo, lapack_int* n, float* a, lapack_int* lda, float* vl, float* vu, lapack_int* il, lapack_int* iu, float* abstol, lapack_int* m, float* w, float* z, lapack_int* ldz, lapack_int* isuppz, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_dsyevr( char* jobz, char* range, char* uplo, lapack_int* n, double* a, lapack_int* lda, double* vl, double* vu, lapack_int* il, lapack_int* iu, double* abstol, lapack_int* m, double* w, double* z, lapack_int* ldz, lapack_int* isuppz, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_cheevr( char* jobz, char* range, char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* lda, float* vl, float* vu, lapack_int* il, lapack_int* iu, float* abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int* ldz, lapack_int* isuppz, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int* lrwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_zheevr( char* jobz, char* range, char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* lda, double* vl, double* vu, lapack_int* il, lapack_int* iu, double* abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int* ldz, lapack_int* isuppz, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int* lrwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_sspev( char* jobz, char* uplo, lapack_int* n, float* ap, float* w, float* z, lapack_int* ldz, float* work, lapack_int *info ); void LAPACK_dspev( char* jobz, char* uplo, lapack_int* n, double* ap, double* w, double* z, lapack_int* ldz, double* work, lapack_int *info ); void LAPACK_chpev( char* jobz, char* uplo, lapack_int* n, lapack_complex_float* ap, float* w, lapack_complex_float* z, lapack_int* ldz, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zhpev( char* jobz, char* uplo, lapack_int* n, lapack_complex_double* ap, double* w, lapack_complex_double* z, lapack_int* ldz, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_sspevd( char* jobz, char* uplo, lapack_int* n, float* ap, float* w, float* z, lapack_int* ldz, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_dspevd( char* jobz, char* uplo, lapack_int* n, double* ap, double* w, double* z, lapack_int* ldz, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_chpevd( char* jobz, char* uplo, lapack_int* n, lapack_complex_float* ap, float* w, lapack_complex_float* z, lapack_int* ldz, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int* lrwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_zhpevd( char* jobz, char* uplo, lapack_int* n, lapack_complex_double* ap, double* w, lapack_complex_double* z, lapack_int* ldz, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int* lrwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_sspevx( char* jobz, char* range, char* uplo, lapack_int* n, float* ap, float* vl, float* vu, lapack_int* il, lapack_int* iu, float* abstol, lapack_int* m, float* w, float* z, lapack_int* ldz, float* work, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_dspevx( char* jobz, char* range, char* uplo, lapack_int* n, double* ap, double* vl, double* vu, lapack_int* il, lapack_int* iu, double* abstol, lapack_int* m, double* w, double* z, lapack_int* ldz, double* work, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_chpevx( char* jobz, char* range, char* uplo, lapack_int* n, lapack_complex_float* ap, float* vl, float* vu, lapack_int* il, lapack_int* iu, float* abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int* ldz, lapack_complex_float* work, float* rwork, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_zhpevx( char* jobz, char* range, char* uplo, lapack_int* n, lapack_complex_double* ap, double* vl, double* vu, lapack_int* il, lapack_int* iu, double* abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int* ldz, lapack_complex_double* work, double* rwork, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_ssbev( char* jobz, char* uplo, lapack_int* n, lapack_int* kd, float* ab, lapack_int* ldab, float* w, float* z, lapack_int* ldz, float* work, lapack_int *info ); void LAPACK_dsbev( char* jobz, char* uplo, lapack_int* n, lapack_int* kd, double* ab, lapack_int* ldab, double* w, double* z, lapack_int* ldz, double* work, lapack_int *info ); void LAPACK_chbev( char* jobz, char* uplo, lapack_int* n, lapack_int* kd, lapack_complex_float* ab, lapack_int* ldab, float* w, lapack_complex_float* z, lapack_int* ldz, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zhbev( char* jobz, char* uplo, lapack_int* n, lapack_int* kd, lapack_complex_double* ab, lapack_int* ldab, double* w, lapack_complex_double* z, lapack_int* ldz, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_ssbevd( char* jobz, char* uplo, lapack_int* n, lapack_int* kd, float* ab, lapack_int* ldab, float* w, float* z, lapack_int* ldz, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_dsbevd( char* jobz, char* uplo, lapack_int* n, lapack_int* kd, double* ab, lapack_int* ldab, double* w, double* z, lapack_int* ldz, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_chbevd( char* jobz, char* uplo, lapack_int* n, lapack_int* kd, lapack_complex_float* ab, lapack_int* ldab, float* w, lapack_complex_float* z, lapack_int* ldz, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int* lrwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_zhbevd( char* jobz, char* uplo, lapack_int* n, lapack_int* kd, lapack_complex_double* ab, lapack_int* ldab, double* w, lapack_complex_double* z, lapack_int* ldz, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int* lrwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_ssbevx( char* jobz, char* range, char* uplo, lapack_int* n, lapack_int* kd, float* ab, lapack_int* ldab, float* q, lapack_int* ldq, float* vl, float* vu, lapack_int* il, lapack_int* iu, float* abstol, lapack_int* m, float* w, float* z, lapack_int* ldz, float* work, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_dsbevx( char* jobz, char* range, char* uplo, lapack_int* n, lapack_int* kd, double* ab, lapack_int* ldab, double* q, lapack_int* ldq, double* vl, double* vu, lapack_int* il, lapack_int* iu, double* abstol, lapack_int* m, double* w, double* z, lapack_int* ldz, double* work, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_chbevx( char* jobz, char* range, char* uplo, lapack_int* n, lapack_int* kd, lapack_complex_float* ab, lapack_int* ldab, lapack_complex_float* q, lapack_int* ldq, float* vl, float* vu, lapack_int* il, lapack_int* iu, float* abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int* ldz, lapack_complex_float* work, float* rwork, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_zhbevx( char* jobz, char* range, char* uplo, lapack_int* n, lapack_int* kd, lapack_complex_double* ab, lapack_int* ldab, lapack_complex_double* q, lapack_int* ldq, double* vl, double* vu, lapack_int* il, lapack_int* iu, double* abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int* ldz, lapack_complex_double* work, double* rwork, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_sstev( char* jobz, lapack_int* n, float* d, float* e, float* z, lapack_int* ldz, float* work, lapack_int *info ); void LAPACK_dstev( char* jobz, lapack_int* n, double* d, double* e, double* z, lapack_int* ldz, double* work, lapack_int *info ); void LAPACK_sstevd( char* jobz, lapack_int* n, float* d, float* e, float* z, lapack_int* ldz, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_dstevd( char* jobz, lapack_int* n, double* d, double* e, double* z, lapack_int* ldz, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_sstevx( char* jobz, char* range, lapack_int* n, float* d, float* e, float* vl, float* vu, lapack_int* il, lapack_int* iu, float* abstol, lapack_int* m, float* w, float* z, lapack_int* ldz, float* work, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_dstevx( char* jobz, char* range, lapack_int* n, double* d, double* e, double* vl, double* vu, lapack_int* il, lapack_int* iu, double* abstol, lapack_int* m, double* w, double* z, lapack_int* ldz, double* work, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_sstevr( char* jobz, char* range, lapack_int* n, float* d, float* e, float* vl, float* vu, lapack_int* il, lapack_int* iu, float* abstol, lapack_int* m, float* w, float* z, lapack_int* ldz, lapack_int* isuppz, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_dstevr( char* jobz, char* range, lapack_int* n, double* d, double* e, double* vl, double* vu, lapack_int* il, lapack_int* iu, double* abstol, lapack_int* m, double* w, double* z, lapack_int* ldz, lapack_int* isuppz, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_sgees( char* jobvs, char* sort, LAPACK_S_SELECT2 select, lapack_int* n, float* a, lapack_int* lda, lapack_int* sdim, float* wr, float* wi, float* vs, lapack_int* ldvs, float* work, lapack_int* lwork, lapack_logical* bwork, lapack_int *info ); void LAPACK_dgees( char* jobvs, char* sort, LAPACK_D_SELECT2 select, lapack_int* n, double* a, lapack_int* lda, lapack_int* sdim, double* wr, double* wi, double* vs, lapack_int* ldvs, double* work, lapack_int* lwork, lapack_logical* bwork, lapack_int *info ); void LAPACK_cgees( char* jobvs, char* sort, LAPACK_C_SELECT1 select, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_int* sdim, lapack_complex_float* w, lapack_complex_float* vs, lapack_int* ldvs, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_logical* bwork, lapack_int *info ); void LAPACK_zgees( char* jobvs, char* sort, LAPACK_Z_SELECT1 select, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_int* sdim, lapack_complex_double* w, lapack_complex_double* vs, lapack_int* ldvs, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_logical* bwork, lapack_int *info ); void LAPACK_sgeesx( char* jobvs, char* sort, LAPACK_S_SELECT2 select, char* sense, lapack_int* n, float* a, lapack_int* lda, lapack_int* sdim, float* wr, float* wi, float* vs, lapack_int* ldvs, float* rconde, float* rcondv, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_logical* bwork, lapack_int *info ); void LAPACK_dgeesx( char* jobvs, char* sort, LAPACK_D_SELECT2 select, char* sense, lapack_int* n, double* a, lapack_int* lda, lapack_int* sdim, double* wr, double* wi, double* vs, lapack_int* ldvs, double* rconde, double* rcondv, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_logical* bwork, lapack_int *info ); void LAPACK_cgeesx( char* jobvs, char* sort, LAPACK_C_SELECT1 select, char* sense, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_int* sdim, lapack_complex_float* w, lapack_complex_float* vs, lapack_int* ldvs, float* rconde, float* rcondv, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_logical* bwork, lapack_int *info ); void LAPACK_zgeesx( char* jobvs, char* sort, LAPACK_Z_SELECT1 select, char* sense, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_int* sdim, lapack_complex_double* w, lapack_complex_double* vs, lapack_int* ldvs, double* rconde, double* rcondv, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_logical* bwork, lapack_int *info ); void LAPACK_sgeev( char* jobvl, char* jobvr, lapack_int* n, float* a, lapack_int* lda, float* wr, float* wi, float* vl, lapack_int* ldvl, float* vr, lapack_int* ldvr, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dgeev( char* jobvl, char* jobvr, lapack_int* n, double* a, lapack_int* lda, double* wr, double* wi, double* vl, lapack_int* ldvl, double* vr, lapack_int* ldvr, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cgeev( char* jobvl, char* jobvr, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* w, lapack_complex_float* vl, lapack_int* ldvl, lapack_complex_float* vr, lapack_int* ldvr, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int *info ); void LAPACK_zgeev( char* jobvl, char* jobvr, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* w, lapack_complex_double* vl, lapack_int* ldvl, lapack_complex_double* vr, lapack_int* ldvr, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int *info ); void LAPACK_sgeevx( char* balanc, char* jobvl, char* jobvr, char* sense, lapack_int* n, float* a, lapack_int* lda, float* wr, float* wi, float* vl, lapack_int* ldvl, float* vr, lapack_int* ldvr, lapack_int* ilo, lapack_int* ihi, float* scale, float* abnrm, float* rconde, float* rcondv, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int *info ); void LAPACK_dgeevx( char* balanc, char* jobvl, char* jobvr, char* sense, lapack_int* n, double* a, lapack_int* lda, double* wr, double* wi, double* vl, lapack_int* ldvl, double* vr, lapack_int* ldvr, lapack_int* ilo, lapack_int* ihi, double* scale, double* abnrm, double* rconde, double* rcondv, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int *info ); void LAPACK_cgeevx( char* balanc, char* jobvl, char* jobvr, char* sense, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* w, lapack_complex_float* vl, lapack_int* ldvl, lapack_complex_float* vr, lapack_int* ldvr, lapack_int* ilo, lapack_int* ihi, float* scale, float* abnrm, float* rconde, float* rcondv, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int *info ); void LAPACK_zgeevx( char* balanc, char* jobvl, char* jobvr, char* sense, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* w, lapack_complex_double* vl, lapack_int* ldvl, lapack_complex_double* vr, lapack_int* ldvr, lapack_int* ilo, lapack_int* ihi, double* scale, double* abnrm, double* rconde, double* rcondv, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int *info ); void LAPACK_sgesvd( char* jobu, char* jobvt, lapack_int* m, lapack_int* n, float* a, lapack_int* lda, float* s, float* u, lapack_int* ldu, float* vt, lapack_int* ldvt, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dgesvd( char* jobu, char* jobvt, lapack_int* m, lapack_int* n, double* a, lapack_int* lda, double* s, double* u, lapack_int* ldu, double* vt, lapack_int* ldvt, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cgesvd( char* jobu, char* jobvt, lapack_int* m, lapack_int* n, lapack_complex_float* a, lapack_int* lda, float* s, lapack_complex_float* u, lapack_int* ldu, lapack_complex_float* vt, lapack_int* ldvt, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int *info ); void LAPACK_zgesvd( char* jobu, char* jobvt, lapack_int* m, lapack_int* n, lapack_complex_double* a, lapack_int* lda, double* s, lapack_complex_double* u, lapack_int* ldu, lapack_complex_double* vt, lapack_int* ldvt, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int *info ); void LAPACK_sgesdd( char* jobz, lapack_int* m, lapack_int* n, float* a, lapack_int* lda, float* s, float* u, lapack_int* ldu, float* vt, lapack_int* ldvt, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int *info ); void LAPACK_dgesdd( char* jobz, lapack_int* m, lapack_int* n, double* a, lapack_int* lda, double* s, double* u, lapack_int* ldu, double* vt, lapack_int* ldvt, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int *info ); void LAPACK_cgesdd( char* jobz, lapack_int* m, lapack_int* n, lapack_complex_float* a, lapack_int* lda, float* s, lapack_complex_float* u, lapack_int* ldu, lapack_complex_float* vt, lapack_int* ldvt, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int* iwork, lapack_int *info ); void LAPACK_zgesdd( char* jobz, lapack_int* m, lapack_int* n, lapack_complex_double* a, lapack_int* lda, double* s, lapack_complex_double* u, lapack_int* ldu, lapack_complex_double* vt, lapack_int* ldvt, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int* iwork, lapack_int *info ); void LAPACK_dgejsv( char* joba, char* jobu, char* jobv, char* jobr, char* jobt, char* jobp, lapack_int* m, lapack_int* n, double* a, lapack_int* lda, double* sva, double* u, lapack_int* ldu, double* v, lapack_int* ldv, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int *info ); void LAPACK_sgejsv( char* joba, char* jobu, char* jobv, char* jobr, char* jobt, char* jobp, lapack_int* m, lapack_int* n, float* a, lapack_int* lda, float* sva, float* u, lapack_int* ldu, float* v, lapack_int* ldv, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int *info ); void LAPACK_dgesvj( char* joba, char* jobu, char* jobv, lapack_int* m, lapack_int* n, double* a, lapack_int* lda, double* sva, lapack_int* mv, double* v, lapack_int* ldv, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sgesvj( char* joba, char* jobu, char* jobv, lapack_int* m, lapack_int* n, float* a, lapack_int* lda, float* sva, lapack_int* mv, float* v, lapack_int* ldv, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_sggsvd( char* jobu, char* jobv, char* jobq, lapack_int* m, lapack_int* n, lapack_int* p, lapack_int* k, lapack_int* l, float* a, lapack_int* lda, float* b, lapack_int* ldb, float* alpha, float* beta, float* u, lapack_int* ldu, float* v, lapack_int* ldv, float* q, lapack_int* ldq, float* work, lapack_int* iwork, lapack_int *info ); void LAPACK_dggsvd( char* jobu, char* jobv, char* jobq, lapack_int* m, lapack_int* n, lapack_int* p, lapack_int* k, lapack_int* l, double* a, lapack_int* lda, double* b, lapack_int* ldb, double* alpha, double* beta, double* u, lapack_int* ldu, double* v, lapack_int* ldv, double* q, lapack_int* ldq, double* work, lapack_int* iwork, lapack_int *info ); void LAPACK_cggsvd( char* jobu, char* jobv, char* jobq, lapack_int* m, lapack_int* n, lapack_int* p, lapack_int* k, lapack_int* l, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, float* alpha, float* beta, lapack_complex_float* u, lapack_int* ldu, lapack_complex_float* v, lapack_int* ldv, lapack_complex_float* q, lapack_int* ldq, lapack_complex_float* work, float* rwork, lapack_int* iwork, lapack_int *info ); void LAPACK_zggsvd( char* jobu, char* jobv, char* jobq, lapack_int* m, lapack_int* n, lapack_int* p, lapack_int* k, lapack_int* l, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, double* alpha, double* beta, lapack_complex_double* u, lapack_int* ldu, lapack_complex_double* v, lapack_int* ldv, lapack_complex_double* q, lapack_int* ldq, lapack_complex_double* work, double* rwork, lapack_int* iwork, lapack_int *info ); void LAPACK_ssygv( lapack_int* itype, char* jobz, char* uplo, lapack_int* n, float* a, lapack_int* lda, float* b, lapack_int* ldb, float* w, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dsygv( lapack_int* itype, char* jobz, char* uplo, lapack_int* n, double* a, lapack_int* lda, double* b, lapack_int* ldb, double* w, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_chegv( lapack_int* itype, char* jobz, char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, float* w, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int *info ); void LAPACK_zhegv( lapack_int* itype, char* jobz, char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, double* w, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int *info ); void LAPACK_ssygvd( lapack_int* itype, char* jobz, char* uplo, lapack_int* n, float* a, lapack_int* lda, float* b, lapack_int* ldb, float* w, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_dsygvd( lapack_int* itype, char* jobz, char* uplo, lapack_int* n, double* a, lapack_int* lda, double* b, lapack_int* ldb, double* w, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_chegvd( lapack_int* itype, char* jobz, char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, float* w, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int* lrwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_zhegvd( lapack_int* itype, char* jobz, char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, double* w, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int* lrwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_ssygvx( lapack_int* itype, char* jobz, char* range, char* uplo, lapack_int* n, float* a, lapack_int* lda, float* b, lapack_int* ldb, float* vl, float* vu, lapack_int* il, lapack_int* iu, float* abstol, lapack_int* m, float* w, float* z, lapack_int* ldz, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_dsygvx( lapack_int* itype, char* jobz, char* range, char* uplo, lapack_int* n, double* a, lapack_int* lda, double* b, lapack_int* ldb, double* vl, double* vu, lapack_int* il, lapack_int* iu, double* abstol, lapack_int* m, double* w, double* z, lapack_int* ldz, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_chegvx( lapack_int* itype, char* jobz, char* range, char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, float* vl, float* vu, lapack_int* il, lapack_int* iu, float* abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int* ldz, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_zhegvx( lapack_int* itype, char* jobz, char* range, char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, double* vl, double* vu, lapack_int* il, lapack_int* iu, double* abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int* ldz, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_sspgv( lapack_int* itype, char* jobz, char* uplo, lapack_int* n, float* ap, float* bp, float* w, float* z, lapack_int* ldz, float* work, lapack_int *info ); void LAPACK_dspgv( lapack_int* itype, char* jobz, char* uplo, lapack_int* n, double* ap, double* bp, double* w, double* z, lapack_int* ldz, double* work, lapack_int *info ); void LAPACK_chpgv( lapack_int* itype, char* jobz, char* uplo, lapack_int* n, lapack_complex_float* ap, lapack_complex_float* bp, float* w, lapack_complex_float* z, lapack_int* ldz, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zhpgv( lapack_int* itype, char* jobz, char* uplo, lapack_int* n, lapack_complex_double* ap, lapack_complex_double* bp, double* w, lapack_complex_double* z, lapack_int* ldz, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_sspgvd( lapack_int* itype, char* jobz, char* uplo, lapack_int* n, float* ap, float* bp, float* w, float* z, lapack_int* ldz, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_dspgvd( lapack_int* itype, char* jobz, char* uplo, lapack_int* n, double* ap, double* bp, double* w, double* z, lapack_int* ldz, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_chpgvd( lapack_int* itype, char* jobz, char* uplo, lapack_int* n, lapack_complex_float* ap, lapack_complex_float* bp, float* w, lapack_complex_float* z, lapack_int* ldz, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int* lrwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_zhpgvd( lapack_int* itype, char* jobz, char* uplo, lapack_int* n, lapack_complex_double* ap, lapack_complex_double* bp, double* w, lapack_complex_double* z, lapack_int* ldz, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int* lrwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_sspgvx( lapack_int* itype, char* jobz, char* range, char* uplo, lapack_int* n, float* ap, float* bp, float* vl, float* vu, lapack_int* il, lapack_int* iu, float* abstol, lapack_int* m, float* w, float* z, lapack_int* ldz, float* work, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_dspgvx( lapack_int* itype, char* jobz, char* range, char* uplo, lapack_int* n, double* ap, double* bp, double* vl, double* vu, lapack_int* il, lapack_int* iu, double* abstol, lapack_int* m, double* w, double* z, lapack_int* ldz, double* work, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_chpgvx( lapack_int* itype, char* jobz, char* range, char* uplo, lapack_int* n, lapack_complex_float* ap, lapack_complex_float* bp, float* vl, float* vu, lapack_int* il, lapack_int* iu, float* abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int* ldz, lapack_complex_float* work, float* rwork, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_zhpgvx( lapack_int* itype, char* jobz, char* range, char* uplo, lapack_int* n, lapack_complex_double* ap, lapack_complex_double* bp, double* vl, double* vu, lapack_int* il, lapack_int* iu, double* abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int* ldz, lapack_complex_double* work, double* rwork, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_ssbgv( char* jobz, char* uplo, lapack_int* n, lapack_int* ka, lapack_int* kb, float* ab, lapack_int* ldab, float* bb, lapack_int* ldbb, float* w, float* z, lapack_int* ldz, float* work, lapack_int *info ); void LAPACK_dsbgv( char* jobz, char* uplo, lapack_int* n, lapack_int* ka, lapack_int* kb, double* ab, lapack_int* ldab, double* bb, lapack_int* ldbb, double* w, double* z, lapack_int* ldz, double* work, lapack_int *info ); void LAPACK_chbgv( char* jobz, char* uplo, lapack_int* n, lapack_int* ka, lapack_int* kb, lapack_complex_float* ab, lapack_int* ldab, lapack_complex_float* bb, lapack_int* ldbb, float* w, lapack_complex_float* z, lapack_int* ldz, lapack_complex_float* work, float* rwork, lapack_int *info ); void LAPACK_zhbgv( char* jobz, char* uplo, lapack_int* n, lapack_int* ka, lapack_int* kb, lapack_complex_double* ab, lapack_int* ldab, lapack_complex_double* bb, lapack_int* ldbb, double* w, lapack_complex_double* z, lapack_int* ldz, lapack_complex_double* work, double* rwork, lapack_int *info ); void LAPACK_ssbgvd( char* jobz, char* uplo, lapack_int* n, lapack_int* ka, lapack_int* kb, float* ab, lapack_int* ldab, float* bb, lapack_int* ldbb, float* w, float* z, lapack_int* ldz, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_dsbgvd( char* jobz, char* uplo, lapack_int* n, lapack_int* ka, lapack_int* kb, double* ab, lapack_int* ldab, double* bb, lapack_int* ldbb, double* w, double* z, lapack_int* ldz, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_chbgvd( char* jobz, char* uplo, lapack_int* n, lapack_int* ka, lapack_int* kb, lapack_complex_float* ab, lapack_int* ldab, lapack_complex_float* bb, lapack_int* ldbb, float* w, lapack_complex_float* z, lapack_int* ldz, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int* lrwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_zhbgvd( char* jobz, char* uplo, lapack_int* n, lapack_int* ka, lapack_int* kb, lapack_complex_double* ab, lapack_int* ldab, lapack_complex_double* bb, lapack_int* ldbb, double* w, lapack_complex_double* z, lapack_int* ldz, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int* lrwork, lapack_int* iwork, lapack_int* liwork, lapack_int *info ); void LAPACK_ssbgvx( char* jobz, char* range, char* uplo, lapack_int* n, lapack_int* ka, lapack_int* kb, float* ab, lapack_int* ldab, float* bb, lapack_int* ldbb, float* q, lapack_int* ldq, float* vl, float* vu, lapack_int* il, lapack_int* iu, float* abstol, lapack_int* m, float* w, float* z, lapack_int* ldz, float* work, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_dsbgvx( char* jobz, char* range, char* uplo, lapack_int* n, lapack_int* ka, lapack_int* kb, double* ab, lapack_int* ldab, double* bb, lapack_int* ldbb, double* q, lapack_int* ldq, double* vl, double* vu, lapack_int* il, lapack_int* iu, double* abstol, lapack_int* m, double* w, double* z, lapack_int* ldz, double* work, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_chbgvx( char* jobz, char* range, char* uplo, lapack_int* n, lapack_int* ka, lapack_int* kb, lapack_complex_float* ab, lapack_int* ldab, lapack_complex_float* bb, lapack_int* ldbb, lapack_complex_float* q, lapack_int* ldq, float* vl, float* vu, lapack_int* il, lapack_int* iu, float* abstol, lapack_int* m, float* w, lapack_complex_float* z, lapack_int* ldz, lapack_complex_float* work, float* rwork, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_zhbgvx( char* jobz, char* range, char* uplo, lapack_int* n, lapack_int* ka, lapack_int* kb, lapack_complex_double* ab, lapack_int* ldab, lapack_complex_double* bb, lapack_int* ldbb, lapack_complex_double* q, lapack_int* ldq, double* vl, double* vu, lapack_int* il, lapack_int* iu, double* abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int* ldz, lapack_complex_double* work, double* rwork, lapack_int* iwork, lapack_int* ifail, lapack_int *info ); void LAPACK_sgges( char* jobvsl, char* jobvsr, char* sort, LAPACK_S_SELECT3 selctg, lapack_int* n, float* a, lapack_int* lda, float* b, lapack_int* ldb, lapack_int* sdim, float* alphar, float* alphai, float* beta, float* vsl, lapack_int* ldvsl, float* vsr, lapack_int* ldvsr, float* work, lapack_int* lwork, lapack_logical* bwork, lapack_int *info ); void LAPACK_dgges( char* jobvsl, char* jobvsr, char* sort, LAPACK_D_SELECT3 selctg, lapack_int* n, double* a, lapack_int* lda, double* b, lapack_int* ldb, lapack_int* sdim, double* alphar, double* alphai, double* beta, double* vsl, lapack_int* ldvsl, double* vsr, lapack_int* ldvsr, double* work, lapack_int* lwork, lapack_logical* bwork, lapack_int *info ); void LAPACK_cgges( char* jobvsl, char* jobvsr, char* sort, LAPACK_C_SELECT2 selctg, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, lapack_int* sdim, lapack_complex_float* alpha, lapack_complex_float* beta, lapack_complex_float* vsl, lapack_int* ldvsl, lapack_complex_float* vsr, lapack_int* ldvsr, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_logical* bwork, lapack_int *info ); void LAPACK_zgges( char* jobvsl, char* jobvsr, char* sort, LAPACK_Z_SELECT2 selctg, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, lapack_int* sdim, lapack_complex_double* alpha, lapack_complex_double* beta, lapack_complex_double* vsl, lapack_int* ldvsl, lapack_complex_double* vsr, lapack_int* ldvsr, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_logical* bwork, lapack_int *info ); void LAPACK_sggesx( char* jobvsl, char* jobvsr, char* sort, LAPACK_S_SELECT3 selctg, char* sense, lapack_int* n, float* a, lapack_int* lda, float* b, lapack_int* ldb, lapack_int* sdim, float* alphar, float* alphai, float* beta, float* vsl, lapack_int* ldvsl, float* vsr, lapack_int* ldvsr, float* rconde, float* rcondv, float* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_logical* bwork, lapack_int *info ); void LAPACK_dggesx( char* jobvsl, char* jobvsr, char* sort, LAPACK_D_SELECT3 selctg, char* sense, lapack_int* n, double* a, lapack_int* lda, double* b, lapack_int* ldb, lapack_int* sdim, double* alphar, double* alphai, double* beta, double* vsl, lapack_int* ldvsl, double* vsr, lapack_int* ldvsr, double* rconde, double* rcondv, double* work, lapack_int* lwork, lapack_int* iwork, lapack_int* liwork, lapack_logical* bwork, lapack_int *info ); void LAPACK_cggesx( char* jobvsl, char* jobvsr, char* sort, LAPACK_C_SELECT2 selctg, char* sense, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, lapack_int* sdim, lapack_complex_float* alpha, lapack_complex_float* beta, lapack_complex_float* vsl, lapack_int* ldvsl, lapack_complex_float* vsr, lapack_int* ldvsr, float* rconde, float* rcondv, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int* iwork, lapack_int* liwork, lapack_logical* bwork, lapack_int *info ); void LAPACK_zggesx( char* jobvsl, char* jobvsr, char* sort, LAPACK_Z_SELECT2 selctg, char* sense, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, lapack_int* sdim, lapack_complex_double* alpha, lapack_complex_double* beta, lapack_complex_double* vsl, lapack_int* ldvsl, lapack_complex_double* vsr, lapack_int* ldvsr, double* rconde, double* rcondv, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int* iwork, lapack_int* liwork, lapack_logical* bwork, lapack_int *info ); void LAPACK_sggev( char* jobvl, char* jobvr, lapack_int* n, float* a, lapack_int* lda, float* b, lapack_int* ldb, float* alphar, float* alphai, float* beta, float* vl, lapack_int* ldvl, float* vr, lapack_int* ldvr, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dggev( char* jobvl, char* jobvr, lapack_int* n, double* a, lapack_int* lda, double* b, lapack_int* ldb, double* alphar, double* alphai, double* beta, double* vl, lapack_int* ldvl, double* vr, lapack_int* ldvr, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cggev( char* jobvl, char* jobvr, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* alpha, lapack_complex_float* beta, lapack_complex_float* vl, lapack_int* ldvl, lapack_complex_float* vr, lapack_int* ldvr, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int *info ); void LAPACK_zggev( char* jobvl, char* jobvr, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* alpha, lapack_complex_double* beta, lapack_complex_double* vl, lapack_int* ldvl, lapack_complex_double* vr, lapack_int* ldvr, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int *info ); void LAPACK_sggevx( char* balanc, char* jobvl, char* jobvr, char* sense, lapack_int* n, float* a, lapack_int* lda, float* b, lapack_int* ldb, float* alphar, float* alphai, float* beta, float* vl, lapack_int* ldvl, float* vr, lapack_int* ldvr, lapack_int* ilo, lapack_int* ihi, float* lscale, float* rscale, float* abnrm, float* bbnrm, float* rconde, float* rcondv, float* work, lapack_int* lwork, lapack_int* iwork, lapack_logical* bwork, lapack_int *info ); void LAPACK_dggevx( char* balanc, char* jobvl, char* jobvr, char* sense, lapack_int* n, double* a, lapack_int* lda, double* b, lapack_int* ldb, double* alphar, double* alphai, double* beta, double* vl, lapack_int* ldvl, double* vr, lapack_int* ldvr, lapack_int* ilo, lapack_int* ihi, double* lscale, double* rscale, double* abnrm, double* bbnrm, double* rconde, double* rcondv, double* work, lapack_int* lwork, lapack_int* iwork, lapack_logical* bwork, lapack_int *info ); void LAPACK_cggevx( char* balanc, char* jobvl, char* jobvr, char* sense, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* alpha, lapack_complex_float* beta, lapack_complex_float* vl, lapack_int* ldvl, lapack_complex_float* vr, lapack_int* ldvr, lapack_int* ilo, lapack_int* ihi, float* lscale, float* rscale, float* abnrm, float* bbnrm, float* rconde, float* rcondv, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int* iwork, lapack_logical* bwork, lapack_int *info ); void LAPACK_zggevx( char* balanc, char* jobvl, char* jobvr, char* sense, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* alpha, lapack_complex_double* beta, lapack_complex_double* vl, lapack_int* ldvl, lapack_complex_double* vr, lapack_int* ldvr, lapack_int* ilo, lapack_int* ihi, double* lscale, double* rscale, double* abnrm, double* bbnrm, double* rconde, double* rcondv, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int* iwork, lapack_logical* bwork, lapack_int *info ); void LAPACK_dsfrk( char* transr, char* uplo, char* trans, lapack_int* n, lapack_int* k, double* alpha, const double* a, lapack_int* lda, double* beta, double* c ); void LAPACK_ssfrk( char* transr, char* uplo, char* trans, lapack_int* n, lapack_int* k, float* alpha, const float* a, lapack_int* lda, float* beta, float* c ); void LAPACK_zhfrk( char* transr, char* uplo, char* trans, lapack_int* n, lapack_int* k, double* alpha, const lapack_complex_double* a, lapack_int* lda, double* beta, lapack_complex_double* c ); void LAPACK_chfrk( char* transr, char* uplo, char* trans, lapack_int* n, lapack_int* k, float* alpha, const lapack_complex_float* a, lapack_int* lda, float* beta, lapack_complex_float* c ); void LAPACK_dtfsm( char* transr, char* side, char* uplo, char* trans, char* diag, lapack_int* m, lapack_int* n, double* alpha, const double* a, double* b, lapack_int* ldb ); void LAPACK_stfsm( char* transr, char* side, char* uplo, char* trans, char* diag, lapack_int* m, lapack_int* n, float* alpha, const float* a, float* b, lapack_int* ldb ); void LAPACK_ztfsm( char* transr, char* side, char* uplo, char* trans, char* diag, lapack_int* m, lapack_int* n, lapack_complex_double* alpha, const lapack_complex_double* a, lapack_complex_double* b, lapack_int* ldb ); void LAPACK_ctfsm( char* transr, char* side, char* uplo, char* trans, char* diag, lapack_int* m, lapack_int* n, lapack_complex_float* alpha, const lapack_complex_float* a, lapack_complex_float* b, lapack_int* ldb ); void LAPACK_dtfttp( char* transr, char* uplo, lapack_int* n, const double* arf, double* ap, lapack_int *info ); void LAPACK_stfttp( char* transr, char* uplo, lapack_int* n, const float* arf, float* ap, lapack_int *info ); void LAPACK_ztfttp( char* transr, char* uplo, lapack_int* n, const lapack_complex_double* arf, lapack_complex_double* ap, lapack_int *info ); void LAPACK_ctfttp( char* transr, char* uplo, lapack_int* n, const lapack_complex_float* arf, lapack_complex_float* ap, lapack_int *info ); void LAPACK_dtfttr( char* transr, char* uplo, lapack_int* n, const double* arf, double* a, lapack_int* lda, lapack_int *info ); void LAPACK_stfttr( char* transr, char* uplo, lapack_int* n, const float* arf, float* a, lapack_int* lda, lapack_int *info ); void LAPACK_ztfttr( char* transr, char* uplo, lapack_int* n, const lapack_complex_double* arf, lapack_complex_double* a, lapack_int* lda, lapack_int *info ); void LAPACK_ctfttr( char* transr, char* uplo, lapack_int* n, const lapack_complex_float* arf, lapack_complex_float* a, lapack_int* lda, lapack_int *info ); void LAPACK_dtpttf( char* transr, char* uplo, lapack_int* n, const double* ap, double* arf, lapack_int *info ); void LAPACK_stpttf( char* transr, char* uplo, lapack_int* n, const float* ap, float* arf, lapack_int *info ); void LAPACK_ztpttf( char* transr, char* uplo, lapack_int* n, const lapack_complex_double* ap, lapack_complex_double* arf, lapack_int *info ); void LAPACK_ctpttf( char* transr, char* uplo, lapack_int* n, const lapack_complex_float* ap, lapack_complex_float* arf, lapack_int *info ); void LAPACK_dtpttr( char* uplo, lapack_int* n, const double* ap, double* a, lapack_int* lda, lapack_int *info ); void LAPACK_stpttr( char* uplo, lapack_int* n, const float* ap, float* a, lapack_int* lda, lapack_int *info ); void LAPACK_ztpttr( char* uplo, lapack_int* n, const lapack_complex_double* ap, lapack_complex_double* a, lapack_int* lda, lapack_int *info ); void LAPACK_ctpttr( char* uplo, lapack_int* n, const lapack_complex_float* ap, lapack_complex_float* a, lapack_int* lda, lapack_int *info ); void LAPACK_dtrttf( char* transr, char* uplo, lapack_int* n, const double* a, lapack_int* lda, double* arf, lapack_int *info ); void LAPACK_strttf( char* transr, char* uplo, lapack_int* n, const float* a, lapack_int* lda, float* arf, lapack_int *info ); void LAPACK_ztrttf( char* transr, char* uplo, lapack_int* n, const lapack_complex_double* a, lapack_int* lda, lapack_complex_double* arf, lapack_int *info ); void LAPACK_ctrttf( char* transr, char* uplo, lapack_int* n, const lapack_complex_float* a, lapack_int* lda, lapack_complex_float* arf, lapack_int *info ); void LAPACK_dtrttp( char* uplo, lapack_int* n, const double* a, lapack_int* lda, double* ap, lapack_int *info ); void LAPACK_strttp( char* uplo, lapack_int* n, const float* a, lapack_int* lda, float* ap, lapack_int *info ); void LAPACK_ztrttp( char* uplo, lapack_int* n, const lapack_complex_double* a, lapack_int* lda, lapack_complex_double* ap, lapack_int *info ); void LAPACK_ctrttp( char* uplo, lapack_int* n, const lapack_complex_float* a, lapack_int* lda, lapack_complex_float* ap, lapack_int *info ); void LAPACK_sgeqrfp( lapack_int* m, lapack_int* n, float* a, lapack_int* lda, float* tau, float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_dgeqrfp( lapack_int* m, lapack_int* n, double* a, lapack_int* lda, double* tau, double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_cgeqrfp( lapack_int* m, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* tau, lapack_complex_float* work, lapack_int* lwork, lapack_int *info ); void LAPACK_zgeqrfp( lapack_int* m, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* tau, lapack_complex_double* work, lapack_int* lwork, lapack_int *info ); void LAPACK_clacgv( lapack_int* n, lapack_complex_float* x, lapack_int* incx ); void LAPACK_zlacgv( lapack_int* n, lapack_complex_double* x, lapack_int* incx ); void LAPACK_slarnv( lapack_int* idist, lapack_int* iseed, lapack_int* n, float* x ); void LAPACK_dlarnv( lapack_int* idist, lapack_int* iseed, lapack_int* n, double* x ); void LAPACK_clarnv( lapack_int* idist, lapack_int* iseed, lapack_int* n, lapack_complex_float* x ); void LAPACK_zlarnv( lapack_int* idist, lapack_int* iseed, lapack_int* n, lapack_complex_double* x ); void LAPACK_sgeqr2( lapack_int* m, lapack_int* n, float* a, lapack_int* lda, float* tau, float* work, lapack_int *info ); void LAPACK_dgeqr2( lapack_int* m, lapack_int* n, double* a, lapack_int* lda, double* tau, double* work, lapack_int *info ); void LAPACK_cgeqr2( lapack_int* m, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* tau, lapack_complex_float* work, lapack_int *info ); void LAPACK_zgeqr2( lapack_int* m, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* tau, lapack_complex_double* work, lapack_int *info ); void LAPACK_slacpy( char* uplo, lapack_int* m, lapack_int* n, const float* a, lapack_int* lda, float* b, lapack_int* ldb ); void LAPACK_dlacpy( char* uplo, lapack_int* m, lapack_int* n, const double* a, lapack_int* lda, double* b, lapack_int* ldb ); void LAPACK_clacpy( char* uplo, lapack_int* m, lapack_int* n, const lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb ); void LAPACK_zlacpy( char* uplo, lapack_int* m, lapack_int* n, const lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb ); void LAPACK_sgetf2( lapack_int* m, lapack_int* n, float* a, lapack_int* lda, lapack_int* ipiv, lapack_int *info ); void LAPACK_dgetf2( lapack_int* m, lapack_int* n, double* a, lapack_int* lda, lapack_int* ipiv, lapack_int *info ); void LAPACK_cgetf2( lapack_int* m, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_int* ipiv, lapack_int *info ); void LAPACK_zgetf2( lapack_int* m, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_int* ipiv, lapack_int *info ); void LAPACK_slaswp( lapack_int* n, float* a, lapack_int* lda, lapack_int* k1, lapack_int* k2, const lapack_int* ipiv, lapack_int* incx ); void LAPACK_dlaswp( lapack_int* n, double* a, lapack_int* lda, lapack_int* k1, lapack_int* k2, const lapack_int* ipiv, lapack_int* incx ); void LAPACK_claswp( lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_int* k1, lapack_int* k2, const lapack_int* ipiv, lapack_int* incx ); void LAPACK_zlaswp( lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_int* k1, lapack_int* k2, const lapack_int* ipiv, lapack_int* incx ); float LAPACK_slange( char* norm, lapack_int* m, lapack_int* n, const float* a, lapack_int* lda, float* work ); double LAPACK_dlange( char* norm, lapack_int* m, lapack_int* n, const double* a, lapack_int* lda, double* work ); float LAPACK_clange( char* norm, lapack_int* m, lapack_int* n, const lapack_complex_float* a, lapack_int* lda, float* work ); double LAPACK_zlange( char* norm, lapack_int* m, lapack_int* n, const lapack_complex_double* a, lapack_int* lda, double* work ); float LAPACK_clanhe( char* norm, char* uplo, lapack_int* n, const lapack_complex_float* a, lapack_int* lda, float* work ); double LAPACK_zlanhe( char* norm, char* uplo, lapack_int* n, const lapack_complex_double* a, lapack_int* lda, double* work ); float LAPACK_slansy( char* norm, char* uplo, lapack_int* n, const float* a, lapack_int* lda, float* work ); double LAPACK_dlansy( char* norm, char* uplo, lapack_int* n, const double* a, lapack_int* lda, double* work ); float LAPACK_clansy( char* norm, char* uplo, lapack_int* n, const lapack_complex_float* a, lapack_int* lda, float* work ); double LAPACK_zlansy( char* norm, char* uplo, lapack_int* n, const lapack_complex_double* a, lapack_int* lda, double* work ); float LAPACK_slantr( char* norm, char* uplo, char* diag, lapack_int* m, lapack_int* n, const float* a, lapack_int* lda, float* work ); double LAPACK_dlantr( char* norm, char* uplo, char* diag, lapack_int* m, lapack_int* n, const double* a, lapack_int* lda, double* work ); float LAPACK_clantr( char* norm, char* uplo, char* diag, lapack_int* m, lapack_int* n, const lapack_complex_float* a, lapack_int* lda, float* work ); double LAPACK_zlantr( char* norm, char* uplo, char* diag, lapack_int* m, lapack_int* n, const lapack_complex_double* a, lapack_int* lda, double* work ); float LAPACK_slamch( char* cmach ); double LAPACK_dlamch( char* cmach ); void LAPACK_sgelq2( lapack_int* m, lapack_int* n, float* a, lapack_int* lda, float* tau, float* work, lapack_int *info ); void LAPACK_dgelq2( lapack_int* m, lapack_int* n, double* a, lapack_int* lda, double* tau, double* work, lapack_int *info ); void LAPACK_cgelq2( lapack_int* m, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* tau, lapack_complex_float* work, lapack_int *info ); void LAPACK_zgelq2( lapack_int* m, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* tau, lapack_complex_double* work, lapack_int *info ); void LAPACK_slarfb( char* side, char* trans, char* direct, char* storev, lapack_int* m, lapack_int* n, lapack_int* k, const float* v, lapack_int* ldv, const float* t, lapack_int* ldt, float* c, lapack_int* ldc, float* work, lapack_int* ldwork ); void LAPACK_dlarfb( char* side, char* trans, char* direct, char* storev, lapack_int* m, lapack_int* n, lapack_int* k, const double* v, lapack_int* ldv, const double* t, lapack_int* ldt, double* c, lapack_int* ldc, double* work, lapack_int* ldwork ); void LAPACK_clarfb( char* side, char* trans, char* direct, char* storev, lapack_int* m, lapack_int* n, lapack_int* k, const lapack_complex_float* v, lapack_int* ldv, const lapack_complex_float* t, lapack_int* ldt, lapack_complex_float* c, lapack_int* ldc, lapack_complex_float* work, lapack_int* ldwork ); void LAPACK_zlarfb( char* side, char* trans, char* direct, char* storev, lapack_int* m, lapack_int* n, lapack_int* k, const lapack_complex_double* v, lapack_int* ldv, const lapack_complex_double* t, lapack_int* ldt, lapack_complex_double* c, lapack_int* ldc, lapack_complex_double* work, lapack_int* ldwork ); void LAPACK_slarfg( lapack_int* n, float* alpha, float* x, lapack_int* incx, float* tau ); void LAPACK_dlarfg( lapack_int* n, double* alpha, double* x, lapack_int* incx, double* tau ); void LAPACK_clarfg( lapack_int* n, lapack_complex_float* alpha, lapack_complex_float* x, lapack_int* incx, lapack_complex_float* tau ); void LAPACK_zlarfg( lapack_int* n, lapack_complex_double* alpha, lapack_complex_double* x, lapack_int* incx, lapack_complex_double* tau ); void LAPACK_slarft( char* direct, char* storev, lapack_int* n, lapack_int* k, const float* v, lapack_int* ldv, const float* tau, float* t, lapack_int* ldt ); void LAPACK_dlarft( char* direct, char* storev, lapack_int* n, lapack_int* k, const double* v, lapack_int* ldv, const double* tau, double* t, lapack_int* ldt ); void LAPACK_clarft( char* direct, char* storev, lapack_int* n, lapack_int* k, const lapack_complex_float* v, lapack_int* ldv, const lapack_complex_float* tau, lapack_complex_float* t, lapack_int* ldt ); void LAPACK_zlarft( char* direct, char* storev, lapack_int* n, lapack_int* k, const lapack_complex_double* v, lapack_int* ldv, const lapack_complex_double* tau, lapack_complex_double* t, lapack_int* ldt ); void LAPACK_slarfx( char* side, lapack_int* m, lapack_int* n, const float* v, float* tau, float* c, lapack_int* ldc, float* work ); void LAPACK_dlarfx( char* side, lapack_int* m, lapack_int* n, const double* v, double* tau, double* c, lapack_int* ldc, double* work ); void LAPACK_clarfx( char* side, lapack_int* m, lapack_int* n, const lapack_complex_float* v, lapack_complex_float* tau, lapack_complex_float* c, lapack_int* ldc, lapack_complex_float* work ); void LAPACK_zlarfx( char* side, lapack_int* m, lapack_int* n, const lapack_complex_double* v, lapack_complex_double* tau, lapack_complex_double* c, lapack_int* ldc, lapack_complex_double* work ); void LAPACK_slatms( lapack_int* m, lapack_int* n, char* dist, lapack_int* iseed, char* sym, float* d, lapack_int* mode, float* cond, float* dmax, lapack_int* kl, lapack_int* ku, char* pack, float* a, lapack_int* lda, float* work, lapack_int *info ); void LAPACK_dlatms( lapack_int* m, lapack_int* n, char* dist, lapack_int* iseed, char* sym, double* d, lapack_int* mode, double* cond, double* dmax, lapack_int* kl, lapack_int* ku, char* pack, double* a, lapack_int* lda, double* work, lapack_int *info ); void LAPACK_clatms( lapack_int* m, lapack_int* n, char* dist, lapack_int* iseed, char* sym, float* d, lapack_int* mode, float* cond, float* dmax, lapack_int* kl, lapack_int* ku, char* pack, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* work, lapack_int *info ); void LAPACK_zlatms( lapack_int* m, lapack_int* n, char* dist, lapack_int* iseed, char* sym, double* d, lapack_int* mode, double* cond, double* dmax, lapack_int* kl, lapack_int* ku, char* pack, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* work, lapack_int *info ); void LAPACK_slag2d( lapack_int* m, lapack_int* n, const float* sa, lapack_int* ldsa, double* a, lapack_int* lda, lapack_int *info ); void LAPACK_dlag2s( lapack_int* m, lapack_int* n, const double* a, lapack_int* lda, float* sa, lapack_int* ldsa, lapack_int *info ); void LAPACK_clag2z( lapack_int* m, lapack_int* n, const lapack_complex_float* sa, lapack_int* ldsa, lapack_complex_double* a, lapack_int* lda, lapack_int *info ); void LAPACK_zlag2c( lapack_int* m, lapack_int* n, const lapack_complex_double* a, lapack_int* lda, lapack_complex_float* sa, lapack_int* ldsa, lapack_int *info ); void LAPACK_slauum( char* uplo, lapack_int* n, float* a, lapack_int* lda, lapack_int *info ); void LAPACK_dlauum( char* uplo, lapack_int* n, double* a, lapack_int* lda, lapack_int *info ); void LAPACK_clauum( char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_int *info ); void LAPACK_zlauum( char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_int *info ); void LAPACK_slagge( lapack_int* m, lapack_int* n, lapack_int* kl, lapack_int* ku, const float* d, float* a, lapack_int* lda, lapack_int* iseed, float* work, lapack_int *info ); void LAPACK_dlagge( lapack_int* m, lapack_int* n, lapack_int* kl, lapack_int* ku, const double* d, double* a, lapack_int* lda, lapack_int* iseed, double* work, lapack_int *info ); void LAPACK_clagge( lapack_int* m, lapack_int* n, lapack_int* kl, lapack_int* ku, const float* d, lapack_complex_float* a, lapack_int* lda, lapack_int* iseed, lapack_complex_float* work, lapack_int *info ); void LAPACK_zlagge( lapack_int* m, lapack_int* n, lapack_int* kl, lapack_int* ku, const double* d, lapack_complex_double* a, lapack_int* lda, lapack_int* iseed, lapack_complex_double* work, lapack_int *info ); void LAPACK_slaset( char* uplo, lapack_int* m, lapack_int* n, float* alpha, float* beta, float* a, lapack_int* lda ); void LAPACK_dlaset( char* uplo, lapack_int* m, lapack_int* n, double* alpha, double* beta, double* a, lapack_int* lda ); void LAPACK_claset( char* uplo, lapack_int* m, lapack_int* n, lapack_complex_float* alpha, lapack_complex_float* beta, lapack_complex_float* a, lapack_int* lda ); void LAPACK_zlaset( char* uplo, lapack_int* m, lapack_int* n, lapack_complex_double* alpha, lapack_complex_double* beta, lapack_complex_double* a, lapack_int* lda ); void LAPACK_slasrt( char* id, lapack_int* n, float* d, lapack_int *info ); void LAPACK_dlasrt( char* id, lapack_int* n, double* d, lapack_int *info ); void LAPACK_claghe( lapack_int* n, lapack_int* k, const float* d, lapack_complex_float* a, lapack_int* lda, lapack_int* iseed, lapack_complex_float* work, lapack_int *info ); void LAPACK_zlaghe( lapack_int* n, lapack_int* k, const double* d, lapack_complex_double* a, lapack_int* lda, lapack_int* iseed, lapack_complex_double* work, lapack_int *info ); void LAPACK_slagsy( lapack_int* n, lapack_int* k, const float* d, float* a, lapack_int* lda, lapack_int* iseed, float* work, lapack_int *info ); void LAPACK_dlagsy( lapack_int* n, lapack_int* k, const double* d, double* a, lapack_int* lda, lapack_int* iseed, double* work, lapack_int *info ); void LAPACK_clagsy( lapack_int* n, lapack_int* k, const float* d, lapack_complex_float* a, lapack_int* lda, lapack_int* iseed, lapack_complex_float* work, lapack_int *info ); void LAPACK_zlagsy( lapack_int* n, lapack_int* k, const double* d, lapack_complex_double* a, lapack_int* lda, lapack_int* iseed, lapack_complex_double* work, lapack_int *info ); void LAPACK_slapmr( lapack_logical* forwrd, lapack_int* m, lapack_int* n, float* x, lapack_int* ldx, lapack_int* k ); void LAPACK_dlapmr( lapack_logical* forwrd, lapack_int* m, lapack_int* n, double* x, lapack_int* ldx, lapack_int* k ); void LAPACK_clapmr( lapack_logical* forwrd, lapack_int* m, lapack_int* n, lapack_complex_float* x, lapack_int* ldx, lapack_int* k ); void LAPACK_zlapmr( lapack_logical* forwrd, lapack_int* m, lapack_int* n, lapack_complex_double* x, lapack_int* ldx, lapack_int* k ); float LAPACK_slapy2( float* x, float* y ); double LAPACK_dlapy2( double* x, double* y ); float LAPACK_slapy3( float* x, float* y, float* z ); double LAPACK_dlapy3( double* x, double* y, double* z ); void LAPACK_slartgp( float* f, float* g, float* cs, float* sn, float* r ); void LAPACK_dlartgp( double* f, double* g, double* cs, double* sn, double* r ); void LAPACK_slartgs( float* x, float* y, float* sigma, float* cs, float* sn ); void LAPACK_dlartgs( double* x, double* y, double* sigma, double* cs, double* sn ); // LAPACK 3.3.0 void LAPACK_cbbcsd( char* jobu1, char* jobu2, char* jobv1t, char* jobv2t, char* trans, lapack_int* m, lapack_int* p, lapack_int* q, float* theta, float* phi, lapack_complex_float* u1, lapack_int* ldu1, lapack_complex_float* u2, lapack_int* ldu2, lapack_complex_float* v1t, lapack_int* ldv1t, lapack_complex_float* v2t, lapack_int* ldv2t, float* b11d, float* b11e, float* b12d, float* b12e, float* b21d, float* b21e, float* b22d, float* b22e, float* rwork, lapack_int* lrwork , lapack_int *info ); void LAPACK_cheswapr( char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* i1, lapack_int* i2 ); void LAPACK_chetri2( char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_float* work, lapack_int* lwork , lapack_int *info ); void LAPACK_chetri2x( char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_float* work, lapack_int* nb , lapack_int *info ); void LAPACK_chetrs2( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* work , lapack_int *info ); void LAPACK_csyconv( char* uplo, char* way, lapack_int* n, lapack_complex_float* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_float* work , lapack_int *info ); void LAPACK_csyswapr( char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* i1, lapack_int* i2 ); void LAPACK_csytri2( char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_float* work, lapack_int* lwork , lapack_int *info ); void LAPACK_csytri2x( char* uplo, lapack_int* n, lapack_complex_float* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_float* work, lapack_int* nb , lapack_int *info ); void LAPACK_csytrs2( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_float* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* work , lapack_int *info ); void LAPACK_cunbdb( char* trans, char* signs, lapack_int* m, lapack_int* p, lapack_int* q, lapack_complex_float* x11, lapack_int* ldx11, lapack_complex_float* x12, lapack_int* ldx12, lapack_complex_float* x21, lapack_int* ldx21, lapack_complex_float* x22, lapack_int* ldx22, float* theta, float* phi, lapack_complex_float* taup1, lapack_complex_float* taup2, lapack_complex_float* tauq1, lapack_complex_float* tauq2, lapack_complex_float* work, lapack_int* lwork , lapack_int *info ); void LAPACK_cuncsd( char* jobu1, char* jobu2, char* jobv1t, char* jobv2t, char* trans, char* signs, lapack_int* m, lapack_int* p, lapack_int* q, lapack_complex_float* x11, lapack_int* ldx11, lapack_complex_float* x12, lapack_int* ldx12, lapack_complex_float* x21, lapack_int* ldx21, lapack_complex_float* x22, lapack_int* ldx22, float* theta, lapack_complex_float* u1, lapack_int* ldu1, lapack_complex_float* u2, lapack_int* ldu2, lapack_complex_float* v1t, lapack_int* ldv1t, lapack_complex_float* v2t, lapack_int* ldv2t, lapack_complex_float* work, lapack_int* lwork, float* rwork, lapack_int* lrwork, lapack_int* iwork , lapack_int *info ); void LAPACK_dbbcsd( char* jobu1, char* jobu2, char* jobv1t, char* jobv2t, char* trans, lapack_int* m, lapack_int* p, lapack_int* q, double* theta, double* phi, double* u1, lapack_int* ldu1, double* u2, lapack_int* ldu2, double* v1t, lapack_int* ldv1t, double* v2t, lapack_int* ldv2t, double* b11d, double* b11e, double* b12d, double* b12e, double* b21d, double* b21e, double* b22d, double* b22e, double* work, lapack_int* lwork , lapack_int *info ); void LAPACK_dorbdb( char* trans, char* signs, lapack_int* m, lapack_int* p, lapack_int* q, double* x11, lapack_int* ldx11, double* x12, lapack_int* ldx12, double* x21, lapack_int* ldx21, double* x22, lapack_int* ldx22, double* theta, double* phi, double* taup1, double* taup2, double* tauq1, double* tauq2, double* work, lapack_int* lwork , lapack_int *info ); void LAPACK_dorcsd( char* jobu1, char* jobu2, char* jobv1t, char* jobv2t, char* trans, char* signs, lapack_int* m, lapack_int* p, lapack_int* q, double* x11, lapack_int* ldx11, double* x12, lapack_int* ldx12, double* x21, lapack_int* ldx21, double* x22, lapack_int* ldx22, double* theta, double* u1, lapack_int* ldu1, double* u2, lapack_int* ldu2, double* v1t, lapack_int* ldv1t, double* v2t, lapack_int* ldv2t, double* work, lapack_int* lwork, lapack_int* iwork , lapack_int *info ); void LAPACK_dsyconv( char* uplo, char* way, lapack_int* n, double* a, lapack_int* lda, const lapack_int* ipiv, double* work , lapack_int *info ); void LAPACK_dsyswapr( char* uplo, lapack_int* n, double* a, lapack_int* i1, lapack_int* i2 ); void LAPACK_dsytri2( char* uplo, lapack_int* n, double* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_double* work, lapack_int* lwork , lapack_int *info ); void LAPACK_dsytri2x( char* uplo, lapack_int* n, double* a, lapack_int* lda, const lapack_int* ipiv, double* work, lapack_int* nb , lapack_int *info ); void LAPACK_dsytrs2( char* uplo, lapack_int* n, lapack_int* nrhs, const double* a, lapack_int* lda, const lapack_int* ipiv, double* b, lapack_int* ldb, double* work , lapack_int *info ); void LAPACK_sbbcsd( char* jobu1, char* jobu2, char* jobv1t, char* jobv2t, char* trans, lapack_int* m, lapack_int* p, lapack_int* q, float* theta, float* phi, float* u1, lapack_int* ldu1, float* u2, lapack_int* ldu2, float* v1t, lapack_int* ldv1t, float* v2t, lapack_int* ldv2t, float* b11d, float* b11e, float* b12d, float* b12e, float* b21d, float* b21e, float* b22d, float* b22e, float* work, lapack_int* lwork , lapack_int *info ); void LAPACK_sorbdb( char* trans, char* signs, lapack_int* m, lapack_int* p, lapack_int* q, float* x11, lapack_int* ldx11, float* x12, lapack_int* ldx12, float* x21, lapack_int* ldx21, float* x22, lapack_int* ldx22, float* theta, float* phi, float* taup1, float* taup2, float* tauq1, float* tauq2, float* work, lapack_int* lwork , lapack_int *info ); void LAPACK_sorcsd( char* jobu1, char* jobu2, char* jobv1t, char* jobv2t, char* trans, char* signs, lapack_int* m, lapack_int* p, lapack_int* q, float* x11, lapack_int* ldx11, float* x12, lapack_int* ldx12, float* x21, lapack_int* ldx21, float* x22, lapack_int* ldx22, float* theta, float* u1, lapack_int* ldu1, float* u2, lapack_int* ldu2, float* v1t, lapack_int* ldv1t, float* v2t, lapack_int* ldv2t, float* work, lapack_int* lwork, lapack_int* iwork , lapack_int *info ); void LAPACK_ssyconv( char* uplo, char* way, lapack_int* n, float* a, lapack_int* lda, const lapack_int* ipiv, float* work , lapack_int *info ); void LAPACK_ssyswapr( char* uplo, lapack_int* n, float* a, lapack_int* i1, lapack_int* i2 ); void LAPACK_ssytri2( char* uplo, lapack_int* n, float* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_float* work, lapack_int* lwork , lapack_int *info ); void LAPACK_ssytri2x( char* uplo, lapack_int* n, float* a, lapack_int* lda, const lapack_int* ipiv, float* work, lapack_int* nb , lapack_int *info ); void LAPACK_ssytrs2( char* uplo, lapack_int* n, lapack_int* nrhs, const float* a, lapack_int* lda, const lapack_int* ipiv, float* b, lapack_int* ldb, float* work , lapack_int *info ); void LAPACK_zbbcsd( char* jobu1, char* jobu2, char* jobv1t, char* jobv2t, char* trans, lapack_int* m, lapack_int* p, lapack_int* q, double* theta, double* phi, lapack_complex_double* u1, lapack_int* ldu1, lapack_complex_double* u2, lapack_int* ldu2, lapack_complex_double* v1t, lapack_int* ldv1t, lapack_complex_double* v2t, lapack_int* ldv2t, double* b11d, double* b11e, double* b12d, double* b12e, double* b21d, double* b21e, double* b22d, double* b22e, double* rwork, lapack_int* lrwork , lapack_int *info ); void LAPACK_zheswapr( char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* i1, lapack_int* i2 ); void LAPACK_zhetri2( char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_double* work, lapack_int* lwork , lapack_int *info ); void LAPACK_zhetri2x( char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_double* work, lapack_int* nb , lapack_int *info ); void LAPACK_zhetrs2( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* work , lapack_int *info ); void LAPACK_zsyconv( char* uplo, char* way, lapack_int* n, lapack_complex_double* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_double* work , lapack_int *info ); void LAPACK_zsyswapr( char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* i1, lapack_int* i2 ); void LAPACK_zsytri2( char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_double* work, lapack_int* lwork , lapack_int *info ); void LAPACK_zsytri2x( char* uplo, lapack_int* n, lapack_complex_double* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_double* work, lapack_int* nb , lapack_int *info ); void LAPACK_zsytrs2( char* uplo, lapack_int* n, lapack_int* nrhs, const lapack_complex_double* a, lapack_int* lda, const lapack_int* ipiv, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* work , lapack_int *info ); void LAPACK_zunbdb( char* trans, char* signs, lapack_int* m, lapack_int* p, lapack_int* q, lapack_complex_double* x11, lapack_int* ldx11, lapack_complex_double* x12, lapack_int* ldx12, lapack_complex_double* x21, lapack_int* ldx21, lapack_complex_double* x22, lapack_int* ldx22, double* theta, double* phi, lapack_complex_double* taup1, lapack_complex_double* taup2, lapack_complex_double* tauq1, lapack_complex_double* tauq2, lapack_complex_double* work, lapack_int* lwork , lapack_int *info ); void LAPACK_zuncsd( char* jobu1, char* jobu2, char* jobv1t, char* jobv2t, char* trans, char* signs, lapack_int* m, lapack_int* p, lapack_int* q, lapack_complex_double* x11, lapack_int* ldx11, lapack_complex_double* x12, lapack_int* ldx12, lapack_complex_double* x21, lapack_int* ldx21, lapack_complex_double* x22, lapack_int* ldx22, double* theta, lapack_complex_double* u1, lapack_int* ldu1, lapack_complex_double* u2, lapack_int* ldu2, lapack_complex_double* v1t, lapack_int* ldv1t, lapack_complex_double* v2t, lapack_int* ldv2t, lapack_complex_double* work, lapack_int* lwork, double* rwork, lapack_int* lrwork, lapack_int* iwork , lapack_int *info ); // LAPACK 3.4.0 void LAPACK_sgemqrt( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, lapack_int* nb, const float* v, lapack_int* ldv, const float* t, lapack_int* ldt, float* c, lapack_int* ldc, float* work, lapack_int *info ); void LAPACK_dgemqrt( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, lapack_int* nb, const double* v, lapack_int* ldv, const double* t, lapack_int* ldt, double* c, lapack_int* ldc, double* work, lapack_int *info ); void LAPACK_cgemqrt( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, lapack_int* nb, const lapack_complex_float* v, lapack_int* ldv, const lapack_complex_float* t, lapack_int* ldt, lapack_complex_float* c, lapack_int* ldc, lapack_complex_float* work, lapack_int *info ); void LAPACK_zgemqrt( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, lapack_int* nb, const lapack_complex_double* v, lapack_int* ldv, const lapack_complex_double* t, lapack_int* ldt, lapack_complex_double* c, lapack_int* ldc, lapack_complex_double* work, lapack_int *info ); void LAPACK_sgeqrt( lapack_int* m, lapack_int* n, lapack_int* nb, float* a, lapack_int* lda, float* t, lapack_int* ldt, float* work, lapack_int *info ); void LAPACK_dgeqrt( lapack_int* m, lapack_int* n, lapack_int* nb, double* a, lapack_int* lda, double* t, lapack_int* ldt, double* work, lapack_int *info ); void LAPACK_cgeqrt( lapack_int* m, lapack_int* n, lapack_int* nb, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* t, lapack_int* ldt, lapack_complex_float* work, lapack_int *info ); void LAPACK_zgeqrt( lapack_int* m, lapack_int* n, lapack_int* nb, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* t, lapack_int* ldt, lapack_complex_double* work, lapack_int *info ); void LAPACK_sgeqrt2( lapack_int* m, lapack_int* n, float* a, lapack_int* lda, float* t, lapack_int* ldt, lapack_int *info ); void LAPACK_dgeqrt2( lapack_int* m, lapack_int* n, double* a, lapack_int* lda, double* t, lapack_int* ldt, lapack_int *info ); void LAPACK_cgeqrt2( lapack_int* m, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* t, lapack_int* ldt, lapack_int *info ); void LAPACK_zgeqrt2( lapack_int* m, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* t, lapack_int* ldt, lapack_int *info ); void LAPACK_sgeqrt3( lapack_int* m, lapack_int* n, float* a, lapack_int* lda, float* t, lapack_int* ldt, lapack_int *info ); void LAPACK_dgeqrt3( lapack_int* m, lapack_int* n, double* a, lapack_int* lda, double* t, lapack_int* ldt, lapack_int *info ); void LAPACK_cgeqrt3( lapack_int* m, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* t, lapack_int* ldt, lapack_int *info ); void LAPACK_zgeqrt3( lapack_int* m, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* t, lapack_int* ldt, lapack_int *info ); void LAPACK_stpmqrt( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, lapack_int* l, lapack_int* nb, const float* v, lapack_int* ldv, const float* t, lapack_int* ldt, float* a, lapack_int* lda, float* b, lapack_int* ldb, float* work, lapack_int *info ); void LAPACK_dtpmqrt( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, lapack_int* l, lapack_int* nb, const double* v, lapack_int* ldv, const double* t, lapack_int* ldt, double* a, lapack_int* lda, double* b, lapack_int* ldb, double* work, lapack_int *info ); void LAPACK_ctpmqrt( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, lapack_int* l, lapack_int* nb, const lapack_complex_float* v, lapack_int* ldv, const lapack_complex_float* t, lapack_int* ldt, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* work, lapack_int *info ); void LAPACK_ztpmqrt( char* side, char* trans, lapack_int* m, lapack_int* n, lapack_int* k, lapack_int* l, lapack_int* nb, const lapack_complex_double* v, lapack_int* ldv, const lapack_complex_double* t, lapack_int* ldt, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* work, lapack_int *info ); void LAPACK_dtpqrt( lapack_int* m, lapack_int* n, lapack_int* l, lapack_int* nb, double* a, lapack_int* lda, double* b, lapack_int* ldb, double* t, lapack_int* ldt, double* work, lapack_int *info ); void LAPACK_ctpqrt( lapack_int* m, lapack_int* n, lapack_int* l, lapack_int* nb, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* t, lapack_complex_float* b, lapack_int* ldb, lapack_int* ldt, lapack_complex_float* work, lapack_int *info ); void LAPACK_ztpqrt( lapack_int* m, lapack_int* n, lapack_int* l, lapack_int* nb, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* t, lapack_int* ldt, lapack_complex_double* work, lapack_int *info ); void LAPACK_stpqrt2( lapack_int* m, lapack_int* n, float* a, lapack_int* lda, float* b, lapack_int* ldb, float* t, lapack_int* ldt, lapack_int *info ); void LAPACK_dtpqrt2( lapack_int* m, lapack_int* n, double* a, lapack_int* lda, double* b, lapack_int* ldb, double* t, lapack_int* ldt, lapack_int *info ); void LAPACK_ctpqrt2( lapack_int* m, lapack_int* n, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, lapack_complex_float* t, lapack_int* ldt, lapack_int *info ); void LAPACK_ztpqrt2( lapack_int* m, lapack_int* n, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, lapack_complex_double* t, lapack_int* ldt, lapack_int *info ); void LAPACK_stprfb( char* side, char* trans, char* direct, char* storev, lapack_int* m, lapack_int* n, lapack_int* k, lapack_int* l, const float* v, lapack_int* ldv, const float* t, lapack_int* ldt, float* a, lapack_int* lda, float* b, lapack_int* ldb, const float* mywork, lapack_int* myldwork ); void LAPACK_dtprfb( char* side, char* trans, char* direct, char* storev, lapack_int* m, lapack_int* n, lapack_int* k, lapack_int* l, const double* v, lapack_int* ldv, const double* t, lapack_int* ldt, double* a, lapack_int* lda, double* b, lapack_int* ldb, const double* mywork, lapack_int* myldwork ); void LAPACK_ctprfb( char* side, char* trans, char* direct, char* storev, lapack_int* m, lapack_int* n, lapack_int* k, lapack_int* l, const lapack_complex_float* v, lapack_int* ldv, const lapack_complex_float* t, lapack_int* ldt, lapack_complex_float* a, lapack_int* lda, lapack_complex_float* b, lapack_int* ldb, const float* mywork, lapack_int* myldwork ); void LAPACK_ztprfb( char* side, char* trans, char* direct, char* storev, lapack_int* m, lapack_int* n, lapack_int* k, lapack_int* l, const lapack_complex_double* v, lapack_int* ldv, const lapack_complex_double* t, lapack_int* ldt, lapack_complex_double* a, lapack_int* lda, lapack_complex_double* b, lapack_int* ldb, const double* mywork, lapack_int* myldwork ); // LAPACK 3.X.X void LAPACK_csyr( char* uplo, lapack_int* n, lapack_complex_float* alpha, const lapack_complex_float* x, lapack_int* incx, lapack_complex_float* a, lapack_int* lda ); void LAPACK_zsyr( char* uplo, lapack_int* n, lapack_complex_double* alpha, const lapack_complex_double* x, lapack_int* incx, lapack_complex_double* a, lapack_int* lda ); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _LAPACKE_H_ */ #endif /* _MKL_LAPACKE_H_ */ ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/misc/lapacke_mangling.h ================================================ #ifndef LAPACK_HEADER_INCLUDED #define LAPACK_HEADER_INCLUDED #ifndef LAPACK_GLOBAL #if defined(LAPACK_GLOBAL_PATTERN_LC) || defined(ADD_) #define LAPACK_GLOBAL(lcname,UCNAME) lcname##_ #elif defined(LAPACK_GLOBAL_PATTERN_UC) || defined(UPPER) #define LAPACK_GLOBAL(lcname,UCNAME) UCNAME #elif defined(LAPACK_GLOBAL_PATTERN_MC) || defined(NOCHANGE) #define LAPACK_GLOBAL(lcname,UCNAME) lcname #else #define LAPACK_GLOBAL(lcname,UCNAME) lcname##_ #endif #endif #endif ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h ================================================ /** \returns an expression of the coefficient wise product of \c *this and \a other * * \sa MatrixBase::cwiseProduct */ template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const EIGEN_CWISE_BINARY_RETURN_TYPE(Derived,OtherDerived,product) operator*(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const { return EIGEN_CWISE_BINARY_RETURN_TYPE(Derived,OtherDerived,product)(derived(), other.derived()); } /** \returns an expression of the coefficient wise quotient of \c *this and \a other * * \sa MatrixBase::cwiseQuotient */ template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp, const Derived, const OtherDerived> operator/(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const { return CwiseBinaryOp, const Derived, const OtherDerived>(derived(), other.derived()); } /** \returns an expression of the coefficient-wise min of \c *this and \a other * * Example: \include Cwise_min.cpp * Output: \verbinclude Cwise_min.out * * \sa max() */ EIGEN_MAKE_CWISE_BINARY_OP(min,min) /** \returns an expression of the coefficient-wise min of \c *this and scalar \a other * * \sa max() */ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp, const Derived, const CwiseNullaryOp, PlainObject> > #ifdef EIGEN_PARSED_BY_DOXYGEN min #else (min) #endif (const Scalar &other) const { return (min)(Derived::PlainObject::Constant(rows(), cols(), other)); } /** \returns an expression of the coefficient-wise max of \c *this and \a other * * Example: \include Cwise_max.cpp * Output: \verbinclude Cwise_max.out * * \sa min() */ EIGEN_MAKE_CWISE_BINARY_OP(max,max) /** \returns an expression of the coefficient-wise max of \c *this and scalar \a other * * \sa min() */ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp, const Derived, const CwiseNullaryOp, PlainObject> > #ifdef EIGEN_PARSED_BY_DOXYGEN max #else (max) #endif (const Scalar &other) const { return (max)(Derived::PlainObject::Constant(rows(), cols(), other)); } /** \returns an expression of the coefficient-wise absdiff of \c *this and \a other * * Example: \include Cwise_absolute_difference.cpp * Output: \verbinclude Cwise_absolute_difference.out * * \sa absolute_difference() */ EIGEN_MAKE_CWISE_BINARY_OP(absolute_difference,absolute_difference) /** \returns an expression of the coefficient-wise absolute_difference of \c *this and scalar \a other * * \sa absolute_difference() */ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp, const Derived, const CwiseNullaryOp, PlainObject> > #ifdef EIGEN_PARSED_BY_DOXYGEN absolute_difference #else (absolute_difference) #endif (const Scalar &other) const { return (absolute_difference)(Derived::PlainObject::Constant(rows(), cols(), other)); } /** \returns an expression of the coefficient-wise power of \c *this to the given array of \a exponents. * * This function computes the coefficient-wise power. * * Example: \include Cwise_array_power_array.cpp * Output: \verbinclude Cwise_array_power_array.out */ EIGEN_MAKE_CWISE_BINARY_OP(pow,pow) #ifndef EIGEN_PARSED_BY_DOXYGEN EIGEN_MAKE_SCALAR_BINARY_OP_ONTHERIGHT(pow,pow) #else /** \returns an expression of the coefficients of \c *this rasied to the constant power \a exponent * * \tparam T is the scalar type of \a exponent. It must be compatible with the scalar type of the given expression. * * This function computes the coefficient-wise power. The function MatrixBase::pow() in the * unsupported module MatrixFunctions computes the matrix power. * * Example: \include Cwise_pow.cpp * Output: \verbinclude Cwise_pow.out * * \sa ArrayBase::pow(ArrayBase), square(), cube(), exp(), log() */ template const CwiseBinaryOp,Derived,Constant > pow(const T& exponent) const; #endif // TODO code generating macros could be moved to Macros.h and could include generation of documentation #define EIGEN_MAKE_CWISE_COMP_OP(OP, COMPARATOR) \ template \ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp, const Derived, const OtherDerived> \ OP(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const \ { \ return CwiseBinaryOp, const Derived, const OtherDerived>(derived(), other.derived()); \ }\ typedef CwiseBinaryOp, const Derived, const CwiseNullaryOp, PlainObject> > Cmp ## COMPARATOR ## ReturnType; \ typedef CwiseBinaryOp, const CwiseNullaryOp, PlainObject>, const Derived > RCmp ## COMPARATOR ## ReturnType; \ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Cmp ## COMPARATOR ## ReturnType \ OP(const Scalar& s) const { \ return this->OP(Derived::PlainObject::Constant(rows(), cols(), s)); \ } \ EIGEN_DEVICE_FUNC friend EIGEN_STRONG_INLINE const RCmp ## COMPARATOR ## ReturnType \ OP(const Scalar& s, const EIGEN_CURRENT_STORAGE_BASE_CLASS& d) { \ return Derived::PlainObject::Constant(d.rows(), d.cols(), s).OP(d); \ } #define EIGEN_MAKE_CWISE_COMP_R_OP(OP, R_OP, RCOMPARATOR) \ template \ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp, const OtherDerived, const Derived> \ OP(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const \ { \ return CwiseBinaryOp, const OtherDerived, const Derived>(other.derived(), derived()); \ } \ EIGEN_DEVICE_FUNC \ inline const RCmp ## RCOMPARATOR ## ReturnType \ OP(const Scalar& s) const { \ return Derived::PlainObject::Constant(rows(), cols(), s).R_OP(*this); \ } \ friend inline const Cmp ## RCOMPARATOR ## ReturnType \ OP(const Scalar& s, const Derived& d) { \ return d.R_OP(Derived::PlainObject::Constant(d.rows(), d.cols(), s)); \ } /** \returns an expression of the coefficient-wise \< operator of *this and \a other * * Example: \include Cwise_less.cpp * Output: \verbinclude Cwise_less.out * * \sa all(), any(), operator>(), operator<=() */ EIGEN_MAKE_CWISE_COMP_OP(operator<, LT) /** \returns an expression of the coefficient-wise \<= operator of *this and \a other * * Example: \include Cwise_less_equal.cpp * Output: \verbinclude Cwise_less_equal.out * * \sa all(), any(), operator>=(), operator<() */ EIGEN_MAKE_CWISE_COMP_OP(operator<=, LE) /** \returns an expression of the coefficient-wise \> operator of *this and \a other * * Example: \include Cwise_greater.cpp * Output: \verbinclude Cwise_greater.out * * \sa all(), any(), operator>=(), operator<() */ EIGEN_MAKE_CWISE_COMP_R_OP(operator>, operator<, LT) /** \returns an expression of the coefficient-wise \>= operator of *this and \a other * * Example: \include Cwise_greater_equal.cpp * Output: \verbinclude Cwise_greater_equal.out * * \sa all(), any(), operator>(), operator<=() */ EIGEN_MAKE_CWISE_COMP_R_OP(operator>=, operator<=, LE) /** \returns an expression of the coefficient-wise == operator of *this and \a other * * \warning this performs an exact comparison, which is generally a bad idea with floating-point types. * In order to check for equality between two vectors or matrices with floating-point coefficients, it is * generally a far better idea to use a fuzzy comparison as provided by isApprox() and * isMuchSmallerThan(). * * Example: \include Cwise_equal_equal.cpp * Output: \verbinclude Cwise_equal_equal.out * * \sa all(), any(), isApprox(), isMuchSmallerThan() */ EIGEN_MAKE_CWISE_COMP_OP(operator==, EQ) /** \returns an expression of the coefficient-wise != operator of *this and \a other * * \warning this performs an exact comparison, which is generally a bad idea with floating-point types. * In order to check for equality between two vectors or matrices with floating-point coefficients, it is * generally a far better idea to use a fuzzy comparison as provided by isApprox() and * isMuchSmallerThan(). * * Example: \include Cwise_not_equal.cpp * Output: \verbinclude Cwise_not_equal.out * * \sa all(), any(), isApprox(), isMuchSmallerThan() */ EIGEN_MAKE_CWISE_COMP_OP(operator!=, NEQ) #undef EIGEN_MAKE_CWISE_COMP_OP #undef EIGEN_MAKE_CWISE_COMP_R_OP // scalar addition #ifndef EIGEN_PARSED_BY_DOXYGEN EIGEN_MAKE_SCALAR_BINARY_OP(operator+,sum) #else /** \returns an expression of \c *this with each coeff incremented by the constant \a scalar * * \tparam T is the scalar type of \a scalar. It must be compatible with the scalar type of the given expression. * * Example: \include Cwise_plus.cpp * Output: \verbinclude Cwise_plus.out * * \sa operator+=(), operator-() */ template const CwiseBinaryOp,Derived,Constant > operator+(const T& scalar) const; /** \returns an expression of \a expr with each coeff incremented by the constant \a scalar * * \tparam T is the scalar type of \a scalar. It must be compatible with the scalar type of the given expression. */ template friend const CwiseBinaryOp,Constant,Derived> operator+(const T& scalar, const StorageBaseType& expr); #endif #ifndef EIGEN_PARSED_BY_DOXYGEN EIGEN_MAKE_SCALAR_BINARY_OP(operator-,difference) #else /** \returns an expression of \c *this with each coeff decremented by the constant \a scalar * * \tparam T is the scalar type of \a scalar. It must be compatible with the scalar type of the given expression. * * Example: \include Cwise_minus.cpp * Output: \verbinclude Cwise_minus.out * * \sa operator+=(), operator-() */ template const CwiseBinaryOp,Derived,Constant > operator-(const T& scalar) const; /** \returns an expression of the constant matrix of value \a scalar decremented by the coefficients of \a expr * * \tparam T is the scalar type of \a scalar. It must be compatible with the scalar type of the given expression. */ template friend const CwiseBinaryOp,Constant,Derived> operator-(const T& scalar, const StorageBaseType& expr); #endif #ifndef EIGEN_PARSED_BY_DOXYGEN EIGEN_MAKE_SCALAR_BINARY_OP_ONTHELEFT(operator/,quotient) #else /** * \brief Component-wise division of the scalar \a s by array elements of \a a. * * \tparam Scalar is the scalar type of \a x. It must be compatible with the scalar type of the given array expression (\c Derived::Scalar). */ template friend inline const CwiseBinaryOp,Constant,Derived> operator/(const T& s,const StorageBaseType& a); #endif /** \returns an expression of the coefficient-wise ^ operator of *this and \a other * * \warning this operator is for expression of bool only. * * Example: \include Cwise_boolean_xor.cpp * Output: \verbinclude Cwise_boolean_xor.out * * \sa operator&&(), select() */ template EIGEN_DEVICE_FUNC inline const CwiseBinaryOp operator^(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const { EIGEN_STATIC_ASSERT((internal::is_same::value && internal::is_same::value), THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL); return CwiseBinaryOp(derived(),other.derived()); } // NOTE disabled until we agree on argument order #if 0 /** \cpp11 \returns an expression of the coefficient-wise polygamma function. * * \specialfunctions_module * * It returns the \a n -th derivative of the digamma(psi) evaluated at \c *this. * * \warning Be careful with the order of the parameters: x.polygamma(n) is equivalent to polygamma(n,x) * * \sa Eigen::polygamma() */ template inline const CwiseBinaryOp, const DerivedN, const Derived> polygamma(const EIGEN_CURRENT_STORAGE_BASE_CLASS &n) const { return CwiseBinaryOp, const DerivedN, const Derived>(n.derived(), this->derived()); } #endif /** \returns an expression of the coefficient-wise zeta function. * * \specialfunctions_module * * It returns the Riemann zeta function of two arguments \c *this and \a q: * * \param q is the shift, it must be > 0 * * \note *this is the exponent, it must be > 1. * \note This function supports only float and double scalar types. To support other scalar types, the user has * to provide implementations of zeta(T,T) for any scalar type T to be supported. * * This method is an alias for zeta(*this,q); * * \sa Eigen::zeta() */ template inline const CwiseBinaryOp, const Derived, const DerivedQ> zeta(const EIGEN_CURRENT_STORAGE_BASE_CLASS &q) const { return CwiseBinaryOp, const Derived, const DerivedQ>(this->derived(), q.derived()); } ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h ================================================ typedef CwiseUnaryOp, const Derived> AbsReturnType; typedef CwiseUnaryOp, const Derived> ArgReturnType; typedef CwiseUnaryOp, const Derived> Abs2ReturnType; typedef CwiseUnaryOp, const Derived> SqrtReturnType; typedef CwiseUnaryOp, const Derived> RsqrtReturnType; typedef CwiseUnaryOp, const Derived> SignReturnType; typedef CwiseUnaryOp, const Derived> InverseReturnType; typedef CwiseUnaryOp, const Derived> BooleanNotReturnType; typedef CwiseUnaryOp, const Derived> ExpReturnType; typedef CwiseUnaryOp, const Derived> Expm1ReturnType; typedef CwiseUnaryOp, const Derived> LogReturnType; typedef CwiseUnaryOp, const Derived> Log1pReturnType; typedef CwiseUnaryOp, const Derived> Log10ReturnType; typedef CwiseUnaryOp, const Derived> Log2ReturnType; typedef CwiseUnaryOp, const Derived> CosReturnType; typedef CwiseUnaryOp, const Derived> SinReturnType; typedef CwiseUnaryOp, const Derived> TanReturnType; typedef CwiseUnaryOp, const Derived> AcosReturnType; typedef CwiseUnaryOp, const Derived> AsinReturnType; typedef CwiseUnaryOp, const Derived> AtanReturnType; typedef CwiseUnaryOp, const Derived> TanhReturnType; typedef CwiseUnaryOp, const Derived> LogisticReturnType; typedef CwiseUnaryOp, const Derived> SinhReturnType; #if EIGEN_HAS_CXX11_MATH typedef CwiseUnaryOp, const Derived> AtanhReturnType; typedef CwiseUnaryOp, const Derived> AsinhReturnType; typedef CwiseUnaryOp, const Derived> AcoshReturnType; #endif typedef CwiseUnaryOp, const Derived> CoshReturnType; typedef CwiseUnaryOp, const Derived> SquareReturnType; typedef CwiseUnaryOp, const Derived> CubeReturnType; typedef CwiseUnaryOp, const Derived> RoundReturnType; typedef CwiseUnaryOp, const Derived> RintReturnType; typedef CwiseUnaryOp, const Derived> FloorReturnType; typedef CwiseUnaryOp, const Derived> CeilReturnType; typedef CwiseUnaryOp, const Derived> IsNaNReturnType; typedef CwiseUnaryOp, const Derived> IsInfReturnType; typedef CwiseUnaryOp, const Derived> IsFiniteReturnType; /** \returns an expression of the coefficient-wise absolute value of \c *this * * Example: \include Cwise_abs.cpp * Output: \verbinclude Cwise_abs.out * * \sa Math functions, abs2() */ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const AbsReturnType abs() const { return AbsReturnType(derived()); } /** \returns an expression of the coefficient-wise phase angle of \c *this * * Example: \include Cwise_arg.cpp * Output: \verbinclude Cwise_arg.out * * \sa abs() */ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const ArgReturnType arg() const { return ArgReturnType(derived()); } /** \returns an expression of the coefficient-wise squared absolute value of \c *this * * Example: \include Cwise_abs2.cpp * Output: \verbinclude Cwise_abs2.out * * \sa Math functions, abs(), square() */ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Abs2ReturnType abs2() const { return Abs2ReturnType(derived()); } /** \returns an expression of the coefficient-wise exponential of *this. * * This function computes the coefficient-wise exponential. The function MatrixBase::exp() in the * unsupported module MatrixFunctions computes the matrix exponential. * * Example: \include Cwise_exp.cpp * Output: \verbinclude Cwise_exp.out * * \sa Math functions, pow(), log(), sin(), cos() */ EIGEN_DEVICE_FUNC inline const ExpReturnType exp() const { return ExpReturnType(derived()); } /** \returns an expression of the coefficient-wise exponential of *this minus 1. * * In exact arithmetic, \c x.expm1() is equivalent to \c x.exp() - 1, * however, with finite precision, this function is much more accurate when \c x is close to zero. * * \sa Math functions, exp() */ EIGEN_DEVICE_FUNC inline const Expm1ReturnType expm1() const { return Expm1ReturnType(derived()); } /** \returns an expression of the coefficient-wise logarithm of *this. * * This function computes the coefficient-wise logarithm. The function MatrixBase::log() in the * unsupported module MatrixFunctions computes the matrix logarithm. * * Example: \include Cwise_log.cpp * Output: \verbinclude Cwise_log.out * * \sa Math functions, log() */ EIGEN_DEVICE_FUNC inline const LogReturnType log() const { return LogReturnType(derived()); } /** \returns an expression of the coefficient-wise logarithm of 1 plus \c *this. * * In exact arithmetic, \c x.log() is equivalent to \c (x+1).log(), * however, with finite precision, this function is much more accurate when \c x is close to zero. * * \sa Math functions, log() */ EIGEN_DEVICE_FUNC inline const Log1pReturnType log1p() const { return Log1pReturnType(derived()); } /** \returns an expression of the coefficient-wise base-10 logarithm of *this. * * This function computes the coefficient-wise base-10 logarithm. * * Example: \include Cwise_log10.cpp * Output: \verbinclude Cwise_log10.out * * \sa Math functions, log() */ EIGEN_DEVICE_FUNC inline const Log10ReturnType log10() const { return Log10ReturnType(derived()); } /** \returns an expression of the coefficient-wise base-2 logarithm of *this. * * This function computes the coefficient-wise base-2 logarithm. * */ EIGEN_DEVICE_FUNC inline const Log2ReturnType log2() const { return Log2ReturnType(derived()); } /** \returns an expression of the coefficient-wise square root of *this. * * This function computes the coefficient-wise square root. The function MatrixBase::sqrt() in the * unsupported module MatrixFunctions computes the matrix square root. * * Example: \include Cwise_sqrt.cpp * Output: \verbinclude Cwise_sqrt.out * * \sa Math functions, pow(), square() */ EIGEN_DEVICE_FUNC inline const SqrtReturnType sqrt() const { return SqrtReturnType(derived()); } /** \returns an expression of the coefficient-wise inverse square root of *this. * * This function computes the coefficient-wise inverse square root. * * Example: \include Cwise_sqrt.cpp * Output: \verbinclude Cwise_sqrt.out * * \sa pow(), square() */ EIGEN_DEVICE_FUNC inline const RsqrtReturnType rsqrt() const { return RsqrtReturnType(derived()); } /** \returns an expression of the coefficient-wise signum of *this. * * This function computes the coefficient-wise signum. * * Example: \include Cwise_sign.cpp * Output: \verbinclude Cwise_sign.out * * \sa pow(), square() */ EIGEN_DEVICE_FUNC inline const SignReturnType sign() const { return SignReturnType(derived()); } /** \returns an expression of the coefficient-wise cosine of *this. * * This function computes the coefficient-wise cosine. The function MatrixBase::cos() in the * unsupported module MatrixFunctions computes the matrix cosine. * * Example: \include Cwise_cos.cpp * Output: \verbinclude Cwise_cos.out * * \sa Math functions, sin(), acos() */ EIGEN_DEVICE_FUNC inline const CosReturnType cos() const { return CosReturnType(derived()); } /** \returns an expression of the coefficient-wise sine of *this. * * This function computes the coefficient-wise sine. The function MatrixBase::sin() in the * unsupported module MatrixFunctions computes the matrix sine. * * Example: \include Cwise_sin.cpp * Output: \verbinclude Cwise_sin.out * * \sa Math functions, cos(), asin() */ EIGEN_DEVICE_FUNC inline const SinReturnType sin() const { return SinReturnType(derived()); } /** \returns an expression of the coefficient-wise tan of *this. * * Example: \include Cwise_tan.cpp * Output: \verbinclude Cwise_tan.out * * \sa Math functions, cos(), sin() */ EIGEN_DEVICE_FUNC inline const TanReturnType tan() const { return TanReturnType(derived()); } /** \returns an expression of the coefficient-wise arc tan of *this. * * Example: \include Cwise_atan.cpp * Output: \verbinclude Cwise_atan.out * * \sa Math functions, tan(), asin(), acos() */ EIGEN_DEVICE_FUNC inline const AtanReturnType atan() const { return AtanReturnType(derived()); } /** \returns an expression of the coefficient-wise arc cosine of *this. * * Example: \include Cwise_acos.cpp * Output: \verbinclude Cwise_acos.out * * \sa Math functions, cos(), asin() */ EIGEN_DEVICE_FUNC inline const AcosReturnType acos() const { return AcosReturnType(derived()); } /** \returns an expression of the coefficient-wise arc sine of *this. * * Example: \include Cwise_asin.cpp * Output: \verbinclude Cwise_asin.out * * \sa Math functions, sin(), acos() */ EIGEN_DEVICE_FUNC inline const AsinReturnType asin() const { return AsinReturnType(derived()); } /** \returns an expression of the coefficient-wise hyperbolic tan of *this. * * Example: \include Cwise_tanh.cpp * Output: \verbinclude Cwise_tanh.out * * \sa Math functions, tan(), sinh(), cosh() */ EIGEN_DEVICE_FUNC inline const TanhReturnType tanh() const { return TanhReturnType(derived()); } /** \returns an expression of the coefficient-wise hyperbolic sin of *this. * * Example: \include Cwise_sinh.cpp * Output: \verbinclude Cwise_sinh.out * * \sa Math functions, sin(), tanh(), cosh() */ EIGEN_DEVICE_FUNC inline const SinhReturnType sinh() const { return SinhReturnType(derived()); } /** \returns an expression of the coefficient-wise hyperbolic cos of *this. * * Example: \include Cwise_cosh.cpp * Output: \verbinclude Cwise_cosh.out * * \sa Math functions, tanh(), sinh(), cosh() */ EIGEN_DEVICE_FUNC inline const CoshReturnType cosh() const { return CoshReturnType(derived()); } #if EIGEN_HAS_CXX11_MATH /** \returns an expression of the coefficient-wise inverse hyperbolic tan of *this. * * \sa Math functions, atanh(), asinh(), acosh() */ EIGEN_DEVICE_FUNC inline const AtanhReturnType atanh() const { return AtanhReturnType(derived()); } /** \returns an expression of the coefficient-wise inverse hyperbolic sin of *this. * * \sa Math functions, atanh(), asinh(), acosh() */ EIGEN_DEVICE_FUNC inline const AsinhReturnType asinh() const { return AsinhReturnType(derived()); } /** \returns an expression of the coefficient-wise inverse hyperbolic cos of *this. * * \sa Math functions, atanh(), asinh(), acosh() */ EIGEN_DEVICE_FUNC inline const AcoshReturnType acosh() const { return AcoshReturnType(derived()); } #endif /** \returns an expression of the coefficient-wise logistic of *this. */ EIGEN_DEVICE_FUNC inline const LogisticReturnType logistic() const { return LogisticReturnType(derived()); } /** \returns an expression of the coefficient-wise inverse of *this. * * Example: \include Cwise_inverse.cpp * Output: \verbinclude Cwise_inverse.out * * \sa operator/(), operator*() */ EIGEN_DEVICE_FUNC inline const InverseReturnType inverse() const { return InverseReturnType(derived()); } /** \returns an expression of the coefficient-wise square of *this. * * Example: \include Cwise_square.cpp * Output: \verbinclude Cwise_square.out * * \sa Math functions, abs2(), cube(), pow() */ EIGEN_DEVICE_FUNC inline const SquareReturnType square() const { return SquareReturnType(derived()); } /** \returns an expression of the coefficient-wise cube of *this. * * Example: \include Cwise_cube.cpp * Output: \verbinclude Cwise_cube.out * * \sa Math functions, square(), pow() */ EIGEN_DEVICE_FUNC inline const CubeReturnType cube() const { return CubeReturnType(derived()); } /** \returns an expression of the coefficient-wise rint of *this. * * Example: \include Cwise_rint.cpp * Output: \verbinclude Cwise_rint.out * * \sa Math functions, ceil(), floor() */ EIGEN_DEVICE_FUNC inline const RintReturnType rint() const { return RintReturnType(derived()); } /** \returns an expression of the coefficient-wise round of *this. * * Example: \include Cwise_round.cpp * Output: \verbinclude Cwise_round.out * * \sa Math functions, ceil(), floor() */ EIGEN_DEVICE_FUNC inline const RoundReturnType round() const { return RoundReturnType(derived()); } /** \returns an expression of the coefficient-wise floor of *this. * * Example: \include Cwise_floor.cpp * Output: \verbinclude Cwise_floor.out * * \sa Math functions, ceil(), round() */ EIGEN_DEVICE_FUNC inline const FloorReturnType floor() const { return FloorReturnType(derived()); } /** \returns an expression of the coefficient-wise ceil of *this. * * Example: \include Cwise_ceil.cpp * Output: \verbinclude Cwise_ceil.out * * \sa Math functions, floor(), round() */ EIGEN_DEVICE_FUNC inline const CeilReturnType ceil() const { return CeilReturnType(derived()); } template struct ShiftRightXpr { typedef CwiseUnaryOp, const Derived> Type; }; /** \returns an expression of \c *this with the \a Scalar type arithmetically * shifted right by \a N bit positions. * * The template parameter \a N specifies the number of bit positions to shift. * * \sa shiftLeft() */ template EIGEN_DEVICE_FUNC typename ShiftRightXpr::Type shiftRight() const { return typename ShiftRightXpr::Type(derived()); } template struct ShiftLeftXpr { typedef CwiseUnaryOp, const Derived> Type; }; /** \returns an expression of \c *this with the \a Scalar type logically * shifted left by \a N bit positions. * * The template parameter \a N specifies the number of bit positions to shift. * * \sa shiftRight() */ template EIGEN_DEVICE_FUNC typename ShiftLeftXpr::Type shiftLeft() const { return typename ShiftLeftXpr::Type(derived()); } /** \returns an expression of the coefficient-wise isnan of *this. * * Example: \include Cwise_isNaN.cpp * Output: \verbinclude Cwise_isNaN.out * * \sa isfinite(), isinf() */ EIGEN_DEVICE_FUNC inline const IsNaNReturnType isNaN() const { return IsNaNReturnType(derived()); } /** \returns an expression of the coefficient-wise isinf of *this. * * Example: \include Cwise_isInf.cpp * Output: \verbinclude Cwise_isInf.out * * \sa isnan(), isfinite() */ EIGEN_DEVICE_FUNC inline const IsInfReturnType isInf() const { return IsInfReturnType(derived()); } /** \returns an expression of the coefficient-wise isfinite of *this. * * Example: \include Cwise_isFinite.cpp * Output: \verbinclude Cwise_isFinite.out * * \sa isnan(), isinf() */ EIGEN_DEVICE_FUNC inline const IsFiniteReturnType isFinite() const { return IsFiniteReturnType(derived()); } /** \returns an expression of the coefficient-wise ! operator of *this * * \warning this operator is for expression of bool only. * * Example: \include Cwise_boolean_not.cpp * Output: \verbinclude Cwise_boolean_not.out * * \sa operator!=() */ EIGEN_DEVICE_FUNC inline const BooleanNotReturnType operator!() const { EIGEN_STATIC_ASSERT((internal::is_same::value), THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL); return BooleanNotReturnType(derived()); } // --- SpecialFunctions module --- typedef CwiseUnaryOp, const Derived> LgammaReturnType; typedef CwiseUnaryOp, const Derived> DigammaReturnType; typedef CwiseUnaryOp, const Derived> ErfReturnType; typedef CwiseUnaryOp, const Derived> ErfcReturnType; typedef CwiseUnaryOp, const Derived> NdtriReturnType; /** \cpp11 \returns an expression of the coefficient-wise ln(|gamma(*this)|). * * \specialfunctions_module * * \note This function supports only float and double scalar types in c++11 mode. To support other scalar types, * or float/double in non c++11 mode, the user has to provide implementations of lgamma(T) for any scalar * type T to be supported. * * \sa Math functions, digamma() */ EIGEN_DEVICE_FUNC inline const LgammaReturnType lgamma() const { return LgammaReturnType(derived()); } /** \returns an expression of the coefficient-wise digamma (psi, derivative of lgamma). * * \specialfunctions_module * * \note This function supports only float and double scalar types. To support other scalar types, * the user has to provide implementations of digamma(T) for any scalar * type T to be supported. * * \sa Math functions, Eigen::digamma(), Eigen::polygamma(), lgamma() */ EIGEN_DEVICE_FUNC inline const DigammaReturnType digamma() const { return DigammaReturnType(derived()); } /** \cpp11 \returns an expression of the coefficient-wise Gauss error * function of *this. * * \specialfunctions_module * * \note This function supports only float and double scalar types in c++11 mode. To support other scalar types, * or float/double in non c++11 mode, the user has to provide implementations of erf(T) for any scalar * type T to be supported. * * \sa Math functions, erfc() */ EIGEN_DEVICE_FUNC inline const ErfReturnType erf() const { return ErfReturnType(derived()); } /** \cpp11 \returns an expression of the coefficient-wise Complementary error * function of *this. * * \specialfunctions_module * * \note This function supports only float and double scalar types in c++11 mode. To support other scalar types, * or float/double in non c++11 mode, the user has to provide implementations of erfc(T) for any scalar * type T to be supported. * * \sa Math functions, erf() */ EIGEN_DEVICE_FUNC inline const ErfcReturnType erfc() const { return ErfcReturnType(derived()); } /** \returns an expression of the coefficient-wise inverse of the CDF of the Normal distribution function * function of *this. * * \specialfunctions_module * * In other words, considering `x = ndtri(y)`, it returns the argument, x, for which the area under the * Gaussian probability density function (integrated from minus infinity to x) is equal to y. * * \note This function supports only float and double scalar types. To support other scalar types, * the user has to provide implementations of ndtri(T) for any scalar type T to be supported. * * \sa Math functions */ EIGEN_DEVICE_FUNC inline const NdtriReturnType ndtri() const { return NdtriReturnType(derived()); } ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/plugins/BlockMethods.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2010 Gael Guennebaud // Copyright (C) 2006-2010 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_PARSED_BY_DOXYGEN /// \internal expression type of a column */ typedef Block::RowsAtCompileTime, 1, !IsRowMajor> ColXpr; typedef const Block::RowsAtCompileTime, 1, !IsRowMajor> ConstColXpr; /// \internal expression type of a row */ typedef Block::ColsAtCompileTime, IsRowMajor> RowXpr; typedef const Block::ColsAtCompileTime, IsRowMajor> ConstRowXpr; /// \internal expression type of a block of whole columns */ typedef Block::RowsAtCompileTime, Dynamic, !IsRowMajor> ColsBlockXpr; typedef const Block::RowsAtCompileTime, Dynamic, !IsRowMajor> ConstColsBlockXpr; /// \internal expression type of a block of whole rows */ typedef Block::ColsAtCompileTime, IsRowMajor> RowsBlockXpr; typedef const Block::ColsAtCompileTime, IsRowMajor> ConstRowsBlockXpr; /// \internal expression type of a block of whole columns */ template struct NColsBlockXpr { typedef Block::RowsAtCompileTime, N, !IsRowMajor> Type; }; template struct ConstNColsBlockXpr { typedef const Block::RowsAtCompileTime, N, !IsRowMajor> Type; }; /// \internal expression type of a block of whole rows */ template struct NRowsBlockXpr { typedef Block::ColsAtCompileTime, IsRowMajor> Type; }; template struct ConstNRowsBlockXpr { typedef const Block::ColsAtCompileTime, IsRowMajor> Type; }; /// \internal expression of a block */ typedef Block BlockXpr; typedef const Block ConstBlockXpr; /// \internal expression of a block of fixed sizes */ template struct FixedBlockXpr { typedef Block Type; }; template struct ConstFixedBlockXpr { typedef Block Type; }; typedef VectorBlock SegmentReturnType; typedef const VectorBlock ConstSegmentReturnType; template struct FixedSegmentReturnType { typedef VectorBlock Type; }; template struct ConstFixedSegmentReturnType { typedef const VectorBlock Type; }; /// \internal inner-vector typedef Block InnerVectorReturnType; typedef Block ConstInnerVectorReturnType; /// \internal set of inner-vectors typedef Block InnerVectorsReturnType; typedef Block ConstInnerVectorsReturnType; #endif // not EIGEN_PARSED_BY_DOXYGEN /// \returns an expression of a block in \c *this with either dynamic or fixed sizes. /// /// \param startRow the first row in the block /// \param startCol the first column in the block /// \param blockRows number of rows in the block, specified at either run-time or compile-time /// \param blockCols number of columns in the block, specified at either run-time or compile-time /// \tparam NRowsType the type of the value handling the number of rows in the block, typically Index. /// \tparam NColsType the type of the value handling the number of columns in the block, typically Index. /// /// Example using runtime (aka dynamic) sizes: \include MatrixBase_block_int_int_int_int.cpp /// Output: \verbinclude MatrixBase_block_int_int_int_int.out /// /// \newin{3.4}: /// /// The number of rows \a blockRows and columns \a blockCols can also be specified at compile-time by passing Eigen::fix, /// or Eigen::fix(n) as arguments. In the later case, \c n plays the role of a runtime fallback value in case \c N equals Eigen::Dynamic. /// Here is an example with a fixed number of rows \c NRows and dynamic number of columns \c cols: /// \code /// mat.block(i,j,fix,cols) /// \endcode /// /// This function thus fully covers the features offered by the following overloads block(Index, Index), /// and block(Index, Index, Index, Index) that are thus obsolete. Indeed, this generic version avoids /// redundancy, it preserves the argument order, and prevents the need to rely on the template keyword in templated code. /// /// but with less redundancy and more consistency as it does not modify the argument order /// and seamlessly enable hybrid fixed/dynamic sizes. /// /// \note Even in the case that the returned expression has dynamic size, in the case /// when it is applied to a fixed-size matrix, it inherits a fixed maximal size, /// which means that evaluating it does not cause a dynamic memory allocation. /// EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL /// /// \sa class Block, fix, fix(int) /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN typename FixedBlockXpr::value,internal::get_fixed_value::value>::Type #else typename FixedBlockXpr<...,...>::Type #endif block(Index startRow, Index startCol, NRowsType blockRows, NColsType blockCols) { return typename FixedBlockXpr::value,internal::get_fixed_value::value>::Type( derived(), startRow, startCol, internal::get_runtime_value(blockRows), internal::get_runtime_value(blockCols)); } /// This is the const version of block(Index,Index,NRowsType,NColsType) template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN const typename ConstFixedBlockXpr::value,internal::get_fixed_value::value>::Type #else const typename ConstFixedBlockXpr<...,...>::Type #endif block(Index startRow, Index startCol, NRowsType blockRows, NColsType blockCols) const { return typename ConstFixedBlockXpr::value,internal::get_fixed_value::value>::Type( derived(), startRow, startCol, internal::get_runtime_value(blockRows), internal::get_runtime_value(blockCols)); } /// \returns a expression of a top-right corner of \c *this with either dynamic or fixed sizes. /// /// \param cRows the number of rows in the corner /// \param cCols the number of columns in the corner /// \tparam NRowsType the type of the value handling the number of rows in the block, typically Index. /// \tparam NColsType the type of the value handling the number of columns in the block, typically Index. /// /// Example with dynamic sizes: \include MatrixBase_topRightCorner_int_int.cpp /// Output: \verbinclude MatrixBase_topRightCorner_int_int.out /// /// The number of rows \a blockRows and columns \a blockCols can also be specified at compile-time by passing Eigen::fix, /// or Eigen::fix(n) as arguments. See \link block(Index,Index,NRowsType,NColsType) block() \endlink for the details. /// EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL /// /// \sa block(Index,Index,NRowsType,NColsType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN typename FixedBlockXpr::value,internal::get_fixed_value::value>::Type #else typename FixedBlockXpr<...,...>::Type #endif topRightCorner(NRowsType cRows, NColsType cCols) { return typename FixedBlockXpr::value,internal::get_fixed_value::value>::Type (derived(), 0, cols() - internal::get_runtime_value(cCols), internal::get_runtime_value(cRows), internal::get_runtime_value(cCols)); } /// This is the const version of topRightCorner(NRowsType, NColsType). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN const typename ConstFixedBlockXpr::value,internal::get_fixed_value::value>::Type #else const typename ConstFixedBlockXpr<...,...>::Type #endif topRightCorner(NRowsType cRows, NColsType cCols) const { return typename ConstFixedBlockXpr::value,internal::get_fixed_value::value>::Type (derived(), 0, cols() - internal::get_runtime_value(cCols), internal::get_runtime_value(cRows), internal::get_runtime_value(cCols)); } /// \returns an expression of a fixed-size top-right corner of \c *this. /// /// \tparam CRows the number of rows in the corner /// \tparam CCols the number of columns in the corner /// /// Example: \include MatrixBase_template_int_int_topRightCorner.cpp /// Output: \verbinclude MatrixBase_template_int_int_topRightCorner.out /// EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL /// /// \sa class Block, block(Index,Index) /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename FixedBlockXpr::Type topRightCorner() { return typename FixedBlockXpr::Type(derived(), 0, cols() - CCols); } /// This is the const version of topRightCorner(). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr::Type topRightCorner() const { return typename ConstFixedBlockXpr::Type(derived(), 0, cols() - CCols); } /// \returns an expression of a top-right corner of \c *this. /// /// \tparam CRows number of rows in corner as specified at compile-time /// \tparam CCols number of columns in corner as specified at compile-time /// \param cRows number of rows in corner as specified at run-time /// \param cCols number of columns in corner as specified at run-time /// /// This function is mainly useful for corners where the number of rows is specified at compile-time /// and the number of columns is specified at run-time, or vice versa. The compile-time and run-time /// information should not contradict. In other words, \a cRows should equal \a CRows unless /// \a CRows is \a Dynamic, and the same for the number of columns. /// /// Example: \include MatrixBase_template_int_int_topRightCorner_int_int.cpp /// Output: \verbinclude MatrixBase_template_int_int_topRightCorner_int_int.out /// EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL /// /// \sa class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename FixedBlockXpr::Type topRightCorner(Index cRows, Index cCols) { return typename FixedBlockXpr::Type(derived(), 0, cols() - cCols, cRows, cCols); } /// This is the const version of topRightCorner(Index, Index). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr::Type topRightCorner(Index cRows, Index cCols) const { return typename ConstFixedBlockXpr::Type(derived(), 0, cols() - cCols, cRows, cCols); } /// \returns an expression of a top-left corner of \c *this with either dynamic or fixed sizes. /// /// \param cRows the number of rows in the corner /// \param cCols the number of columns in the corner /// \tparam NRowsType the type of the value handling the number of rows in the block, typically Index. /// \tparam NColsType the type of the value handling the number of columns in the block, typically Index. /// /// Example: \include MatrixBase_topLeftCorner_int_int.cpp /// Output: \verbinclude MatrixBase_topLeftCorner_int_int.out /// /// The number of rows \a blockRows and columns \a blockCols can also be specified at compile-time by passing Eigen::fix, /// or Eigen::fix(n) as arguments. See \link block(Index,Index,NRowsType,NColsType) block() \endlink for the details. /// EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL /// /// \sa block(Index,Index,NRowsType,NColsType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN typename FixedBlockXpr::value,internal::get_fixed_value::value>::Type #else typename FixedBlockXpr<...,...>::Type #endif topLeftCorner(NRowsType cRows, NColsType cCols) { return typename FixedBlockXpr::value,internal::get_fixed_value::value>::Type (derived(), 0, 0, internal::get_runtime_value(cRows), internal::get_runtime_value(cCols)); } /// This is the const version of topLeftCorner(Index, Index). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN const typename ConstFixedBlockXpr::value,internal::get_fixed_value::value>::Type #else const typename ConstFixedBlockXpr<...,...>::Type #endif topLeftCorner(NRowsType cRows, NColsType cCols) const { return typename ConstFixedBlockXpr::value,internal::get_fixed_value::value>::Type (derived(), 0, 0, internal::get_runtime_value(cRows), internal::get_runtime_value(cCols)); } /// \returns an expression of a fixed-size top-left corner of \c *this. /// /// The template parameters CRows and CCols are the number of rows and columns in the corner. /// /// Example: \include MatrixBase_template_int_int_topLeftCorner.cpp /// Output: \verbinclude MatrixBase_template_int_int_topLeftCorner.out /// EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL /// /// \sa block(Index,Index,NRowsType,NColsType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename FixedBlockXpr::Type topLeftCorner() { return typename FixedBlockXpr::Type(derived(), 0, 0); } /// This is the const version of topLeftCorner(). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr::Type topLeftCorner() const { return typename ConstFixedBlockXpr::Type(derived(), 0, 0); } /// \returns an expression of a top-left corner of \c *this. /// /// \tparam CRows number of rows in corner as specified at compile-time /// \tparam CCols number of columns in corner as specified at compile-time /// \param cRows number of rows in corner as specified at run-time /// \param cCols number of columns in corner as specified at run-time /// /// This function is mainly useful for corners where the number of rows is specified at compile-time /// and the number of columns is specified at run-time, or vice versa. The compile-time and run-time /// information should not contradict. In other words, \a cRows should equal \a CRows unless /// \a CRows is \a Dynamic, and the same for the number of columns. /// /// Example: \include MatrixBase_template_int_int_topLeftCorner_int_int.cpp /// Output: \verbinclude MatrixBase_template_int_int_topLeftCorner_int_int.out /// EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL /// /// \sa class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename FixedBlockXpr::Type topLeftCorner(Index cRows, Index cCols) { return typename FixedBlockXpr::Type(derived(), 0, 0, cRows, cCols); } /// This is the const version of topLeftCorner(Index, Index). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr::Type topLeftCorner(Index cRows, Index cCols) const { return typename ConstFixedBlockXpr::Type(derived(), 0, 0, cRows, cCols); } /// \returns an expression of a bottom-right corner of \c *this with either dynamic or fixed sizes. /// /// \param cRows the number of rows in the corner /// \param cCols the number of columns in the corner /// \tparam NRowsType the type of the value handling the number of rows in the block, typically Index. /// \tparam NColsType the type of the value handling the number of columns in the block, typically Index. /// /// Example: \include MatrixBase_bottomRightCorner_int_int.cpp /// Output: \verbinclude MatrixBase_bottomRightCorner_int_int.out /// /// The number of rows \a blockRows and columns \a blockCols can also be specified at compile-time by passing Eigen::fix, /// or Eigen::fix(n) as arguments. See \link block(Index,Index,NRowsType,NColsType) block() \endlink for the details. /// EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL /// /// \sa block(Index,Index,NRowsType,NColsType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN typename FixedBlockXpr::value,internal::get_fixed_value::value>::Type #else typename FixedBlockXpr<...,...>::Type #endif bottomRightCorner(NRowsType cRows, NColsType cCols) { return typename FixedBlockXpr::value,internal::get_fixed_value::value>::Type (derived(), rows() - internal::get_runtime_value(cRows), cols() - internal::get_runtime_value(cCols), internal::get_runtime_value(cRows), internal::get_runtime_value(cCols)); } /// This is the const version of bottomRightCorner(NRowsType, NColsType). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN const typename ConstFixedBlockXpr::value,internal::get_fixed_value::value>::Type #else const typename ConstFixedBlockXpr<...,...>::Type #endif bottomRightCorner(NRowsType cRows, NColsType cCols) const { return typename ConstFixedBlockXpr::value,internal::get_fixed_value::value>::Type (derived(), rows() - internal::get_runtime_value(cRows), cols() - internal::get_runtime_value(cCols), internal::get_runtime_value(cRows), internal::get_runtime_value(cCols)); } /// \returns an expression of a fixed-size bottom-right corner of \c *this. /// /// The template parameters CRows and CCols are the number of rows and columns in the corner. /// /// Example: \include MatrixBase_template_int_int_bottomRightCorner.cpp /// Output: \verbinclude MatrixBase_template_int_int_bottomRightCorner.out /// EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL /// /// \sa block(Index,Index,NRowsType,NColsType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename FixedBlockXpr::Type bottomRightCorner() { return typename FixedBlockXpr::Type(derived(), rows() - CRows, cols() - CCols); } /// This is the const version of bottomRightCorner(). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr::Type bottomRightCorner() const { return typename ConstFixedBlockXpr::Type(derived(), rows() - CRows, cols() - CCols); } /// \returns an expression of a bottom-right corner of \c *this. /// /// \tparam CRows number of rows in corner as specified at compile-time /// \tparam CCols number of columns in corner as specified at compile-time /// \param cRows number of rows in corner as specified at run-time /// \param cCols number of columns in corner as specified at run-time /// /// This function is mainly useful for corners where the number of rows is specified at compile-time /// and the number of columns is specified at run-time, or vice versa. The compile-time and run-time /// information should not contradict. In other words, \a cRows should equal \a CRows unless /// \a CRows is \a Dynamic, and the same for the number of columns. /// /// Example: \include MatrixBase_template_int_int_bottomRightCorner_int_int.cpp /// Output: \verbinclude MatrixBase_template_int_int_bottomRightCorner_int_int.out /// EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL /// /// \sa class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename FixedBlockXpr::Type bottomRightCorner(Index cRows, Index cCols) { return typename FixedBlockXpr::Type(derived(), rows() - cRows, cols() - cCols, cRows, cCols); } /// This is the const version of bottomRightCorner(Index, Index). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr::Type bottomRightCorner(Index cRows, Index cCols) const { return typename ConstFixedBlockXpr::Type(derived(), rows() - cRows, cols() - cCols, cRows, cCols); } /// \returns an expression of a bottom-left corner of \c *this with either dynamic or fixed sizes. /// /// \param cRows the number of rows in the corner /// \param cCols the number of columns in the corner /// \tparam NRowsType the type of the value handling the number of rows in the block, typically Index. /// \tparam NColsType the type of the value handling the number of columns in the block, typically Index. /// /// Example: \include MatrixBase_bottomLeftCorner_int_int.cpp /// Output: \verbinclude MatrixBase_bottomLeftCorner_int_int.out /// /// The number of rows \a blockRows and columns \a blockCols can also be specified at compile-time by passing Eigen::fix, /// or Eigen::fix(n) as arguments. See \link block(Index,Index,NRowsType,NColsType) block() \endlink for the details. /// EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL /// /// \sa block(Index,Index,NRowsType,NColsType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN typename FixedBlockXpr::value,internal::get_fixed_value::value>::Type #else typename FixedBlockXpr<...,...>::Type #endif bottomLeftCorner(NRowsType cRows, NColsType cCols) { return typename FixedBlockXpr::value,internal::get_fixed_value::value>::Type (derived(), rows() - internal::get_runtime_value(cRows), 0, internal::get_runtime_value(cRows), internal::get_runtime_value(cCols)); } /// This is the const version of bottomLeftCorner(NRowsType, NColsType). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN typename ConstFixedBlockXpr::value,internal::get_fixed_value::value>::Type #else typename ConstFixedBlockXpr<...,...>::Type #endif bottomLeftCorner(NRowsType cRows, NColsType cCols) const { return typename ConstFixedBlockXpr::value,internal::get_fixed_value::value>::Type (derived(), rows() - internal::get_runtime_value(cRows), 0, internal::get_runtime_value(cRows), internal::get_runtime_value(cCols)); } /// \returns an expression of a fixed-size bottom-left corner of \c *this. /// /// The template parameters CRows and CCols are the number of rows and columns in the corner. /// /// Example: \include MatrixBase_template_int_int_bottomLeftCorner.cpp /// Output: \verbinclude MatrixBase_template_int_int_bottomLeftCorner.out /// EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL /// /// \sa block(Index,Index,NRowsType,NColsType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename FixedBlockXpr::Type bottomLeftCorner() { return typename FixedBlockXpr::Type(derived(), rows() - CRows, 0); } /// This is the const version of bottomLeftCorner(). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr::Type bottomLeftCorner() const { return typename ConstFixedBlockXpr::Type(derived(), rows() - CRows, 0); } /// \returns an expression of a bottom-left corner of \c *this. /// /// \tparam CRows number of rows in corner as specified at compile-time /// \tparam CCols number of columns in corner as specified at compile-time /// \param cRows number of rows in corner as specified at run-time /// \param cCols number of columns in corner as specified at run-time /// /// This function is mainly useful for corners where the number of rows is specified at compile-time /// and the number of columns is specified at run-time, or vice versa. The compile-time and run-time /// information should not contradict. In other words, \a cRows should equal \a CRows unless /// \a CRows is \a Dynamic, and the same for the number of columns. /// /// Example: \include MatrixBase_template_int_int_bottomLeftCorner_int_int.cpp /// Output: \verbinclude MatrixBase_template_int_int_bottomLeftCorner_int_int.out /// EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL /// /// \sa class Block /// template EIGEN_STRONG_INLINE typename FixedBlockXpr::Type bottomLeftCorner(Index cRows, Index cCols) { return typename FixedBlockXpr::Type(derived(), rows() - cRows, 0, cRows, cCols); } /// This is the const version of bottomLeftCorner(Index, Index). template EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr::Type bottomLeftCorner(Index cRows, Index cCols) const { return typename ConstFixedBlockXpr::Type(derived(), rows() - cRows, 0, cRows, cCols); } /// \returns a block consisting of the top rows of \c *this. /// /// \param n the number of rows in the block /// \tparam NRowsType the type of the value handling the number of rows in the block, typically Index. /// /// Example: \include MatrixBase_topRows_int.cpp /// Output: \verbinclude MatrixBase_topRows_int.out /// /// The number of rows \a n can also be specified at compile-time by passing Eigen::fix, /// or Eigen::fix(n) as arguments. /// See \link block(Index,Index,NRowsType,NColsType) block() \endlink for the details. /// EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row-major) /// /// \sa block(Index,Index,NRowsType,NColsType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN typename NRowsBlockXpr::value>::Type #else typename NRowsBlockXpr<...>::Type #endif topRows(NRowsType n) { return typename NRowsBlockXpr::value>::Type (derived(), 0, 0, internal::get_runtime_value(n), cols()); } /// This is the const version of topRows(NRowsType). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN const typename ConstNRowsBlockXpr::value>::Type #else const typename ConstNRowsBlockXpr<...>::Type #endif topRows(NRowsType n) const { return typename ConstNRowsBlockXpr::value>::Type (derived(), 0, 0, internal::get_runtime_value(n), cols()); } /// \returns a block consisting of the top rows of \c *this. /// /// \tparam N the number of rows in the block as specified at compile-time /// \param n the number of rows in the block as specified at run-time /// /// The compile-time and run-time information should not contradict. In other words, /// \a n should equal \a N unless \a N is \a Dynamic. /// /// Example: \include MatrixBase_template_int_topRows.cpp /// Output: \verbinclude MatrixBase_template_int_topRows.out /// EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row-major) /// /// \sa block(Index,Index,NRowsType,NColsType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename NRowsBlockXpr::Type topRows(Index n = N) { return typename NRowsBlockXpr::Type(derived(), 0, 0, n, cols()); } /// This is the const version of topRows(). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename ConstNRowsBlockXpr::Type topRows(Index n = N) const { return typename ConstNRowsBlockXpr::Type(derived(), 0, 0, n, cols()); } /// \returns a block consisting of the bottom rows of \c *this. /// /// \param n the number of rows in the block /// \tparam NRowsType the type of the value handling the number of rows in the block, typically Index. /// /// Example: \include MatrixBase_bottomRows_int.cpp /// Output: \verbinclude MatrixBase_bottomRows_int.out /// /// The number of rows \a n can also be specified at compile-time by passing Eigen::fix, /// or Eigen::fix(n) as arguments. /// See \link block(Index,Index,NRowsType,NColsType) block() \endlink for the details. /// EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row-major) /// /// \sa block(Index,Index,NRowsType,NColsType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN typename NRowsBlockXpr::value>::Type #else typename NRowsBlockXpr<...>::Type #endif bottomRows(NRowsType n) { return typename NRowsBlockXpr::value>::Type (derived(), rows() - internal::get_runtime_value(n), 0, internal::get_runtime_value(n), cols()); } /// This is the const version of bottomRows(NRowsType). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN const typename ConstNRowsBlockXpr::value>::Type #else const typename ConstNRowsBlockXpr<...>::Type #endif bottomRows(NRowsType n) const { return typename ConstNRowsBlockXpr::value>::Type (derived(), rows() - internal::get_runtime_value(n), 0, internal::get_runtime_value(n), cols()); } /// \returns a block consisting of the bottom rows of \c *this. /// /// \tparam N the number of rows in the block as specified at compile-time /// \param n the number of rows in the block as specified at run-time /// /// The compile-time and run-time information should not contradict. In other words, /// \a n should equal \a N unless \a N is \a Dynamic. /// /// Example: \include MatrixBase_template_int_bottomRows.cpp /// Output: \verbinclude MatrixBase_template_int_bottomRows.out /// EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row-major) /// /// \sa block(Index,Index,NRowsType,NColsType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename NRowsBlockXpr::Type bottomRows(Index n = N) { return typename NRowsBlockXpr::Type(derived(), rows() - n, 0, n, cols()); } /// This is the const version of bottomRows(). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename ConstNRowsBlockXpr::Type bottomRows(Index n = N) const { return typename ConstNRowsBlockXpr::Type(derived(), rows() - n, 0, n, cols()); } /// \returns a block consisting of a range of rows of \c *this. /// /// \param startRow the index of the first row in the block /// \param n the number of rows in the block /// \tparam NRowsType the type of the value handling the number of rows in the block, typically Index. /// /// Example: \include DenseBase_middleRows_int.cpp /// Output: \verbinclude DenseBase_middleRows_int.out /// /// The number of rows \a n can also be specified at compile-time by passing Eigen::fix, /// or Eigen::fix(n) as arguments. /// See \link block(Index,Index,NRowsType,NColsType) block() \endlink for the details. /// EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row-major) /// /// \sa block(Index,Index,NRowsType,NColsType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN typename NRowsBlockXpr::value>::Type #else typename NRowsBlockXpr<...>::Type #endif middleRows(Index startRow, NRowsType n) { return typename NRowsBlockXpr::value>::Type (derived(), startRow, 0, internal::get_runtime_value(n), cols()); } /// This is the const version of middleRows(Index,NRowsType). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN const typename ConstNRowsBlockXpr::value>::Type #else const typename ConstNRowsBlockXpr<...>::Type #endif middleRows(Index startRow, NRowsType n) const { return typename ConstNRowsBlockXpr::value>::Type (derived(), startRow, 0, internal::get_runtime_value(n), cols()); } /// \returns a block consisting of a range of rows of \c *this. /// /// \tparam N the number of rows in the block as specified at compile-time /// \param startRow the index of the first row in the block /// \param n the number of rows in the block as specified at run-time /// /// The compile-time and run-time information should not contradict. In other words, /// \a n should equal \a N unless \a N is \a Dynamic. /// /// Example: \include DenseBase_template_int_middleRows.cpp /// Output: \verbinclude DenseBase_template_int_middleRows.out /// EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row-major) /// /// \sa block(Index,Index,NRowsType,NColsType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename NRowsBlockXpr::Type middleRows(Index startRow, Index n = N) { return typename NRowsBlockXpr::Type(derived(), startRow, 0, n, cols()); } /// This is the const version of middleRows(). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename ConstNRowsBlockXpr::Type middleRows(Index startRow, Index n = N) const { return typename ConstNRowsBlockXpr::Type(derived(), startRow, 0, n, cols()); } /// \returns a block consisting of the left columns of \c *this. /// /// \param n the number of columns in the block /// \tparam NColsType the type of the value handling the number of columns in the block, typically Index. /// /// Example: \include MatrixBase_leftCols_int.cpp /// Output: \verbinclude MatrixBase_leftCols_int.out /// /// The number of columns \a n can also be specified at compile-time by passing Eigen::fix, /// or Eigen::fix(n) as arguments. /// See \link block(Index,Index,NRowsType,NColsType) block() \endlink for the details. /// EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column-major) /// /// \sa block(Index,Index,NRowsType,NColsType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN typename NColsBlockXpr::value>::Type #else typename NColsBlockXpr<...>::Type #endif leftCols(NColsType n) { return typename NColsBlockXpr::value>::Type (derived(), 0, 0, rows(), internal::get_runtime_value(n)); } /// This is the const version of leftCols(NColsType). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN const typename ConstNColsBlockXpr::value>::Type #else const typename ConstNColsBlockXpr<...>::Type #endif leftCols(NColsType n) const { return typename ConstNColsBlockXpr::value>::Type (derived(), 0, 0, rows(), internal::get_runtime_value(n)); } /// \returns a block consisting of the left columns of \c *this. /// /// \tparam N the number of columns in the block as specified at compile-time /// \param n the number of columns in the block as specified at run-time /// /// The compile-time and run-time information should not contradict. In other words, /// \a n should equal \a N unless \a N is \a Dynamic. /// /// Example: \include MatrixBase_template_int_leftCols.cpp /// Output: \verbinclude MatrixBase_template_int_leftCols.out /// EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column-major) /// /// \sa block(Index,Index,NRowsType,NColsType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename NColsBlockXpr::Type leftCols(Index n = N) { return typename NColsBlockXpr::Type(derived(), 0, 0, rows(), n); } /// This is the const version of leftCols(). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename ConstNColsBlockXpr::Type leftCols(Index n = N) const { return typename ConstNColsBlockXpr::Type(derived(), 0, 0, rows(), n); } /// \returns a block consisting of the right columns of \c *this. /// /// \param n the number of columns in the block /// \tparam NColsType the type of the value handling the number of columns in the block, typically Index. /// /// Example: \include MatrixBase_rightCols_int.cpp /// Output: \verbinclude MatrixBase_rightCols_int.out /// /// The number of columns \a n can also be specified at compile-time by passing Eigen::fix, /// or Eigen::fix(n) as arguments. /// See \link block(Index,Index,NRowsType,NColsType) block() \endlink for the details. /// EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column-major) /// /// \sa block(Index,Index,NRowsType,NColsType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN typename NColsBlockXpr::value>::Type #else typename NColsBlockXpr<...>::Type #endif rightCols(NColsType n) { return typename NColsBlockXpr::value>::Type (derived(), 0, cols() - internal::get_runtime_value(n), rows(), internal::get_runtime_value(n)); } /// This is the const version of rightCols(NColsType). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN const typename ConstNColsBlockXpr::value>::Type #else const typename ConstNColsBlockXpr<...>::Type #endif rightCols(NColsType n) const { return typename ConstNColsBlockXpr::value>::Type (derived(), 0, cols() - internal::get_runtime_value(n), rows(), internal::get_runtime_value(n)); } /// \returns a block consisting of the right columns of \c *this. /// /// \tparam N the number of columns in the block as specified at compile-time /// \param n the number of columns in the block as specified at run-time /// /// The compile-time and run-time information should not contradict. In other words, /// \a n should equal \a N unless \a N is \a Dynamic. /// /// Example: \include MatrixBase_template_int_rightCols.cpp /// Output: \verbinclude MatrixBase_template_int_rightCols.out /// EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column-major) /// /// \sa block(Index,Index,NRowsType,NColsType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename NColsBlockXpr::Type rightCols(Index n = N) { return typename NColsBlockXpr::Type(derived(), 0, cols() - n, rows(), n); } /// This is the const version of rightCols(). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename ConstNColsBlockXpr::Type rightCols(Index n = N) const { return typename ConstNColsBlockXpr::Type(derived(), 0, cols() - n, rows(), n); } /// \returns a block consisting of a range of columns of \c *this. /// /// \param startCol the index of the first column in the block /// \param numCols the number of columns in the block /// \tparam NColsType the type of the value handling the number of columns in the block, typically Index. /// /// Example: \include DenseBase_middleCols_int.cpp /// Output: \verbinclude DenseBase_middleCols_int.out /// /// The number of columns \a n can also be specified at compile-time by passing Eigen::fix, /// or Eigen::fix(n) as arguments. /// See \link block(Index,Index,NRowsType,NColsType) block() \endlink for the details. /// EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column-major) /// /// \sa block(Index,Index,NRowsType,NColsType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN typename NColsBlockXpr::value>::Type #else typename NColsBlockXpr<...>::Type #endif middleCols(Index startCol, NColsType numCols) { return typename NColsBlockXpr::value>::Type (derived(), 0, startCol, rows(), internal::get_runtime_value(numCols)); } /// This is the const version of middleCols(Index,NColsType). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN const typename ConstNColsBlockXpr::value>::Type #else const typename ConstNColsBlockXpr<...>::Type #endif middleCols(Index startCol, NColsType numCols) const { return typename ConstNColsBlockXpr::value>::Type (derived(), 0, startCol, rows(), internal::get_runtime_value(numCols)); } /// \returns a block consisting of a range of columns of \c *this. /// /// \tparam N the number of columns in the block as specified at compile-time /// \param startCol the index of the first column in the block /// \param n the number of columns in the block as specified at run-time /// /// The compile-time and run-time information should not contradict. In other words, /// \a n should equal \a N unless \a N is \a Dynamic. /// /// Example: \include DenseBase_template_int_middleCols.cpp /// Output: \verbinclude DenseBase_template_int_middleCols.out /// EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column-major) /// /// \sa block(Index,Index,NRowsType,NColsType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename NColsBlockXpr::Type middleCols(Index startCol, Index n = N) { return typename NColsBlockXpr::Type(derived(), 0, startCol, rows(), n); } /// This is the const version of middleCols(). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename ConstNColsBlockXpr::Type middleCols(Index startCol, Index n = N) const { return typename ConstNColsBlockXpr::Type(derived(), 0, startCol, rows(), n); } /// \returns a fixed-size expression of a block of \c *this. /// /// The template parameters \a NRows and \a NCols are the number of /// rows and columns in the block. /// /// \param startRow the first row in the block /// \param startCol the first column in the block /// /// Example: \include MatrixBase_block_int_int.cpp /// Output: \verbinclude MatrixBase_block_int_int.out /// /// \note The usage of of this overload is discouraged from %Eigen 3.4, better used the generic /// block(Index,Index,NRowsType,NColsType), here is the one-to-one equivalence: /// \code /// mat.template block(i,j) <--> mat.block(i,j,fix,fix) /// \endcode /// /// \note since block is a templated member, the keyword template has to be used /// if the matrix type is also a template parameter: \code m.template block<3,3>(1,1); \endcode /// EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL /// /// \sa block(Index,Index,NRowsType,NColsType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename FixedBlockXpr::Type block(Index startRow, Index startCol) { return typename FixedBlockXpr::Type(derived(), startRow, startCol); } /// This is the const version of block<>(Index, Index). */ template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr::Type block(Index startRow, Index startCol) const { return typename ConstFixedBlockXpr::Type(derived(), startRow, startCol); } /// \returns an expression of a block of \c *this. /// /// \tparam NRows number of rows in block as specified at compile-time /// \tparam NCols number of columns in block as specified at compile-time /// \param startRow the first row in the block /// \param startCol the first column in the block /// \param blockRows number of rows in block as specified at run-time /// \param blockCols number of columns in block as specified at run-time /// /// This function is mainly useful for blocks where the number of rows is specified at compile-time /// and the number of columns is specified at run-time, or vice versa. The compile-time and run-time /// information should not contradict. In other words, \a blockRows should equal \a NRows unless /// \a NRows is \a Dynamic, and the same for the number of columns. /// /// Example: \include MatrixBase_template_int_int_block_int_int_int_int.cpp /// Output: \verbinclude MatrixBase_template_int_int_block_int_int_int_int.out /// /// \note The usage of of this overload is discouraged from %Eigen 3.4, better used the generic /// block(Index,Index,NRowsType,NColsType), here is the one-to-one complete equivalence: /// \code /// mat.template block(i,j,rows,cols) <--> mat.block(i,j,fix(rows),fix(cols)) /// \endcode /// If we known that, e.g., NRows==Dynamic and NCols!=Dynamic, then the equivalence becomes: /// \code /// mat.template block(i,j,rows,NCols) <--> mat.block(i,j,rows,fix) /// \endcode /// EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL /// /// \sa block(Index,Index,NRowsType,NColsType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename FixedBlockXpr::Type block(Index startRow, Index startCol, Index blockRows, Index blockCols) { return typename FixedBlockXpr::Type(derived(), startRow, startCol, blockRows, blockCols); } /// This is the const version of block<>(Index, Index, Index, Index). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename ConstFixedBlockXpr::Type block(Index startRow, Index startCol, Index blockRows, Index blockCols) const { return typename ConstFixedBlockXpr::Type(derived(), startRow, startCol, blockRows, blockCols); } /// \returns an expression of the \a i-th column of \c *this. Note that the numbering starts at 0. /// /// Example: \include MatrixBase_col.cpp /// Output: \verbinclude MatrixBase_col.out /// EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column-major) /** * \sa row(), class Block */ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ColXpr col(Index i) { return ColXpr(derived(), i); } /// This is the const version of col(). EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ConstColXpr col(Index i) const { return ConstColXpr(derived(), i); } /// \returns an expression of the \a i-th row of \c *this. Note that the numbering starts at 0. /// /// Example: \include MatrixBase_row.cpp /// Output: \verbinclude MatrixBase_row.out /// EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row-major) /** * \sa col(), class Block */ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE RowXpr row(Index i) { return RowXpr(derived(), i); } /// This is the const version of row(). */ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ConstRowXpr row(Index i) const { return ConstRowXpr(derived(), i); } /// \returns an expression of a segment (i.e. a vector block) in \c *this with either dynamic or fixed sizes. /// /// \only_for_vectors /// /// \param start the first coefficient in the segment /// \param n the number of coefficients in the segment /// \tparam NType the type of the value handling the number of coefficients in the segment, typically Index. /// /// Example: \include MatrixBase_segment_int_int.cpp /// Output: \verbinclude MatrixBase_segment_int_int.out /// /// The number of coefficients \a n can also be specified at compile-time by passing Eigen::fix, /// or Eigen::fix(n) as arguments. /// See \link block(Index,Index,NRowsType,NColsType) block() \endlink for the details. /// /// \note Even in the case that the returned expression has dynamic size, in the case /// when it is applied to a fixed-size vector, it inherits a fixed maximal size, /// which means that evaluating it does not cause a dynamic memory allocation. /// /// \sa block(Index,Index,NRowsType,NColsType), fix, fix(int), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN typename FixedSegmentReturnType::value>::Type #else typename FixedSegmentReturnType<...>::Type #endif segment(Index start, NType n) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) return typename FixedSegmentReturnType::value>::Type (derived(), start, internal::get_runtime_value(n)); } /// This is the const version of segment(Index,NType). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN const typename ConstFixedSegmentReturnType::value>::Type #else const typename ConstFixedSegmentReturnType<...>::Type #endif segment(Index start, NType n) const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) return typename ConstFixedSegmentReturnType::value>::Type (derived(), start, internal::get_runtime_value(n)); } /// \returns an expression of the first coefficients of \c *this with either dynamic or fixed sizes. /// /// \only_for_vectors /// /// \param n the number of coefficients in the segment /// \tparam NType the type of the value handling the number of coefficients in the segment, typically Index. /// /// Example: \include MatrixBase_start_int.cpp /// Output: \verbinclude MatrixBase_start_int.out /// /// The number of coefficients \a n can also be specified at compile-time by passing Eigen::fix, /// or Eigen::fix(n) as arguments. /// See \link block(Index,Index,NRowsType,NColsType) block() \endlink for the details. /// /// \note Even in the case that the returned expression has dynamic size, in the case /// when it is applied to a fixed-size vector, it inherits a fixed maximal size, /// which means that evaluating it does not cause a dynamic memory allocation. /// /// \sa class Block, block(Index,Index) /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN typename FixedSegmentReturnType::value>::Type #else typename FixedSegmentReturnType<...>::Type #endif head(NType n) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) return typename FixedSegmentReturnType::value>::Type (derived(), 0, internal::get_runtime_value(n)); } /// This is the const version of head(NType). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN const typename ConstFixedSegmentReturnType::value>::Type #else const typename ConstFixedSegmentReturnType<...>::Type #endif head(NType n) const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) return typename ConstFixedSegmentReturnType::value>::Type (derived(), 0, internal::get_runtime_value(n)); } /// \returns an expression of a last coefficients of \c *this with either dynamic or fixed sizes. /// /// \only_for_vectors /// /// \param n the number of coefficients in the segment /// \tparam NType the type of the value handling the number of coefficients in the segment, typically Index. /// /// Example: \include MatrixBase_end_int.cpp /// Output: \verbinclude MatrixBase_end_int.out /// /// The number of coefficients \a n can also be specified at compile-time by passing Eigen::fix, /// or Eigen::fix(n) as arguments. /// See \link block(Index,Index,NRowsType,NColsType) block() \endlink for the details. /// /// \note Even in the case that the returned expression has dynamic size, in the case /// when it is applied to a fixed-size vector, it inherits a fixed maximal size, /// which means that evaluating it does not cause a dynamic memory allocation. /// /// \sa class Block, block(Index,Index) /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN typename FixedSegmentReturnType::value>::Type #else typename FixedSegmentReturnType<...>::Type #endif tail(NType n) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) return typename FixedSegmentReturnType::value>::Type (derived(), this->size() - internal::get_runtime_value(n), internal::get_runtime_value(n)); } /// This is the const version of tail(Index). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE #ifndef EIGEN_PARSED_BY_DOXYGEN const typename ConstFixedSegmentReturnType::value>::Type #else const typename ConstFixedSegmentReturnType<...>::Type #endif tail(NType n) const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) return typename ConstFixedSegmentReturnType::value>::Type (derived(), this->size() - internal::get_runtime_value(n), internal::get_runtime_value(n)); } /// \returns a fixed-size expression of a segment (i.e. a vector block) in \c *this /// /// \only_for_vectors /// /// \tparam N the number of coefficients in the segment as specified at compile-time /// \param start the index of the first element in the segment /// \param n the number of coefficients in the segment as specified at compile-time /// /// The compile-time and run-time information should not contradict. In other words, /// \a n should equal \a N unless \a N is \a Dynamic. /// /// Example: \include MatrixBase_template_int_segment.cpp /// Output: \verbinclude MatrixBase_template_int_segment.out /// /// \sa segment(Index,NType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename FixedSegmentReturnType::Type segment(Index start, Index n = N) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) return typename FixedSegmentReturnType::Type(derived(), start, n); } /// This is the const version of segment(Index). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename ConstFixedSegmentReturnType::Type segment(Index start, Index n = N) const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) return typename ConstFixedSegmentReturnType::Type(derived(), start, n); } /// \returns a fixed-size expression of the first coefficients of \c *this. /// /// \only_for_vectors /// /// \tparam N the number of coefficients in the segment as specified at compile-time /// \param n the number of coefficients in the segment as specified at run-time /// /// The compile-time and run-time information should not contradict. In other words, /// \a n should equal \a N unless \a N is \a Dynamic. /// /// Example: \include MatrixBase_template_int_start.cpp /// Output: \verbinclude MatrixBase_template_int_start.out /// /// \sa head(NType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename FixedSegmentReturnType::Type head(Index n = N) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) return typename FixedSegmentReturnType::Type(derived(), 0, n); } /// This is the const version of head(). template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename ConstFixedSegmentReturnType::Type head(Index n = N) const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) return typename ConstFixedSegmentReturnType::Type(derived(), 0, n); } /// \returns a fixed-size expression of the last coefficients of \c *this. /// /// \only_for_vectors /// /// \tparam N the number of coefficients in the segment as specified at compile-time /// \param n the number of coefficients in the segment as specified at run-time /// /// The compile-time and run-time information should not contradict. In other words, /// \a n should equal \a N unless \a N is \a Dynamic. /// /// Example: \include MatrixBase_template_int_end.cpp /// Output: \verbinclude MatrixBase_template_int_end.out /// /// \sa tail(NType), class Block /// template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename FixedSegmentReturnType::Type tail(Index n = N) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) return typename FixedSegmentReturnType::Type(derived(), size() - n); } /// This is the const version of tail. template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename ConstFixedSegmentReturnType::Type tail(Index n = N) const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) return typename ConstFixedSegmentReturnType::Type(derived(), size() - n); } /// \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this /// is col-major (resp. row-major). /// EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE InnerVectorReturnType innerVector(Index outer) { return InnerVectorReturnType(derived(), outer); } /// \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this /// is col-major (resp. row-major). Read-only. /// EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const ConstInnerVectorReturnType innerVector(Index outer) const { return ConstInnerVectorReturnType(derived(), outer); } /// \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this /// is col-major (resp. row-major). /// EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE InnerVectorsReturnType innerVectors(Index outerStart, Index outerSize) { return Block(derived(), IsRowMajor ? outerStart : 0, IsRowMajor ? 0 : outerStart, IsRowMajor ? outerSize : rows(), IsRowMajor ? cols() : outerSize); } /// \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this /// is col-major (resp. row-major). Read-only. /// EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const ConstInnerVectorsReturnType innerVectors(Index outerStart, Index outerSize) const { return Block(derived(), IsRowMajor ? outerStart : 0, IsRowMajor ? 0 : outerStart, IsRowMajor ? outerSize : rows(), IsRowMajor ? cols() : outerSize); } /** \returns the i-th subvector (column or vector) according to the \c Direction * \sa subVectors() */ template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::conditional::type subVector(Index i) { return typename internal::conditional::type(derived(),i); } /** This is the const version of subVector(Index) */ template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::conditional::type subVector(Index i) const { return typename internal::conditional::type(derived(),i); } /** \returns the number of subvectors (rows or columns) in the direction \c Direction * \sa subVector(Index) */ template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index subVectors() const { return (Direction==Vertical)?cols():rows(); } ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2016 Gael Guennebaud // Copyright (C) 2006-2008 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. // This file is a base class plugin containing common coefficient wise functions. /** \returns an expression of the difference of \c *this and \a other * * \note If you want to substract a given scalar from all coefficients, see Cwise::operator-(). * * \sa class CwiseBinaryOp, operator-=() */ EIGEN_MAKE_CWISE_BINARY_OP(operator-,difference) /** \returns an expression of the sum of \c *this and \a other * * \note If you want to add a given scalar to all coefficients, see Cwise::operator+(). * * \sa class CwiseBinaryOp, operator+=() */ EIGEN_MAKE_CWISE_BINARY_OP(operator+,sum) /** \returns an expression of a custom coefficient-wise operator \a func of *this and \a other * * The template parameter \a CustomBinaryOp is the type of the functor * of the custom operator (see class CwiseBinaryOp for an example) * * Here is an example illustrating the use of custom functors: * \include class_CwiseBinaryOp.cpp * Output: \verbinclude class_CwiseBinaryOp.out * * \sa class CwiseBinaryOp, operator+(), operator-(), cwiseProduct() */ template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp binaryExpr(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other, const CustomBinaryOp& func = CustomBinaryOp()) const { return CwiseBinaryOp(derived(), other.derived(), func); } #ifndef EIGEN_PARSED_BY_DOXYGEN EIGEN_MAKE_SCALAR_BINARY_OP(operator*,product) #else /** \returns an expression of \c *this scaled by the scalar factor \a scalar * * \tparam T is the scalar type of \a scalar. It must be compatible with the scalar type of the given expression. */ template const CwiseBinaryOp,Derived,Constant > operator*(const T& scalar) const; /** \returns an expression of \a expr scaled by the scalar factor \a scalar * * \tparam T is the scalar type of \a scalar. It must be compatible with the scalar type of the given expression. */ template friend const CwiseBinaryOp,Constant,Derived> operator*(const T& scalar, const StorageBaseType& expr); #endif #ifndef EIGEN_PARSED_BY_DOXYGEN EIGEN_MAKE_SCALAR_BINARY_OP_ONTHERIGHT(operator/,quotient) #else /** \returns an expression of \c *this divided by the scalar value \a scalar * * \tparam T is the scalar type of \a scalar. It must be compatible with the scalar type of the given expression. */ template const CwiseBinaryOp,Derived,Constant > operator/(const T& scalar) const; #endif /** \returns an expression of the coefficient-wise boolean \b and operator of \c *this and \a other * * \warning this operator is for expression of bool only. * * Example: \include Cwise_boolean_and.cpp * Output: \verbinclude Cwise_boolean_and.out * * \sa operator||(), select() */ template EIGEN_DEVICE_FUNC inline const CwiseBinaryOp operator&&(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const { EIGEN_STATIC_ASSERT((internal::is_same::value && internal::is_same::value), THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL); return CwiseBinaryOp(derived(),other.derived()); } /** \returns an expression of the coefficient-wise boolean \b or operator of \c *this and \a other * * \warning this operator is for expression of bool only. * * Example: \include Cwise_boolean_or.cpp * Output: \verbinclude Cwise_boolean_or.out * * \sa operator&&(), select() */ template EIGEN_DEVICE_FUNC inline const CwiseBinaryOp operator||(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const { EIGEN_STATIC_ASSERT((internal::is_same::value && internal::is_same::value), THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL); return CwiseBinaryOp(derived(),other.derived()); } ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.h ================================================ // 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 // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. // This file is a base class plugin containing common coefficient wise functions. #ifndef EIGEN_PARSED_BY_DOXYGEN /** \internal the return type of conjugate() */ typedef typename internal::conditional::IsComplex, const CwiseUnaryOp, const Derived>, const Derived& >::type ConjugateReturnType; /** \internal the return type of real() const */ typedef typename internal::conditional::IsComplex, const CwiseUnaryOp, const Derived>, const Derived& >::type RealReturnType; /** \internal the return type of real() */ typedef typename internal::conditional::IsComplex, CwiseUnaryView, Derived>, Derived& >::type NonConstRealReturnType; /** \internal the return type of imag() const */ typedef CwiseUnaryOp, const Derived> ImagReturnType; /** \internal the return type of imag() */ typedef CwiseUnaryView, Derived> NonConstImagReturnType; typedef CwiseUnaryOp, const Derived> NegativeReturnType; #endif // not EIGEN_PARSED_BY_DOXYGEN /// \returns an expression of the opposite of \c *this /// EIGEN_DOC_UNARY_ADDONS(operator-,opposite) /// EIGEN_DEVICE_FUNC inline const NegativeReturnType operator-() const { return NegativeReturnType(derived()); } template struct CastXpr { typedef typename internal::cast_return_type, const Derived> >::type Type; }; /// \returns an expression of \c *this with the \a Scalar type casted to /// \a NewScalar. /// /// The template parameter \a NewScalar is the type we are casting the scalars to. /// EIGEN_DOC_UNARY_ADDONS(cast,conversion function) /// /// \sa class CwiseUnaryOp /// template EIGEN_DEVICE_FUNC typename CastXpr::Type cast() const { return typename CastXpr::Type(derived()); } /// \returns an expression of the complex conjugate of \c *this. /// EIGEN_DOC_UNARY_ADDONS(conjugate,complex conjugate) /// /// \sa Math functions, MatrixBase::adjoint() EIGEN_DEVICE_FUNC inline ConjugateReturnType conjugate() const { return ConjugateReturnType(derived()); } /// \returns an expression of the complex conjugate of \c *this if Cond==true, returns derived() otherwise. /// EIGEN_DOC_UNARY_ADDONS(conjugate,complex conjugate) /// /// \sa conjugate() template EIGEN_DEVICE_FUNC inline typename internal::conditional::type conjugateIf() const { typedef typename internal::conditional::type ReturnType; return ReturnType(derived()); } /// \returns a read-only expression of the real part of \c *this. /// EIGEN_DOC_UNARY_ADDONS(real,real part function) /// /// \sa imag() EIGEN_DEVICE_FUNC inline RealReturnType real() const { return RealReturnType(derived()); } /// \returns an read-only expression of the imaginary part of \c *this. /// EIGEN_DOC_UNARY_ADDONS(imag,imaginary part function) /// /// \sa real() EIGEN_DEVICE_FUNC inline const ImagReturnType imag() const { return ImagReturnType(derived()); } /// \brief Apply a unary operator coefficient-wise /// \param[in] func Functor implementing the unary operator /// \tparam CustomUnaryOp Type of \a func /// \returns An expression of a custom coefficient-wise unary operator \a func of *this /// /// The function \c ptr_fun() from the C++ standard library can be used to make functors out of normal functions. /// /// Example: /// \include class_CwiseUnaryOp_ptrfun.cpp /// Output: \verbinclude class_CwiseUnaryOp_ptrfun.out /// /// Genuine functors allow for more possibilities, for instance it may contain a state. /// /// Example: /// \include class_CwiseUnaryOp.cpp /// Output: \verbinclude class_CwiseUnaryOp.out /// EIGEN_DOC_UNARY_ADDONS(unaryExpr,unary function) /// /// \sa unaryViewExpr, binaryExpr, class CwiseUnaryOp /// template EIGEN_DEVICE_FUNC inline const CwiseUnaryOp unaryExpr(const CustomUnaryOp& func = CustomUnaryOp()) const { return CwiseUnaryOp(derived(), func); } /// \returns an expression of a custom coefficient-wise unary operator \a func of *this /// /// The template parameter \a CustomUnaryOp is the type of the functor /// of the custom unary operator. /// /// Example: /// \include class_CwiseUnaryOp.cpp /// Output: \verbinclude class_CwiseUnaryOp.out /// EIGEN_DOC_UNARY_ADDONS(unaryViewExpr,unary function) /// /// \sa unaryExpr, binaryExpr class CwiseUnaryOp /// template EIGEN_DEVICE_FUNC inline const CwiseUnaryView unaryViewExpr(const CustomViewOp& func = CustomViewOp()) const { return CwiseUnaryView(derived(), func); } /// \returns a non const expression of the real part of \c *this. /// EIGEN_DOC_UNARY_ADDONS(real,real part function) /// /// \sa imag() EIGEN_DEVICE_FUNC inline NonConstRealReturnType real() { return NonConstRealReturnType(derived()); } /// \returns a non const expression of the imaginary part of \c *this. /// EIGEN_DOC_UNARY_ADDONS(imag,imaginary part function) /// /// \sa real() EIGEN_DEVICE_FUNC inline NonConstImagReturnType imag() { return NonConstImagReturnType(derived()); } ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/plugins/IndexedViewMethods.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2017 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #if !defined(EIGEN_PARSED_BY_DOXYGEN) // This file is automatically included twice to generate const and non-const versions #ifndef EIGEN_INDEXED_VIEW_METHOD_2ND_PASS #define EIGEN_INDEXED_VIEW_METHOD_CONST const #define EIGEN_INDEXED_VIEW_METHOD_TYPE ConstIndexedViewType #else #define EIGEN_INDEXED_VIEW_METHOD_CONST #define EIGEN_INDEXED_VIEW_METHOD_TYPE IndexedViewType #endif #ifndef EIGEN_INDEXED_VIEW_METHOD_2ND_PASS protected: // define some aliases to ease readability template struct IvcRowType : public internal::IndexedViewCompatibleType {}; template struct IvcColType : public internal::IndexedViewCompatibleType {}; template struct IvcType : public internal::IndexedViewCompatibleType {}; typedef typename internal::IndexedViewCompatibleType::type IvcIndex; template typename IvcRowType::type ivcRow(const Indices& indices) const { return internal::makeIndexedViewCompatible(indices, internal::variable_if_dynamic(derived().rows()),Specialized); } template typename IvcColType::type ivcCol(const Indices& indices) const { return internal::makeIndexedViewCompatible(indices, internal::variable_if_dynamic(derived().cols()),Specialized); } template typename IvcColType::type ivcSize(const Indices& indices) const { return internal::makeIndexedViewCompatible(indices, internal::variable_if_dynamic(derived().size()),Specialized); } public: #endif template struct EIGEN_INDEXED_VIEW_METHOD_TYPE { typedef IndexedView::type, typename IvcColType::type> type; }; // This is the generic version template typename internal::enable_if::value && internal::traits::type>::ReturnAsIndexedView, typename EIGEN_INDEXED_VIEW_METHOD_TYPE::type >::type operator()(const RowIndices& rowIndices, const ColIndices& colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST { return typename EIGEN_INDEXED_VIEW_METHOD_TYPE::type (derived(), ivcRow(rowIndices), ivcCol(colIndices)); } // The following overload returns a Block<> object template typename internal::enable_if::value && internal::traits::type>::ReturnAsBlock, typename internal::traits::type>::BlockType>::type operator()(const RowIndices& rowIndices, const ColIndices& colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST { typedef typename internal::traits::type>::BlockType BlockType; typename IvcRowType::type actualRowIndices = ivcRow(rowIndices); typename IvcColType::type actualColIndices = ivcCol(colIndices); return BlockType(derived(), internal::first(actualRowIndices), internal::first(actualColIndices), internal::size(actualRowIndices), internal::size(actualColIndices)); } // The following overload returns a Scalar template typename internal::enable_if::value && internal::traits::type>::ReturnAsScalar, CoeffReturnType >::type operator()(const RowIndices& rowIndices, const ColIndices& colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST { return Base::operator()(internal::eval_expr_given_size(rowIndices,rows()),internal::eval_expr_given_size(colIndices,cols())); } #if EIGEN_HAS_STATIC_ARRAY_TEMPLATE // The following three overloads are needed to handle raw Index[N] arrays. template IndexedView::type> operator()(const RowIndicesT (&rowIndices)[RowIndicesN], const ColIndices& colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST { return IndexedView::type> (derived(), rowIndices, ivcCol(colIndices)); } template IndexedView::type, const ColIndicesT (&)[ColIndicesN]> operator()(const RowIndices& rowIndices, const ColIndicesT (&colIndices)[ColIndicesN]) EIGEN_INDEXED_VIEW_METHOD_CONST { return IndexedView::type,const ColIndicesT (&)[ColIndicesN]> (derived(), ivcRow(rowIndices), colIndices); } template IndexedView operator()(const RowIndicesT (&rowIndices)[RowIndicesN], const ColIndicesT (&colIndices)[ColIndicesN]) EIGEN_INDEXED_VIEW_METHOD_CONST { return IndexedView (derived(), rowIndices, colIndices); } #endif // EIGEN_HAS_STATIC_ARRAY_TEMPLATE // Overloads for 1D vectors/arrays template typename internal::enable_if< IsRowMajor && (!(internal::get_compile_time_incr::type>::value==1 || internal::is_valid_index_type::value)), IndexedView::type> >::type operator()(const Indices& indices) EIGEN_INDEXED_VIEW_METHOD_CONST { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) return IndexedView::type> (derived(), IvcIndex(0), ivcCol(indices)); } template typename internal::enable_if< (!IsRowMajor) && (!(internal::get_compile_time_incr::type>::value==1 || internal::is_valid_index_type::value)), IndexedView::type,IvcIndex> >::type operator()(const Indices& indices) EIGEN_INDEXED_VIEW_METHOD_CONST { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) return IndexedView::type,IvcIndex> (derived(), ivcRow(indices), IvcIndex(0)); } template typename internal::enable_if< (internal::get_compile_time_incr::type>::value==1) && (!internal::is_valid_index_type::value) && (!symbolic::is_symbolic::value), VectorBlock::value> >::type operator()(const Indices& indices) EIGEN_INDEXED_VIEW_METHOD_CONST { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) typename IvcType::type actualIndices = ivcSize(indices); return VectorBlock::value> (derived(), internal::first(actualIndices), internal::size(actualIndices)); } template typename internal::enable_if::value, CoeffReturnType >::type operator()(const IndexType& id) EIGEN_INDEXED_VIEW_METHOD_CONST { return Base::operator()(internal::eval_expr_given_size(id,size())); } #if EIGEN_HAS_STATIC_ARRAY_TEMPLATE template typename internal::enable_if >::type operator()(const IndicesT (&indices)[IndicesN]) EIGEN_INDEXED_VIEW_METHOD_CONST { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) return IndexedView (derived(), IvcIndex(0), indices); } template typename internal::enable_if >::type operator()(const IndicesT (&indices)[IndicesN]) EIGEN_INDEXED_VIEW_METHOD_CONST { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) return IndexedView (derived(), indices, IvcIndex(0)); } #endif // EIGEN_HAS_STATIC_ARRAY_TEMPLATE #undef EIGEN_INDEXED_VIEW_METHOD_CONST #undef EIGEN_INDEXED_VIEW_METHOD_TYPE #ifndef EIGEN_INDEXED_VIEW_METHOD_2ND_PASS #define EIGEN_INDEXED_VIEW_METHOD_2ND_PASS #include "IndexedViewMethods.h" #undef EIGEN_INDEXED_VIEW_METHOD_2ND_PASS #endif #else // EIGEN_PARSED_BY_DOXYGEN /** * \returns a generic submatrix view defined by the rows and columns indexed \a rowIndices and \a colIndices respectively. * * Each parameter must either be: * - An integer indexing a single row or column * - Eigen::all indexing the full set of respective rows or columns in increasing order * - An ArithmeticSequence as returned by the Eigen::seq and Eigen::seqN functions * - Any %Eigen's vector/array of integers or expressions * - Plain C arrays: \c int[N] * - And more generally any type exposing the following two member functions: * \code * operator[]() const; * size() const; * \endcode * where \c stands for any integer type compatible with Eigen::Index (i.e. \c std::ptrdiff_t). * * The last statement implies compatibility with \c std::vector, \c std::valarray, \c std::array, many of the Range-v3's ranges, etc. * * If the submatrix can be represented using a starting position \c (i,j) and positive sizes \c (rows,columns), then this * method will returns a Block object after extraction of the relevant information from the passed arguments. This is the case * when all arguments are either: * - An integer * - Eigen::all * - An ArithmeticSequence with compile-time increment strictly equal to 1, as returned by Eigen::seq(a,b), and Eigen::seqN(a,N). * * Otherwise a more general IndexedView object will be returned, after conversion of the inputs * to more suitable types \c RowIndices' and \c ColIndices'. * * For 1D vectors and arrays, you better use the operator()(const Indices&) overload, which behave the same way but taking a single parameter. * * See also this question and its answer for an example of how to duplicate coefficients. * * \sa operator()(const Indices&), class Block, class IndexedView, DenseBase::block(Index,Index,Index,Index) */ template IndexedView_or_Block operator()(const RowIndices& rowIndices, const ColIndices& colIndices); /** This is an overload of operator()(const RowIndices&, const ColIndices&) for 1D vectors or arrays * * \only_for_vectors */ template IndexedView_or_VectorBlock operator()(const Indices& indices); #endif // EIGEN_PARSED_BY_DOXYGEN ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h ================================================ // 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 // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. // This file is a base class plugin containing matrix specifics coefficient wise functions. /** \returns an expression of the Schur product (coefficient wise product) of *this and \a other * * Example: \include MatrixBase_cwiseProduct.cpp * Output: \verbinclude MatrixBase_cwiseProduct.out * * \sa class CwiseBinaryOp, cwiseAbs2 */ template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const EIGEN_CWISE_BINARY_RETURN_TYPE(Derived,OtherDerived,product) cwiseProduct(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const { return EIGEN_CWISE_BINARY_RETURN_TYPE(Derived,OtherDerived,product)(derived(), other.derived()); } /** \returns an expression of the coefficient-wise == operator of *this and \a other * * \warning this performs an exact comparison, which is generally a bad idea with floating-point types. * In order to check for equality between two vectors or matrices with floating-point coefficients, it is * generally a far better idea to use a fuzzy comparison as provided by isApprox() and * isMuchSmallerThan(). * * Example: \include MatrixBase_cwiseEqual.cpp * Output: \verbinclude MatrixBase_cwiseEqual.out * * \sa cwiseNotEqual(), isApprox(), isMuchSmallerThan() */ template EIGEN_DEVICE_FUNC inline const CwiseBinaryOp, const Derived, const OtherDerived> cwiseEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const { return CwiseBinaryOp, const Derived, const OtherDerived>(derived(), other.derived()); } /** \returns an expression of the coefficient-wise != operator of *this and \a other * * \warning this performs an exact comparison, which is generally a bad idea with floating-point types. * In order to check for equality between two vectors or matrices with floating-point coefficients, it is * generally a far better idea to use a fuzzy comparison as provided by isApprox() and * isMuchSmallerThan(). * * Example: \include MatrixBase_cwiseNotEqual.cpp * Output: \verbinclude MatrixBase_cwiseNotEqual.out * * \sa cwiseEqual(), isApprox(), isMuchSmallerThan() */ template EIGEN_DEVICE_FUNC inline const CwiseBinaryOp, const Derived, const OtherDerived> cwiseNotEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const { return CwiseBinaryOp, const Derived, const OtherDerived>(derived(), other.derived()); } /** \returns an expression of the coefficient-wise min of *this and \a other * * Example: \include MatrixBase_cwiseMin.cpp * Output: \verbinclude MatrixBase_cwiseMin.out * * \sa class CwiseBinaryOp, max() */ template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp, const Derived, const OtherDerived> cwiseMin(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const { return CwiseBinaryOp, const Derived, const OtherDerived>(derived(), other.derived()); } /** \returns an expression of the coefficient-wise min of *this and scalar \a other * * \sa class CwiseBinaryOp, min() */ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp, const Derived, const ConstantReturnType> cwiseMin(const Scalar &other) const { return cwiseMin(Derived::Constant(rows(), cols(), other)); } /** \returns an expression of the coefficient-wise max of *this and \a other * * Example: \include MatrixBase_cwiseMax.cpp * Output: \verbinclude MatrixBase_cwiseMax.out * * \sa class CwiseBinaryOp, min() */ template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp, const Derived, const OtherDerived> cwiseMax(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const { return CwiseBinaryOp, const Derived, const OtherDerived>(derived(), other.derived()); } /** \returns an expression of the coefficient-wise max of *this and scalar \a other * * \sa class CwiseBinaryOp, min() */ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp, const Derived, const ConstantReturnType> cwiseMax(const Scalar &other) const { return cwiseMax(Derived::Constant(rows(), cols(), other)); } /** \returns an expression of the coefficient-wise quotient of *this and \a other * * Example: \include MatrixBase_cwiseQuotient.cpp * Output: \verbinclude MatrixBase_cwiseQuotient.out * * \sa class CwiseBinaryOp, cwiseProduct(), cwiseInverse() */ template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp, const Derived, const OtherDerived> cwiseQuotient(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const { return CwiseBinaryOp, const Derived, const OtherDerived>(derived(), other.derived()); } typedef CwiseBinaryOp, const Derived, const ConstantReturnType> CwiseScalarEqualReturnType; /** \returns an expression of the coefficient-wise == operator of \c *this and a scalar \a s * * \warning this performs an exact comparison, which is generally a bad idea with floating-point types. * In order to check for equality between two vectors or matrices with floating-point coefficients, it is * generally a far better idea to use a fuzzy comparison as provided by isApprox() and * isMuchSmallerThan(). * * \sa cwiseEqual(const MatrixBase &) const */ EIGEN_DEVICE_FUNC inline const CwiseScalarEqualReturnType cwiseEqual(const Scalar& s) const { return CwiseScalarEqualReturnType(derived(), Derived::Constant(rows(), cols(), s), internal::scalar_cmp_op()); } ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h ================================================ // 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 // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. // This file is included into the body of the base classes supporting matrix specific coefficient-wise functions. // This include MatrixBase and SparseMatrixBase. typedef CwiseUnaryOp, const Derived> CwiseAbsReturnType; typedef CwiseUnaryOp, const Derived> CwiseAbs2ReturnType; typedef CwiseUnaryOp, const Derived> CwiseArgReturnType; typedef CwiseUnaryOp, const Derived> CwiseSqrtReturnType; typedef CwiseUnaryOp, const Derived> CwiseSignReturnType; typedef CwiseUnaryOp, const Derived> CwiseInverseReturnType; /// \returns an expression of the coefficient-wise absolute value of \c *this /// /// Example: \include MatrixBase_cwiseAbs.cpp /// Output: \verbinclude MatrixBase_cwiseAbs.out /// EIGEN_DOC_UNARY_ADDONS(cwiseAbs,absolute value) /// /// \sa cwiseAbs2() /// EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseAbsReturnType cwiseAbs() const { return CwiseAbsReturnType(derived()); } /// \returns an expression of the coefficient-wise squared absolute value of \c *this /// /// Example: \include MatrixBase_cwiseAbs2.cpp /// Output: \verbinclude MatrixBase_cwiseAbs2.out /// EIGEN_DOC_UNARY_ADDONS(cwiseAbs2,squared absolute value) /// /// \sa cwiseAbs() /// EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseAbs2ReturnType cwiseAbs2() const { return CwiseAbs2ReturnType(derived()); } /// \returns an expression of the coefficient-wise square root of *this. /// /// Example: \include MatrixBase_cwiseSqrt.cpp /// Output: \verbinclude MatrixBase_cwiseSqrt.out /// EIGEN_DOC_UNARY_ADDONS(cwiseSqrt,square-root) /// /// \sa cwisePow(), cwiseSquare() /// EIGEN_DEVICE_FUNC inline const CwiseSqrtReturnType cwiseSqrt() const { return CwiseSqrtReturnType(derived()); } /// \returns an expression of the coefficient-wise signum of *this. /// /// Example: \include MatrixBase_cwiseSign.cpp /// Output: \verbinclude MatrixBase_cwiseSign.out /// EIGEN_DOC_UNARY_ADDONS(cwiseSign,sign function) /// EIGEN_DEVICE_FUNC inline const CwiseSignReturnType cwiseSign() const { return CwiseSignReturnType(derived()); } /// \returns an expression of the coefficient-wise inverse of *this. /// /// Example: \include MatrixBase_cwiseInverse.cpp /// Output: \verbinclude MatrixBase_cwiseInverse.out /// EIGEN_DOC_UNARY_ADDONS(cwiseInverse,inverse) /// /// \sa cwiseProduct() /// EIGEN_DEVICE_FUNC inline const CwiseInverseReturnType cwiseInverse() const { return CwiseInverseReturnType(derived()); } /// \returns an expression of the coefficient-wise phase angle of \c *this /// /// Example: \include MatrixBase_cwiseArg.cpp /// Output: \verbinclude MatrixBase_cwiseArg.out /// EIGEN_DOC_UNARY_ADDONS(cwiseArg,arg) EIGEN_DEVICE_FUNC inline const CwiseArgReturnType cwiseArg() const { return CwiseArgReturnType(derived()); } ================================================ FILE: VO_Module/thirdparty/eigen/Eigen/src/plugins/ReshapedMethods.h ================================================ #ifdef EIGEN_PARSED_BY_DOXYGEN /// \returns an expression of \c *this with reshaped sizes. /// /// \param nRows the number of rows in the reshaped expression, specified at either run-time or compile-time, or AutoSize /// \param nCols the number of columns in the reshaped expression, specified at either run-time or compile-time, or AutoSize /// \tparam Order specifies whether the coefficients should be processed in column-major-order (ColMajor), in row-major-order (RowMajor), /// or follows the \em natural order of the nested expression (AutoOrder). The default is ColMajor. /// \tparam NRowsType the type of the value handling the number of rows, typically Index. /// \tparam NColsType the type of the value handling the number of columns, typically Index. /// /// Dynamic size example: \include MatrixBase_reshaped_int_int.cpp /// Output: \verbinclude MatrixBase_reshaped_int_int.out /// /// The number of rows \a nRows and columns \a nCols can also be specified at compile-time by passing Eigen::fix, /// or Eigen::fix(n) as arguments. In the later case, \c n plays the role of a runtime fallback value in case \c N equals Eigen::Dynamic. /// Here is an example with a fixed number of rows and columns: /// \include MatrixBase_reshaped_fixed.cpp /// Output: \verbinclude MatrixBase_reshaped_fixed.out /// /// Finally, one of the sizes parameter can be automatically deduced from the other one by passing AutoSize as in the following example: /// \include MatrixBase_reshaped_auto.cpp /// Output: \verbinclude MatrixBase_reshaped_auto.out /// AutoSize does preserve compile-time sizes when possible, i.e., when the sizes of the input are known at compile time \b and /// that the other size is passed at compile-time using Eigen::fix as above. /// /// \sa class Reshaped, fix, fix(int) /// template EIGEN_DEVICE_FUNC inline Reshaped reshaped(NRowsType nRows, NColsType nCols); /// This is the const version of reshaped(NRowsType,NColsType). template EIGEN_DEVICE_FUNC inline const Reshaped reshaped(NRowsType nRows, NColsType nCols) const; /// \returns an expression of \c *this with columns (or rows) stacked to a linear column vector /// /// \tparam Order specifies whether the coefficients should be processed in column-major-order (ColMajor), in row-major-order (RowMajor), /// or follows the \em natural order of the nested expression (AutoOrder). The default is ColMajor. /// /// This overloads is essentially a shortcut for `A.reshaped(AutoSize,fix<1>)`. /// /// - If `Order==ColMajor` (the default), then it returns a column-vector from the stacked columns of \c *this. /// - If `Order==RowMajor`, then it returns a column-vector from the stacked rows of \c *this. /// - If `Order==AutoOrder`, then it returns a column-vector with elements stacked following the storage order of \c *this. /// This mode is the recommended one when the particular ordering of the element is not relevant. /// /// Example: /// \include MatrixBase_reshaped_to_vector.cpp /// Output: \verbinclude MatrixBase_reshaped_to_vector.out /// /// If you want more control, you can still fall back to reshaped(NRowsType,NColsType). /// /// \sa reshaped(NRowsType,NColsType), class Reshaped /// template EIGEN_DEVICE_FUNC inline Reshaped reshaped(); /// This is the const version of reshaped(). template EIGEN_DEVICE_FUNC inline const Reshaped reshaped() const; #else // This file is automatically included twice to generate const and non-const versions #ifndef EIGEN_RESHAPED_METHOD_2ND_PASS #define EIGEN_RESHAPED_METHOD_CONST const #else #define EIGEN_RESHAPED_METHOD_CONST #endif #ifndef EIGEN_RESHAPED_METHOD_2ND_PASS // This part is included once #endif template EIGEN_DEVICE_FUNC inline Reshaped::value, internal::get_compiletime_reshape_size::value> reshaped(NRowsType nRows, NColsType nCols) EIGEN_RESHAPED_METHOD_CONST { return Reshaped::value, internal::get_compiletime_reshape_size::value> (derived(), internal::get_runtime_reshape_size(nRows,internal::get_runtime_value(nCols),size()), internal::get_runtime_reshape_size(nCols,internal::get_runtime_value(nRows),size())); } template EIGEN_DEVICE_FUNC inline Reshaped::value, internal::get_compiletime_reshape_size::value, internal::get_compiletime_reshape_order::value> reshaped(NRowsType nRows, NColsType nCols) EIGEN_RESHAPED_METHOD_CONST { return Reshaped::value, internal::get_compiletime_reshape_size::value, internal::get_compiletime_reshape_order::value> (derived(), internal::get_runtime_reshape_size(nRows,internal::get_runtime_value(nCols),size()), internal::get_runtime_reshape_size(nCols,internal::get_runtime_value(nRows),size())); } // Views as linear vectors EIGEN_DEVICE_FUNC inline Reshaped reshaped() EIGEN_RESHAPED_METHOD_CONST { return Reshaped(derived(),size(),1); } template EIGEN_DEVICE_FUNC inline Reshaped::value> reshaped() EIGEN_RESHAPED_METHOD_CONST { EIGEN_STATIC_ASSERT(Order==RowMajor || Order==ColMajor || Order==AutoOrder, INVALID_TEMPLATE_PARAMETER); return Reshaped::value> (derived(), size(), 1); } #undef EIGEN_RESHAPED_METHOD_CONST #ifndef EIGEN_RESHAPED_METHOD_2ND_PASS #define EIGEN_RESHAPED_METHOD_2ND_PASS #include "ReshapedMethods.h" #undef EIGEN_RESHAPED_METHOD_2ND_PASS #endif #endif // EIGEN_PARSED_BY_DOXYGEN ================================================ FILE: VO_Module/thirdparty/eigen/INSTALL ================================================ Installation instructions for Eigen *********************************** Explanation before starting *************************** Eigen consists only of header files, hence there is nothing to compile before you can use it. Moreover, these header files do not depend on your platform, they are the same for everybody. Method 1. Installing without using CMake **************************************** You can use right away the headers in the Eigen/ subdirectory. In order to install, just copy this Eigen/ subdirectory to your favorite location. If you also want the unsupported features, copy the unsupported/ subdirectory too. Method 2. Installing using CMake ******************************** Let's call this directory 'source_dir' (where this INSTALL file is). Before starting, create another directory which we will call 'build_dir'. Do: cd build_dir cmake source_dir make install The "make install" step may require administrator privileges. You can adjust the installation destination (the "prefix") by passing the -DCMAKE_INSTALL_PREFIX=myprefix option to cmake, as is explained in the message that cmake prints at the end. ================================================ FILE: VO_Module/thirdparty/eigen/README.md ================================================ **Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms.** For more information go to http://eigen.tuxfamily.org/. For ***pull request***, ***bug reports***, and ***feature requests***, go to https://gitlab.com/libeigen/eigen. ================================================ FILE: VO_Module/thirdparty/eigen/bench/BenchSparseUtil.h ================================================ #include #include #include using namespace std; using namespace Eigen; using namespace Eigen; #ifndef SIZE #define SIZE 1024 #endif #ifndef DENSITY #define DENSITY 0.01 #endif #ifndef SCALAR #define SCALAR double #endif typedef SCALAR Scalar; typedef Matrix DenseMatrix; typedef Matrix DenseVector; typedef SparseMatrix EigenSparseMatrix; void fillMatrix(float density, int rows, int cols, EigenSparseMatrix& dst) { dst.reserve(double(rows)*cols*density); for(int j = 0; j < cols; j++) { for(int i = 0; i < rows; i++) { Scalar v = (internal::random(0,1) < density) ? internal::random() : 0; if (v!=0) dst.insert(i,j) = v; } } dst.finalize(); } void fillMatrix2(int nnzPerCol, int rows, int cols, EigenSparseMatrix& dst) { // std::cout << "alloc " << nnzPerCol*cols << "\n"; dst.reserve(nnzPerCol*cols); for(int j = 0; j < cols; j++) { std::set aux; for(int i = 0; i < nnzPerCol; i++) { int k = internal::random(0,rows-1); while (aux.find(k)!=aux.end()) k = internal::random(0,rows-1); aux.insert(k); dst.insert(k,j) = internal::random(); } } dst.finalize(); } void eiToDense(const EigenSparseMatrix& src, DenseMatrix& dst) { dst.setZero(); for (int j=0; j GmmSparse; typedef gmm::col_matrix< gmm::wsvector > GmmDynSparse; void eiToGmm(const EigenSparseMatrix& src, GmmSparse& dst) { GmmDynSparse tmp(src.rows(), src.cols()); for (int j=0; j typedef mtl::compressed2D > MtlSparse; typedef mtl::compressed2D > MtlSparseRowMajor; void eiToMtl(const EigenSparseMatrix& src, MtlSparse& dst) { mtl::matrix::inserter ins(dst); for (int j=0; j #include #include #include #include #include #include #include typedef boost::numeric::ublas::compressed_matrix UBlasSparse; void eiToUblas(const EigenSparseMatrix& src, UBlasSparse& dst) { dst.resize(src.rows(), src.cols(), false); for (int j=0; j void eiToUblasVec(const EigenType& src, UblasType& dst) { dst.resize(src.size()); for (int j=0; j } #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/BenchTimer.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2010 Gael Guennebaud // Copyright (C) 2009 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_BENCH_TIMERR_H #define EIGEN_BENCH_TIMERR_H #if defined(_WIN32) || defined(__CYGWIN__) # ifndef NOMINMAX # define NOMINMAX # define EIGEN_BT_UNDEF_NOMINMAX # endif # ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN # define EIGEN_BT_UNDEF_WIN32_LEAN_AND_MEAN # endif # include #elif defined(__APPLE__) #include #else # include #endif static void escape(void *p) { #if EIGEN_COMP_GNUC || EIGEN_COMP_CLANG asm volatile("" : : "g"(p) : "memory"); #endif } static void clobber() { #if EIGEN_COMP_GNUC || EIGEN_COMP_CLANG asm volatile("" : : : "memory"); #endif } #include namespace Eigen { enum { CPU_TIMER = 0, REAL_TIMER = 1 }; /** Elapsed time timer keeping the best try. * * On POSIX platforms we use clock_gettime with CLOCK_PROCESS_CPUTIME_ID. * On Windows we use QueryPerformanceCounter * * Important: on linux, you must link with -lrt */ class BenchTimer { public: BenchTimer() { #if defined(_WIN32) || defined(__CYGWIN__) LARGE_INTEGER freq; QueryPerformanceFrequency(&freq); m_frequency = (double)freq.QuadPart; #endif reset(); } ~BenchTimer() {} inline void reset() { m_bests.fill(1e9); m_worsts.fill(0); m_totals.setZero(); } inline void start() { m_starts[CPU_TIMER] = getCpuTime(); m_starts[REAL_TIMER] = getRealTime(); } inline void stop() { m_times[CPU_TIMER] = getCpuTime() - m_starts[CPU_TIMER]; m_times[REAL_TIMER] = getRealTime() - m_starts[REAL_TIMER]; #if EIGEN_VERSION_AT_LEAST(2,90,0) m_bests = m_bests.cwiseMin(m_times); m_worsts = m_worsts.cwiseMax(m_times); #else m_bests(0) = std::min(m_bests(0),m_times(0)); m_bests(1) = std::min(m_bests(1),m_times(1)); m_worsts(0) = std::max(m_worsts(0),m_times(0)); m_worsts(1) = std::max(m_worsts(1),m_times(1)); #endif m_totals += m_times; } /** Return the elapsed time in seconds between the last start/stop pair */ inline double value(int TIMER = CPU_TIMER) const { return m_times[TIMER]; } /** Return the best elapsed time in seconds */ inline double best(int TIMER = CPU_TIMER) const { return m_bests[TIMER]; } /** Return the worst elapsed time in seconds */ inline double worst(int TIMER = CPU_TIMER) const { return m_worsts[TIMER]; } /** Return the total elapsed time in seconds. */ inline double total(int TIMER = CPU_TIMER) const { return m_totals[TIMER]; } inline double getCpuTime() const { #ifdef _WIN32 LARGE_INTEGER query_ticks; QueryPerformanceCounter(&query_ticks); return query_ticks.QuadPart/m_frequency; #elif __APPLE__ return double(mach_absolute_time())*1e-9; #else timespec ts; clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts); return double(ts.tv_sec) + 1e-9 * double(ts.tv_nsec); #endif } inline double getRealTime() const { #ifdef _WIN32 SYSTEMTIME st; GetSystemTime(&st); return (double)st.wSecond + 1.e-3 * (double)st.wMilliseconds; #elif __APPLE__ return double(mach_absolute_time())*1e-9; #else timespec ts; clock_gettime(CLOCK_REALTIME, &ts); return double(ts.tv_sec) + 1e-9 * double(ts.tv_nsec); #endif } protected: #if defined(_WIN32) || defined(__CYGWIN__) double m_frequency; #endif Vector2d m_starts; Vector2d m_times; Vector2d m_bests; Vector2d m_worsts; Vector2d m_totals; public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW }; #define BENCH(TIMER,TRIES,REP,CODE) { \ TIMER.reset(); \ for(int uglyvarname1=0; uglyvarname1 #include "BenchTimer.h" using namespace std; using namespace Eigen; #include #include #include #include #include #include #include #include #include template void initMatrix_random(MatrixType& mat) __attribute__((noinline)); template void initMatrix_random(MatrixType& mat) { mat.setRandom();// = MatrixType::random(mat.rows(), mat.cols()); } template void initMatrix_identity(MatrixType& mat) __attribute__((noinline)); template void initMatrix_identity(MatrixType& mat) { mat.setIdentity(); } #ifndef __INTEL_COMPILER #define DISABLE_SSE_EXCEPTIONS() { \ int aux; \ asm( \ "stmxcsr %[aux] \n\t" \ "orl $32832, %[aux] \n\t" \ "ldmxcsr %[aux] \n\t" \ : : [aux] "m" (aux)); \ } #else #define DISABLE_SSE_EXCEPTIONS() #endif #ifdef BENCH_GMM #include template void eiToGmm(const EigenMatrixType& src, GmmMatrixType& dst) { dst.resize(src.rows(),src.cols()); for (int j=0; j #include #include template void eiToGsl(const EigenMatrixType& src, gsl_matrix** dst) { for (int j=0; j #include template void eiToUblas(const EigenMatrixType& src, UblasMatrixType& dst) { dst.resize(src.rows(),src.cols()); for (int j=0; j void eiToUblasVec(const EigenType& src, UblasType& dst) { dst.resize(src.size()); for (int j=0; j x0.869674 (2) double, 128x128: 0.054148s 0.0419669s => x1.29025 (2) double, 512x512: 0.913799s 0.428533s => x2.13239 (2) double, 1024x1024: 14.5972s 9.3542s => x1.5605 (2) icpc -fast -DNDEBUG -fno-exceptions -no-inline-max-size -openmp double, fixed-size 4x4: 0.000589848s 0.019949s double, 32x32: 0.0682781s 0.0449722s => x1.51823 (2) double, 128x128: 0.0547509s 0.0435519s => x1.25714 (2) double, 512x512: 0.829436s 0.424438s => x1.9542 (2) double, 1024x1024: 14.5243s 10.7735s => x1.34815 (2) ================================================ FILE: VO_Module/thirdparty/eigen/bench/analyze-blocking-sizes.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2015 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; const int default_precision = 4; // see --only-cubic-sizes bool only_cubic_sizes = false; // see --dump-tables bool dump_tables = false; uint8_t log2_pot(size_t x) { size_t l = 0; while (x >>= 1) l++; return l; } uint16_t compact_size_triple(size_t k, size_t m, size_t n) { return (log2_pot(k) << 8) | (log2_pot(m) << 4) | log2_pot(n); } // just a helper to store a triple of K,M,N sizes for matrix product struct size_triple_t { uint16_t k, m, n; size_triple_t() : k(0), m(0), n(0) {} size_triple_t(size_t _k, size_t _m, size_t _n) : k(_k), m(_m), n(_n) {} size_triple_t(const size_triple_t& o) : k(o.k), m(o.m), n(o.n) {} size_triple_t(uint16_t compact) { k = 1 << ((compact & 0xf00) >> 8); m = 1 << ((compact & 0x0f0) >> 4); n = 1 << ((compact & 0x00f) >> 0); } bool is_cubic() const { return k == m && m == n; } }; ostream& operator<<(ostream& s, const size_triple_t& t) { return s << "(" << t.k << ", " << t.m << ", " << t.n << ")"; } struct inputfile_entry_t { uint16_t product_size; uint16_t pot_block_size; size_triple_t nonpot_block_size; float gflops; }; struct inputfile_t { enum class type_t { unknown, all_pot_sizes, default_sizes }; string filename; vector entries; type_t type; inputfile_t(const string& fname) : filename(fname) , type(type_t::unknown) { ifstream stream(filename); if (!stream.is_open()) { cerr << "couldn't open input file: " << filename << endl; exit(1); } string line; while (getline(stream, line)) { if (line.empty()) continue; if (line.find("BEGIN MEASUREMENTS ALL POT SIZES") == 0) { if (type != type_t::unknown) { cerr << "Input file " << filename << " contains redundant BEGIN MEASUREMENTS lines"; exit(1); } type = type_t::all_pot_sizes; continue; } if (line.find("BEGIN MEASUREMENTS DEFAULT SIZES") == 0) { if (type != type_t::unknown) { cerr << "Input file " << filename << " contains redundant BEGIN MEASUREMENTS lines"; exit(1); } type = type_t::default_sizes; continue; } if (type == type_t::unknown) { continue; } switch(type) { case type_t::all_pot_sizes: { unsigned int product_size, block_size; float gflops; int sscanf_result = sscanf(line.c_str(), "%x %x %f", &product_size, &block_size, &gflops); if (3 != sscanf_result || !product_size || product_size > 0xfff || !block_size || block_size > 0xfff || !isfinite(gflops)) { cerr << "ill-formed input file: " << filename << endl; cerr << "offending line:" << endl << line << endl; exit(1); } if (only_cubic_sizes && !size_triple_t(product_size).is_cubic()) { continue; } inputfile_entry_t entry; entry.product_size = uint16_t(product_size); entry.pot_block_size = uint16_t(block_size); entry.gflops = gflops; entries.push_back(entry); break; } case type_t::default_sizes: { unsigned int product_size; float gflops; int bk, bm, bn; int sscanf_result = sscanf(line.c_str(), "%x default(%d, %d, %d) %f", &product_size, &bk, &bm, &bn, &gflops); if (5 != sscanf_result || !product_size || product_size > 0xfff || !isfinite(gflops)) { cerr << "ill-formed input file: " << filename << endl; cerr << "offending line:" << endl << line << endl; exit(1); } if (only_cubic_sizes && !size_triple_t(product_size).is_cubic()) { continue; } inputfile_entry_t entry; entry.product_size = uint16_t(product_size); entry.pot_block_size = 0; entry.nonpot_block_size = size_triple_t(bk, bm, bn); entry.gflops = gflops; entries.push_back(entry); break; } default: break; } } stream.close(); if (type == type_t::unknown) { cerr << "Unrecognized input file " << filename << endl; exit(1); } if (entries.empty()) { cerr << "didn't find any measurements in input file: " << filename << endl; exit(1); } } }; struct preprocessed_inputfile_entry_t { uint16_t product_size; uint16_t block_size; float efficiency; }; bool lower_efficiency(const preprocessed_inputfile_entry_t& e1, const preprocessed_inputfile_entry_t& e2) { return e1.efficiency < e2.efficiency; } struct preprocessed_inputfile_t { string filename; vector entries; preprocessed_inputfile_t(const inputfile_t& inputfile) : filename(inputfile.filename) { if (inputfile.type != inputfile_t::type_t::all_pot_sizes) { abort(); } auto it = inputfile.entries.begin(); auto it_first_with_given_product_size = it; while (it != inputfile.entries.end()) { ++it; if (it == inputfile.entries.end() || it->product_size != it_first_with_given_product_size->product_size) { import_input_file_range_one_product_size(it_first_with_given_product_size, it); it_first_with_given_product_size = it; } } } private: void import_input_file_range_one_product_size( const vector::const_iterator& begin, const vector::const_iterator& end) { uint16_t product_size = begin->product_size; float max_gflops = 0.0f; for (auto it = begin; it != end; ++it) { if (it->product_size != product_size) { cerr << "Unexpected ordering of entries in " << filename << endl; cerr << "(Expected all entries for product size " << hex << product_size << dec << " to be grouped)" << endl; exit(1); } max_gflops = max(max_gflops, it->gflops); } for (auto it = begin; it != end; ++it) { preprocessed_inputfile_entry_t entry; entry.product_size = it->product_size; entry.block_size = it->pot_block_size; entry.efficiency = it->gflops / max_gflops; entries.push_back(entry); } } }; void check_all_files_in_same_exact_order( const vector& preprocessed_inputfiles) { if (preprocessed_inputfiles.empty()) { return; } const preprocessed_inputfile_t& first_file = preprocessed_inputfiles[0]; const size_t num_entries = first_file.entries.size(); for (size_t i = 0; i < preprocessed_inputfiles.size(); i++) { if (preprocessed_inputfiles[i].entries.size() != num_entries) { cerr << "these files have different number of entries: " << preprocessed_inputfiles[i].filename << " and " << first_file.filename << endl; exit(1); } } for (size_t entry_index = 0; entry_index < num_entries; entry_index++) { const uint16_t entry_product_size = first_file.entries[entry_index].product_size; const uint16_t entry_block_size = first_file.entries[entry_index].block_size; for (size_t file_index = 0; file_index < preprocessed_inputfiles.size(); file_index++) { const preprocessed_inputfile_t& cur_file = preprocessed_inputfiles[file_index]; if (cur_file.entries[entry_index].product_size != entry_product_size || cur_file.entries[entry_index].block_size != entry_block_size) { cerr << "entries not in same order between these files: " << first_file.filename << " and " << cur_file.filename << endl; exit(1); } } } } float efficiency_of_subset( const vector& preprocessed_inputfiles, const vector& subset) { if (subset.size() <= 1) { return 1.0f; } const preprocessed_inputfile_t& first_file = preprocessed_inputfiles[subset[0]]; const size_t num_entries = first_file.entries.size(); float efficiency = 1.0f; size_t entry_index = 0; size_t first_entry_index_with_this_product_size = 0; uint16_t product_size = first_file.entries[0].product_size; while (entry_index < num_entries) { ++entry_index; if (entry_index == num_entries || first_file.entries[entry_index].product_size != product_size) { float efficiency_this_product_size = 0.0f; for (size_t e = first_entry_index_with_this_product_size; e < entry_index; e++) { float efficiency_this_entry = 1.0f; for (auto i = subset.begin(); i != subset.end(); ++i) { efficiency_this_entry = min(efficiency_this_entry, preprocessed_inputfiles[*i].entries[e].efficiency); } efficiency_this_product_size = max(efficiency_this_product_size, efficiency_this_entry); } efficiency = min(efficiency, efficiency_this_product_size); if (entry_index < num_entries) { first_entry_index_with_this_product_size = entry_index; product_size = first_file.entries[entry_index].product_size; } } } return efficiency; } void dump_table_for_subset( const vector& preprocessed_inputfiles, const vector& subset) { const preprocessed_inputfile_t& first_file = preprocessed_inputfiles[subset[0]]; const size_t num_entries = first_file.entries.size(); size_t entry_index = 0; size_t first_entry_index_with_this_product_size = 0; uint16_t product_size = first_file.entries[0].product_size; size_t i = 0; size_triple_t min_product_size(first_file.entries.front().product_size); size_triple_t max_product_size(first_file.entries.back().product_size); if (!min_product_size.is_cubic() || !max_product_size.is_cubic()) { abort(); } if (only_cubic_sizes) { cerr << "Can't generate tables with --only-cubic-sizes." << endl; abort(); } cout << "struct LookupTable {" << endl; cout << " static const size_t BaseSize = " << min_product_size.k << ";" << endl; const size_t NumSizes = log2_pot(max_product_size.k / min_product_size.k) + 1; const size_t TableSize = NumSizes * NumSizes * NumSizes; cout << " static const size_t NumSizes = " << NumSizes << ";" << endl; cout << " static const unsigned short* Data() {" << endl; cout << " static const unsigned short data[" << TableSize << "] = {"; while (entry_index < num_entries) { ++entry_index; if (entry_index == num_entries || first_file.entries[entry_index].product_size != product_size) { float best_efficiency_this_product_size = 0.0f; uint16_t best_block_size_this_product_size = 0; for (size_t e = first_entry_index_with_this_product_size; e < entry_index; e++) { float efficiency_this_entry = 1.0f; for (auto i = subset.begin(); i != subset.end(); ++i) { efficiency_this_entry = min(efficiency_this_entry, preprocessed_inputfiles[*i].entries[e].efficiency); } if (efficiency_this_entry > best_efficiency_this_product_size) { best_efficiency_this_product_size = efficiency_this_entry; best_block_size_this_product_size = first_file.entries[e].block_size; } } if ((i++) % NumSizes) { cout << " "; } else { cout << endl << " "; } cout << "0x" << hex << best_block_size_this_product_size << dec; if (entry_index < num_entries) { cout << ","; first_entry_index_with_this_product_size = entry_index; product_size = first_file.entries[entry_index].product_size; } } } if (i != TableSize) { cerr << endl << "Wrote " << i << " table entries, expected " << TableSize << endl; abort(); } cout << endl << " };" << endl; cout << " return data;" << endl; cout << " }" << endl; cout << "};" << endl; } float efficiency_of_partition( const vector& preprocessed_inputfiles, const vector>& partition) { float efficiency = 1.0f; for (auto s = partition.begin(); s != partition.end(); ++s) { efficiency = min(efficiency, efficiency_of_subset(preprocessed_inputfiles, *s)); } return efficiency; } void make_first_subset(size_t subset_size, vector& out_subset, size_t set_size) { assert(subset_size >= 1 && subset_size <= set_size); out_subset.resize(subset_size); for (size_t i = 0; i < subset_size; i++) { out_subset[i] = i; } } bool is_last_subset(const vector& subset, size_t set_size) { return subset[0] == set_size - subset.size(); } void next_subset(vector& inout_subset, size_t set_size) { if (is_last_subset(inout_subset, set_size)) { cerr << "iterating past the last subset" << endl; abort(); } size_t i = 1; while (inout_subset[inout_subset.size() - i] == set_size - i) { i++; assert(i <= inout_subset.size()); } size_t first_index_to_change = inout_subset.size() - i; inout_subset[first_index_to_change]++; size_t p = inout_subset[first_index_to_change]; for (size_t j = first_index_to_change + 1; j < inout_subset.size(); j++) { inout_subset[j] = ++p; } } const size_t number_of_subsets_limit = 100; const size_t always_search_subsets_of_size_at_least = 2; bool is_number_of_subsets_feasible(size_t n, size_t p) { assert(n>0 && p>0 && p<=n); uint64_t numerator = 1, denominator = 1; for (size_t i = 0; i < p; i++) { numerator *= n - i; denominator *= i + 1; if (numerator > denominator * number_of_subsets_limit) { return false; } } return true; } size_t max_feasible_subset_size(size_t n) { assert(n > 0); const size_t minresult = min(n-1, always_search_subsets_of_size_at_least); for (size_t p = 1; p <= n - 1; p++) { if (!is_number_of_subsets_feasible(n, p+1)) { return max(p, minresult); } } return n - 1; } void find_subset_with_efficiency_higher_than( const vector& preprocessed_inputfiles, float required_efficiency_to_beat, vector& inout_remainder, vector& out_subset) { out_subset.resize(0); if (required_efficiency_to_beat >= 1.0f) { cerr << "can't beat efficiency 1." << endl; abort(); } while (!inout_remainder.empty()) { vector candidate_indices(inout_remainder.size()); for (size_t i = 0; i < candidate_indices.size(); i++) { candidate_indices[i] = i; } size_t candidate_indices_subset_size = max_feasible_subset_size(candidate_indices.size()); while (candidate_indices_subset_size >= 1) { vector candidate_indices_subset; make_first_subset(candidate_indices_subset_size, candidate_indices_subset, candidate_indices.size()); vector best_candidate_indices_subset; float best_efficiency = 0.0f; vector trial_subset = out_subset; trial_subset.resize(out_subset.size() + candidate_indices_subset_size); while (true) { for (size_t i = 0; i < candidate_indices_subset_size; i++) { trial_subset[out_subset.size() + i] = inout_remainder[candidate_indices_subset[i]]; } float trial_efficiency = efficiency_of_subset(preprocessed_inputfiles, trial_subset); if (trial_efficiency > best_efficiency) { best_efficiency = trial_efficiency; best_candidate_indices_subset = candidate_indices_subset; } if (is_last_subset(candidate_indices_subset, candidate_indices.size())) { break; } next_subset(candidate_indices_subset, candidate_indices.size()); } if (best_efficiency > required_efficiency_to_beat) { for (size_t i = 0; i < best_candidate_indices_subset.size(); i++) { candidate_indices[i] = candidate_indices[best_candidate_indices_subset[i]]; } candidate_indices.resize(best_candidate_indices_subset.size()); } candidate_indices_subset_size--; } size_t candidate_index = candidate_indices[0]; auto candidate_iterator = inout_remainder.begin() + candidate_index; vector trial_subset = out_subset; trial_subset.push_back(*candidate_iterator); float trial_efficiency = efficiency_of_subset(preprocessed_inputfiles, trial_subset); if (trial_efficiency > required_efficiency_to_beat) { out_subset.push_back(*candidate_iterator); inout_remainder.erase(candidate_iterator); } else { break; } } } void find_partition_with_efficiency_higher_than( const vector& preprocessed_inputfiles, float required_efficiency_to_beat, vector>& out_partition) { out_partition.resize(0); vector remainder; for (size_t i = 0; i < preprocessed_inputfiles.size(); i++) { remainder.push_back(i); } while (!remainder.empty()) { vector new_subset; find_subset_with_efficiency_higher_than( preprocessed_inputfiles, required_efficiency_to_beat, remainder, new_subset); out_partition.push_back(new_subset); } } void print_partition( const vector& preprocessed_inputfiles, const vector>& partition) { float efficiency = efficiency_of_partition(preprocessed_inputfiles, partition); cout << "Partition into " << partition.size() << " subsets for " << efficiency * 100.0f << "% efficiency" << endl; for (auto subset = partition.begin(); subset != partition.end(); ++subset) { cout << " Subset " << (subset - partition.begin()) << ", efficiency " << efficiency_of_subset(preprocessed_inputfiles, *subset) * 100.0f << "%:" << endl; for (auto file = subset->begin(); file != subset->end(); ++file) { cout << " " << preprocessed_inputfiles[*file].filename << endl; } if (dump_tables) { cout << " Table:" << endl; dump_table_for_subset(preprocessed_inputfiles, *subset); } } cout << endl; } struct action_t { virtual const char* invokation_name() const { abort(); return nullptr; } virtual void run(const vector&) const { abort(); } virtual ~action_t() {} }; struct partition_action_t : action_t { virtual const char* invokation_name() const override { return "partition"; } virtual void run(const vector& input_filenames) const override { vector preprocessed_inputfiles; if (input_filenames.empty()) { cerr << "The " << invokation_name() << " action needs a list of input files." << endl; exit(1); } for (auto it = input_filenames.begin(); it != input_filenames.end(); ++it) { inputfile_t inputfile(*it); switch (inputfile.type) { case inputfile_t::type_t::all_pot_sizes: preprocessed_inputfiles.emplace_back(inputfile); break; case inputfile_t::type_t::default_sizes: cerr << "The " << invokation_name() << " action only uses measurements for all pot sizes, and " << "has no use for " << *it << " which contains measurements for default sizes." << endl; exit(1); break; default: cerr << "Unrecognized input file: " << *it << endl; exit(1); } } check_all_files_in_same_exact_order(preprocessed_inputfiles); float required_efficiency_to_beat = 0.0f; vector>> partitions; cerr << "searching for partitions...\r" << flush; while (true) { vector> partition; find_partition_with_efficiency_higher_than( preprocessed_inputfiles, required_efficiency_to_beat, partition); float actual_efficiency = efficiency_of_partition(preprocessed_inputfiles, partition); cerr << "partition " << preprocessed_inputfiles.size() << " files into " << partition.size() << " subsets for " << 100.0f * actual_efficiency << " % efficiency" << " \r" << flush; partitions.push_back(partition); if (partition.size() == preprocessed_inputfiles.size() || actual_efficiency == 1.0f) { break; } required_efficiency_to_beat = actual_efficiency; } cerr << " " << endl; while (true) { bool repeat = false; for (size_t i = 0; i < partitions.size() - 1; i++) { if (partitions[i].size() >= partitions[i+1].size()) { partitions.erase(partitions.begin() + i); repeat = true; break; } } if (!repeat) { break; } } for (auto it = partitions.begin(); it != partitions.end(); ++it) { print_partition(preprocessed_inputfiles, *it); } } }; struct evaluate_defaults_action_t : action_t { struct results_entry_t { uint16_t product_size; size_triple_t default_block_size; uint16_t best_pot_block_size; float default_gflops; float best_pot_gflops; float default_efficiency; }; friend ostream& operator<<(ostream& s, const results_entry_t& entry) { return s << "Product size " << size_triple_t(entry.product_size) << ": default block size " << entry.default_block_size << " -> " << entry.default_gflops << " GFlop/s = " << entry.default_efficiency * 100.0f << " %" << " of best POT block size " << size_triple_t(entry.best_pot_block_size) << " -> " << entry.best_pot_gflops << " GFlop/s" << dec; } static bool lower_efficiency(const results_entry_t& e1, const results_entry_t& e2) { return e1.default_efficiency < e2.default_efficiency; } virtual const char* invokation_name() const override { return "evaluate-defaults"; } void show_usage_and_exit() const { cerr << "usage: " << invokation_name() << " default-sizes-data all-pot-sizes-data" << endl; cerr << "checks how well the performance with default sizes compares to the best " << "performance measured over all POT sizes." << endl; exit(1); } virtual void run(const vector& input_filenames) const override { if (input_filenames.size() != 2) { show_usage_and_exit(); } inputfile_t inputfile_default_sizes(input_filenames[0]); inputfile_t inputfile_all_pot_sizes(input_filenames[1]); if (inputfile_default_sizes.type != inputfile_t::type_t::default_sizes) { cerr << inputfile_default_sizes.filename << " is not an input file with default sizes." << endl; show_usage_and_exit(); } if (inputfile_all_pot_sizes.type != inputfile_t::type_t::all_pot_sizes) { cerr << inputfile_all_pot_sizes.filename << " is not an input file with all POT sizes." << endl; show_usage_and_exit(); } vector results; vector cubic_results; uint16_t product_size = 0; auto it_all_pot_sizes = inputfile_all_pot_sizes.entries.begin(); for (auto it_default_sizes = inputfile_default_sizes.entries.begin(); it_default_sizes != inputfile_default_sizes.entries.end(); ++it_default_sizes) { if (it_default_sizes->product_size == product_size) { continue; } product_size = it_default_sizes->product_size; while (it_all_pot_sizes != inputfile_all_pot_sizes.entries.end() && it_all_pot_sizes->product_size != product_size) { ++it_all_pot_sizes; } if (it_all_pot_sizes == inputfile_all_pot_sizes.entries.end()) { break; } uint16_t best_pot_block_size = 0; float best_pot_gflops = 0; for (auto it = it_all_pot_sizes; it != inputfile_all_pot_sizes.entries.end() && it->product_size == product_size; ++it) { if (it->gflops > best_pot_gflops) { best_pot_gflops = it->gflops; best_pot_block_size = it->pot_block_size; } } results_entry_t entry; entry.product_size = product_size; entry.default_block_size = it_default_sizes->nonpot_block_size; entry.best_pot_block_size = best_pot_block_size; entry.default_gflops = it_default_sizes->gflops; entry.best_pot_gflops = best_pot_gflops; entry.default_efficiency = entry.default_gflops / entry.best_pot_gflops; results.push_back(entry); size_triple_t t(product_size); if (t.k == t.m && t.m == t.n) { cubic_results.push_back(entry); } } cout << "All results:" << endl; for (auto it = results.begin(); it != results.end(); ++it) { cout << *it << endl; } cout << endl; sort(results.begin(), results.end(), lower_efficiency); const size_t n = min(20, results.size()); cout << n << " worst results:" << endl; for (size_t i = 0; i < n; i++) { cout << results[i] << endl; } cout << endl; cout << "cubic results:" << endl; for (auto it = cubic_results.begin(); it != cubic_results.end(); ++it) { cout << *it << endl; } cout << endl; sort(cubic_results.begin(), cubic_results.end(), lower_efficiency); cout.precision(2); vector a = {0.5f, 0.20f, 0.10f, 0.05f, 0.02f, 0.01f}; for (auto it = a.begin(); it != a.end(); ++it) { size_t n = min(results.size() - 1, size_t(*it * results.size())); cout << (100.0f * n / (results.size() - 1)) << " % of product sizes have default efficiency <= " << 100.0f * results[n].default_efficiency << " %" << endl; } cout.precision(default_precision); } }; void show_usage_and_exit(int argc, char* argv[], const vector>& available_actions) { cerr << "usage: " << argv[0] << " [options...] " << endl; cerr << "available actions:" << endl; for (auto it = available_actions.begin(); it != available_actions.end(); ++it) { cerr << " " << (*it)->invokation_name() << endl; } cerr << "the input files should each contain an output of benchmark-blocking-sizes" << endl; exit(1); } int main(int argc, char* argv[]) { cout.precision(default_precision); cerr.precision(default_precision); vector> available_actions; available_actions.emplace_back(new partition_action_t); available_actions.emplace_back(new evaluate_defaults_action_t); vector input_filenames; action_t* action = nullptr; if (argc < 2) { show_usage_and_exit(argc, argv, available_actions); } for (int i = 1; i < argc; i++) { bool arg_handled = false; // Step 1. Try to match action invocation names. for (auto it = available_actions.begin(); it != available_actions.end(); ++it) { if (!strcmp(argv[i], (*it)->invokation_name())) { if (!action) { action = it->get(); arg_handled = true; break; } else { cerr << "can't specify more than one action!" << endl; show_usage_and_exit(argc, argv, available_actions); } } } if (arg_handled) { continue; } // Step 2. Try to match option names. if (argv[i][0] == '-') { if (!strcmp(argv[i], "--only-cubic-sizes")) { only_cubic_sizes = true; arg_handled = true; } if (!strcmp(argv[i], "--dump-tables")) { dump_tables = true; arg_handled = true; } if (!arg_handled) { cerr << "Unrecognized option: " << argv[i] << endl; show_usage_and_exit(argc, argv, available_actions); } } if (arg_handled) { continue; } // Step 3. Default to interpreting args as input filenames. input_filenames.emplace_back(argv[i]); } if (dump_tables && only_cubic_sizes) { cerr << "Incompatible options: --only-cubic-sizes and --dump-tables." << endl; show_usage_and_exit(argc, argv, available_actions); } if (!action) { show_usage_and_exit(argc, argv, available_actions); } action->run(input_filenames); } ================================================ FILE: VO_Module/thirdparty/eigen/bench/basicbench.cxxlist ================================================ #!/bin/bash # CLIST[((g++))]="g++-3.4 -O3 -DNDEBUG" # CLIST[((g++))]="g++-3.4 -O3 -DNDEBUG -finline-limit=20000" # CLIST[((g++))]="g++-4.1 -O3 -DNDEBUG" #CLIST[((g++))]="g++-4.1 -O3 -DNDEBUG -finline-limit=20000" # CLIST[((g++))]="g++-4.2 -O3 -DNDEBUG" #CLIST[((g++))]="g++-4.2 -O3 -DNDEBUG -finline-limit=20000" # CLIST[((g++))]="g++-4.2 -O3 -DNDEBUG -finline-limit=20000 -fprofile-generate" # CLIST[((g++))]="g++-4.2 -O3 -DNDEBUG -finline-limit=20000 -fprofile-use" # CLIST[((g++))]="g++-4.3 -O3 -DNDEBUG" #CLIST[((g++))]="g++-4.3 -O3 -DNDEBUG -finline-limit=20000" # CLIST[((g++))]="g++-4.3 -O3 -DNDEBUG -finline-limit=20000 -fprofile-generate" # CLIST[((g++))]="g++-4.3 -O3 -DNDEBUG -finline-limit=20000 -fprofile-use" # CLIST[((g++))]="icpc -fast -DNDEBUG -fno-exceptions -no-inline-max-size -prof-genx" # CLIST[((g++))]="icpc -fast -DNDEBUG -fno-exceptions -no-inline-max-size -prof-use" #CLIST[((g++))]="/opt/intel/Compiler/11.1/072/bin/intel64/icpc -fast -DNDEBUG -fno-exceptions -no-inline-max-size -lrt" CLIST[((g++))]="/home/orzel/svn/llvm/Release/bin/clang++ -O3 -DNDEBUG -DEIGEN_DONT_VECTORIZE -lrt" CLIST[((g++))]="/home/orzel/svn/llvm/Release/bin/clang++ -O3 -DNDEBUG -lrt" CLIST[((g++))]="g++-4.4.4 -O3 -DNDEBUG -DEIGEN_DONT_VECTORIZE -lrt" CLIST[((g++))]="g++-4.4.4 -O3 -DNDEBUG -lrt" CLIST[((g++))]="g++-4.5.0 -O3 -DNDEBUG -DEIGEN_DONT_VECTORIZE -lrt" CLIST[((g++))]="g++-4.5.0 -O3 -DNDEBUG -lrt" ================================================ FILE: VO_Module/thirdparty/eigen/bench/basicbenchmark.cpp ================================================ #include #include "BenchUtil.h" #include "basicbenchmark.h" int main(int argc, char *argv[]) { DISABLE_SSE_EXCEPTIONS(); // this is the list of matrix type and size we want to bench: // ((suffix) (matrix size) (number of iterations)) #define MODES ((3d)(3)(4000000)) ((4d)(4)(1000000)) ((Xd)(4)(1000000)) ((Xd)(20)(10000)) // #define MODES ((Xd)(20)(10000)) #define _GENERATE_HEADER(R,ARG,EL) << BOOST_PP_STRINGIZE(BOOST_PP_SEQ_HEAD(EL)) << "-" \ << BOOST_PP_STRINGIZE(BOOST_PP_SEQ_ELEM(1,EL)) << "x" \ << BOOST_PP_STRINGIZE(BOOST_PP_SEQ_ELEM(1,EL)) << " / " std::cout BOOST_PP_SEQ_FOR_EACH(_GENERATE_HEADER, ~, MODES ) << endl; const int tries = 10; #define _RUN_BENCH(R,ARG,EL) \ std::cout << ARG( \ BOOST_PP_CAT(Matrix, BOOST_PP_SEQ_HEAD(EL)) (\ BOOST_PP_SEQ_ELEM(1,EL),BOOST_PP_SEQ_ELEM(1,EL)), BOOST_PP_SEQ_ELEM(2,EL), tries) \ << " "; BOOST_PP_SEQ_FOR_EACH(_RUN_BENCH, benchBasic, MODES ); std::cout << endl; BOOST_PP_SEQ_FOR_EACH(_RUN_BENCH, benchBasic, MODES ); std::cout << endl; return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/basicbenchmark.h ================================================ #ifndef EIGEN_BENCH_BASICBENCH_H #define EIGEN_BENCH_BASICBENCH_H enum {LazyEval, EarlyEval, OmpEval}; template void benchBasic_loop(const MatrixType& I, MatrixType& m, int iterations) __attribute__((noinline)); template void benchBasic_loop(const MatrixType& I, MatrixType& m, int iterations) { for(int a = 0; a < iterations; a++) { if (Mode==LazyEval) { asm("#begin_bench_loop LazyEval"); if (MatrixType::SizeAtCompileTime!=Eigen::Dynamic) asm("#fixedsize"); m = (I + 0.00005 * (m + m.lazyProduct(m))).eval(); } else if (Mode==OmpEval) { asm("#begin_bench_loop OmpEval"); if (MatrixType::SizeAtCompileTime!=Eigen::Dynamic) asm("#fixedsize"); m = (I + 0.00005 * (m + m.lazyProduct(m))).eval(); } else { asm("#begin_bench_loop EarlyEval"); if (MatrixType::SizeAtCompileTime!=Eigen::Dynamic) asm("#fixedsize"); m = I + 0.00005 * (m + m * m); } asm("#end_bench_loop"); } } template double benchBasic(const MatrixType& mat, int size, int tries) __attribute__((noinline)); template double benchBasic(const MatrixType& mat, int iterations, int tries) { const int rows = mat.rows(); const int cols = mat.cols(); MatrixType I(rows,cols); MatrixType m(rows,cols); initMatrix_identity(I); Eigen::BenchTimer timer; for(uint t=0; t(I, m, iterations); timer.stop(); cerr << m; } return timer.value(); }; #endif // EIGEN_BENCH_BASICBENCH_H ================================================ FILE: VO_Module/thirdparty/eigen/bench/benchBlasGemm.cpp ================================================ // g++ -O3 -DNDEBUG -I.. -L /usr/lib64/atlas/ benchBlasGemm.cpp -o benchBlasGemm -lrt -lcblas // possible options: // -DEIGEN_DONT_VECTORIZE // -msse2 // #define EIGEN_DEFAULT_TO_ROW_MAJOR #define _FLOAT #include #include #include "BenchTimer.h" // include the BLAS headers extern "C" { #include } #include #ifdef _FLOAT typedef float Scalar; #define CBLAS_GEMM cblas_sgemm #else typedef double Scalar; #define CBLAS_GEMM cblas_dgemm #endif typedef Eigen::Matrix MyMatrix; void bench_eigengemm(MyMatrix& mc, const MyMatrix& ma, const MyMatrix& mb, int nbloops); void check_product(int M, int N, int K); void check_product(void); int main(int argc, char *argv[]) { // disable SSE exceptions #ifdef __GNUC__ { int aux; asm( "stmxcsr %[aux] \n\t" "orl $32832, %[aux] \n\t" "ldmxcsr %[aux] \n\t" : : [aux] "m" (aux)); } #endif int nbtries=1, nbloops=1, M, N, K; if (argc==2) { if (std::string(argv[1])=="check") check_product(); else M = N = K = atoi(argv[1]); } else if ((argc==3) && (std::string(argv[1])=="auto")) { M = N = K = atoi(argv[2]); nbloops = 1000000000/(M*M*M); if (nbloops<1) nbloops = 1; nbtries = 6; } else if (argc==4) { M = N = K = atoi(argv[1]); nbloops = atoi(argv[2]); nbtries = atoi(argv[3]); } else if (argc==6) { M = atoi(argv[1]); N = atoi(argv[2]); K = atoi(argv[3]); nbloops = atoi(argv[4]); nbtries = atoi(argv[5]); } else { std::cout << "Usage: " << argv[0] << " size \n"; std::cout << "Usage: " << argv[0] << " auto size\n"; std::cout << "Usage: " << argv[0] << " size nbloops nbtries\n"; std::cout << "Usage: " << argv[0] << " M N K nbloops nbtries\n"; std::cout << "Usage: " << argv[0] << " check\n"; std::cout << "Options:\n"; std::cout << " size unique size of the 2 matrices (integer)\n"; std::cout << " auto automatically set the number of repetitions and tries\n"; std::cout << " nbloops number of times the GEMM routines is executed\n"; std::cout << " nbtries number of times the loop is benched (return the best try)\n"; std::cout << " M N K sizes of the matrices: MxN = MxK * KxN (integers)\n"; std::cout << " check check eigen product using cblas as a reference\n"; exit(1); } double nbmad = double(M) * double(N) * double(K) * double(nbloops); if (!(std::string(argv[1])=="auto")) std::cout << M << " x " << N << " x " << K << "\n"; Scalar alpha, beta; MyMatrix ma(M,K), mb(K,N), mc(M,N); ma = MyMatrix::Random(M,K); mb = MyMatrix::Random(K,N); mc = MyMatrix::Random(M,N); Eigen::BenchTimer timer; // we simply compute c += a*b, so: alpha = 1; beta = 1; // bench cblas // ROWS_A, COLS_B, COLS_A, 1.0, A, COLS_A, B, COLS_B, 0.0, C, COLS_B); if (!(std::string(argv[1])=="auto")) { timer.reset(); for (uint k=0 ; k(1,64); N = internal::random(1,768); K = internal::random(1,768); M = (0 + M) * 1; std::cout << M << " x " << N << " x " << K << "\n"; check_product(M, N, K); } } ================================================ FILE: VO_Module/thirdparty/eigen/bench/benchCholesky.cpp ================================================ // g++ -DNDEBUG -O3 -I.. benchCholesky.cpp -o benchCholesky && ./benchCholesky // options: // -DBENCH_GSL -lgsl /usr/lib/libcblas.so.3 // -DEIGEN_DONT_VECTORIZE // -msse2 // -DREPEAT=100 // -DTRIES=10 // -DSCALAR=double #include #include #include #include using namespace Eigen; #ifndef REPEAT #define REPEAT 10000 #endif #ifndef TRIES #define TRIES 10 #endif typedef float Scalar; template __attribute__ ((noinline)) void benchLLT(const MatrixType& m) { int rows = m.rows(); int cols = m.cols(); double cost = 0; for (int j=0; j SquareMatrixType; MatrixType a = MatrixType::Random(rows,cols); SquareMatrixType covMat = a * a.adjoint(); BenchTimer timerNoSqrt, timerSqrt; Scalar acc = 0; int r = internal::random(0,covMat.rows()-1); int c = internal::random(0,covMat.cols()-1); for (int t=0; t cholnosqrt(covMat); acc += cholnosqrt.matrixL().coeff(r,c); } timerNoSqrt.stop(); } for (int t=0; t chol(covMat); acc += chol.matrixL().coeff(r,c); } timerSqrt.stop(); } if (MatrixType::RowsAtCompileTime==Dynamic) std::cout << "dyn "; else std::cout << "fixed "; std::cout << covMat.rows() << " \t" << (timerNoSqrt.best()) / repeats << "s " << "(" << 1e-9 * cost*repeats/timerNoSqrt.best() << " GFLOPS)\t" << (timerSqrt.best()) / repeats << "s " << "(" << 1e-9 * cost*repeats/timerSqrt.best() << " GFLOPS)\n"; #ifdef BENCH_GSL if (MatrixType::RowsAtCompileTime==Dynamic) { timerSqrt.reset(); gsl_matrix* gslCovMat = gsl_matrix_alloc(covMat.rows(),covMat.cols()); gsl_matrix* gslCopy = gsl_matrix_alloc(covMat.rows(),covMat.cols()); eiToGsl(covMat, &gslCovMat); for (int t=0; t0; ++i) benchLLT(Matrix(dynsizes[i],dynsizes[i])); benchLLT(Matrix()); benchLLT(Matrix()); benchLLT(Matrix()); benchLLT(Matrix()); benchLLT(Matrix()); benchLLT(Matrix()); benchLLT(Matrix()); benchLLT(Matrix()); benchLLT(Matrix()); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/benchEigenSolver.cpp ================================================ // g++ -DNDEBUG -O3 -I.. benchEigenSolver.cpp -o benchEigenSolver && ./benchEigenSolver // options: // -DBENCH_GMM // -DBENCH_GSL -lgsl /usr/lib/libcblas.so.3 // -DEIGEN_DONT_VECTORIZE // -msse2 // -DREPEAT=100 // -DTRIES=10 // -DSCALAR=double #include #include #include #include using namespace Eigen; #ifndef REPEAT #define REPEAT 1000 #endif #ifndef TRIES #define TRIES 4 #endif #ifndef SCALAR #define SCALAR float #endif typedef SCALAR Scalar; template __attribute__ ((noinline)) void benchEigenSolver(const MatrixType& m) { int rows = m.rows(); int cols = m.cols(); int stdRepeats = std::max(1,int((REPEAT*1000)/(rows*rows*sqrt(rows)))); int saRepeats = stdRepeats * 4; typedef typename MatrixType::Scalar Scalar; typedef Matrix SquareMatrixType; MatrixType a = MatrixType::Random(rows,cols); SquareMatrixType covMat = a * a.adjoint(); BenchTimer timerSa, timerStd; Scalar acc = 0; int r = internal::random(0,covMat.rows()-1); int c = internal::random(0,covMat.cols()-1); { SelfAdjointEigenSolver ei(covMat); for (int t=0; t ei(covMat); for (int t=0; t gmmCovMat(covMat.rows(),covMat.cols()); gmm::dense_matrix eigvect(covMat.rows(),covMat.cols()); std::vector eigval(covMat.rows()); eiToGmm(covMat, gmmCovMat); for (int t=0; t0; ++i) benchEigenSolver(Matrix(dynsizes[i],dynsizes[i])); benchEigenSolver(Matrix()); benchEigenSolver(Matrix()); benchEigenSolver(Matrix()); benchEigenSolver(Matrix()); benchEigenSolver(Matrix()); benchEigenSolver(Matrix()); benchEigenSolver(Matrix()); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/benchFFT.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Mark Borgerding mark a borgerding net // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include #include #include #include #include #include using namespace Eigen; using namespace std; template string nameof(); template <> string nameof() {return "float";} template <> string nameof() {return "double";} template <> string nameof() {return "long double";} #ifndef TYPE #define TYPE float #endif #ifndef NFFT #define NFFT 1024 #endif #ifndef NDATA #define NDATA 1000000 #endif using namespace Eigen; template void bench(int nfft,bool fwd,bool unscaled=false, bool halfspec=false) { typedef typename NumTraits::Real Scalar; typedef typename std::complex Complex; int nits = NDATA/nfft; vector inbuf(nfft); vector outbuf(nfft); FFT< Scalar > fft; if (unscaled) { fft.SetFlag(fft.Unscaled); cout << "unscaled "; } if (halfspec) { fft.SetFlag(fft.HalfSpectrum); cout << "halfspec "; } std::fill(inbuf.begin(),inbuf.end(),0); fft.fwd( outbuf , inbuf); BenchTimer timer; timer.reset(); for (int k=0;k<8;++k) { timer.start(); if (fwd) for(int i = 0; i < nits; i++) fft.fwd( outbuf , inbuf); else for(int i = 0; i < nits; i++) fft.inv(inbuf,outbuf); timer.stop(); } cout << nameof() << " "; double mflops = 5.*nfft*log2((double)nfft) / (1e6 * timer.value() / (double)nits ); if ( NumTraits::IsComplex ) { cout << "complex"; }else{ cout << "real "; mflops /= 2; } if (fwd) cout << " fwd"; else cout << " inv"; cout << " NFFT=" << nfft << " " << (double(1e-6*nfft*nits)/timer.value()) << " MS/s " << mflops << "MFLOPS\n"; } int main(int argc,char ** argv) { bench >(NFFT,true); bench >(NFFT,false); bench(NFFT,true); bench(NFFT,false); bench(NFFT,false,true); bench(NFFT,false,true,true); bench >(NFFT,true); bench >(NFFT,false); bench(NFFT,true); bench(NFFT,false); bench >(NFFT,true); bench >(NFFT,false); bench(NFFT,true); bench(NFFT,false); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/benchGeometry.cpp ================================================ #include #include #include #include #include using namespace Eigen; using namespace std; #ifndef REPEAT #define REPEAT 1000000 #endif enum func_opt { TV, TMATV, TMATVMAT, }; template struct func; template struct func { static EIGEN_DONT_INLINE res run( arg1& a1, arg2& a2 ) { asm (""); return a1 * a2; } }; template struct func { static EIGEN_DONT_INLINE res run( arg1& a1, arg2& a2 ) { asm (""); return a1.matrix() * a2; } }; template struct func { static EIGEN_DONT_INLINE res run( arg1& a1, arg2& a2 ) { asm (""); return res(a1.matrix() * a2.matrix()); } }; template struct test_transform { static void run() { arg1 a1; a1.setIdentity(); arg2 a2; a2.setIdentity(); BenchTimer timer; timer.reset(); for (int k=0; k<10; ++k) { timer.start(); for (int k=0; k Trans;\ typedef Matrix Vec;\ typedef func Func;\ test_transform< Func, Trans, Vec >::run();\ } #define run_trans( op, scalar, mode, option ) \ std::cout << #scalar << "\t " << #mode << "\t " << #option << " "; \ {\ typedef Transform Trans;\ typedef func Func;\ test_transform< Func, Trans, Trans >::run();\ } int main(int argc, char* argv[]) { cout << "vec = trans * vec" << endl; run_vec(TV, float, Isometry, AutoAlign, 3); run_vec(TV, float, Isometry, DontAlign, 3); run_vec(TV, float, Isometry, AutoAlign, 4); run_vec(TV, float, Isometry, DontAlign, 4); run_vec(TV, float, Projective, AutoAlign, 4); run_vec(TV, float, Projective, DontAlign, 4); run_vec(TV, double, Isometry, AutoAlign, 3); run_vec(TV, double, Isometry, DontAlign, 3); run_vec(TV, double, Isometry, AutoAlign, 4); run_vec(TV, double, Isometry, DontAlign, 4); run_vec(TV, double, Projective, AutoAlign, 4); run_vec(TV, double, Projective, DontAlign, 4); cout << "vec = trans.matrix() * vec" << endl; run_vec(TMATV, float, Isometry, AutoAlign, 4); run_vec(TMATV, float, Isometry, DontAlign, 4); run_vec(TMATV, double, Isometry, AutoAlign, 4); run_vec(TMATV, double, Isometry, DontAlign, 4); cout << "trans = trans1 * trans" << endl; run_trans(TV, float, Isometry, AutoAlign); run_trans(TV, float, Isometry, DontAlign); run_trans(TV, double, Isometry, AutoAlign); run_trans(TV, double, Isometry, DontAlign); run_trans(TV, float, Projective, AutoAlign); run_trans(TV, float, Projective, DontAlign); run_trans(TV, double, Projective, AutoAlign); run_trans(TV, double, Projective, DontAlign); cout << "trans = trans1.matrix() * trans.matrix()" << endl; run_trans(TMATVMAT, float, Isometry, AutoAlign); run_trans(TMATVMAT, float, Isometry, DontAlign); run_trans(TMATVMAT, double, Isometry, AutoAlign); run_trans(TMATVMAT, double, Isometry, DontAlign); } ================================================ FILE: VO_Module/thirdparty/eigen/bench/benchVecAdd.cpp ================================================ #include #include #include using namespace Eigen; #ifndef SIZE #define SIZE 50 #endif #ifndef REPEAT #define REPEAT 10000 #endif typedef float Scalar; __attribute__ ((noinline)) void benchVec(Scalar* a, Scalar* b, Scalar* c, int size); __attribute__ ((noinline)) void benchVec(MatrixXf& a, MatrixXf& b, MatrixXf& c); __attribute__ ((noinline)) void benchVec(VectorXf& a, VectorXf& b, VectorXf& c); int main(int argc, char* argv[]) { int size = SIZE * 8; int size2 = size * size; Scalar* a = internal::aligned_new(size2); Scalar* b = internal::aligned_new(size2+4)+1; Scalar* c = internal::aligned_new(size2); for (int i=0; i2 ; --innersize) { if (size2%innersize==0) { int outersize = size2/innersize; MatrixXf ma = Map(a, innersize, outersize ); MatrixXf mb = Map(b, innersize, outersize ); MatrixXf mc = Map(c, innersize, outersize ); timer.reset(); for (int k=0; k<3; ++k) { timer.start(); benchVec(ma, mb, mc); timer.stop(); } std::cout << innersize << " x " << outersize << " " << timer.value() << "s " << (double(size2*REPEAT)/timer.value())/(1024.*1024.*1024.) << " GFlops\n"; } } VectorXf va = Map(a, size2); VectorXf vb = Map(b, size2); VectorXf vc = Map(c, size2); timer.reset(); for (int k=0; k<3; ++k) { timer.start(); benchVec(va, vb, vc); timer.stop(); } std::cout << timer.value() << "s " << (double(size2*REPEAT)/timer.value())/(1024.*1024.*1024.) << " GFlops\n"; return 0; } void benchVec(MatrixXf& a, MatrixXf& b, MatrixXf& c) { for (int k=0; k::type PacketScalar; const int PacketSize = internal::packet_traits::size; PacketScalar a0, a1, a2, a3, b0, b1, b2, b3; for (int k=0; k // -DSCALARA=double or -DSCALARB=double // -DHAVE_BLAS // -DDECOUPLED // #include #include #include using namespace std; using namespace Eigen; #ifndef SCALAR // #define SCALAR std::complex #define SCALAR float #endif #ifndef SCALARA #define SCALARA SCALAR #endif #ifndef SCALARB #define SCALARB SCALAR #endif #ifdef ROWMAJ_A const int opt_A = RowMajor; #else const int opt_A = ColMajor; #endif #ifdef ROWMAJ_B const int opt_B = RowMajor; #else const int opt_B = ColMajor; #endif typedef SCALAR Scalar; typedef NumTraits::Real RealScalar; typedef Matrix A; typedef Matrix B; typedef Matrix C; typedef Matrix M; #ifdef HAVE_BLAS extern "C" { #include } static float fone = 1; static float fzero = 0; static double done = 1; static double szero = 0; static std::complex cfone = 1; static std::complex cfzero = 0; static std::complex cdone = 1; static std::complex cdzero = 0; static char notrans = 'N'; static char trans = 'T'; static char nonunit = 'N'; static char lower = 'L'; static char right = 'R'; static int intone = 1; #ifdef ROWMAJ_A const char transA = trans; #else const char transA = notrans; #endif #ifdef ROWMAJ_B const char transB = trans; #else const char transB = notrans; #endif template void blas_gemm(const A& a, const B& b, MatrixXf& c) { int M = c.rows(); int N = c.cols(); int K = a.cols(); int lda = a.outerStride(); int ldb = b.outerStride(); int ldc = c.rows(); sgemm_(&transA,&transB,&M,&N,&K,&fone, const_cast(a.data()),&lda, const_cast(b.data()),&ldb,&fone, c.data(),&ldc); } template void blas_gemm(const A& a, const B& b, MatrixXd& c) { int M = c.rows(); int N = c.cols(); int K = a.cols(); int lda = a.outerStride(); int ldb = b.outerStride(); int ldc = c.rows(); dgemm_(&transA,&transB,&M,&N,&K,&done, const_cast(a.data()),&lda, const_cast(b.data()),&ldb,&done, c.data(),&ldc); } template void blas_gemm(const A& a, const B& b, MatrixXcf& c) { int M = c.rows(); int N = c.cols(); int K = a.cols(); int lda = a.outerStride(); int ldb = b.outerStride(); int ldc = c.rows(); cgemm_(&transA,&transB,&M,&N,&K,(float*)&cfone, const_cast((const float*)a.data()),&lda, const_cast((const float*)b.data()),&ldb,(float*)&cfone, (float*)c.data(),&ldc); } template void blas_gemm(const A& a, const B& b, MatrixXcd& c) { int M = c.rows(); int N = c.cols(); int K = a.cols(); int lda = a.outerStride(); int ldb = b.outerStride(); int ldc = c.rows(); zgemm_(&transA,&transB,&M,&N,&K,(double*)&cdone, const_cast((const double*)a.data()),&lda, const_cast((const double*)b.data()),&ldb,(double*)&cdone, (double*)c.data(),&ldc); } #endif void matlab_cplx_cplx(const M& ar, const M& ai, const M& br, const M& bi, M& cr, M& ci) { cr.noalias() += ar * br; cr.noalias() -= ai * bi; ci.noalias() += ar * bi; ci.noalias() += ai * br; // [cr ci] += [ar ai] * br + [-ai ar] * bi } void matlab_real_cplx(const M& a, const M& br, const M& bi, M& cr, M& ci) { cr.noalias() += a * br; ci.noalias() += a * bi; } void matlab_cplx_real(const M& ar, const M& ai, const M& b, M& cr, M& ci) { cr.noalias() += ar * b; ci.noalias() += ai * b; } template EIGEN_DONT_INLINE void gemm(const A& a, const B& b, C& c) { c.noalias() += a * b; } int main(int argc, char ** argv) { std::ptrdiff_t l1 = internal::queryL1CacheSize(); std::ptrdiff_t l2 = internal::queryTopLevelCacheSize(); std::cout << "L1 cache size = " << (l1>0 ? l1/1024 : -1) << " KB\n"; std::cout << "L2/L3 cache size = " << (l2>0 ? l2/1024 : -1) << " KB\n"; typedef internal::gebp_traits Traits; std::cout << "Register blocking = " << Traits::mr << " x " << Traits::nr << "\n"; int rep = 1; // number of repetitions per try int tries = 2; // number of tries, we keep the best int s = 2048; int m = s; int n = s; int p = s; int cache_size1=-1, cache_size2=l2, cache_size3 = 0; bool need_help = false; for (int i=1; i -c -t -p \n"; std::cout << " : size\n"; std::cout << " : rows columns depth\n"; return 1; } #if EIGEN_VERSION_AT_LEAST(3,2,90) if(cache_size1>0) setCpuCacheSizes(cache_size1,cache_size2,cache_size3); #endif A a(m,p); a.setRandom(); B b(p,n); b.setRandom(); C c(m,n); c.setOnes(); C rc = c; std::cout << "Matrix sizes = " << m << "x" << p << " * " << p << "x" << n << "\n"; std::ptrdiff_t mc(m), nc(n), kc(p); internal::computeProductBlockingSizes(kc, mc, nc); std::cout << "blocking size (mc x kc) = " << mc << " x " << kc << " x " << nc << "\n"; C r = c; // check the parallel product is correct #if defined EIGEN_HAS_OPENMP Eigen::initParallel(); int procs = omp_get_max_threads(); if(procs>1) { #ifdef HAVE_BLAS blas_gemm(a,b,r); #else omp_set_num_threads(1); r.noalias() += a * b; omp_set_num_threads(procs); #endif c.noalias() += a * b; if(!r.isApprox(c)) std::cerr << "Warning, your parallel product is crap!\n\n"; } #elif defined HAVE_BLAS blas_gemm(a,b,r); c.noalias() += a * b; if(!r.isApprox(c)) { std::cout << (r - c).norm()/r.norm() << "\n"; std::cerr << "Warning, your product is crap!\n\n"; } #else if(1.*m*n*p<2000.*2000*2000) { gemm(a,b,c); r.noalias() += a.cast() .lazyProduct( b.cast() ); if(!r.isApprox(c)) { std::cout << (r - c).norm()/r.norm() << "\n"; std::cerr << "Warning, your product is crap!\n\n"; } } #endif #ifdef HAVE_BLAS BenchTimer tblas; c = rc; BENCH(tblas, tries, rep, blas_gemm(a,b,c)); std::cout << "blas cpu " << tblas.best(CPU_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tblas.best(CPU_TIMER))*1e-9 << " GFLOPS \t(" << tblas.total(CPU_TIMER) << "s)\n"; std::cout << "blas real " << tblas.best(REAL_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tblas.best(REAL_TIMER))*1e-9 << " GFLOPS \t(" << tblas.total(REAL_TIMER) << "s)\n"; #endif // warm start if(b.norm()+a.norm()==123.554) std::cout << "\n"; BenchTimer tmt; c = rc; BENCH(tmt, tries, rep, gemm(a,b,c)); std::cout << "eigen cpu " << tmt.best(CPU_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tmt.best(CPU_TIMER))*1e-9 << " GFLOPS \t(" << tmt.total(CPU_TIMER) << "s)\n"; std::cout << "eigen real " << tmt.best(REAL_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tmt.best(REAL_TIMER))*1e-9 << " GFLOPS \t(" << tmt.total(REAL_TIMER) << "s)\n"; #ifdef EIGEN_HAS_OPENMP if(procs>1) { BenchTimer tmono; omp_set_num_threads(1); Eigen::setNbThreads(1); c = rc; BENCH(tmono, tries, rep, gemm(a,b,c)); std::cout << "eigen mono cpu " << tmono.best(CPU_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tmono.best(CPU_TIMER))*1e-9 << " GFLOPS \t(" << tmono.total(CPU_TIMER) << "s)\n"; std::cout << "eigen mono real " << tmono.best(REAL_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tmono.best(REAL_TIMER))*1e-9 << " GFLOPS \t(" << tmono.total(REAL_TIMER) << "s)\n"; std::cout << "mt speed up x" << tmono.best(CPU_TIMER) / tmt.best(REAL_TIMER) << " => " << (100.0*tmono.best(CPU_TIMER) / tmt.best(REAL_TIMER))/procs << "%\n"; } #endif if(1.*m*n*p<30*30*30) { BenchTimer tmt; c = rc; BENCH(tmt, tries, rep, c.noalias()+=a.lazyProduct(b)); std::cout << "lazy cpu " << tmt.best(CPU_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tmt.best(CPU_TIMER))*1e-9 << " GFLOPS \t(" << tmt.total(CPU_TIMER) << "s)\n"; std::cout << "lazy real " << tmt.best(REAL_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tmt.best(REAL_TIMER))*1e-9 << " GFLOPS \t(" << tmt.total(REAL_TIMER) << "s)\n"; } #ifdef DECOUPLED if((NumTraits::IsComplex) && (NumTraits::IsComplex)) { M ar(m,p); ar.setRandom(); M ai(m,p); ai.setRandom(); M br(p,n); br.setRandom(); M bi(p,n); bi.setRandom(); M cr(m,n); cr.setRandom(); M ci(m,n); ci.setRandom(); BenchTimer t; BENCH(t, tries, rep, matlab_cplx_cplx(ar,ai,br,bi,cr,ci)); std::cout << "\"matlab\" cpu " << t.best(CPU_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/t.best(CPU_TIMER))*1e-9 << " GFLOPS \t(" << t.total(CPU_TIMER) << "s)\n"; std::cout << "\"matlab\" real " << t.best(REAL_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/t.best(REAL_TIMER))*1e-9 << " GFLOPS \t(" << t.total(REAL_TIMER) << "s)\n"; } if((!NumTraits::IsComplex) && (NumTraits::IsComplex)) { M a(m,p); a.setRandom(); M br(p,n); br.setRandom(); M bi(p,n); bi.setRandom(); M cr(m,n); cr.setRandom(); M ci(m,n); ci.setRandom(); BenchTimer t; BENCH(t, tries, rep, matlab_real_cplx(a,br,bi,cr,ci)); std::cout << "\"matlab\" cpu " << t.best(CPU_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/t.best(CPU_TIMER))*1e-9 << " GFLOPS \t(" << t.total(CPU_TIMER) << "s)\n"; std::cout << "\"matlab\" real " << t.best(REAL_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/t.best(REAL_TIMER))*1e-9 << " GFLOPS \t(" << t.total(REAL_TIMER) << "s)\n"; } if((NumTraits::IsComplex) && (!NumTraits::IsComplex)) { M ar(m,p); ar.setRandom(); M ai(m,p); ai.setRandom(); M b(p,n); b.setRandom(); M cr(m,n); cr.setRandom(); M ci(m,n); ci.setRandom(); BenchTimer t; BENCH(t, tries, rep, matlab_cplx_real(ar,ai,b,cr,ci)); std::cout << "\"matlab\" cpu " << t.best(CPU_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/t.best(CPU_TIMER))*1e-9 << " GFLOPS \t(" << t.total(CPU_TIMER) << "s)\n"; std::cout << "\"matlab\" real " << t.best(REAL_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/t.best(REAL_TIMER))*1e-9 << " GFLOPS \t(" << t.total(REAL_TIMER) << "s)\n"; } #endif return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/bench_move_semantics.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2020 Sebastien Boisvert // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "BenchTimer.h" #include "../test/MovableScalar.h" #include #include #include template void copy_matrix(MatrixType& m) { MatrixType tmp(m); m = tmp; } template void move_matrix(MatrixType&& m) { MatrixType tmp(std::move(m)); m = std::move(tmp); } template void bench(const std::string& label) { using MatrixType = Eigen::Matrix,1,10>; Eigen::BenchTimer t; int tries = 10; int rep = 1000000; MatrixType data = MatrixType::Random().eval(); MatrixType dest; BENCH(t, tries, rep, copy_matrix(data)); std::cout << label << " copy semantics: " << 1e3*t.best(Eigen::CPU_TIMER) << " ms" << std::endl; BENCH(t, tries, rep, move_matrix(std::move(data))); std::cout << label << " move semantics: " << 1e3*t.best(Eigen::CPU_TIMER) << " ms" << std::endl; } int main() { bench("float"); bench("double"); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/bench_multi_compilers.sh ================================================ #!/bin/bash if (($# < 2)); then echo "Usage: $0 compilerlist.txt benchfile.cpp" else compilerlist=$1 benchfile=$2 g=0 source $compilerlist # for each compiler, compile benchfile and run the benchmark for (( i=0 ; i /dev/null echo "" else echo "compiler not found: $compiler" fi done fi ================================================ FILE: VO_Module/thirdparty/eigen/bench/bench_norm.cpp ================================================ #include #include #include #include "BenchTimer.h" using namespace Eigen; using namespace std; template EIGEN_DONT_INLINE typename T::Scalar sqsumNorm(T& v) { return v.norm(); } template EIGEN_DONT_INLINE typename T::Scalar stableNorm(T& v) { return v.stableNorm(); } template EIGEN_DONT_INLINE typename T::Scalar hypotNorm(T& v) { return v.hypotNorm(); } template EIGEN_DONT_INLINE typename T::Scalar blueNorm(T& v) { return v.blueNorm(); } template EIGEN_DONT_INLINE typename T::Scalar lapackNorm(T& v) { typedef typename T::Scalar Scalar; int n = v.size(); Scalar scale = 0; Scalar ssq = 1; for (int i=0;i= ax) { ssq += numext::abs2(ax/scale); } else { ssq = Scalar(1) + ssq * numext::abs2(scale/ax); scale = ax; } } return scale * std::sqrt(ssq); } template EIGEN_DONT_INLINE typename T::Scalar twopassNorm(T& v) { typedef typename T::Scalar Scalar; Scalar s = v.array().abs().maxCoeff(); return s*(v/s).norm(); } template EIGEN_DONT_INLINE typename T::Scalar bl2passNorm(T& v) { return v.stableNorm(); } template EIGEN_DONT_INLINE typename T::Scalar divacNorm(T& v) { int n =v.size() / 2; for (int i=0;i0) { for (int i=0;i EIGEN_DONT_INLINE typename T::Scalar pblueNorm(const T& v) { #ifndef EIGEN_VECTORIZE return v.blueNorm(); #else typedef typename T::Scalar Scalar; static int nmax = 0; static Scalar b1, b2, s1m, s2m, overfl, rbig, relerr; int n; if(nmax <= 0) { int nbig, ibeta, it, iemin, iemax, iexp; Scalar abig, eps; nbig = NumTraits::highest(); // largest integer ibeta = std::numeric_limits::radix; // NumTraits::Base; // base for floating-point numbers it = NumTraits::digits(); // NumTraits::Mantissa; // number of base-beta digits in mantissa iemin = NumTraits::min_exponent(); // minimum exponent iemax = NumTraits::max_exponent(); // maximum exponent rbig = NumTraits::highest(); // largest floating-point number // Check the basic machine-dependent constants. if(iemin > 1 - 2*it || 1+it>iemax || (it==2 && ibeta<5) || (it<=4 && ibeta <= 3 ) || it<2) { eigen_assert(false && "the algorithm cannot be guaranteed on this computer"); } iexp = -((1-iemin)/2); b1 = std::pow(ibeta, iexp); // lower boundary of midrange iexp = (iemax + 1 - it)/2; b2 = std::pow(ibeta,iexp); // upper boundary of midrange iexp = (2-iemin)/2; s1m = std::pow(ibeta,iexp); // scaling factor for lower range iexp = - ((iemax+it)/2); s2m = std::pow(ibeta,iexp); // scaling factor for upper range overfl = rbig*s2m; // overflow boundary for abig eps = std::pow(ibeta, 1-it); relerr = std::sqrt(eps); // tolerance for neglecting asml abig = 1.0/eps - 1.0; if (Scalar(nbig)>abig) nmax = abig; // largest safe n else nmax = nbig; } typedef typename internal::packet_traits::type Packet; const int ps = internal::packet_traits::size; Packet pasml = internal::pset1(Scalar(0)); Packet pamed = internal::pset1(Scalar(0)); Packet pabig = internal::pset1(Scalar(0)); Packet ps2m = internal::pset1(s2m); Packet ps1m = internal::pset1(s1m); Packet pb2 = internal::pset1(b2); Packet pb1 = internal::pset1(b1); for(int j=0; j(j)); Packet ax_s2m = internal::pmul(ax,ps2m); Packet ax_s1m = internal::pmul(ax,ps1m); Packet maskBig = internal::plt(pb2,ax); Packet maskSml = internal::plt(ax,pb1); // Packet maskMed = internal::pand(maskSml,maskBig); // Packet scale = internal::pset1(Scalar(0)); // scale = internal::por(scale, internal::pand(maskBig,ps2m)); // scale = internal::por(scale, internal::pand(maskSml,ps1m)); // scale = internal::por(scale, internal::pandnot(internal::pset1(Scalar(1)),maskMed)); // ax = internal::pmul(ax,scale); // ax = internal::pmul(ax,ax); // pabig = internal::padd(pabig, internal::pand(maskBig, ax)); // pasml = internal::padd(pasml, internal::pand(maskSml, ax)); // pamed = internal::padd(pamed, internal::pandnot(ax,maskMed)); pabig = internal::padd(pabig, internal::pand(maskBig, internal::pmul(ax_s2m,ax_s2m))); pasml = internal::padd(pasml, internal::pand(maskSml, internal::pmul(ax_s1m,ax_s1m))); pamed = internal::padd(pamed, internal::pandnot(internal::pmul(ax,ax),internal::pand(maskSml,maskBig))); } Scalar abig = internal::predux(pabig); Scalar asml = internal::predux(pasml); Scalar amed = internal::predux(pamed); if(abig > Scalar(0)) { abig = std::sqrt(abig); if(abig > overfl) { eigen_assert(false && "overflow"); return rbig; } if(amed > Scalar(0)) { abig = abig/s2m; amed = std::sqrt(amed); } else { return abig/s2m; } } else if(asml > Scalar(0)) { if (amed > Scalar(0)) { abig = std::sqrt(amed); amed = std::sqrt(asml) / s1m; } else { return std::sqrt(asml)/s1m; } } else { return std::sqrt(amed); } asml = std::min(abig, amed); abig = std::max(abig, amed); if(asml <= abig*relerr) return abig; else return abig * std::sqrt(Scalar(1) + numext::abs2(asml/abig)); #endif } #define BENCH_PERF(NRM) { \ float af = 0; double ad = 0; std::complex ac = 0; \ Eigen::BenchTimer tf, td, tcf; tf.reset(); td.reset(); tcf.reset();\ for (int k=0; k()); double yd = based * std::abs(internal::random()); VectorXf vf = VectorXf::Ones(s) * yf; VectorXd vd = VectorXd::Ones(s) * yd; std::cout << "reference\t" << std::sqrt(double(s))*yf << "\t" << std::sqrt(double(s))*yd << "\n"; std::cout << "sqsumNorm\t" << sqsumNorm(vf) << "\t" << sqsumNorm(vd) << "\n"; std::cout << "hypotNorm\t" << hypotNorm(vf) << "\t" << hypotNorm(vd) << "\n"; std::cout << "blueNorm\t" << blueNorm(vf) << "\t" << blueNorm(vd) << "\n"; std::cout << "pblueNorm\t" << pblueNorm(vf) << "\t" << pblueNorm(vd) << "\n"; std::cout << "lapackNorm\t" << lapackNorm(vf) << "\t" << lapackNorm(vd) << "\n"; std::cout << "twopassNorm\t" << twopassNorm(vf) << "\t" << twopassNorm(vd) << "\n"; std::cout << "bl2passNorm\t" << bl2passNorm(vf) << "\t" << bl2passNorm(vd) << "\n"; } void check_accuracy_var(int ef0, int ef1, int ed0, int ed1, int s) { VectorXf vf(s); VectorXd vd(s); for (int i=0; i()) * std::pow(double(10), internal::random(ef0,ef1)); vd[i] = std::abs(internal::random()) * std::pow(double(10), internal::random(ed0,ed1)); } //std::cout << "reference\t" << internal::sqrt(double(s))*yf << "\t" << internal::sqrt(double(s))*yd << "\n"; std::cout << "sqsumNorm\t" << sqsumNorm(vf) << "\t" << sqsumNorm(vd) << "\t" << sqsumNorm(vf.cast()) << "\t" << sqsumNorm(vd.cast()) << "\n"; std::cout << "hypotNorm\t" << hypotNorm(vf) << "\t" << hypotNorm(vd) << "\t" << hypotNorm(vf.cast()) << "\t" << hypotNorm(vd.cast()) << "\n"; std::cout << "blueNorm\t" << blueNorm(vf) << "\t" << blueNorm(vd) << "\t" << blueNorm(vf.cast()) << "\t" << blueNorm(vd.cast()) << "\n"; std::cout << "pblueNorm\t" << pblueNorm(vf) << "\t" << pblueNorm(vd) << "\t" << blueNorm(vf.cast()) << "\t" << blueNorm(vd.cast()) << "\n"; std::cout << "lapackNorm\t" << lapackNorm(vf) << "\t" << lapackNorm(vd) << "\t" << lapackNorm(vf.cast()) << "\t" << lapackNorm(vd.cast()) << "\n"; std::cout << "twopassNorm\t" << twopassNorm(vf) << "\t" << twopassNorm(vd) << "\t" << twopassNorm(vf.cast()) << "\t" << twopassNorm(vd.cast()) << "\n"; // std::cout << "bl2passNorm\t" << bl2passNorm(vf) << "\t" << bl2passNorm(vd) << "\t" << bl2passNorm(vf.cast()) << "\t" << bl2passNorm(vd.cast()) << "\n"; } int main(int argc, char** argv) { int tries = 10; int iters = 100000; double y = 1.1345743233455785456788e12 * internal::random(); VectorXf v = VectorXf::Ones(1024) * y; // return 0; int s = 10000; double basef_ok = 1.1345743233455785456788e15; double based_ok = 1.1345743233455785456788e95; double basef_under = 1.1345743233455785456788e-27; double based_under = 1.1345743233455785456788e-303; double basef_over = 1.1345743233455785456788e+27; double based_over = 1.1345743233455785456788e+302; std::cout.precision(20); std::cerr << "\nNo under/overflow:\n"; check_accuracy(basef_ok, based_ok, s); std::cerr << "\nUnderflow:\n"; check_accuracy(basef_under, based_under, s); std::cerr << "\nOverflow:\n"; check_accuracy(basef_over, based_over, s); std::cerr << "\nVarying (over):\n"; for (int k=0; k<1; ++k) { check_accuracy_var(20,27,190,302,s); std::cout << "\n"; } std::cerr << "\nVarying (under):\n"; for (int k=0; k<1; ++k) { check_accuracy_var(-27,20,-302,-190,s); std::cout << "\n"; } y = 1; std::cout.precision(4); int s1 = 1024*1024*32; std::cerr << "Performance (out of cache, " << s1 << "):\n"; { int iters = 1; VectorXf vf = VectorXf::Random(s1) * y; VectorXd vd = VectorXd::Random(s1) * y; VectorXcf vcf = VectorXcf::Random(s1) * y; BENCH_PERF(sqsumNorm); BENCH_PERF(stableNorm); BENCH_PERF(blueNorm); BENCH_PERF(pblueNorm); BENCH_PERF(lapackNorm); BENCH_PERF(hypotNorm); BENCH_PERF(twopassNorm); BENCH_PERF(bl2passNorm); } std::cerr << "\nPerformance (in cache, " << 512 << "):\n"; { int iters = 100000; VectorXf vf = VectorXf::Random(512) * y; VectorXd vd = VectorXd::Random(512) * y; VectorXcf vcf = VectorXcf::Random(512) * y; BENCH_PERF(sqsumNorm); BENCH_PERF(stableNorm); BENCH_PERF(blueNorm); BENCH_PERF(pblueNorm); BENCH_PERF(lapackNorm); BENCH_PERF(hypotNorm); BENCH_PERF(twopassNorm); BENCH_PERF(bl2passNorm); } } ================================================ FILE: VO_Module/thirdparty/eigen/bench/bench_reverse.cpp ================================================ #include #include #include using namespace Eigen; #ifndef REPEAT #define REPEAT 100000 #endif #ifndef TRIES #define TRIES 20 #endif typedef double Scalar; template __attribute__ ((noinline)) void bench_reverse(const MatrixType& m) { int rows = m.rows(); int cols = m.cols(); int size = m.size(); int repeats = (REPEAT*1000)/size; MatrixType a = MatrixType::Random(rows,cols); MatrixType b = MatrixType::Random(rows,cols); BenchTimer timerB, timerH, timerV; Scalar acc = 0; int r = internal::random(0,rows-1); int c = internal::random(0,cols-1); for (int t=0; t0; ++i) { bench_reverse(Matrix(dynsizes[i],dynsizes[i])); bench_reverse(Matrix(dynsizes[i]*dynsizes[i])); } // bench_reverse(Matrix()); // bench_reverse(Matrix()); // bench_reverse(Matrix()); // bench_reverse(Matrix()); // bench_reverse(Matrix()); // bench_reverse(Matrix()); // bench_reverse(Matrix()); // bench_reverse(Matrix()); // bench_reverse(Matrix()); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/bench_sum.cpp ================================================ #include #include using namespace Eigen; using namespace std; int main() { typedef Matrix Vec; Vec v(SIZE); v.setZero(); v[0] = 1; v[1] = 2; for(int i = 0; i < 1000000; i++) { v.coeffRef(0) += v.sum() * SCALAR(1e-20); } cout << v.sum() << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/bench_unrolling ================================================ #!/bin/bash # gcc : CXX="g++ -finline-limit=10000 -ftemplate-depth-2000 --param max-inline-recursive-depth=2000" # icc : CXX="icpc -fast -no-inline-max-size -fno-exceptions" CXX=${CXX-g++ -finline-limit=10000 -ftemplate-depth-2000 --param max-inline-recursive-depth=2000} # default value for ((i=1; i<16; ++i)); do echo "Matrix size: $i x $i :" $CXX -O3 -I.. -DNDEBUG benchmark.cpp -DMATSIZE=$i -DEIGEN_UNROLLING_LIMIT=400 -o benchmark && time ./benchmark >/dev/null $CXX -O3 -I.. -DNDEBUG -finline-limit=10000 benchmark.cpp -DMATSIZE=$i -DEIGEN_DONT_USE_UNROLLED_LOOPS=1 -o benchmark && time ./benchmark >/dev/null echo " " done ================================================ FILE: VO_Module/thirdparty/eigen/bench/benchmark-blocking-sizes.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2015 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include #include #include #include #include #include #include bool eigen_use_specific_block_size; int eigen_block_size_k, eigen_block_size_m, eigen_block_size_n; #define EIGEN_TEST_SPECIFIC_BLOCKING_SIZES eigen_use_specific_block_size #define EIGEN_TEST_SPECIFIC_BLOCKING_SIZE_K eigen_block_size_k #define EIGEN_TEST_SPECIFIC_BLOCKING_SIZE_M eigen_block_size_m #define EIGEN_TEST_SPECIFIC_BLOCKING_SIZE_N eigen_block_size_n #include #include using namespace Eigen; using namespace std; static BenchTimer timer; // how many times we repeat each measurement. // measurements are randomly shuffled - we're not doing // all N identical measurements in a row. const int measurement_repetitions = 3; // Timings below this value are too short to be accurate, // we'll repeat measurements with more iterations until // we get a timing above that threshold. const float min_accurate_time = 1e-2f; // See --min-working-set-size command line parameter. size_t min_working_set_size = 0; float max_clock_speed = 0.0f; // range of sizes that we will benchmark (in all 3 K,M,N dimensions) const size_t maxsize = 2048; const size_t minsize = 16; typedef MatrixXf MatrixType; typedef MatrixType::Scalar Scalar; typedef internal::packet_traits::type Packet; static_assert((maxsize & (maxsize - 1)) == 0, "maxsize must be a power of two"); static_assert((minsize & (minsize - 1)) == 0, "minsize must be a power of two"); static_assert(maxsize > minsize, "maxsize must be larger than minsize"); static_assert(maxsize < (minsize << 16), "maxsize must be less than (minsize<<16)"); // just a helper to store a triple of K,M,N sizes for matrix product struct size_triple_t { size_t k, m, n; size_triple_t() : k(0), m(0), n(0) {} size_triple_t(size_t _k, size_t _m, size_t _n) : k(_k), m(_m), n(_n) {} size_triple_t(const size_triple_t& o) : k(o.k), m(o.m), n(o.n) {} size_triple_t(uint16_t compact) { k = 1 << ((compact & 0xf00) >> 8); m = 1 << ((compact & 0x0f0) >> 4); n = 1 << ((compact & 0x00f) >> 0); } }; uint8_t log2_pot(size_t x) { size_t l = 0; while (x >>= 1) l++; return l; } // Convert between size tripes and a compact form fitting in 12 bits // where each size, which must be a POT, is encoded as its log2, on 4 bits // so the largest representable size is 2^15 == 32k ... big enough. uint16_t compact_size_triple(size_t k, size_t m, size_t n) { return (log2_pot(k) << 8) | (log2_pot(m) << 4) | log2_pot(n); } uint16_t compact_size_triple(const size_triple_t& t) { return compact_size_triple(t.k, t.m, t.n); } // A single benchmark. Initially only contains benchmark params. // Then call run(), which stores the result in the gflops field. struct benchmark_t { uint16_t compact_product_size; uint16_t compact_block_size; bool use_default_block_size; float gflops; benchmark_t() : compact_product_size(0) , compact_block_size(0) , use_default_block_size(false) , gflops(0) { } benchmark_t(size_t pk, size_t pm, size_t pn, size_t bk, size_t bm, size_t bn) : compact_product_size(compact_size_triple(pk, pm, pn)) , compact_block_size(compact_size_triple(bk, bm, bn)) , use_default_block_size(false) , gflops(0) {} benchmark_t(size_t pk, size_t pm, size_t pn) : compact_product_size(compact_size_triple(pk, pm, pn)) , compact_block_size(0) , use_default_block_size(true) , gflops(0) {} void run(); }; ostream& operator<<(ostream& s, const benchmark_t& b) { s << hex << b.compact_product_size << dec; if (b.use_default_block_size) { size_triple_t t(b.compact_product_size); Index k = t.k, m = t.m, n = t.n; internal::computeProductBlockingSizes(k, m, n); s << " default(" << k << ", " << m << ", " << n << ")"; } else { s << " " << hex << b.compact_block_size << dec; } s << " " << b.gflops; return s; } // We sort first by increasing benchmark parameters, // then by decreasing performance. bool operator<(const benchmark_t& b1, const benchmark_t& b2) { return b1.compact_product_size < b2.compact_product_size || (b1.compact_product_size == b2.compact_product_size && ( (b1.compact_block_size < b2.compact_block_size || ( b1.compact_block_size == b2.compact_block_size && b1.gflops > b2.gflops)))); } void benchmark_t::run() { size_triple_t productsizes(compact_product_size); if (use_default_block_size) { eigen_use_specific_block_size = false; } else { // feed eigen with our custom blocking params eigen_use_specific_block_size = true; size_triple_t blocksizes(compact_block_size); eigen_block_size_k = blocksizes.k; eigen_block_size_m = blocksizes.m; eigen_block_size_n = blocksizes.n; } // set up the matrix pool const size_t combined_three_matrices_sizes = sizeof(Scalar) * (productsizes.k * productsizes.m + productsizes.k * productsizes.n + productsizes.m * productsizes.n); // 64 M is large enough that nobody has a cache bigger than that, // while still being small enough that everybody has this much RAM, // so conveniently we don't need to special-case platforms here. const size_t unlikely_large_cache_size = 64 << 20; const size_t working_set_size = min_working_set_size ? min_working_set_size : unlikely_large_cache_size; const size_t matrix_pool_size = 1 + working_set_size / combined_three_matrices_sizes; MatrixType *lhs = new MatrixType[matrix_pool_size]; MatrixType *rhs = new MatrixType[matrix_pool_size]; MatrixType *dst = new MatrixType[matrix_pool_size]; for (size_t i = 0; i < matrix_pool_size; i++) { lhs[i] = MatrixType::Zero(productsizes.m, productsizes.k); rhs[i] = MatrixType::Zero(productsizes.k, productsizes.n); dst[i] = MatrixType::Zero(productsizes.m, productsizes.n); } // main benchmark loop int iters_at_a_time = 1; float time_per_iter = 0.0f; size_t matrix_index = 0; while (true) { double starttime = timer.getCpuTime(); for (int i = 0; i < iters_at_a_time; i++) { dst[matrix_index].noalias() = lhs[matrix_index] * rhs[matrix_index]; matrix_index++; if (matrix_index == matrix_pool_size) { matrix_index = 0; } } double endtime = timer.getCpuTime(); const float timing = float(endtime - starttime); if (timing >= min_accurate_time) { time_per_iter = timing / iters_at_a_time; break; } iters_at_a_time *= 2; } delete[] lhs; delete[] rhs; delete[] dst; gflops = 2e-9 * productsizes.k * productsizes.m * productsizes.n / time_per_iter; } void print_cpuinfo() { #ifdef __linux__ cout << "contents of /proc/cpuinfo:" << endl; string line; ifstream cpuinfo("/proc/cpuinfo"); if (cpuinfo.is_open()) { while (getline(cpuinfo, line)) { cout << line << endl; } cpuinfo.close(); } cout << endl; #elif defined __APPLE__ cout << "output of sysctl hw:" << endl; system("sysctl hw"); cout << endl; #endif } template string type_name() { return "unknown"; } template<> string type_name() { return "float"; } template<> string type_name() { return "double"; } struct action_t { virtual const char* invokation_name() const { abort(); return nullptr; } virtual void run() const { abort(); } virtual ~action_t() {} }; void show_usage_and_exit(int /*argc*/, char* argv[], const vector>& available_actions) { cerr << "usage: " << argv[0] << " [options...]" << endl << endl; cerr << "available actions:" << endl << endl; for (auto it = available_actions.begin(); it != available_actions.end(); ++it) { cerr << " " << (*it)->invokation_name() << endl; } cerr << endl; cerr << "options:" << endl << endl; cerr << " --min-working-set-size=N:" << endl; cerr << " Set the minimum working set size to N bytes." << endl; cerr << " This is rounded up as needed to a multiple of matrix size." << endl; cerr << " A larger working set lowers the chance of a warm cache." << endl; cerr << " The default value 0 means use a large enough working" << endl; cerr << " set to likely outsize caches." << endl; cerr << " A value of 1 (that is, 1 byte) would mean don't do anything to" << endl; cerr << " avoid warm caches." << endl; exit(1); } float measure_clock_speed() { cerr << "Measuring clock speed... \r" << flush; vector all_gflops; for (int i = 0; i < 8; i++) { benchmark_t b(1024, 1024, 1024); b.run(); all_gflops.push_back(b.gflops); } sort(all_gflops.begin(), all_gflops.end()); float stable_estimate = all_gflops[2] + all_gflops[3] + all_gflops[4] + all_gflops[5]; // multiply by an arbitrary constant to discourage trying doing anything with the // returned values besides just comparing them with each other. float result = stable_estimate * 123.456f; return result; } struct human_duration_t { int seconds; human_duration_t(int s) : seconds(s) {} }; ostream& operator<<(ostream& s, const human_duration_t& d) { int remainder = d.seconds; if (remainder > 3600) { int hours = remainder / 3600; s << hours << " h "; remainder -= hours * 3600; } if (remainder > 60) { int minutes = remainder / 60; s << minutes << " min "; remainder -= minutes * 60; } if (d.seconds < 600) { s << remainder << " s"; } return s; } const char session_filename[] = "/data/local/tmp/benchmark-blocking-sizes-session.data"; void serialize_benchmarks(const char* filename, const vector& benchmarks, size_t first_benchmark_to_run) { FILE* file = fopen(filename, "w"); if (!file) { cerr << "Could not open file " << filename << " for writing." << endl; cerr << "Do you have write permissions on the current working directory?" << endl; exit(1); } size_t benchmarks_vector_size = benchmarks.size(); fwrite(&max_clock_speed, sizeof(max_clock_speed), 1, file); fwrite(&benchmarks_vector_size, sizeof(benchmarks_vector_size), 1, file); fwrite(&first_benchmark_to_run, sizeof(first_benchmark_to_run), 1, file); fwrite(benchmarks.data(), sizeof(benchmark_t), benchmarks.size(), file); fclose(file); } bool deserialize_benchmarks(const char* filename, vector& benchmarks, size_t& first_benchmark_to_run) { FILE* file = fopen(filename, "r"); if (!file) { return false; } if (1 != fread(&max_clock_speed, sizeof(max_clock_speed), 1, file)) { return false; } size_t benchmarks_vector_size = 0; if (1 != fread(&benchmarks_vector_size, sizeof(benchmarks_vector_size), 1, file)) { return false; } if (1 != fread(&first_benchmark_to_run, sizeof(first_benchmark_to_run), 1, file)) { return false; } benchmarks.resize(benchmarks_vector_size); if (benchmarks.size() != fread(benchmarks.data(), sizeof(benchmark_t), benchmarks.size(), file)) { return false; } unlink(filename); return true; } void try_run_some_benchmarks( vector& benchmarks, double time_start, size_t& first_benchmark_to_run) { if (first_benchmark_to_run == benchmarks.size()) { return; } double time_last_progress_update = 0; double time_last_clock_speed_measurement = 0; double time_now = 0; size_t benchmark_index = first_benchmark_to_run; while (true) { float ratio_done = float(benchmark_index) / benchmarks.size(); time_now = timer.getRealTime(); // We check clock speed every minute and at the end. if (benchmark_index == benchmarks.size() || time_now > time_last_clock_speed_measurement + 60.0f) { time_last_clock_speed_measurement = time_now; // Ensure that clock speed is as expected float current_clock_speed = measure_clock_speed(); // The tolerance needs to be smaller than the relative difference between // clock speeds that a device could operate under. // It seems unlikely that a device would be throttling clock speeds by // amounts smaller than 2%. // With a value of 1%, I was getting within noise on a Sandy Bridge. const float clock_speed_tolerance = 0.02f; if (current_clock_speed > (1 + clock_speed_tolerance) * max_clock_speed) { // Clock speed is now higher than we previously measured. // Either our initial measurement was inaccurate, which won't happen // too many times as we are keeping the best clock speed value and // and allowing some tolerance; or something really weird happened, // which invalidates all benchmark results collected so far. // Either way, we better restart all over again now. if (benchmark_index) { cerr << "Restarting at " << 100.0f * ratio_done << " % because clock speed increased. " << endl; } max_clock_speed = current_clock_speed; first_benchmark_to_run = 0; return; } bool rerun_last_tests = false; if (current_clock_speed < (1 - clock_speed_tolerance) * max_clock_speed) { cerr << "Measurements completed so far: " << 100.0f * ratio_done << " % " << endl; cerr << "Clock speed seems to be only " << current_clock_speed/max_clock_speed << " times what it used to be." << endl; unsigned int seconds_to_sleep_if_lower_clock_speed = 1; while (current_clock_speed < (1 - clock_speed_tolerance) * max_clock_speed) { if (seconds_to_sleep_if_lower_clock_speed > 32) { cerr << "Sleeping longer probably won't make a difference." << endl; cerr << "Serializing benchmarks to " << session_filename << endl; serialize_benchmarks(session_filename, benchmarks, first_benchmark_to_run); cerr << "Now restart this benchmark, and it should pick up where we left." << endl; exit(2); } rerun_last_tests = true; cerr << "Sleeping " << seconds_to_sleep_if_lower_clock_speed << " s... \r" << endl; sleep(seconds_to_sleep_if_lower_clock_speed); current_clock_speed = measure_clock_speed(); seconds_to_sleep_if_lower_clock_speed *= 2; } } if (rerun_last_tests) { cerr << "Redoing the last " << 100.0f * float(benchmark_index - first_benchmark_to_run) / benchmarks.size() << " % because clock speed had been low. " << endl; return; } // nothing wrong with the clock speed so far, so there won't be a need to rerun // benchmarks run so far in case we later encounter a lower clock speed. first_benchmark_to_run = benchmark_index; } if (benchmark_index == benchmarks.size()) { // We're done! first_benchmark_to_run = benchmarks.size(); // Erase progress info cerr << " " << endl; return; } // Display progress info on stderr if (time_now > time_last_progress_update + 1.0f) { time_last_progress_update = time_now; cerr << "Measurements... " << 100.0f * ratio_done << " %, ETA " << human_duration_t(float(time_now - time_start) * (1.0f - ratio_done) / ratio_done) << " \r" << flush; } // This is where we actually run a benchmark! benchmarks[benchmark_index].run(); benchmark_index++; } } void run_benchmarks(vector& benchmarks) { size_t first_benchmark_to_run; vector deserialized_benchmarks; bool use_deserialized_benchmarks = false; if (deserialize_benchmarks(session_filename, deserialized_benchmarks, first_benchmark_to_run)) { cerr << "Found serialized session with " << 100.0f * first_benchmark_to_run / deserialized_benchmarks.size() << " % already done" << endl; if (deserialized_benchmarks.size() == benchmarks.size() && first_benchmark_to_run > 0 && first_benchmark_to_run < benchmarks.size()) { use_deserialized_benchmarks = true; } } if (use_deserialized_benchmarks) { benchmarks = deserialized_benchmarks; } else { // not using deserialized benchmarks, starting from scratch first_benchmark_to_run = 0; // Randomly shuffling benchmarks allows us to get accurate enough progress info, // as now the cheap/expensive benchmarks are randomly mixed so they average out. // It also means that if data is corrupted for some time span, the odds are that // not all repetitions of a given benchmark will be corrupted. random_shuffle(benchmarks.begin(), benchmarks.end()); } for (int i = 0; i < 4; i++) { max_clock_speed = max(max_clock_speed, measure_clock_speed()); } double time_start = 0.0; while (first_benchmark_to_run < benchmarks.size()) { if (first_benchmark_to_run == 0) { time_start = timer.getRealTime(); } try_run_some_benchmarks(benchmarks, time_start, first_benchmark_to_run); } // Sort timings by increasing benchmark parameters, and decreasing gflops. // The latter is very important. It means that we can ignore all but the first // benchmark with given parameters. sort(benchmarks.begin(), benchmarks.end()); // Collect best (i.e. now first) results for each parameter values. vector best_benchmarks; for (auto it = benchmarks.begin(); it != benchmarks.end(); ++it) { if (best_benchmarks.empty() || best_benchmarks.back().compact_product_size != it->compact_product_size || best_benchmarks.back().compact_block_size != it->compact_block_size) { best_benchmarks.push_back(*it); } } // keep and return only the best benchmarks benchmarks = best_benchmarks; } struct measure_all_pot_sizes_action_t : action_t { virtual const char* invokation_name() const { return "all-pot-sizes"; } virtual void run() const { vector benchmarks; for (int repetition = 0; repetition < measurement_repetitions; repetition++) { for (size_t ksize = minsize; ksize <= maxsize; ksize *= 2) { for (size_t msize = minsize; msize <= maxsize; msize *= 2) { for (size_t nsize = minsize; nsize <= maxsize; nsize *= 2) { for (size_t kblock = minsize; kblock <= ksize; kblock *= 2) { for (size_t mblock = minsize; mblock <= msize; mblock *= 2) { for (size_t nblock = minsize; nblock <= nsize; nblock *= 2) { benchmarks.emplace_back(ksize, msize, nsize, kblock, mblock, nblock); } } } } } } } run_benchmarks(benchmarks); cout << "BEGIN MEASUREMENTS ALL POT SIZES" << endl; for (auto it = benchmarks.begin(); it != benchmarks.end(); ++it) { cout << *it << endl; } } }; struct measure_default_sizes_action_t : action_t { virtual const char* invokation_name() const { return "default-sizes"; } virtual void run() const { vector benchmarks; for (int repetition = 0; repetition < measurement_repetitions; repetition++) { for (size_t ksize = minsize; ksize <= maxsize; ksize *= 2) { for (size_t msize = minsize; msize <= maxsize; msize *= 2) { for (size_t nsize = minsize; nsize <= maxsize; nsize *= 2) { benchmarks.emplace_back(ksize, msize, nsize); } } } } run_benchmarks(benchmarks); cout << "BEGIN MEASUREMENTS DEFAULT SIZES" << endl; for (auto it = benchmarks.begin(); it != benchmarks.end(); ++it) { cout << *it << endl; } } }; int main(int argc, char* argv[]) { double time_start = timer.getRealTime(); cout.precision(4); cerr.precision(4); vector> available_actions; available_actions.emplace_back(new measure_all_pot_sizes_action_t); available_actions.emplace_back(new measure_default_sizes_action_t); auto action = available_actions.end(); if (argc <= 1) { show_usage_and_exit(argc, argv, available_actions); } for (auto it = available_actions.begin(); it != available_actions.end(); ++it) { if (!strcmp(argv[1], (*it)->invokation_name())) { action = it; break; } } if (action == available_actions.end()) { show_usage_and_exit(argc, argv, available_actions); } for (int i = 2; i < argc; i++) { if (argv[i] == strstr(argv[i], "--min-working-set-size=")) { const char* equals_sign = strchr(argv[i], '='); min_working_set_size = strtoul(equals_sign+1, nullptr, 10); } else { cerr << "unrecognized option: " << argv[i] << endl << endl; show_usage_and_exit(argc, argv, available_actions); } } print_cpuinfo(); cout << "benchmark parameters:" << endl; cout << "pointer size: " << 8*sizeof(void*) << " bits" << endl; cout << "scalar type: " << type_name() << endl; cout << "packet size: " << internal::packet_traits::size << endl; cout << "minsize = " << minsize << endl; cout << "maxsize = " << maxsize << endl; cout << "measurement_repetitions = " << measurement_repetitions << endl; cout << "min_accurate_time = " << min_accurate_time << endl; cout << "min_working_set_size = " << min_working_set_size; if (min_working_set_size == 0) { cout << " (try to outsize caches)"; } cout << endl << endl; (*action)->run(); double time_end = timer.getRealTime(); cerr << "Finished in " << human_duration_t(time_end - time_start) << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/benchmark.cpp ================================================ // g++ -O3 -DNDEBUG -DMATSIZE= benchmark.cpp -o benchmark && time ./benchmark #include #include #ifndef MATSIZE #define MATSIZE 3 #endif using namespace std; using namespace Eigen; #ifndef REPEAT #define REPEAT 40000000 #endif #ifndef SCALAR #define SCALAR double #endif int main(int argc, char *argv[]) { Matrix I = Matrix::Ones(); Matrix m; for(int i = 0; i < MATSIZE; i++) for(int j = 0; j < MATSIZE; j++) { m(i,j) = (i+MATSIZE*j); } asm("#begin"); for(int a = 0; a < REPEAT; a++) { m = Matrix::Ones() + 0.00005 * (m + (m*m)); } asm("#end"); cout << m << endl; return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/benchmarkSlice.cpp ================================================ // g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX #include #include using namespace std; using namespace Eigen; #ifndef REPEAT #define REPEAT 10000 #endif #ifndef SCALAR #define SCALAR float #endif int main(int argc, char *argv[]) { typedef Matrix Mat; Mat m(100, 100); m.setRandom(); for(int a = 0; a < REPEAT; a++) { int r, c, nr, nc; r = Eigen::internal::random(0,10); c = Eigen::internal::random(0,10); nr = Eigen::internal::random(50,80); nc = Eigen::internal::random(50,80); m.block(r,c,nr,nc) += Mat::Ones(nr,nc); m.block(r,c,nr,nc) *= SCALAR(10); m.block(r,c,nr,nc) -= Mat::constant(nr,nc,10); m.block(r,c,nr,nc) /= SCALAR(10); } cout << m[0] << endl; return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/benchmarkX.cpp ================================================ // g++ -fopenmp -I .. -O3 -DNDEBUG -finline-limit=1000 benchmarkX.cpp -o b && time ./b #include #include using namespace std; using namespace Eigen; #ifndef MATTYPE #define MATTYPE MatrixXLd #endif #ifndef MATSIZE #define MATSIZE 400 #endif #ifndef REPEAT #define REPEAT 100 #endif int main(int argc, char *argv[]) { MATTYPE I = MATTYPE::Ones(MATSIZE,MATSIZE); MATTYPE m(MATSIZE,MATSIZE); for(int i = 0; i < MATSIZE; i++) for(int j = 0; j < MATSIZE; j++) { m(i,j) = (i+j+1)/(MATSIZE*MATSIZE); } for(int a = 0; a < REPEAT; a++) { m = I + 0.0001 * (m + m*m); } cout << m(0,0) << endl; return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/benchmarkXcwise.cpp ================================================ // g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX #include #include using namespace std; using namespace Eigen; #ifndef VECTYPE #define VECTYPE VectorXLd #endif #ifndef VECSIZE #define VECSIZE 1000000 #endif #ifndef REPEAT #define REPEAT 1000 #endif int main(int argc, char *argv[]) { VECTYPE I = VECTYPE::Ones(VECSIZE); VECTYPE m(VECSIZE,1); for(int i = 0; i < VECSIZE; i++) { m[i] = 0.1 * i/VECSIZE; } for(int a = 0; a < REPEAT; a++) { m = VECTYPE::Ones(VECSIZE) + 0.00005 * (m.cwise().square() + m/4); } cout << m[0] << endl; return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/benchmark_suite ================================================ #!/bin/bash CXX=${CXX-g++} # default value unless caller has defined CXX echo "Fixed size 3x3, column-major, -DNDEBUG" $CXX -O3 -I .. -DNDEBUG benchmark.cpp -o benchmark && time ./benchmark >/dev/null echo "Fixed size 3x3, column-major, with asserts" $CXX -O3 -I .. benchmark.cpp -o benchmark && time ./benchmark >/dev/null echo "Fixed size 3x3, row-major, -DNDEBUG" $CXX -O3 -I .. -DEIGEN_DEFAULT_TO_ROW_MAJOR -DNDEBUG benchmark.cpp -o benchmark && time ./benchmark >/dev/null echo "Fixed size 3x3, row-major, with asserts" $CXX -O3 -I .. -DEIGEN_DEFAULT_TO_ROW_MAJOR benchmark.cpp -o benchmark && time ./benchmark >/dev/null echo "Dynamic size 20x20, column-major, -DNDEBUG" $CXX -O3 -I .. -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX >/dev/null echo "Dynamic size 20x20, column-major, with asserts" $CXX -O3 -I .. benchmarkX.cpp -o benchmarkX && time ./benchmarkX >/dev/null echo "Dynamic size 20x20, row-major, -DNDEBUG" $CXX -O3 -I .. -DEIGEN_DEFAULT_TO_ROW_MAJOR -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX >/dev/null echo "Dynamic size 20x20, row-major, with asserts" $CXX -O3 -I .. -DEIGEN_DEFAULT_TO_ROW_MAJOR benchmarkX.cpp -o benchmarkX && time ./benchmarkX >/dev/null ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/CMakeLists.txt ================================================ project(BTL) cmake_minimum_required(VERSION 2.6.2) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${Eigen_SOURCE_DIR}/cmake) include(MacroOptionalAddSubdirectory) option(BTL_NOVEC "Disable SSE/Altivec optimizations when possible" OFF) set(CMAKE_INCLUDE_CURRENT_DIR ON) string(REGEX MATCH icpc IS_ICPC ${CMAKE_CXX_COMPILER}) if(CMAKE_COMPILER_IS_GNUCXX OR IS_ICPC) set(CMAKE_CXX_FLAGS "-g0 -O3 -DNDEBUG ${CMAKE_CXX_FLAGS}") set(CMAKE_Fortran_FLAGS "-g0 -O3 -DNDEBUG ${CMAKE_Fortran_FLAGS}") if(BTL_NOVEC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_DONT_VECTORIZE") endif(BTL_NOVEC) endif(CMAKE_COMPILER_IS_GNUCXX OR IS_ICPC) if(MSVC) set(CMAKE_CXX_FLAGS " /O2 /Ot /GL /fp:fast -DNDEBUG") # set(CMAKE_Fortran_FLAGS "-g0 -O3 -DNDEBUG") if(BTL_NOVEC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_DONT_VECTORIZE") endif(BTL_NOVEC) endif(MSVC) if(IS_ICPC) set(CMAKE_CXX_FLAGS "-fast ${CMAKE_CXX_FLAGS}") set(CMAKE_Fortran_FLAGS "-fast ${CMAKE_Fortran_FLAGS}") endif() include_directories( ${PROJECT_SOURCE_DIR}/actions ${PROJECT_SOURCE_DIR}/generic_bench ${PROJECT_SOURCE_DIR}/generic_bench/utils ${PROJECT_SOURCE_DIR}/libs/STL) # find_package(MKL) # if (MKL_FOUND) # add_definitions(-DHAVE_MKL) # set(DEFAULT_LIBRARIES ${MKL_LIBRARIES}) # endif () find_library(EIGEN_BTL_RT_LIBRARY rt) # if we cannot find it easily, then we don't need it! if(NOT EIGEN_BTL_RT_LIBRARY) set(EIGEN_BTL_RT_LIBRARY "") endif() macro(BTL_ADD_BENCH targetname) foreach(_current_var ${ARGN}) set(_last_var ${_current_var}) endforeach() set(_sources ${ARGN}) list(LENGTH _sources _argn_length) list(REMOVE_ITEM _sources ON OFF TRUE FALSE) list(LENGTH _sources _src_length) if (${_argn_length} EQUAL ${_src_length}) set(_last_var ON) endif () option(BUILD_${targetname} "Build benchmark ${targetname}" ${_last_var}) if(BUILD_${targetname}) add_executable(${targetname} ${_sources}) add_test(${targetname} "${targetname}") target_link_libraries(${targetname} ${DEFAULT_LIBRARIES} ${EIGEN_BTL_RT_LIBRARY}) endif(BUILD_${targetname}) endmacro(BTL_ADD_BENCH) macro(btl_add_target_property target prop value) if(BUILD_${target}) get_target_property(previous ${target} ${prop}) if(NOT previous) set(previous "") endif() set_target_properties(${target} PROPERTIES ${prop} "${previous} ${value}") endif() endmacro() enable_testing() add_subdirectory(libs/eigen3) add_subdirectory(libs/eigen2) add_subdirectory(libs/tensors) add_subdirectory(libs/BLAS) add_subdirectory(libs/ublas) add_subdirectory(libs/gmm) add_subdirectory(libs/mtl4) add_subdirectory(libs/blitz) add_subdirectory(libs/tvmet) add_subdirectory(libs/STL) add_subdirectory(libs/blaze) add_subdirectory(data) ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/COPYING ================================================ GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) 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 this service 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 make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. 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. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. 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 Program or any portion of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, 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 Program, 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 Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) 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; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, 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 executable. However, as a special exception, the source code 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. If distribution of executable or 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 counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program 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. 5. 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 Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program 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 to this License. 7. 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 Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program 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 Program. 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. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program 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. 9. The Free Software Foundation may publish revised and/or new versions of the 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 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 Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, 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 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. 12. 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 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. 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 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 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 2 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision 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, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This 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 Library General Public License instead of this License. ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/README ================================================ Bench Template Library **************************************** Introduction : The aim of this project is to compare the performance of available numerical libraries. The code is designed as generic and modular as possible. Thus, adding new numerical libraries or new numerical tests should require minimal effort. ***************************************** Installation : BTL uses cmake / ctest: 1 - create a build directory: $ mkdir build $ cd build 2 - configure: $ ccmake .. 3 - run the bench using ctest: $ ctest -V You can run the benchmarks only on libraries matching a given regular expression: ctest -V -R For instance: ctest -V -R eigen2 You can also select a given set of actions defining the environment variable BTL_CONFIG this way: BTL_CONFIG="-a action1{:action2}*" ctest -V An example: BTL_CONFIG="-a axpy:vector_matrix:trisolve:ata" ctest -V -R eigen2 Finally, if bench results already exist (the bench*.dat files) then they merges by keeping the best for each matrix size. If you want to overwrite the previous ones you can simply add the "--overwrite" option: BTL_CONFIG="-a axpy:vector_matrix:trisolve:ata --overwrite" ctest -V -R eigen2 4 : Analyze the result. different data files (.dat) are produced in each libs directories. If gnuplot is available, choose a directory name in the data directory to store the results and type: $ cd data $ mkdir my_directory $ cp ../libs/*/*.dat my_directory Build the data utilities in this (data) directory make Then you can look the raw data, go_mean my_directory or smooth the data first : smooth_all.sh my_directory go_mean my_directory_smooth ************************************************* Files and directories : generic_bench : all the bench sources common to all libraries actions : sources for different action wrappers (axpy, matrix-matrix product) to be tested. libs/* : bench sources specific to each tested libraries. machine_dep : directory used to store machine specific Makefile.in data : directory used to store gnuplot scripts and data analysis utilities ************************************************** Principles : the code modularity is achieved by defining two concepts : ****** Action concept : This is a class defining which kind of test must be performed (e.g. a matrix_vector_product). An Action should define the following methods : *** Ctor using the size of the problem (matrix or vector size) as an argument Action action(size); *** initialize : this method initialize the calculation (e.g. initialize the matrices and vectors arguments) action.initialize(); *** calculate : this method actually launch the calculation to be benchmarked action.calculate; *** nb_op_base() : this method returns the complexity of the calculate method (allowing the mflops evaluation) *** name() : this method returns the name of the action (std::string) ****** Interface concept : This is a class or namespace defining how to use a given library and its specific containers (matrix and vector). Up to now an interface should following types *** real_type : kind of float to be used (float or double) *** stl_vector : must correspond to std::vector *** stl_matrix : must correspond to std::vector *** gene_vector : the vector type for this interface --> e.g. (real_type *) for the C_interface *** gene_matrix : the matrix type for this interface --> e.g. (gene_vector *) for the C_interface + the following common methods *** free_matrix(gene_matrix & A, int N) dealocation of a N sized gene_matrix A *** free_vector(gene_vector & B) dealocation of a N sized gene_vector B *** matrix_from_stl(gene_matrix & A, stl_matrix & A_stl) copy the content of an stl_matrix A_stl into a gene_matrix A. The allocation of A is done in this function. *** vector_to_stl(gene_vector & B, stl_vector & B_stl) copy the content of an stl_vector B_stl into a gene_vector B. The allocation of B is done in this function. *** matrix_to_stl(gene_matrix & A, stl_matrix & A_stl) copy the content of an gene_matrix A into an stl_matrix A_stl. The size of A_STL must corresponds to the size of A. *** vector_to_stl(gene_vector & A, stl_vector & A_stl) copy the content of an gene_vector A into an stl_vector A_stl. The size of B_STL must corresponds to the size of B. *** copy_matrix(gene_matrix & source, gene_matrix & cible, int N) : copy the content of source in cible. Both source and cible must be sized NxN. *** copy_vector(gene_vector & source, gene_vector & cible, int N) : copy the content of source in cible. Both source and cible must be sized N. and the following method corresponding to the action one wants to be benchmarked : *** matrix_vector_product(const gene_matrix & A, const gene_vector & B, gene_vector & X, int N) *** matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N) *** ata_product(const gene_matrix & A, gene_matrix & X, int N) *** aat_product(const gene_matrix & A, gene_matrix & X, int N) *** axpy(real coef, const gene_vector & X, gene_vector & Y, int N) The bench algorithm (generic_bench/bench.hh) is templated with an action itself templated with an interface. A typical main.cpp source stored in a given library directory libs/A_LIB looks like : bench< AN_ACTION < AN_INTERFACE > >( 10 , 1000 , 50 ) ; this function will produce XY data file containing measured mflops as a function of the size for 50 sizes between 10 and 10000. This algorithm can be adapted by providing a given Perf_Analyzer object which determines how the time measurements must be done. For example, the X86_Perf_Analyzer use the asm rdtsc function and provides a very fast and accurate (but less portable) timing method. The default is the Portable_Perf_Analyzer so bench< AN_ACTION < AN_INTERFACE > >( 10 , 1000 , 50 ) ; is equivalent to bench< Portable_Perf_Analyzer,AN_ACTION < AN_INTERFACE > >( 10 , 1000 , 50 ) ; If your system supports it we suggest to use a mixed implementation (X86_perf_Analyzer+Portable_Perf_Analyzer). replace bench(size_min,size_max,nb_point); with bench(size_min,size_max,nb_point); in generic/bench.hh . ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/actions/action_aat_product.hh ================================================ //===================================================== // File : action_aat_product.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef ACTION_AAT_PRODUCT #define ACTION_AAT_PRODUCT #include "utilities.h" #include "STL_interface.hh" #include #include "init/init_function.hh" #include "init/init_vector.hh" #include "init/init_matrix.hh" using namespace std; template class Action_aat_product { public : // Ctor Action_aat_product( int size ):_size(size) { MESSAGE("Action_aat_product Ctor"); // STL matrix and vector initialization init_matrix(A_stl,_size); init_matrix(X_stl,_size); init_matrix(resu_stl,_size); // generic matrix and vector initialization Interface::matrix_from_stl(A_ref,A_stl); Interface::matrix_from_stl(X_ref,X_stl); Interface::matrix_from_stl(A,A_stl); Interface::matrix_from_stl(X,X_stl); } // invalidate copy ctor Action_aat_product( const Action_aat_product & ) { INFOS("illegal call to Action_aat_product Copy Ctor"); exit(0); } // Dtor ~Action_aat_product( void ){ MESSAGE("Action_aat_product Dtor"); // deallocation Interface::free_matrix(A,_size); Interface::free_matrix(X,_size); Interface::free_matrix(A_ref,_size); Interface::free_matrix(X_ref,_size); } // action name static inline std::string name( void ) { return "aat_"+Interface::name(); } double nb_op_base( void ){ return double(_size)*double(_size)*double(_size); } inline void initialize( void ){ Interface::copy_matrix(A_ref,A,_size); Interface::copy_matrix(X_ref,X,_size); } inline void calculate( void ) { Interface::aat_product(A,X,_size); } void check_result( void ){ if (_size>128) return; // calculation check Interface::matrix_to_stl(X,resu_stl); STL_interface::aat_product(A_stl,X_stl,_size); typename Interface::real_type error= STL_interface::norm_diff(X_stl,resu_stl); if (error>1.e-6){ INFOS("WRONG CALCULATION...residual=" << error); exit(1); } } private : typename Interface::stl_matrix A_stl; typename Interface::stl_matrix X_stl; typename Interface::stl_matrix resu_stl; typename Interface::gene_matrix A_ref; typename Interface::gene_matrix X_ref; typename Interface::gene_matrix A; typename Interface::gene_matrix X; int _size; }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/actions/action_ata_product.hh ================================================ //===================================================== // File : action_ata_product.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef ACTION_ATA_PRODUCT #define ACTION_ATA_PRODUCT #include "utilities.h" #include "STL_interface.hh" #include #include "init/init_function.hh" #include "init/init_vector.hh" #include "init/init_matrix.hh" using namespace std; template class Action_ata_product { public : // Ctor Action_ata_product( int size ):_size(size) { MESSAGE("Action_ata_product Ctor"); // STL matrix and vector initialization init_matrix(A_stl,_size); init_matrix(X_stl,_size); init_matrix(resu_stl,_size); // generic matrix and vector initialization Interface::matrix_from_stl(A_ref,A_stl); Interface::matrix_from_stl(X_ref,X_stl); Interface::matrix_from_stl(A,A_stl); Interface::matrix_from_stl(X,X_stl); } // invalidate copy ctor Action_ata_product( const Action_ata_product & ) { INFOS("illegal call to Action_ata_product Copy Ctor"); exit(0); } // Dtor ~Action_ata_product( void ){ MESSAGE("Action_ata_product Dtor"); // deallocation Interface::free_matrix(A,_size); Interface::free_matrix(X,_size); Interface::free_matrix(A_ref,_size); Interface::free_matrix(X_ref,_size); } // action name static inline std::string name( void ) { return "ata_"+Interface::name(); } double nb_op_base( void ){ return 2.0*_size*_size*_size; } inline void initialize( void ){ Interface::copy_matrix(A_ref,A,_size); Interface::copy_matrix(X_ref,X,_size); } inline void calculate( void ) { Interface::ata_product(A,X,_size); } void check_result( void ){ if (_size>128) return; // calculation check Interface::matrix_to_stl(X,resu_stl); STL_interface::ata_product(A_stl,X_stl,_size); typename Interface::real_type error= STL_interface::norm_diff(X_stl,resu_stl); if (error>1.e-6){ INFOS("WRONG CALCULATION...residual=" << error); exit(1); } } private : typename Interface::stl_matrix A_stl; typename Interface::stl_matrix X_stl; typename Interface::stl_matrix resu_stl; typename Interface::gene_matrix A_ref; typename Interface::gene_matrix X_ref; typename Interface::gene_matrix A; typename Interface::gene_matrix X; int _size; }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/actions/action_atv_product.hh ================================================ //===================================================== // File : action_atv_product.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef ACTION_ATV_PRODUCT #define ACTION_ATV_PRODUCT #include "utilities.h" #include "STL_interface.hh" #include #include "init/init_function.hh" #include "init/init_vector.hh" #include "init/init_matrix.hh" using namespace std; template class Action_atv_product { public : Action_atv_product( int size ) : _size(size) { MESSAGE("Action_atv_product Ctor"); // STL matrix and vector initialization init_matrix(A_stl,_size); init_vector(B_stl,_size); init_vector(X_stl,_size); init_vector(resu_stl,_size); // generic matrix and vector initialization Interface::matrix_from_stl(A_ref,A_stl); Interface::vector_from_stl(B_ref,B_stl); Interface::vector_from_stl(X_ref,X_stl); Interface::matrix_from_stl(A,A_stl); Interface::vector_from_stl(B,B_stl); Interface::vector_from_stl(X,X_stl); } // invalidate copy ctor Action_atv_product( const Action_atv_product & ) { INFOS("illegal call to Action_atv_product Copy Ctor"); exit(1); } ~Action_atv_product( void ) { MESSAGE("Action_atv_product Dtor"); Interface::free_matrix(A,_size); Interface::free_vector(B); Interface::free_vector(X); Interface::free_matrix(A_ref,_size); Interface::free_vector(B_ref); Interface::free_vector(X_ref); } static inline std::string name() { return "atv_" + Interface::name(); } double nb_op_base( void ) { return 2.0*_size*_size; } inline void initialize( void ){ Interface::copy_matrix(A_ref,A,_size); Interface::copy_vector(B_ref,B,_size); Interface::copy_vector(X_ref,X,_size); } BTL_DONT_INLINE void calculate( void ) { BTL_ASM_COMMENT("begin atv"); Interface::atv_product(A,B,X,_size); BTL_ASM_COMMENT("end atv"); } void check_result( void ) { if (_size>128) return; Interface::vector_to_stl(X,resu_stl); STL_interface::atv_product(A_stl,B_stl,X_stl,_size); typename Interface::real_type error= STL_interface::norm_diff(X_stl,resu_stl); if (error>1.e-6){ INFOS("WRONG CALCULATION...residual=" << error); exit(1); } } private : typename Interface::stl_matrix A_stl; typename Interface::stl_vector B_stl; typename Interface::stl_vector X_stl; typename Interface::stl_vector resu_stl; typename Interface::gene_matrix A_ref; typename Interface::gene_vector B_ref; typename Interface::gene_vector X_ref; typename Interface::gene_matrix A; typename Interface::gene_vector B; typename Interface::gene_vector X; int _size; }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/actions/action_axpby.hh ================================================ //===================================================== // File : action_axpby.hh // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef ACTION_AXPBY #define ACTION_AXPBY #include "utilities.h" #include "STL_interface.hh" #include #include "init/init_function.hh" #include "init/init_vector.hh" #include "init/init_matrix.hh" using namespace std; template class Action_axpby { public : // Ctor Action_axpby( int size ):_alpha(0.5),_beta(0.95),_size(size) { MESSAGE("Action_axpby Ctor"); // STL vector initialization init_vector(X_stl,_size); init_vector(Y_stl,_size); init_vector(resu_stl,_size); // generic matrix and vector initialization Interface::vector_from_stl(X_ref,X_stl); Interface::vector_from_stl(Y_ref,Y_stl); Interface::vector_from_stl(X,X_stl); Interface::vector_from_stl(Y,Y_stl); } // invalidate copy ctor Action_axpby( const Action_axpby & ) { INFOS("illegal call to Action_axpby Copy Ctor"); exit(1); } // Dtor ~Action_axpby( void ){ MESSAGE("Action_axpby Dtor"); // deallocation Interface::free_vector(X_ref); Interface::free_vector(Y_ref); Interface::free_vector(X); Interface::free_vector(Y); } // action name static inline std::string name( void ) { return "axpby_"+Interface::name(); } double nb_op_base( void ){ return 3.0*_size; } inline void initialize( void ){ Interface::copy_vector(X_ref,X,_size); Interface::copy_vector(Y_ref,Y,_size); } inline void calculate( void ) { BTL_ASM_COMMENT("mybegin axpby"); Interface::axpby(_alpha,X,_beta,Y,_size); BTL_ASM_COMMENT("myend axpby"); } void check_result( void ){ if (_size>128) return; // calculation check Interface::vector_to_stl(Y,resu_stl); STL_interface::axpby(_alpha,X_stl,_beta,Y_stl,_size); typename Interface::real_type error= STL_interface::norm_diff(Y_stl,resu_stl); if (error>1.e-6){ INFOS("WRONG CALCULATION...residual=" << error); exit(2); } } private : typename Interface::stl_vector X_stl; typename Interface::stl_vector Y_stl; typename Interface::stl_vector resu_stl; typename Interface::gene_vector X_ref; typename Interface::gene_vector Y_ref; typename Interface::gene_vector X; typename Interface::gene_vector Y; typename Interface::real_type _alpha; typename Interface::real_type _beta; int _size; }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/actions/action_axpy.hh ================================================ //===================================================== // File : action_axpy.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef ACTION_AXPY #define ACTION_AXPY #include "utilities.h" #include "STL_interface.hh" #include #include "init/init_function.hh" #include "init/init_vector.hh" #include "init/init_matrix.hh" using namespace std; template class Action_axpy { public : // Ctor Action_axpy( int size ):_coef(1.0),_size(size) { MESSAGE("Action_axpy Ctor"); // STL vector initialization init_vector(X_stl,_size); init_vector(Y_stl,_size); init_vector(resu_stl,_size); // generic matrix and vector initialization Interface::vector_from_stl(X_ref,X_stl); Interface::vector_from_stl(Y_ref,Y_stl); Interface::vector_from_stl(X,X_stl); Interface::vector_from_stl(Y,Y_stl); } // invalidate copy ctor Action_axpy( const Action_axpy & ) { INFOS("illegal call to Action_axpy Copy Ctor"); exit(1); } // Dtor ~Action_axpy( void ){ MESSAGE("Action_axpy Dtor"); // deallocation Interface::free_vector(X_ref); Interface::free_vector(Y_ref); Interface::free_vector(X); Interface::free_vector(Y); } // action name static inline std::string name( void ) { return "axpy_"+Interface::name(); } double nb_op_base( void ){ return 2.0*_size; } inline void initialize( void ){ Interface::copy_vector(X_ref,X,_size); Interface::copy_vector(Y_ref,Y,_size); } inline void calculate( void ) { BTL_ASM_COMMENT("mybegin axpy"); Interface::axpy(_coef,X,Y,_size); BTL_ASM_COMMENT("myend axpy"); } void check_result( void ){ if (_size>128) return; // calculation check Interface::vector_to_stl(Y,resu_stl); STL_interface::axpy(_coef,X_stl,Y_stl,_size); typename Interface::real_type error= STL_interface::norm_diff(Y_stl,resu_stl); if (error>1.e-6){ INFOS("WRONG CALCULATION...residual=" << error); exit(0); } } private : typename Interface::stl_vector X_stl; typename Interface::stl_vector Y_stl; typename Interface::stl_vector resu_stl; typename Interface::gene_vector X_ref; typename Interface::gene_vector Y_ref; typename Interface::gene_vector X; typename Interface::gene_vector Y; typename Interface::real_type _coef; int _size; }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/actions/action_cholesky.hh ================================================ //===================================================== // File : action_cholesky.hh // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef ACTION_CHOLESKY #define ACTION_CHOLESKY #include "utilities.h" #include "STL_interface.hh" #include #include "init/init_function.hh" #include "init/init_vector.hh" #include "init/init_matrix.hh" using namespace std; template class Action_cholesky { public : // Ctor Action_cholesky( int size ):_size(size) { MESSAGE("Action_cholesky Ctor"); // STL mat/vec initialization init_matrix_symm(X_stl,_size); init_matrix(C_stl,_size); // make sure X is invertible for (int i=0; i<_size; ++i) X_stl[i][i] = std::abs(X_stl[i][i]) * 1e2 + 100; // generic matrix and vector initialization Interface::matrix_from_stl(X_ref,X_stl); Interface::matrix_from_stl(X,X_stl); Interface::matrix_from_stl(C,C_stl); _cost = 0; for (int j=0; j<_size; ++j) { double r = std::max(_size - j -1,0); _cost += 2*(r*j+r+j); } } // invalidate copy ctor Action_cholesky( const Action_cholesky & ) { INFOS("illegal call to Action_cholesky Copy Ctor"); exit(1); } // Dtor ~Action_cholesky( void ){ MESSAGE("Action_cholesky Dtor"); // deallocation Interface::free_matrix(X_ref,_size); Interface::free_matrix(X,_size); Interface::free_matrix(C,_size); } // action name static inline std::string name( void ) { return "cholesky_"+Interface::name(); } double nb_op_base( void ){ return _cost; } inline void initialize( void ){ Interface::copy_matrix(X_ref,X,_size); } inline void calculate( void ) { Interface::cholesky(X,C,_size); } void check_result( void ){ // calculation check // STL_interface::cholesky(X_stl,C_stl,_size); // // typename Interface::real_type error= // STL_interface::norm_diff(C_stl,resu_stl); // // if (error>1.e-6){ // INFOS("WRONG CALCULATION...residual=" << error); // exit(0); // } } private : typename Interface::stl_matrix X_stl; typename Interface::stl_matrix C_stl; typename Interface::gene_matrix X_ref; typename Interface::gene_matrix X; typename Interface::gene_matrix C; int _size; double _cost; }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/actions/action_ger.hh ================================================ // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef ACTION_GER #define ACTION_GER #include "utilities.h" #include "STL_interface.hh" #include #include "init/init_function.hh" #include "init/init_vector.hh" #include "init/init_matrix.hh" using namespace std; template class Action_ger { public : // Ctor BTL_DONT_INLINE Action_ger( int size ):_size(size) { MESSAGE("Action_ger Ctor"); // STL matrix and vector initialization typename Interface::stl_matrix tmp; init_matrix(A_stl,_size); init_vector(B_stl,_size); init_vector(X_stl,_size); init_vector(resu_stl,_size); // generic matrix and vector initialization Interface::matrix_from_stl(A_ref,A_stl); Interface::matrix_from_stl(A,A_stl); Interface::vector_from_stl(B_ref,B_stl); Interface::vector_from_stl(B,B_stl); Interface::vector_from_stl(X_ref,X_stl); Interface::vector_from_stl(X,X_stl); } // invalidate copy ctor Action_ger( const Action_ger & ) { INFOS("illegal call to Action_ger Copy Ctor"); exit(1); } // Dtor BTL_DONT_INLINE ~Action_ger( void ){ MESSAGE("Action_ger Dtor"); Interface::free_matrix(A,_size); Interface::free_vector(B); Interface::free_vector(X); Interface::free_matrix(A_ref,_size); Interface::free_vector(B_ref); Interface::free_vector(X_ref); } // action name static inline std::string name( void ) { return "ger_" + Interface::name(); } double nb_op_base( void ){ return 2.0*_size*_size; } BTL_DONT_INLINE void initialize( void ){ Interface::copy_matrix(A_ref,A,_size); Interface::copy_vector(B_ref,B,_size); Interface::copy_vector(X_ref,X,_size); } BTL_DONT_INLINE void calculate( void ) { BTL_ASM_COMMENT("#begin ger"); Interface::ger(A,B,X,_size); BTL_ASM_COMMENT("end ger"); } BTL_DONT_INLINE void check_result( void ){ // calculation check Interface::vector_to_stl(X,resu_stl); STL_interface::ger(A_stl,B_stl,X_stl,_size); typename Interface::real_type error= STL_interface::norm_diff(X_stl,resu_stl); if (error>1.e-3){ INFOS("WRONG CALCULATION...residual=" << error); // exit(0); } } private : typename Interface::stl_matrix A_stl; typename Interface::stl_vector B_stl; typename Interface::stl_vector X_stl; typename Interface::stl_vector resu_stl; typename Interface::gene_matrix A_ref; typename Interface::gene_vector B_ref; typename Interface::gene_vector X_ref; typename Interface::gene_matrix A; typename Interface::gene_vector B; typename Interface::gene_vector X; int _size; }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/actions/action_hessenberg.hh ================================================ //===================================================== // File : action_hessenberg.hh // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef ACTION_HESSENBERG #define ACTION_HESSENBERG #include "utilities.h" #include "STL_interface.hh" #include #include "init/init_function.hh" #include "init/init_vector.hh" #include "init/init_matrix.hh" using namespace std; template class Action_hessenberg { public : // Ctor Action_hessenberg( int size ):_size(size) { MESSAGE("Action_hessenberg Ctor"); // STL vector initialization init_matrix(X_stl,_size); init_matrix(C_stl,_size); init_matrix(resu_stl,_size); // generic matrix and vector initialization Interface::matrix_from_stl(X_ref,X_stl); Interface::matrix_from_stl(X,X_stl); Interface::matrix_from_stl(C,C_stl); _cost = 0; for (int j=0; j<_size-2; ++j) { double r = std::max(0,_size-j-1); double b = std::max(0,_size-j-2); _cost += 6 + 3*b + r*r*4 + r*_size*4; } } // invalidate copy ctor Action_hessenberg( const Action_hessenberg & ) { INFOS("illegal call to Action_hessenberg Copy Ctor"); exit(1); } // Dtor ~Action_hessenberg( void ){ MESSAGE("Action_hessenberg Dtor"); // deallocation Interface::free_matrix(X_ref,_size); Interface::free_matrix(X,_size); Interface::free_matrix(C,_size); } // action name static inline std::string name( void ) { return "hessenberg_"+Interface::name(); } double nb_op_base( void ){ return _cost; } inline void initialize( void ){ Interface::copy_matrix(X_ref,X,_size); } inline void calculate( void ) { Interface::hessenberg(X,C,_size); } void check_result( void ){ // calculation check Interface::matrix_to_stl(C,resu_stl); // STL_interface::hessenberg(X_stl,C_stl,_size); // // typename Interface::real_type error= // STL_interface::norm_diff(C_stl,resu_stl); // // if (error>1.e-6){ // INFOS("WRONG CALCULATION...residual=" << error); // exit(0); // } } private : typename Interface::stl_matrix X_stl; typename Interface::stl_matrix C_stl; typename Interface::stl_matrix resu_stl; typename Interface::gene_matrix X_ref; typename Interface::gene_matrix X; typename Interface::gene_matrix C; int _size; double _cost; }; template class Action_tridiagonalization { public : // Ctor Action_tridiagonalization( int size ):_size(size) { MESSAGE("Action_tridiagonalization Ctor"); // STL vector initialization init_matrix(X_stl,_size); for(int i=0; i<_size; ++i) { for(int j=0; j(C_stl,_size); init_matrix(resu_stl,_size); // generic matrix and vector initialization Interface::matrix_from_stl(X_ref,X_stl); Interface::matrix_from_stl(X,X_stl); Interface::matrix_from_stl(C,C_stl); _cost = 0; for (int j=0; j<_size-2; ++j) { double r = std::max(0,_size-j-1); double b = std::max(0,_size-j-2); _cost += 6. + 3.*b + r*r*8.; } } // invalidate copy ctor Action_tridiagonalization( const Action_tridiagonalization & ) { INFOS("illegal call to Action_tridiagonalization Copy Ctor"); exit(1); } // Dtor ~Action_tridiagonalization( void ){ MESSAGE("Action_tridiagonalization Dtor"); // deallocation Interface::free_matrix(X_ref,_size); Interface::free_matrix(X,_size); Interface::free_matrix(C,_size); } // action name static inline std::string name( void ) { return "tridiagonalization_"+Interface::name(); } double nb_op_base( void ){ return _cost; } inline void initialize( void ){ Interface::copy_matrix(X_ref,X,_size); } inline void calculate( void ) { Interface::tridiagonalization(X,C,_size); } void check_result( void ){ // calculation check Interface::matrix_to_stl(C,resu_stl); // STL_interface::tridiagonalization(X_stl,C_stl,_size); // // typename Interface::real_type error= // STL_interface::norm_diff(C_stl,resu_stl); // // if (error>1.e-6){ // INFOS("WRONG CALCULATION...residual=" << error); // exit(0); // } } private : typename Interface::stl_matrix X_stl; typename Interface::stl_matrix C_stl; typename Interface::stl_matrix resu_stl; typename Interface::gene_matrix X_ref; typename Interface::gene_matrix X; typename Interface::gene_matrix C; int _size; double _cost; }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/actions/action_lu_decomp.hh ================================================ //===================================================== // File : action_lu_decomp.hh // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef ACTION_LU_DECOMP #define ACTION_LU_DECOMP #include "utilities.h" #include "STL_interface.hh" #include #include "init/init_function.hh" #include "init/init_vector.hh" #include "init/init_matrix.hh" using namespace std; template class Action_lu_decomp { public : // Ctor Action_lu_decomp( int size ):_size(size) { MESSAGE("Action_lu_decomp Ctor"); // STL vector initialization init_matrix(X_stl,_size); init_matrix(C_stl,_size); init_matrix(resu_stl,_size); // generic matrix and vector initialization Interface::matrix_from_stl(X_ref,X_stl); Interface::matrix_from_stl(X,X_stl); Interface::matrix_from_stl(C,C_stl); _cost = 2.0*size*size*size/3.0 + size*size; } // invalidate copy ctor Action_lu_decomp( const Action_lu_decomp & ) { INFOS("illegal call to Action_lu_decomp Copy Ctor"); exit(1); } // Dtor ~Action_lu_decomp( void ){ MESSAGE("Action_lu_decomp Dtor"); // deallocation Interface::free_matrix(X_ref,_size); Interface::free_matrix(X,_size); Interface::free_matrix(C,_size); } // action name static inline std::string name( void ) { return "complete_lu_decomp_"+Interface::name(); } double nb_op_base( void ){ return _cost; } inline void initialize( void ){ Interface::copy_matrix(X_ref,X,_size); } inline void calculate( void ) { Interface::lu_decomp(X,C,_size); } void check_result( void ){ // calculation check Interface::matrix_to_stl(C,resu_stl); // STL_interface::lu_decomp(X_stl,C_stl,_size); // // typename Interface::real_type error= // STL_interface::norm_diff(C_stl,resu_stl); // // if (error>1.e-6){ // INFOS("WRONG CALCULATION...residual=" << error); // exit(0); // } } private : typename Interface::stl_matrix X_stl; typename Interface::stl_matrix C_stl; typename Interface::stl_matrix resu_stl; typename Interface::gene_matrix X_ref; typename Interface::gene_matrix X; typename Interface::gene_matrix C; int _size; double _cost; }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/actions/action_lu_solve.hh ================================================ //===================================================== // File : action_lu_solve.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef ACTION_LU_SOLVE #define ACTION_LU_SOLVE #include "utilities.h" #include "STL_interface.hh" #include #include "init/init_function.hh" #include "init/init_vector.hh" #include "init/init_matrix.hh" using namespace std; template class Action_lu_solve { public : static inline std::string name( void ) { return "lu_solve_"+Interface::name(); } static double nb_op_base(int size){ return 2.0*size*size*size/3.0; // questionable but not really important } static double calculate( int nb_calc, int size ) { // STL matrix and vector initialization typename Interface::stl_matrix A_stl; typename Interface::stl_vector B_stl; typename Interface::stl_vector X_stl; init_matrix(A_stl,size); init_vector(B_stl,size); init_vector(X_stl,size); // generic matrix and vector initialization typename Interface::gene_matrix A; typename Interface::gene_vector B; typename Interface::gene_vector X; typename Interface::gene_matrix LU; Interface::matrix_from_stl(A,A_stl); Interface::vector_from_stl(B,B_stl); Interface::vector_from_stl(X,X_stl); Interface::matrix_from_stl(LU,A_stl); // local variable : typename Interface::Pivot_Vector pivot; // pivot vector Interface::new_Pivot_Vector(pivot,size); // timer utilities Portable_Timer chronos; // time measurement chronos.start(); for (int ii=0;ii::matrix_vector_product(A_stl,X_stl,B_new_stl,size); typename Interface::real_type error= STL_interface::norm_diff(B_stl,B_new_stl); if (error>1.e-5){ INFOS("WRONG CALCULATION...residual=" << error); STL_interface::display_vector(B_stl); STL_interface::display_vector(B_new_stl); exit(0); } // deallocation and return time Interface::free_matrix(A,size); Interface::free_vector(B); Interface::free_vector(X); Interface::free_Pivot_Vector(pivot); return time; } }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/actions/action_matrix_matrix_product.hh ================================================ //===================================================== // File : action_matrix_matrix_product.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef ACTION_MATRIX_MATRIX_PRODUCT #define ACTION_MATRIX_MATRIX_PRODUCT #include "utilities.h" #include "STL_interface.hh" #include #include "init/init_function.hh" #include "init/init_vector.hh" #include "init/init_matrix.hh" using namespace std; template class Action_matrix_matrix_product { public : // Ctor Action_matrix_matrix_product( int size ):_size(size) { MESSAGE("Action_matrix_matrix_product Ctor"); // STL matrix and vector initialization init_matrix(A_stl,_size); init_matrix(B_stl,_size); init_matrix(X_stl,_size); init_matrix(resu_stl,_size); // generic matrix and vector initialization Interface::matrix_from_stl(A_ref,A_stl); Interface::matrix_from_stl(B_ref,B_stl); Interface::matrix_from_stl(X_ref,X_stl); Interface::matrix_from_stl(A,A_stl); Interface::matrix_from_stl(B,B_stl); Interface::matrix_from_stl(X,X_stl); } // invalidate copy ctor Action_matrix_matrix_product( const Action_matrix_matrix_product & ) { INFOS("illegal call to Action_matrix_matrix_product Copy Ctor"); exit(0); } // Dtor ~Action_matrix_matrix_product( void ){ MESSAGE("Action_matrix_matrix_product Dtor"); // deallocation Interface::free_matrix(A,_size); Interface::free_matrix(B,_size); Interface::free_matrix(X,_size); Interface::free_matrix(A_ref,_size); Interface::free_matrix(B_ref,_size); Interface::free_matrix(X_ref,_size); } // action name static inline std::string name( void ) { return "matrix_matrix_"+Interface::name(); } double nb_op_base( void ){ return 2.0*_size*_size*_size; } inline void initialize( void ){ Interface::copy_matrix(A_ref,A,_size); Interface::copy_matrix(B_ref,B,_size); Interface::copy_matrix(X_ref,X,_size); } inline void calculate( void ) { Interface::matrix_matrix_product(A,B,X,_size); } void check_result( void ){ // calculation check if (_size<200) { Interface::matrix_to_stl(X,resu_stl); STL_interface::matrix_matrix_product(A_stl,B_stl,X_stl,_size); typename Interface::real_type error= STL_interface::norm_diff(X_stl,resu_stl); if (error>1.e-6){ INFOS("WRONG CALCULATION...residual=" << error); exit(1); } } } private : typename Interface::stl_matrix A_stl; typename Interface::stl_matrix B_stl; typename Interface::stl_matrix X_stl; typename Interface::stl_matrix resu_stl; typename Interface::gene_matrix A_ref; typename Interface::gene_matrix B_ref; typename Interface::gene_matrix X_ref; typename Interface::gene_matrix A; typename Interface::gene_matrix B; typename Interface::gene_matrix X; int _size; }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/actions/action_matrix_matrix_product_bis.hh ================================================ //===================================================== // File : action_matrix_matrix_product_bis.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef ACTION_MATRIX_MATRIX_PRODUCT_BIS #define ACTION_MATRIX_MATRIX_PRODUCT_BIS #include "utilities.h" #include "STL_interface.hh" #include "STL_timer.hh" #include #include "init_function.hh" #include "init_vector.hh" #include "init_matrix.hh" using namespace std; template class Action_matrix_matrix_product_bis { public : static inline std::string name( void ) { return "matrix_matrix_"+Interface::name(); } static double nb_op_base(int size){ return 2.0*size*size*size; } static double calculate( int nb_calc, int size ) { // STL matrix and vector initialization typename Interface::stl_matrix A_stl; typename Interface::stl_matrix B_stl; typename Interface::stl_matrix X_stl; init_matrix(A_stl,size); init_matrix(B_stl,size); init_matrix(X_stl,size); // generic matrix and vector initialization typename Interface::gene_matrix A_ref; typename Interface::gene_matrix B_ref; typename Interface::gene_matrix X_ref; typename Interface::gene_matrix A; typename Interface::gene_matrix B; typename Interface::gene_matrix X; Interface::matrix_from_stl(A_ref,A_stl); Interface::matrix_from_stl(B_ref,B_stl); Interface::matrix_from_stl(X_ref,X_stl); Interface::matrix_from_stl(A,A_stl); Interface::matrix_from_stl(B,B_stl); Interface::matrix_from_stl(X,X_stl); // STL_timer utilities STL_timer chronos; // Baseline evaluation chronos.start_baseline(nb_calc); do { Interface::copy_matrix(A_ref,A,size); Interface::copy_matrix(B_ref,B,size); Interface::copy_matrix(X_ref,X,size); // Interface::matrix_matrix_product(A,B,X,size); This line must be commented !!!! } while(chronos.check()); chronos.report(true); // Time measurement chronos.start(nb_calc); do { Interface::copy_matrix(A_ref,A,size); Interface::copy_matrix(B_ref,B,size); Interface::copy_matrix(X_ref,X,size); Interface::matrix_matrix_product(A,B,X,size); // here it is not commented !!!! } while(chronos.check()); chronos.report(true); double time=chronos.calculated_time/2000.0; // calculation check typename Interface::stl_matrix resu_stl(size); Interface::matrix_to_stl(X,resu_stl); STL_interface::matrix_matrix_product(A_stl,B_stl,X_stl,size); typename Interface::real_type error= STL_interface::norm_diff(X_stl,resu_stl); if (error>1.e-6){ INFOS("WRONG CALCULATION...residual=" << error); exit(1); } // deallocation and return time Interface::free_matrix(A,size); Interface::free_matrix(B,size); Interface::free_matrix(X,size); Interface::free_matrix(A_ref,size); Interface::free_matrix(B_ref,size); Interface::free_matrix(X_ref,size); return time; } }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/actions/action_matrix_vector_product.hh ================================================ //===================================================== // File : action_matrix_vector_product.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef ACTION_MATRIX_VECTOR_PRODUCT #define ACTION_MATRIX_VECTOR_PRODUCT #include "utilities.h" #include "STL_interface.hh" #include #include "init/init_function.hh" #include "init/init_vector.hh" #include "init/init_matrix.hh" using namespace std; template class Action_matrix_vector_product { public : // Ctor BTL_DONT_INLINE Action_matrix_vector_product( int size ):_size(size) { MESSAGE("Action_matrix_vector_product Ctor"); // STL matrix and vector initialization init_matrix(A_stl,_size); init_vector(B_stl,_size); init_vector(X_stl,_size); init_vector(resu_stl,_size); // generic matrix and vector initialization Interface::matrix_from_stl(A_ref,A_stl); Interface::matrix_from_stl(A,A_stl); Interface::vector_from_stl(B_ref,B_stl); Interface::vector_from_stl(B,B_stl); Interface::vector_from_stl(X_ref,X_stl); Interface::vector_from_stl(X,X_stl); } // invalidate copy ctor Action_matrix_vector_product( const Action_matrix_vector_product & ) { INFOS("illegal call to Action_matrix_vector_product Copy Ctor"); exit(1); } // Dtor BTL_DONT_INLINE ~Action_matrix_vector_product( void ){ MESSAGE("Action_matrix_vector_product Dtor"); // deallocation Interface::free_matrix(A,_size); Interface::free_vector(B); Interface::free_vector(X); Interface::free_matrix(A_ref,_size); Interface::free_vector(B_ref); Interface::free_vector(X_ref); } // action name static inline std::string name( void ) { return "matrix_vector_" + Interface::name(); } double nb_op_base( void ){ return 2.0*_size*_size; } BTL_DONT_INLINE void initialize( void ){ Interface::copy_matrix(A_ref,A,_size); Interface::copy_vector(B_ref,B,_size); Interface::copy_vector(X_ref,X,_size); } BTL_DONT_INLINE void calculate( void ) { BTL_ASM_COMMENT("#begin matrix_vector_product"); Interface::matrix_vector_product(A,B,X,_size); BTL_ASM_COMMENT("end matrix_vector_product"); } BTL_DONT_INLINE void check_result( void ){ // calculation check Interface::vector_to_stl(X,resu_stl); STL_interface::matrix_vector_product(A_stl,B_stl,X_stl,_size); typename Interface::real_type error= STL_interface::norm_diff(X_stl,resu_stl); if (error>1.e-5){ INFOS("WRONG CALCULATION...residual=" << error); exit(0); } } private : typename Interface::stl_matrix A_stl; typename Interface::stl_vector B_stl; typename Interface::stl_vector X_stl; typename Interface::stl_vector resu_stl; typename Interface::gene_matrix A_ref; typename Interface::gene_vector B_ref; typename Interface::gene_vector X_ref; typename Interface::gene_matrix A; typename Interface::gene_vector B; typename Interface::gene_vector X; int _size; }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/actions/action_partial_lu.hh ================================================ //===================================================== // File : action_lu_decomp.hh // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef ACTION_PARTIAL_LU #define ACTION_PARTIAL_LU #include "utilities.h" #include "STL_interface.hh" #include #include "init/init_function.hh" #include "init/init_vector.hh" #include "init/init_matrix.hh" using namespace std; template class Action_partial_lu { public : // Ctor Action_partial_lu( int size ):_size(size) { MESSAGE("Action_partial_lu Ctor"); // STL vector initialization init_matrix(X_stl,_size); init_matrix(C_stl,_size); // make sure X is invertible for (int i=0; i<_size; ++i) X_stl[i][i] = X_stl[i][i] * 1e2 + 1; // generic matrix and vector initialization Interface::matrix_from_stl(X_ref,X_stl); Interface::matrix_from_stl(X,X_stl); Interface::matrix_from_stl(C,C_stl); _cost = 2.0*size*size*size/3.0 + size*size; } // invalidate copy ctor Action_partial_lu( const Action_partial_lu & ) { INFOS("illegal call to Action_partial_lu Copy Ctor"); exit(1); } // Dtor ~Action_partial_lu( void ){ MESSAGE("Action_partial_lu Dtor"); // deallocation Interface::free_matrix(X_ref,_size); Interface::free_matrix(X,_size); Interface::free_matrix(C,_size); } // action name static inline std::string name( void ) { return "partial_lu_decomp_"+Interface::name(); } double nb_op_base( void ){ return _cost; } inline void initialize( void ){ Interface::copy_matrix(X_ref,X,_size); } inline void calculate( void ) { Interface::partial_lu_decomp(X,C,_size); } void check_result( void ){ // calculation check // Interface::matrix_to_stl(C,resu_stl); // STL_interface::lu_decomp(X_stl,C_stl,_size); // // typename Interface::real_type error= // STL_interface::norm_diff(C_stl,resu_stl); // // if (error>1.e-6){ // INFOS("WRONG CALCULATION...residual=" << error); // exit(0); // } } private : typename Interface::stl_matrix X_stl; typename Interface::stl_matrix C_stl; typename Interface::gene_matrix X_ref; typename Interface::gene_matrix X; typename Interface::gene_matrix C; int _size; double _cost; }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/actions/action_rot.hh ================================================ // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef ACTION_ROT #define ACTION_ROT #include "utilities.h" #include "STL_interface.hh" #include #include "init/init_function.hh" #include "init/init_vector.hh" #include "init/init_matrix.hh" using namespace std; template class Action_rot { public : // Ctor BTL_DONT_INLINE Action_rot( int size ):_size(size) { MESSAGE("Action_rot Ctor"); // STL matrix and vector initialization typename Interface::stl_matrix tmp; init_vector(A_stl,_size); init_vector(B_stl,_size); // generic matrix and vector initialization Interface::vector_from_stl(A_ref,A_stl); Interface::vector_from_stl(A,A_stl); Interface::vector_from_stl(B_ref,B_stl); Interface::vector_from_stl(B,B_stl); } // invalidate copy ctor Action_rot( const Action_rot & ) { INFOS("illegal call to Action_rot Copy Ctor"); exit(1); } // Dtor BTL_DONT_INLINE ~Action_rot( void ){ MESSAGE("Action_rot Dtor"); Interface::free_vector(A); Interface::free_vector(B); Interface::free_vector(A_ref); Interface::free_vector(B_ref); } // action name static inline std::string name( void ) { return "rot_" + Interface::name(); } double nb_op_base( void ){ return 6.0*_size; } BTL_DONT_INLINE void initialize( void ){ Interface::copy_vector(A_ref,A,_size); Interface::copy_vector(B_ref,B,_size); } BTL_DONT_INLINE void calculate( void ) { BTL_ASM_COMMENT("#begin rot"); Interface::rot(A,B,0.5,0.6,_size); BTL_ASM_COMMENT("end rot"); } BTL_DONT_INLINE void check_result( void ){ // calculation check // Interface::vector_to_stl(X,resu_stl); // STL_interface::rot(A_stl,B_stl,X_stl,_size); // typename Interface::real_type error= // STL_interface::norm_diff(X_stl,resu_stl); // if (error>1.e-3){ // INFOS("WRONG CALCULATION...residual=" << error); // exit(0); // } } private : typename Interface::stl_vector A_stl; typename Interface::stl_vector B_stl; typename Interface::gene_vector A_ref; typename Interface::gene_vector B_ref; typename Interface::gene_vector A; typename Interface::gene_vector B; int _size; }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/actions/action_symv.hh ================================================ //===================================================== // File : action_symv.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef ACTION_SYMV #define ACTION_SYMV #include "utilities.h" #include "STL_interface.hh" #include #include "init/init_function.hh" #include "init/init_vector.hh" #include "init/init_matrix.hh" using namespace std; template class Action_symv { public : // Ctor BTL_DONT_INLINE Action_symv( int size ):_size(size) { MESSAGE("Action_symv Ctor"); // STL matrix and vector initialization init_matrix_symm(A_stl,_size); init_vector(B_stl,_size); init_vector(X_stl,_size); init_vector(resu_stl,_size); // generic matrix and vector initialization Interface::matrix_from_stl(A_ref,A_stl); Interface::matrix_from_stl(A,A_stl); Interface::vector_from_stl(B_ref,B_stl); Interface::vector_from_stl(B,B_stl); Interface::vector_from_stl(X_ref,X_stl); Interface::vector_from_stl(X,X_stl); } // invalidate copy ctor Action_symv( const Action_symv & ) { INFOS("illegal call to Action_symv Copy Ctor"); exit(1); } // Dtor BTL_DONT_INLINE ~Action_symv( void ){ Interface::free_matrix(A,_size); Interface::free_vector(B); Interface::free_vector(X); Interface::free_matrix(A_ref,_size); Interface::free_vector(B_ref); Interface::free_vector(X_ref); } // action name static inline std::string name( void ) { return "symv_" + Interface::name(); } double nb_op_base( void ){ return 2.0*_size*_size; } BTL_DONT_INLINE void initialize( void ){ Interface::copy_matrix(A_ref,A,_size); Interface::copy_vector(B_ref,B,_size); Interface::copy_vector(X_ref,X,_size); } BTL_DONT_INLINE void calculate( void ) { BTL_ASM_COMMENT("#begin symv"); Interface::symv(A,B,X,_size); BTL_ASM_COMMENT("end symv"); } BTL_DONT_INLINE void check_result( void ){ if (_size>128) return; // calculation check Interface::vector_to_stl(X,resu_stl); STL_interface::symv(A_stl,B_stl,X_stl,_size); typename Interface::real_type error= STL_interface::norm_diff(X_stl,resu_stl); if (error>1.e-5){ INFOS("WRONG CALCULATION...residual=" << error); exit(0); } } private : typename Interface::stl_matrix A_stl; typename Interface::stl_vector B_stl; typename Interface::stl_vector X_stl; typename Interface::stl_vector resu_stl; typename Interface::gene_matrix A_ref; typename Interface::gene_vector B_ref; typename Interface::gene_vector X_ref; typename Interface::gene_matrix A; typename Interface::gene_vector B; typename Interface::gene_vector X; int _size; }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/actions/action_syr2.hh ================================================ //===================================================== // File : action_syr2.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef ACTION_SYR2 #define ACTION_SYR2 #include "utilities.h" #include "STL_interface.hh" #include #include "init/init_function.hh" #include "init/init_vector.hh" #include "init/init_matrix.hh" using namespace std; template class Action_syr2 { public : // Ctor BTL_DONT_INLINE Action_syr2( int size ):_size(size) { // STL matrix and vector initialization typename Interface::stl_matrix tmp; init_matrix(A_stl,_size); init_vector(B_stl,_size); init_vector(X_stl,_size); init_vector(resu_stl,_size); // generic matrix and vector initialization Interface::matrix_from_stl(A_ref,A_stl); Interface::matrix_from_stl(A,A_stl); Interface::vector_from_stl(B_ref,B_stl); Interface::vector_from_stl(B,B_stl); Interface::vector_from_stl(X_ref,X_stl); Interface::vector_from_stl(X,X_stl); } // invalidate copy ctor Action_syr2( const Action_syr2 & ) { INFOS("illegal call to Action_syr2 Copy Ctor"); exit(1); } // Dtor BTL_DONT_INLINE ~Action_syr2( void ){ Interface::free_matrix(A,_size); Interface::free_vector(B); Interface::free_vector(X); Interface::free_matrix(A_ref,_size); Interface::free_vector(B_ref); Interface::free_vector(X_ref); } // action name static inline std::string name( void ) { return "syr2_" + Interface::name(); } double nb_op_base( void ){ return 2.0*_size*_size; } BTL_DONT_INLINE void initialize( void ){ Interface::copy_matrix(A_ref,A,_size); Interface::copy_vector(B_ref,B,_size); Interface::copy_vector(X_ref,X,_size); } BTL_DONT_INLINE void calculate( void ) { BTL_ASM_COMMENT("#begin syr2"); Interface::syr2(A,B,X,_size); BTL_ASM_COMMENT("end syr2"); } BTL_DONT_INLINE void check_result( void ){ // calculation check Interface::vector_to_stl(X,resu_stl); STL_interface::syr2(A_stl,B_stl,X_stl,_size); typename Interface::real_type error= STL_interface::norm_diff(X_stl,resu_stl); if (error>1.e-3){ INFOS("WRONG CALCULATION...residual=" << error); // exit(0); } } private : typename Interface::stl_matrix A_stl; typename Interface::stl_vector B_stl; typename Interface::stl_vector X_stl; typename Interface::stl_vector resu_stl; typename Interface::gene_matrix A_ref; typename Interface::gene_vector B_ref; typename Interface::gene_vector X_ref; typename Interface::gene_matrix A; typename Interface::gene_vector B; typename Interface::gene_vector X; int _size; }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/actions/action_trisolve.hh ================================================ //===================================================== // File : action_trisolve.hh // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef ACTION_TRISOLVE #define ACTION_TRISOLVE #include "utilities.h" #include "STL_interface.hh" #include #include "init/init_function.hh" #include "init/init_vector.hh" #include "init/init_matrix.hh" using namespace std; template class Action_trisolve { public : // Ctor Action_trisolve( int size ):_size(size) { MESSAGE("Action_trisolve Ctor"); // STL vector initialization init_matrix(L_stl,_size); init_vector(B_stl,_size); init_vector(X_stl,_size); for (int j=0; j<_size; ++j) { for (int i=0; i(resu_stl,_size); // generic matrix and vector initialization Interface::matrix_from_stl(L,L_stl); Interface::vector_from_stl(X,X_stl); Interface::vector_from_stl(B,B_stl); _cost = 0; for (int j=0; j<_size; ++j) { _cost += 2*j + 1; } } // invalidate copy ctor Action_trisolve( const Action_trisolve & ) { INFOS("illegal call to Action_trisolve Copy Ctor"); exit(1); } // Dtor ~Action_trisolve( void ){ MESSAGE("Action_trisolve Dtor"); // deallocation Interface::free_matrix(L,_size); Interface::free_vector(B); Interface::free_vector(X); } // action name static inline std::string name( void ) { return "trisolve_vector_"+Interface::name(); } double nb_op_base( void ){ return _cost; } inline void initialize( void ){ //Interface::copy_vector(X_ref,X,_size); } inline void calculate( void ) { Interface::trisolve_lower(L,B,X,_size); } void check_result(){ if (_size>128) return; // calculation check Interface::vector_to_stl(X,resu_stl); STL_interface::trisolve_lower(L_stl,B_stl,X_stl,_size); typename Interface::real_type error= STL_interface::norm_diff(X_stl,resu_stl); if (error>1.e-4){ INFOS("WRONG CALCULATION...residual=" << error); exit(2); } //else INFOS("CALCULATION OK...residual=" << error); } private : typename Interface::stl_matrix L_stl; typename Interface::stl_vector X_stl; typename Interface::stl_vector B_stl; typename Interface::stl_vector resu_stl; typename Interface::gene_matrix L; typename Interface::gene_vector X; typename Interface::gene_vector B; int _size; double _cost; }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/actions/action_trisolve_matrix.hh ================================================ //===================================================== // File : action_matrix_matrix_product.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef ACTION_TRISOLVE_MATRIX_PRODUCT #define ACTION_TRISOLVE_MATRIX_PRODUCT #include "utilities.h" #include "STL_interface.hh" #include #include "init/init_function.hh" #include "init/init_vector.hh" #include "init/init_matrix.hh" using namespace std; template class Action_trisolve_matrix { public : // Ctor Action_trisolve_matrix( int size ):_size(size) { MESSAGE("Action_trisolve_matrix Ctor"); // STL matrix and vector initialization init_matrix(A_stl,_size); init_matrix(B_stl,_size); init_matrix(X_stl,_size); init_matrix(resu_stl,_size); for (int j=0; j<_size; ++j) { for (int i=0; i::matrix_matrix_product(A_stl,B_stl,X_stl,_size); // // typename Interface::real_type error= // STL_interface::norm_diff(X_stl,resu_stl); // // if (error>1.e-6){ // INFOS("WRONG CALCULATION...residual=" << error); // // exit(1); // } } private : typename Interface::stl_matrix A_stl; typename Interface::stl_matrix B_stl; typename Interface::stl_matrix X_stl; typename Interface::stl_matrix resu_stl; typename Interface::gene_matrix A_ref; typename Interface::gene_matrix B_ref; typename Interface::gene_matrix X_ref; typename Interface::gene_matrix A; typename Interface::gene_matrix B; typename Interface::gene_matrix X; int _size; double _cost; }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/actions/action_trmm.hh ================================================ //===================================================== // File : action_matrix_matrix_product.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef ACTION_TRMM #define ACTION_TRMM #include "utilities.h" #include "STL_interface.hh" #include #include "init/init_function.hh" #include "init/init_vector.hh" #include "init/init_matrix.hh" using namespace std; template class Action_trmm { public : // Ctor Action_trmm( int size ):_size(size) { MESSAGE("Action_trmm Ctor"); // STL matrix and vector initialization init_matrix(A_stl,_size); init_matrix(B_stl,_size); init_matrix(X_stl,_size); init_matrix(resu_stl,_size); for (int j=0; j<_size; ++j) { for (int i=0; i::matrix_matrix_product(A_stl,B_stl,X_stl,_size); // // typename Interface::real_type error= // STL_interface::norm_diff(X_stl,resu_stl); // // if (error>1.e-6){ // INFOS("WRONG CALCULATION...residual=" << error); // // exit(1); // } } private : typename Interface::stl_matrix A_stl; typename Interface::stl_matrix B_stl; typename Interface::stl_matrix X_stl; typename Interface::stl_matrix resu_stl; typename Interface::gene_matrix A_ref; typename Interface::gene_matrix B_ref; typename Interface::gene_matrix X_ref; typename Interface::gene_matrix A; typename Interface::gene_matrix B; typename Interface::gene_matrix X; int _size; double _cost; }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/actions/basic_actions.hh ================================================ #include "action_axpy.hh" #include "action_axpby.hh" #include "action_matrix_vector_product.hh" #include "action_atv_product.hh" #include "action_matrix_matrix_product.hh" #include "action_ata_product.hh" #include "action_aat_product.hh" #include "action_trisolve.hh" #include "action_trmm.hh" #include "action_symv.hh" // #include "action_symm.hh" #include "action_syr2.hh" #include "action_ger.hh" #include "action_rot.hh" // #include "action_lu_solve.hh" ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/cmake/FindACML.cmake ================================================ if (ACML_LIBRARIES) set(ACML_FIND_QUIETLY TRUE) endif () find_library(ACML_LIBRARIES NAMES acml_mp acml_mv PATHS $ENV{ACMLDIR}/lib $ENV{ACML_DIR}/lib ${LIB_INSTALL_DIR} ) find_file(ACML_LIBRARIES NAMES libacml_mp.so PATHS /usr/lib /usr/lib64 $ENV{ACMLDIR}/lib ${LIB_INSTALL_DIR} ) if(NOT ACML_LIBRARIES) message(STATUS "Multi-threaded library not found, looking for single-threaded") find_library(ACML_LIBRARIES NAMES acml acml_mv PATHS $ENV{ACMLDIR}/lib $ENV{ACML_DIR}/lib ${LIB_INSTALL_DIR} ) find_file(ACML_LIBRARIES libacml.so libacml_mv.so PATHS /usr/lib /usr/lib64 $ENV{ACMLDIR}/lib ${LIB_INSTALL_DIR} ) endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(ACML DEFAULT_MSG ACML_LIBRARIES) mark_as_advanced(ACML_LIBRARIES) ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/cmake/FindATLAS.cmake ================================================ if (ATLAS_LIBRARIES) set(ATLAS_FIND_QUIETLY TRUE) endif () find_file(ATLAS_LIB libatlas.so.3 PATHS /usr/lib /usr/lib/atlas /usr/lib64 /usr/lib64/atlas $ENV{ATLASDIR} ${LIB_INSTALL_DIR}) find_library(ATLAS_LIB satlas PATHS $ENV{ATLASDIR} ${LIB_INSTALL_DIR}) find_file(ATLAS_LAPACK NAMES liblapack_atlas.so.3 liblapack.so.3 PATHS /usr/lib /usr/lib/atlas /usr/lib64 /usr/lib64/atlas $ENV{ATLASDIR} ${LIB_INSTALL_DIR}) find_library(ATLAS_LAPACK NAMES lapack_atlas lapack PATHS $ENV{ATLASDIR} ${LIB_INSTALL_DIR}) find_file(ATLAS_F77BLAS libf77blas.so.3 PATHS /usr/lib /usr/lib/atlas /usr/lib64 /usr/lib64/atlas $ENV{ATLASDIR} ${LIB_INSTALL_DIR}) find_library(ATLAS_F77BLAS f77blas PATHS $ENV{ATLASDIR} ${LIB_INSTALL_DIR}) if(ATLAS_LIB AND ATLAS_CBLAS AND ATLAS_LAPACK AND ATLAS_F77BLAS) set(ATLAS_LIBRARIES ${ATLAS_LAPACK} ${ATLAS_LIB}) # search the default lapack lib link to it find_file(ATLAS_REFERENCE_LAPACK liblapack.so.3 PATHS /usr/lib /usr/lib64) find_library(ATLAS_REFERENCE_LAPACK NAMES lapack) # if(ATLAS_REFERENCE_LAPACK) # set(ATLAS_LIBRARIES ${ATLAS_LIBRARIES} ${ATLAS_REFERENCE_LAPACK}) # endif() endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(ATLAS DEFAULT_MSG ATLAS_LIBRARIES) mark_as_advanced(ATLAS_LIBRARIES) ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/cmake/FindBLAZE.cmake ================================================ # - Try to find eigen2 headers # Once done this will define # # BLAZE_FOUND - system has blaze lib # BLAZE_INCLUDE_DIR - the blaze include directory # # Copyright (C) 2008 Gael Guennebaud # Adapted from FindEigen.cmake: # Copyright (c) 2006, 2007 Montel Laurent, # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (BLAZE_INCLUDE_DIR) # in cache already set(BLAZE_FOUND TRUE) else () find_path(BLAZE_INCLUDE_DIR NAMES blaze/Blaze.h PATHS ${INCLUDE_INSTALL_DIR} ) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(BLAZE DEFAULT_MSG BLAZE_INCLUDE_DIR) mark_as_advanced(BLAZE_INCLUDE_DIR) endif() ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/cmake/FindBlitz.cmake ================================================ # - Try to find blitz lib # Once done this will define # # BLITZ_FOUND - system has blitz lib # BLITZ_INCLUDES - the blitz include directory # BLITZ_LIBRARIES - The libraries needed to use blitz # Copyright (c) 2006, Montel Laurent, # Copyright (c) 2007, Allen Winter, # Copyright (C) 2008 Gael Guennebaud # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. # include(FindLibraryWithDebug) if (BLITZ_INCLUDES AND BLITZ_LIBRARIES) set(Blitz_FIND_QUIETLY TRUE) endif () find_path(BLITZ_INCLUDES NAMES blitz/array.h PATH_SUFFIXES blitz* PATHS $ENV{BLITZDIR}/include ${INCLUDE_INSTALL_DIR} ) find_library(BLITZ_LIBRARIES blitz PATHS $ENV{BLITZDIR}/lib ${LIB_INSTALL_DIR} ) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Blitz DEFAULT_MSG BLITZ_INCLUDES BLITZ_LIBRARIES) mark_as_advanced(BLITZ_INCLUDES BLITZ_LIBRARIES) ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/cmake/FindCBLAS.cmake ================================================ # include(FindLibraryWithDebug) if (CBLAS_INCLUDES AND CBLAS_LIBRARIES) set(CBLAS_FIND_QUIETLY TRUE) endif () find_path(CBLAS_INCLUDES NAMES cblas.h PATHS $ENV{CBLASDIR}/include ${INCLUDE_INSTALL_DIR} ) find_library(CBLAS_LIBRARIES cblas PATHS $ENV{CBLASDIR}/lib ${LIB_INSTALL_DIR} ) find_file(CBLAS_LIBRARIES libcblas.so.3 PATHS /usr/lib /usr/lib64 $ENV{CBLASDIR}/lib ${LIB_INSTALL_DIR} ) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(CBLAS DEFAULT_MSG CBLAS_INCLUDES CBLAS_LIBRARIES) mark_as_advanced(CBLAS_INCLUDES CBLAS_LIBRARIES) ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/cmake/FindGMM.cmake ================================================ if (GMM_INCLUDE_DIR) # in cache already set(GMM_FOUND TRUE) else () find_path(GMM_INCLUDE_DIR NAMES gmm/gmm.h PATHS ${INCLUDE_INSTALL_DIR} ${GMM_INCLUDE_PATH} ) include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMM DEFAULT_MSG GMM_INCLUDE_DIR ) mark_as_advanced(GMM_INCLUDE_DIR) endif() ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/cmake/FindMKL.cmake ================================================ if (MKL_LIBRARIES) set(MKL_FIND_QUIETLY TRUE) endif () if(CMAKE_MINOR_VERSION GREATER 4) if(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64") find_library(MKL_LIBRARIES mkl_core PATHS $ENV{MKLLIB} /opt/intel/mkl/*/lib/em64t /opt/intel/Compiler/*/*/mkl/lib/em64t ${LIB_INSTALL_DIR} ) find_library(MKL_GUIDE guide PATHS $ENV{MKLLIB} /opt/intel/mkl/*/lib/em64t /opt/intel/Compiler/*/*/mkl/lib/em64t /opt/intel/Compiler/*/*/lib/intel64 ${LIB_INSTALL_DIR} ) if(MKL_LIBRARIES AND MKL_GUIDE) set(MKL_LIBRARIES ${MKL_LIBRARIES} mkl_intel_lp64 mkl_sequential ${MKL_GUIDE} pthread) endif() else() find_library(MKL_LIBRARIES mkl_core PATHS $ENV{MKLLIB} /opt/intel/mkl/*/lib/32 /opt/intel/Compiler/*/*/mkl/lib/32 ${LIB_INSTALL_DIR} ) find_library(MKL_GUIDE guide PATHS $ENV{MKLLIB} /opt/intel/mkl/*/lib/32 /opt/intel/Compiler/*/*/mkl/lib/32 /opt/intel/Compiler/*/*/lib/intel32 ${LIB_INSTALL_DIR} ) if(MKL_LIBRARIES AND MKL_GUIDE) set(MKL_LIBRARIES ${MKL_LIBRARIES} mkl_intel mkl_sequential ${MKL_GUIDE} pthread) endif() endif() endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(MKL DEFAULT_MSG MKL_LIBRARIES) mark_as_advanced(MKL_LIBRARIES) ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/cmake/FindMTL4.cmake ================================================ # - Try to find eigen2 headers # Once done this will define # # MTL4_FOUND - system has eigen2 lib # MTL4_INCLUDE_DIR - the eigen2 include directory # # Copyright (C) 2008 Gael Guennebaud # Adapted from FindEigen.cmake: # Copyright (c) 2006, 2007 Montel Laurent, # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (MTL4_INCLUDE_DIR) # in cache already set(MTL4_FOUND TRUE) else () find_path(MTL4_INCLUDE_DIR NAMES boost/numeric/mtl/mtl.hpp PATHS ${INCLUDE_INSTALL_DIR} ) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(MTL4 DEFAULT_MSG MTL4_INCLUDE_DIR) mark_as_advanced(MTL4_INCLUDE_DIR) endif() ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/cmake/FindOPENBLAS.cmake ================================================ if (OPENBLAS_LIBRARIES) set(OPENBLAS_FIND_QUIETLY TRUE) endif () find_file(OPENBLAS_LIBRARIES NAMES libopenblas.so libopenblas.so.0 PATHS /usr/lib /usr/lib64 $ENV{OPENBLASDIR} ${LIB_INSTALL_DIR}) find_library(OPENBLAS_LIBRARIES openblas PATHS $ENV{OPENBLASDIR} ${LIB_INSTALL_DIR}) if(OPENBLAS_LIBRARIES AND CMAKE_COMPILER_IS_GNUCXX) set(OPENBLAS_LIBRARIES ${OPENBLAS_LIBRARIES} "-lpthread -lgfortran") endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(OPENBLAS DEFAULT_MSG OPENBLAS_LIBRARIES) mark_as_advanced(OPENBLAS_LIBRARIES) ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/cmake/FindPackageHandleStandardArgs.cmake ================================================ # FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME (DEFAULT_MSG|"Custom failure message") VAR1 ... ) # # This macro is intended to be used in FindXXX.cmake modules files. # It handles the REQUIRED and QUIET argument to find_package() and # it also sets the _FOUND variable. # The package is found if all variables listed are TRUE. # Example: # # FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR) # # LibXml2 is considered to be found, if both LIBXML2_LIBRARIES and # LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE. # If it is not found and REQUIRED was used, it fails with FATAL_ERROR, # independent whether QUIET was used or not. # # If it is found, the location is reported using the VAR1 argument, so # here a message "Found LibXml2: /usr/lib/libxml2.so" will be printed out. # If the second argument is DEFAULT_MSG, the message in the failure case will # be "Could NOT find LibXml2", if you don't like this message you can specify # your own custom failure message there. macro(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 ) if("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") if (${_NAME}_FIND_REQUIRED) set(_FAIL_MESSAGE "Could not find REQUIRED package ${_NAME}") else (${_NAME}_FIND_REQUIRED) set(_FAIL_MESSAGE "Could not find OPTIONAL package ${_NAME}") endif (${_NAME}_FIND_REQUIRED) else("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") set(_FAIL_MESSAGE "${_FAIL_MSG}") endif("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") string(TOUPPER ${_NAME} _NAME_UPPER) set(${_NAME_UPPER}_FOUND TRUE) if(NOT ${_VAR1}) set(${_NAME_UPPER}_FOUND FALSE) endif(NOT ${_VAR1}) foreach(_CURRENT_VAR ${ARGN}) if(NOT ${_CURRENT_VAR}) set(${_NAME_UPPER}_FOUND FALSE) endif(NOT ${_CURRENT_VAR}) endforeach(_CURRENT_VAR) if (${_NAME_UPPER}_FOUND) if (NOT ${_NAME}_FIND_QUIETLY) message(STATUS "Found ${_NAME}: ${${_VAR1}}") endif (NOT ${_NAME}_FIND_QUIETLY) else (${_NAME_UPPER}_FOUND) if (${_NAME}_FIND_REQUIRED) message(FATAL_ERROR "${_FAIL_MESSAGE}") else (${_NAME}_FIND_REQUIRED) if (NOT ${_NAME}_FIND_QUIETLY) message(STATUS "${_FAIL_MESSAGE}") endif (NOT ${_NAME}_FIND_QUIETLY) endif (${_NAME}_FIND_REQUIRED) endif (${_NAME_UPPER}_FOUND) endmacro(FIND_PACKAGE_HANDLE_STANDARD_ARGS) ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/cmake/FindTvmet.cmake ================================================ # - Try to find tvmet headers # Once done this will define # # TVMET_FOUND - system has tvmet lib # TVMET_INCLUDE_DIR - the tvmet include directory # # Copyright (C) 2008 Gael Guennebaud # Adapted from FindEigen.cmake: # Copyright (c) 2006, 2007 Montel Laurent, # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (TVMET_INCLUDE_DIR) # in cache already set(TVMET_FOUND TRUE) else () find_path(TVMET_INCLUDE_DIR NAMES tvmet/tvmet.h PATHS ${TVMETDIR}/ ${INCLUDE_INSTALL_DIR} ) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Tvmet DEFAULT_MSG TVMET_INCLUDE_DIR) mark_as_advanced(TVMET_INCLUDE_DIR) endif() ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/cmake/MacroOptionalAddSubdirectory.cmake ================================================ # - MACRO_OPTIONAL_ADD_SUBDIRECTORY() combines add_subdirectory() with an option() # MACRO_OPTIONAL_ADD_SUBDIRECTORY( ) # If you use MACRO_OPTIONAL_ADD_SUBDIRECTORY() instead of add_subdirectory(), # this will have two effects # 1 - CMake will not complain if the directory doesn't exist # This makes sense if you want to distribute just one of the subdirs # in a source package, e.g. just one of the subdirs in kdeextragear. # 2 - If the directory exists, it will offer an option to skip the # subdirectory. # This is useful if you want to compile only a subset of all # directories. # Copyright (c) 2007, Alexander Neundorf, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. macro (MACRO_OPTIONAL_ADD_SUBDIRECTORY _dir ) get_filename_component(_fullPath ${_dir} ABSOLUTE) if(EXISTS ${_fullPath}) if(${ARGC} EQUAL 2) option(BUILD_${_dir} "Build directory ${_dir}" ${ARGV1}) else(${ARGC} EQUAL 2) option(BUILD_${_dir} "Build directory ${_dir}" TRUE) endif(${ARGC} EQUAL 2) if(BUILD_${_dir}) add_subdirectory(${_dir}) endif(BUILD_${_dir}) endif(EXISTS ${_fullPath}) endmacro (MACRO_OPTIONAL_ADD_SUBDIRECTORY) ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/generic_bench/bench.hh ================================================ //===================================================== // File : bench.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:16 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef BENCH_HH #define BENCH_HH #include "btl.hh" #include "bench_parameter.hh" #include #include "utilities.h" #include "size_lin_log.hh" #include "xy_file.hh" #include #include #include "timers/portable_perf_analyzer.hh" // #include "timers/mixed_perf_analyzer.hh" // #include "timers/x86_perf_analyzer.hh" // #include "timers/STL_perf_analyzer.hh" #ifdef HAVE_MKL extern "C" void cblas_saxpy(const int, const float, const float*, const int, float *, const int); #endif using namespace std; template class Perf_Analyzer, class Action> BTL_DONT_INLINE void bench( int size_min, int size_max, int nb_point ) { if (BtlConfig::skipAction(Action::name())) return; string filename="bench_"+Action::name()+".dat"; INFOS("starting " < tab_mflops(nb_point); std::vector tab_sizes(nb_point); // matrices and vector size calculations size_lin_log(nb_point,size_min,size_max,tab_sizes); std::vector oldSizes; std::vector oldFlops; bool hasOldResults = read_xy_file(filename, oldSizes, oldFlops, true); int oldi = oldSizes.size() - 1; // loop on matrix size Perf_Analyzer perf_action; for (int i=nb_point-1;i>=0;i--) { //INFOS("size=" <=0 && oldSizes[oldi]>tab_sizes[i]) --oldi; if (oldi>=0 && oldSizes[oldi]==tab_sizes[i]) { if (oldFlops[oldi] "; else std::cout << "\t < "; std::cout << oldFlops[oldi]; } --oldi; } std::cout << " MFlops (" << nb_point-i << "/" << nb_point << ")" << std::endl; } if (!BtlConfig::Instance.overwriteResults) { if (hasOldResults) { // merge the two data std::vector newSizes; std::vector newFlops; unsigned int i=0; unsigned int j=0; while (i BTL_DONT_INLINE void bench( int size_min, int size_max, int nb_point ){ // if the rdtsc is not available : bench(size_min,size_max,nb_point); // if the rdtsc is available : // bench(size_min,size_max,nb_point); // Only for small problem size. Otherwise it will be too long // bench(size_min,size_max,nb_point); // bench(size_min,size_max,nb_point); } #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/generic_bench/bench_parameter.hh ================================================ //===================================================== // File : bench_parameter.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:16 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef BENCH_PARAMETER_HH #define BENCH_PARAMETER_HH // minimal time for each measurement #define REAL_TYPE float // minimal time for each measurement #define MIN_TIME 0.2 // nb of point on bench curves #define NB_POINT 100 // min vector size for axpy bench #define MIN_AXPY 5 // max vector size for axpy bench #define MAX_AXPY 3000000 // min matrix size for matrix vector product bench #define MIN_MV 5 // max matrix size for matrix vector product bench #define MAX_MV 5000 // min matrix size for matrix matrix product bench #define MIN_MM 5 // max matrix size for matrix matrix product bench #define MAX_MM MAX_MV // min matrix size for LU bench #define MIN_LU 5 // max matrix size for LU bench #define MAX_LU 3000 // max size for tiny vector and matrix #define TINY_MV_MAX_SIZE 16 // default nb_sample for x86 timer #define DEFAULT_NB_SAMPLE 1000 // how many times we run a single bench (keep the best perf) #define DEFAULT_NB_TRIES 3 #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/generic_bench/btl.hh ================================================ //===================================================== // File : btl.hh // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef BTL_HH #define BTL_HH #include "bench_parameter.hh" #include #include #include #include #include "utilities.h" #if (defined __GNUC__) #define BTL_ALWAYS_INLINE __attribute__((always_inline)) inline #else #define BTL_ALWAYS_INLINE inline #endif #if (defined __GNUC__) #define BTL_DONT_INLINE __attribute__((noinline)) #else #define BTL_DONT_INLINE #endif #if (defined __GNUC__) #define BTL_ASM_COMMENT(X) asm("#" X) #else #define BTL_ASM_COMMENT(X) #endif #ifdef __SSE__ #include "xmmintrin.h" // This enables flush to zero (FTZ) and denormals are zero (DAZ) modes: #define BTL_DISABLE_SSE_EXCEPTIONS() { _mm_setcsr(_mm_getcsr() | 0x8040); } #else #define BTL_DISABLE_SSE_EXCEPTIONS() #endif /** Enhanced std::string */ class BtlString : public std::string { public: BtlString() : std::string() {} BtlString(const BtlString& str) : std::string(static_cast(str)) {} BtlString(const std::string& str) : std::string(str) {} BtlString(const char* str) : std::string(str) {} operator const char* () const { return c_str(); } void trim( bool left = true, bool right = true ) { int lspaces, rspaces, len = length(), i; lspaces = rspaces = 0; if ( left ) for (i=0; i=0 && (at(i)==' '||at(i)=='\t'||at(i)=='\r'||at(i)=='\n'); rspaces++,i--); *this = substr(lspaces, len-lspaces-rspaces); } std::vector split( const BtlString& delims = "\t\n ") const { std::vector ret; unsigned int numSplits = 0; size_t start, pos; start = 0; do { pos = find_first_of(delims, start); if (pos == start) { ret.push_back(""); start = pos + 1; } else if (pos == npos) ret.push_back( substr(start) ); else { ret.push_back( substr(start, pos - start) ); start = pos + 1; } //start = find_first_not_of(delims, start); ++numSplits; } while (pos != npos); return ret; } bool endsWith(const BtlString& str) const { if(str.size()>this->size()) return false; return this->substr(this->size()-str.size(),str.size()) == str; } bool contains(const BtlString& str) const { return this->find(str)size(); } bool beginsWith(const BtlString& str) const { if(str.size()>this->size()) return false; return this->substr(0,str.size()) == str; } BtlString toLowerCase( void ) { std::transform(begin(), end(), begin(), static_cast(::tolower) ); return *this; } BtlString toUpperCase( void ) { std::transform(begin(), end(), begin(), static_cast(::toupper) ); return *this; } /** Case insensitive comparison. */ bool isEquiv(const BtlString& str) const { BtlString str0 = *this; str0.toLowerCase(); BtlString str1 = str; str1.toLowerCase(); return str0 == str1; } /** Decompose the current string as a path and a file. For instance: "dir1/dir2/file.ext" leads to path="dir1/dir2/" and filename="file.ext" */ void decomposePathAndFile(BtlString& path, BtlString& filename) const { std::vector elements = this->split("/\\"); path = ""; filename = elements.back(); elements.pop_back(); if (this->at(0)=='/') path = "/"; for (unsigned int i=0 ; i config = BtlString(_config).split(" \t\n"); for (unsigned int i = 0; i m_selectedActionNames; }; #define BTL_MAIN \ BtlConfig BtlConfig::Instance #endif // BTL_HH ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/generic_bench/init/init_function.hh ================================================ //===================================================== // File : init_function.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:18 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef INIT_FUNCTION_HH #define INIT_FUNCTION_HH double simple_function(int index) { return index; } double simple_function(int index_i, int index_j) { return index_i+index_j; } double pseudo_random(int /*index*/) { return std::rand()/double(RAND_MAX); } double pseudo_random(int /*index_i*/, int /*index_j*/) { return std::rand()/double(RAND_MAX); } double null_function(int /*index*/) { return 0.0; } double null_function(int /*index_i*/, int /*index_j*/) { return 0.0; } #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/generic_bench/init/init_matrix.hh ================================================ //===================================================== // File : init_matrix.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef INIT_MATRIX_HH #define INIT_MATRIX_HH // The Vector class must satisfy the following part of STL vector concept : // resize() method // [] operator for setting element // value_type defined template BTL_DONT_INLINE void init_row(Vector & X, int size, int row){ X.resize(size); for (unsigned int j=0;j BTL_DONT_INLINE void init_matrix(Vector & A, int size){ A.resize(size); for (unsigned int row=0; row(A[row],size,row); } } template BTL_DONT_INLINE void init_matrix_symm(Matrix& A, int size){ A.resize(size); for (unsigned int row=0; row // Copyright (C) EDF R&D, lun sep 30 14:23:18 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef INIT_VECTOR_HH #define INIT_VECTOR_HH // The Vector class must satisfy the following part of STL vector concept : // resize() method // [] operator for setting element // value_type defined template void init_vector(Vector & X, int size){ X.resize(size); for (unsigned int i=0;i // Copyright (C) EDF R&D, lun sep 30 14:23:16 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef BENCH_STATIC_HH #define BENCH_STATIC_HH #include "btl.hh" #include "bench_parameter.hh" #include #include "utilities.h" #include "xy_file.hh" #include "static/static_size_generator.hh" #include "timers/portable_perf_analyzer.hh" // #include "timers/mixed_perf_analyzer.hh" // #include "timers/x86_perf_analyzer.hh" using namespace std; template class Perf_Analyzer, template class Action, template class Interface> BTL_DONT_INLINE void bench_static(void) { if (BtlConfig::skipAction(Action >::name())) return; string filename = "bench_" + Action >::name() + ".dat"; INFOS("starting " << filename); const int max_size = TINY_MV_MAX_SIZE; std::vector tab_mflops; std::vector tab_sizes; static_size_generator::go(tab_sizes,tab_mflops); dump_xy_file(tab_sizes,tab_mflops,filename); } // default Perf Analyzer template class Action, template class Interface> BTL_DONT_INLINE void bench_static(void) { bench_static(); //bench_static(); //bench_static(); } #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/generic_bench/static/intel_bench_fixed_size.hh ================================================ //===================================================== // File : intel_bench_fixed_size.hh // Author : L. Plagne // Copyright (C) EDF R&D, mar dc 3 18:59:37 CET 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef _BENCH_FIXED_SIZE_HH_ #define _BENCH_FIXED_SIZE_HH_ #include "utilities.h" #include "function_time.hh" template double bench_fixed_size(int size, unsigned long long & nb_calc,unsigned long long & nb_init) { Action action(size); double time_baseline=time_init(nb_init,action); while (time_baseline < MIN_TIME) { //INFOS("nb_init="< > > perf_action; tab_mflops.push_back(perf_action.eval_mflops(SIZE)); std::cout << tab_mflops.back() << " MFlops" << std::endl; static_size_generator::go(tab_sizes,tab_mflops); }; }; //recursion end template class Perf_Analyzer, template class Action, template class Interface> struct static_size_generator<1,Perf_Analyzer,Action,Interface>{ static void go(vector & tab_sizes, vector & tab_mflops) { tab_sizes.push_back(1); Perf_Analyzer > > perf_action; tab_mflops.push_back(perf_action.eval_mflops(1)); }; }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/generic_bench/timers/STL_perf_analyzer.hh ================================================ //===================================================== // File : STL_perf_analyzer.hh // Author : L. Plagne // Copyright (C) EDF R&D, mar dc 3 18:59:35 CET 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef _STL_PERF_ANALYSER_HH #define _STL_PERF_ANALYSER_HH #include "STL_timer.hh" #include "bench_parameter.hh" template class STL_Perf_Analyzer{ public: STL_Perf_Analyzer(unsigned long long nb_sample=DEFAULT_NB_SAMPLE):_nb_sample(nb_sample),_chronos() { MESSAGE("STL_Perf_Analyzer Ctor"); }; STL_Perf_Analyzer( const STL_Perf_Analyzer & ){ INFOS("Copy Ctor not implemented"); exit(0); }; ~STL_Perf_Analyzer( void ){ MESSAGE("STL_Perf_Analyzer Dtor"); }; inline double eval_mflops(int size) { ACTION action(size); _chronos.start_baseline(_nb_sample); do { action.initialize(); } while (_chronos.check()); double baseline_time=_chronos.get_time(); _chronos.start(_nb_sample); do { action.initialize(); action.calculate(); } while (_chronos.check()); double calculate_time=_chronos.get_time(); double corrected_time=calculate_time-baseline_time; // cout << size <<" "< // Copyright (C) EDF R&D, mar dc 3 18:59:35 CET 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // STL Timer Class. Adapted (L.P.) from the timer class by Musser et Al // described int the Book : STL Tutorial and reference guide. // Define a timer class for analyzing algorithm performance. #include #include #include #include #include using namespace std; class STL_Timer { public: STL_Timer(){ baseline = false; }; // Default constructor // Start a series of r trials: void start(unsigned int r){ reps = r; count = 0; iterations.clear(); iterations.reserve(reps); initial = time(0); }; // Start a series of r trials to determine baseline time: void start_baseline(unsigned int r) { baseline = true; start(r); } // Returns true if the trials have been completed, else false bool check() { ++count; final = time(0); if (initial < final) { iterations.push_back(count); initial = final; count = 0; } return (iterations.size() < reps); }; // Returns the results for external use double get_time( void ) { sort(iterations.begin(), iterations.end()); return 1.0/iterations[reps/2]; }; private: unsigned int reps; // Number of trials // For storing loop iterations of a trial vector iterations; // For saving initial and final times of a trial time_t initial, final; // For counting loop iterations of a trial unsigned long count; // true if this is a baseline computation, false otherwise bool baseline; // For recording the baseline time double baseline_time; }; ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/generic_bench/timers/mixed_perf_analyzer.hh ================================================ //===================================================== // File : mixed_perf_analyzer.hh // Author : L. Plagne // Copyright (C) EDF R&D, mar dc 3 18:59:36 CET 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef _MIXED_PERF_ANALYSER_HH #define _MIXED_PERF_ANALYSER_HH #include "x86_perf_analyzer.hh" #include "portable_perf_analyzer.hh" // choose portable perf analyzer for long calculations and x86 analyser for short ones template class Mixed_Perf_Analyzer{ public: Mixed_Perf_Analyzer( void ):_x86pa(),_ppa(),_use_ppa(true) { MESSAGE("Mixed_Perf_Analyzer Ctor"); }; Mixed_Perf_Analyzer( const Mixed_Perf_Analyzer & ){ INFOS("Copy Ctor not implemented"); exit(0); }; ~Mixed_Perf_Analyzer( void ){ MESSAGE("Mixed_Perf_Analyzer Dtor"); }; inline double eval_mflops(int size) { double result=0.0; if (_use_ppa){ result=_ppa.eval_mflops(size); if (_ppa.get_nb_calc()>DEFAULT_NB_SAMPLE){_use_ppa=false;} } else{ result=_x86pa.eval_mflops(size); } return result; } private: Portable_Perf_Analyzer _ppa; X86_Perf_Analyzer _x86pa; bool _use_ppa; }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/generic_bench/timers/portable_perf_analyzer.hh ================================================ //===================================================== // File : portable_perf_analyzer.hh // Author : L. Plagne // Copyright (C) EDF R&D, mar d�c 3 18:59:35 CET 2002 // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef _PORTABLE_PERF_ANALYZER_HH #define _PORTABLE_PERF_ANALYZER_HH #include "utilities.h" #include "timers/portable_timer.hh" template class Portable_Perf_Analyzer{ public: Portable_Perf_Analyzer( ):_nb_calc(0), m_time_action(0), _chronos(){ MESSAGE("Portable_Perf_Analyzer Ctor"); }; Portable_Perf_Analyzer( const Portable_Perf_Analyzer & ){ INFOS("Copy Ctor not implemented"); exit(0); }; ~Portable_Perf_Analyzer(){ MESSAGE("Portable_Perf_Analyzer Dtor"); }; BTL_DONT_INLINE double eval_mflops(int size) { Action action(size); // action.initialize(); // time_action = time_calculate(action); while (m_time_action < MIN_TIME) { if(_nb_calc==0) _nb_calc = 1; else _nb_calc *= 2; action.initialize(); m_time_action = time_calculate(action); } // optimize for (int i=1; i // Copyright (C) EDF R&D, mar d�c 3 18:59:35 CET 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef _PORTABLE_PERF_ANALYZER_HH #define _PORTABLE_PERF_ANALYZER_HH #include "utilities.h" #include "timers/portable_timer.hh" template class Portable_Perf_Analyzer{ public: Portable_Perf_Analyzer( void ):_nb_calc(1),_nb_init(1),_chronos(){ MESSAGE("Portable_Perf_Analyzer Ctor"); }; Portable_Perf_Analyzer( const Portable_Perf_Analyzer & ){ INFOS("Copy Ctor not implemented"); exit(0); }; ~Portable_Perf_Analyzer( void ){ MESSAGE("Portable_Perf_Analyzer Dtor"); }; inline double eval_mflops(int size) { Action action(size); // double time_baseline = time_init(action); // while (time_baseline < MIN_TIME_INIT) // { // _nb_init *= 2; // time_baseline = time_init(action); // } // // // optimize // for (int i=1; i #include class Portable_Timer { public: Portable_Timer() { } void start() { m_start_time = double(mach_absolute_time())*1e-9;; } void stop() { m_stop_time = double(mach_absolute_time())*1e-9;; } double elapsed() { return user_time(); } double user_time() { return m_stop_time - m_start_time; } private: double m_stop_time, m_start_time; }; // Portable_Timer (Apple) #else #include #include #include #include class Portable_Timer { public: Portable_Timer() { m_clkid = BtlConfig::Instance.realclock ? CLOCK_REALTIME : CLOCK_PROCESS_CPUTIME_ID; } Portable_Timer(int clkid) : m_clkid(clkid) {} void start() { timespec ts; clock_gettime(m_clkid, &ts); m_start_time = double(ts.tv_sec) + 1e-9 * double(ts.tv_nsec); } void stop() { timespec ts; clock_gettime(m_clkid, &ts); m_stop_time = double(ts.tv_sec) + 1e-9 * double(ts.tv_nsec); } double elapsed() { return user_time(); } double user_time() { return m_stop_time - m_start_time; } private: int m_clkid; double m_stop_time, m_start_time; }; // Portable_Timer (Linux) #endif #endif // PORTABLE_TIMER_HPP ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/generic_bench/timers/x86_perf_analyzer.hh ================================================ //===================================================== // File : x86_perf_analyzer.hh // Author : L. Plagne // Copyright (C) EDF R&D, mar d�c 3 18:59:35 CET 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef _X86_PERF_ANALYSER_HH #define _X86_PERF_ANALYSER_HH #include "x86_timer.hh" #include "bench_parameter.hh" template class X86_Perf_Analyzer{ public: X86_Perf_Analyzer( unsigned long long nb_sample=DEFAULT_NB_SAMPLE):_nb_sample(nb_sample),_chronos() { MESSAGE("X86_Perf_Analyzer Ctor"); _chronos.find_frequency(); }; X86_Perf_Analyzer( const X86_Perf_Analyzer & ){ INFOS("Copy Ctor not implemented"); exit(0); }; ~X86_Perf_Analyzer( void ){ MESSAGE("X86_Perf_Analyzer Dtor"); }; inline double eval_mflops(int size) { ACTION action(size); int nb_loop=5; double calculate_time=0.0; double baseline_time=0.0; for (int j=0 ; j < nb_loop ; j++){ _chronos.clear(); for(int i=0 ; i < _nb_sample ; i++) { _chronos.start(); action.initialize(); action.calculate(); _chronos.stop(); _chronos.add_get_click(); } calculate_time += double(_chronos.get_shortest_clicks())/_chronos.frequency(); if (j==0) action.check_result(); _chronos.clear(); for(int i=0 ; i < _nb_sample ; i++) { _chronos.start(); action.initialize(); _chronos.stop(); _chronos.add_get_click(); } baseline_time+=double(_chronos.get_shortest_clicks())/_chronos.frequency(); } double corrected_time = (calculate_time-baseline_time)/double(nb_loop); // INFOS("_nb_sample="<<_nb_sample); // INFOS("baseline_time="< // Copyright (C) EDF R&D, mar d�c 3 18:59:35 CET 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef _X86_TIMER_HH #define _X86_TIMER_HH #include #include #include #include //#include "system_time.h" #define u32 unsigned int #include #include "utilities.h" #include #include #include #include // frequence de la becanne en Hz //#define FREQUENCY 648000000 //#define FREQUENCY 1400000000 #define FREQUENCY 1695000000 using namespace std; class X86_Timer { public : X86_Timer( void ):_frequency(FREQUENCY),_nb_sample(0) { MESSAGE("X86_Timer Default Ctor"); } inline void start( void ){ rdtsc(_click_start.n32[0],_click_start.n32[1]); } inline void stop( void ){ rdtsc(_click_stop.n32[0],_click_stop.n32[1]); } inline double frequency( void ){ return _frequency; } double get_elapsed_time_in_second( void ){ return (_click_stop.n64-_click_start.n64)/double(FREQUENCY); } unsigned long long get_click( void ){ return (_click_stop.n64-_click_start.n64); } inline void find_frequency( void ){ time_t initial, final; int dummy=2; initial = time(0); start(); do { dummy+=2; } while(time(0)==initial); // On est au debut d'un cycle d'une seconde !!! initial = time(0); start(); do { dummy+=2; } while(time(0)==initial); final=time(0); stop(); // INFOS("fine grained time : "<< get_elapsed_time_in_second()); // INFOS("coarse grained time : "<< final-initial); _frequency=_frequency*get_elapsed_time_in_second()/double(final-initial); /// INFOS("CPU frequency : "<< _frequency); } void add_get_click( void ){ _nb_sample++; _counted_clicks[get_click()]++; fill_history_clicks(); } void dump_statistics(string filemane){ ofstream outfile (filemane.c_str(),ios::out) ; std::map::iterator itr; for(itr=_counted_clicks.begin() ; itr!=_counted_clicks.end() ; itr++) { outfile << (*itr).first << " " << (*itr).second << endl ; } outfile.close(); } void dump_history(string filemane){ ofstream outfile (filemane.c_str(),ios::out) ; for(int i=0 ; i<_history_mean_clicks.size() ; i++) { outfile << i << " " << _history_mean_clicks[i] << " " << _history_shortest_clicks[i] << " " << _history_most_occured_clicks[i] << endl ; } outfile.close(); } double get_mean_clicks( void ){ std::map::iterator itr; unsigned long long mean_clicks=0; for(itr=_counted_clicks.begin() ; itr!=_counted_clicks.end() ; itr++) { mean_clicks+=(*itr).second*(*itr).first; } return mean_clicks/double(_nb_sample); } double get_shortest_clicks( void ){ return double((*_counted_clicks.begin()).first); } void fill_history_clicks( void ){ _history_mean_clicks.push_back(get_mean_clicks()); _history_shortest_clicks.push_back(get_shortest_clicks()); _history_most_occured_clicks.push_back(get_most_occured_clicks()); } double get_most_occured_clicks( void ){ unsigned long long moc=0; unsigned long long max_occurence=0; std::map::iterator itr; for(itr=_counted_clicks.begin() ; itr!=_counted_clicks.end() ; itr++) { if (max_occurence<=(*itr).second){ max_occurence=(*itr).second; moc=(*itr).first; } } return double(moc); } void clear( void ) { _counted_clicks.clear(); _history_mean_clicks.clear(); _history_shortest_clicks.clear(); _history_most_occured_clicks.clear(); _nb_sample=0; } private : union { unsigned long int n32[2] ; unsigned long long n64 ; } _click_start; union { unsigned long int n32[2] ; unsigned long long n64 ; } _click_stop; double _frequency ; map _counted_clicks; vector _history_mean_clicks; vector _history_shortest_clicks; vector _history_most_occured_clicks; unsigned long long _nb_sample; }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/generic_bench/utils/size_lin_log.hh ================================================ //===================================================== // File : size_lin_log.hh // Author : L. Plagne // Copyright (C) EDF R&D, mar dc 3 18:59:37 CET 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef SIZE_LIN_LOG #define SIZE_LIN_LOG #include "size_log.hh" template void size_lin_log(const int nb_point, const int /*size_min*/, const int size_max, Vector & X) { int ten=10; int nine=9; X.resize(nb_point); if (nb_point>ten){ for (int i=0;i void size_log(const int nb_point, const int size_min, const int size_max, Vector & X) { X.resize(nb_point); float ls_min=log(float(size_min)); float ls_max=log(float(size_max)); float ls=0.0; float delta_ls=(ls_max-ls_min)/(float(nb_point-1)); int size=0; for (int i=0;i //# include ok for gcc3.01 # include /* --- INFOS is always defined (without _DEBUG_): to be used for warnings, with release version --- */ # define HEREWEARE cout< // Copyright (C) EDF R&D, lun sep 30 14:23:20 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef XY_FILE_HH #define XY_FILE_HH #include #include #include #include using namespace std; bool read_xy_file(const std::string & filename, std::vector & tab_sizes, std::vector & tab_mflops, bool quiet = false) { std::ifstream input_file (filename.c_str(),std::ios::in); if (!input_file){ if (!quiet) { INFOS("!!! Error opening "<> size >> mflops ){ nb_point++; tab_sizes.push_back(size); tab_mflops.push_back(mflops); } SCRUTE(nb_point); input_file.close(); return true; } // The Vector class must satisfy the following part of STL vector concept : // resize() method // [] operator for setting element // the vector element must have the << operator define using namespace std; template void dump_xy_file(const Vector_A & X, const Vector_B & Y, const std::string & filename){ ofstream outfile (filename.c_str(),ios::out) ; int size=X.size(); for (int i=0;i BLASFUNC(cdotu) (int *, float *, int *, float *, int *); std::complex BLASFUNC(cdotc) (int *, float *, int *, float *, int *); std::complex BLASFUNC(zdotu) (int *, double *, int *, double *, int *); std::complex BLASFUNC(zdotc) (int *, double *, int *, double *, int *); double BLASFUNC(xdotu) (int *, double *, int *, double *, int *); double BLASFUNC(xdotc) (int *, double *, int *, double *, int *); #endif int BLASFUNC(cdotuw) (int *, float *, int *, float *, int *, float*); int BLASFUNC(cdotcw) (int *, float *, int *, float *, int *, float*); int BLASFUNC(zdotuw) (int *, double *, int *, double *, int *, double*); int BLASFUNC(zdotcw) (int *, double *, int *, double *, int *, double*); int BLASFUNC(saxpy) (int *, float *, float *, int *, float *, int *); int BLASFUNC(daxpy) (int *, double *, double *, int *, double *, int *); int BLASFUNC(qaxpy) (int *, double *, double *, int *, double *, int *); int BLASFUNC(caxpy) (int *, float *, float *, int *, float *, int *); int BLASFUNC(zaxpy) (int *, double *, double *, int *, double *, int *); int BLASFUNC(xaxpy) (int *, double *, double *, int *, double *, int *); int BLASFUNC(caxpyc)(int *, float *, float *, int *, float *, int *); int BLASFUNC(zaxpyc)(int *, double *, double *, int *, double *, int *); int BLASFUNC(xaxpyc)(int *, double *, double *, int *, double *, int *); int BLASFUNC(scopy) (int *, float *, int *, float *, int *); int BLASFUNC(dcopy) (int *, double *, int *, double *, int *); int BLASFUNC(qcopy) (int *, double *, int *, double *, int *); int BLASFUNC(ccopy) (int *, float *, int *, float *, int *); int BLASFUNC(zcopy) (int *, double *, int *, double *, int *); int BLASFUNC(xcopy) (int *, double *, int *, double *, int *); int BLASFUNC(sswap) (int *, float *, int *, float *, int *); int BLASFUNC(dswap) (int *, double *, int *, double *, int *); int BLASFUNC(qswap) (int *, double *, int *, double *, int *); int BLASFUNC(cswap) (int *, float *, int *, float *, int *); int BLASFUNC(zswap) (int *, double *, int *, double *, int *); int BLASFUNC(xswap) (int *, double *, int *, double *, int *); float BLASFUNC(sasum) (int *, float *, int *); float BLASFUNC(scasum)(int *, float *, int *); double BLASFUNC(dasum) (int *, double *, int *); double BLASFUNC(qasum) (int *, double *, int *); double BLASFUNC(dzasum)(int *, double *, int *); double BLASFUNC(qxasum)(int *, double *, int *); int BLASFUNC(isamax)(int *, float *, int *); int BLASFUNC(idamax)(int *, double *, int *); int BLASFUNC(iqamax)(int *, double *, int *); int BLASFUNC(icamax)(int *, float *, int *); int BLASFUNC(izamax)(int *, double *, int *); int BLASFUNC(ixamax)(int *, double *, int *); int BLASFUNC(ismax) (int *, float *, int *); int BLASFUNC(idmax) (int *, double *, int *); int BLASFUNC(iqmax) (int *, double *, int *); int BLASFUNC(icmax) (int *, float *, int *); int BLASFUNC(izmax) (int *, double *, int *); int BLASFUNC(ixmax) (int *, double *, int *); int BLASFUNC(isamin)(int *, float *, int *); int BLASFUNC(idamin)(int *, double *, int *); int BLASFUNC(iqamin)(int *, double *, int *); int BLASFUNC(icamin)(int *, float *, int *); int BLASFUNC(izamin)(int *, double *, int *); int BLASFUNC(ixamin)(int *, double *, int *); int BLASFUNC(ismin)(int *, float *, int *); int BLASFUNC(idmin)(int *, double *, int *); int BLASFUNC(iqmin)(int *, double *, int *); int BLASFUNC(icmin)(int *, float *, int *); int BLASFUNC(izmin)(int *, double *, int *); int BLASFUNC(ixmin)(int *, double *, int *); float BLASFUNC(samax) (int *, float *, int *); double BLASFUNC(damax) (int *, double *, int *); double BLASFUNC(qamax) (int *, double *, int *); float BLASFUNC(scamax)(int *, float *, int *); double BLASFUNC(dzamax)(int *, double *, int *); double BLASFUNC(qxamax)(int *, double *, int *); float BLASFUNC(samin) (int *, float *, int *); double BLASFUNC(damin) (int *, double *, int *); double BLASFUNC(qamin) (int *, double *, int *); float BLASFUNC(scamin)(int *, float *, int *); double BLASFUNC(dzamin)(int *, double *, int *); double BLASFUNC(qxamin)(int *, double *, int *); float BLASFUNC(smax) (int *, float *, int *); double BLASFUNC(dmax) (int *, double *, int *); double BLASFUNC(qmax) (int *, double *, int *); float BLASFUNC(scmax) (int *, float *, int *); double BLASFUNC(dzmax) (int *, double *, int *); double BLASFUNC(qxmax) (int *, double *, int *); float BLASFUNC(smin) (int *, float *, int *); double BLASFUNC(dmin) (int *, double *, int *); double BLASFUNC(qmin) (int *, double *, int *); float BLASFUNC(scmin) (int *, float *, int *); double BLASFUNC(dzmin) (int *, double *, int *); double BLASFUNC(qxmin) (int *, double *, int *); int BLASFUNC(sscal) (int *, float *, float *, int *); int BLASFUNC(dscal) (int *, double *, double *, int *); int BLASFUNC(qscal) (int *, double *, double *, int *); int BLASFUNC(cscal) (int *, float *, float *, int *); int BLASFUNC(zscal) (int *, double *, double *, int *); int BLASFUNC(xscal) (int *, double *, double *, int *); int BLASFUNC(csscal)(int *, float *, float *, int *); int BLASFUNC(zdscal)(int *, double *, double *, int *); int BLASFUNC(xqscal)(int *, double *, double *, int *); float BLASFUNC(snrm2) (int *, float *, int *); float BLASFUNC(scnrm2)(int *, float *, int *); double BLASFUNC(dnrm2) (int *, double *, int *); double BLASFUNC(qnrm2) (int *, double *, int *); double BLASFUNC(dznrm2)(int *, double *, int *); double BLASFUNC(qxnrm2)(int *, double *, int *); int BLASFUNC(srot) (int *, float *, int *, float *, int *, float *, float *); int BLASFUNC(drot) (int *, double *, int *, double *, int *, double *, double *); int BLASFUNC(qrot) (int *, double *, int *, double *, int *, double *, double *); int BLASFUNC(csrot) (int *, float *, int *, float *, int *, float *, float *); int BLASFUNC(zdrot) (int *, double *, int *, double *, int *, double *, double *); int BLASFUNC(xqrot) (int *, double *, int *, double *, int *, double *, double *); int BLASFUNC(srotg) (float *, float *, float *, float *); int BLASFUNC(drotg) (double *, double *, double *, double *); int BLASFUNC(qrotg) (double *, double *, double *, double *); int BLASFUNC(crotg) (float *, float *, float *, float *); int BLASFUNC(zrotg) (double *, double *, double *, double *); int BLASFUNC(xrotg) (double *, double *, double *, double *); int BLASFUNC(srotmg)(float *, float *, float *, float *, float *); int BLASFUNC(drotmg)(double *, double *, double *, double *, double *); int BLASFUNC(srotm) (int *, float *, int *, float *, int *, float *); int BLASFUNC(drotm) (int *, double *, int *, double *, int *, double *); int BLASFUNC(qrotm) (int *, double *, int *, double *, int *, double *); /* Level 2 routines */ int BLASFUNC(sger)(int *, int *, float *, float *, int *, float *, int *, float *, int *); int BLASFUNC(dger)(int *, int *, double *, double *, int *, double *, int *, double *, int *); int BLASFUNC(qger)(int *, int *, double *, double *, int *, double *, int *, double *, int *); int BLASFUNC(cgeru)(int *, int *, float *, float *, int *, float *, int *, float *, int *); int BLASFUNC(cgerc)(int *, int *, float *, float *, int *, float *, int *, float *, int *); int BLASFUNC(zgeru)(int *, int *, double *, double *, int *, double *, int *, double *, int *); int BLASFUNC(zgerc)(int *, int *, double *, double *, int *, double *, int *, double *, int *); int BLASFUNC(xgeru)(int *, int *, double *, double *, int *, double *, int *, double *, int *); int BLASFUNC(xgerc)(int *, int *, double *, double *, int *, double *, int *, double *, int *); int BLASFUNC(sgemv)(char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(dgemv)(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(qgemv)(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(cgemv)(char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zgemv)(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(xgemv)(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(strsv) (char *, char *, char *, int *, float *, int *, float *, int *); int BLASFUNC(dtrsv) (char *, char *, char *, int *, double *, int *, double *, int *); int BLASFUNC(qtrsv) (char *, char *, char *, int *, double *, int *, double *, int *); int BLASFUNC(ctrsv) (char *, char *, char *, int *, float *, int *, float *, int *); int BLASFUNC(ztrsv) (char *, char *, char *, int *, double *, int *, double *, int *); int BLASFUNC(xtrsv) (char *, char *, char *, int *, double *, int *, double *, int *); int BLASFUNC(stpsv) (char *, char *, char *, int *, float *, float *, int *); int BLASFUNC(dtpsv) (char *, char *, char *, int *, double *, double *, int *); int BLASFUNC(qtpsv) (char *, char *, char *, int *, double *, double *, int *); int BLASFUNC(ctpsv) (char *, char *, char *, int *, float *, float *, int *); int BLASFUNC(ztpsv) (char *, char *, char *, int *, double *, double *, int *); int BLASFUNC(xtpsv) (char *, char *, char *, int *, double *, double *, int *); int BLASFUNC(strmv) (char *, char *, char *, int *, float *, int *, float *, int *); int BLASFUNC(dtrmv) (char *, char *, char *, int *, double *, int *, double *, int *); int BLASFUNC(qtrmv) (char *, char *, char *, int *, double *, int *, double *, int *); int BLASFUNC(ctrmv) (char *, char *, char *, int *, float *, int *, float *, int *); int BLASFUNC(ztrmv) (char *, char *, char *, int *, double *, int *, double *, int *); int BLASFUNC(xtrmv) (char *, char *, char *, int *, double *, int *, double *, int *); int BLASFUNC(stpmv) (char *, char *, char *, int *, float *, float *, int *); int BLASFUNC(dtpmv) (char *, char *, char *, int *, double *, double *, int *); int BLASFUNC(qtpmv) (char *, char *, char *, int *, double *, double *, int *); int BLASFUNC(ctpmv) (char *, char *, char *, int *, float *, float *, int *); int BLASFUNC(ztpmv) (char *, char *, char *, int *, double *, double *, int *); int BLASFUNC(xtpmv) (char *, char *, char *, int *, double *, double *, int *); int BLASFUNC(stbmv) (char *, char *, char *, int *, int *, float *, int *, float *, int *); int BLASFUNC(dtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); int BLASFUNC(qtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); int BLASFUNC(ctbmv) (char *, char *, char *, int *, int *, float *, int *, float *, int *); int BLASFUNC(ztbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); int BLASFUNC(xtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); int BLASFUNC(stbsv) (char *, char *, char *, int *, int *, float *, int *, float *, int *); int BLASFUNC(dtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); int BLASFUNC(qtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); int BLASFUNC(ctbsv) (char *, char *, char *, int *, int *, float *, int *, float *, int *); int BLASFUNC(ztbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); int BLASFUNC(xtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); int BLASFUNC(ssymv) (char *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(dsymv) (char *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(qsymv) (char *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(csymv) (char *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zsymv) (char *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(xsymv) (char *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(sspmv) (char *, int *, float *, float *, float *, int *, float *, float *, int *); int BLASFUNC(dspmv) (char *, int *, double *, double *, double *, int *, double *, double *, int *); int BLASFUNC(qspmv) (char *, int *, double *, double *, double *, int *, double *, double *, int *); int BLASFUNC(cspmv) (char *, int *, float *, float *, float *, int *, float *, float *, int *); int BLASFUNC(zspmv) (char *, int *, double *, double *, double *, int *, double *, double *, int *); int BLASFUNC(xspmv) (char *, int *, double *, double *, double *, int *, double *, double *, int *); int BLASFUNC(ssyr) (char *, int *, float *, float *, int *, float *, int *); int BLASFUNC(dsyr) (char *, int *, double *, double *, int *, double *, int *); int BLASFUNC(qsyr) (char *, int *, double *, double *, int *, double *, int *); int BLASFUNC(csyr) (char *, int *, float *, float *, int *, float *, int *); int BLASFUNC(zsyr) (char *, int *, double *, double *, int *, double *, int *); int BLASFUNC(xsyr) (char *, int *, double *, double *, int *, double *, int *); int BLASFUNC(ssyr2) (char *, int *, float *, float *, int *, float *, int *, float *, int *); int BLASFUNC(dsyr2) (char *, int *, double *, double *, int *, double *, int *, double *, int *); int BLASFUNC(qsyr2) (char *, int *, double *, double *, int *, double *, int *, double *, int *); int BLASFUNC(csyr2) (char *, int *, float *, float *, int *, float *, int *, float *, int *); int BLASFUNC(zsyr2) (char *, int *, double *, double *, int *, double *, int *, double *, int *); int BLASFUNC(xsyr2) (char *, int *, double *, double *, int *, double *, int *, double *, int *); int BLASFUNC(sspr) (char *, int *, float *, float *, int *, float *); int BLASFUNC(dspr) (char *, int *, double *, double *, int *, double *); int BLASFUNC(qspr) (char *, int *, double *, double *, int *, double *); int BLASFUNC(cspr) (char *, int *, float *, float *, int *, float *); int BLASFUNC(zspr) (char *, int *, double *, double *, int *, double *); int BLASFUNC(xspr) (char *, int *, double *, double *, int *, double *); int BLASFUNC(sspr2) (char *, int *, float *, float *, int *, float *, int *, float *); int BLASFUNC(dspr2) (char *, int *, double *, double *, int *, double *, int *, double *); int BLASFUNC(qspr2) (char *, int *, double *, double *, int *, double *, int *, double *); int BLASFUNC(cspr2) (char *, int *, float *, float *, int *, float *, int *, float *); int BLASFUNC(zspr2) (char *, int *, double *, double *, int *, double *, int *, double *); int BLASFUNC(xspr2) (char *, int *, double *, double *, int *, double *, int *, double *); int BLASFUNC(cher) (char *, int *, float *, float *, int *, float *, int *); int BLASFUNC(zher) (char *, int *, double *, double *, int *, double *, int *); int BLASFUNC(xher) (char *, int *, double *, double *, int *, double *, int *); int BLASFUNC(chpr) (char *, int *, float *, float *, int *, float *); int BLASFUNC(zhpr) (char *, int *, double *, double *, int *, double *); int BLASFUNC(xhpr) (char *, int *, double *, double *, int *, double *); int BLASFUNC(cher2) (char *, int *, float *, float *, int *, float *, int *, float *, int *); int BLASFUNC(zher2) (char *, int *, double *, double *, int *, double *, int *, double *, int *); int BLASFUNC(xher2) (char *, int *, double *, double *, int *, double *, int *, double *, int *); int BLASFUNC(chpr2) (char *, int *, float *, float *, int *, float *, int *, float *); int BLASFUNC(zhpr2) (char *, int *, double *, double *, int *, double *, int *, double *); int BLASFUNC(xhpr2) (char *, int *, double *, double *, int *, double *, int *, double *); int BLASFUNC(chemv) (char *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zhemv) (char *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(xhemv) (char *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(chpmv) (char *, int *, float *, float *, float *, int *, float *, float *, int *); int BLASFUNC(zhpmv) (char *, int *, double *, double *, double *, int *, double *, double *, int *); int BLASFUNC(xhpmv) (char *, int *, double *, double *, double *, int *, double *, double *, int *); int BLASFUNC(snorm)(char *, int *, int *, float *, int *); int BLASFUNC(dnorm)(char *, int *, int *, double *, int *); int BLASFUNC(cnorm)(char *, int *, int *, float *, int *); int BLASFUNC(znorm)(char *, int *, int *, double *, int *); int BLASFUNC(sgbmv)(char *, int *, int *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(dgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(qgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(cgbmv)(char *, int *, int *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(xgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(ssbmv)(char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(dsbmv)(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(qsbmv)(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(csbmv)(char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zsbmv)(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(xsbmv)(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(chbmv)(char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zhbmv)(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(xhbmv)(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); /* Level 3 routines */ int BLASFUNC(sgemm)(char *, char *, int *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(dgemm)(char *, char *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(qgemm)(char *, char *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(cgemm)(char *, char *, int *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zgemm)(char *, char *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(xgemm)(char *, char *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(cgemm3m)(char *, char *, int *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zgemm3m)(char *, char *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(xgemm3m)(char *, char *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(sge2mm)(char *, char *, char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(dge2mm)(char *, char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(cge2mm)(char *, char *, char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zge2mm)(char *, char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(strsm)(char *, char *, char *, char *, int *, int *, float *, float *, int *, float *, int *); int BLASFUNC(dtrsm)(char *, char *, char *, char *, int *, int *, double *, double *, int *, double *, int *); int BLASFUNC(qtrsm)(char *, char *, char *, char *, int *, int *, double *, double *, int *, double *, int *); int BLASFUNC(ctrsm)(char *, char *, char *, char *, int *, int *, float *, float *, int *, float *, int *); int BLASFUNC(ztrsm)(char *, char *, char *, char *, int *, int *, double *, double *, int *, double *, int *); int BLASFUNC(xtrsm)(char *, char *, char *, char *, int *, int *, double *, double *, int *, double *, int *); int BLASFUNC(strmm)(char *, char *, char *, char *, int *, int *, float *, float *, int *, float *, int *); int BLASFUNC(dtrmm)(char *, char *, char *, char *, int *, int *, double *, double *, int *, double *, int *); int BLASFUNC(qtrmm)(char *, char *, char *, char *, int *, int *, double *, double *, int *, double *, int *); int BLASFUNC(ctrmm)(char *, char *, char *, char *, int *, int *, float *, float *, int *, float *, int *); int BLASFUNC(ztrmm)(char *, char *, char *, char *, int *, int *, double *, double *, int *, double *, int *); int BLASFUNC(xtrmm)(char *, char *, char *, char *, int *, int *, double *, double *, int *, double *, int *); int BLASFUNC(ssymm)(char *, char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(dsymm)(char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(qsymm)(char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(csymm)(char *, char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zsymm)(char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(xsymm)(char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(csymm3m)(char *, char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zsymm3m)(char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(xsymm3m)(char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(ssyrk)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *); int BLASFUNC(dsyrk)(char *, char *, int *, int *, double *, double *, int *, double *, double *, int *); int BLASFUNC(qsyrk)(char *, char *, int *, int *, double *, double *, int *, double *, double *, int *); int BLASFUNC(csyrk)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *); int BLASFUNC(zsyrk)(char *, char *, int *, int *, double *, double *, int *, double *, double *, int *); int BLASFUNC(xsyrk)(char *, char *, int *, int *, double *, double *, int *, double *, double *, int *); int BLASFUNC(ssyr2k)(char *, char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(dsyr2k)(char *, char *, int *, int *, double *, double *, int *, double*, int *, double *, double *, int *); int BLASFUNC(qsyr2k)(char *, char *, int *, int *, double *, double *, int *, double*, int *, double *, double *, int *); int BLASFUNC(csyr2k)(char *, char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zsyr2k)(char *, char *, int *, int *, double *, double *, int *, double*, int *, double *, double *, int *); int BLASFUNC(xsyr2k)(char *, char *, int *, int *, double *, double *, int *, double*, int *, double *, double *, int *); int BLASFUNC(chemm)(char *, char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zhemm)(char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(xhemm)(char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(chemm3m)(char *, char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zhemm3m)(char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(xhemm3m)(char *, char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); int BLASFUNC(cherk)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *); int BLASFUNC(zherk)(char *, char *, int *, int *, double *, double *, int *, double *, double *, int *); int BLASFUNC(xherk)(char *, char *, int *, int *, double *, double *, int *, double *, double *, int *); int BLASFUNC(cher2k)(char *, char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zher2k)(char *, char *, int *, int *, double *, double *, int *, double*, int *, double *, double *, int *); int BLASFUNC(xher2k)(char *, char *, int *, int *, double *, double *, int *, double*, int *, double *, double *, int *); int BLASFUNC(cher2m)(char *, char *, char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *); int BLASFUNC(zher2m)(char *, char *, char *, int *, int *, double *, double *, int *, double*, int *, double *, double *, int *); int BLASFUNC(xher2m)(char *, char *, char *, int *, int *, double *, double *, int *, double*, int *, double *, double *, int *); int BLASFUNC(sgemt)(char *, int *, int *, float *, float *, int *, float *, int *); int BLASFUNC(dgemt)(char *, int *, int *, double *, double *, int *, double *, int *); int BLASFUNC(cgemt)(char *, int *, int *, float *, float *, int *, float *, int *); int BLASFUNC(zgemt)(char *, int *, int *, double *, double *, int *, double *, int *); int BLASFUNC(sgema)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, float *, int *); int BLASFUNC(dgema)(char *, char *, int *, int *, double *, double *, int *, double*, double *, int *, double*, int *); int BLASFUNC(cgema)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, float *, int *); int BLASFUNC(zgema)(char *, char *, int *, int *, double *, double *, int *, double*, double *, int *, double*, int *); int BLASFUNC(sgems)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, float *, int *); int BLASFUNC(dgems)(char *, char *, int *, int *, double *, double *, int *, double*, double *, int *, double*, int *); int BLASFUNC(cgems)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, float *, int *); int BLASFUNC(zgems)(char *, char *, int *, int *, double *, double *, int *, double*, double *, int *, double*, int *); int BLASFUNC(sgetf2)(int *, int *, float *, int *, int *, int *); int BLASFUNC(dgetf2)(int *, int *, double *, int *, int *, int *); int BLASFUNC(qgetf2)(int *, int *, double *, int *, int *, int *); int BLASFUNC(cgetf2)(int *, int *, float *, int *, int *, int *); int BLASFUNC(zgetf2)(int *, int *, double *, int *, int *, int *); int BLASFUNC(xgetf2)(int *, int *, double *, int *, int *, int *); int BLASFUNC(sgetrf)(int *, int *, float *, int *, int *, int *); int BLASFUNC(dgetrf)(int *, int *, double *, int *, int *, int *); int BLASFUNC(qgetrf)(int *, int *, double *, int *, int *, int *); int BLASFUNC(cgetrf)(int *, int *, float *, int *, int *, int *); int BLASFUNC(zgetrf)(int *, int *, double *, int *, int *, int *); int BLASFUNC(xgetrf)(int *, int *, double *, int *, int *, int *); int BLASFUNC(slaswp)(int *, float *, int *, int *, int *, int *, int *); int BLASFUNC(dlaswp)(int *, double *, int *, int *, int *, int *, int *); int BLASFUNC(qlaswp)(int *, double *, int *, int *, int *, int *, int *); int BLASFUNC(claswp)(int *, float *, int *, int *, int *, int *, int *); int BLASFUNC(zlaswp)(int *, double *, int *, int *, int *, int *, int *); int BLASFUNC(xlaswp)(int *, double *, int *, int *, int *, int *, int *); int BLASFUNC(sgetrs)(char *, int *, int *, float *, int *, int *, float *, int *, int *); int BLASFUNC(dgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); int BLASFUNC(qgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); int BLASFUNC(cgetrs)(char *, int *, int *, float *, int *, int *, float *, int *, int *); int BLASFUNC(zgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); int BLASFUNC(xgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); int BLASFUNC(sgesv)(int *, int *, float *, int *, int *, float *, int *, int *); int BLASFUNC(dgesv)(int *, int *, double *, int *, int *, double*, int *, int *); int BLASFUNC(qgesv)(int *, int *, double *, int *, int *, double*, int *, int *); int BLASFUNC(cgesv)(int *, int *, float *, int *, int *, float *, int *, int *); int BLASFUNC(zgesv)(int *, int *, double *, int *, int *, double*, int *, int *); int BLASFUNC(xgesv)(int *, int *, double *, int *, int *, double*, int *, int *); int BLASFUNC(spotf2)(char *, int *, float *, int *, int *); int BLASFUNC(dpotf2)(char *, int *, double *, int *, int *); int BLASFUNC(qpotf2)(char *, int *, double *, int *, int *); int BLASFUNC(cpotf2)(char *, int *, float *, int *, int *); int BLASFUNC(zpotf2)(char *, int *, double *, int *, int *); int BLASFUNC(xpotf2)(char *, int *, double *, int *, int *); int BLASFUNC(spotrf)(char *, int *, float *, int *, int *); int BLASFUNC(dpotrf)(char *, int *, double *, int *, int *); int BLASFUNC(qpotrf)(char *, int *, double *, int *, int *); int BLASFUNC(cpotrf)(char *, int *, float *, int *, int *); int BLASFUNC(zpotrf)(char *, int *, double *, int *, int *); int BLASFUNC(xpotrf)(char *, int *, double *, int *, int *); int BLASFUNC(slauu2)(char *, int *, float *, int *, int *); int BLASFUNC(dlauu2)(char *, int *, double *, int *, int *); int BLASFUNC(qlauu2)(char *, int *, double *, int *, int *); int BLASFUNC(clauu2)(char *, int *, float *, int *, int *); int BLASFUNC(zlauu2)(char *, int *, double *, int *, int *); int BLASFUNC(xlauu2)(char *, int *, double *, int *, int *); int BLASFUNC(slauum)(char *, int *, float *, int *, int *); int BLASFUNC(dlauum)(char *, int *, double *, int *, int *); int BLASFUNC(qlauum)(char *, int *, double *, int *, int *); int BLASFUNC(clauum)(char *, int *, float *, int *, int *); int BLASFUNC(zlauum)(char *, int *, double *, int *, int *); int BLASFUNC(xlauum)(char *, int *, double *, int *, int *); int BLASFUNC(strti2)(char *, char *, int *, float *, int *, int *); int BLASFUNC(dtrti2)(char *, char *, int *, double *, int *, int *); int BLASFUNC(qtrti2)(char *, char *, int *, double *, int *, int *); int BLASFUNC(ctrti2)(char *, char *, int *, float *, int *, int *); int BLASFUNC(ztrti2)(char *, char *, int *, double *, int *, int *); int BLASFUNC(xtrti2)(char *, char *, int *, double *, int *, int *); int BLASFUNC(strtri)(char *, char *, int *, float *, int *, int *); int BLASFUNC(dtrtri)(char *, char *, int *, double *, int *, int *); int BLASFUNC(qtrtri)(char *, char *, int *, double *, int *, int *); int BLASFUNC(ctrtri)(char *, char *, int *, float *, int *, int *); int BLASFUNC(ztrtri)(char *, char *, int *, double *, int *, int *); int BLASFUNC(xtrtri)(char *, char *, int *, double *, int *, int *); int BLASFUNC(spotri)(char *, int *, float *, int *, int *); int BLASFUNC(dpotri)(char *, int *, double *, int *, int *); int BLASFUNC(qpotri)(char *, int *, double *, int *, int *); int BLASFUNC(cpotri)(char *, int *, float *, int *, int *); int BLASFUNC(zpotri)(char *, int *, double *, int *, int *); int BLASFUNC(xpotri)(char *, int *, double *, int *, int *); #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/BLAS/blas_interface.hh ================================================ //===================================================== // File : blas_interface.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:28 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef blas_PRODUIT_MATRICE_VECTEUR_HH #define blas_PRODUIT_MATRICE_VECTEUR_HH #include #include extern "C" { #include "blas.h" // Cholesky Factorization // void spotrf_(const char* uplo, const int* n, float *a, const int* ld, int* info); // void dpotrf_(const char* uplo, const int* n, double *a, const int* ld, int* info); void ssytrd_(char *uplo, const int *n, float *a, const int *lda, float *d, float *e, float *tau, float *work, int *lwork, int *info ); void dsytrd_(char *uplo, const int *n, double *a, const int *lda, double *d, double *e, double *tau, double *work, int *lwork, int *info ); void sgehrd_( const int *n, int *ilo, int *ihi, float *a, const int *lda, float *tau, float *work, int *lwork, int *info ); void dgehrd_( const int *n, int *ilo, int *ihi, double *a, const int *lda, double *tau, double *work, int *lwork, int *info ); // LU row pivoting // void dgetrf_( int *m, int *n, double *a, int *lda, int *ipiv, int *info ); // void sgetrf_(const int* m, const int* n, float *a, const int* ld, int* ipivot, int* info); // LU full pivoting void sgetc2_(const int* n, float *a, const int *lda, int *ipiv, int *jpiv, int*info ); void dgetc2_(const int* n, double *a, const int *lda, int *ipiv, int *jpiv, int*info ); #ifdef HAS_LAPACK #endif } #define MAKE_STRING2(S) #S #define MAKE_STRING(S) MAKE_STRING2(S) #define CAT2(A,B) A##B #define CAT(A,B) CAT2(A,B) template class blas_interface; static char notrans = 'N'; static char trans = 'T'; static char nonunit = 'N'; static char lower = 'L'; static char right = 'R'; static char left = 'L'; static int intone = 1; #define SCALAR float #define SCALAR_PREFIX s #include "blas_interface_impl.hh" #undef SCALAR #undef SCALAR_PREFIX #define SCALAR double #define SCALAR_PREFIX d #include "blas_interface_impl.hh" #undef SCALAR #undef SCALAR_PREFIX #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/BLAS/blas_interface_impl.hh ================================================ #define BLAS_FUNC(NAME) CAT(CAT(SCALAR_PREFIX,NAME),_) template<> class blas_interface : public c_interface_base { public : static SCALAR fone; static SCALAR fzero; static inline std::string name() { return MAKE_STRING(CBLASNAME); } static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ BLAS_FUNC(gemv)(¬rans,&N,&N,&fone,A,&N,B,&intone,&fzero,X,&intone); } static inline void symv(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ BLAS_FUNC(symv)(&lower, &N,&fone,A,&N,B,&intone,&fzero,X,&intone); } static inline void syr2(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ BLAS_FUNC(syr2)(&lower,&N,&fone,B,&intone,X,&intone,A,&N); } static inline void ger(gene_matrix & A, gene_vector & X, gene_vector & Y, int N){ BLAS_FUNC(ger)(&N,&N,&fone,X,&intone,Y,&intone,A,&N); } static inline void rot(gene_vector & A, gene_vector & B, SCALAR c, SCALAR s, int N){ BLAS_FUNC(rot)(&N,A,&intone,B,&intone,&c,&s); } static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ BLAS_FUNC(gemv)(&trans,&N,&N,&fone,A,&N,B,&intone,&fzero,X,&intone); } static inline void matrix_matrix_product(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N){ BLAS_FUNC(gemm)(¬rans,¬rans,&N,&N,&N,&fone,A,&N,B,&N,&fzero,X,&N); } static inline void transposed_matrix_matrix_product(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N){ BLAS_FUNC(gemm)(¬rans,¬rans,&N,&N,&N,&fone,A,&N,B,&N,&fzero,X,&N); } static inline void ata_product(gene_matrix & A, gene_matrix & X, int N){ BLAS_FUNC(syrk)(&lower,&trans,&N,&N,&fone,A,&N,&fzero,X,&N); } static inline void aat_product(gene_matrix & A, gene_matrix & X, int N){ BLAS_FUNC(syrk)(&lower,¬rans,&N,&N,&fone,A,&N,&fzero,X,&N); } static inline void axpy(SCALAR coef, const gene_vector & X, gene_vector & Y, int N){ BLAS_FUNC(axpy)(&N,&coef,X,&intone,Y,&intone); } static inline void axpby(SCALAR a, const gene_vector & X, SCALAR b, gene_vector & Y, int N){ BLAS_FUNC(scal)(&N,&b,Y,&intone); BLAS_FUNC(axpy)(&N,&a,X,&intone,Y,&intone); } static inline void cholesky(const gene_matrix & X, gene_matrix & C, int N){ int N2 = N*N; BLAS_FUNC(copy)(&N2, X, &intone, C, &intone); char uplo = 'L'; int info = 0; BLAS_FUNC(potrf)(&uplo, &N, C, &N, &info); if(info!=0) std::cerr << "potrf_ error " << info << "\n"; } static inline void partial_lu_decomp(const gene_matrix & X, gene_matrix & C, int N){ int N2 = N*N; BLAS_FUNC(copy)(&N2, X, &intone, C, &intone); int info = 0; int * ipiv = (int*)alloca(sizeof(int)*N); BLAS_FUNC(getrf)(&N, &N, C, &N, ipiv, &info); if(info!=0) std::cerr << "getrf_ error " << info << "\n"; } static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector & X, int N){ BLAS_FUNC(copy)(&N, B, &intone, X, &intone); BLAS_FUNC(trsv)(&lower, ¬rans, &nonunit, &N, L, &N, X, &intone); } static inline void trisolve_lower_matrix(const gene_matrix & L, const gene_matrix& B, gene_matrix & X, int N){ BLAS_FUNC(copy)(&N, B, &intone, X, &intone); BLAS_FUNC(trsm)(&right, &lower, ¬rans, &nonunit, &N, &N, &fone, L, &N, X, &N); } static inline void trmm(gene_matrix & A, gene_matrix & B, gene_matrix & /*X*/, int N){ BLAS_FUNC(trmm)(&left, &lower, ¬rans,&nonunit, &N,&N,&fone,A,&N,B,&N); } #ifdef HAS_LAPACK static inline void lu_decomp(const gene_matrix & X, gene_matrix & C, int N){ int N2 = N*N; BLAS_FUNC(copy)(&N2, X, &intone, C, &intone); int info = 0; int * ipiv = (int*)alloca(sizeof(int)*N); int * jpiv = (int*)alloca(sizeof(int)*N); BLAS_FUNC(getc2)(&N, C, &N, ipiv, jpiv, &info); } static inline void hessenberg(const gene_matrix & X, gene_matrix & C, int N){ { int N2 = N*N; int inc = 1; BLAS_FUNC(copy)(&N2, X, &inc, C, &inc); } int info = 0; int ilo = 1; int ihi = N; int bsize = 64; int worksize = N*bsize; SCALAR* d = new SCALAR[N+worksize]; BLAS_FUNC(gehrd)(&N, &ilo, &ihi, C, &N, d, d+N, &worksize, &info); delete[] d; } static inline void tridiagonalization(const gene_matrix & X, gene_matrix & C, int N){ { int N2 = N*N; int inc = 1; BLAS_FUNC(copy)(&N2, X, &inc, C, &inc); } char uplo = 'U'; int info = 0; int bsize = 64; int worksize = N*bsize; SCALAR* d = new SCALAR[3*N+worksize]; BLAS_FUNC(sytrd)(&uplo, &N, C, &N, d, d+N, d+2*N, d+3*N, &worksize, &info); delete[] d; } #endif // HAS_LAPACK }; SCALAR blas_interface::fone = SCALAR(1); SCALAR blas_interface::fzero = SCALAR(0); ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/BLAS/c_interface_base.h ================================================ #ifndef BTL_C_INTERFACE_BASE_H #define BTL_C_INTERFACE_BASE_H #include "utilities.h" #include template class c_interface_base { public: typedef real real_type; typedef std::vector stl_vector; typedef std::vector stl_matrix; typedef real* gene_matrix; typedef real* gene_vector; static void free_matrix(gene_matrix & A, int /*N*/){ delete[] A; } static void free_vector(gene_vector & B){ delete[] B; } static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ int N = A_stl.size(); A = new real[N*N]; for (int j=0;j // Copyright (C) EDF R&D, lun sep 30 14:23:28 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #include "utilities.h" #include "blas_interface.hh" #include "bench.hh" #include "basic_actions.hh" #include "action_cholesky.hh" #include "action_lu_decomp.hh" #include "action_partial_lu.hh" #include "action_trisolve_matrix.hh" #ifdef HAS_LAPACK #include "action_hessenberg.hh" #endif BTL_MAIN; int main() { bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_LU,MAX_LU,NB_POINT); bench > >(MIN_LU,MAX_LU,NB_POINT); #ifdef HAS_LAPACK // bench > >(MIN_LU,MAX_LU,NB_POINT); bench > >(MIN_LU,MAX_LU,NB_POINT); bench > >(MIN_LU,MAX_LU,NB_POINT); #endif //bench > >(MIN_LU,MAX_LU,NB_POINT); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/STL/CMakeLists.txt ================================================ btl_add_bench(btl_STL main.cpp OFF) ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/STL/STL_interface.hh ================================================ //===================================================== // File : STL_interface.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:24 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef STL_INTERFACE_HH #define STL_INTERFACE_HH #include #include #include "utilities.h" using namespace std; template class STL_interface{ public : typedef real real_type ; typedef std::vector stl_vector; typedef std::vector stl_matrix; typedef stl_matrix gene_matrix; typedef stl_vector gene_vector; static inline std::string name( void ) { return "STL"; } static void free_matrix(gene_matrix & /*A*/, int /*N*/){} static void free_vector(gene_vector & /*B*/){} static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ A = A_stl; } static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){ B = B_stl; } static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){ B_stl = B ; } static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){ A_stl = A ; } static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){ for (int i=0;i=j) { for (int k=0;k > >(MIN_AXPY,MAX_AXPY,NB_POINT); bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/blaze/CMakeLists.txt ================================================ find_package(BLAZE) find_package(Boost COMPONENTS system) if (BLAZE_FOUND AND Boost_FOUND) include_directories(${BLAZE_INCLUDE_DIR} ${Boost_INCLUDE_DIRS}) btl_add_bench(btl_blaze main.cpp) # Note: The newest blaze version requires C++14. # Ideally, we should set this depending on the version of Blaze we found set_property(TARGET btl_blaze PROPERTY CXX_STANDARD 14) if(BUILD_btl_blaze) target_link_libraries(btl_blaze ${Boost_LIBRARIES}) endif() endif () ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/blaze/blaze_interface.hh ================================================ //===================================================== // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef BLAZE_INTERFACE_HH #define BLAZE_INTERFACE_HH #include #include #include // using namespace blaze; #include template class blaze_interface { public : typedef real real_type ; typedef std::vector stl_vector; typedef std::vector stl_matrix; typedef blaze::DynamicMatrix gene_matrix; typedef blaze::DynamicVector gene_vector; static inline std::string name() { return "blaze"; } static void free_matrix(gene_matrix & A, int N){ return ; } static void free_vector(gene_vector & B){ return ; } static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ A.resize(A_stl[0].size(), A_stl.size()); for (int j=0; j ipvt(N); // lu_factor(R, ipvt); // } // static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector & X, int N){ // X = lower_trisolve(L, B); // } static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){ cible = source; } static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){ cible = source; } }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/blaze/main.cpp ================================================ //===================================================== // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #include "utilities.h" #include "blaze_interface.hh" #include "bench.hh" #include "basic_actions.hh" BTL_MAIN; int main() { bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/blitz/CMakeLists.txt ================================================ find_package(Blitz) if (BLITZ_FOUND) include_directories(${BLITZ_INCLUDES}) btl_add_bench(btl_blitz btl_blitz.cpp) if (BUILD_btl_blitz) target_link_libraries(btl_blitz ${BLITZ_LIBRARIES}) endif () btl_add_bench(btl_tiny_blitz btl_tiny_blitz.cpp OFF) if (BUILD_btl_tiny_blitz) target_link_libraries(btl_tiny_blitz ${BLITZ_LIBRARIES}) endif () endif () ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/blitz/blitz_LU_solve_interface.hh ================================================ //===================================================== // File : blitz_LU_solve_interface.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:31 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef BLITZ_LU_SOLVE_INTERFACE_HH #define BLITZ_LU_SOLVE_INTERFACE_HH #include "blitz/array.h" #include BZ_USING_NAMESPACE(blitz) template class blitz_LU_solve_interface : public blitz_interface { public : typedef typename blitz_interface::gene_matrix gene_matrix; typedef typename blitz_interface::gene_vector gene_vector; typedef blitz::Array Pivot_Vector; inline static void new_Pivot_Vector(Pivot_Vector & pivot,int N) { pivot.resize(N); } inline static void free_Pivot_Vector(Pivot_Vector & pivot) { return; } static inline real matrix_vector_product_sliced(const gene_matrix & A, gene_vector B, int row, int col_start, int col_end) { real somme=0.; for (int j=col_start ; j=big ) big = abs( LU( i, j ) ) ; } if( big==0. ) { INFOS( "blitz_LU_factor::Singular matrix" ) ; exit( 0 ) ; } ImplicitScaling( i ) = 1./big ; } // Loop over columns of Crout's method : for( int j=0; j=big ) { dum = ImplicitScaling( i )*abs( theSum ) ; big = dum ; index_max = i ; } } // Interchanging rows and the scale factor : if( j!=index_max ) { for( int k=0; k=0; i-- ) { theSum = X( i ) ; // theSum = B( i ) ; theSum -= matrix_vector_product_sliced(LU, X, i, i+1, N) ; // theSum -= sum( LU( i, Range( i+1, toEnd ) )*X( Range( i+1, toEnd ) ) ) ; // theSum -= sum( LU( i, Range( i+1, toEnd ) )*B( Range( i+1, toEnd ) ) ) ; // Store a component of the solution vector : X( i ) = theSum/LU( i, i ) ; // B( i ) = theSum/LU( i, i ) ; } } }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/blitz/blitz_interface.hh ================================================ //===================================================== // File : blitz_interface.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002 // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef BLITZ_INTERFACE_HH #define BLITZ_INTERFACE_HH #include #include #include #include #include #include BZ_USING_NAMESPACE(blitz) template class blitz_interface{ public : typedef real real_type ; typedef std::vector stl_vector; typedef std::vector stl_matrix; typedef blitz::Array gene_matrix; typedef blitz::Array gene_vector; // typedef blitz::Matrix gene_matrix; // typedef blitz::Vector gene_vector; static inline std::string name() { return "blitz"; } static void free_matrix(gene_matrix & A, int N){} static void free_vector(gene_vector & B){} static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ A.resize(A_stl[0].size(),A_stl.size()); for (int j=0; j(source); // for (int i=0;i(source); cible = source; } }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/blitz/btl_blitz.cpp ================================================ //===================================================== // File : main.cpp // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #include "utilities.h" #include "blitz_interface.hh" #include "blitz_LU_solve_interface.hh" #include "bench.hh" #include "action_matrix_vector_product.hh" #include "action_matrix_matrix_product.hh" #include "action_axpy.hh" #include "action_lu_solve.hh" #include "action_ata_product.hh" #include "action_aat_product.hh" #include "action_atv_product.hh" BTL_MAIN; int main() { bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); //bench > >(MIN_LU,MAX_LU,NB_POINT); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/blitz/btl_tiny_blitz.cpp ================================================ //===================================================== // File : main.cpp // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #include "utilities.h" #include "tiny_blitz_interface.hh" #include "static/bench_static.hh" #include "action_matrix_vector_product.hh" #include "action_matrix_matrix_product.hh" #include "action_axpy.hh" BTL_MAIN; int main() { bench_static(); bench_static(); bench_static(); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/blitz/tiny_blitz_interface.hh ================================================ //===================================================== // File : tiny_blitz_interface.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef TINY_BLITZ_INTERFACE_HH #define TINY_BLITZ_INTERFACE_HH #include "blitz/array.h" #include "blitz/tiny.h" #include "blitz/tinymat.h" #include "blitz/tinyvec.h" #include #include BZ_USING_NAMESPACE(blitz) template class tiny_blitz_interface { public : typedef real real_type ; typedef std::vector stl_vector; typedef std::vector stl_matrix; typedef TinyVector gene_vector; typedef TinyMatrix gene_matrix; static inline std::string name() { return "tiny_blitz"; } static void free_matrix(gene_matrix & A, int N){} static void free_vector(gene_vector & B){} static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ for (int j=0; j //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #include "utilities.h" #include "eigen3_interface.hh" #include "static/bench_static.hh" #include "action_matrix_vector_product.hh" #include "action_matrix_matrix_product.hh" #include "action_axpy.hh" #include "action_lu_solve.hh" #include "action_ata_product.hh" #include "action_aat_product.hh" #include "action_atv_product.hh" #include "action_cholesky.hh" #include "action_trisolve.hh" BTL_MAIN; int main() { bench_static(); bench_static(); bench_static(); bench_static(); bench_static(); bench_static(); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/eigen2/eigen2_interface.hh ================================================ //===================================================== // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef EIGEN2_INTERFACE_HH #define EIGEN2_INTERFACE_HH // #include #include #include #include #include #include #include "btl.hh" using namespace Eigen; template class eigen2_interface { public : enum {IsFixedSize = (SIZE!=Dynamic)}; typedef real real_type; typedef std::vector stl_vector; typedef std::vector stl_matrix; typedef Eigen::Matrix gene_matrix; typedef Eigen::Matrix gene_vector; static inline std::string name( void ) { #if defined(EIGEN_VECTORIZE_SSE) if (SIZE==Dynamic) return "eigen2"; else return "tiny_eigen2"; #elif defined(EIGEN_VECTORIZE_ALTIVEC) || defined(EIGEN_VECTORIZE_VSX) if (SIZE==Dynamic) return "eigen2"; else return "tiny_eigen2"; #else if (SIZE==Dynamic) return "eigen2_novec"; else return "tiny_eigen2_novec"; #endif } static void free_matrix(gene_matrix & A, int N) {} static void free_vector(gene_vector & B) {} static BTL_DONT_INLINE void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ A.resize(A_stl[0].size(), A_stl.size()); for (int j=0; j().solveTriangular(B); } static inline void trisolve_lower_matrix(const gene_matrix & L, const gene_matrix& B, gene_matrix& X, int N){ X = L.template marked().solveTriangular(B); } static inline void cholesky(const gene_matrix & X, gene_matrix & C, int N){ C = X.llt().matrixL(); // C = X; // Cholesky::computeInPlace(C); // Cholesky::computeInPlaceBlock(C); } static inline void lu_decomp(const gene_matrix & X, gene_matrix & C, int N){ C = X.lu().matrixLU(); // C = X.inverse(); } static inline void tridiagonalization(const gene_matrix & X, gene_matrix & C, int N){ C = Tridiagonalization(X).packedMatrix(); } static inline void hessenberg(const gene_matrix & X, gene_matrix & C, int N){ C = HessenbergDecomposition(X).packedMatrix(); } }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/eigen2/main_adv.cpp ================================================ //===================================================== // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #include "utilities.h" #include "eigen2_interface.hh" #include "bench.hh" #include "action_trisolve.hh" #include "action_trisolve_matrix.hh" #include "action_cholesky.hh" #include "action_hessenberg.hh" #include "action_lu_decomp.hh" // #include "action_partial_lu.hh" BTL_MAIN; int main() { bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); // bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/eigen2/main_linear.cpp ================================================ //===================================================== // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #include "utilities.h" #include "eigen2_interface.hh" #include "bench.hh" #include "basic_actions.hh" BTL_MAIN; int main() { bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/eigen2/main_matmat.cpp ================================================ //===================================================== // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #include "utilities.h" #include "eigen2_interface.hh" #include "bench.hh" #include "basic_actions.hh" BTL_MAIN; int main() { bench > >(MIN_MM,MAX_MM,NB_POINT); // bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); // bench > >(MIN_MM,MAX_MM,NB_POINT); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/eigen2/main_vecmat.cpp ================================================ //===================================================== // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #include "utilities.h" #include "eigen2_interface.hh" #include "bench.hh" #include "basic_actions.hh" BTL_MAIN; int main() { bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); // bench > >(MIN_MV,MAX_MV,NB_POINT); // bench > >(MIN_MV,MAX_MV,NB_POINT); // bench > >(MIN_MV,MAX_MV,NB_POINT); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/eigen3/CMakeLists.txt ================================================ if((NOT EIGEN3_INCLUDE_DIR) AND Eigen_SOURCE_DIR) # unless EIGEN3_INCLUDE_DIR is defined, let's use current Eigen version set(EIGEN3_INCLUDE_DIR ${Eigen_SOURCE_DIR}) set(EIGEN3_FOUND TRUE) else() find_package(Eigen3) endif() if (EIGEN3_FOUND) include_directories(${EIGEN3_INCLUDE_DIR}) btl_add_bench(btl_eigen3_linear main_linear.cpp) btl_add_bench(btl_eigen3_vecmat main_vecmat.cpp) btl_add_bench(btl_eigen3_matmat main_matmat.cpp) btl_add_bench(btl_eigen3_adv main_adv.cpp ) btl_add_target_property(btl_eigen3_linear COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen3") btl_add_target_property(btl_eigen3_vecmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen3") btl_add_target_property(btl_eigen3_matmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen3") btl_add_target_property(btl_eigen3_adv COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen3") option(BTL_BENCH_NOGCCVEC "also bench Eigen explicit vec without GCC's auto vec" OFF) if(CMAKE_COMPILER_IS_GNUCXX AND BTL_BENCH_NOGCCVEC) btl_add_bench(btl_eigen3_nogccvec_linear main_linear.cpp) btl_add_bench(btl_eigen3_nogccvec_vecmat main_vecmat.cpp) btl_add_bench(btl_eigen3_nogccvec_matmat main_matmat.cpp) btl_add_bench(btl_eigen3_nogccvec_adv main_adv.cpp ) btl_add_target_property(btl_eigen3_nogccvec_linear COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=eigen3_nogccvec") btl_add_target_property(btl_eigen3_nogccvec_vecmat COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=eigen3_nogccvec") btl_add_target_property(btl_eigen3_nogccvec_matmat COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=eigen3_nogccvec") btl_add_target_property(btl_eigen3_nogccvec_adv COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=eigen3_nogccvec") endif() if(NOT BTL_NOVEC) btl_add_bench(btl_eigen3_novec_linear main_linear.cpp OFF) btl_add_bench(btl_eigen3_novec_vecmat main_vecmat.cpp OFF) btl_add_bench(btl_eigen3_novec_matmat main_matmat.cpp OFF) btl_add_bench(btl_eigen3_novec_adv main_adv.cpp OFF) btl_add_target_property(btl_eigen3_novec_linear COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_novec") btl_add_target_property(btl_eigen3_novec_vecmat COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_novec") btl_add_target_property(btl_eigen3_novec_matmat COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_novec") btl_add_target_property(btl_eigen3_novec_adv COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_novec") # if(BUILD_btl_eigen3_adv) # target_link_libraries(btl_eigen3_adv ${MKL_LIBRARIES}) # endif() endif() btl_add_bench(btl_tiny_eigen3 btl_tiny_eigen3.cpp OFF) if(NOT BTL_NOVEC) btl_add_bench(btl_tiny_eigen3_novec btl_tiny_eigen3.cpp OFF) btl_add_target_property(btl_tiny_eigen3_novec COMPILE_FLAGS "-DBTL_PREFIX=eigen3_tiny") if(BUILD_btl_tiny_eigen3_novec) btl_add_target_property(btl_tiny_eigen3_novec COMPILE_FLAGS "-DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_tiny_novec") endif() endif() endif () ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/eigen3/btl_tiny_eigen3.cpp ================================================ //===================================================== // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #include "utilities.h" #include "eigen3_interface.hh" #include "static/bench_static.hh" #include "action_matrix_vector_product.hh" #include "action_matrix_matrix_product.hh" #include "action_axpy.hh" #include "action_lu_solve.hh" #include "action_ata_product.hh" #include "action_aat_product.hh" #include "action_atv_product.hh" #include "action_cholesky.hh" #include "action_trisolve.hh" BTL_MAIN; int main() { bench_static(); bench_static(); bench_static(); bench_static(); bench_static(); bench_static(); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/eigen3/eigen3_interface.hh ================================================ //===================================================== // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef EIGEN3_INTERFACE_HH #define EIGEN3_INTERFACE_HH #include #include #include "btl.hh" using namespace Eigen; template class eigen3_interface { public : enum {IsFixedSize = (SIZE!=Dynamic)}; typedef real real_type; typedef std::vector stl_vector; typedef std::vector stl_matrix; typedef Eigen::Matrix gene_matrix; typedef Eigen::Matrix gene_vector; static inline std::string name( void ) { return EIGEN_MAKESTRING(BTL_PREFIX); } static void free_matrix(gene_matrix & /*A*/, int /*N*/) {} static void free_vector(gene_vector & /*B*/) {} static BTL_DONT_INLINE void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ A.resize(A_stl[0].size(), A_stl.size()); for (unsigned int j=0; j().setZero(); X.template selfadjointView().rankUpdate(A.transpose()); } static inline void aat_product(const gene_matrix & A, gene_matrix & X, int /*N*/){ X.template triangularView().setZero(); X.template selfadjointView().rankUpdate(A); } static inline void matrix_vector_product(const gene_matrix & A, const gene_vector & B, gene_vector & X, int /*N*/){ X.noalias() = A*B; } static inline void symv(const gene_matrix & A, const gene_vector & B, gene_vector & X, int /*N*/){ X.noalias() = (A.template selfadjointView() * B); // internal::product_selfadjoint_vector(N,A.data(),N, B.data(), 1, X.data(), 1); } template static void triassign(Dest& dst, const Src& src) { typedef typename Dest::Scalar Scalar; typedef typename internal::packet_traits::type Packet; const int PacketSize = sizeof(Packet)/sizeof(Scalar); int size = dst.cols(); for(int j=0; j(j, index, src); else dst.template copyPacket(index, j, src); } // do the non-vectorizable part of the assignment for (int index = alignedEnd; index(N,A.data(),N, X.data(), 1, Y.data(), 1, -1); for(int j=0; j(c,s)); } static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int /*N*/){ X.noalias() = (A.transpose()*B); } static inline void axpy(real coef, const gene_vector & X, gene_vector & Y, int /*N*/){ Y += coef * X; } static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int /*N*/){ Y = a*X + b*Y; } static EIGEN_DONT_INLINE void copy_matrix(const gene_matrix & source, gene_matrix & cible, int /*N*/){ cible = source; } static EIGEN_DONT_INLINE void copy_vector(const gene_vector & source, gene_vector & cible, int /*N*/){ cible = source; } static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector& X, int /*N*/){ X = L.template triangularView().solve(B); } static inline void trisolve_lower_matrix(const gene_matrix & L, const gene_matrix& B, gene_matrix& X, int /*N*/){ X = L.template triangularView().solve(B); } static inline void trmm(const gene_matrix & L, const gene_matrix& B, gene_matrix& X, int /*N*/){ X.noalias() = L.template triangularView() * B; } static inline void cholesky(const gene_matrix & X, gene_matrix & C, int /*N*/){ C = X; internal::llt_inplace::blocked(C); //C = X.llt().matrixL(); // C = X; // Cholesky::computeInPlace(C); // Cholesky::computeInPlaceBlock(C); } static inline void lu_decomp(const gene_matrix & X, gene_matrix & C, int /*N*/){ C = X.fullPivLu().matrixLU(); } static inline void partial_lu_decomp(const gene_matrix & X, gene_matrix & C, int N){ Matrix piv(N); DenseIndex nb; C = X; internal::partial_lu_inplace(C,piv,nb); // C = X.partialPivLu().matrixLU(); } static inline void tridiagonalization(const gene_matrix & X, gene_matrix & C, int N){ typename Tridiagonalization::CoeffVectorType aux(N-1); C = X; internal::tridiagonalization_inplace(C, aux); } static inline void hessenberg(const gene_matrix & X, gene_matrix & C, int /*N*/){ C = HessenbergDecomposition(X).packedMatrix(); } }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/eigen3/main_adv.cpp ================================================ //===================================================== // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #include "utilities.h" #include "eigen3_interface.hh" #include "bench.hh" #include "action_trisolve.hh" #include "action_trisolve_matrix.hh" #include "action_cholesky.hh" #include "action_hessenberg.hh" #include "action_lu_decomp.hh" #include "action_partial_lu.hh" BTL_MAIN; int main() { bench > >(MIN_LU,MAX_LU,NB_POINT); bench > >(MIN_LU,MAX_LU,NB_POINT); bench > >(MIN_LU,MAX_LU,NB_POINT); // bench > >(MIN_LU,MAX_LU,NB_POINT); bench > >(MIN_LU,MAX_LU,NB_POINT); // bench > >(MIN_LU,MAX_LU,NB_POINT); bench > >(MIN_LU,MAX_LU,NB_POINT); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/eigen3/main_linear.cpp ================================================ //===================================================== // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #include "utilities.h" #include "eigen3_interface.hh" #include "bench.hh" #include "basic_actions.hh" BTL_MAIN; int main() { bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/eigen3/main_matmat.cpp ================================================ //===================================================== // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #include "utilities.h" #include "eigen3_interface.hh" #include "bench.hh" #include "basic_actions.hh" BTL_MAIN; int main() { bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/eigen3/main_vecmat.cpp ================================================ //===================================================== // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #include "utilities.h" #include "eigen3_interface.hh" #include "bench.hh" #include "basic_actions.hh" BTL_MAIN; int main() { bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/gmm/CMakeLists.txt ================================================ find_package(GMM) if (GMM_FOUND) include_directories(${GMM_INCLUDES}) btl_add_bench(btl_gmm main.cpp) endif () ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/gmm/gmm_LU_solve_interface.hh ================================================ //===================================================== // File : blitz_LU_solve_interface.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:31 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef BLITZ_LU_SOLVE_INTERFACE_HH #define BLITZ_LU_SOLVE_INTERFACE_HH #include "blitz/array.h" #include BZ_USING_NAMESPACE(blitz) template class blitz_LU_solve_interface : public blitz_interface { public : typedef typename blitz_interface::gene_matrix gene_matrix; typedef typename blitz_interface::gene_vector gene_vector; typedef blitz::Array Pivot_Vector; inline static void new_Pivot_Vector(Pivot_Vector & pivot,int N) { pivot.resize(N); } inline static void free_Pivot_Vector(Pivot_Vector & pivot) { return; } static inline real matrix_vector_product_sliced(const gene_matrix & A, gene_vector B, int row, int col_start, int col_end) { real somme=0.; for (int j=col_start ; j=big ) big = abs( LU( i, j ) ) ; } if( big==0. ) { INFOS( "blitz_LU_factor::Singular matrix" ) ; exit( 0 ) ; } ImplicitScaling( i ) = 1./big ; } // Loop over columns of Crout's method : for( int j=0; j=big ) { dum = ImplicitScaling( i )*abs( theSum ) ; big = dum ; index_max = i ; } } // Interchanging rows and the scale factor : if( j!=index_max ) { for( int k=0; k=0; i-- ) { theSum = X( i ) ; // theSum = B( i ) ; theSum -= matrix_vector_product_sliced(LU, X, i, i+1, N) ; // theSum -= sum( LU( i, Range( i+1, toEnd ) )*X( Range( i+1, toEnd ) ) ) ; // theSum -= sum( LU( i, Range( i+1, toEnd ) )*B( Range( i+1, toEnd ) ) ) ; // Store a component of the solution vector : X( i ) = theSum/LU( i, i ) ; // B( i ) = theSum/LU( i, i ) ; } } }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/gmm/gmm_interface.hh ================================================ //===================================================== // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef GMM_INTERFACE_HH #define GMM_INTERFACE_HH #include #include using namespace gmm; template class gmm_interface { public : typedef real real_type ; typedef std::vector stl_vector; typedef std::vector stl_matrix; typedef gmm::dense_matrix gene_matrix; typedef stl_vector gene_vector; static inline std::string name( void ) { return "gmm"; } static void free_matrix(gene_matrix & A, int N){ return ; } static void free_vector(gene_vector & B){ return ; } static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ A.resize(A_stl[0].size(),A_stl.size()); for (int j=0; j ipvt(N); gmm::lu_factor(R, ipvt); } static inline void hessenberg(const gene_matrix & X, gene_matrix & R, int N){ gmm::copy(X,R); gmm::Hessenberg_reduction(R,X,false); } static inline void tridiagonalization(const gene_matrix & X, gene_matrix & R, int N){ gmm::copy(X,R); gmm::Householder_tridiagonalization(R,X,false); } }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/gmm/main.cpp ================================================ //===================================================== // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #include "utilities.h" #include "gmm_interface.hh" #include "bench.hh" #include "basic_actions.hh" #include "action_hessenberg.hh" #include "action_partial_lu.hh" BTL_MAIN; int main() { bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); // bench > >(MIN_MM,MAX_MM,NB_POINT); // bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); //bench > >(MIN_LU,MAX_LU,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/mtl4/.kdbgrc.main ================================================ [General] DebuggerCmdStr= DriverName=GDB FileVersion=1 OptionsSelected= ProgramArgs= TTYLevel=7 WorkingDirectory= [Memory] ColumnWidths=80,0 NumExprs=0 ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/mtl4/CMakeLists.txt ================================================ find_package(MTL4) if (MTL4_FOUND) include_directories(${MTL4_INCLUDE_DIR}) btl_add_bench(btl_mtl4 main.cpp) endif () ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/mtl4/main.cpp ================================================ //===================================================== // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #include "utilities.h" #include "mtl4_interface.hh" #include "bench.hh" #include "basic_actions.hh" #include "action_cholesky.hh" // #include "action_lu_decomp.hh" BTL_MAIN; int main() { bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); // bench > >(MIN_MM,MAX_MM,NB_POINT); // bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); // bench > >(MIN_MM,MAX_MM,NB_POINT); // bench > >(MIN_MM,MAX_MM,NB_POINT); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/mtl4/mtl4_LU_solve_interface.hh ================================================ //===================================================== // File : blitz_LU_solve_interface.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:31 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef BLITZ_LU_SOLVE_INTERFACE_HH #define BLITZ_LU_SOLVE_INTERFACE_HH #include "blitz/array.h" #include BZ_USING_NAMESPACE(blitz) template class blitz_LU_solve_interface : public blitz_interface { public : typedef typename blitz_interface::gene_matrix gene_matrix; typedef typename blitz_interface::gene_vector gene_vector; typedef blitz::Array Pivot_Vector; inline static void new_Pivot_Vector(Pivot_Vector & pivot,int N) { pivot.resize(N); } inline static void free_Pivot_Vector(Pivot_Vector & pivot) { return; } static inline real matrix_vector_product_sliced(const gene_matrix & A, gene_vector B, int row, int col_start, int col_end) { real somme=0.; for (int j=col_start ; j=big ) big = abs( LU( i, j ) ) ; } if( big==0. ) { INFOS( "blitz_LU_factor::Singular matrix" ) ; exit( 0 ) ; } ImplicitScaling( i ) = 1./big ; } // Loop over columns of Crout's method : for( int j=0; j=big ) { dum = ImplicitScaling( i )*abs( theSum ) ; big = dum ; index_max = i ; } } // Interchanging rows and the scale factor : if( j!=index_max ) { for( int k=0; k=0; i-- ) { theSum = X( i ) ; // theSum = B( i ) ; theSum -= matrix_vector_product_sliced(LU, X, i, i+1, N) ; // theSum -= sum( LU( i, Range( i+1, toEnd ) )*X( Range( i+1, toEnd ) ) ) ; // theSum -= sum( LU( i, Range( i+1, toEnd ) )*B( Range( i+1, toEnd ) ) ) ; // Store a component of the solution vector : X( i ) = theSum/LU( i, i ) ; // B( i ) = theSum/LU( i, i ) ; } } }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/mtl4/mtl4_interface.hh ================================================ //===================================================== // Copyright (C) 2008 Gael Guennebaud //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef MTL4_INTERFACE_HH #define MTL4_INTERFACE_HH #include #include // #include #include using namespace mtl; template class mtl4_interface { public : typedef real real_type ; typedef std::vector stl_vector; typedef std::vector stl_matrix; typedef mtl::dense2D > gene_matrix; typedef mtl::dense_vector gene_vector; static inline std::string name() { return "mtl4"; } static void free_matrix(gene_matrix & A, int N){ return ; } static void free_vector(gene_vector & B){ return ; } static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ A.change_dim(A_stl[0].size(), A_stl.size()); for (int j=0; j C(N,N); // C = B; // X = (A*C); } static inline void transposed_matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){ X = (trans(A)*trans(B)); } // static inline void ata_product(const gene_matrix & A, gene_matrix & X, int N){ // X = (trans(A)*A); // } static inline void aat_product(const gene_matrix & A, gene_matrix & X, int N){ X = (A*trans(A)); } static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ X = (A*B); } static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ X = (trans(A)*B); } static inline void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N){ Y += coef * X; } static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int N){ Y = a*X + b*Y; } // static inline void cholesky(const gene_matrix & X, gene_matrix & C, int N){ // C = X; // recursive_cholesky(C); // } // static inline void lu_decomp(const gene_matrix & X, gene_matrix & R, int N){ // R = X; // std::vector ipvt(N); // lu_factor(R, ipvt); // } static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector & X, int N){ X = lower_trisolve(L, B); } static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){ cible = source; } static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){ cible = source; } }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/tensors/CMakeLists.txt ================================================ if((NOT TENSOR_INCLUDE_DIR) AND Eigen_SOURCE_DIR) # unless TENSOR_INCLUDE_DIR is defined, let's use current Eigen version set(TENSOR_INCLUDE_DIR ${Eigen_SOURCE_DIR}) set(TENSOR_FOUND TRUE) else() find_package(Tensor) endif() if (TENSOR_FOUND) include_directories(${TENSOR_INCLUDE_DIR}) btl_add_bench(btl_tensor_linear main_linear.cpp) btl_add_bench(btl_tensor_vecmat main_vecmat.cpp) btl_add_bench(btl_tensor_matmat main_matmat.cpp) btl_add_target_property(btl_tensor_linear COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=tensor") btl_add_target_property(btl_tensor_vecmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=tensor") btl_add_target_property(btl_tensor_matmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=tensor") option(BTL_BENCH_NOGCCVEC "also bench Eigen explicit vec without GCC's auto vec" OFF) if(CMAKE_COMPILER_IS_GNUCXX AND BTL_BENCH_NOGCCVEC) btl_add_bench(btl_tensor_nogccvec_linear main_linear.cpp) btl_add_bench(btl_tensor_nogccvec_vecmat main_vecmat.cpp) btl_add_bench(btl_tensor_nogccvec_matmat main_matmat.cpp) btl_add_target_property(btl_tensor_nogccvec_linear COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=tensor_nogccvec") btl_add_target_property(btl_tensor_nogccvec_vecmat COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=tensor_nogccvec") btl_add_target_property(btl_tensor_nogccvec_matmat COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=tensor_nogccvec") endif() if(NOT BTL_NOVEC) btl_add_bench(btl_tensor_novec_linear main_linear.cpp OFF) btl_add_bench(btl_tensor_novec_vecmat main_vecmat.cpp OFF) btl_add_bench(btl_tensor_novec_matmat main_matmat.cpp OFF) btl_add_target_property(btl_tensor_novec_linear COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=tensor_novec") btl_add_target_property(btl_tensor_novec_vecmat COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=tensor_novec") btl_add_target_property(btl_tensor_novec_matmat COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=tensor_novec") endif() endif () ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/tensors/main_linear.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2014 Benoit Steiner // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "utilities.h" #include "tensor_interface.hh" #include "bench.hh" #include "basic_actions.hh" BTL_MAIN; int main() { bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/tensors/main_matmat.cpp ================================================ //===================================================== // Copyright (C) 2014 Benoit Steiner //===================================================== // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. // #include "utilities.h" #include "tensor_interface.hh" #include "bench.hh" #include "basic_actions.hh" BTL_MAIN; int main() { bench > >(MIN_MM,MAX_MM,NB_POINT); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/tensors/main_vecmat.cpp ================================================ //===================================================== // Copyright (C) 2014 Benoit Steiner //===================================================== // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. // #include "utilities.h" #include "tensor_interface.hh" #include "bench.hh" #include "basic_actions.hh" BTL_MAIN; int main() { bench > >(MIN_MV,MAX_MV,NB_POINT); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/tensors/tensor_interface.hh ================================================ //===================================================== // Copyright (C) 2014 Benoit Steiner //===================================================== // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. // #ifndef TENSOR_INTERFACE_HH #define TENSOR_INTERFACE_HH #include #include #include "btl.hh" using namespace Eigen; template class tensor_interface { public : typedef real real_type; typedef typename Eigen::Tensor::Index Index; typedef std::vector stl_vector; typedef std::vector stl_matrix; typedef Eigen::Tensor gene_matrix; typedef Eigen::Tensor gene_vector; static inline std::string name( void ) { return EIGEN_MAKESTRING(BTL_PREFIX); } static void free_matrix(gene_matrix & /*A*/, int /*N*/) {} static void free_vector(gene_vector & /*B*/) {} static BTL_DONT_INLINE void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ A.resize(Eigen::array(A_stl[0].size(), A_stl.size())); for (unsigned int j=0; j(i,j)) = A_stl[j][i]; } } } static BTL_DONT_INLINE void vector_from_stl(gene_vector & B, stl_vector & B_stl){ B.resize(B_stl.size()); for (unsigned int i=0; i(i,j)); } } } static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int /*N*/){ typedef typename Eigen::Tensor::DimensionPair DimPair; const Eigen::array dims(DimPair(1, 0)); X/*.noalias()*/ = A.contract(B, dims); } static inline void matrix_vector_product(const gene_matrix & A, const gene_vector & B, gene_vector & X, int /*N*/){ typedef typename Eigen::Tensor::DimensionPair DimPair; const Eigen::array dims(DimPair(1, 0)); X/*.noalias()*/ = A.contract(B, dims); } static inline void axpy(real coef, const gene_vector & X, gene_vector & Y, int /*N*/){ Y += X.constant(coef) * X; } static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int /*N*/){ Y = X.constant(a)*X + Y.constant(b)*Y; } static EIGEN_DONT_INLINE void copy_matrix(const gene_matrix & source, gene_matrix & cible, int /*N*/){ cible = source; } static EIGEN_DONT_INLINE void copy_vector(const gene_vector & source, gene_vector & cible, int /*N*/){ cible = source; } }; #endif ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/tvmet/CMakeLists.txt ================================================ find_package(Tvmet) if (TVMET_FOUND) include_directories(${TVMET_INCLUDE_DIR}) btl_add_bench(btl_tvmet main.cpp OFF) endif () ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/tvmet/main.cpp ================================================ //===================================================== // File : main.cpp // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #include "utilities.h" #include "tvmet_interface.hh" #include "static/bench_static.hh" #include "action_matrix_vector_product.hh" #include "action_matrix_matrix_product.hh" #include "action_atv_product.hh" #include "action_axpy.hh" BTL_MAIN; int main() { bench_static(); bench_static(); bench_static(); bench_static(); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/tvmet/tvmet_interface.hh ================================================ //===================================================== // File : tvmet_interface.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef TVMET_INTERFACE_HH #define TVMET_INTERFACE_HH #include #include #include #include using namespace tvmet; template class tvmet_interface{ public : typedef real real_type ; typedef std::vector stl_vector; typedef std::vector stl_matrix; typedef Vector gene_vector; typedef Matrix gene_matrix; static inline std::string name() { return "tiny_tvmet"; } static void free_matrix(gene_matrix & A, int N){} static void free_vector(gene_vector & B){} static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ for (int j=0; j // Copyright (C) EDF R&D, lun sep 30 14:23:27 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #include "utilities.h" #include "ublas_interface.hh" #include "bench.hh" #include "basic_actions.hh" BTL_MAIN; int main() { bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MV,MAX_MV,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); // bench > >(MIN_MM,MAX_MM,NB_POINT); // bench > >(MIN_MM,MAX_MM,NB_POINT); bench > >(MIN_MM,MAX_MM,NB_POINT); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/btl/libs/ublas/ublas_interface.hh ================================================ //===================================================== // File : ublas_interface.hh // Author : L. Plagne // Copyright (C) EDF R&D, lun sep 30 14:23:27 CEST 2002 //===================================================== // // 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 2 // 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, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // #ifndef UBLAS_INTERFACE_HH #define UBLAS_INTERFACE_HH #include #include #include #include using namespace boost::numeric; template class ublas_interface{ public : typedef real real_type ; typedef std::vector stl_vector; typedef std::vector stl_matrix; typedef typename boost::numeric::ublas::matrix gene_matrix; typedef typename boost::numeric::ublas::vector gene_vector; static inline std::string name( void ) { return "ublas"; } static void free_matrix(gene_matrix & A, int N) {} static void free_vector(gene_vector & B) {} static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ A.resize(A_stl.size(),A_stl[0].size()); for (int j=0; j #include "../Eigen/Core" using namespace Eigen; using namespace std; #define DUMP_CPUID(CODE) {\ int abcd[4]; \ abcd[0] = abcd[1] = abcd[2] = abcd[3] = 0;\ EIGEN_CPUID(abcd, CODE, 0); \ std::cout << "The code " << CODE << " gives " \ << (int*)(abcd[0]) << " " << (int*)(abcd[1]) << " " \ << (int*)(abcd[2]) << " " << (int*)(abcd[3]) << " " << std::endl; \ } int main() { cout << "Eigen's L1 = " << internal::queryL1CacheSize() << endl; cout << "Eigen's L2/L3 = " << internal::queryTopLevelCacheSize() << endl; int l1, l2, l3; internal::queryCacheSizes(l1, l2, l3); cout << "Eigen's L1, L2, L3 = " << l1 << " " << l2 << " " << l3 << endl; #ifdef EIGEN_CPUID int abcd[4]; int string[8]; char* string_char = (char*)(string); // vendor ID EIGEN_CPUID(abcd,0x0,0); string[0] = abcd[1]; string[1] = abcd[3]; string[2] = abcd[2]; string[3] = 0; cout << endl; cout << "vendor id = " << string_char << endl; cout << endl; int max_funcs = abcd[0]; internal::queryCacheSizes_intel_codes(l1, l2, l3); cout << "Eigen's intel codes L1, L2, L3 = " << l1 << " " << l2 << " " << l3 << endl; if(max_funcs>=4) { internal::queryCacheSizes_intel_direct(l1, l2, l3); cout << "Eigen's intel direct L1, L2, L3 = " << l1 << " " << l2 << " " << l3 << endl; } internal::queryCacheSizes_amd(l1, l2, l3); cout << "Eigen's amd L1, L2, L3 = " << l1 << " " << l2 << " " << l3 << endl; cout << endl; // dump Intel direct method if(max_funcs>=4) { l1 = l2 = l3 = 0; int cache_id = 0; int cache_type = 0; do { abcd[0] = abcd[1] = abcd[2] = abcd[3] = 0; EIGEN_CPUID(abcd,0x4,cache_id); cache_type = (abcd[0] & 0x0F) >> 0; int cache_level = (abcd[0] & 0xE0) >> 5; // A[7:5] int ways = (abcd[1] & 0xFFC00000) >> 22; // B[31:22] int partitions = (abcd[1] & 0x003FF000) >> 12; // B[21:12] int line_size = (abcd[1] & 0x00000FFF) >> 0; // B[11:0] int sets = (abcd[2]); // C[31:0] int cache_size = (ways+1) * (partitions+1) * (line_size+1) * (sets+1); cout << "cache[" << cache_id << "].type = " << cache_type << "\n"; cout << "cache[" << cache_id << "].level = " << cache_level << "\n"; cout << "cache[" << cache_id << "].ways = " << ways << "\n"; cout << "cache[" << cache_id << "].partitions = " << partitions << "\n"; cout << "cache[" << cache_id << "].line_size = " << line_size << "\n"; cout << "cache[" << cache_id << "].sets = " << sets << "\n"; cout << "cache[" << cache_id << "].size = " << cache_size << "\n"; cache_id++; } while(cache_type>0 && cache_id<16); } // dump everything std::cout << endl <<"Raw dump:" << endl; for(int i=0; i #include "BenchTimer.h" #include #include #include #include #include using namespace Eigen; std::map > results; std::vector labels; std::vector sizes; template EIGEN_DONT_INLINE void compute_norm_equation(Solver &solver, const MatrixType &A) { if(A.rows()!=A.cols()) solver.compute(A.transpose()*A); else solver.compute(A); } template EIGEN_DONT_INLINE void compute(Solver &solver, const MatrixType &A) { solver.compute(A); } template void bench(int id, int rows, int size = Size) { typedef Matrix Mat; typedef Matrix MatDyn; typedef Matrix MatSquare; Mat A(rows,size); A.setRandom(); if(rows==size) A = A*A.adjoint(); BenchTimer t_llt, t_ldlt, t_lu, t_fplu, t_qr, t_cpqr, t_cod, t_fpqr, t_jsvd, t_bdcsvd; int svd_opt = ComputeThinU|ComputeThinV; int tries = 5; int rep = 1000/size; if(rep==0) rep = 1; // rep = rep*rep; LLT llt(size); LDLT ldlt(size); PartialPivLU lu(size); FullPivLU fplu(size,size); HouseholderQR qr(A.rows(),A.cols()); ColPivHouseholderQR cpqr(A.rows(),A.cols()); CompleteOrthogonalDecomposition cod(A.rows(),A.cols()); FullPivHouseholderQR fpqr(A.rows(),A.cols()); JacobiSVD jsvd(A.rows(),A.cols()); BDCSVD bdcsvd(A.rows(),A.cols()); BENCH(t_llt, tries, rep, compute_norm_equation(llt,A)); BENCH(t_ldlt, tries, rep, compute_norm_equation(ldlt,A)); BENCH(t_lu, tries, rep, compute_norm_equation(lu,A)); if(size<=1000) BENCH(t_fplu, tries, rep, compute_norm_equation(fplu,A)); BENCH(t_qr, tries, rep, compute(qr,A)); BENCH(t_cpqr, tries, rep, compute(cpqr,A)); BENCH(t_cod, tries, rep, compute(cod,A)); if(size*rows<=10000000) BENCH(t_fpqr, tries, rep, compute(fpqr,A)); if(size<500) // JacobiSVD is really too slow for too large matrices BENCH(t_jsvd, tries, rep, jsvd.compute(A,svd_opt)); // if(size*rows<=20000000) BENCH(t_bdcsvd, tries, rep, bdcsvd.compute(A,svd_opt)); results["LLT"][id] = t_llt.best(); results["LDLT"][id] = t_ldlt.best(); results["PartialPivLU"][id] = t_lu.best(); results["FullPivLU"][id] = t_fplu.best(); results["HouseholderQR"][id] = t_qr.best(); results["ColPivHouseholderQR"][id] = t_cpqr.best(); results["CompleteOrthogonalDecomposition"][id] = t_cod.best(); results["FullPivHouseholderQR"][id] = t_fpqr.best(); results["JacobiSVD"][id] = t_jsvd.best(); results["BDCSVD"][id] = t_bdcsvd.best(); } int main() { labels.push_back("LLT"); labels.push_back("LDLT"); labels.push_back("PartialPivLU"); labels.push_back("FullPivLU"); labels.push_back("HouseholderQR"); labels.push_back("ColPivHouseholderQR"); labels.push_back("CompleteOrthogonalDecomposition"); labels.push_back("FullPivHouseholderQR"); labels.push_back("JacobiSVD"); labels.push_back("BDCSVD"); for(int i=0; i(k,sizes[k](0),sizes[k](1)); } cout.width(32); cout << "solver/size"; cout << " "; for(int k=0; k=1e6) cout << "-"; else cout << r(k); cout << " "; } cout << endl; } // HTML output cout << "" << endl; cout << "" << endl; for(int k=0; k" << sizes[k](0) << "x" << sizes[k](1) << ""; cout << "" << endl; for(int i=0; i"; ArrayXf r = (results[labels[i]]*100000.f).floor()/100.f; for(int k=0; k=1e6) cout << ""; else { cout << ""; } } cout << "" << endl; } cout << "
solver/size
" << labels[i] << "-" << r(k); if(i>0) cout << " (x" << numext::round(10.f*results[labels[i]](k)/results["LLT"](k))/10.f << ")"; if(i<4 && sizes[k](0)!=sizes[k](1)) cout << " *"; cout << "
" << endl; // cout << "LLT (ms) " << (results["LLT"]*1000.).format(fmt) << "\n"; // cout << "LDLT (%) " << (results["LDLT"]/results["LLT"]).format(fmt) << "\n"; // cout << "PartialPivLU (%) " << (results["PartialPivLU"]/results["LLT"]).format(fmt) << "\n"; // cout << "FullPivLU (%) " << (results["FullPivLU"]/results["LLT"]).format(fmt) << "\n"; // cout << "HouseholderQR (%) " << (results["HouseholderQR"]/results["LLT"]).format(fmt) << "\n"; // cout << "ColPivHouseholderQR (%) " << (results["ColPivHouseholderQR"]/results["LLT"]).format(fmt) << "\n"; // cout << "CompleteOrthogonalDecomposition (%) " << (results["CompleteOrthogonalDecomposition"]/results["LLT"]).format(fmt) << "\n"; // cout << "FullPivHouseholderQR (%) " << (results["FullPivHouseholderQR"]/results["LLT"]).format(fmt) << "\n"; // cout << "JacobiSVD (%) " << (results["JacobiSVD"]/results["LLT"]).format(fmt) << "\n"; // cout << "BDCSVD (%) " << (results["BDCSVD"]/results["LLT"]).format(fmt) << "\n"; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/eig33.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2010 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. // The computeRoots function included in this is based on materials // covered by the following copyright and license: // // Geometric Tools, LLC // Copyright (c) 1998-2010 // Distributed under the Boost Software License, Version 1.0. // // Permission is hereby granted, free of charge, to any person or organization // obtaining a copy of the software and accompanying documentation covered by // this license (the "Software") to use, reproduce, display, distribute, // execute, and transmit the Software, and to prepare derivative works of the // Software, and to permit third-parties to whom the Software is furnished to // do so, all subject to the following: // // The copyright notices in the Software and this entire statement, including // the above license grant, this restriction and the following disclaimer, // must be included in all copies of the Software, in whole or in part, and // all derivative works of the Software, unless such copies or derivative // works are solely in the form of machine-executable object code generated by // a source language processor. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. #include #include #include #include #include using namespace Eigen; using namespace std; template inline void computeRoots(const Matrix& m, Roots& roots) { typedef typename Matrix::Scalar Scalar; const Scalar s_inv3 = 1.0/3.0; const Scalar s_sqrt3 = std::sqrt(Scalar(3.0)); // The characteristic equation is x^3 - c2*x^2 + c1*x - c0 = 0. The // eigenvalues are the roots to this equation, all guaranteed to be // real-valued, because the matrix is symmetric. Scalar c0 = m(0,0)*m(1,1)*m(2,2) + Scalar(2)*m(0,1)*m(0,2)*m(1,2) - m(0,0)*m(1,2)*m(1,2) - m(1,1)*m(0,2)*m(0,2) - m(2,2)*m(0,1)*m(0,1); Scalar c1 = m(0,0)*m(1,1) - m(0,1)*m(0,1) + m(0,0)*m(2,2) - m(0,2)*m(0,2) + m(1,1)*m(2,2) - m(1,2)*m(1,2); Scalar c2 = m(0,0) + m(1,1) + m(2,2); // Construct the parameters used in classifying the roots of the equation // and in solving the equation for the roots in closed form. Scalar c2_over_3 = c2*s_inv3; Scalar a_over_3 = (c1 - c2*c2_over_3)*s_inv3; if (a_over_3 > Scalar(0)) a_over_3 = Scalar(0); Scalar half_b = Scalar(0.5)*(c0 + c2_over_3*(Scalar(2)*c2_over_3*c2_over_3 - c1)); Scalar q = half_b*half_b + a_over_3*a_over_3*a_over_3; if (q > Scalar(0)) q = Scalar(0); // Compute the eigenvalues by solving for the roots of the polynomial. Scalar rho = std::sqrt(-a_over_3); Scalar theta = std::atan2(std::sqrt(-q),half_b)*s_inv3; Scalar cos_theta = std::cos(theta); Scalar sin_theta = std::sin(theta); roots(2) = c2_over_3 + Scalar(2)*rho*cos_theta; roots(0) = c2_over_3 - rho*(cos_theta + s_sqrt3*sin_theta); roots(1) = c2_over_3 - rho*(cos_theta - s_sqrt3*sin_theta); } template void eigen33(const Matrix& mat, Matrix& evecs, Vector& evals) { typedef typename Matrix::Scalar Scalar; // Scale the matrix so its entries are in [-1,1]. The scaling is applied // only when at least one matrix entry has magnitude larger than 1. Scalar shift = mat.trace()/3; Matrix scaledMat = mat; scaledMat.diagonal().array() -= shift; Scalar scale = scaledMat.cwiseAbs()/*.template triangularView()*/.maxCoeff(); scale = std::max(scale,Scalar(1)); scaledMat/=scale; // Compute the eigenvalues // scaledMat.setZero(); computeRoots(scaledMat,evals); // compute the eigen vectors // **here we assume 3 different eigenvalues** // "optimized version" which appears to be slower with gcc! // Vector base; // Scalar alpha, beta; // base << scaledMat(1,0) * scaledMat(2,1), // scaledMat(1,0) * scaledMat(2,0), // -scaledMat(1,0) * scaledMat(1,0); // for(int k=0; k<2; ++k) // { // alpha = scaledMat(0,0) - evals(k); // beta = scaledMat(1,1) - evals(k); // evecs.col(k) = (base + Vector(-beta*scaledMat(2,0), -alpha*scaledMat(2,1), alpha*beta)).normalized(); // } // evecs.col(2) = evecs.col(0).cross(evecs.col(1)).normalized(); // // naive version // Matrix tmp; // tmp = scaledMat; // tmp.diagonal().array() -= evals(0); // evecs.col(0) = tmp.row(0).cross(tmp.row(1)).normalized(); // // tmp = scaledMat; // tmp.diagonal().array() -= evals(1); // evecs.col(1) = tmp.row(0).cross(tmp.row(1)).normalized(); // // tmp = scaledMat; // tmp.diagonal().array() -= evals(2); // evecs.col(2) = tmp.row(0).cross(tmp.row(1)).normalized(); // a more stable version: if((evals(2)-evals(0))<=Eigen::NumTraits::epsilon()) { evecs.setIdentity(); } else { Matrix tmp; tmp = scaledMat; tmp.diagonal ().array () -= evals (2); evecs.col (2) = tmp.row (0).cross (tmp.row (1)).normalized (); tmp = scaledMat; tmp.diagonal ().array () -= evals (1); evecs.col(1) = tmp.row (0).cross(tmp.row (1)); Scalar n1 = evecs.col(1).norm(); if(n1<=Eigen::NumTraits::epsilon()) evecs.col(1) = evecs.col(2).unitOrthogonal(); else evecs.col(1) /= n1; // make sure that evecs[1] is orthogonal to evecs[2] evecs.col(1) = evecs.col(2).cross(evecs.col(1).cross(evecs.col(2))).normalized(); evecs.col(0) = evecs.col(2).cross(evecs.col(1)); } // Rescale back to the original size. evals *= scale; evals.array()+=shift; } int main() { BenchTimer t; int tries = 10; int rep = 400000; typedef Matrix3d Mat; typedef Vector3d Vec; Mat A = Mat::Random(3,3); A = A.adjoint() * A; // Mat Q = A.householderQr().householderQ(); // A = Q * Vec(2.2424567,2.2424566,7.454353).asDiagonal() * Q.transpose(); SelfAdjointEigenSolver eig(A); BENCH(t, tries, rep, eig.compute(A)); std::cout << "Eigen iterative: " << t.best() << "s\n"; BENCH(t, tries, rep, eig.computeDirect(A)); std::cout << "Eigen direct : " << t.best() << "s\n"; Mat evecs; Vec evals; BENCH(t, tries, rep, eigen33(A,evecs,evals)); std::cout << "Direct: " << t.best() << "s\n\n"; // std::cerr << "Eigenvalue/eigenvector diffs:\n"; // std::cerr << (evals - eig.eigenvalues()).transpose() << "\n"; // for(int k=0;k<3;++k) // if(evecs.col(k).dot(eig.eigenvectors().col(k))<0) // evecs.col(k) = -evecs.col(k); // std::cerr << evecs - eig.eigenvectors() << "\n\n"; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/geometry.cpp ================================================ #include #include #include using namespace std; using namespace Eigen; #ifndef SCALAR #define SCALAR float #endif #ifndef SIZE #define SIZE 8 #endif typedef SCALAR Scalar; typedef NumTraits::Real RealScalar; typedef Matrix A; typedef Matrix B; typedef Matrix C; typedef Matrix M; template EIGEN_DONT_INLINE void transform(const Transformation& t, Data& data) { EIGEN_ASM_COMMENT("begin"); data = t * data; EIGEN_ASM_COMMENT("end"); } template EIGEN_DONT_INLINE void transform(const Quaternion& t, Data& data) { EIGEN_ASM_COMMENT("begin quat"); for(int i=0;i struct ToRotationMatrixWrapper { enum {Dim = T::Dim}; typedef typename T::Scalar Scalar; ToRotationMatrixWrapper(const T& o) : object(o) {} T object; }; template EIGEN_DONT_INLINE void transform(const ToRotationMatrixWrapper& t, Data& data) { EIGEN_ASM_COMMENT("begin quat via mat"); data = t.object.toRotationMatrix() * data; EIGEN_ASM_COMMENT("end quat via mat"); } template EIGEN_DONT_INLINE void transform(const Transform& t, Data& data) { data = (t * data.colwise().homogeneous()).template block(0,0); } template struct get_dim { enum { Dim = T::Dim }; }; template struct get_dim > { enum { Dim = R }; }; template struct bench_impl { static EIGEN_DONT_INLINE void run(const Transformation& t) { Matrix::Dim,N> data; data.setRandom(); bench_impl::run(t); BenchTimer timer; BENCH(timer,10,100000,transform(t,data)); cout.width(9); cout << timer.best() << " "; } }; template struct bench_impl { static EIGEN_DONT_INLINE void run(const Transformation&) {} }; template EIGEN_DONT_INLINE void bench(const std::string& msg, const Transformation& t) { cout << msg << " "; bench_impl::run(t); std::cout << "\n"; } int main(int argc, char ** argv) { Matrix mat34; mat34.setRandom(); Transform iso3(mat34); Transform aff3(mat34); Transform caff3(mat34); Transform proj3(mat34); Quaternion quat;quat.setIdentity(); ToRotationMatrixWrapper > quatmat(quat); Matrix mat33; mat33.setRandom(); cout.precision(4); std::cout << "N "; for(int i=0;i Also optimized the blocking parameters to take
into account the number of threads used for a computation. 6782dde63499c # generalized gemv 6799f98650d0a # ensured that contractions that can be reduced to a matrix vector product #6840918c51e60 # merge tensor 684e972b55ec4 # change prefetching in gebp #68598604576d1 # merge index conversion 68963eb0f6fe6 # clean blocking size computation 689db05f2d01e # rotating kernel for ARM only #6901b7e12847d # result_of 69226275b250a # fix prefetching change for ARM 692692136350b # prefetching 693a8ad8887bf # blocking size strategy 693bcf9bb5c1f # avoid redundant pack_rhs 6987550107028 # dynamic loop swapping 69858740ce4c6 # rm dynamic loop swapping,
adjust lhs's micro panel height to fully exploit L1 cache 698cd3bbffa73 # blocking heuristic:
block on the rhs in L1 if the lhs fit in L1. 701488c15615a # organize a little our default cache sizes,
and use a saner default L1 outside of x86 (10% faster on Nexus 5) 701e56aabf205 # Refactor computeProductBlockingSizes to make room
for the possibility of using lookup tables 701ca5c12587b # Polish lookup tables generation 7013589a9c115 # actual_panel_rows computation should always be resilient
to parameters not consistent with the known L1 cache size, see comment 70102babb9c0f # Provide a empirical lookup table for blocking sizes measured on a Nexus 5.
Only for float, only for Android on ARM 32bit for now. 7088481dc21ea # Bug 986: add support for coefficient-based
product with 0 depth. 709d7f51feb07 # Bug 992: don't select a 3p GEMM path with non-SIMD scalar types. 759f9303cc7c5 # 3.3-alpha1 765aba1eda71e # help clang inlining 770fe630c9873 # Improve numerical accuracy in LLT and triangular solve
by using true scalar divisions (instead of x * (1/y)) #8741d23430628 # Improved the matrix multiplication blocking in the case
where mr is not a power of 2 (e.g on Haswell CPUs) 878f629fe95c8 # Made the index type a template parameter to evaluateProductBlockingSizes.
Use numext::mini and numext::maxi instead of
std::min/std::max to compute blocking sizes. 8975d51a7f12c # Don't optimize the processing of the last rows of
a matrix matrix product in cases that violate
the assumptions made by the optimized code path. 8986136f4fdd4 # Remove the rotating kernel. 898e68e165a23 # Bug 256: enable vectorization with unaligned loads/stores. 91466e99ab6a1 # Relax mixing-type constraints for binary coeff-wise operators 91776236cdea4 # merge 917101ea26f5e # Include the cost of stores in unrolling 921672076db5d # Fix perf regression introduced in changeset e56aabf205 9210fa9e4a15c # Fix perf regression in dgemm introduced by changeset 5d51a7f12c 936f6b3cf8de9 # 3.3-beta2 944504a4404f1 # Optimize expression matching 'd?=a-b*c' as 'd?=a; d?=b*c;' 95877e27fbeee # 3.3-rc1 959779774f98c # Bug 1311: fix alignment logic in some cases
of (scalar*small).lazyProduct(small) 9729f9d8d2f62 # Disabled part of the matrix matrix peeling code
that's incompatible with 512 bit registers 979eeac81b8c0 # 3.3.0 989c927af60ed # Fix a performance regression in (mat*mat)*vec
for which mat*mat was evaluated multiple times. 994fe696022ec # Operators += and -= do not resize! 99466f65ccc36 # Ease compiler generating clean and efficient code in mat*vec 9946a5fe86098 # Complete rewrite of column-major-matrix * vector product
to deliver higher performance of modern CPU. 99591003f3b86 # Improve performance of row-major-dense-matrix * vector products
for recent CPUs. 997eb621413c1 # Revert vec/y to vec*(1/y) in row-major TRSM 10444bbc320468 # Bug 1435: fix aliasing issue in exressions like: A = C - B*A; 1073624df50945 # Adds missing EIGEN_STRONG_INLINE to support MSVC
properly inlining small vector calculations 1094d428a199ab # Bug 1562: optimize evaluation of small products
of the form s*A*B by rewriting them as: s*(A.lazyProduct(B))
to save a costly temporary.
Measured speedup from 2x to 5x. 1096de9e31a06d # Introduce the macro ei_declare_local_nested_eval to
help allocating on the stack local temporaries via alloca,
and let outer-products makes a good use of it. 11087b91c11207 # Bug 1578: Improve prefetching in matrix multiplication on MIPS. 1153aa110e681b # PR 526: Speed up multiplication of small, dynamically sized matrices 11544ad359237a # Vectorize row-by-row gebp loop iterations on 16 packets as well 1157a476054879 # Bug 1624: improve matrix-matrix product on ARM 64, 20% speedup 1160a4159dba08 # do not read buffers out of bounds 1163c53eececb0 # Implement AVX512 vectorization of std::complex 11644e7746fe22 # Bug 1636: fix gemm performance issue with gcc>=6 and no FMA 1164956678a4ef # Bug 1515: disable gebp's 3pX4 micro kernel
for MSVC<=19.14 because of register spilling. 1165426bce7529 # fix EIGEN_GEBP_2PX4_SPILLING_WORKAROUND
for non vectorized type, and non x86/64 target 11660d90637838 # enable spilling workaround on architectures with SSE/AVX 1166f159cf3d75 # Artificially increase l1-blocking size for AVX512.
+10% speedup with current kernels. 11686dd93f7e3b # Make code compile again for older compilers. 1175dbfcceabf5 # Bug: 1633: refactor gebp kernel and optimize for neon 117670e133333d # Bug 1661: fix regression in GEBP and AVX512 11760f028f61cb # GEBP: cleanup logic to choose between
a 4 packets of 1 packet (=e118ce86fd+fix) 1180de77bf5d6c # gebp: Add new ½ and ¼ packet rows per (peeling) round on the lhs ================================================ FILE: VO_Module/thirdparty/eigen/bench/perf_monitoring/gemm.cpp ================================================ #include "gemm_common.h" EIGEN_DONT_INLINE void gemm(const Mat &A, const Mat &B, Mat &C) { C.noalias() += A * B; } int main(int argc, char **argv) { return main_gemm(argc, argv, gemm); } ================================================ FILE: VO_Module/thirdparty/eigen/bench/perf_monitoring/gemm_common.h ================================================ #include #include #include #include #include "eigen_src/Eigen/Core" #include "../BenchTimer.h" using namespace Eigen; #ifndef SCALAR #error SCALAR must be defined #endif typedef SCALAR Scalar; typedef Matrix Mat; template EIGEN_DONT_INLINE double bench(long m, long n, long k, const Func& f) { Mat A(m,k); Mat B(k,n); Mat C(m,n); A.setRandom(); B.setRandom(); C.setZero(); BenchTimer t; double up = 1e8*4/sizeof(Scalar); double tm0 = 4, tm1 = 10; if(NumTraits::IsComplex) { up /= 4; tm0 = 2; tm1 = 4; } double flops = 2. * m * n * k; long rep = std::max(1., std::min(100., up/flops) ); long tries = std::max(tm0, std::min(tm1, up/flops) ); BENCH(t, tries, rep, f(A,B,C)); return 1e-9 * rep * flops / t.best(); } template int main_gemm(int argc, char **argv, const Func& f) { std::vector results; std::string filename = std::string("gemm_settings.txt"); if(argc>1) filename = std::string(argv[1]); std::ifstream settings(filename); long m, n, k; while(settings >> m >> n >> k) { //std::cerr << " Testing " << m << " " << n << " " << k << std::endl; results.push_back( bench(m, n, k, f) ); } std::cout << RowVectorXd::Map(results.data(), results.size()); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/perf_monitoring/gemm_settings.txt ================================================ 8 8 8 9 9 9 24 24 24 239 239 239 240 240 240 2400 24 24 24 2400 24 24 24 2400 24 2400 2400 2400 24 2400 2400 2400 24 2400 2400 64 4800 23 160 23 4800 160 2400 2400 2400 ================================================ FILE: VO_Module/thirdparty/eigen/bench/perf_monitoring/gemm_square_settings.txt ================================================ 8 8 8 9 9 9 12 12 12 15 15 15 16 16 16 24 24 24 102 102 102 239 239 239 240 240 240 2400 2400 2400 2463 2463 2463 ================================================ FILE: VO_Module/thirdparty/eigen/bench/perf_monitoring/gemv.cpp ================================================ #include "gemv_common.h" EIGEN_DONT_INLINE void gemv(const Mat &A, const Vec &B, Vec &C) { C.noalias() += A * B; } int main(int argc, char **argv) { return main_gemv(argc, argv, gemv); } ================================================ FILE: VO_Module/thirdparty/eigen/bench/perf_monitoring/gemv_common.h ================================================ #include #include #include #include #include #include "eigen_src/Eigen/Core" #include "../BenchTimer.h" using namespace Eigen; #ifndef SCALAR #error SCALAR must be defined #endif typedef SCALAR Scalar; typedef Matrix Mat; typedef Matrix Vec; template EIGEN_DONT_INLINE double bench(long m, long n, Func &f) { Mat A(m,n); Vec B(n); Vec C(m); A.setRandom(); B.setRandom(); C.setRandom(); BenchTimer t; double up = 1e8/sizeof(Scalar); double tm0 = 4, tm1 = 10; if(NumTraits::IsComplex) { up /= 4; tm0 = 2; tm1 = 4; } double flops = 2. * m * n; long rep = std::max(1., std::min(100., up/flops) ); long tries = std::max(tm0, std::min(tm1, up/flops) ); BENCH(t, tries, rep, f(A,B,C)); return 1e-9 * rep * flops / t.best(); } template int main_gemv(int argc, char **argv, Func& f) { std::vector results; std::string filename = std::string("gemv_settings.txt"); if(argc>1) filename = std::string(argv[1]); std::ifstream settings(filename); long m, n; while(settings >> m >> n) { //std::cerr << " Testing " << m << " " << n << std::endl; results.push_back( bench(m, n, f) ); } std::cout << RowVectorXd::Map(results.data(), results.size()); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/perf_monitoring/gemv_settings.txt ================================================ 8 8 9 9 24 24 239 239 240 240 2400 24 24 2400 24 240 2400 2400 4800 23 23 4800 ================================================ FILE: VO_Module/thirdparty/eigen/bench/perf_monitoring/gemv_square_settings.txt ================================================ 8 8 9 9 12 12 15 15 16 16 24 24 53 53 74 74 102 102 239 239 240 240 2400 2400 2463 2463 ================================================ FILE: VO_Module/thirdparty/eigen/bench/perf_monitoring/gemvt.cpp ================================================ #include "gemv_common.h" EIGEN_DONT_INLINE void gemv(const Mat &A, Vec &B, const Vec &C) { B.noalias() += A.transpose() * C; } int main(int argc, char **argv) { return main_gemv(argc, argv, gemv); } ================================================ FILE: VO_Module/thirdparty/eigen/bench/perf_monitoring/lazy_gemm.cpp ================================================ #include #include #include #include #include "../../BenchTimer.h" using namespace Eigen; #ifndef SCALAR #error SCALAR must be defined #endif typedef SCALAR Scalar; template EIGEN_DONT_INLINE void lazy_gemm(const MatA &A, const MatB &B, MatC &C) { // escape((void*)A.data()); // escape((void*)B.data()); C.noalias() += A.lazyProduct(B); // escape((void*)C.data()); } template EIGEN_DONT_INLINE double bench() { typedef Matrix MatA; typedef Matrix MatB; typedef Matrix MatC; MatA A(m,k); MatB B(k,n); MatC C(m,n); A.setRandom(); B.setRandom(); C.setZero(); BenchTimer t; double up = 1e7*4/sizeof(Scalar); double tm0 = 10, tm1 = 20; double flops = 2. * m * n * k; long rep = std::max(10., std::min(10000., up/flops) ); long tries = std::max(tm0, std::min(tm1, up/flops) ); BENCH(t, tries, rep, lazy_gemm(A,B,C)); return 1e-9 * rep * flops / t.best(); } template double bench_t(int t) { if(t) return bench(); else return bench(); } EIGEN_DONT_INLINE double bench_mnk(int m, int n, int k, int t) { int id = m*10000 + n*100 + k; switch(id) { case 10101 : return bench_t< 1, 1, 1>(t); break; case 20202 : return bench_t< 2, 2, 2>(t); break; case 30303 : return bench_t< 3, 3, 3>(t); break; case 40404 : return bench_t< 4, 4, 4>(t); break; case 50505 : return bench_t< 5, 5, 5>(t); break; case 60606 : return bench_t< 6, 6, 6>(t); break; case 70707 : return bench_t< 7, 7, 7>(t); break; case 80808 : return bench_t< 8, 8, 8>(t); break; case 90909 : return bench_t< 9, 9, 9>(t); break; case 101010 : return bench_t<10,10,10>(t); break; case 111111 : return bench_t<11,11,11>(t); break; case 121212 : return bench_t<12,12,12>(t); break; } return 0; } int main(int argc, char **argv) { std::vector results; std::string filename = std::string("lazy_gemm_settings.txt"); if(argc>1) filename = std::string(argv[1]); std::ifstream settings(filename); long m, n, k, t; while(settings >> m >> n >> k >> t) { //std::cerr << " Testing " << m << " " << n << " " << k << std::endl; results.push_back( bench_mnk(m, n, k, t) ); } std::cout << RowVectorXd::Map(results.data(), results.size()); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/bench/perf_monitoring/lazy_gemm_settings.txt ================================================ 1 1 1 0 2 2 2 0 3 3 3 0 4 4 4 0 4 4 4 1 5 5 5 0 6 6 6 0 7 7 7 0 7 7 7 1 8 8 8 0 9 9 9 0 10 10 10 0 11 11 11 0 12 12 12 0 12 12 12 1 ================================================ FILE: VO_Module/thirdparty/eigen/bench/perf_monitoring/llt.cpp ================================================ #include "gemm_common.h" #include EIGEN_DONT_INLINE void llt(const Mat &A, const Mat &B, Mat &C) { C = A; C.diagonal().array() += 1000; Eigen::internal::llt_inplace::blocked(C); } int main(int argc, char **argv) { return main_gemm(argc, argv, llt); } ================================================ FILE: VO_Module/thirdparty/eigen/bench/perf_monitoring/make_plot.sh ================================================ #!/bin/bash # base name of the bench # it reads $1.out # and generates $1.pdf WHAT=$1 bench=$2 settings_file=$3 header="rev " while read line do if [ ! -z '$line' ]; then header="$header \"$line\"" fi done < $settings_file echo $header > $WHAT.out.header cat $WHAT.out >> $WHAT.out.header echo "set title '$WHAT'" > $WHAT.gnuplot echo "set key autotitle columnhead outside " >> $WHAT.gnuplot echo "set xtics rotate 1" >> $WHAT.gnuplot echo "set term pdf color rounded enhanced fontscale 0.35 size 7in,5in" >> $WHAT.gnuplot echo set output "'"$WHAT.pdf"'" >> $WHAT.gnuplot col=`cat $settings_file | wc -l` echo "plot for [col=2:$col+1] '$WHAT.out.header' using 0:col:xticlabels(1) with lines" >> $WHAT.gnuplot echo " " >> $WHAT.gnuplot gnuplot -persist < $WHAT.gnuplot # generate a png file (thumbnail) convert -colors 256 -background white -density 300 -resize 300 -quality 0 $WHAT.pdf -background white -flatten $WHAT.png # clean rm $WHAT.out.header $WHAT.gnuplot # generate html/svg graph echo " " > $WHAT.html cat resources/chart_header.html > $WHAT.html echo 'var customSettings = {"TITLE":"","SUBTITLE":"","XLABEL":"","YLABEL":""};' >> $WHAT.html # 'data' is an array of datasets (i.e. curves), each of which is an object of the form # { # key: , # color: , # values: [{ # r: , # v: # }] # } echo 'var data = [' >> $WHAT.html col=2 while read line do if [ ! -z '$line' ]; then header="$header \"$line\"" echo '{"key":"'$line'","values":[' >> $WHAT.html i=0 while read line2 do if [ ! -z "$line2" ]; then val=`echo $line2 | cut -s -f $col -d ' '` if [ -n "$val" ]; then # skip build failures echo '{"r":'$i',"v":'$val'},' >> $WHAT.html fi fi ((i++)) done < $WHAT.out echo ']},' >> $WHAT.html fi ((col++)) done < $settings_file echo '];' >> $WHAT.html echo 'var changesets = [' >> $WHAT.html while read line2 do if [ ! -z '$line2' ]; then echo '"'`echo $line2 | cut -f 1 -d ' '`'",' >> $WHAT.html fi done < $WHAT.out echo '];' >> $WHAT.html echo 'var changesets_details = [' >> $WHAT.html while read line2 do if [ ! -z '$line2' ]; then num=`echo "$line2" | cut -f 1 -d ' '` comment=`grep ":$num" changesets.txt | cut -f 2 -d '#'` echo '"'"$comment"'",' >> $WHAT.html fi done < $WHAT.out echo '];' >> $WHAT.html echo 'var changesets_count = [' >> $WHAT.html i=0 while read line2 do if [ ! -z '$line2' ]; then echo $i ',' >> $WHAT.html fi ((i++)) done < $WHAT.out echo '];' >> $WHAT.html cat resources/chart_footer.html >> $WHAT.html ================================================ FILE: VO_Module/thirdparty/eigen/bench/perf_monitoring/resources/chart_footer.html ================================================ /* setup the chart and its options */ var chart = nv.models.lineChart() .color(d3.scale.category10().range()) .margin({left: 75, bottom: 100}) .forceX([0]).forceY([0]); chart.x(function(datum){ return datum.r; }) .xAxis.options({ axisLabel: customSettings.XLABEL || 'Changeset', tickFormat: d3.format('.0f') }); chart.xAxis .tickValues(changesets_count) .tickFormat(function(d){return changesets[d]}) .rotateLabels(-90); chart.y(function(datum){ return datum.v; }) .yAxis.options({ axisLabel: customSettings.YLABEL || 'GFlops'/*, tickFormat: function(val){ return d3.format('.0f')(val) + ' GFlops'; }*/ }); chart.tooltip.headerFormatter(function(d) { return changesets[d] + '

' + changesets_details[d] + "

"; }); //chart.useInteractiveGuideline(true); d3.select('#chart').datum(data).call(chart); var plot = d3.select('#chart > g'); /* setup the title */ plot.append('text') .style('font-size', '24px') .attr('text-anchor', 'middle').attr('x', '50%').attr('y', '20px') .text(customSettings.TITLE || ''); /* ensure the chart is responsive */ nv.utils.windowResize(chart.update); ================================================ FILE: VO_Module/thirdparty/eigen/bench/perf_monitoring/resources/chart_header.html ================================================ $treeview $search $mathjax
Please, help us to better know about our user community by answering the following short survey: https://forms.gle/wpyrxWi18ox9Z5ae9
$projectname  $projectnumber
$projectbrief
$projectbrief
$searchbox
================================================ FILE: VO_Module/thirdparty/eigen/doc/eigendoxy_layout.xml.in ================================================ ================================================ FILE: VO_Module/thirdparty/eigen/doc/eigendoxy_tabs.css ================================================ .tabs, .tabs2, .tabs3 { background-image: url('tab_b.png'); width: 100%; z-index: 101; font-size: 13px; } .tabs2 { font-size: 10px; } .tabs3 { font-size: 9px; } .tablist { margin: 0; padding: 0; display: table; } .tablist li { float: left; display: table-cell; background-image: url('tab_b.png'); line-height: 36px; list-style: none; } .tablist a { display: block; padding: 0 20px; font-weight: bold; background-image:url('tab_s.png'); background-repeat:no-repeat; background-position:right; color: #283A5D; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); text-decoration: none; outline: none; } .tabs3 .tablist a { padding: 0 10px; } .tablist a:hover { background-image: url('tab_h.png'); background-repeat:repeat-x; color: #fff; text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); text-decoration: none; } .tablist li.current a { background-image: url('tab_a.png'); background-repeat:repeat-x; color: #fff; text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/.krazy ================================================ EXCLUDE copyright EXCLUDE license ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/CMakeLists.txt ================================================ file(GLOB examples_SRCS "*.cpp") foreach(example_src ${examples_SRCS}) get_filename_component(example ${example_src} NAME_WE) add_executable(${example} ${example_src}) if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) target_link_libraries(${example} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}) endif() add_custom_command( TARGET ${example} POST_BUILD COMMAND ${example} ARGS >${CMAKE_CURRENT_BINARY_DIR}/${example}.out ) add_dependencies(all_examples ${example}) endforeach() ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/CustomizingEigen_Inheritance.cpp ================================================ #include #include class MyVectorType : public Eigen::VectorXd { public: MyVectorType(void):Eigen::VectorXd() {} // This constructor allows you to construct MyVectorType from Eigen expressions template MyVectorType(const Eigen::MatrixBase& other) : Eigen::VectorXd(other) { } // This method allows you to assign Eigen expressions to MyVectorType template MyVectorType& operator=(const Eigen::MatrixBase & other) { this->Eigen::VectorXd::operator=(other); return *this; } }; int main() { MyVectorType v = MyVectorType::Ones(4); v(2) += 10; v = 2 * v; std::cout << v.transpose() << std::endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Cwise_erf.cpp ================================================ #include #include #include using namespace Eigen; int main() { Array4d v(-0.5,2,0,-7); std::cout << v.erf() << std::endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Cwise_erfc.cpp ================================================ #include #include #include using namespace Eigen; int main() { Array4d v(-0.5,2,0,-7); std::cout << v.erfc() << std::endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Cwise_lgamma.cpp ================================================ #include #include #include using namespace Eigen; int main() { Array4d v(0.5,10,0,-1); std::cout << v.lgamma() << std::endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/DenseBase_middleCols_int.cpp ================================================ #include #include using namespace Eigen; using namespace std; int main(void) { int const N = 5; MatrixXi A(N,N); A.setRandom(); cout << "A =\n" << A << '\n' << endl; cout << "A(1..3,:) =\n" << A.middleCols(1,3) << endl; return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/DenseBase_middleRows_int.cpp ================================================ #include #include using namespace Eigen; using namespace std; int main(void) { int const N = 5; MatrixXi A(N,N); A.setRandom(); cout << "A =\n" << A << '\n' << endl; cout << "A(2..3,:) =\n" << A.middleRows(2,2) << endl; return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/DenseBase_template_int_middleCols.cpp ================================================ #include #include using namespace Eigen; using namespace std; int main(void) { int const N = 5; MatrixXi A(N,N); A.setRandom(); cout << "A =\n" << A << '\n' << endl; cout << "A(:,1..3) =\n" << A.middleCols<3>(1) << endl; return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/DenseBase_template_int_middleRows.cpp ================================================ #include #include using namespace Eigen; using namespace std; int main(void) { int const N = 5; MatrixXi A(N,N); A.setRandom(); cout << "A =\n" << A << '\n' << endl; cout << "A(1..3,:) =\n" << A.middleRows<3>(1) << endl; return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/QuickStart_example.cpp ================================================ #include #include using Eigen::MatrixXd; int main() { MatrixXd m(2,2); m(0,0) = 3; m(1,0) = 2.5; m(0,1) = -1; m(1,1) = m(1,0) + m(0,1); std::cout << m << std::endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/QuickStart_example2_dynamic.cpp ================================================ #include #include using namespace Eigen; using namespace std; int main() { MatrixXd m = MatrixXd::Random(3,3); m = (m + MatrixXd::Constant(3,3,1.2)) * 50; cout << "m =" << endl << m << endl; VectorXd v(3); v << 1, 2, 3; cout << "m * v =" << endl << m * v << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/QuickStart_example2_fixed.cpp ================================================ #include #include using namespace Eigen; using namespace std; int main() { Matrix3d m = Matrix3d::Random(); m = (m + Matrix3d::Constant(1.2)) * 50; cout << "m =" << endl << m << endl; Vector3d v(1,2,3); cout << "m * v =" << endl << m * v << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/TemplateKeyword_flexible.cpp ================================================ #include #include using namespace Eigen; template void copyUpperTriangularPart(MatrixBase& dst, const MatrixBase& src) { /* Note the 'template' keywords in the following line! */ dst.template triangularView() = src.template triangularView(); } int main() { MatrixXi m1 = MatrixXi::Ones(5,5); MatrixXi m2 = MatrixXi::Random(4,4); std::cout << "m2 before copy:" << std::endl; std::cout << m2 << std::endl << std::endl; copyUpperTriangularPart(m2, m1.topLeftCorner(4,4)); std::cout << "m2 after copy:" << std::endl; std::cout << m2 << std::endl << std::endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/TemplateKeyword_simple.cpp ================================================ #include #include using namespace Eigen; void copyUpperTriangularPart(MatrixXf& dst, const MatrixXf& src) { dst.triangularView() = src.triangularView(); } int main() { MatrixXf m1 = MatrixXf::Ones(4,4); MatrixXf m2 = MatrixXf::Random(4,4); std::cout << "m2 before copy:" << std::endl; std::cout << m2 << std::endl << std::endl; copyUpperTriangularPart(m2, m1); std::cout << "m2 after copy:" << std::endl; std::cout << m2 << std::endl << std::endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/TutorialInplaceLU.cpp ================================================ #include struct init { init() { std::cout << "[" << "init" << "]" << std::endl; } }; init init_obj; // [init] #include #include using namespace std; using namespace Eigen; int main() { MatrixXd A(2,2); A << 2, -1, 1, 3; cout << "Here is the input matrix A before decomposition:\n" << A << endl; cout << "[init]" << endl; cout << "[declaration]" << endl; PartialPivLU > lu(A); cout << "Here is the input matrix A after decomposition:\n" << A << endl; cout << "[declaration]" << endl; cout << "[matrixLU]" << endl; cout << "Here is the matrix storing the L and U factors:\n" << lu.matrixLU() << endl; cout << "[matrixLU]" << endl; cout << "[solve]" << endl; MatrixXd A0(2,2); A0 << 2, -1, 1, 3; VectorXd b(2); b << 1, 2; VectorXd x = lu.solve(b); cout << "Residual: " << (A0 * x - b).norm() << endl; cout << "[solve]" << endl; cout << "[modifyA]" << endl; A << 3, 4, -2, 1; x = lu.solve(b); cout << "Residual: " << (A0 * x - b).norm() << endl; cout << "[modifyA]" << endl; cout << "[recompute]" << endl; A0 = A; // save A lu.compute(A); x = lu.solve(b); cout << "Residual: " << (A0 * x - b).norm() << endl; cout << "[recompute]" << endl; cout << "[recompute_bis0]" << endl; MatrixXd A1(2,2); A1 << 5,-2,3,4; lu.compute(A1); cout << "Here is the input matrix A1 after decomposition:\n" << A1 << endl; cout << "[recompute_bis0]" << endl; cout << "[recompute_bis1]" << endl; x = lu.solve(b); cout << "Residual: " << (A1 * x - b).norm() << endl; cout << "[recompute_bis1]" << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/TutorialLinAlgComputeTwice.cpp ================================================ #include #include using namespace std; using namespace Eigen; int main() { Matrix2f A, b; LLT llt; A << 2, -1, -1, 3; b << 1, 2, 3, 1; cout << "Here is the matrix A:\n" << A << endl; cout << "Here is the right hand side b:\n" << b << endl; cout << "Computing LLT decomposition..." << endl; llt.compute(A); cout << "The solution is:\n" << llt.solve(b) << endl; A(1,1)++; cout << "The matrix A is now:\n" << A << endl; cout << "Computing LLT decomposition..." << endl; llt.compute(A); cout << "The solution is now:\n" << llt.solve(b) << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/TutorialLinAlgExComputeSolveError.cpp ================================================ #include #include using namespace std; using namespace Eigen; int main() { MatrixXd A = MatrixXd::Random(100,100); MatrixXd b = MatrixXd::Random(100,50); MatrixXd x = A.fullPivLu().solve(b); double relative_error = (A*x - b).norm() / b.norm(); // norm() is L2 norm cout << "The relative error is:\n" << relative_error << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/TutorialLinAlgExSolveColPivHouseholderQR.cpp ================================================ #include #include using namespace std; using namespace Eigen; int main() { Matrix3f A; Vector3f b; A << 1,2,3, 4,5,6, 7,8,10; b << 3, 3, 4; cout << "Here is the matrix A:\n" << A << endl; cout << "Here is the vector b:\n" << b << endl; Vector3f x = A.colPivHouseholderQr().solve(b); cout << "The solution is:\n" << x << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/TutorialLinAlgExSolveLDLT.cpp ================================================ #include #include using namespace std; using namespace Eigen; int main() { Matrix2f A, b; A << 2, -1, -1, 3; b << 1, 2, 3, 1; cout << "Here is the matrix A:\n" << A << endl; cout << "Here is the right hand side b:\n" << b << endl; Matrix2f x = A.ldlt().solve(b); cout << "The solution is:\n" << x << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/TutorialLinAlgInverseDeterminant.cpp ================================================ #include #include using namespace std; using namespace Eigen; int main() { Matrix3f A; A << 1, 2, 1, 2, 1, 0, -1, 1, 2; cout << "Here is the matrix A:\n" << A << endl; cout << "The determinant of A is " << A.determinant() << endl; cout << "The inverse of A is:\n" << A.inverse() << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/TutorialLinAlgRankRevealing.cpp ================================================ #include #include using namespace std; using namespace Eigen; int main() { Matrix3f A; A << 1, 2, 5, 2, 1, 4, 3, 0, 3; cout << "Here is the matrix A:\n" << A << endl; FullPivLU lu_decomp(A); cout << "The rank of A is " << lu_decomp.rank() << endl; cout << "Here is a matrix whose columns form a basis of the null-space of A:\n" << lu_decomp.kernel() << endl; cout << "Here is a matrix whose columns form a basis of the column-space of A:\n" << lu_decomp.image(A) << endl; // yes, have to pass the original A } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/TutorialLinAlgSVDSolve.cpp ================================================ #include #include using namespace std; using namespace Eigen; int main() { MatrixXf A = MatrixXf::Random(3, 2); cout << "Here is the matrix A:\n" << A << endl; VectorXf b = VectorXf::Random(3); cout << "Here is the right hand side b:\n" << b << endl; cout << "The least-squares solution is:\n" << A.bdcSvd(ComputeThinU | ComputeThinV).solve(b) << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/TutorialLinAlgSelfAdjointEigenSolver.cpp ================================================ #include #include using namespace std; using namespace Eigen; int main() { Matrix2f A; A << 1, 2, 2, 3; cout << "Here is the matrix A:\n" << A << endl; SelfAdjointEigenSolver eigensolver(A); if (eigensolver.info() != Success) abort(); cout << "The eigenvalues of A are:\n" << eigensolver.eigenvalues() << endl; cout << "Here's a matrix whose columns are eigenvectors of A \n" << "corresponding to these eigenvalues:\n" << eigensolver.eigenvectors() << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/TutorialLinAlgSetThreshold.cpp ================================================ #include #include using namespace std; using namespace Eigen; int main() { Matrix2d A; A << 2, 1, 2, 0.9999999999; FullPivLU lu(A); cout << "By default, the rank of A is found to be " << lu.rank() << endl; lu.setThreshold(1e-5); cout << "With threshold 1e-5, the rank of A is found to be " << lu.rank() << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_ArrayClass_accessors.cpp ================================================ #include #include using namespace Eigen; using namespace std; int main() { ArrayXXf m(2,2); // assign some values coefficient by coefficient m(0,0) = 1.0; m(0,1) = 2.0; m(1,0) = 3.0; m(1,1) = m(0,1) + m(1,0); // print values to standard output cout << m << endl << endl; // using the comma-initializer is also allowed m << 1.0,2.0, 3.0,4.0; // print values to standard output cout << m << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_ArrayClass_addition.cpp ================================================ #include #include using namespace Eigen; using namespace std; int main() { ArrayXXf a(3,3); ArrayXXf b(3,3); a << 1,2,3, 4,5,6, 7,8,9; b << 1,2,3, 1,2,3, 1,2,3; // Adding two arrays cout << "a + b = " << endl << a + b << endl << endl; // Subtracting a scalar from an array cout << "a - 2 = " << endl << a - 2 << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_ArrayClass_cwise_other.cpp ================================================ #include #include using namespace Eigen; using namespace std; int main() { ArrayXf a = ArrayXf::Random(5); a *= 2; cout << "a =" << endl << a << endl; cout << "a.abs() =" << endl << a.abs() << endl; cout << "a.abs().sqrt() =" << endl << a.abs().sqrt() << endl; cout << "a.min(a.abs().sqrt()) =" << endl << a.min(a.abs().sqrt()) << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_ArrayClass_interop.cpp ================================================ #include #include using namespace Eigen; using namespace std; int main() { MatrixXf m(2,2); MatrixXf n(2,2); MatrixXf result(2,2); m << 1,2, 3,4; n << 5,6, 7,8; result = (m.array() + 4).matrix() * m; cout << "-- Combination 1: --" << endl << result << endl << endl; result = (m.array() * n.array()).matrix() * m; cout << "-- Combination 2: --" << endl << result << endl << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_ArrayClass_interop_matrix.cpp ================================================ #include #include using namespace Eigen; using namespace std; int main() { MatrixXf m(2,2); MatrixXf n(2,2); MatrixXf result(2,2); m << 1,2, 3,4; n << 5,6, 7,8; result = m * n; cout << "-- Matrix m*n: --" << endl << result << endl << endl; result = m.array() * n.array(); cout << "-- Array m*n: --" << endl << result << endl << endl; result = m.cwiseProduct(n); cout << "-- With cwiseProduct: --" << endl << result << endl << endl; result = m.array() + 4; cout << "-- Array m + 4: --" << endl << result << endl << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_ArrayClass_mult.cpp ================================================ #include #include using namespace Eigen; using namespace std; int main() { ArrayXXf a(2,2); ArrayXXf b(2,2); a << 1,2, 3,4; b << 5,6, 7,8; cout << "a * b = " << endl << a * b << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_BlockOperations_block_assignment.cpp ================================================ #include #include using namespace std; using namespace Eigen; int main() { Array22f m; m << 1,2, 3,4; Array44f a = Array44f::Constant(0.6); cout << "Here is the array a:" << endl << a << endl << endl; a.block<2,2>(1,1) = m; cout << "Here is now a with m copied into its central 2x2 block:" << endl << a << endl << endl; a.block(0,0,2,3) = a.block(2,1,2,3); cout << "Here is now a with bottom-right 2x3 block copied into top-left 2x3 block:" << endl << a << endl << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_BlockOperations_colrow.cpp ================================================ #include #include using namespace std; int main() { Eigen::MatrixXf m(3,3); m << 1,2,3, 4,5,6, 7,8,9; cout << "Here is the matrix m:" << endl << m << endl; cout << "2nd Row: " << m.row(1) << endl; m.col(2) += 3 * m.col(0); cout << "After adding 3 times the first column into the third column, the matrix m is:\n"; cout << m << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_BlockOperations_corner.cpp ================================================ #include #include using namespace std; int main() { Eigen::Matrix4f m; m << 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12, 13,14,15,16; cout << "m.leftCols(2) =" << endl << m.leftCols(2) << endl << endl; cout << "m.bottomRows<2>() =" << endl << m.bottomRows<2>() << endl << endl; m.topLeftCorner(1,3) = m.bottomRightCorner(3,1).transpose(); cout << "After assignment, m = " << endl << m << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_BlockOperations_print_block.cpp ================================================ #include #include using namespace std; int main() { Eigen::MatrixXf m(4,4); m << 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12, 13,14,15,16; cout << "Block in the middle" << endl; cout << m.block<2,2>(1,1) << endl << endl; for (int i = 1; i <= 3; ++i) { cout << "Block of size " << i << "x" << i << endl; cout << m.block(0,0,i,i) << endl << endl; } } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_BlockOperations_vector.cpp ================================================ #include #include using namespace std; int main() { Eigen::ArrayXf v(6); v << 1, 2, 3, 4, 5, 6; cout << "v.head(3) =" << endl << v.head(3) << endl << endl; cout << "v.tail<3>() = " << endl << v.tail<3>() << endl << endl; v.segment(1,4) *= 2; cout << "after 'v.segment(1,4) *= 2', v =" << endl << v << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_PartialLU_solve.cpp ================================================ #include #include #include using namespace std; using namespace Eigen; int main() { Matrix3f A; Vector3f b; A << 1,2,3, 4,5,6, 7,8,10; b << 3, 3, 4; cout << "Here is the matrix A:" << endl << A << endl; cout << "Here is the vector b:" << endl << b << endl; Vector3f x = A.lu().solve(b); cout << "The solution is:" << endl << x << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.cpp ================================================ #include #include using namespace std; using namespace Eigen; int main() { Eigen::MatrixXf m(2,4); Eigen::VectorXf v(2); m << 1, 23, 6, 9, 3, 11, 7, 2; v << 2, 3; MatrixXf::Index index; // find nearest neighbour (m.colwise() - v).colwise().squaredNorm().minCoeff(&index); cout << "Nearest neighbour is column " << index << ":" << endl; cout << m.col(index) << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp ================================================ #include #include using namespace std; int main() { Eigen::MatrixXf mat(2,4); Eigen::VectorXf v(2); mat << 1, 2, 6, 9, 3, 1, 7, 2; v << 0, 1; //add v to each column of m mat.colwise() += v; std::cout << "Broadcasting result: " << std::endl; std::cout << mat << std::endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp ================================================ #include #include using namespace std; int main() { Eigen::MatrixXf mat(2,4); Eigen::VectorXf v(4); mat << 1, 2, 6, 9, 3, 1, 7, 2; v << 0,1,2,3; //add v to each row of m mat.rowwise() += v.transpose(); std::cout << "Broadcasting result: " << std::endl; std::cout << mat << std::endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp ================================================ #include #include using namespace std; int main() { Eigen::MatrixXf mat(2,4); mat << 1, 2, 6, 9, 3, 1, 7, 2; std::cout << "Column's maximum: " << std::endl << mat.colwise().maxCoeff() << std::endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp ================================================ #include #include using namespace std; using namespace Eigen; int main() { MatrixXf mat(2,4); mat << 1, 2, 6, 9, 3, 1, 7, 2; MatrixXf::Index maxIndex; float maxNorm = mat.colwise().sum().maxCoeff(&maxIndex); std::cout << "Maximum sum at position " << maxIndex << std::endl; std::cout << "The corresponding vector is: " << std::endl; std::cout << mat.col( maxIndex ) << std::endl; std::cout << "And its sum is is: " << maxNorm << std::endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp ================================================ #include #include using namespace std; using namespace Eigen; int main() { ArrayXXf a(2,2); a << 1,2, 3,4; cout << "(a > 0).all() = " << (a > 0).all() << endl; cout << "(a > 0).any() = " << (a > 0).any() << endl; cout << "(a > 0).count() = " << (a > 0).count() << endl; cout << endl; cout << "(a > 2).all() = " << (a > 2).all() << endl; cout << "(a > 2).any() = " << (a > 2).any() << endl; cout << "(a > 2).count() = " << (a > 2).count() << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp ================================================ #include #include using namespace std; using namespace Eigen; int main() { VectorXf v(2); MatrixXf m(2,2), n(2,2); v << -1, 2; m << 1,-2, -3,4; cout << "v.squaredNorm() = " << v.squaredNorm() << endl; cout << "v.norm() = " << v.norm() << endl; cout << "v.lpNorm<1>() = " << v.lpNorm<1>() << endl; cout << "v.lpNorm() = " << v.lpNorm() << endl; cout << endl; cout << "m.squaredNorm() = " << m.squaredNorm() << endl; cout << "m.norm() = " << m.norm() << endl; cout << "m.lpNorm<1>() = " << m.lpNorm<1>() << endl; cout << "m.lpNorm() = " << m.lpNorm() << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_operatornorm.cpp ================================================ #include #include using namespace Eigen; using namespace std; int main() { MatrixXf m(2,2); m << 1,-2, -3,4; cout << "1-norm(m) = " << m.cwiseAbs().colwise().sum().maxCoeff() << " == " << m.colwise().lpNorm<1>().maxCoeff() << endl; cout << "infty-norm(m) = " << m.cwiseAbs().rowwise().sum().maxCoeff() << " == " << m.rowwise().lpNorm<1>().maxCoeff() << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_rowwise.cpp ================================================ #include #include using namespace std; int main() { Eigen::MatrixXf mat(2,4); mat << 1, 2, 6, 9, 3, 1, 7, 2; std::cout << "Row's maximum: " << std::endl << mat.rowwise().maxCoeff() << std::endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp ================================================ #include #include using namespace std; using namespace Eigen; int main() { Eigen::MatrixXf m(2,2); m << 1, 2, 3, 4; //get location of maximum MatrixXf::Index maxRow, maxCol; float max = m.maxCoeff(&maxRow, &maxCol); //get location of minimum MatrixXf::Index minRow, minCol; float min = m.minCoeff(&minRow, &minCol); cout << "Max: " << max << ", at: " << maxRow << "," << maxCol << endl; cout << "Min: " << min << ", at: " << minRow << "," << minCol << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/Tutorial_simple_example_dynamic_size.cpp ================================================ #include #include using namespace Eigen; int main() { for (int size=1; size<=4; ++size) { MatrixXi m(size,size+1); // a (size)x(size+1)-matrix of int's for (int j=0; j #include using namespace Eigen; int main() { Matrix3f m3; m3 << 1, 2, 3, 4, 5, 6, 7, 8, 9; Matrix4f m4 = Matrix4f::Identity(); Vector4i v4(1, 2, 3, 4); std::cout << "m3\n" << m3 << "\nm4:\n" << m4 << "\nv4:\n" << v4 << std::endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/class_Block.cpp ================================================ #include #include using namespace Eigen; using namespace std; template Eigen::Block topLeftCorner(MatrixBase& m, int rows, int cols) { return Eigen::Block(m.derived(), 0, 0, rows, cols); } template const Eigen::Block topLeftCorner(const MatrixBase& m, int rows, int cols) { return Eigen::Block(m.derived(), 0, 0, rows, cols); } int main(int, char**) { Matrix4d m = Matrix4d::Identity(); cout << topLeftCorner(4*m, 2, 3) << endl; // calls the const version topLeftCorner(m, 2, 3) *= 5; // calls the non-const version cout << "Now the matrix m is:" << endl << m << endl; return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/class_CwiseBinaryOp.cpp ================================================ #include #include using namespace Eigen; using namespace std; // define a custom template binary functor template struct MakeComplexOp { EIGEN_EMPTY_STRUCT_CTOR(MakeComplexOp) typedef complex result_type; complex operator()(const Scalar& a, const Scalar& b) const { return complex(a,b); } }; int main(int, char**) { Matrix4d m1 = Matrix4d::Random(), m2 = Matrix4d::Random(); cout << m1.binaryExpr(m2, MakeComplexOp()) << endl; return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/class_CwiseUnaryOp.cpp ================================================ #include #include using namespace Eigen; using namespace std; // define a custom template unary functor template struct CwiseClampOp { CwiseClampOp(const Scalar& inf, const Scalar& sup) : m_inf(inf), m_sup(sup) {} const Scalar operator()(const Scalar& x) const { return xm_sup ? m_sup : x); } Scalar m_inf, m_sup; }; int main(int, char**) { Matrix4d m1 = Matrix4d::Random(); cout << m1 << endl << "becomes: " << endl << m1.unaryExpr(CwiseClampOp(-0.5,0.5)) << endl; return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/class_CwiseUnaryOp_ptrfun.cpp ================================================ #include #include using namespace Eigen; using namespace std; // define function to be applied coefficient-wise double ramp(double x) { if (x > 0) return x; else return 0; } int main(int, char**) { Matrix4d m1 = Matrix4d::Random(); cout << m1 << endl << "becomes: " << endl << m1.unaryExpr(ptr_fun(ramp)) << endl; return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/class_FixedBlock.cpp ================================================ #include #include using namespace Eigen; using namespace std; template Eigen::Block topLeft2x2Corner(MatrixBase& m) { return Eigen::Block(m.derived(), 0, 0); } template const Eigen::Block topLeft2x2Corner(const MatrixBase& m) { return Eigen::Block(m.derived(), 0, 0); } int main(int, char**) { Matrix3d m = Matrix3d::Identity(); cout << topLeft2x2Corner(4*m) << endl; // calls the const version topLeft2x2Corner(m) *= 2; // calls the non-const version cout << "Now the matrix m is:" << endl << m << endl; return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/class_FixedReshaped.cpp ================================================ #include #include using namespace Eigen; using namespace std; template Eigen::Reshaped reshape_helper(MatrixBase& m) { return Eigen::Reshaped(m.derived()); } int main(int, char**) { MatrixXd m(2, 4); m << 1, 2, 3, 4, 5, 6, 7, 8; MatrixXd n = reshape_helper(m); cout << "matrix m is:" << endl << m << endl; cout << "matrix n is:" << endl << n << endl; return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/class_FixedVectorBlock.cpp ================================================ #include #include using namespace Eigen; using namespace std; template Eigen::VectorBlock firstTwo(MatrixBase& v) { return Eigen::VectorBlock(v.derived(), 0); } template const Eigen::VectorBlock firstTwo(const MatrixBase& v) { return Eigen::VectorBlock(v.derived(), 0); } int main(int, char**) { Matrix v; v << 1,2,3,4,5,6; cout << firstTwo(4*v) << endl; // calls the const version firstTwo(v) *= 2; // calls the non-const version cout << "Now the vector v is:" << endl << v << endl; return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/class_Reshaped.cpp ================================================ #include #include using namespace std; using namespace Eigen; template const Reshaped reshape_helper(const MatrixBase& m, int rows, int cols) { return Reshaped(m.derived(), rows, cols); } int main(int, char**) { MatrixXd m(3, 4); m << 1, 4, 7, 10, 2, 5, 8, 11, 3, 6, 9, 12; cout << m << endl; Ref n = reshape_helper(m, 2, 6); cout << "Matrix m is:" << endl << m << endl; cout << "Matrix n is:" << endl << n << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/class_VectorBlock.cpp ================================================ #include #include using namespace Eigen; using namespace std; template Eigen::VectorBlock segmentFromRange(MatrixBase& v, int start, int end) { return Eigen::VectorBlock(v.derived(), start, end-start); } template const Eigen::VectorBlock segmentFromRange(const MatrixBase& v, int start, int end) { return Eigen::VectorBlock(v.derived(), start, end-start); } int main(int, char**) { Matrix v; v << 1,2,3,4,5,6; cout << segmentFromRange(2*v, 2, 4) << endl; // calls the const version segmentFromRange(v, 1, 3) *= 5; // calls the non-const version cout << "Now the vector v is:" << endl << v << endl; return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/function_taking_eigenbase.cpp ================================================ #include #include using namespace Eigen; template void print_size(const EigenBase& b) { std::cout << "size (rows, cols): " << b.size() << " (" << b.rows() << ", " << b.cols() << ")" << std::endl; } int main() { Vector3f v; print_size(v); // v.asDiagonal() returns a 3x3 diagonal matrix pseudo-expression print_size(v.asDiagonal()); } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/function_taking_ref.cpp ================================================ #include #include using namespace Eigen; using namespace std; float inv_cond(const Ref& a) { const VectorXf sing_vals = a.jacobiSvd().singularValues(); return sing_vals(sing_vals.size()-1) / sing_vals(0); } int main() { Matrix4f m = Matrix4f::Random(); cout << "matrix m:" << endl << m << endl << endl; cout << "inv_cond(m): " << inv_cond(m) << endl; cout << "inv_cond(m(1:3,1:3)): " << inv_cond(m.topLeftCorner(3,3)) << endl; cout << "inv_cond(m+I): " << inv_cond(m+Matrix4f::Identity()) << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/make_circulant.cpp ================================================ /* This program is presented in several fragments in the doc page. Every fragment is in its own file; this file simply combines them. */ #include "make_circulant.cpp.preamble" #include "make_circulant.cpp.traits" #include "make_circulant.cpp.expression" #include "make_circulant.cpp.evaluator" #include "make_circulant.cpp.entry" #include "make_circulant.cpp.main" ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/make_circulant.cpp.entry ================================================ template Circulant makeCirculant(const Eigen::MatrixBase& arg) { return Circulant(arg.derived()); } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/make_circulant.cpp.evaluator ================================================ namespace Eigen { namespace internal { template struct evaluator > : evaluator_base > { typedef Circulant XprType; typedef typename nested_eval::type ArgTypeNested; typedef typename remove_all::type ArgTypeNestedCleaned; typedef typename XprType::CoeffReturnType CoeffReturnType; enum { CoeffReadCost = evaluator::CoeffReadCost, Flags = Eigen::ColMajor }; evaluator(const XprType& xpr) : m_argImpl(xpr.m_arg), m_rows(xpr.rows()) { } CoeffReturnType coeff(Index row, Index col) const { Index index = row - col; if (index < 0) index += m_rows; return m_argImpl.coeff(index); } evaluator m_argImpl; const Index m_rows; }; } } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/make_circulant.cpp.expression ================================================ template class Circulant : public Eigen::MatrixBase > { public: Circulant(const ArgType& arg) : m_arg(arg) { EIGEN_STATIC_ASSERT(ArgType::ColsAtCompileTime == 1, YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX); } typedef typename Eigen::internal::ref_selector::type Nested; typedef Eigen::Index Index; Index rows() const { return m_arg.rows(); } Index cols() const { return m_arg.rows(); } typedef typename Eigen::internal::ref_selector::type ArgTypeNested; ArgTypeNested m_arg; }; ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/make_circulant.cpp.main ================================================ int main() { Eigen::VectorXd vec(4); vec << 1, 2, 4, 8; Eigen::MatrixXd mat; mat = makeCirculant(vec); std::cout << mat << std::endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/make_circulant.cpp.preamble ================================================ #include #include template class Circulant; ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/make_circulant.cpp.traits ================================================ namespace Eigen { namespace internal { template struct traits > { typedef Eigen::Dense StorageKind; typedef Eigen::MatrixXpr XprKind; typedef typename ArgType::StorageIndex StorageIndex; typedef typename ArgType::Scalar Scalar; enum { Flags = Eigen::ColMajor, RowsAtCompileTime = ArgType::RowsAtCompileTime, ColsAtCompileTime = ArgType::RowsAtCompileTime, MaxRowsAtCompileTime = ArgType::MaxRowsAtCompileTime, MaxColsAtCompileTime = ArgType::MaxRowsAtCompileTime }; }; } } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/make_circulant2.cpp ================================================ #include #include using namespace Eigen; // [circulant_func] template class circulant_functor { const ArgType &m_vec; public: circulant_functor(const ArgType& arg) : m_vec(arg) {} const typename ArgType::Scalar& operator() (Index row, Index col) const { Index index = row - col; if (index < 0) index += m_vec.size(); return m_vec(index); } }; // [circulant_func] // [square] template struct circulant_helper { typedef Matrix MatrixType; }; // [square] // [makeCirculant] template CwiseNullaryOp, typename circulant_helper::MatrixType> makeCirculant(const Eigen::MatrixBase& arg) { typedef typename circulant_helper::MatrixType MatrixType; return MatrixType::NullaryExpr(arg.size(), arg.size(), circulant_functor(arg.derived())); } // [makeCirculant] // [main] int main() { Eigen::VectorXd vec(4); vec << 1, 2, 4, 8; Eigen::MatrixXd mat; mat = makeCirculant(vec); std::cout << mat << std::endl; } // [main] ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/matrixfree_cg.cpp ================================================ #include #include #include #include #include class MatrixReplacement; using Eigen::SparseMatrix; namespace Eigen { namespace internal { // MatrixReplacement looks-like a SparseMatrix, so let's inherits its traits: template<> struct traits : public Eigen::internal::traits > {}; } } // Example of a matrix-free wrapper from a user type to Eigen's compatible type // For the sake of simplicity, this example simply wrap a Eigen::SparseMatrix. class MatrixReplacement : public Eigen::EigenBase { public: // Required typedefs, constants, and method: typedef double Scalar; typedef double RealScalar; typedef int StorageIndex; enum { ColsAtCompileTime = Eigen::Dynamic, MaxColsAtCompileTime = Eigen::Dynamic, IsRowMajor = false }; Index rows() const { return mp_mat->rows(); } Index cols() const { return mp_mat->cols(); } template Eigen::Product operator*(const Eigen::MatrixBase& x) const { return Eigen::Product(*this, x.derived()); } // Custom API: MatrixReplacement() : mp_mat(0) {} void attachMyMatrix(const SparseMatrix &mat) { mp_mat = &mat; } const SparseMatrix my_matrix() const { return *mp_mat; } private: const SparseMatrix *mp_mat; }; // Implementation of MatrixReplacement * Eigen::DenseVector though a specialization of internal::generic_product_impl: namespace Eigen { namespace internal { template struct generic_product_impl // GEMV stands for matrix-vector : generic_product_impl_base > { typedef typename Product::Scalar Scalar; template static void scaleAndAddTo(Dest& dst, const MatrixReplacement& lhs, const Rhs& rhs, const Scalar& alpha) { // This method should implement "dst += alpha * lhs * rhs" inplace, // however, for iterative solvers, alpha is always equal to 1, so let's not bother about it. assert(alpha==Scalar(1) && "scaling is not implemented"); EIGEN_ONLY_USED_FOR_DEBUG(alpha); // Here we could simply call dst.noalias() += lhs.my_matrix() * rhs, // but let's do something fancier (and less efficient): for(Index i=0; i S = Eigen::MatrixXd::Random(n,n).sparseView(0.5,1); S = S.transpose()*S; MatrixReplacement A; A.attachMyMatrix(S); Eigen::VectorXd b(n), x; b.setRandom(); // Solve Ax = b using various iterative solver with matrix-free version: { Eigen::ConjugateGradient cg; cg.compute(A); x = cg.solve(b); std::cout << "CG: #iterations: " << cg.iterations() << ", estimated error: " << cg.error() << std::endl; } { Eigen::BiCGSTAB bicg; bicg.compute(A); x = bicg.solve(b); std::cout << "BiCGSTAB: #iterations: " << bicg.iterations() << ", estimated error: " << bicg.error() << std::endl; } { Eigen::GMRES gmres; gmres.compute(A); x = gmres.solve(b); std::cout << "GMRES: #iterations: " << gmres.iterations() << ", estimated error: " << gmres.error() << std::endl; } { Eigen::DGMRES gmres; gmres.compute(A); x = gmres.solve(b); std::cout << "DGMRES: #iterations: " << gmres.iterations() << ", estimated error: " << gmres.error() << std::endl; } { Eigen::MINRES minres; minres.compute(A); x = minres.solve(b); std::cout << "MINRES: #iterations: " << minres.iterations() << ", estimated error: " << minres.error() << std::endl; } } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/nullary_indexing.cpp ================================================ #include #include using namespace Eigen; // [functor] template class indexing_functor { const ArgType &m_arg; const RowIndexType &m_rowIndices; const ColIndexType &m_colIndices; public: typedef Matrix MatrixType; indexing_functor(const ArgType& arg, const RowIndexType& row_indices, const ColIndexType& col_indices) : m_arg(arg), m_rowIndices(row_indices), m_colIndices(col_indices) {} const typename ArgType::Scalar& operator() (Index row, Index col) const { return m_arg(m_rowIndices[row], m_colIndices[col]); } }; // [functor] // [function] template CwiseNullaryOp, typename indexing_functor::MatrixType> mat_indexing(const Eigen::MatrixBase& arg, const RowIndexType& row_indices, const ColIndexType& col_indices) { typedef indexing_functor Func; typedef typename Func::MatrixType MatrixType; return MatrixType::NullaryExpr(row_indices.size(), col_indices.size(), Func(arg.derived(), row_indices, col_indices)); } // [function] int main() { std::cout << "[main1]\n"; Eigen::MatrixXi A = Eigen::MatrixXi::Random(4,4); Array3i ri(1,2,1); ArrayXi ci(6); ci << 3,2,1,0,0,2; Eigen::MatrixXi B = mat_indexing(A, ri, ci); std::cout << "A =" << std::endl; std::cout << A << std::endl << std::endl; std::cout << "A([" << ri.transpose() << "], [" << ci.transpose() << "]) =" << std::endl; std::cout << B << std::endl; std::cout << "[main1]\n"; std::cout << "[main2]\n"; B = mat_indexing(A, ri+1, ci); std::cout << "A(ri+1,ci) =" << std::endl; std::cout << B << std::endl << std::endl; #if EIGEN_COMP_CXXVER >= 11 B = mat_indexing(A, ArrayXi::LinSpaced(13,0,12).unaryExpr([](int x){return x%4;}), ArrayXi::LinSpaced(4,0,3)); std::cout << "A(ArrayXi::LinSpaced(13,0,12).unaryExpr([](int x){return x%4;}), ArrayXi::LinSpaced(4,0,3)) =" << std::endl; std::cout << B << std::endl << std::endl; #endif std::cout << "[main2]\n"; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/tut_arithmetic_add_sub.cpp ================================================ #include #include using namespace Eigen; int main() { Matrix2d a; a << 1, 2, 3, 4; MatrixXd b(2,2); b << 2, 3, 1, 4; std::cout << "a + b =\n" << a + b << std::endl; std::cout << "a - b =\n" << a - b << std::endl; std::cout << "Doing a += b;" << std::endl; a += b; std::cout << "Now a =\n" << a << std::endl; Vector3d v(1,2,3); Vector3d w(1,0,0); std::cout << "-v + w - v =\n" << -v + w - v << std::endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/tut_arithmetic_dot_cross.cpp ================================================ #include #include using namespace Eigen; using namespace std; int main() { Vector3d v(1,2,3); Vector3d w(0,1,2); cout << "Dot product: " << v.dot(w) << endl; double dp = v.adjoint()*w; // automatic conversion of the inner product to a scalar cout << "Dot product via a matrix product: " << dp << endl; cout << "Cross product:\n" << v.cross(w) << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/tut_arithmetic_matrix_mul.cpp ================================================ #include #include using namespace Eigen; int main() { Matrix2d mat; mat << 1, 2, 3, 4; Vector2d u(-1,1), v(2,0); std::cout << "Here is mat*mat:\n" << mat*mat << std::endl; std::cout << "Here is mat*u:\n" << mat*u << std::endl; std::cout << "Here is u^T*mat:\n" << u.transpose()*mat << std::endl; std::cout << "Here is u^T*v:\n" << u.transpose()*v << std::endl; std::cout << "Here is u*v^T:\n" << u*v.transpose() << std::endl; std::cout << "Let's multiply mat by itself" << std::endl; mat = mat*mat; std::cout << "Now mat is mat:\n" << mat << std::endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/tut_arithmetic_redux_basic.cpp ================================================ #include #include using namespace std; int main() { Eigen::Matrix2d mat; mat << 1, 2, 3, 4; cout << "Here is mat.sum(): " << mat.sum() << endl; cout << "Here is mat.prod(): " << mat.prod() << endl; cout << "Here is mat.mean(): " << mat.mean() << endl; cout << "Here is mat.minCoeff(): " << mat.minCoeff() << endl; cout << "Here is mat.maxCoeff(): " << mat.maxCoeff() << endl; cout << "Here is mat.trace(): " << mat.trace() << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/tut_arithmetic_scalar_mul_div.cpp ================================================ #include #include using namespace Eigen; int main() { Matrix2d a; a << 1, 2, 3, 4; Vector3d v(1,2,3); std::cout << "a * 2.5 =\n" << a * 2.5 << std::endl; std::cout << "0.1 * v =\n" << 0.1 * v << std::endl; std::cout << "Doing v *= 2;" << std::endl; v *= 2; std::cout << "Now v =\n" << v << std::endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/tut_matrix_coefficient_accessors.cpp ================================================ #include #include using namespace Eigen; int main() { MatrixXd m(2,2); m(0,0) = 3; m(1,0) = 2.5; m(0,1) = -1; m(1,1) = m(1,0) + m(0,1); std::cout << "Here is the matrix m:\n" << m << std::endl; VectorXd v(2); v(0) = 4; v(1) = v(0) - 1; std::cout << "Here is the vector v:\n" << v << std::endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/tut_matrix_resize.cpp ================================================ #include #include using namespace Eigen; int main() { MatrixXd m(2,5); m.resize(4,3); std::cout << "The matrix m is of size " << m.rows() << "x" << m.cols() << std::endl; std::cout << "It has " << m.size() << " coefficients" << std::endl; VectorXd v(2); v.resize(5); std::cout << "The vector v is of size " << v.size() << std::endl; std::cout << "As a matrix, v is of size " << v.rows() << "x" << v.cols() << std::endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/examples/tut_matrix_resize_fixed_size.cpp ================================================ #include #include using namespace Eigen; int main() { Matrix4d m; m.resize(4,4); // no operation std::cout << "The matrix m is of size " << m.rows() << "x" << m.cols() << std::endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/.krazy ================================================ EXCLUDE copyright EXCLUDE license ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/AngleAxis_mimic_euler.cpp ================================================ Matrix3f m; m = AngleAxisf(0.25*M_PI, Vector3f::UnitX()) * AngleAxisf(0.5*M_PI, Vector3f::UnitY()) * AngleAxisf(0.33*M_PI, Vector3f::UnitZ()); cout << m << endl << "is unitary: " << m.isUnitary() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Array_initializer_list_23_cxx11.cpp ================================================ ArrayXXi a { {1, 2, 3}, {3, 4, 5} }; cout << a << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Array_initializer_list_vector_cxx11.cpp ================================================ Array v {{1, 2, 3, 4, 5}}; cout << v << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Array_variadic_ctor_cxx11.cpp ================================================ Array a(1, 2, 3, 4, 5, 6); Array b {1, 2, 3}; cout << a << "\n\n" << b << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/BiCGSTAB_simple.cpp ================================================ int n = 10000; VectorXd x(n), b(n); SparseMatrix A(n,n); /* ... fill A and b ... */ BiCGSTAB > solver; solver.compute(A); x = solver.solve(b); std::cout << "#iterations: " << solver.iterations() << std::endl; std::cout << "estimated error: " << solver.error() << std::endl; /* ... update b ... */ x = solver.solve(b); // solve again ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/BiCGSTAB_step_by_step.cpp ================================================ int n = 10000; VectorXd x(n), b(n); SparseMatrix A(n,n); /* ... fill A and b ... */ BiCGSTAB > solver(A); // start from a random solution x = VectorXd::Random(n); solver.setMaxIterations(1); int i = 0; do { x = solver.solveWithGuess(b,x); std::cout << i << " : " << solver.error() << std::endl; ++i; } while (solver.info()!=Success && i<100); ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/CMakeLists.txt ================================================ file(GLOB snippets_SRCS "*.cpp") add_custom_target(all_snippets) foreach(snippet_src ${snippets_SRCS}) get_filename_component(snippet ${snippet_src} NAME_WE) set(compile_snippet_target compile_${snippet}) set(compile_snippet_src ${compile_snippet_target}.cpp) file(READ ${snippet_src} snippet_source_code) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/compile_snippet.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src}) add_executable(${compile_snippet_target} ${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src}) if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) target_link_libraries(${compile_snippet_target} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}) endif() if(${snippet_src} MATCHES "deprecated") set_target_properties(${compile_snippet_target} PROPERTIES COMPILE_FLAGS "-DEIGEN_NO_DEPRECATED_WARNING") endif() add_custom_command( TARGET ${compile_snippet_target} POST_BUILD COMMAND ${compile_snippet_target} ARGS >${CMAKE_CURRENT_BINARY_DIR}/${snippet}.out ) add_dependencies(all_snippets ${compile_snippet_target}) set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src} PROPERTIES OBJECT_DEPENDS ${snippet_src}) endforeach() ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/ColPivHouseholderQR_solve.cpp ================================================ Matrix3f m = Matrix3f::Random(); Matrix3f y = Matrix3f::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the matrix y:" << endl << y << endl; Matrix3f x; x = m.colPivHouseholderQr().solve(y); assert(y.isApprox(m*x)); cout << "Here is a solution x to the equation mx=y:" << endl << x << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/ComplexEigenSolver_compute.cpp ================================================ MatrixXcf A = MatrixXcf::Random(4,4); cout << "Here is a random 4x4 matrix, A:" << endl << A << endl << endl; ComplexEigenSolver ces; ces.compute(A); cout << "The eigenvalues of A are:" << endl << ces.eigenvalues() << endl; cout << "The matrix of eigenvectors, V, is:" << endl << ces.eigenvectors() << endl << endl; complex lambda = ces.eigenvalues()[0]; cout << "Consider the first eigenvalue, lambda = " << lambda << endl; VectorXcf v = ces.eigenvectors().col(0); cout << "If v is the corresponding eigenvector, then lambda * v = " << endl << lambda * v << endl; cout << "... and A * v = " << endl << A * v << endl << endl; cout << "Finally, V * D * V^(-1) = " << endl << ces.eigenvectors() * ces.eigenvalues().asDiagonal() * ces.eigenvectors().inverse() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/ComplexEigenSolver_eigenvalues.cpp ================================================ MatrixXcf ones = MatrixXcf::Ones(3,3); ComplexEigenSolver ces(ones, /* computeEigenvectors = */ false); cout << "The eigenvalues of the 3x3 matrix of ones are:" << endl << ces.eigenvalues() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/ComplexEigenSolver_eigenvectors.cpp ================================================ MatrixXcf ones = MatrixXcf::Ones(3,3); ComplexEigenSolver ces(ones); cout << "The first eigenvector of the 3x3 matrix of ones is:" << endl << ces.eigenvectors().col(0) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/ComplexSchur_compute.cpp ================================================ MatrixXcf A = MatrixXcf::Random(4,4); ComplexSchur schur(4); schur.compute(A); cout << "The matrix T in the decomposition of A is:" << endl << schur.matrixT() << endl; schur.compute(A.inverse()); cout << "The matrix T in the decomposition of A^(-1) is:" << endl << schur.matrixT() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/ComplexSchur_matrixT.cpp ================================================ MatrixXcf A = MatrixXcf::Random(4,4); cout << "Here is a random 4x4 matrix, A:" << endl << A << endl << endl; ComplexSchur schurOfA(A, false); // false means do not compute U cout << "The triangular matrix T is:" << endl << schurOfA.matrixT() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/ComplexSchur_matrixU.cpp ================================================ MatrixXcf A = MatrixXcf::Random(4,4); cout << "Here is a random 4x4 matrix, A:" << endl << A << endl << endl; ComplexSchur schurOfA(A); cout << "The unitary matrix U is:" << endl << schurOfA.matrixU() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_abs.cpp ================================================ Array3d v(1,-2,-3); cout << v.abs() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_abs2.cpp ================================================ Array3d v(1,-2,-3); cout << v.abs2() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_acos.cpp ================================================ Array3d v(0, sqrt(2.)/2, 1); cout << v.acos() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_arg.cpp ================================================ ArrayXcf v = ArrayXcf::Random(3); cout << v << endl << endl; cout << arg(v) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_array_power_array.cpp ================================================ Array x(8,25,3), e(1./3.,0.5,2.); cout << "[" << x << "]^[" << e << "] = " << x.pow(e) << endl; // using ArrayBase::pow cout << "[" << x << "]^[" << e << "] = " << pow(x,e) << endl; // using Eigen::pow ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_asin.cpp ================================================ Array3d v(0, sqrt(2.)/2, 1); cout << v.asin() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_atan.cpp ================================================ ArrayXd v = ArrayXd::LinSpaced(5,0,1); cout << v.atan() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_boolean_and.cpp ================================================ Array3d v(-1,2,1), w(-3,2,3); cout << ((vw) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_greater_equal.cpp ================================================ Array3d v(1,2,3), w(3,2,1); cout << (v>=w) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_inverse.cpp ================================================ Array3d v(2,3,4); cout << v.inverse() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_isFinite.cpp ================================================ Array3d v(1,2,3); v(1) *= 0.0/0.0; v(2) /= 0.0; cout << v << endl << endl; cout << isfinite(v) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_isInf.cpp ================================================ Array3d v(1,2,3); v(1) *= 0.0/0.0; v(2) /= 0.0; cout << v << endl << endl; cout << isinf(v) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_isNaN.cpp ================================================ Array3d v(1,2,3); v(1) *= 0.0/0.0; v(2) /= 0.0; cout << v << endl << endl; cout << isnan(v) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_less.cpp ================================================ Array3d v(1,2,3), w(3,2,1); cout << (v e(2,-3,1./3.); cout << "10^[" << e << "] = " << pow(10,e) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_sign.cpp ================================================ Array3d v(-3,5,0); cout << v.sign() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_sin.cpp ================================================ Array3d v(M_PI, M_PI/2, M_PI/3); cout << v.sin() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_sinh.cpp ================================================ ArrayXd v = ArrayXd::LinSpaced(5,0,1); cout << sinh(v) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_slash_equal.cpp ================================================ Array3d v(3,2,4), w(5,4,2); v /= w; cout << v << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_sqrt.cpp ================================================ Array3d v(1,2,4); cout << v.sqrt() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_square.cpp ================================================ Array3d v(2,3,4); cout << v.square() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_tan.cpp ================================================ Array3d v(M_PI, M_PI/2, M_PI/3); cout << v.tan() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_tanh.cpp ================================================ ArrayXd v = ArrayXd::LinSpaced(5,0,1); cout << tanh(v) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Cwise_times_equal.cpp ================================================ Array3d v(1,2,3), w(2,3,0); v *= w; cout << v << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/DenseBase_LinSpaced.cpp ================================================ cout << VectorXi::LinSpaced(4,7,10).transpose() << endl; cout << VectorXd::LinSpaced(5,0.0,1.0).transpose() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/DenseBase_LinSpacedInt.cpp ================================================ cout << "Even spacing inputs:" << endl; cout << VectorXi::LinSpaced(8,1,4).transpose() << endl; cout << VectorXi::LinSpaced(8,1,8).transpose() << endl; cout << VectorXi::LinSpaced(8,1,15).transpose() << endl; cout << "Uneven spacing inputs:" << endl; cout << VectorXi::LinSpaced(8,1,7).transpose() << endl; cout << VectorXi::LinSpaced(8,1,9).transpose() << endl; cout << VectorXi::LinSpaced(8,1,16).transpose() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/DenseBase_LinSpaced_seq_deprecated.cpp ================================================ cout << VectorXi::LinSpaced(Sequential,4,7,10).transpose() << endl; cout << VectorXd::LinSpaced(Sequential,5,0.0,1.0).transpose() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/DenseBase_setLinSpaced.cpp ================================================ VectorXf v; v.setLinSpaced(5,0.5f,1.5f); cout << v << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/DirectionWise_hnormalized.cpp ================================================ Matrix4Xd M = Matrix4Xd::Random(4,5); Projective3d P(Matrix4d::Random()); cout << "The matrix M is:" << endl << M << endl << endl; cout << "M.colwise().hnormalized():" << endl << M.colwise().hnormalized() << endl << endl; cout << "P*M:" << endl << P*M << endl << endl; cout << "(P*M).colwise().hnormalized():" << endl << (P*M).colwise().hnormalized() << endl << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/DirectionWise_replicate.cpp ================================================ MatrixXi m = MatrixXi::Random(2,3); cout << "Here is the matrix m:" << endl << m << endl; cout << "m.colwise().replicate<3>() = ..." << endl; cout << m.colwise().replicate<3>() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/DirectionWise_replicate_int.cpp ================================================ Vector3i v = Vector3i::Random(); cout << "Here is the vector v:" << endl << v << endl; cout << "v.rowwise().replicate(5) = ..." << endl; cout << v.rowwise().replicate(5) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/EigenSolver_EigenSolver_MatrixType.cpp ================================================ MatrixXd A = MatrixXd::Random(6,6); cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl; EigenSolver es(A); cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl; cout << "The matrix of eigenvectors, V, is:" << endl << es.eigenvectors() << endl << endl; complex lambda = es.eigenvalues()[0]; cout << "Consider the first eigenvalue, lambda = " << lambda << endl; VectorXcd v = es.eigenvectors().col(0); cout << "If v is the corresponding eigenvector, then lambda * v = " << endl << lambda * v << endl; cout << "... and A * v = " << endl << A.cast >() * v << endl << endl; MatrixXcd D = es.eigenvalues().asDiagonal(); MatrixXcd V = es.eigenvectors(); cout << "Finally, V * D * V^(-1) = " << endl << V * D * V.inverse() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/EigenSolver_compute.cpp ================================================ EigenSolver es; MatrixXf A = MatrixXf::Random(4,4); es.compute(A, /* computeEigenvectors = */ false); cout << "The eigenvalues of A are: " << es.eigenvalues().transpose() << endl; es.compute(A + MatrixXf::Identity(4,4), false); // re-use es to compute eigenvalues of A+I cout << "The eigenvalues of A+I are: " << es.eigenvalues().transpose() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/EigenSolver_eigenvalues.cpp ================================================ MatrixXd ones = MatrixXd::Ones(3,3); EigenSolver es(ones, false); cout << "The eigenvalues of the 3x3 matrix of ones are:" << endl << es.eigenvalues() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/EigenSolver_eigenvectors.cpp ================================================ MatrixXd ones = MatrixXd::Ones(3,3); EigenSolver es(ones); cout << "The first eigenvector of the 3x3 matrix of ones is:" << endl << es.eigenvectors().col(0) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/EigenSolver_pseudoEigenvectors.cpp ================================================ MatrixXd A = MatrixXd::Random(6,6); cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl; EigenSolver es(A); MatrixXd D = es.pseudoEigenvalueMatrix(); MatrixXd V = es.pseudoEigenvectors(); cout << "The pseudo-eigenvalue matrix D is:" << endl << D << endl; cout << "The pseudo-eigenvector matrix V is:" << endl << V << endl; cout << "Finally, V * D * V^(-1) = " << endl << V * D * V.inverse() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/FullPivHouseholderQR_solve.cpp ================================================ Matrix3f m = Matrix3f::Random(); Matrix3f y = Matrix3f::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the matrix y:" << endl << y << endl; Matrix3f x; x = m.fullPivHouseholderQr().solve(y); assert(y.isApprox(m*x)); cout << "Here is a solution x to the equation mx=y:" << endl << x << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/FullPivLU_image.cpp ================================================ Matrix3d m; m << 1,1,0, 1,3,2, 0,1,1; cout << "Here is the matrix m:" << endl << m << endl; cout << "Notice that the middle column is the sum of the two others, so the " << "columns are linearly dependent." << endl; cout << "Here is a matrix whose columns have the same span but are linearly independent:" << endl << m.fullPivLu().image(m) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/FullPivLU_kernel.cpp ================================================ MatrixXf m = MatrixXf::Random(3,5); cout << "Here is the matrix m:" << endl << m << endl; MatrixXf ker = m.fullPivLu().kernel(); cout << "Here is a matrix whose columns form a basis of the kernel of m:" << endl << ker << endl; cout << "By definition of the kernel, m*ker is zero:" << endl << m*ker << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/FullPivLU_solve.cpp ================================================ Matrix m = Matrix::Random(); Matrix2f y = Matrix2f::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the matrix y:" << endl << y << endl; Matrix x = m.fullPivLu().solve(y); if((m*x).isApprox(y)) { cout << "Here is a solution x to the equation mx=y:" << endl << x << endl; } else cout << "The equation mx=y does not have any solution." << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/GeneralizedEigenSolver.cpp ================================================ GeneralizedEigenSolver ges; MatrixXf A = MatrixXf::Random(4,4); MatrixXf B = MatrixXf::Random(4,4); ges.compute(A, B); cout << "The (complex) numerators of the generalzied eigenvalues are: " << ges.alphas().transpose() << endl; cout << "The (real) denominatore of the generalzied eigenvalues are: " << ges.betas().transpose() << endl; cout << "The (complex) generalzied eigenvalues are (alphas./beta): " << ges.eigenvalues().transpose() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/HessenbergDecomposition_compute.cpp ================================================ MatrixXcf A = MatrixXcf::Random(4,4); HessenbergDecomposition hd(4); hd.compute(A); cout << "The matrix H in the decomposition of A is:" << endl << hd.matrixH() << endl; hd.compute(2*A); // re-use hd to compute and store decomposition of 2A cout << "The matrix H in the decomposition of 2A is:" << endl << hd.matrixH() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/HessenbergDecomposition_matrixH.cpp ================================================ Matrix4f A = MatrixXf::Random(4,4); cout << "Here is a random 4x4 matrix:" << endl << A << endl; HessenbergDecomposition hessOfA(A); MatrixXf H = hessOfA.matrixH(); cout << "The Hessenberg matrix H is:" << endl << H << endl; MatrixXf Q = hessOfA.matrixQ(); cout << "The orthogonal matrix Q is:" << endl << Q << endl; cout << "Q H Q^T is:" << endl << Q * H * Q.transpose() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/HessenbergDecomposition_packedMatrix.cpp ================================================ Matrix4d A = Matrix4d::Random(4,4); cout << "Here is a random 4x4 matrix:" << endl << A << endl; HessenbergDecomposition hessOfA(A); Matrix4d pm = hessOfA.packedMatrix(); cout << "The packed matrix M is:" << endl << pm << endl; cout << "The upper Hessenberg part corresponds to the matrix H, which is:" << endl << hessOfA.matrixH() << endl; Vector3d hc = hessOfA.householderCoefficients(); cout << "The vector of Householder coefficients is:" << endl << hc << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/HouseholderQR_householderQ.cpp ================================================ MatrixXf A(MatrixXf::Random(5,3)), thinQ(MatrixXf::Identity(5,3)), Q; A.setRandom(); HouseholderQR qr(A); Q = qr.householderQ(); thinQ = qr.householderQ() * thinQ; std::cout << "The complete unitary matrix Q is:\n" << Q << "\n\n"; std::cout << "The thin matrix Q is:\n" << thinQ << "\n\n"; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/HouseholderQR_solve.cpp ================================================ typedef Matrix Matrix3x3; Matrix3x3 m = Matrix3x3::Random(); Matrix3f y = Matrix3f::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the matrix y:" << endl << y << endl; Matrix3f x; x = m.householderQr().solve(y); assert(y.isApprox(m*x)); cout << "Here is a solution x to the equation mx=y:" << endl << x << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/HouseholderSequence_HouseholderSequence.cpp ================================================ Matrix3d v = Matrix3d::Random(); cout << "The matrix v is:" << endl; cout << v << endl; Vector3d v0(1, v(1,0), v(2,0)); cout << "The first Householder vector is: v_0 = " << v0.transpose() << endl; Vector3d v1(0, 1, v(2,1)); cout << "The second Householder vector is: v_1 = " << v1.transpose() << endl; Vector3d v2(0, 0, 1); cout << "The third Householder vector is: v_2 = " << v2.transpose() << endl; Vector3d h = Vector3d::Random(); cout << "The Householder coefficients are: h = " << h.transpose() << endl; Matrix3d H0 = Matrix3d::Identity() - h(0) * v0 * v0.adjoint(); cout << "The first Householder reflection is represented by H_0 = " << endl; cout << H0 << endl; Matrix3d H1 = Matrix3d::Identity() - h(1) * v1 * v1.adjoint(); cout << "The second Householder reflection is represented by H_1 = " << endl; cout << H1 << endl; Matrix3d H2 = Matrix3d::Identity() - h(2) * v2 * v2.adjoint(); cout << "The third Householder reflection is represented by H_2 = " << endl; cout << H2 << endl; cout << "Their product is H_0 H_1 H_2 = " << endl; cout << H0 * H1 * H2 << endl; HouseholderSequence hhSeq(v, h); Matrix3d hhSeqAsMatrix(hhSeq); cout << "If we construct a HouseholderSequence from v and h" << endl; cout << "and convert it to a matrix, we get:" << endl; cout << hhSeqAsMatrix << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/IOFormat.cpp ================================================ std::string sep = "\n----------------------------------------\n"; Matrix3d m1; m1 << 1.111111, 2, 3.33333, 4, 5, 6, 7, 8.888888, 9; IOFormat CommaInitFmt(StreamPrecision, DontAlignCols, ", ", ", ", "", "", " << ", ";"); IOFormat CleanFmt(4, 0, ", ", "\n", "[", "]"); IOFormat OctaveFmt(StreamPrecision, 0, ", ", ";\n", "", "", "[", "]"); IOFormat HeavyFmt(FullPrecision, 0, ", ", ";\n", "[", "]", "[", "]"); std::cout << m1 << sep; std::cout << m1.format(CommaInitFmt) << sep; std::cout << m1.format(CleanFmt) << sep; std::cout << m1.format(OctaveFmt) << sep; std::cout << m1.format(HeavyFmt) << sep; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/JacobiSVD_basic.cpp ================================================ MatrixXf m = MatrixXf::Random(3,2); cout << "Here is the matrix m:" << endl << m << endl; JacobiSVD svd(m, ComputeThinU | ComputeThinV); cout << "Its singular values are:" << endl << svd.singularValues() << endl; cout << "Its left singular vectors are the columns of the thin U matrix:" << endl << svd.matrixU() << endl; cout << "Its right singular vectors are the columns of the thin V matrix:" << endl << svd.matrixV() << endl; Vector3f rhs(1, 0, 0); cout << "Now consider this rhs vector:" << endl << rhs << endl; cout << "A least-squares solution of m*x = rhs is:" << endl << svd.solve(rhs) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Jacobi_makeGivens.cpp ================================================ Vector2f v = Vector2f::Random(); JacobiRotation G; G.makeGivens(v.x(), v.y()); cout << "Here is the vector v:" << endl << v << endl; v.applyOnTheLeft(0, 1, G.adjoint()); cout << "Here is the vector J' * v:" << endl << v << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Jacobi_makeJacobi.cpp ================================================ Matrix2f m = Matrix2f::Random(); m = (m + m.adjoint()).eval(); JacobiRotation J; J.makeJacobi(m, 0, 1); cout << "Here is the matrix m:" << endl << m << endl; m.applyOnTheLeft(0, 1, J.adjoint()); m.applyOnTheRight(0, 1, J); cout << "Here is the matrix J' * m * J:" << endl << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/LLT_example.cpp ================================================ MatrixXd A(3,3); A << 4,-1,2, -1,6,0, 2,0,5; cout << "The matrix A is" << endl << A << endl; LLT lltOfA(A); // compute the Cholesky decomposition of A MatrixXd L = lltOfA.matrixL(); // retrieve factor L in the decomposition // The previous two lines can also be written as "L = A.llt().matrixL()" cout << "The Cholesky factor L is" << endl << L << endl; cout << "To check this, let us compute L * L.transpose()" << endl; cout << L * L.transpose() << endl; cout << "This should equal the matrix A" << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/LLT_solve.cpp ================================================ typedef Matrix DataMatrix; // let's generate some samples on the 3D plane of equation z = 2x+3y (with some noise) DataMatrix samples = DataMatrix::Random(12,2); VectorXf elevations = 2*samples.col(0) + 3*samples.col(1) + VectorXf::Random(12)*0.1; // and let's solve samples * [x y]^T = elevations in least square sense: Matrix xy = (samples.adjoint() * samples).llt().solve((samples.adjoint()*elevations)); cout << xy << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/LeastSquaresNormalEquations.cpp ================================================ MatrixXf A = MatrixXf::Random(3, 2); VectorXf b = VectorXf::Random(3); cout << "The solution using normal equations is:\n" << (A.transpose() * A).ldlt().solve(A.transpose() * b) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/LeastSquaresQR.cpp ================================================ MatrixXf A = MatrixXf::Random(3, 2); VectorXf b = VectorXf::Random(3); cout << "The solution using the QR decomposition is:\n" << A.colPivHouseholderQr().solve(b) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Map_general_stride.cpp ================================================ int array[24]; for(int i = 0; i < 24; ++i) array[i] = i; cout << Map > (array, 3, 3, Stride(8, 2)) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Map_inner_stride.cpp ================================================ int array[12]; for(int i = 0; i < 12; ++i) array[i] = i; cout << Map > (array, 6) // the inner stride has already been passed as template parameter << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Map_outer_stride.cpp ================================================ int array[12]; for(int i = 0; i < 12; ++i) array[i] = i; cout << Map >(array, 3, 3, OuterStride<>(4)) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Map_placement_new.cpp ================================================ int data[] = {1,2,3,4,5,6,7,8,9}; Map v(data,4); cout << "The mapped vector v is: " << v << "\n"; new (&v) Map(data+4,5); cout << "Now v is: " << v << "\n"; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Map_simple.cpp ================================================ int array[9]; for(int i = 0; i < 9; ++i) array[i] = i; cout << Map(array) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_adjoint.cpp ================================================ Matrix2cf m = Matrix2cf::Random(); cout << "Here is the 2x2 complex matrix m:" << endl << m << endl; cout << "Here is the adjoint of m:" << endl << m.adjoint() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_all.cpp ================================================ Vector3f boxMin(Vector3f::Zero()), boxMax(Vector3f::Ones()); Vector3f p0 = Vector3f::Random(), p1 = Vector3f::Random().cwiseAbs(); // let's check if p0 and p1 are inside the axis aligned box defined by the corners boxMin,boxMax: cout << "Is (" << p0.transpose() << ") inside the box: " << ((boxMin.array()p0.array()).all()) << endl; cout << "Is (" << p1.transpose() << ") inside the box: " << ((boxMin.array()p1.array()).all()) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_applyOnTheLeft.cpp ================================================ Matrix3f A = Matrix3f::Random(3,3), B; B << 0,1,0, 0,0,1, 1,0,0; cout << "At start, A = " << endl << A << endl; A.applyOnTheLeft(B); cout << "After applyOnTheLeft, A = " << endl << A << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_applyOnTheRight.cpp ================================================ Matrix3f A = Matrix3f::Random(3,3), B; B << 0,1,0, 0,0,1, 1,0,0; cout << "At start, A = " << endl << A << endl; A *= B; cout << "After A *= B, A = " << endl << A << endl; A.applyOnTheRight(B); // equivalent to A *= B cout << "After applyOnTheRight, A = " << endl << A << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_array.cpp ================================================ Vector3d v(1,2,3); v.array() += 3; v.array() -= 2; cout << v << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_array_const.cpp ================================================ Vector3d v(-1,2,-3); cout << "the absolute values:" << endl << v.array().abs() << endl; cout << "the absolute values plus one:" << endl << v.array().abs()+1 << endl; cout << "sum of the squares: " << v.array().square().sum() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_asDiagonal.cpp ================================================ cout << Matrix3i(Vector3i(2,5,6).asDiagonal()) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_block_int_int.cpp ================================================ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.block<2,2>(1,1):" << endl << m.block<2,2>(1,1) << endl; m.block<2,2>(1,1).setZero(); cout << "Now the matrix m is:" << endl << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_block_int_int_int_int.cpp ================================================ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.block(1, 1, 2, 2):" << endl << m.block(1, 1, 2, 2) << endl; m.block(1, 1, 2, 2).setZero(); cout << "Now the matrix m is:" << endl << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_bottomLeftCorner_int_int.cpp ================================================ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.bottomLeftCorner(2, 2):" << endl; cout << m.bottomLeftCorner(2, 2) << endl; m.bottomLeftCorner(2, 2).setZero(); cout << "Now the matrix m is:" << endl << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_bottomRightCorner_int_int.cpp ================================================ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.bottomRightCorner(2, 2):" << endl; cout << m.bottomRightCorner(2, 2) << endl; m.bottomRightCorner(2, 2).setZero(); cout << "Now the matrix m is:" << endl << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_bottomRows_int.cpp ================================================ Array44i a = Array44i::Random(); cout << "Here is the array a:" << endl << a << endl; cout << "Here is a.bottomRows(2):" << endl; cout << a.bottomRows(2) << endl; a.bottomRows(2).setZero(); cout << "Now the array a is:" << endl << a << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_cast.cpp ================================================ Matrix2d md = Matrix2d::Identity() * 0.45; Matrix2f mf = Matrix2f::Identity(); cout << md + mf.cast() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_col.cpp ================================================ Matrix3d m = Matrix3d::Identity(); m.col(1) = Vector3d(4,5,6); cout << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_colwise.cpp ================================================ Matrix3d m = Matrix3d::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the sum of each column:" << endl << m.colwise().sum() << endl; cout << "Here is the maximum absolute value of each column:" << endl << m.cwiseAbs().colwise().maxCoeff() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_colwise_iterator_cxx11.cpp ================================================ Matrix3i m = Matrix3i::Random(); cout << "Here is the initial matrix m:" << endl << m << endl; int i = -1; for(auto c: m.colwise()) { c *= i; ++i; } cout << "Here is the matrix m after the for-range-loop:" << endl << m << endl; auto cols = m.colwise(); auto it = std::find_if(cols.cbegin(), cols.cend(), [](Matrix3i::ConstColXpr x) { return x.squaredNorm() == 0; }); cout << "The first empty column is: " << distance(cols.cbegin(),it) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_computeInverseAndDetWithCheck.cpp ================================================ Matrix3d m = Matrix3d::Random(); cout << "Here is the matrix m:" << endl << m << endl; Matrix3d inverse; bool invertible; double determinant; m.computeInverseAndDetWithCheck(inverse,determinant,invertible); cout << "Its determinant is " << determinant << endl; if(invertible) { cout << "It is invertible, and its inverse is:" << endl << inverse << endl; } else { cout << "It is not invertible." << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_computeInverseWithCheck.cpp ================================================ Matrix3d m = Matrix3d::Random(); cout << "Here is the matrix m:" << endl << m << endl; Matrix3d inverse; bool invertible; m.computeInverseWithCheck(inverse,invertible); if(invertible) { cout << "It is invertible, and its inverse is:" << endl << inverse << endl; } else { cout << "It is not invertible." << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_cwiseAbs.cpp ================================================ MatrixXd m(2,3); m << 2, -4, 6, -5, 1, 0; cout << m.cwiseAbs() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_cwiseAbs2.cpp ================================================ MatrixXd m(2,3); m << 2, -4, 6, -5, 1, 0; cout << m.cwiseAbs2() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_cwiseArg.cpp ================================================ MatrixXcf v = MatrixXcf::Random(2, 3); cout << v << endl << endl; cout << v.cwiseArg() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_cwiseEqual.cpp ================================================ MatrixXi m(2,2); m << 1, 0, 1, 1; cout << "Comparing m with identity matrix:" << endl; cout << m.cwiseEqual(MatrixXi::Identity(2,2)) << endl; Index count = m.cwiseEqual(MatrixXi::Identity(2,2)).count(); cout << "Number of coefficients that are equal: " << count << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_cwiseInverse.cpp ================================================ MatrixXd m(2,3); m << 2, 0.5, 1, 3, 0.25, 1; cout << m.cwiseInverse() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_cwiseMax.cpp ================================================ Vector3d v(2,3,4), w(4,2,3); cout << v.cwiseMax(w) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_cwiseMin.cpp ================================================ Vector3d v(2,3,4), w(4,2,3); cout << v.cwiseMin(w) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_cwiseNotEqual.cpp ================================================ MatrixXi m(2,2); m << 1, 0, 1, 1; cout << "Comparing m with identity matrix:" << endl; cout << m.cwiseNotEqual(MatrixXi::Identity(2,2)) << endl; Index count = m.cwiseNotEqual(MatrixXi::Identity(2,2)).count(); cout << "Number of coefficients that are not equal: " << count << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_cwiseProduct.cpp ================================================ Matrix3i a = Matrix3i::Random(), b = Matrix3i::Random(); Matrix3i c = a.cwiseProduct(b); cout << "a:\n" << a << "\nb:\n" << b << "\nc:\n" << c << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_cwiseQuotient.cpp ================================================ Vector3d v(2,3,4), w(4,2,3); cout << v.cwiseQuotient(w) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_cwiseSign.cpp ================================================ MatrixXd m(2,3); m << 2, -4, 6, -5, 1, 0; cout << m.cwiseSign() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_cwiseSqrt.cpp ================================================ Vector3d v(1,2,4); cout << v.cwiseSqrt() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_diagonal.cpp ================================================ Matrix3i m = Matrix3i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here are the coefficients on the main diagonal of m:" << endl << m.diagonal() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_diagonal_int.cpp ================================================ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here are the coefficients on the 1st super-diagonal and 2nd sub-diagonal of m:" << endl << m.diagonal(1).transpose() << endl << m.diagonal(-2).transpose() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_diagonal_template_int.cpp ================================================ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here are the coefficients on the 1st super-diagonal and 2nd sub-diagonal of m:" << endl << m.diagonal<1>().transpose() << endl << m.diagonal<-2>().transpose() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_eigenvalues.cpp ================================================ MatrixXd ones = MatrixXd::Ones(3,3); VectorXcd eivals = ones.eigenvalues(); cout << "The eigenvalues of the 3x3 matrix of ones are:" << endl << eivals << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_end_int.cpp ================================================ RowVector4i v = RowVector4i::Random(); cout << "Here is the vector v:" << endl << v << endl; cout << "Here is v.tail(2):" << endl << v.tail(2) << endl; v.tail(2).setZero(); cout << "Now the vector v is:" << endl << v << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_eval.cpp ================================================ Matrix2f M = Matrix2f::Random(); Matrix2f m; m = M; cout << "Here is the matrix m:" << endl << m << endl; cout << "Now we want to copy a column into a row." << endl; cout << "If we do m.col(1) = m.row(0), then m becomes:" << endl; m.col(1) = m.row(0); cout << m << endl << "which is wrong!" << endl; cout << "Now let us instead do m.col(1) = m.row(0).eval(). Then m becomes" << endl; m = M; m.col(1) = m.row(0).eval(); cout << m << endl << "which is right." << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_fixedBlock_int_int.cpp ================================================ Matrix4d m = Vector4d(1,2,3,4).asDiagonal(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.fixed<2, 2>(2, 2):" << endl << m.block<2, 2>(2, 2) << endl; m.block<2, 2>(2, 0) = m.block<2, 2>(2, 2); cout << "Now the matrix m is:" << endl << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_hnormalized.cpp ================================================ Vector4d v = Vector4d::Random(); Projective3d P(Matrix4d::Random()); cout << "v = " << v.transpose() << "]^T" << endl; cout << "v.hnormalized() = " << v.hnormalized().transpose() << "]^T" << endl; cout << "P*v = " << (P*v).transpose() << "]^T" << endl; cout << "(P*v).hnormalized() = " << (P*v).hnormalized().transpose() << "]^T" << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_homogeneous.cpp ================================================ Vector3d v = Vector3d::Random(), w; Projective3d P(Matrix4d::Random()); cout << "v = [" << v.transpose() << "]^T" << endl; cout << "h.homogeneous() = [" << v.homogeneous().transpose() << "]^T" << endl; cout << "(P * v.homogeneous()) = [" << (P * v.homogeneous()).transpose() << "]^T" << endl; cout << "(P * v.homogeneous()).hnormalized() = [" << (P * v.homogeneous()).eval().hnormalized().transpose() << "]^T" << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_identity.cpp ================================================ cout << Matrix::Identity() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_identity_int_int.cpp ================================================ cout << MatrixXd::Identity(4, 3) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_inverse.cpp ================================================ Matrix3d m = Matrix3d::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Its inverse is:" << endl << m.inverse() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_isDiagonal.cpp ================================================ Matrix3d m = 10000 * Matrix3d::Identity(); m(0,2) = 1; cout << "Here's the matrix m:" << endl << m << endl; cout << "m.isDiagonal() returns: " << m.isDiagonal() << endl; cout << "m.isDiagonal(1e-3) returns: " << m.isDiagonal(1e-3) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_isIdentity.cpp ================================================ Matrix3d m = Matrix3d::Identity(); m(0,2) = 1e-4; cout << "Here's the matrix m:" << endl << m << endl; cout << "m.isIdentity() returns: " << m.isIdentity() << endl; cout << "m.isIdentity(1e-3) returns: " << m.isIdentity(1e-3) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_isOnes.cpp ================================================ Matrix3d m = Matrix3d::Ones(); m(0,2) += 1e-4; cout << "Here's the matrix m:" << endl << m << endl; cout << "m.isOnes() returns: " << m.isOnes() << endl; cout << "m.isOnes(1e-3) returns: " << m.isOnes(1e-3) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_isOrthogonal.cpp ================================================ Vector3d v(1,0,0); Vector3d w(1e-4,0,1); cout << "Here's the vector v:" << endl << v << endl; cout << "Here's the vector w:" << endl << w << endl; cout << "v.isOrthogonal(w) returns: " << v.isOrthogonal(w) << endl; cout << "v.isOrthogonal(w,1e-3) returns: " << v.isOrthogonal(w,1e-3) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_isUnitary.cpp ================================================ Matrix3d m = Matrix3d::Identity(); m(0,2) = 1e-4; cout << "Here's the matrix m:" << endl << m << endl; cout << "m.isUnitary() returns: " << m.isUnitary() << endl; cout << "m.isUnitary(1e-3) returns: " << m.isUnitary(1e-3) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_isZero.cpp ================================================ Matrix3d m = Matrix3d::Zero(); m(0,2) = 1e-4; cout << "Here's the matrix m:" << endl << m << endl; cout << "m.isZero() returns: " << m.isZero() << endl; cout << "m.isZero(1e-3) returns: " << m.isZero(1e-3) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_leftCols_int.cpp ================================================ Array44i a = Array44i::Random(); cout << "Here is the array a:" << endl << a << endl; cout << "Here is a.leftCols(2):" << endl; cout << a.leftCols(2) << endl; a.leftCols(2).setZero(); cout << "Now the array a is:" << endl << a << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_noalias.cpp ================================================ Matrix2d a, b, c; a << 1,2,3,4; b << 5,6,7,8; c.noalias() = a * b; // this computes the product directly to c cout << c << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_ones.cpp ================================================ cout << Matrix2d::Ones() << endl; cout << 6 * RowVector4i::Ones() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_ones_int.cpp ================================================ cout << 6 * RowVectorXi::Ones(4) << endl; cout << VectorXf::Ones(2) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_ones_int_int.cpp ================================================ cout << MatrixXi::Ones(2,3) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_operatorNorm.cpp ================================================ MatrixXd ones = MatrixXd::Ones(3,3); cout << "The operator norm of the 3x3 matrix of ones is " << ones.operatorNorm() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_prod.cpp ================================================ Matrix3d m = Matrix3d::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the product of all the coefficients:" << endl << m.prod() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_random.cpp ================================================ cout << 100 * Matrix2i::Random() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_random_int.cpp ================================================ cout << VectorXi::Random(2) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_random_int_int.cpp ================================================ cout << MatrixXi::Random(2,3) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_replicate.cpp ================================================ MatrixXi m = MatrixXi::Random(2,3); cout << "Here is the matrix m:" << endl << m << endl; cout << "m.replicate<3,2>() = ..." << endl; cout << m.replicate<3,2>() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_replicate_int_int.cpp ================================================ Vector3i v = Vector3i::Random(); cout << "Here is the vector v:" << endl << v << endl; cout << "v.replicate(2,5) = ..." << endl; cout << v.replicate(2,5) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_reshaped_auto.cpp ================================================ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.reshaped(2, AutoSize):" << endl << m.reshaped(2, AutoSize) << endl; cout << "Here is m.reshaped(AutoSize, fix<8>):" << endl << m.reshaped(AutoSize, fix<8>) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_reshaped_fixed.cpp ================================================ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.reshaped(fix<2>,fix<8>):" << endl << m.reshaped(fix<2>,fix<8>) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_reshaped_int_int.cpp ================================================ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.reshaped(2, 8):" << endl << m.reshaped(2, 8) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_reshaped_to_vector.cpp ================================================ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.reshaped().transpose():" << endl << m.reshaped().transpose() << endl; cout << "Here is m.reshaped().transpose(): " << endl << m.reshaped().transpose() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_reverse.cpp ================================================ MatrixXi m = MatrixXi::Random(3,4); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the reverse of m:" << endl << m.reverse() << endl; cout << "Here is the coefficient (1,0) in the reverse of m:" << endl << m.reverse()(1,0) << endl; cout << "Let us overwrite this coefficient with the value 4." << endl; m.reverse()(1,0) = 4; cout << "Now the matrix m is:" << endl << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_rightCols_int.cpp ================================================ Array44i a = Array44i::Random(); cout << "Here is the array a:" << endl << a << endl; cout << "Here is a.rightCols(2):" << endl; cout << a.rightCols(2) << endl; a.rightCols(2).setZero(); cout << "Now the array a is:" << endl << a << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_row.cpp ================================================ Matrix3d m = Matrix3d::Identity(); m.row(1) = Vector3d(4,5,6); cout << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_rowwise.cpp ================================================ Matrix3d m = Matrix3d::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the sum of each row:" << endl << m.rowwise().sum() << endl; cout << "Here is the maximum absolute value of each row:" << endl << m.cwiseAbs().rowwise().maxCoeff() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_segment_int_int.cpp ================================================ RowVector4i v = RowVector4i::Random(); cout << "Here is the vector v:" << endl << v << endl; cout << "Here is v.segment(1, 2):" << endl << v.segment(1, 2) << endl; v.segment(1, 2).setZero(); cout << "Now the vector v is:" << endl << v << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_select.cpp ================================================ MatrixXi m(3, 3); m << 1, 2, 3, 4, 5, 6, 7, 8, 9; m = (m.array() >= 5).select(-m, m); cout << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_selfadjointView.cpp ================================================ Matrix3i m = Matrix3i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the symmetric matrix extracted from the upper part of m:" << endl << Matrix3i(m.selfadjointView()) << endl; cout << "Here is the symmetric matrix extracted from the lower part of m:" << endl << Matrix3i(m.selfadjointView()) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_set.cpp ================================================ Matrix3i m1; m1 << 1, 2, 3, 4, 5, 6, 7, 8, 9; cout << m1 << endl << endl; Matrix3i m2 = Matrix3i::Identity(); m2.block(0,0, 2,2) << 10, 11, 12, 13; cout << m2 << endl << endl; Vector2i v1; v1 << 14, 15; m2 << v1.transpose(), 16, v1, m1.block(1,1,2,2); cout << m2 << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_setIdentity.cpp ================================================ Matrix4i m = Matrix4i::Zero(); m.block<3,3>(1,0).setIdentity(); cout << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_setOnes.cpp ================================================ Matrix4i m = Matrix4i::Random(); m.row(1).setOnes(); cout << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_setRandom.cpp ================================================ Matrix4i m = Matrix4i::Zero(); m.col(1).setRandom(); cout << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_setZero.cpp ================================================ Matrix4i m = Matrix4i::Random(); m.row(1).setZero(); cout << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_start_int.cpp ================================================ RowVector4i v = RowVector4i::Random(); cout << "Here is the vector v:" << endl << v << endl; cout << "Here is v.head(2):" << endl << v.head(2) << endl; v.head(2).setZero(); cout << "Now the vector v is:" << endl << v << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_template_int_bottomRows.cpp ================================================ Array44i a = Array44i::Random(); cout << "Here is the array a:" << endl << a << endl; cout << "Here is a.bottomRows<2>():" << endl; cout << a.bottomRows<2>() << endl; a.bottomRows<2>().setZero(); cout << "Now the array a is:" << endl << a << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_template_int_end.cpp ================================================ RowVector4i v = RowVector4i::Random(); cout << "Here is the vector v:" << endl << v << endl; cout << "Here is v.tail(2):" << endl << v.tail<2>() << endl; v.tail<2>().setZero(); cout << "Now the vector v is:" << endl << v << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_template_int_int_block_int_int_int_int.cpp ================================================ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the block:" << endl << m.block<2, Dynamic>(1, 1, 2, 3) << endl; m.block<2, Dynamic>(1, 1, 2, 3).setZero(); cout << "Now the matrix m is:" << endl << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_template_int_int_bottomLeftCorner.cpp ================================================ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.bottomLeftCorner<2,2>():" << endl; cout << m.bottomLeftCorner<2,2>() << endl; m.bottomLeftCorner<2,2>().setZero(); cout << "Now the matrix m is:" << endl << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_template_int_int_bottomLeftCorner_int_int.cpp ================================================ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.bottomLeftCorner<2,Dynamic>(2,2):" << endl; cout << m.bottomLeftCorner<2,Dynamic>(2,2) << endl; m.bottomLeftCorner<2,Dynamic>(2,2).setZero(); cout << "Now the matrix m is:" << endl << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_template_int_int_bottomRightCorner.cpp ================================================ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.bottomRightCorner<2,2>():" << endl; cout << m.bottomRightCorner<2,2>() << endl; m.bottomRightCorner<2,2>().setZero(); cout << "Now the matrix m is:" << endl << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_template_int_int_bottomRightCorner_int_int.cpp ================================================ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.bottomRightCorner<2,Dynamic>(2,2):" << endl; cout << m.bottomRightCorner<2,Dynamic>(2,2) << endl; m.bottomRightCorner<2,Dynamic>(2,2).setZero(); cout << "Now the matrix m is:" << endl << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_template_int_int_topLeftCorner.cpp ================================================ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.topLeftCorner<2,2>():" << endl; cout << m.topLeftCorner<2,2>() << endl; m.topLeftCorner<2,2>().setZero(); cout << "Now the matrix m is:" << endl << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_template_int_int_topLeftCorner_int_int.cpp ================================================ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.topLeftCorner<2,Dynamic>(2,2):" << endl; cout << m.topLeftCorner<2,Dynamic>(2,2) << endl; m.topLeftCorner<2,Dynamic>(2,2).setZero(); cout << "Now the matrix m is:" << endl << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_template_int_int_topRightCorner.cpp ================================================ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.topRightCorner<2,2>():" << endl; cout << m.topRightCorner<2,2>() << endl; m.topRightCorner<2,2>().setZero(); cout << "Now the matrix m is:" << endl << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_template_int_int_topRightCorner_int_int.cpp ================================================ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.topRightCorner<2,Dynamic>(2,2):" << endl; cout << m.topRightCorner<2,Dynamic>(2,2) << endl; m.topRightCorner<2,Dynamic>(2,2).setZero(); cout << "Now the matrix m is:" << endl << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_template_int_leftCols.cpp ================================================ Array44i a = Array44i::Random(); cout << "Here is the array a:" << endl << a << endl; cout << "Here is a.leftCols<2>():" << endl; cout << a.leftCols<2>() << endl; a.leftCols<2>().setZero(); cout << "Now the array a is:" << endl << a << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_template_int_rightCols.cpp ================================================ Array44i a = Array44i::Random(); cout << "Here is the array a:" << endl << a << endl; cout << "Here is a.rightCols<2>():" << endl; cout << a.rightCols<2>() << endl; a.rightCols<2>().setZero(); cout << "Now the array a is:" << endl << a << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_template_int_segment.cpp ================================================ RowVector4i v = RowVector4i::Random(); cout << "Here is the vector v:" << endl << v << endl; cout << "Here is v.segment<2>(1):" << endl << v.segment<2>(1) << endl; v.segment<2>(2).setZero(); cout << "Now the vector v is:" << endl << v << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_template_int_start.cpp ================================================ RowVector4i v = RowVector4i::Random(); cout << "Here is the vector v:" << endl << v << endl; cout << "Here is v.head(2):" << endl << v.head<2>() << endl; v.head<2>().setZero(); cout << "Now the vector v is:" << endl << v << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_template_int_topRows.cpp ================================================ Array44i a = Array44i::Random(); cout << "Here is the array a:" << endl << a << endl; cout << "Here is a.topRows<2>():" << endl; cout << a.topRows<2>() << endl; a.topRows<2>().setZero(); cout << "Now the array a is:" << endl << a << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_topLeftCorner_int_int.cpp ================================================ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.topLeftCorner(2, 2):" << endl; cout << m.topLeftCorner(2, 2) << endl; m.topLeftCorner(2, 2).setZero(); cout << "Now the matrix m is:" << endl << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_topRightCorner_int_int.cpp ================================================ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.topRightCorner(2, 2):" << endl; cout << m.topRightCorner(2, 2) << endl; m.topRightCorner(2, 2).setZero(); cout << "Now the matrix m is:" << endl << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_topRows_int.cpp ================================================ Array44i a = Array44i::Random(); cout << "Here is the array a:" << endl << a << endl; cout << "Here is a.topRows(2):" << endl; cout << a.topRows(2) << endl; a.topRows(2).setZero(); cout << "Now the array a is:" << endl << a << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_transpose.cpp ================================================ Matrix2i m = Matrix2i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the transpose of m:" << endl << m.transpose() << endl; cout << "Here is the coefficient (1,0) in the transpose of m:" << endl << m.transpose()(1,0) << endl; cout << "Let us overwrite this coefficient with the value 0." << endl; m.transpose()(1,0) = 0; cout << "Now the matrix m is:" << endl << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_triangularView.cpp ================================================ Matrix3i m = Matrix3i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the upper-triangular matrix extracted from m:" << endl << Matrix3i(m.triangularView()) << endl; cout << "Here is the strictly-upper-triangular matrix extracted from m:" << endl << Matrix3i(m.triangularView()) << endl; cout << "Here is the unit-lower-triangular matrix extracted from m:" << endl << Matrix3i(m.triangularView()) << endl; // FIXME need to implement output for triangularViews (Bug 885) ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_zero.cpp ================================================ cout << Matrix2d::Zero() << endl; cout << RowVector4i::Zero() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_zero_int.cpp ================================================ cout << RowVectorXi::Zero(4) << endl; cout << VectorXf::Zero(2) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/MatrixBase_zero_int_int.cpp ================================================ cout << MatrixXi::Zero(2,3) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Matrix_Map_stride.cpp ================================================ Matrix4i A; A << 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16; std::cout << Matrix2i::Map(&A(1,1),Stride<8,2>()) << std::endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Matrix_initializer_list_23_cxx11.cpp ================================================ MatrixXd m { {1, 2, 3}, {4, 5, 6} }; cout << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Matrix_initializer_list_vector_cxx11.cpp ================================================ VectorXi v {{1, 2}}; cout << v << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Matrix_resize_NoChange_int.cpp ================================================ MatrixXd m(3,4); m.resize(NoChange, 5); cout << "m: " << m.rows() << " rows, " << m.cols() << " cols" << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Matrix_resize_int.cpp ================================================ VectorXd v(10); v.resize(3); RowVector3d w; w.resize(3); // this is legal, but has no effect cout << "v: " << v.rows() << " rows, " << v.cols() << " cols" << endl; cout << "w: " << w.rows() << " rows, " << w.cols() << " cols" << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Matrix_resize_int_NoChange.cpp ================================================ MatrixXd m(3,4); m.resize(5, NoChange); cout << "m: " << m.rows() << " rows, " << m.cols() << " cols" << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Matrix_resize_int_int.cpp ================================================ MatrixXd m(2,3); m << 1,2,3,4,5,6; cout << "here's the 2x3 matrix m:" << endl << m << endl; cout << "let's resize m to 3x2. This is a conservative resizing because 2*3==3*2." << endl; m.resize(3,2); cout << "here's the 3x2 matrix m:" << endl << m << endl; cout << "now let's resize m to size 2x2. This is NOT a conservative resizing, so it becomes uninitialized:" << endl; m.resize(2,2); cout << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Matrix_setConstant_int.cpp ================================================ VectorXf v; v.setConstant(3, 5); cout << v << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Matrix_setConstant_int_int.cpp ================================================ MatrixXf m; m.setConstant(3, 3, 5); cout << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Matrix_setIdentity_int_int.cpp ================================================ MatrixXf m; m.setIdentity(3, 3); cout << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Matrix_setOnes_int.cpp ================================================ VectorXf v; v.setOnes(3); cout << v << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Matrix_setOnes_int_int.cpp ================================================ MatrixXf m; m.setOnes(3, 3); cout << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Matrix_setRandom_int.cpp ================================================ VectorXf v; v.setRandom(3); cout << v << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Matrix_setRandom_int_int.cpp ================================================ MatrixXf m; m.setRandom(3, 3); cout << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Matrix_setZero_int.cpp ================================================ VectorXf v; v.setZero(3); cout << v << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Matrix_setZero_int_int.cpp ================================================ MatrixXf m; m.setZero(3, 3); cout << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Matrix_variadic_ctor_cxx11.cpp ================================================ Matrix a(1, 2, 3, 4, 5, 6); Matrix b {1, 2, 3}; cout << a << "\n\n" << b << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/PartialPivLU_solve.cpp ================================================ MatrixXd A = MatrixXd::Random(3,3); MatrixXd B = MatrixXd::Random(3,2); cout << "Here is the invertible matrix A:" << endl << A << endl; cout << "Here is the matrix B:" << endl << B << endl; MatrixXd X = A.lu().solve(B); cout << "Here is the (unique) solution X to the equation AX=B:" << endl << X << endl; cout << "Relative error: " << (A*X-B).norm() / B.norm() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/PartialRedux_count.cpp ================================================ Matrix3d m = Matrix3d::Random(); cout << "Here is the matrix m:" << endl << m << endl; Matrix res = (m.array() >= 0.5).rowwise().count(); cout << "Here is the count of elements larger or equal than 0.5 of each row:" << endl; cout << res << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/PartialRedux_maxCoeff.cpp ================================================ Matrix3d m = Matrix3d::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the maximum of each column:" << endl << m.colwise().maxCoeff() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/PartialRedux_minCoeff.cpp ================================================ Matrix3d m = Matrix3d::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the minimum of each column:" << endl << m.colwise().minCoeff() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/PartialRedux_norm.cpp ================================================ Matrix3d m = Matrix3d::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the norm of each column:" << endl << m.colwise().norm() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/PartialRedux_prod.cpp ================================================ Matrix3d m = Matrix3d::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the product of each row:" << endl << m.rowwise().prod() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/PartialRedux_squaredNorm.cpp ================================================ Matrix3d m = Matrix3d::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the square norm of each row:" << endl << m.rowwise().squaredNorm() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/PartialRedux_sum.cpp ================================================ Matrix3d m = Matrix3d::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the sum of each row:" << endl << m.rowwise().sum() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/RealQZ_compute.cpp ================================================ MatrixXf A = MatrixXf::Random(4,4); MatrixXf B = MatrixXf::Random(4,4); RealQZ qz(4); // preallocate space for 4x4 matrices qz.compute(A,B); // A = Q S Z, B = Q T Z // print original matrices and result of decomposition cout << "A:\n" << A << "\n" << "B:\n" << B << "\n"; cout << "S:\n" << qz.matrixS() << "\n" << "T:\n" << qz.matrixT() << "\n"; cout << "Q:\n" << qz.matrixQ() << "\n" << "Z:\n" << qz.matrixZ() << "\n"; // verify precision cout << "\nErrors:" << "\n|A-QSZ|: " << (A-qz.matrixQ()*qz.matrixS()*qz.matrixZ()).norm() << ", |B-QTZ|: " << (B-qz.matrixQ()*qz.matrixT()*qz.matrixZ()).norm() << "\n|QQ* - I|: " << (qz.matrixQ()*qz.matrixQ().adjoint() - MatrixXf::Identity(4,4)).norm() << ", |ZZ* - I|: " << (qz.matrixZ()*qz.matrixZ().adjoint() - MatrixXf::Identity(4,4)).norm() << "\n"; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/RealSchur_RealSchur_MatrixType.cpp ================================================ MatrixXd A = MatrixXd::Random(6,6); cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl; RealSchur schur(A); cout << "The orthogonal matrix U is:" << endl << schur.matrixU() << endl; cout << "The quasi-triangular matrix T is:" << endl << schur.matrixT() << endl << endl; MatrixXd U = schur.matrixU(); MatrixXd T = schur.matrixT(); cout << "U * T * U^T = " << endl << U * T * U.transpose() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/RealSchur_compute.cpp ================================================ MatrixXf A = MatrixXf::Random(4,4); RealSchur schur(4); schur.compute(A, /* computeU = */ false); cout << "The matrix T in the decomposition of A is:" << endl << schur.matrixT() << endl; schur.compute(A.inverse(), /* computeU = */ false); cout << "The matrix T in the decomposition of A^(-1) is:" << endl << schur.matrixT() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver.cpp ================================================ SelfAdjointEigenSolver es; Matrix4f X = Matrix4f::Random(4,4); Matrix4f A = X + X.transpose(); es.compute(A); cout << "The eigenvalues of A are: " << es.eigenvalues().transpose() << endl; es.compute(A + Matrix4f::Identity(4,4)); // re-use es to compute eigenvalues of A+I cout << "The eigenvalues of A+I are: " << es.eigenvalues().transpose() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp ================================================ MatrixXd X = MatrixXd::Random(5,5); MatrixXd A = X + X.transpose(); cout << "Here is a random symmetric 5x5 matrix, A:" << endl << A << endl << endl; SelfAdjointEigenSolver es(A); cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl; cout << "The matrix of eigenvectors, V, is:" << endl << es.eigenvectors() << endl << endl; double lambda = es.eigenvalues()[0]; cout << "Consider the first eigenvalue, lambda = " << lambda << endl; VectorXd v = es.eigenvectors().col(0); cout << "If v is the corresponding eigenvector, then lambda * v = " << endl << lambda * v << endl; cout << "... and A * v = " << endl << A * v << endl << endl; MatrixXd D = es.eigenvalues().asDiagonal(); MatrixXd V = es.eigenvectors(); cout << "Finally, V * D * V^(-1) = " << endl << V * D * V.inverse() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType2.cpp ================================================ MatrixXd X = MatrixXd::Random(5,5); MatrixXd A = X + X.transpose(); cout << "Here is a random symmetric matrix, A:" << endl << A << endl; X = MatrixXd::Random(5,5); MatrixXd B = X * X.transpose(); cout << "and a random postive-definite matrix, B:" << endl << B << endl << endl; GeneralizedSelfAdjointEigenSolver es(A,B); cout << "The eigenvalues of the pencil (A,B) are:" << endl << es.eigenvalues() << endl; cout << "The matrix of eigenvectors, V, is:" << endl << es.eigenvectors() << endl << endl; double lambda = es.eigenvalues()[0]; cout << "Consider the first eigenvalue, lambda = " << lambda << endl; VectorXd v = es.eigenvectors().col(0); cout << "If v is the corresponding eigenvector, then A * v = " << endl << A * v << endl; cout << "... and lambda * B * v = " << endl << lambda * B * v << endl << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/SelfAdjointEigenSolver_compute_MatrixType.cpp ================================================ SelfAdjointEigenSolver es(4); MatrixXf X = MatrixXf::Random(4,4); MatrixXf A = X + X.transpose(); es.compute(A); cout << "The eigenvalues of A are: " << es.eigenvalues().transpose() << endl; es.compute(A + MatrixXf::Identity(4,4)); // re-use es to compute eigenvalues of A+I cout << "The eigenvalues of A+I are: " << es.eigenvalues().transpose() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/SelfAdjointEigenSolver_compute_MatrixType2.cpp ================================================ MatrixXd X = MatrixXd::Random(5,5); MatrixXd A = X * X.transpose(); X = MatrixXd::Random(5,5); MatrixXd B = X * X.transpose(); GeneralizedSelfAdjointEigenSolver es(A,B,EigenvaluesOnly); cout << "The eigenvalues of the pencil (A,B) are:" << endl << es.eigenvalues() << endl; es.compute(B,A,false); cout << "The eigenvalues of the pencil (B,A) are:" << endl << es.eigenvalues() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/SelfAdjointEigenSolver_eigenvalues.cpp ================================================ MatrixXd ones = MatrixXd::Ones(3,3); SelfAdjointEigenSolver es(ones); cout << "The eigenvalues of the 3x3 matrix of ones are:" << endl << es.eigenvalues() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/SelfAdjointEigenSolver_eigenvectors.cpp ================================================ MatrixXd ones = MatrixXd::Ones(3,3); SelfAdjointEigenSolver es(ones); cout << "The first eigenvector of the 3x3 matrix of ones is:" << endl << es.eigenvectors().col(0) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp ================================================ MatrixXd X = MatrixXd::Random(4,4); MatrixXd A = X * X.transpose(); cout << "Here is a random positive-definite matrix, A:" << endl << A << endl << endl; SelfAdjointEigenSolver es(A); cout << "The inverse square root of A is: " << endl; cout << es.operatorInverseSqrt() << endl; cout << "We can also compute it with operatorSqrt() and inverse(). That yields: " << endl; cout << es.operatorSqrt().inverse() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/SelfAdjointEigenSolver_operatorSqrt.cpp ================================================ MatrixXd X = MatrixXd::Random(4,4); MatrixXd A = X * X.transpose(); cout << "Here is a random positive-definite matrix, A:" << endl << A << endl << endl; SelfAdjointEigenSolver es(A); MatrixXd sqrtA = es.operatorSqrt(); cout << "The square root of A is: " << endl << sqrtA << endl; cout << "If we square this, we get: " << endl << sqrtA*sqrtA << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/SelfAdjointView_eigenvalues.cpp ================================================ MatrixXd ones = MatrixXd::Ones(3,3); VectorXd eivals = ones.selfadjointView().eigenvalues(); cout << "The eigenvalues of the 3x3 matrix of ones are:" << endl << eivals << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/SelfAdjointView_operatorNorm.cpp ================================================ MatrixXd ones = MatrixXd::Ones(3,3); cout << "The operator norm of the 3x3 matrix of ones is " << ones.selfadjointView().operatorNorm() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Slicing_arrayexpr.cpp ================================================ ArrayXi ind(5); ind<<4,2,5,5,3; MatrixXi A = MatrixXi::Random(4,6); cout << "Initial matrix A:\n" << A << "\n\n"; cout << "A(all,ind-1):\n" << A(all,ind-1) << "\n\n"; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Slicing_custom_padding_cxx11.cpp ================================================ struct pad { Index size() const { return out_size; } Index operator[] (Index i) const { return std::max(0,i-(out_size-in_size)); } Index in_size, out_size; }; Matrix3i A; A.reshaped() = VectorXi::LinSpaced(9,1,9); cout << "Initial matrix A:\n" << A << "\n\n"; MatrixXi B(5,5); B = A(pad{3,5}, pad{3,5}); cout << "A(pad{3,N}, pad{3,N}):\n" << B << "\n\n"; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Slicing_rawarray_cxx11.cpp ================================================ #if EIGEN_HAS_STATIC_ARRAY_TEMPLATE MatrixXi A = MatrixXi::Random(4,6); cout << "Initial matrix A:\n" << A << "\n\n"; cout << "A(all,{4,2,5,5,3}):\n" << A(all,{4,2,5,5,3}) << "\n\n"; #endif ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Slicing_stdvector_cxx11.cpp ================================================ std::vector ind{4,2,5,5,3}; MatrixXi A = MatrixXi::Random(4,6); cout << "Initial matrix A:\n" << A << "\n\n"; cout << "A(all,ind):\n" << A(all,ind) << "\n\n"; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/SparseMatrix_coeffs.cpp ================================================ SparseMatrix A(3,3); A.insert(1,2) = 0; A.insert(0,1) = 1; A.insert(2,0) = 2; A.makeCompressed(); cout << "The matrix A is:" << endl << MatrixXd(A) << endl; cout << "it has " << A.nonZeros() << " stored non zero coefficients that are: " << A.coeffs().transpose() << endl; A.coeffs() += 10; cout << "After adding 10 to every stored non zero coefficient, the matrix A is:" << endl << MatrixXd(A) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/TopicAliasing_block.cpp ================================================ MatrixXi mat(3,3); mat << 1, 2, 3, 4, 5, 6, 7, 8, 9; cout << "Here is the matrix mat:\n" << mat << endl; // This assignment shows the aliasing problem mat.bottomRightCorner(2,2) = mat.topLeftCorner(2,2); cout << "After the assignment, mat = \n" << mat << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/TopicAliasing_block_correct.cpp ================================================ MatrixXi mat(3,3); mat << 1, 2, 3, 4, 5, 6, 7, 8, 9; cout << "Here is the matrix mat:\n" << mat << endl; // The eval() solves the aliasing problem mat.bottomRightCorner(2,2) = mat.topLeftCorner(2,2).eval(); cout << "After the assignment, mat = \n" << mat << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/TopicAliasing_cwise.cpp ================================================ MatrixXf mat(2,2); mat << 1, 2, 4, 7; cout << "Here is the matrix mat:\n" << mat << endl << endl; mat = 2 * mat; cout << "After 'mat = 2 * mat', mat = \n" << mat << endl << endl; mat = mat - MatrixXf::Identity(2,2); cout << "After the subtraction, it becomes\n" << mat << endl << endl; ArrayXXf arr = mat; arr = arr.square(); cout << "After squaring, it becomes\n" << arr << endl << endl; // Combining all operations in one statement: mat << 1, 2, 4, 7; mat = (2 * mat - MatrixXf::Identity(2,2)).array().square(); cout << "Doing everything at once yields\n" << mat << endl << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/TopicAliasing_mult1.cpp ================================================ MatrixXf matA(2,2); matA << 2, 0, 0, 2; matA = matA * matA; cout << matA; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/TopicAliasing_mult2.cpp ================================================ MatrixXf matA(2,2), matB(2,2); matA << 2, 0, 0, 2; // Simple but not quite as efficient matB = matA * matA; cout << matB << endl << endl; // More complicated but also more efficient matB.noalias() = matA * matA; cout << matB; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/TopicAliasing_mult3.cpp ================================================ MatrixXf matA(2,2); matA << 2, 0, 0, 2; matA.noalias() = matA * matA; cout << matA; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/TopicAliasing_mult4.cpp ================================================ MatrixXf A(2,2), B(3,2); B << 2, 0, 0, 3, 1, 1; A << 2, 0, 0, -2; A = (B * A).cwiseAbs(); cout << A; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/TopicAliasing_mult5.cpp ================================================ MatrixXf A(2,2), B(3,2); B << 2, 0, 0, 3, 1, 1; A << 2, 0, 0, -2; A = (B * A).eval().cwiseAbs(); cout << A; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/TopicStorageOrders_example.cpp ================================================ Matrix Acolmajor; Acolmajor << 8, 2, 2, 9, 9, 1, 4, 4, 3, 5, 4, 5; cout << "The matrix A:" << endl; cout << Acolmajor << endl << endl; cout << "In memory (column-major):" << endl; for (int i = 0; i < Acolmajor.size(); i++) cout << *(Acolmajor.data() + i) << " "; cout << endl << endl; Matrix Arowmajor = Acolmajor; cout << "In memory (row-major):" << endl; for (int i = 0; i < Arowmajor.size(); i++) cout << *(Arowmajor.data() + i) << " "; cout << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Triangular_solve.cpp ================================================ Matrix3d m = Matrix3d::Zero(); m.triangularView().setOnes(); cout << "Here is the matrix m:\n" << m << endl; Matrix3d n = Matrix3d::Ones(); n.triangularView() *= 2; cout << "Here is the matrix n:\n" << n << endl; cout << "And now here is m.inverse()*n, taking advantage of the fact that" " m is upper-triangular:\n" << m.triangularView().solve(n) << endl; cout << "And this is n*m.inverse():\n" << m.triangularView().solve(n); ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tridiagonalization_Tridiagonalization_MatrixType.cpp ================================================ MatrixXd X = MatrixXd::Random(5,5); MatrixXd A = X + X.transpose(); cout << "Here is a random symmetric 5x5 matrix:" << endl << A << endl << endl; Tridiagonalization triOfA(A); MatrixXd Q = triOfA.matrixQ(); cout << "The orthogonal matrix Q is:" << endl << Q << endl; MatrixXd T = triOfA.matrixT(); cout << "The tridiagonal matrix T is:" << endl << T << endl << endl; cout << "Q * T * Q^T = " << endl << Q * T * Q.transpose() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tridiagonalization_compute.cpp ================================================ Tridiagonalization tri; MatrixXf X = MatrixXf::Random(4,4); MatrixXf A = X + X.transpose(); tri.compute(A); cout << "The matrix T in the tridiagonal decomposition of A is: " << endl; cout << tri.matrixT() << endl; tri.compute(2*A); // re-use tri to compute eigenvalues of 2A cout << "The matrix T in the tridiagonal decomposition of 2A is: " << endl; cout << tri.matrixT() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tridiagonalization_decomposeInPlace.cpp ================================================ MatrixXd X = MatrixXd::Random(5,5); MatrixXd A = X + X.transpose(); cout << "Here is a random symmetric 5x5 matrix:" << endl << A << endl << endl; VectorXd diag(5); VectorXd subdiag(4); VectorXd hcoeffs(4); // Scratch space for householder reflector. internal::tridiagonalization_inplace(A, diag, subdiag, hcoeffs, true); cout << "The orthogonal matrix Q is:" << endl << A << endl; cout << "The diagonal of the tridiagonal matrix T is:" << endl << diag << endl; cout << "The subdiagonal of the tridiagonal matrix T is:" << endl << subdiag << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tridiagonalization_diagonal.cpp ================================================ MatrixXcd X = MatrixXcd::Random(4,4); MatrixXcd A = X + X.adjoint(); cout << "Here is a random self-adjoint 4x4 matrix:" << endl << A << endl << endl; Tridiagonalization triOfA(A); MatrixXd T = triOfA.matrixT(); cout << "The tridiagonal matrix T is:" << endl << T << endl << endl; cout << "We can also extract the diagonals of T directly ..." << endl; VectorXd diag = triOfA.diagonal(); cout << "The diagonal is:" << endl << diag << endl; VectorXd subdiag = triOfA.subDiagonal(); cout << "The subdiagonal is:" << endl << subdiag << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tridiagonalization_householderCoefficients.cpp ================================================ Matrix4d X = Matrix4d::Random(4,4); Matrix4d A = X + X.transpose(); cout << "Here is a random symmetric 4x4 matrix:" << endl << A << endl; Tridiagonalization triOfA(A); Vector3d hc = triOfA.householderCoefficients(); cout << "The vector of Householder coefficients is:" << endl << hc << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tridiagonalization_packedMatrix.cpp ================================================ Matrix4d X = Matrix4d::Random(4,4); Matrix4d A = X + X.transpose(); cout << "Here is a random symmetric 4x4 matrix:" << endl << A << endl; Tridiagonalization triOfA(A); Matrix4d pm = triOfA.packedMatrix(); cout << "The packed matrix M is:" << endl << pm << endl; cout << "The diagonal and subdiagonal corresponds to the matrix T, which is:" << endl << triOfA.matrixT() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_AdvancedInitialization_Block.cpp ================================================ MatrixXf matA(2, 2); matA << 1, 2, 3, 4; MatrixXf matB(4, 4); matB << matA, matA/10, matA/10, matA; std::cout << matB << std::endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_AdvancedInitialization_CommaTemporary.cpp ================================================ MatrixXf mat = MatrixXf::Random(2, 3); std::cout << mat << std::endl << std::endl; mat = (MatrixXf(2,2) << 0, 1, 1, 0).finished() * mat; std::cout << mat << std::endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_AdvancedInitialization_Join.cpp ================================================ RowVectorXd vec1(3); vec1 << 1, 2, 3; std::cout << "vec1 = " << vec1 << std::endl; RowVectorXd vec2(4); vec2 << 1, 4, 9, 16; std::cout << "vec2 = " << vec2 << std::endl; RowVectorXd joined(7); joined << vec1, vec2; std::cout << "joined = " << joined << std::endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_AdvancedInitialization_LinSpaced.cpp ================================================ ArrayXXf table(10, 4); table.col(0) = ArrayXf::LinSpaced(10, 0, 90); table.col(1) = M_PI / 180 * table.col(0); table.col(2) = table.col(1).sin(); table.col(3) = table.col(1).cos(); std::cout << " Degrees Radians Sine Cosine\n"; std::cout << table << std::endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_AdvancedInitialization_ThreeWays.cpp ================================================ const int size = 6; MatrixXd mat1(size, size); mat1.topLeftCorner(size/2, size/2) = MatrixXd::Zero(size/2, size/2); mat1.topRightCorner(size/2, size/2) = MatrixXd::Identity(size/2, size/2); mat1.bottomLeftCorner(size/2, size/2) = MatrixXd::Identity(size/2, size/2); mat1.bottomRightCorner(size/2, size/2) = MatrixXd::Zero(size/2, size/2); std::cout << mat1 << std::endl << std::endl; MatrixXd mat2(size, size); mat2.topLeftCorner(size/2, size/2).setZero(); mat2.topRightCorner(size/2, size/2).setIdentity(); mat2.bottomLeftCorner(size/2, size/2).setIdentity(); mat2.bottomRightCorner(size/2, size/2).setZero(); std::cout << mat2 << std::endl << std::endl; MatrixXd mat3(size, size); mat3 << MatrixXd::Zero(size/2, size/2), MatrixXd::Identity(size/2, size/2), MatrixXd::Identity(size/2, size/2), MatrixXd::Zero(size/2, size/2); std::cout << mat3 << std::endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_AdvancedInitialization_Zero.cpp ================================================ std::cout << "A fixed-size array:\n"; Array33f a1 = Array33f::Zero(); std::cout << a1 << "\n\n"; std::cout << "A one-dimensional dynamic-size array:\n"; ArrayXf a2 = ArrayXf::Zero(3); std::cout << a2 << "\n\n"; std::cout << "A two-dimensional dynamic-size array:\n"; ArrayXXf a3 = ArrayXXf::Zero(3, 4); std::cout << a3 << "\n"; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_Map_rowmajor.cpp ================================================ int array[8]; for(int i = 0; i < 8; ++i) array[i] = i; cout << "Column-major:\n" << Map >(array) << endl; cout << "Row-major:\n" << Map >(array) << endl; cout << "Row-major using stride:\n" << Map, Unaligned, Stride<1,4> >(array) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_Map_using.cpp ================================================ typedef Matrix MatrixType; typedef Map MapType; typedef Map MapTypeConst; // a read-only map const int n_dims = 5; MatrixType m1(n_dims), m2(n_dims); m1.setRandom(); m2.setRandom(); float *p = &m2(0); // get the address storing the data for m2 MapType m2map(p,m2.size()); // m2map shares data with m2 MapTypeConst m2mapconst(p,m2.size()); // a read-only accessor for m2 cout << "m1: " << m1 << endl; cout << "m2: " << m2 << endl; cout << "Squared euclidean distance: " << (m1-m2).squaredNorm() << endl; cout << "Squared euclidean distance, using map: " << (m1-m2map).squaredNorm() << endl; m2map(3) = 7; // this will change m2, since they share the same array cout << "Updated m2: " << m2 << endl; cout << "m2 coefficient 2, constant accessor: " << m2mapconst(2) << endl; /* m2mapconst(2) = 5; */ // this yields a compile-time error ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_ReshapeMat2Mat.cpp ================================================ MatrixXf M1(2,6); // Column-major storage M1 << 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12; Map M2(M1.data(), 6,2); cout << "M2:" << endl << M2 << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_ReshapeMat2Vec.cpp ================================================ MatrixXf M1(3,3); // Column-major storage M1 << 1, 2, 3, 4, 5, 6, 7, 8, 9; Map v1(M1.data(), M1.size()); cout << "v1:" << endl << v1 << endl; Matrix M2(M1); Map v2(M2.data(), M2.size()); cout << "v2:" << endl << v2 << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_SlicingCol.cpp ================================================ MatrixXf M1 = MatrixXf::Random(3,8); cout << "Column major input:" << endl << M1 << "\n"; Map > M2(M1.data(), M1.rows(), (M1.cols()+2)/3, OuterStride<>(M1.outerStride()*3)); cout << "1 column over 3:" << endl << M2 << "\n"; typedef Matrix RowMajorMatrixXf; RowMajorMatrixXf M3(M1); cout << "Row major input:" << endl << M3 << "\n"; Map > M4(M3.data(), M3.rows(), (M3.cols()+2)/3, Stride(M3.outerStride(),3)); cout << "1 column over 3:" << endl << M4 << "\n"; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_SlicingVec.cpp ================================================ RowVectorXf v = RowVectorXf::LinSpaced(20,0,19); cout << "Input:" << endl << v << endl; Map > v2(v.data(), v.size()/2); cout << "Even:" << v2 << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_commainit_01.cpp ================================================ Matrix3f m; m << 1, 2, 3, 4, 5, 6, 7, 8, 9; std::cout << m; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_commainit_01b.cpp ================================================ Matrix3f m; m.row(0) << 1, 2, 3; m.block(1,0,2,2) << 4, 5, 7, 8; m.col(2).tail(2) << 6, 9; std::cout << m; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_commainit_02.cpp ================================================ int rows=5, cols=5; MatrixXf m(rows,cols); m << (Matrix3f() << 1, 2, 3, 4, 5, 6, 7, 8, 9).finished(), MatrixXf::Zero(3,cols-3), MatrixXf::Zero(rows-3,3), MatrixXf::Identity(rows-3,cols-3); cout << m; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_range_for_loop_1d_cxx11.cpp ================================================ VectorXi v = VectorXi::Random(4); cout << "Here is the vector v:\n"; for(auto x : v) cout << x << " "; cout << "\n"; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_range_for_loop_2d_cxx11.cpp ================================================ Matrix2i A = Matrix2i::Random(); cout << "Here are the coeffs of the 2x2 matrix A:\n"; for(auto x : A.reshaped()) cout << x << " "; cout << "\n"; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_reshaped_vs_resize_1.cpp ================================================ MatrixXi m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.reshaped(2, 8):" << endl << m.reshaped(2, 8) << endl; m.resize(2,8); cout << "Here is the matrix m after m.resize(2,8):" << endl << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_reshaped_vs_resize_2.cpp ================================================ Matrix m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.reshaped(2, 8):" << endl << m.reshaped(2, 8) << endl; cout << "Here is m.reshaped(2, 8):" << endl << m.reshaped(2, 8) << endl; m.resize(2,8); cout << "Here is the matrix m after m.resize(2,8):" << endl << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_solve_matrix_inverse.cpp ================================================ Matrix3f A; Vector3f b; A << 1,2,3, 4,5,6, 7,8,10; b << 3, 3, 4; Vector3f x = A.inverse() * b; cout << "The solution is:" << endl << x << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_solve_multiple_rhs.cpp ================================================ Matrix3f A(3,3); A << 1,2,3, 4,5,6, 7,8,10; Matrix B; B << 3,1, 3,1, 4,1; Matrix X; X = A.fullPivLu().solve(B); cout << "The solution with right-hand side (3,3,4) is:" << endl; cout << X.col(0) << endl; cout << "The solution with right-hand side (1,1,1) is:" << endl; cout << X.col(1) << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_solve_reuse_decomposition.cpp ================================================ Matrix3f A(3,3); A << 1,2,3, 4,5,6, 7,8,10; PartialPivLU luOfA(A); // compute LU decomposition of A Vector3f b; b << 3,3,4; Vector3f x; x = luOfA.solve(b); cout << "The solution with right-hand side (3,3,4) is:" << endl; cout << x << endl; b << 1,1,1; x = luOfA.solve(b); cout << "The solution with right-hand side (1,1,1) is:" << endl; cout << x << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_solve_singular.cpp ================================================ Matrix3f A; Vector3f b; A << 1,2,3, 4,5,6, 7,8,9; b << 3, 3, 4; cout << "Here is the matrix A:" << endl << A << endl; cout << "Here is the vector b:" << endl << b << endl; Vector3f x; x = A.lu().solve(b); cout << "The solution is:" << endl << x << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_solve_triangular.cpp ================================================ Matrix3f A; Vector3f b; A << 1,2,3, 0,5,6, 0,0,10; b << 3, 3, 4; cout << "Here is the matrix A:" << endl << A << endl; cout << "Here is the vector b:" << endl << b << endl; Vector3f x = A.triangularView().solve(b); cout << "The solution is:" << endl << x << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_solve_triangular_inplace.cpp ================================================ Matrix3f A; Vector3f b; A << 1,2,3, 0,5,6, 0,0,10; b << 3, 3, 4; A.triangularView().solveInPlace(b); cout << "The solution is:" << endl << b << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_std_sort.cpp ================================================ Array4i v = Array4i::Random().abs(); cout << "Here is the initial vector v:\n" << v.transpose() << "\n"; std::sort(v.begin(), v.end()); cout << "Here is the sorted vector v:\n" << v.transpose() << "\n"; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Tutorial_std_sort_rows_cxx11.cpp ================================================ ArrayXXi A = ArrayXXi::Random(4,4).abs(); cout << "Here is the initial matrix A:\n" << A << "\n"; for(auto row : A.rowwise()) std::sort(row.begin(), row.end()); cout << "Here is the sorted matrix A:\n" << A << "\n"; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/VectorwiseOp_homogeneous.cpp ================================================ Matrix3Xd M = Matrix3Xd::Random(3,5); Projective3d P(Matrix4d::Random()); cout << "The matrix M is:" << endl << M << endl << endl; cout << "M.colwise().homogeneous():" << endl << M.colwise().homogeneous() << endl << endl; cout << "P * M.colwise().homogeneous():" << endl << P * M.colwise().homogeneous() << endl << endl; cout << "P * M.colwise().homogeneous().hnormalized(): " << endl << (P * M.colwise().homogeneous()).colwise().hnormalized() << endl << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/Vectorwise_reverse.cpp ================================================ MatrixXi m = MatrixXi::Random(3,4); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the rowwise reverse of m:" << endl << m.rowwise().reverse() << endl; cout << "Here is the colwise reverse of m:" << endl << m.colwise().reverse() << endl; cout << "Here is the coefficient (1,0) in the rowise reverse of m:" << endl << m.rowwise().reverse()(1,0) << endl; cout << "Let us overwrite this coefficient with the value 4." << endl; //m.colwise().reverse()(1,0) = 4; cout << "Now the matrix m is:" << endl << m << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/class_FullPivLU.cpp ================================================ typedef Matrix Matrix5x3; typedef Matrix Matrix5x5; Matrix5x3 m = Matrix5x3::Random(); cout << "Here is the matrix m:" << endl << m << endl; Eigen::FullPivLU lu(m); cout << "Here is, up to permutations, its LU decomposition matrix:" << endl << lu.matrixLU() << endl; cout << "Here is the L part:" << endl; Matrix5x5 l = Matrix5x5::Identity(); l.block<5,3>(0,0).triangularView() = lu.matrixLU(); cout << l << endl; cout << "Here is the U part:" << endl; Matrix5x3 u = lu.matrixLU().triangularView(); cout << u << endl; cout << "Let us now reconstruct the original matrix m:" << endl; cout << lu.permutationP().inverse() * l * u * lu.permutationQ().inverse() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/compile_snippet.cpp.in ================================================ static bool eigen_did_assert = false; #define eigen_assert(X) if(!eigen_did_assert && !(X)){ std::cout << "### Assertion raised in " << __FILE__ << ":" << __LINE__ << ":\n" #X << "\n### The following would happen without assertions:\n"; eigen_did_assert = true;} #include #include #ifndef M_PI #define M_PI 3.1415926535897932384626433832795 #endif using namespace Eigen; using namespace std; int main(int, char**) { cout.precision(3); // intentionally remove indentation of snippet { ${snippet_source_code} } return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/tut_arithmetic_redux_minmax.cpp ================================================ Matrix3f m = Matrix3f::Random(); std::ptrdiff_t i, j; float minOfM = m.minCoeff(&i,&j); cout << "Here is the matrix m:\n" << m << endl; cout << "Its minimum coefficient (" << minOfM << ") is at position (" << i << "," << j << ")\n\n"; RowVector4i v = RowVector4i::Random(); int maxOfV = v.maxCoeff(&i); cout << "Here is the vector v: " << v << endl; cout << "Its maximum coefficient (" << maxOfV << ") is at position " << i << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/tut_arithmetic_transpose_aliasing.cpp ================================================ Matrix2i a; a << 1, 2, 3, 4; cout << "Here is the matrix a:\n" << a << endl; a = a.transpose(); // !!! do NOT do this !!! cout << "and the result of the aliasing effect:\n" << a << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/tut_arithmetic_transpose_conjugate.cpp ================================================ MatrixXcf a = MatrixXcf::Random(2,2); cout << "Here is the matrix a\n" << a << endl; cout << "Here is the matrix a^T\n" << a.transpose() << endl; cout << "Here is the conjugate of a\n" << a.conjugate() << endl; cout << "Here is the matrix a^*\n" << a.adjoint() << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/tut_arithmetic_transpose_inplace.cpp ================================================ MatrixXf a(2,3); a << 1, 2, 3, 4, 5, 6; cout << "Here is the initial matrix a:\n" << a << endl; a.transposeInPlace(); cout << "and after being transposed:\n" << a << endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/snippets/tut_matrix_assignment_resizing.cpp ================================================ MatrixXf a(2,2); std::cout << "a is of size " << a.rows() << "x" << a.cols() << std::endl; MatrixXf b(3,3); a = b; std::cout << "a is now of size " << a.rows() << "x" << a.cols() << std::endl; ================================================ FILE: VO_Module/thirdparty/eigen/doc/special_examples/CMakeLists.txt ================================================ if(NOT EIGEN_TEST_NOQT) find_package(Qt4) if(QT4_FOUND) include(${QT_USE_FILE}) endif() endif() if(QT4_FOUND) add_executable(Tutorial_sparse_example Tutorial_sparse_example.cpp Tutorial_sparse_example_details.cpp) target_link_libraries(Tutorial_sparse_example ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}) add_custom_command( TARGET Tutorial_sparse_example POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/../html/ COMMAND Tutorial_sparse_example ARGS ${CMAKE_CURRENT_BINARY_DIR}/../html/Tutorial_sparse_example.jpeg ) add_dependencies(all_examples Tutorial_sparse_example) endif() add_executable(random_cpp11 random_cpp11.cpp) target_link_libraries(random_cpp11 ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}) add_dependencies(all_examples random_cpp11) add_custom_command( TARGET random_cpp11 POST_BUILD COMMAND random_cpp11 ARGS >${CMAKE_CURRENT_BINARY_DIR}/random_cpp11.out ) ================================================ FILE: VO_Module/thirdparty/eigen/doc/special_examples/Tutorial_sparse_example.cpp ================================================ #include #include #include typedef Eigen::SparseMatrix SpMat; // declares a column-major sparse matrix type of double typedef Eigen::Triplet T; void buildProblem(std::vector& coefficients, Eigen::VectorXd& b, int n); void saveAsBitmap(const Eigen::VectorXd& x, int n, const char* filename); int main(int argc, char** argv) { if(argc!=2) { std::cerr << "Error: expected one and only one argument.\n"; return -1; } int n = 300; // size of the image int m = n*n; // number of unknowns (=number of pixels) // Assembly: std::vector coefficients; // list of non-zeros coefficients Eigen::VectorXd b(m); // the right hand side-vector resulting from the constraints buildProblem(coefficients, b, n); SpMat A(m,m); A.setFromTriplets(coefficients.begin(), coefficients.end()); // Solving: Eigen::SimplicialCholesky chol(A); // performs a Cholesky factorization of A Eigen::VectorXd x = chol.solve(b); // use the factorization to solve for the given right hand side // Export the result to a file: saveAsBitmap(x, n, argv[1]); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/special_examples/Tutorial_sparse_example_details.cpp ================================================ #include #include #include typedef Eigen::SparseMatrix SpMat; // declares a column-major sparse matrix type of double typedef Eigen::Triplet T; void insertCoefficient(int id, int i, int j, double w, std::vector& coeffs, Eigen::VectorXd& b, const Eigen::VectorXd& boundary) { int n = int(boundary.size()); int id1 = i+j*n; if(i==-1 || i==n) b(id) -= w * boundary(j); // constrained coefficient else if(j==-1 || j==n) b(id) -= w * boundary(i); // constrained coefficient else coeffs.push_back(T(id,id1,w)); // unknown coefficient } void buildProblem(std::vector& coefficients, Eigen::VectorXd& b, int n) { b.setZero(); Eigen::ArrayXd boundary = Eigen::ArrayXd::LinSpaced(n, 0,M_PI).sin().pow(2); for(int j=0; j bits = (x*255).cast(); QImage img(bits.data(), n,n,QImage::Format_Indexed8); img.setColorCount(256); for(int i=0;i<256;i++) img.setColor(i,qRgb(i,i,i)); img.save(filename); } ================================================ FILE: VO_Module/thirdparty/eigen/doc/special_examples/random_cpp11.cpp ================================================ #include #include #include using namespace Eigen; int main() { std::default_random_engine generator; std::poisson_distribution distribution(4.1); auto poisson = [&] () {return distribution(generator);}; RowVectorXi v = RowVectorXi::NullaryExpr(10, poisson ); std::cout << v << "\n"; } ================================================ FILE: VO_Module/thirdparty/eigen/doc/tutorial.cpp ================================================ #include int main(int argc, char *argv[]) { std::cout.precision(2); // demo static functions Eigen::Matrix3f m3 = Eigen::Matrix3f::Random(); Eigen::Matrix4f m4 = Eigen::Matrix4f::Identity(); std::cout << "*** Step 1 ***\nm3:\n" << m3 << "\nm4:\n" << m4 << std::endl; // demo non-static set... functions m4.setZero(); m3.diagonal().setOnes(); std::cout << "*** Step 2 ***\nm3:\n" << m3 << "\nm4:\n" << m4 << std::endl; // demo fixed-size block() expression as lvalue and as rvalue m4.block<3,3>(0,1) = m3; m3.row(2) = m4.block<1,3>(2,0); std::cout << "*** Step 3 ***\nm3:\n" << m3 << "\nm4:\n" << m4 << std::endl; // demo dynamic-size block() { int rows = 3, cols = 3; m4.block(0,1,3,3).setIdentity(); std::cout << "*** Step 4 ***\nm4:\n" << m4 << std::endl; } // demo vector blocks m4.diagonal().block(1,2).setOnes(); std::cout << "*** Step 5 ***\nm4.diagonal():\n" << m4.diagonal() << std::endl; std::cout << "m4.diagonal().start(3)\n" << m4.diagonal().start(3) << std::endl; // demo coeff-wise operations m4 = m4.cwise()*m4; m3 = m3.cwise().cos(); std::cout << "*** Step 6 ***\nm3:\n" << m3 << "\nm4:\n" << m4 << std::endl; // sums of coefficients std::cout << "*** Step 7 ***\n m4.sum(): " << m4.sum() << std::endl; std::cout << "m4.col(2).sum(): " << m4.col(2).sum() << std::endl; std::cout << "m4.colwise().sum():\n" << m4.colwise().sum() << std::endl; std::cout << "m4.rowwise().sum():\n" << m4.rowwise().sum() << std::endl; // demo intelligent auto-evaluation m4 = m4 * m4; // auto-evaluates so no aliasing problem (performance penalty is low) Eigen::Matrix4f other = (m4 * m4).lazy(); // forces lazy evaluation m4 = m4 + m4; // here Eigen goes for lazy evaluation, as with most expressions m4 = -m4 + m4 + 5 * m4; // same here, Eigen chooses lazy evaluation for all that. m4 = m4 * (m4 + m4); // here Eigen chooses to first evaluate m4 + m4 into a temporary. // indeed, here it is an optimization to cache this intermediate result. m3 = m3 * m4.block<3,3>(1,1); // here Eigen chooses NOT to evaluate block() into a temporary // because accessing coefficients of that block expression is not more costly than accessing // coefficients of a plain matrix. m4 = m4 * m4.transpose(); // same here, lazy evaluation of the transpose. m4 = m4 * m4.transpose().eval(); // forces immediate evaluation of the transpose std::cout << "*** Step 8 ***\nm3:\n" << m3 << "\nm4:\n" << m4 << std::endl; } ================================================ FILE: VO_Module/thirdparty/eigen/eigen3.pc.in ================================================ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} Name: Eigen3 Description: A C++ template library for linear algebra: vectors, matrices, and related algorithms Requires: Version: @EIGEN_VERSION_NUMBER@ Libs: Cflags: -I${prefix}/@INCLUDE_INSTALL_DIR@ ================================================ FILE: VO_Module/thirdparty/eigen/failtest/CMakeLists.txt ================================================ ei_add_failtest("failtest_sanity_check") ei_add_failtest("block_nonconst_ctor_on_const_xpr_0") ei_add_failtest("block_nonconst_ctor_on_const_xpr_1") ei_add_failtest("block_nonconst_ctor_on_const_xpr_2") ei_add_failtest("transpose_nonconst_ctor_on_const_xpr") ei_add_failtest("diagonal_nonconst_ctor_on_const_xpr") ei_add_failtest("cwiseunaryview_nonconst_ctor_on_const_xpr") ei_add_failtest("triangularview_nonconst_ctor_on_const_xpr") ei_add_failtest("selfadjointview_nonconst_ctor_on_const_xpr") ei_add_failtest("const_qualified_block_method_retval_0") ei_add_failtest("const_qualified_block_method_retval_1") ei_add_failtest("const_qualified_transpose_method_retval") ei_add_failtest("const_qualified_diagonal_method_retval") ei_add_failtest("map_nonconst_ctor_on_const_ptr_0") ei_add_failtest("map_nonconst_ctor_on_const_ptr_1") ei_add_failtest("map_nonconst_ctor_on_const_ptr_2") ei_add_failtest("map_nonconst_ctor_on_const_ptr_3") ei_add_failtest("map_nonconst_ctor_on_const_ptr_4") ei_add_failtest("map_on_const_type_actually_const_0") ei_add_failtest("map_on_const_type_actually_const_1") ei_add_failtest("block_on_const_type_actually_const_0") ei_add_failtest("block_on_const_type_actually_const_1") ei_add_failtest("transpose_on_const_type_actually_const") ei_add_failtest("diagonal_on_const_type_actually_const") ei_add_failtest("cwiseunaryview_on_const_type_actually_const") ei_add_failtest("triangularview_on_const_type_actually_const") ei_add_failtest("selfadjointview_on_const_type_actually_const") ei_add_failtest("ref_1") ei_add_failtest("ref_2") ei_add_failtest("ref_3") ei_add_failtest("ref_4") ei_add_failtest("ref_5") ei_add_failtest("swap_1") ei_add_failtest("swap_2") ei_add_failtest("ternary_1") ei_add_failtest("ternary_2") ei_add_failtest("sparse_ref_1") ei_add_failtest("sparse_ref_2") ei_add_failtest("sparse_ref_3") ei_add_failtest("sparse_ref_4") ei_add_failtest("sparse_ref_5") ei_add_failtest("sparse_storage_mismatch") ei_add_failtest("partialpivlu_int") ei_add_failtest("fullpivlu_int") ei_add_failtest("llt_int") ei_add_failtest("ldlt_int") ei_add_failtest("qr_int") ei_add_failtest("colpivqr_int") ei_add_failtest("fullpivqr_int") ei_add_failtest("jacobisvd_int") ei_add_failtest("bdcsvd_int") ei_add_failtest("eigensolver_int") ei_add_failtest("eigensolver_cplx") ei_add_failtest("initializer_list_1") ei_add_failtest("initializer_list_2") ================================================ FILE: VO_Module/thirdparty/eigen/failtest/bdcsvd_int.cpp ================================================ #include "../Eigen/SVD" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define SCALAR int #else #define SCALAR float #endif using namespace Eigen; int main() { BDCSVD > qr(Matrix::Random(10,10)); } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/block_nonconst_ctor_on_const_xpr_0.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER Matrix3d &m){ Block b(m,0,0); } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/block_nonconst_ctor_on_const_xpr_1.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER Matrix3d &m){ Block b(m,0,0,3,3); } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/block_nonconst_ctor_on_const_xpr_2.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER Matrix3d &m){ // row/column constructor Block b(m,0); } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/block_on_const_type_actually_const_0.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(){ Matrix3f m; Block(m, 0, 0, 3, 3).coeffRef(0, 0) = 1.0f; } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/block_on_const_type_actually_const_1.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(){ MatrixXf m; Block(m, 0, 0).coeffRef(0, 0) = 1.0f; } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/colpivqr_int.cpp ================================================ #include "../Eigen/QR" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define SCALAR int #else #define SCALAR float #endif using namespace Eigen; int main() { ColPivHouseholderQR > qr(Matrix::Random(10,10)); } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/const_qualified_block_method_retval_0.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER Matrix3d &m){ Block b(m.block<3,3>(0,0)); } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/const_qualified_block_method_retval_1.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER Matrix3d &m){ Block b(m.block(0,0,3,3)); } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/const_qualified_diagonal_method_retval.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER Matrix3d &m){ Diagonal b(m.diagonal()); } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/const_qualified_transpose_method_retval.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER Matrix3d &m){ Transpose b(m.transpose()); } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/cwiseunaryview_nonconst_ctor_on_const_xpr.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER Matrix3d &m){ CwiseUnaryView,Matrix3d> t(m); } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/cwiseunaryview_on_const_type_actually_const.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(){ MatrixXf m; CwiseUnaryView,CV_QUALIFIER MatrixXf>(m).coeffRef(0, 0) = 1.0f; } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/diagonal_nonconst_ctor_on_const_xpr.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER Matrix3d &m){ Diagonal d(m); } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/diagonal_on_const_type_actually_const.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(){ MatrixXf m; Diagonal(m).coeffRef(0) = 1.0f; } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/eigensolver_cplx.cpp ================================================ #include "../Eigen/Eigenvalues" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define SCALAR std::complex #else #define SCALAR float #endif using namespace Eigen; int main() { EigenSolver > eig(Matrix::Random(10,10)); } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/eigensolver_int.cpp ================================================ #include "../Eigen/Eigenvalues" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define SCALAR int #else #define SCALAR float #endif using namespace Eigen; int main() { EigenSolver > eig(Matrix::Random(10,10)); } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/failtest_sanity_check.cpp ================================================ #ifdef EIGEN_SHOULD_FAIL_TO_BUILD This is just some text that won't compile as a C++ file, as a basic sanity check for failtest. #else int main() {} #endif ================================================ FILE: VO_Module/thirdparty/eigen/failtest/fullpivlu_int.cpp ================================================ #include "../Eigen/LU" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define SCALAR int #else #define SCALAR float #endif using namespace Eigen; int main() { FullPivLU > lu(Matrix::Random(10,10)); } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/fullpivqr_int.cpp ================================================ #include "../Eigen/QR" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define SCALAR int #else #define SCALAR float #endif using namespace Eigen; int main() { FullPivHouseholderQR > qr(Matrix::Random(10,10)); } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/initializer_list_1.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define ROWS Dynamic #else #define ROWS 3 #endif using namespace Eigen; int main() { Matrix {1, 2, 3}; } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/initializer_list_2.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define ROWS Dynamic #define COLS Dynamic #else #define ROWS 3 #define COLS 1 #endif using namespace Eigen; int main() { Matrix {1, 2, 3}; } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/jacobisvd_int.cpp ================================================ #include "../Eigen/SVD" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define SCALAR int #else #define SCALAR float #endif using namespace Eigen; int main() { JacobiSVD > qr(Matrix::Random(10,10)); } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/ldlt_int.cpp ================================================ #include "../Eigen/Cholesky" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define SCALAR int #else #define SCALAR float #endif using namespace Eigen; int main() { LDLT > ldlt(Matrix::Random(10,10)); } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/llt_int.cpp ================================================ #include "../Eigen/Cholesky" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define SCALAR int #else #define SCALAR float #endif using namespace Eigen; int main() { LLT > llt(Matrix::Random(10,10)); } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/map_nonconst_ctor_on_const_ptr_0.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER float *ptr){ Map m(ptr); } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/map_nonconst_ctor_on_const_ptr_1.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER float *ptr, DenseIndex size){ Map m(ptr, size); } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/map_nonconst_ctor_on_const_ptr_2.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER float *ptr, DenseIndex rows, DenseIndex cols){ Map m(ptr, rows, cols); } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/map_nonconst_ctor_on_const_ptr_3.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER float *ptr, DenseIndex rows, DenseIndex cols){ Map > m(ptr, rows, cols, InnerStride<2>()); } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/map_nonconst_ctor_on_const_ptr_4.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER #else #define CV_QUALIFIER const #endif using namespace Eigen; void foo(const float *ptr, DenseIndex rows, DenseIndex cols){ Map > m(ptr, rows, cols, OuterStride<>(2)); } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/map_on_const_type_actually_const_0.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(float *ptr){ Map(ptr, 1, 1).coeffRef(0,0) = 1.0f; } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/map_on_const_type_actually_const_1.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(float *ptr){ Map(ptr).coeffRef(0) = 1.0f; } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/partialpivlu_int.cpp ================================================ #include "../Eigen/LU" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define SCALAR int #else #define SCALAR float #endif using namespace Eigen; int main() { PartialPivLU > lu(Matrix::Random(10,10)); } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/qr_int.cpp ================================================ #include "../Eigen/QR" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define SCALAR int #else #define SCALAR float #endif using namespace Eigen; int main() { HouseholderQR > qr(Matrix::Random(10,10)); } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/ref_1.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void call_ref(Ref a) { } int main() { VectorXf a(10); CV_QUALIFIER VectorXf& ac(a); call_ref(ac); } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/ref_2.cpp ================================================ #include "../Eigen/Core" using namespace Eigen; void call_ref(Ref a) { } int main() { MatrixXf A(10,10); #ifdef EIGEN_SHOULD_FAIL_TO_BUILD call_ref(A.row(3)); #else call_ref(A.col(3)); #endif } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/ref_3.cpp ================================================ #include "../Eigen/Core" using namespace Eigen; #ifdef EIGEN_SHOULD_FAIL_TO_BUILD void call_ref(Ref a) { } #else void call_ref(const Ref &a) { } #endif int main() { VectorXf a(10); call_ref(a+a); } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/ref_4.cpp ================================================ #include "../Eigen/Core" using namespace Eigen; void call_ref(Ref > a) {} int main() { MatrixXf A(10,10); #ifdef EIGEN_SHOULD_FAIL_TO_BUILD call_ref(A.transpose()); #else call_ref(A); #endif } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/ref_5.cpp ================================================ #include "../Eigen/Core" using namespace Eigen; void call_ref(Ref a) { } int main() { VectorXf a(10); DenseBase &ac(a); #ifdef EIGEN_SHOULD_FAIL_TO_BUILD call_ref(ac); #else call_ref(ac.derived()); #endif } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/selfadjointview_nonconst_ctor_on_const_xpr.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER Matrix3d &m){ SelfAdjointView t(m); } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/selfadjointview_on_const_type_actually_const.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(){ MatrixXf m; SelfAdjointView(m).coeffRef(0, 0) = 1.0f; } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/sparse_ref_1.cpp ================================================ #include "../Eigen/Sparse" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void call_ref(Ref > a) { } int main() { SparseMatrix a(10,10); CV_QUALIFIER SparseMatrix& ac(a); call_ref(ac); } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/sparse_ref_2.cpp ================================================ #include "../Eigen/Sparse" using namespace Eigen; void call_ref(Ref > a) { } int main() { SparseMatrix A(10,10); #ifdef EIGEN_SHOULD_FAIL_TO_BUILD call_ref(A.row(3)); #else call_ref(A.col(3)); #endif } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/sparse_ref_3.cpp ================================================ #include "../Eigen/Sparse" using namespace Eigen; #ifdef EIGEN_SHOULD_FAIL_TO_BUILD void call_ref(Ref > a) { } #else void call_ref(const Ref > &a) { } #endif int main() { SparseMatrix a(10,10); call_ref(a+a); } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/sparse_ref_4.cpp ================================================ #include "../Eigen/Sparse" using namespace Eigen; void call_ref(Ref > a) {} int main() { SparseMatrix A(10,10); #ifdef EIGEN_SHOULD_FAIL_TO_BUILD call_ref(A.transpose()); #else call_ref(A); #endif } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/sparse_ref_5.cpp ================================================ #include "../Eigen/Sparse" using namespace Eigen; void call_ref(Ref > a) { } int main() { SparseMatrix a(10,10); SparseMatrixBase > &ac(a); #ifdef EIGEN_SHOULD_FAIL_TO_BUILD call_ref(ac); #else call_ref(ac.derived()); #endif } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/sparse_storage_mismatch.cpp ================================================ #include "../Eigen/Sparse" using namespace Eigen; typedef SparseMatrix Mat1; #ifdef EIGEN_SHOULD_FAIL_TO_BUILD typedef SparseMatrix Mat2; #else typedef SparseMatrix Mat2; #endif int main() { Mat1 a(10,10); Mat2 b(10,10); a += b; } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/swap_1.cpp ================================================ #include "../Eigen/Core" using namespace Eigen; int main() { VectorXf a(10), b(10); #ifdef EIGEN_SHOULD_FAIL_TO_BUILD const DenseBase &ac(a); #else DenseBase &ac(a); #endif b.swap(ac); } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/swap_2.cpp ================================================ #include "../Eigen/Core" using namespace Eigen; int main() { VectorXf a(10), b(10); VectorXf const &ac(a); #ifdef EIGEN_SHOULD_FAIL_TO_BUILD b.swap(ac); #else b.swap(ac.const_cast_derived()); #endif } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/ternary_1.cpp ================================================ #include "../Eigen/Core" using namespace Eigen; int main(int argc,char **) { VectorXf a(10), b(10); #ifdef EIGEN_SHOULD_FAIL_TO_BUILD b = argc>1 ? 2*a : -a; #else b = argc>1 ? 2*a : VectorXf(-a); #endif } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/ternary_2.cpp ================================================ #include "../Eigen/Core" using namespace Eigen; int main(int argc,char **) { VectorXf a(10), b(10); #ifdef EIGEN_SHOULD_FAIL_TO_BUILD b = argc>1 ? 2*a : a+a; #else b = argc>1 ? VectorXf(2*a) : VectorXf(a+a); #endif } ================================================ FILE: VO_Module/thirdparty/eigen/failtest/transpose_nonconst_ctor_on_const_xpr.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER Matrix3d &m){ Transpose t(m); } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/transpose_on_const_type_actually_const.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(){ MatrixXf m; Transpose(m).coeffRef(0, 0) = 1.0f; } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/triangularview_nonconst_ctor_on_const_xpr.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER Matrix3d &m){ TriangularView t(m); } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/failtest/triangularview_on_const_type_actually_const.cpp ================================================ #include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(){ MatrixXf m; TriangularView(m).coeffRef(0, 0) = 1.0f; } int main() {} ================================================ FILE: VO_Module/thirdparty/eigen/lapack/CMakeLists.txt ================================================ project(EigenLapack CXX) include(CheckLanguage) check_language(Fortran) if(CMAKE_Fortran_COMPILER) enable_language(Fortran) if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU") if ("${CMAKE_Fortran_COMPILER_VERSION}" VERSION_GREATER_EQUAL 10.0) # We use an old version of LAPACK with argument type mismatches. # Allow them to compile anyway with newer GNU versions. set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch") endif() endif() set(EIGEN_Fortran_COMPILER_WORKS ON) else() set(EIGEN_Fortran_COMPILER_WORKS OFF) endif() add_custom_target(lapack) include_directories(../blas) set(EigenLapack_SRCS single.cpp double.cpp complex_single.cpp complex_double.cpp ../blas/xerbla.cpp ) if(EIGEN_Fortran_COMPILER_WORKS) set(EigenLapack_SRCS ${EigenLapack_SRCS} slarft.f dlarft.f clarft.f zlarft.f slarfb.f dlarfb.f clarfb.f zlarfb.f slarfg.f dlarfg.f clarfg.f zlarfg.f slarf.f dlarf.f clarf.f zlarf.f sladiv.f dladiv.f cladiv.f zladiv.f ilaslr.f iladlr.f ilaclr.f ilazlr.f ilaslc.f iladlc.f ilaclc.f ilazlc.f dlapy2.f dlapy3.f slapy2.f slapy3.f clacgv.f zlacgv.f slamch.f dlamch.f second_NONE.f dsecnd_NONE.f ) option(EIGEN_ENABLE_LAPACK_TESTS OFF "Enable the Lapack unit tests") if(EIGEN_ENABLE_LAPACK_TESTS) get_filename_component(eigen_full_path_to_reference_lapack "./reference/" ABSOLUTE) if(NOT EXISTS ${eigen_full_path_to_reference_lapack}) # Download lapack and install sources and testing at the right place message(STATUS "Download lapack_addons_3.4.1.tgz...") file(DOWNLOAD "http://downloads.tuxfamily.org/eigen/lapack_addons_3.4.1.tgz" "${CMAKE_CURRENT_SOURCE_DIR}/lapack_addons_3.4.1.tgz" INACTIVITY_TIMEOUT 15 TIMEOUT 240 STATUS download_status EXPECTED_MD5 ab5742640617e3221a873aba44bbdc93 SHOW_PROGRESS) message(STATUS ${download_status}) list(GET download_status 0 download_status_num) set(download_status_num 0) if(download_status_num EQUAL 0) message(STATUS "Setup lapack reference and lapack unit tests") execute_process(COMMAND tar xzf "lapack_addons_3.4.1.tgz" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) else() message(STATUS "Download of lapack_addons_3.4.1.tgz failed, LAPACK unit tests won't be enabled") set(EIGEN_ENABLE_LAPACK_TESTS false) endif() endif() get_filename_component(eigen_full_path_to_reference_lapack "./reference/" ABSOLUTE) if(EXISTS ${eigen_full_path_to_reference_lapack}) set(EigenLapack_funcfilenames ssyev.f dsyev.f csyev.f zsyev.f spotrf.f dpotrf.f cpotrf.f zpotrf.f spotrs.f dpotrs.f cpotrs.f zpotrs.f sgetrf.f dgetrf.f cgetrf.f zgetrf.f sgetrs.f dgetrs.f cgetrs.f zgetrs.f) file(GLOB ReferenceLapack_SRCS0 RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "reference/*.f") foreach(filename1 IN LISTS ReferenceLapack_SRCS0) string(REPLACE "reference/" "" filename ${filename1}) list(FIND EigenLapack_SRCS ${filename} id1) list(FIND EigenLapack_funcfilenames ${filename} id2) if((id1 EQUAL -1) AND (id2 EQUAL -1)) set(ReferenceLapack_SRCS ${ReferenceLapack_SRCS} reference/${filename}) endif() endforeach() endif() endif() endif() set(EIGEN_LAPACK_TARGETS "") add_library(eigen_lapack_static ${EigenLapack_SRCS} ${ReferenceLapack_SRCS}) list(APPEND EIGEN_LAPACK_TARGETS eigen_lapack_static) if (EIGEN_BUILD_SHARED_LIBS) add_library(eigen_lapack SHARED ${EigenLapack_SRCS}) list(APPEND EIGEN_LAPACK_TARGETS eigen_lapack) target_link_libraries(eigen_lapack eigen_blas) endif() foreach(target IN LISTS EIGEN_LAPACK_TARGETS) if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) target_link_libraries(${target} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}) endif() add_dependencies(lapack ${target}) install(TARGETS ${target} RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) endforeach() get_filename_component(eigen_full_path_to_testing_lapack "./testing/" ABSOLUTE) if(EXISTS ${eigen_full_path_to_testing_lapack}) # The following comes from lapack/TESTING/CMakeLists.txt # Get Python find_package(PythonInterp) message(STATUS "Looking for Python found - ${PYTHONINTERP_FOUND}") if (PYTHONINTERP_FOUND) message(STATUS "Using Python version ${PYTHON_VERSION_STRING}") endif() set(LAPACK_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(LAPACK_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(BUILD_SINGLE true) set(BUILD_DOUBLE true) set(BUILD_COMPLEX true) set(BUILD_COMPLEX16E true) if(MSVC_VERSION) # string(REPLACE "/STACK:10000000" "/STACK:900000000000000000" # CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") string(REGEX REPLACE "(.*)/STACK:(.*) (.*)" "\\1/STACK:900000000000000000 \\3" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") endif() file(MAKE_DIRECTORY "${LAPACK_BINARY_DIR}/TESTING") add_subdirectory(testing/MATGEN) add_subdirectory(testing/LIN) add_subdirectory(testing/EIG) macro(add_lapack_test output input target) set(TEST_INPUT "${LAPACK_SOURCE_DIR}/testing/${input}") set(TEST_OUTPUT "${LAPACK_BINARY_DIR}/TESTING/${output}") string(REPLACE "." "_" input_name ${input}) set(testName "${target}_${input_name}") if(EXISTS "${TEST_INPUT}") add_dependencies(buildtests ${target}) add_test(NAME LAPACK-${testName} COMMAND "${CMAKE_COMMAND}" -DTEST=$ -DINPUT=${TEST_INPUT} -DOUTPUT=${TEST_OUTPUT} -DINTDIR=${CMAKE_CFG_INTDIR} -P "${LAPACK_SOURCE_DIR}/testing/runtest.cmake") endif() endmacro() if (BUILD_SINGLE) add_lapack_test(stest.out stest.in xlintsts) # # ======== SINGLE RFP LIN TESTS ======================== add_lapack_test(stest_rfp.out stest_rfp.in xlintstrfs) # # # ======== SINGLE EIG TESTS =========================== # add_lapack_test(snep.out nep.in xeigtsts) add_lapack_test(ssep.out sep.in xeigtsts) add_lapack_test(ssvd.out svd.in xeigtsts) add_lapack_test(sec.out sec.in xeigtsts) add_lapack_test(sed.out sed.in xeigtsts) add_lapack_test(sgg.out sgg.in xeigtsts) add_lapack_test(sgd.out sgd.in xeigtsts) add_lapack_test(ssb.out ssb.in xeigtsts) add_lapack_test(ssg.out ssg.in xeigtsts) add_lapack_test(sbal.out sbal.in xeigtsts) add_lapack_test(sbak.out sbak.in xeigtsts) add_lapack_test(sgbal.out sgbal.in xeigtsts) add_lapack_test(sgbak.out sgbak.in xeigtsts) add_lapack_test(sbb.out sbb.in xeigtsts) add_lapack_test(sglm.out glm.in xeigtsts) add_lapack_test(sgqr.out gqr.in xeigtsts) add_lapack_test(sgsv.out gsv.in xeigtsts) add_lapack_test(scsd.out csd.in xeigtsts) add_lapack_test(slse.out lse.in xeigtsts) endif() if (BUILD_DOUBLE) # # ======== DOUBLE LIN TESTS =========================== add_lapack_test(dtest.out dtest.in xlintstd) # # ======== DOUBLE RFP LIN TESTS ======================== add_lapack_test(dtest_rfp.out dtest_rfp.in xlintstrfd) # # ======== DOUBLE EIG TESTS =========================== add_lapack_test(dnep.out nep.in xeigtstd) add_lapack_test(dsep.out sep.in xeigtstd) add_lapack_test(dsvd.out svd.in xeigtstd) add_lapack_test(dec.out dec.in xeigtstd) add_lapack_test(ded.out ded.in xeigtstd) add_lapack_test(dgg.out dgg.in xeigtstd) add_lapack_test(dgd.out dgd.in xeigtstd) add_lapack_test(dsb.out dsb.in xeigtstd) add_lapack_test(dsg.out dsg.in xeigtstd) add_lapack_test(dbal.out dbal.in xeigtstd) add_lapack_test(dbak.out dbak.in xeigtstd) add_lapack_test(dgbal.out dgbal.in xeigtstd) add_lapack_test(dgbak.out dgbak.in xeigtstd) add_lapack_test(dbb.out dbb.in xeigtstd) add_lapack_test(dglm.out glm.in xeigtstd) add_lapack_test(dgqr.out gqr.in xeigtstd) add_lapack_test(dgsv.out gsv.in xeigtstd) add_lapack_test(dcsd.out csd.in xeigtstd) add_lapack_test(dlse.out lse.in xeigtstd) endif() if (BUILD_COMPLEX) add_lapack_test(ctest.out ctest.in xlintstc) # # ======== COMPLEX RFP LIN TESTS ======================== add_lapack_test(ctest_rfp.out ctest_rfp.in xlintstrfc) # # ======== COMPLEX EIG TESTS =========================== add_lapack_test(cnep.out nep.in xeigtstc) add_lapack_test(csep.out sep.in xeigtstc) add_lapack_test(csvd.out svd.in xeigtstc) add_lapack_test(cec.out cec.in xeigtstc) add_lapack_test(ced.out ced.in xeigtstc) add_lapack_test(cgg.out cgg.in xeigtstc) add_lapack_test(cgd.out cgd.in xeigtstc) add_lapack_test(csb.out csb.in xeigtstc) add_lapack_test(csg.out csg.in xeigtstc) add_lapack_test(cbal.out cbal.in xeigtstc) add_lapack_test(cbak.out cbak.in xeigtstc) add_lapack_test(cgbal.out cgbal.in xeigtstc) add_lapack_test(cgbak.out cgbak.in xeigtstc) add_lapack_test(cbb.out cbb.in xeigtstc) add_lapack_test(cglm.out glm.in xeigtstc) add_lapack_test(cgqr.out gqr.in xeigtstc) add_lapack_test(cgsv.out gsv.in xeigtstc) add_lapack_test(ccsd.out csd.in xeigtstc) add_lapack_test(clse.out lse.in xeigtstc) endif() if (BUILD_COMPLEX16) # # ======== COMPLEX16 LIN TESTS ======================== add_lapack_test(ztest.out ztest.in xlintstz) # # ======== COMPLEX16 RFP LIN TESTS ======================== add_lapack_test(ztest_rfp.out ztest_rfp.in xlintstrfz) # # ======== COMPLEX16 EIG TESTS =========================== add_lapack_test(znep.out nep.in xeigtstz) add_lapack_test(zsep.out sep.in xeigtstz) add_lapack_test(zsvd.out svd.in xeigtstz) add_lapack_test(zec.out zec.in xeigtstz) add_lapack_test(zed.out zed.in xeigtstz) add_lapack_test(zgg.out zgg.in xeigtstz) add_lapack_test(zgd.out zgd.in xeigtstz) add_lapack_test(zsb.out zsb.in xeigtstz) add_lapack_test(zsg.out zsg.in xeigtstz) add_lapack_test(zbal.out zbal.in xeigtstz) add_lapack_test(zbak.out zbak.in xeigtstz) add_lapack_test(zgbal.out zgbal.in xeigtstz) add_lapack_test(zgbak.out zgbak.in xeigtstz) add_lapack_test(zbb.out zbb.in xeigtstz) add_lapack_test(zglm.out glm.in xeigtstz) add_lapack_test(zgqr.out gqr.in xeigtstz) add_lapack_test(zgsv.out gsv.in xeigtstz) add_lapack_test(zcsd.out csd.in xeigtstz) add_lapack_test(zlse.out lse.in xeigtstz) endif() if (BUILD_SIMPLE) if (BUILD_DOUBLE) # # ======== SINGLE-DOUBLE PROTO LIN TESTS ============== add_lapack_test(dstest.out dstest.in xlintstds) endif() endif() if (BUILD_COMPLEX) if (BUILD_COMPLEX16) # # ======== COMPLEX-COMPLEX16 LIN TESTS ======================== add_lapack_test(zctest.out zctest.in xlintstzc) endif() endif() # ============================================================================== execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${LAPACK_SOURCE_DIR}/testing/lapack_testing.py ${LAPACK_BINARY_DIR}) add_test( NAME LAPACK_Test_Summary WORKING_DIRECTORY ${LAPACK_BINARY_DIR} COMMAND ${PYTHON_EXECUTABLE} "lapack_testing.py" ) endif() ================================================ FILE: VO_Module/thirdparty/eigen/lapack/cholesky.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2010-2011 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "lapack_common.h" #include // POTRF computes the Cholesky factorization of a real symmetric positive definite matrix A. EIGEN_LAPACK_FUNC(potrf,(char* uplo, int *n, RealScalar *pa, int *lda, int *info)) { *info = 0; if(UPLO(*uplo)==INVALID) *info = -1; else if(*n<0) *info = -2; else if(*lda(pa); MatrixType A(a,*n,*n,*lda); int ret; if(UPLO(*uplo)==UP) ret = int(internal::llt_inplace::blocked(A)); else ret = int(internal::llt_inplace::blocked(A)); if(ret>=0) *info = ret+1; return 0; } // POTRS solves a system of linear equations A*X = B with a symmetric // positive definite matrix A using the Cholesky factorization // A = U**T*U or A = L*L**T computed by DPOTRF. EIGEN_LAPACK_FUNC(potrs,(char* uplo, int *n, int *nrhs, RealScalar *pa, int *lda, RealScalar *pb, int *ldb, int *info)) { *info = 0; if(UPLO(*uplo)==INVALID) *info = -1; else if(*n<0) *info = -2; else if(*nrhs<0) *info = -3; else if(*lda(pa); Scalar* b = reinterpret_cast(pb); MatrixType A(a,*n,*n,*lda); MatrixType B(b,*n,*nrhs,*ldb); if(UPLO(*uplo)==UP) { A.triangularView().adjoint().solveInPlace(B); A.triangularView().solveInPlace(B); } else { A.triangularView().solveInPlace(B); A.triangularView().adjoint().solveInPlace(B); } return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/lapack/clacgv.f ================================================ *> \brief \b CLACGV * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download CLACGV + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE CLACGV( N, X, INCX ) * * .. Scalar Arguments .. * INTEGER INCX, N * .. * .. Array Arguments .. * COMPLEX X( * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> CLACGV conjugates a complex vector of length N. *> \endverbatim * * Arguments: * ========== * *> \param[in] N *> \verbatim *> N is INTEGER *> The length of the vector X. N >= 0. *> \endverbatim *> *> \param[in,out] X *> \verbatim *> X is COMPLEX array, dimension *> (1+(N-1)*abs(INCX)) *> On entry, the vector of length N to be conjugated. *> On exit, X is overwritten with conjg(X). *> \endverbatim *> *> \param[in] INCX *> \verbatim *> INCX is INTEGER *> The spacing between successive elements of X. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup complexOTHERauxiliary * * ===================================================================== SUBROUTINE CLACGV( N, X, INCX ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. INTEGER INCX, N * .. * .. Array Arguments .. COMPLEX X( * ) * .. * * ===================================================================== * * .. Local Scalars .. INTEGER I, IOFF * .. * .. Intrinsic Functions .. INTRINSIC CONJG * .. * .. Executable Statements .. * IF( INCX.EQ.1 ) THEN DO 10 I = 1, N X( I ) = CONJG( X( I ) ) 10 CONTINUE ELSE IOFF = 1 IF( INCX.LT.0 ) $ IOFF = 1 - ( N-1 )*INCX DO 20 I = 1, N X( IOFF ) = CONJG( X( IOFF ) ) IOFF = IOFF + INCX 20 CONTINUE END IF RETURN * * End of CLACGV * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/cladiv.f ================================================ *> \brief \b CLADIV * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download CLADIV + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * COMPLEX FUNCTION CLADIV( X, Y ) * * .. Scalar Arguments .. * COMPLEX X, Y * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> CLADIV := X / Y, where X and Y are complex. The computation of X / Y *> will not overflow on an intermediary step unless the results *> overflows. *> \endverbatim * * Arguments: * ========== * *> \param[in] X *> \verbatim *> X is COMPLEX *> \endverbatim *> *> \param[in] Y *> \verbatim *> Y is COMPLEX *> The complex scalars X and Y. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup complexOTHERauxiliary * * ===================================================================== COMPLEX FUNCTION CLADIV( X, Y ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. COMPLEX X, Y * .. * * ===================================================================== * * .. Local Scalars .. REAL ZI, ZR * .. * .. External Subroutines .. EXTERNAL SLADIV * .. * .. Intrinsic Functions .. INTRINSIC AIMAG, CMPLX, REAL * .. * .. Executable Statements .. * CALL SLADIV( REAL( X ), AIMAG( X ), REAL( Y ), AIMAG( Y ), ZR, $ ZI ) CLADIV = CMPLX( ZR, ZI ) * RETURN * * End of CLADIV * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/clarf.f ================================================ *> \brief \b CLARF * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download CLARF + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE CLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK ) * * .. Scalar Arguments .. * CHARACTER SIDE * INTEGER INCV, LDC, M, N * COMPLEX TAU * .. * .. Array Arguments .. * COMPLEX C( LDC, * ), V( * ), WORK( * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> CLARF applies a complex elementary reflector H to a complex M-by-N *> matrix C, from either the left or the right. H is represented in the *> form *> *> H = I - tau * v * v**H *> *> where tau is a complex scalar and v is a complex vector. *> *> If tau = 0, then H is taken to be the unit matrix. *> *> To apply H**H (the conjugate transpose of H), supply conjg(tau) instead *> tau. *> \endverbatim * * Arguments: * ========== * *> \param[in] SIDE *> \verbatim *> SIDE is CHARACTER*1 *> = 'L': form H * C *> = 'R': form C * H *> \endverbatim *> *> \param[in] M *> \verbatim *> M is INTEGER *> The number of rows of the matrix C. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The number of columns of the matrix C. *> \endverbatim *> *> \param[in] V *> \verbatim *> V is COMPLEX array, dimension *> (1 + (M-1)*abs(INCV)) if SIDE = 'L' *> or (1 + (N-1)*abs(INCV)) if SIDE = 'R' *> The vector v in the representation of H. V is not used if *> TAU = 0. *> \endverbatim *> *> \param[in] INCV *> \verbatim *> INCV is INTEGER *> The increment between elements of v. INCV <> 0. *> \endverbatim *> *> \param[in] TAU *> \verbatim *> TAU is COMPLEX *> The value tau in the representation of H. *> \endverbatim *> *> \param[in,out] C *> \verbatim *> C is COMPLEX array, dimension (LDC,N) *> On entry, the M-by-N matrix C. *> On exit, C is overwritten by the matrix H * C if SIDE = 'L', *> or C * H if SIDE = 'R'. *> \endverbatim *> *> \param[in] LDC *> \verbatim *> LDC is INTEGER *> The leading dimension of the array C. LDC >= max(1,M). *> \endverbatim *> *> \param[out] WORK *> \verbatim *> WORK is COMPLEX array, dimension *> (N) if SIDE = 'L' *> or (M) if SIDE = 'R' *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup complexOTHERauxiliary * * ===================================================================== SUBROUTINE CLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. CHARACTER SIDE INTEGER INCV, LDC, M, N COMPLEX TAU * .. * .. Array Arguments .. COMPLEX C( LDC, * ), V( * ), WORK( * ) * .. * * ===================================================================== * * .. Parameters .. COMPLEX ONE, ZERO PARAMETER ( ONE = ( 1.0E+0, 0.0E+0 ), $ ZERO = ( 0.0E+0, 0.0E+0 ) ) * .. * .. Local Scalars .. LOGICAL APPLYLEFT INTEGER I, LASTV, LASTC * .. * .. External Subroutines .. EXTERNAL CGEMV, CGERC * .. * .. External Functions .. LOGICAL LSAME INTEGER ILACLR, ILACLC EXTERNAL LSAME, ILACLR, ILACLC * .. * .. Executable Statements .. * APPLYLEFT = LSAME( SIDE, 'L' ) LASTV = 0 LASTC = 0 IF( TAU.NE.ZERO ) THEN ! Set up variables for scanning V. LASTV begins pointing to the end ! of V. IF( APPLYLEFT ) THEN LASTV = M ELSE LASTV = N END IF IF( INCV.GT.0 ) THEN I = 1 + (LASTV-1) * INCV ELSE I = 1 END IF ! Look for the last non-zero row in V. DO WHILE( LASTV.GT.0 .AND. V( I ).EQ.ZERO ) LASTV = LASTV - 1 I = I - INCV END DO IF( APPLYLEFT ) THEN ! Scan for the last non-zero column in C(1:lastv,:). LASTC = ILACLC(LASTV, N, C, LDC) ELSE ! Scan for the last non-zero row in C(:,1:lastv). LASTC = ILACLR(M, LASTV, C, LDC) END IF END IF ! Note that lastc.eq.0 renders the BLAS operations null; no special ! case is needed at this level. IF( APPLYLEFT ) THEN * * Form H * C * IF( LASTV.GT.0 ) THEN * * w(1:lastc,1) := C(1:lastv,1:lastc)**H * v(1:lastv,1) * CALL CGEMV( 'Conjugate transpose', LASTV, LASTC, ONE, $ C, LDC, V, INCV, ZERO, WORK, 1 ) * * C(1:lastv,1:lastc) := C(...) - v(1:lastv,1) * w(1:lastc,1)**H * CALL CGERC( LASTV, LASTC, -TAU, V, INCV, WORK, 1, C, LDC ) END IF ELSE * * Form C * H * IF( LASTV.GT.0 ) THEN * * w(1:lastc,1) := C(1:lastc,1:lastv) * v(1:lastv,1) * CALL CGEMV( 'No transpose', LASTC, LASTV, ONE, C, LDC, $ V, INCV, ZERO, WORK, 1 ) * * C(1:lastc,1:lastv) := C(...) - w(1:lastc,1) * v(1:lastv,1)**H * CALL CGERC( LASTC, LASTV, -TAU, WORK, 1, V, INCV, C, LDC ) END IF END IF RETURN * * End of CLARF * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/clarfb.f ================================================ *> \brief \b CLARFB * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download CLARFB + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE CLARFB( SIDE, TRANS, DIRECT, STOREV, M, N, K, V, LDV, * T, LDT, C, LDC, WORK, LDWORK ) * * .. Scalar Arguments .. * CHARACTER DIRECT, SIDE, STOREV, TRANS * INTEGER K, LDC, LDT, LDV, LDWORK, M, N * .. * .. Array Arguments .. * COMPLEX C( LDC, * ), T( LDT, * ), V( LDV, * ), * $ WORK( LDWORK, * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> CLARFB applies a complex block reflector H or its transpose H**H to a *> complex M-by-N matrix C, from either the left or the right. *> \endverbatim * * Arguments: * ========== * *> \param[in] SIDE *> \verbatim *> SIDE is CHARACTER*1 *> = 'L': apply H or H**H from the Left *> = 'R': apply H or H**H from the Right *> \endverbatim *> *> \param[in] TRANS *> \verbatim *> TRANS is CHARACTER*1 *> = 'N': apply H (No transpose) *> = 'C': apply H**H (Conjugate transpose) *> \endverbatim *> *> \param[in] DIRECT *> \verbatim *> DIRECT is CHARACTER*1 *> Indicates how H is formed from a product of elementary *> reflectors *> = 'F': H = H(1) H(2) . . . H(k) (Forward) *> = 'B': H = H(k) . . . H(2) H(1) (Backward) *> \endverbatim *> *> \param[in] STOREV *> \verbatim *> STOREV is CHARACTER*1 *> Indicates how the vectors which define the elementary *> reflectors are stored: *> = 'C': Columnwise *> = 'R': Rowwise *> \endverbatim *> *> \param[in] M *> \verbatim *> M is INTEGER *> The number of rows of the matrix C. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The number of columns of the matrix C. *> \endverbatim *> *> \param[in] K *> \verbatim *> K is INTEGER *> The order of the matrix T (= the number of elementary *> reflectors whose product defines the block reflector). *> \endverbatim *> *> \param[in] V *> \verbatim *> V is COMPLEX array, dimension *> (LDV,K) if STOREV = 'C' *> (LDV,M) if STOREV = 'R' and SIDE = 'L' *> (LDV,N) if STOREV = 'R' and SIDE = 'R' *> The matrix V. See Further Details. *> \endverbatim *> *> \param[in] LDV *> \verbatim *> LDV is INTEGER *> The leading dimension of the array V. *> If STOREV = 'C' and SIDE = 'L', LDV >= max(1,M); *> if STOREV = 'C' and SIDE = 'R', LDV >= max(1,N); *> if STOREV = 'R', LDV >= K. *> \endverbatim *> *> \param[in] T *> \verbatim *> T is COMPLEX array, dimension (LDT,K) *> The triangular K-by-K matrix T in the representation of the *> block reflector. *> \endverbatim *> *> \param[in] LDT *> \verbatim *> LDT is INTEGER *> The leading dimension of the array T. LDT >= K. *> \endverbatim *> *> \param[in,out] C *> \verbatim *> C is COMPLEX array, dimension (LDC,N) *> On entry, the M-by-N matrix C. *> On exit, C is overwritten by H*C or H**H*C or C*H or C*H**H. *> \endverbatim *> *> \param[in] LDC *> \verbatim *> LDC is INTEGER *> The leading dimension of the array C. LDC >= max(1,M). *> \endverbatim *> *> \param[out] WORK *> \verbatim *> WORK is COMPLEX array, dimension (LDWORK,K) *> \endverbatim *> *> \param[in] LDWORK *> \verbatim *> LDWORK is INTEGER *> The leading dimension of the array WORK. *> If SIDE = 'L', LDWORK >= max(1,N); *> if SIDE = 'R', LDWORK >= max(1,M). *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup complexOTHERauxiliary * *> \par Further Details: * ===================== *> *> \verbatim *> *> The shape of the matrix V and the storage of the vectors which define *> the H(i) is best illustrated by the following example with n = 5 and *> k = 3. The elements equal to 1 are not stored; the corresponding *> array elements are modified but restored on exit. The rest of the *> array is not used. *> *> DIRECT = 'F' and STOREV = 'C': DIRECT = 'F' and STOREV = 'R': *> *> V = ( 1 ) V = ( 1 v1 v1 v1 v1 ) *> ( v1 1 ) ( 1 v2 v2 v2 ) *> ( v1 v2 1 ) ( 1 v3 v3 ) *> ( v1 v2 v3 ) *> ( v1 v2 v3 ) *> *> DIRECT = 'B' and STOREV = 'C': DIRECT = 'B' and STOREV = 'R': *> *> V = ( v1 v2 v3 ) V = ( v1 v1 1 ) *> ( v1 v2 v3 ) ( v2 v2 v2 1 ) *> ( 1 v2 v3 ) ( v3 v3 v3 v3 1 ) *> ( 1 v3 ) *> ( 1 ) *> \endverbatim *> * ===================================================================== SUBROUTINE CLARFB( SIDE, TRANS, DIRECT, STOREV, M, N, K, V, LDV, $ T, LDT, C, LDC, WORK, LDWORK ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. CHARACTER DIRECT, SIDE, STOREV, TRANS INTEGER K, LDC, LDT, LDV, LDWORK, M, N * .. * .. Array Arguments .. COMPLEX C( LDC, * ), T( LDT, * ), V( LDV, * ), $ WORK( LDWORK, * ) * .. * * ===================================================================== * * .. Parameters .. COMPLEX ONE PARAMETER ( ONE = ( 1.0E+0, 0.0E+0 ) ) * .. * .. Local Scalars .. CHARACTER TRANST INTEGER I, J, LASTV, LASTC * .. * .. External Functions .. LOGICAL LSAME INTEGER ILACLR, ILACLC EXTERNAL LSAME, ILACLR, ILACLC * .. * .. External Subroutines .. EXTERNAL CCOPY, CGEMM, CLACGV, CTRMM * .. * .. Intrinsic Functions .. INTRINSIC CONJG * .. * .. Executable Statements .. * * Quick return if possible * IF( M.LE.0 .OR. N.LE.0 ) $ RETURN * IF( LSAME( TRANS, 'N' ) ) THEN TRANST = 'C' ELSE TRANST = 'N' END IF * IF( LSAME( STOREV, 'C' ) ) THEN * IF( LSAME( DIRECT, 'F' ) ) THEN * * Let V = ( V1 ) (first K rows) * ( V2 ) * where V1 is unit lower triangular. * IF( LSAME( SIDE, 'L' ) ) THEN * * Form H * C or H**H * C where C = ( C1 ) * ( C2 ) * LASTV = MAX( K, ILACLR( M, K, V, LDV ) ) LASTC = ILACLC( LASTV, N, C, LDC ) * * W := C**H * V = (C1**H * V1 + C2**H * V2) (stored in WORK) * * W := C1**H * DO 10 J = 1, K CALL CCOPY( LASTC, C( J, 1 ), LDC, WORK( 1, J ), 1 ) CALL CLACGV( LASTC, WORK( 1, J ), 1 ) 10 CONTINUE * * W := W * V1 * CALL CTRMM( 'Right', 'Lower', 'No transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C2**H *V2 * CALL CGEMM( 'Conjugate transpose', 'No transpose', $ LASTC, K, LASTV-K, ONE, C( K+1, 1 ), LDC, $ V( K+1, 1 ), LDV, ONE, WORK, LDWORK ) END IF * * W := W * T**H or W * T * CALL CTRMM( 'Right', 'Upper', TRANST, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - V * W**H * IF( M.GT.K ) THEN * * C2 := C2 - V2 * W**H * CALL CGEMM( 'No transpose', 'Conjugate transpose', $ LASTV-K, LASTC, K, -ONE, V( K+1, 1 ), LDV, $ WORK, LDWORK, ONE, C( K+1, 1 ), LDC ) END IF * * W := W * V1**H * CALL CTRMM( 'Right', 'Lower', 'Conjugate transpose', $ 'Unit', LASTC, K, ONE, V, LDV, WORK, LDWORK ) * * C1 := C1 - W**H * DO 30 J = 1, K DO 20 I = 1, LASTC C( J, I ) = C( J, I ) - CONJG( WORK( I, J ) ) 20 CONTINUE 30 CONTINUE * ELSE IF( LSAME( SIDE, 'R' ) ) THEN * * Form C * H or C * H**H where C = ( C1 C2 ) * LASTV = MAX( K, ILACLR( N, K, V, LDV ) ) LASTC = ILACLR( M, LASTV, C, LDC ) * * W := C * V = (C1*V1 + C2*V2) (stored in WORK) * * W := C1 * DO 40 J = 1, K CALL CCOPY( LASTC, C( 1, J ), 1, WORK( 1, J ), 1 ) 40 CONTINUE * * W := W * V1 * CALL CTRMM( 'Right', 'Lower', 'No transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C2 * V2 * CALL CGEMM( 'No transpose', 'No transpose', $ LASTC, K, LASTV-K, $ ONE, C( 1, K+1 ), LDC, V( K+1, 1 ), LDV, $ ONE, WORK, LDWORK ) END IF * * W := W * T or W * T**H * CALL CTRMM( 'Right', 'Upper', TRANS, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - W * V**H * IF( LASTV.GT.K ) THEN * * C2 := C2 - W * V2**H * CALL CGEMM( 'No transpose', 'Conjugate transpose', $ LASTC, LASTV-K, K, $ -ONE, WORK, LDWORK, V( K+1, 1 ), LDV, $ ONE, C( 1, K+1 ), LDC ) END IF * * W := W * V1**H * CALL CTRMM( 'Right', 'Lower', 'Conjugate transpose', $ 'Unit', LASTC, K, ONE, V, LDV, WORK, LDWORK ) * * C1 := C1 - W * DO 60 J = 1, K DO 50 I = 1, LASTC C( I, J ) = C( I, J ) - WORK( I, J ) 50 CONTINUE 60 CONTINUE END IF * ELSE * * Let V = ( V1 ) * ( V2 ) (last K rows) * where V2 is unit upper triangular. * IF( LSAME( SIDE, 'L' ) ) THEN * * Form H * C or H**H * C where C = ( C1 ) * ( C2 ) * LASTV = MAX( K, ILACLR( M, K, V, LDV ) ) LASTC = ILACLC( LASTV, N, C, LDC ) * * W := C**H * V = (C1**H * V1 + C2**H * V2) (stored in WORK) * * W := C2**H * DO 70 J = 1, K CALL CCOPY( LASTC, C( LASTV-K+J, 1 ), LDC, $ WORK( 1, J ), 1 ) CALL CLACGV( LASTC, WORK( 1, J ), 1 ) 70 CONTINUE * * W := W * V2 * CALL CTRMM( 'Right', 'Upper', 'No transpose', 'Unit', $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, $ WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C1**H*V1 * CALL CGEMM( 'Conjugate transpose', 'No transpose', $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, $ ONE, WORK, LDWORK ) END IF * * W := W * T**H or W * T * CALL CTRMM( 'Right', 'Lower', TRANST, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - V * W**H * IF( LASTV.GT.K ) THEN * * C1 := C1 - V1 * W**H * CALL CGEMM( 'No transpose', 'Conjugate transpose', $ LASTV-K, LASTC, K, -ONE, V, LDV, WORK, LDWORK, $ ONE, C, LDC ) END IF * * W := W * V2**H * CALL CTRMM( 'Right', 'Upper', 'Conjugate transpose', $ 'Unit', LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, $ WORK, LDWORK ) * * C2 := C2 - W**H * DO 90 J = 1, K DO 80 I = 1, LASTC C( LASTV-K+J, I ) = C( LASTV-K+J, I ) - $ CONJG( WORK( I, J ) ) 80 CONTINUE 90 CONTINUE * ELSE IF( LSAME( SIDE, 'R' ) ) THEN * * Form C * H or C * H**H where C = ( C1 C2 ) * LASTV = MAX( K, ILACLR( N, K, V, LDV ) ) LASTC = ILACLR( M, LASTV, C, LDC ) * * W := C * V = (C1*V1 + C2*V2) (stored in WORK) * * W := C2 * DO 100 J = 1, K CALL CCOPY( LASTC, C( 1, LASTV-K+J ), 1, $ WORK( 1, J ), 1 ) 100 CONTINUE * * W := W * V2 * CALL CTRMM( 'Right', 'Upper', 'No transpose', 'Unit', $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, $ WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C1 * V1 * CALL CGEMM( 'No transpose', 'No transpose', $ LASTC, K, LASTV-K, $ ONE, C, LDC, V, LDV, ONE, WORK, LDWORK ) END IF * * W := W * T or W * T**H * CALL CTRMM( 'Right', 'Lower', TRANS, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - W * V**H * IF( LASTV.GT.K ) THEN * * C1 := C1 - W * V1**H * CALL CGEMM( 'No transpose', 'Conjugate transpose', $ LASTC, LASTV-K, K, -ONE, WORK, LDWORK, V, LDV, $ ONE, C, LDC ) END IF * * W := W * V2**H * CALL CTRMM( 'Right', 'Upper', 'Conjugate transpose', $ 'Unit', LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, $ WORK, LDWORK ) * * C2 := C2 - W * DO 120 J = 1, K DO 110 I = 1, LASTC C( I, LASTV-K+J ) = C( I, LASTV-K+J ) $ - WORK( I, J ) 110 CONTINUE 120 CONTINUE END IF END IF * ELSE IF( LSAME( STOREV, 'R' ) ) THEN * IF( LSAME( DIRECT, 'F' ) ) THEN * * Let V = ( V1 V2 ) (V1: first K columns) * where V1 is unit upper triangular. * IF( LSAME( SIDE, 'L' ) ) THEN * * Form H * C or H**H * C where C = ( C1 ) * ( C2 ) * LASTV = MAX( K, ILACLC( K, M, V, LDV ) ) LASTC = ILACLC( LASTV, N, C, LDC ) * * W := C**H * V**H = (C1**H * V1**H + C2**H * V2**H) (stored in WORK) * * W := C1**H * DO 130 J = 1, K CALL CCOPY( LASTC, C( J, 1 ), LDC, WORK( 1, J ), 1 ) CALL CLACGV( LASTC, WORK( 1, J ), 1 ) 130 CONTINUE * * W := W * V1**H * CALL CTRMM( 'Right', 'Upper', 'Conjugate transpose', $ 'Unit', LASTC, K, ONE, V, LDV, WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C2**H*V2**H * CALL CGEMM( 'Conjugate transpose', $ 'Conjugate transpose', LASTC, K, LASTV-K, $ ONE, C( K+1, 1 ), LDC, V( 1, K+1 ), LDV, $ ONE, WORK, LDWORK ) END IF * * W := W * T**H or W * T * CALL CTRMM( 'Right', 'Upper', TRANST, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - V**H * W**H * IF( LASTV.GT.K ) THEN * * C2 := C2 - V2**H * W**H * CALL CGEMM( 'Conjugate transpose', $ 'Conjugate transpose', LASTV-K, LASTC, K, $ -ONE, V( 1, K+1 ), LDV, WORK, LDWORK, $ ONE, C( K+1, 1 ), LDC ) END IF * * W := W * V1 * CALL CTRMM( 'Right', 'Upper', 'No transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) * * C1 := C1 - W**H * DO 150 J = 1, K DO 140 I = 1, LASTC C( J, I ) = C( J, I ) - CONJG( WORK( I, J ) ) 140 CONTINUE 150 CONTINUE * ELSE IF( LSAME( SIDE, 'R' ) ) THEN * * Form C * H or C * H**H where C = ( C1 C2 ) * LASTV = MAX( K, ILACLC( K, N, V, LDV ) ) LASTC = ILACLR( M, LASTV, C, LDC ) * * W := C * V**H = (C1*V1**H + C2*V2**H) (stored in WORK) * * W := C1 * DO 160 J = 1, K CALL CCOPY( LASTC, C( 1, J ), 1, WORK( 1, J ), 1 ) 160 CONTINUE * * W := W * V1**H * CALL CTRMM( 'Right', 'Upper', 'Conjugate transpose', $ 'Unit', LASTC, K, ONE, V, LDV, WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C2 * V2**H * CALL CGEMM( 'No transpose', 'Conjugate transpose', $ LASTC, K, LASTV-K, ONE, C( 1, K+1 ), LDC, $ V( 1, K+1 ), LDV, ONE, WORK, LDWORK ) END IF * * W := W * T or W * T**H * CALL CTRMM( 'Right', 'Upper', TRANS, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - W * V * IF( LASTV.GT.K ) THEN * * C2 := C2 - W * V2 * CALL CGEMM( 'No transpose', 'No transpose', $ LASTC, LASTV-K, K, $ -ONE, WORK, LDWORK, V( 1, K+1 ), LDV, $ ONE, C( 1, K+1 ), LDC ) END IF * * W := W * V1 * CALL CTRMM( 'Right', 'Upper', 'No transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) * * C1 := C1 - W * DO 180 J = 1, K DO 170 I = 1, LASTC C( I, J ) = C( I, J ) - WORK( I, J ) 170 CONTINUE 180 CONTINUE * END IF * ELSE * * Let V = ( V1 V2 ) (V2: last K columns) * where V2 is unit lower triangular. * IF( LSAME( SIDE, 'L' ) ) THEN * * Form H * C or H**H * C where C = ( C1 ) * ( C2 ) * LASTV = MAX( K, ILACLC( K, M, V, LDV ) ) LASTC = ILACLC( LASTV, N, C, LDC ) * * W := C**H * V**H = (C1**H * V1**H + C2**H * V2**H) (stored in WORK) * * W := C2**H * DO 190 J = 1, K CALL CCOPY( LASTC, C( LASTV-K+J, 1 ), LDC, $ WORK( 1, J ), 1 ) CALL CLACGV( LASTC, WORK( 1, J ), 1 ) 190 CONTINUE * * W := W * V2**H * CALL CTRMM( 'Right', 'Lower', 'Conjugate transpose', $ 'Unit', LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, $ WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C1**H * V1**H * CALL CGEMM( 'Conjugate transpose', $ 'Conjugate transpose', LASTC, K, LASTV-K, $ ONE, C, LDC, V, LDV, ONE, WORK, LDWORK ) END IF * * W := W * T**H or W * T * CALL CTRMM( 'Right', 'Lower', TRANST, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - V**H * W**H * IF( LASTV.GT.K ) THEN * * C1 := C1 - V1**H * W**H * CALL CGEMM( 'Conjugate transpose', $ 'Conjugate transpose', LASTV-K, LASTC, K, $ -ONE, V, LDV, WORK, LDWORK, ONE, C, LDC ) END IF * * W := W * V2 * CALL CTRMM( 'Right', 'Lower', 'No transpose', 'Unit', $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, $ WORK, LDWORK ) * * C2 := C2 - W**H * DO 210 J = 1, K DO 200 I = 1, LASTC C( LASTV-K+J, I ) = C( LASTV-K+J, I ) - $ CONJG( WORK( I, J ) ) 200 CONTINUE 210 CONTINUE * ELSE IF( LSAME( SIDE, 'R' ) ) THEN * * Form C * H or C * H**H where C = ( C1 C2 ) * LASTV = MAX( K, ILACLC( K, N, V, LDV ) ) LASTC = ILACLR( M, LASTV, C, LDC ) * * W := C * V**H = (C1*V1**H + C2*V2**H) (stored in WORK) * * W := C2 * DO 220 J = 1, K CALL CCOPY( LASTC, C( 1, LASTV-K+J ), 1, $ WORK( 1, J ), 1 ) 220 CONTINUE * * W := W * V2**H * CALL CTRMM( 'Right', 'Lower', 'Conjugate transpose', $ 'Unit', LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, $ WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C1 * V1**H * CALL CGEMM( 'No transpose', 'Conjugate transpose', $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, ONE, $ WORK, LDWORK ) END IF * * W := W * T or W * T**H * CALL CTRMM( 'Right', 'Lower', TRANS, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - W * V * IF( LASTV.GT.K ) THEN * * C1 := C1 - W * V1 * CALL CGEMM( 'No transpose', 'No transpose', $ LASTC, LASTV-K, K, -ONE, WORK, LDWORK, V, LDV, $ ONE, C, LDC ) END IF * * W := W * V2 * CALL CTRMM( 'Right', 'Lower', 'No transpose', 'Unit', $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, $ WORK, LDWORK ) * * C1 := C1 - W * DO 240 J = 1, K DO 230 I = 1, LASTC C( I, LASTV-K+J ) = C( I, LASTV-K+J ) $ - WORK( I, J ) 230 CONTINUE 240 CONTINUE * END IF * END IF END IF * RETURN * * End of CLARFB * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/clarfg.f ================================================ *> \brief \b CLARFG * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download CLARFG + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE CLARFG( N, ALPHA, X, INCX, TAU ) * * .. Scalar Arguments .. * INTEGER INCX, N * COMPLEX ALPHA, TAU * .. * .. Array Arguments .. * COMPLEX X( * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> CLARFG generates a complex elementary reflector H of order n, such *> that *> *> H**H * ( alpha ) = ( beta ), H**H * H = I. *> ( x ) ( 0 ) *> *> where alpha and beta are scalars, with beta real, and x is an *> (n-1)-element complex vector. H is represented in the form *> *> H = I - tau * ( 1 ) * ( 1 v**H ) , *> ( v ) *> *> where tau is a complex scalar and v is a complex (n-1)-element *> vector. Note that H is not hermitian. *> *> If the elements of x are all zero and alpha is real, then tau = 0 *> and H is taken to be the unit matrix. *> *> Otherwise 1 <= real(tau) <= 2 and abs(tau-1) <= 1 . *> \endverbatim * * Arguments: * ========== * *> \param[in] N *> \verbatim *> N is INTEGER *> The order of the elementary reflector. *> \endverbatim *> *> \param[in,out] ALPHA *> \verbatim *> ALPHA is COMPLEX *> On entry, the value alpha. *> On exit, it is overwritten with the value beta. *> \endverbatim *> *> \param[in,out] X *> \verbatim *> X is COMPLEX array, dimension *> (1+(N-2)*abs(INCX)) *> On entry, the vector x. *> On exit, it is overwritten with the vector v. *> \endverbatim *> *> \param[in] INCX *> \verbatim *> INCX is INTEGER *> The increment between elements of X. INCX > 0. *> \endverbatim *> *> \param[out] TAU *> \verbatim *> TAU is COMPLEX *> The value tau. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup complexOTHERauxiliary * * ===================================================================== SUBROUTINE CLARFG( N, ALPHA, X, INCX, TAU ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. INTEGER INCX, N COMPLEX ALPHA, TAU * .. * .. Array Arguments .. COMPLEX X( * ) * .. * * ===================================================================== * * .. Parameters .. REAL ONE, ZERO PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 ) * .. * .. Local Scalars .. INTEGER J, KNT REAL ALPHI, ALPHR, BETA, RSAFMN, SAFMIN, XNORM * .. * .. External Functions .. REAL SCNRM2, SLAMCH, SLAPY3 COMPLEX CLADIV EXTERNAL SCNRM2, SLAMCH, SLAPY3, CLADIV * .. * .. Intrinsic Functions .. INTRINSIC ABS, AIMAG, CMPLX, REAL, SIGN * .. * .. External Subroutines .. EXTERNAL CSCAL, CSSCAL * .. * .. Executable Statements .. * IF( N.LE.0 ) THEN TAU = ZERO RETURN END IF * XNORM = SCNRM2( N-1, X, INCX ) ALPHR = REAL( ALPHA ) ALPHI = AIMAG( ALPHA ) * IF( XNORM.EQ.ZERO .AND. ALPHI.EQ.ZERO ) THEN * * H = I * TAU = ZERO ELSE * * general case * BETA = -SIGN( SLAPY3( ALPHR, ALPHI, XNORM ), ALPHR ) SAFMIN = SLAMCH( 'S' ) / SLAMCH( 'E' ) RSAFMN = ONE / SAFMIN * KNT = 0 IF( ABS( BETA ).LT.SAFMIN ) THEN * * XNORM, BETA may be inaccurate; scale X and recompute them * 10 CONTINUE KNT = KNT + 1 CALL CSSCAL( N-1, RSAFMN, X, INCX ) BETA = BETA*RSAFMN ALPHI = ALPHI*RSAFMN ALPHR = ALPHR*RSAFMN IF( ABS( BETA ).LT.SAFMIN ) $ GO TO 10 * * New BETA is at most 1, at least SAFMIN * XNORM = SCNRM2( N-1, X, INCX ) ALPHA = CMPLX( ALPHR, ALPHI ) BETA = -SIGN( SLAPY3( ALPHR, ALPHI, XNORM ), ALPHR ) END IF TAU = CMPLX( ( BETA-ALPHR ) / BETA, -ALPHI / BETA ) ALPHA = CLADIV( CMPLX( ONE ), ALPHA-BETA ) CALL CSCAL( N-1, ALPHA, X, INCX ) * * If ALPHA is subnormal, it may lose relative accuracy * DO 20 J = 1, KNT BETA = BETA*SAFMIN 20 CONTINUE ALPHA = BETA END IF * RETURN * * End of CLARFG * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/clarft.f ================================================ *> \brief \b CLARFT * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download CLARFT + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE CLARFT( DIRECT, STOREV, N, K, V, LDV, TAU, T, LDT ) * * .. Scalar Arguments .. * CHARACTER DIRECT, STOREV * INTEGER K, LDT, LDV, N * .. * .. Array Arguments .. * COMPLEX T( LDT, * ), TAU( * ), V( LDV, * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> CLARFT forms the triangular factor T of a complex block reflector H *> of order n, which is defined as a product of k elementary reflectors. *> *> If DIRECT = 'F', H = H(1) H(2) . . . H(k) and T is upper triangular; *> *> If DIRECT = 'B', H = H(k) . . . H(2) H(1) and T is lower triangular. *> *> If STOREV = 'C', the vector which defines the elementary reflector *> H(i) is stored in the i-th column of the array V, and *> *> H = I - V * T * V**H *> *> If STOREV = 'R', the vector which defines the elementary reflector *> H(i) is stored in the i-th row of the array V, and *> *> H = I - V**H * T * V *> \endverbatim * * Arguments: * ========== * *> \param[in] DIRECT *> \verbatim *> DIRECT is CHARACTER*1 *> Specifies the order in which the elementary reflectors are *> multiplied to form the block reflector: *> = 'F': H = H(1) H(2) . . . H(k) (Forward) *> = 'B': H = H(k) . . . H(2) H(1) (Backward) *> \endverbatim *> *> \param[in] STOREV *> \verbatim *> STOREV is CHARACTER*1 *> Specifies how the vectors which define the elementary *> reflectors are stored (see also Further Details): *> = 'C': columnwise *> = 'R': rowwise *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The order of the block reflector H. N >= 0. *> \endverbatim *> *> \param[in] K *> \verbatim *> K is INTEGER *> The order of the triangular factor T (= the number of *> elementary reflectors). K >= 1. *> \endverbatim *> *> \param[in] V *> \verbatim *> V is COMPLEX array, dimension *> (LDV,K) if STOREV = 'C' *> (LDV,N) if STOREV = 'R' *> The matrix V. See further details. *> \endverbatim *> *> \param[in] LDV *> \verbatim *> LDV is INTEGER *> The leading dimension of the array V. *> If STOREV = 'C', LDV >= max(1,N); if STOREV = 'R', LDV >= K. *> \endverbatim *> *> \param[in] TAU *> \verbatim *> TAU is COMPLEX array, dimension (K) *> TAU(i) must contain the scalar factor of the elementary *> reflector H(i). *> \endverbatim *> *> \param[out] T *> \verbatim *> T is COMPLEX array, dimension (LDT,K) *> The k by k triangular factor T of the block reflector. *> If DIRECT = 'F', T is upper triangular; if DIRECT = 'B', T is *> lower triangular. The rest of the array is not used. *> \endverbatim *> *> \param[in] LDT *> \verbatim *> LDT is INTEGER *> The leading dimension of the array T. LDT >= K. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date April 2012 * *> \ingroup complexOTHERauxiliary * *> \par Further Details: * ===================== *> *> \verbatim *> *> The shape of the matrix V and the storage of the vectors which define *> the H(i) is best illustrated by the following example with n = 5 and *> k = 3. The elements equal to 1 are not stored. *> *> DIRECT = 'F' and STOREV = 'C': DIRECT = 'F' and STOREV = 'R': *> *> V = ( 1 ) V = ( 1 v1 v1 v1 v1 ) *> ( v1 1 ) ( 1 v2 v2 v2 ) *> ( v1 v2 1 ) ( 1 v3 v3 ) *> ( v1 v2 v3 ) *> ( v1 v2 v3 ) *> *> DIRECT = 'B' and STOREV = 'C': DIRECT = 'B' and STOREV = 'R': *> *> V = ( v1 v2 v3 ) V = ( v1 v1 1 ) *> ( v1 v2 v3 ) ( v2 v2 v2 1 ) *> ( 1 v2 v3 ) ( v3 v3 v3 v3 1 ) *> ( 1 v3 ) *> ( 1 ) *> \endverbatim *> * ===================================================================== SUBROUTINE CLARFT( DIRECT, STOREV, N, K, V, LDV, TAU, T, LDT ) * * -- LAPACK auxiliary routine (version 3.4.1) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * April 2012 * * .. Scalar Arguments .. CHARACTER DIRECT, STOREV INTEGER K, LDT, LDV, N * .. * .. Array Arguments .. COMPLEX T( LDT, * ), TAU( * ), V( LDV, * ) * .. * * ===================================================================== * * .. Parameters .. COMPLEX ONE, ZERO PARAMETER ( ONE = ( 1.0E+0, 0.0E+0 ), $ ZERO = ( 0.0E+0, 0.0E+0 ) ) * .. * .. Local Scalars .. INTEGER I, J, PREVLASTV, LASTV * .. * .. External Subroutines .. EXTERNAL CGEMV, CLACGV, CTRMV * .. * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. * .. Executable Statements .. * * Quick return if possible * IF( N.EQ.0 ) $ RETURN * IF( LSAME( DIRECT, 'F' ) ) THEN PREVLASTV = N DO I = 1, K PREVLASTV = MAX( PREVLASTV, I ) IF( TAU( I ).EQ.ZERO ) THEN * * H(i) = I * DO J = 1, I T( J, I ) = ZERO END DO ELSE * * general case * IF( LSAME( STOREV, 'C' ) ) THEN * Skip any trailing zeros. DO LASTV = N, I+1, -1 IF( V( LASTV, I ).NE.ZERO ) EXIT END DO DO J = 1, I-1 T( J, I ) = -TAU( I ) * CONJG( V( I , J ) ) END DO J = MIN( LASTV, PREVLASTV ) * * T(1:i-1,i) := - tau(i) * V(i:j,1:i-1)**H * V(i:j,i) * CALL CGEMV( 'Conjugate transpose', J-I, I-1, $ -TAU( I ), V( I+1, 1 ), LDV, $ V( I+1, I ), 1, $ ONE, T( 1, I ), 1 ) ELSE * Skip any trailing zeros. DO LASTV = N, I+1, -1 IF( V( I, LASTV ).NE.ZERO ) EXIT END DO DO J = 1, I-1 T( J, I ) = -TAU( I ) * V( J , I ) END DO J = MIN( LASTV, PREVLASTV ) * * T(1:i-1,i) := - tau(i) * V(1:i-1,i:j) * V(i,i:j)**H * CALL CGEMM( 'N', 'C', I-1, 1, J-I, -TAU( I ), $ V( 1, I+1 ), LDV, V( I, I+1 ), LDV, $ ONE, T( 1, I ), LDT ) END IF * * T(1:i-1,i) := T(1:i-1,1:i-1) * T(1:i-1,i) * CALL CTRMV( 'Upper', 'No transpose', 'Non-unit', I-1, T, $ LDT, T( 1, I ), 1 ) T( I, I ) = TAU( I ) IF( I.GT.1 ) THEN PREVLASTV = MAX( PREVLASTV, LASTV ) ELSE PREVLASTV = LASTV END IF END IF END DO ELSE PREVLASTV = 1 DO I = K, 1, -1 IF( TAU( I ).EQ.ZERO ) THEN * * H(i) = I * DO J = I, K T( J, I ) = ZERO END DO ELSE * * general case * IF( I.LT.K ) THEN IF( LSAME( STOREV, 'C' ) ) THEN * Skip any leading zeros. DO LASTV = 1, I-1 IF( V( LASTV, I ).NE.ZERO ) EXIT END DO DO J = I+1, K T( J, I ) = -TAU( I ) * CONJG( V( N-K+I , J ) ) END DO J = MAX( LASTV, PREVLASTV ) * * T(i+1:k,i) = -tau(i) * V(j:n-k+i,i+1:k)**H * V(j:n-k+i,i) * CALL CGEMV( 'Conjugate transpose', N-K+I-J, K-I, $ -TAU( I ), V( J, I+1 ), LDV, V( J, I ), $ 1, ONE, T( I+1, I ), 1 ) ELSE * Skip any leading zeros. DO LASTV = 1, I-1 IF( V( I, LASTV ).NE.ZERO ) EXIT END DO DO J = I+1, K T( J, I ) = -TAU( I ) * V( J, N-K+I ) END DO J = MAX( LASTV, PREVLASTV ) * * T(i+1:k,i) = -tau(i) * V(i+1:k,j:n-k+i) * V(i,j:n-k+i)**H * CALL CGEMM( 'N', 'C', K-I, 1, N-K+I-J, -TAU( I ), $ V( I+1, J ), LDV, V( I, J ), LDV, $ ONE, T( I+1, I ), LDT ) END IF * * T(i+1:k,i) := T(i+1:k,i+1:k) * T(i+1:k,i) * CALL CTRMV( 'Lower', 'No transpose', 'Non-unit', K-I, $ T( I+1, I+1 ), LDT, T( I+1, I ), 1 ) IF( I.GT.1 ) THEN PREVLASTV = MIN( PREVLASTV, LASTV ) ELSE PREVLASTV = LASTV END IF END IF T( I, I ) = TAU( I ) END IF END DO END IF RETURN * * End of CLARFT * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/complex_double.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #define SCALAR std::complex #define SCALAR_SUFFIX z #define SCALAR_SUFFIX_UP "Z" #define REAL_SCALAR_SUFFIX d #define ISCOMPLEX 1 #include "cholesky.cpp" #include "lu.cpp" #include "svd.cpp" ================================================ FILE: VO_Module/thirdparty/eigen/lapack/complex_single.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #define SCALAR std::complex #define SCALAR_SUFFIX c #define SCALAR_SUFFIX_UP "C" #define REAL_SCALAR_SUFFIX s #define ISCOMPLEX 1 #include "cholesky.cpp" #include "lu.cpp" #include "svd.cpp" ================================================ FILE: VO_Module/thirdparty/eigen/lapack/dladiv.f ================================================ *> \brief \b DLADIV * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download DLADIV + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE DLADIV( A, B, C, D, P, Q ) * * .. Scalar Arguments .. * DOUBLE PRECISION A, B, C, D, P, Q * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> DLADIV performs complex division in real arithmetic *> *> a + i*b *> p + i*q = --------- *> c + i*d *> *> The algorithm is due to Robert L. Smith and can be found *> in D. Knuth, The art of Computer Programming, Vol.2, p.195 *> \endverbatim * * Arguments: * ========== * *> \param[in] A *> \verbatim *> A is DOUBLE PRECISION *> \endverbatim *> *> \param[in] B *> \verbatim *> B is DOUBLE PRECISION *> \endverbatim *> *> \param[in] C *> \verbatim *> C is DOUBLE PRECISION *> \endverbatim *> *> \param[in] D *> \verbatim *> D is DOUBLE PRECISION *> The scalars a, b, c, and d in the above expression. *> \endverbatim *> *> \param[out] P *> \verbatim *> P is DOUBLE PRECISION *> \endverbatim *> *> \param[out] Q *> \verbatim *> Q is DOUBLE PRECISION *> The scalars p and q in the above expression. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup auxOTHERauxiliary * * ===================================================================== SUBROUTINE DLADIV( A, B, C, D, P, Q ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. DOUBLE PRECISION A, B, C, D, P, Q * .. * * ===================================================================== * * .. Local Scalars .. DOUBLE PRECISION E, F * .. * .. Intrinsic Functions .. INTRINSIC ABS * .. * .. Executable Statements .. * IF( ABS( D ).LT.ABS( C ) ) THEN E = D / C F = C + D*E P = ( A+B*E ) / F Q = ( B-A*E ) / F ELSE E = C / D F = D + C*E P = ( B+A*E ) / F Q = ( -A+B*E ) / F END IF * RETURN * * End of DLADIV * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/dlamch.f ================================================ *> \brief \b DLAMCH * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * * Definition: * =========== * * DOUBLE PRECISION FUNCTION DLAMCH( CMACH ) * * *> \par Purpose: * ============= *> *> \verbatim *> *> DLAMCH determines double precision machine parameters. *> \endverbatim * * Arguments: * ========== * *> \param[in] CMACH *> \verbatim *> Specifies the value to be returned by DLAMCH: *> = 'E' or 'e', DLAMCH := eps *> = 'S' or 's , DLAMCH := sfmin *> = 'B' or 'b', DLAMCH := base *> = 'P' or 'p', DLAMCH := eps*base *> = 'N' or 'n', DLAMCH := t *> = 'R' or 'r', DLAMCH := rnd *> = 'M' or 'm', DLAMCH := emin *> = 'U' or 'u', DLAMCH := rmin *> = 'L' or 'l', DLAMCH := emax *> = 'O' or 'o', DLAMCH := rmax *> where *> eps = relative machine precision *> sfmin = safe minimum, such that 1/sfmin does not overflow *> base = base of the machine *> prec = eps*base *> t = number of (base) digits in the mantissa *> rnd = 1.0 when rounding occurs in addition, 0.0 otherwise *> emin = minimum exponent before (gradual) underflow *> rmin = underflow threshold - base**(emin-1) *> emax = largest exponent before overflow *> rmax = overflow threshold - (base**emax)*(1-eps) *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup auxOTHERauxiliary * * ===================================================================== DOUBLE PRECISION FUNCTION DLAMCH( CMACH ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. CHARACTER CMACH * .. * * ===================================================================== * * .. Parameters .. DOUBLE PRECISION ONE, ZERO PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 ) * .. * .. Local Scalars .. DOUBLE PRECISION RND, EPS, SFMIN, SMALL, RMACH * .. * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. * .. Intrinsic Functions .. INTRINSIC DIGITS, EPSILON, HUGE, MAXEXPONENT, $ MINEXPONENT, RADIX, TINY * .. * .. Executable Statements .. * * * Assume rounding, not chopping. Always. * RND = ONE * IF( ONE.EQ.RND ) THEN EPS = EPSILON(ZERO) * 0.5 ELSE EPS = EPSILON(ZERO) END IF * IF( LSAME( CMACH, 'E' ) ) THEN RMACH = EPS ELSE IF( LSAME( CMACH, 'S' ) ) THEN SFMIN = TINY(ZERO) SMALL = ONE / HUGE(ZERO) IF( SMALL.GE.SFMIN ) THEN * * Use SMALL plus a bit, to avoid the possibility of rounding * causing overflow when computing 1/sfmin. * SFMIN = SMALL*( ONE+EPS ) END IF RMACH = SFMIN ELSE IF( LSAME( CMACH, 'B' ) ) THEN RMACH = RADIX(ZERO) ELSE IF( LSAME( CMACH, 'P' ) ) THEN RMACH = EPS * RADIX(ZERO) ELSE IF( LSAME( CMACH, 'N' ) ) THEN RMACH = DIGITS(ZERO) ELSE IF( LSAME( CMACH, 'R' ) ) THEN RMACH = RND ELSE IF( LSAME( CMACH, 'M' ) ) THEN RMACH = MINEXPONENT(ZERO) ELSE IF( LSAME( CMACH, 'U' ) ) THEN RMACH = tiny(zero) ELSE IF( LSAME( CMACH, 'L' ) ) THEN RMACH = MAXEXPONENT(ZERO) ELSE IF( LSAME( CMACH, 'O' ) ) THEN RMACH = HUGE(ZERO) ELSE RMACH = ZERO END IF * DLAMCH = RMACH RETURN * * End of DLAMCH * END ************************************************************************ *> \brief \b DLAMC3 *> \details *> \b Purpose: *> \verbatim *> DLAMC3 is intended to force A and B to be stored prior to doing *> the addition of A and B , for use in situations where optimizers *> might hold one of these in a register. *> \endverbatim *> \author LAPACK is a software package provided by Univ. of Tennessee, Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd.. *> \date November 2011 *> \ingroup auxOTHERauxiliary *> *> \param[in] A *> \verbatim *> A is a DOUBLE PRECISION *> \endverbatim *> *> \param[in] B *> \verbatim *> B is a DOUBLE PRECISION *> The values A and B. *> \endverbatim *> DOUBLE PRECISION FUNCTION DLAMC3( A, B ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. * November 2010 * * .. Scalar Arguments .. DOUBLE PRECISION A, B * .. * ===================================================================== * * .. Executable Statements .. * DLAMC3 = A + B * RETURN * * End of DLAMC3 * END * ************************************************************************ ================================================ FILE: VO_Module/thirdparty/eigen/lapack/dlapy2.f ================================================ *> \brief \b DLAPY2 * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download DLAPY2 + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * DOUBLE PRECISION FUNCTION DLAPY2( X, Y ) * * .. Scalar Arguments .. * DOUBLE PRECISION X, Y * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> DLAPY2 returns sqrt(x**2+y**2), taking care not to cause unnecessary *> overflow. *> \endverbatim * * Arguments: * ========== * *> \param[in] X *> \verbatim *> X is DOUBLE PRECISION *> \endverbatim *> *> \param[in] Y *> \verbatim *> Y is DOUBLE PRECISION *> X and Y specify the values x and y. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup auxOTHERauxiliary * * ===================================================================== DOUBLE PRECISION FUNCTION DLAPY2( X, Y ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. DOUBLE PRECISION X, Y * .. * * ===================================================================== * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D0 ) DOUBLE PRECISION ONE PARAMETER ( ONE = 1.0D0 ) * .. * .. Local Scalars .. DOUBLE PRECISION W, XABS, YABS, Z * .. * .. Intrinsic Functions .. INTRINSIC ABS, MAX, MIN, SQRT * .. * .. Executable Statements .. * XABS = ABS( X ) YABS = ABS( Y ) W = MAX( XABS, YABS ) Z = MIN( XABS, YABS ) IF( Z.EQ.ZERO ) THEN DLAPY2 = W ELSE DLAPY2 = W*SQRT( ONE+( Z / W )**2 ) END IF RETURN * * End of DLAPY2 * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/dlapy3.f ================================================ *> \brief \b DLAPY3 * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download DLAPY3 + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * DOUBLE PRECISION FUNCTION DLAPY3( X, Y, Z ) * * .. Scalar Arguments .. * DOUBLE PRECISION X, Y, Z * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> DLAPY3 returns sqrt(x**2+y**2+z**2), taking care not to cause *> unnecessary overflow. *> \endverbatim * * Arguments: * ========== * *> \param[in] X *> \verbatim *> X is DOUBLE PRECISION *> \endverbatim *> *> \param[in] Y *> \verbatim *> Y is DOUBLE PRECISION *> \endverbatim *> *> \param[in] Z *> \verbatim *> Z is DOUBLE PRECISION *> X, Y and Z specify the values x, y and z. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup auxOTHERauxiliary * * ===================================================================== DOUBLE PRECISION FUNCTION DLAPY3( X, Y, Z ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. DOUBLE PRECISION X, Y, Z * .. * * ===================================================================== * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D0 ) * .. * .. Local Scalars .. DOUBLE PRECISION W, XABS, YABS, ZABS * .. * .. Intrinsic Functions .. INTRINSIC ABS, MAX, SQRT * .. * .. Executable Statements .. * XABS = ABS( X ) YABS = ABS( Y ) ZABS = ABS( Z ) W = MAX( XABS, YABS, ZABS ) IF( W.EQ.ZERO ) THEN * W can be zero for max(0,nan,0) * adding all three entries together will make sure * NaN will not disappear. DLAPY3 = XABS + YABS + ZABS ELSE DLAPY3 = W*SQRT( ( XABS / W )**2+( YABS / W )**2+ $ ( ZABS / W )**2 ) END IF RETURN * * End of DLAPY3 * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/dlarf.f ================================================ *> \brief \b DLARF * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download DLARF + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE DLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK ) * * .. Scalar Arguments .. * CHARACTER SIDE * INTEGER INCV, LDC, M, N * DOUBLE PRECISION TAU * .. * .. Array Arguments .. * DOUBLE PRECISION C( LDC, * ), V( * ), WORK( * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> DLARF applies a real elementary reflector H to a real m by n matrix *> C, from either the left or the right. H is represented in the form *> *> H = I - tau * v * v**T *> *> where tau is a real scalar and v is a real vector. *> *> If tau = 0, then H is taken to be the unit matrix. *> \endverbatim * * Arguments: * ========== * *> \param[in] SIDE *> \verbatim *> SIDE is CHARACTER*1 *> = 'L': form H * C *> = 'R': form C * H *> \endverbatim *> *> \param[in] M *> \verbatim *> M is INTEGER *> The number of rows of the matrix C. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The number of columns of the matrix C. *> \endverbatim *> *> \param[in] V *> \verbatim *> V is DOUBLE PRECISION array, dimension *> (1 + (M-1)*abs(INCV)) if SIDE = 'L' *> or (1 + (N-1)*abs(INCV)) if SIDE = 'R' *> The vector v in the representation of H. V is not used if *> TAU = 0. *> \endverbatim *> *> \param[in] INCV *> \verbatim *> INCV is INTEGER *> The increment between elements of v. INCV <> 0. *> \endverbatim *> *> \param[in] TAU *> \verbatim *> TAU is DOUBLE PRECISION *> The value tau in the representation of H. *> \endverbatim *> *> \param[in,out] C *> \verbatim *> C is DOUBLE PRECISION array, dimension (LDC,N) *> On entry, the m by n matrix C. *> On exit, C is overwritten by the matrix H * C if SIDE = 'L', *> or C * H if SIDE = 'R'. *> \endverbatim *> *> \param[in] LDC *> \verbatim *> LDC is INTEGER *> The leading dimension of the array C. LDC >= max(1,M). *> \endverbatim *> *> \param[out] WORK *> \verbatim *> WORK is DOUBLE PRECISION array, dimension *> (N) if SIDE = 'L' *> or (M) if SIDE = 'R' *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup doubleOTHERauxiliary * * ===================================================================== SUBROUTINE DLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. CHARACTER SIDE INTEGER INCV, LDC, M, N DOUBLE PRECISION TAU * .. * .. Array Arguments .. DOUBLE PRECISION C( LDC, * ), V( * ), WORK( * ) * .. * * ===================================================================== * * .. Parameters .. DOUBLE PRECISION ONE, ZERO PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 ) * .. * .. Local Scalars .. LOGICAL APPLYLEFT INTEGER I, LASTV, LASTC * .. * .. External Subroutines .. EXTERNAL DGEMV, DGER * .. * .. External Functions .. LOGICAL LSAME INTEGER ILADLR, ILADLC EXTERNAL LSAME, ILADLR, ILADLC * .. * .. Executable Statements .. * APPLYLEFT = LSAME( SIDE, 'L' ) LASTV = 0 LASTC = 0 IF( TAU.NE.ZERO ) THEN ! Set up variables for scanning V. LASTV begins pointing to the end ! of V. IF( APPLYLEFT ) THEN LASTV = M ELSE LASTV = N END IF IF( INCV.GT.0 ) THEN I = 1 + (LASTV-1) * INCV ELSE I = 1 END IF ! Look for the last non-zero row in V. DO WHILE( LASTV.GT.0 .AND. V( I ).EQ.ZERO ) LASTV = LASTV - 1 I = I - INCV END DO IF( APPLYLEFT ) THEN ! Scan for the last non-zero column in C(1:lastv,:). LASTC = ILADLC(LASTV, N, C, LDC) ELSE ! Scan for the last non-zero row in C(:,1:lastv). LASTC = ILADLR(M, LASTV, C, LDC) END IF END IF ! Note that lastc.eq.0 renders the BLAS operations null; no special ! case is needed at this level. IF( APPLYLEFT ) THEN * * Form H * C * IF( LASTV.GT.0 ) THEN * * w(1:lastc,1) := C(1:lastv,1:lastc)**T * v(1:lastv,1) * CALL DGEMV( 'Transpose', LASTV, LASTC, ONE, C, LDC, V, INCV, $ ZERO, WORK, 1 ) * * C(1:lastv,1:lastc) := C(...) - v(1:lastv,1) * w(1:lastc,1)**T * CALL DGER( LASTV, LASTC, -TAU, V, INCV, WORK, 1, C, LDC ) END IF ELSE * * Form C * H * IF( LASTV.GT.0 ) THEN * * w(1:lastc,1) := C(1:lastc,1:lastv) * v(1:lastv,1) * CALL DGEMV( 'No transpose', LASTC, LASTV, ONE, C, LDC, $ V, INCV, ZERO, WORK, 1 ) * * C(1:lastc,1:lastv) := C(...) - w(1:lastc,1) * v(1:lastv,1)**T * CALL DGER( LASTC, LASTV, -TAU, WORK, 1, V, INCV, C, LDC ) END IF END IF RETURN * * End of DLARF * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/dlarfb.f ================================================ *> \brief \b DLARFB * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download DLARFB + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE DLARFB( SIDE, TRANS, DIRECT, STOREV, M, N, K, V, LDV, * T, LDT, C, LDC, WORK, LDWORK ) * * .. Scalar Arguments .. * CHARACTER DIRECT, SIDE, STOREV, TRANS * INTEGER K, LDC, LDT, LDV, LDWORK, M, N * .. * .. Array Arguments .. * DOUBLE PRECISION C( LDC, * ), T( LDT, * ), V( LDV, * ), * $ WORK( LDWORK, * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> DLARFB applies a real block reflector H or its transpose H**T to a *> real m by n matrix C, from either the left or the right. *> \endverbatim * * Arguments: * ========== * *> \param[in] SIDE *> \verbatim *> SIDE is CHARACTER*1 *> = 'L': apply H or H**T from the Left *> = 'R': apply H or H**T from the Right *> \endverbatim *> *> \param[in] TRANS *> \verbatim *> TRANS is CHARACTER*1 *> = 'N': apply H (No transpose) *> = 'T': apply H**T (Transpose) *> \endverbatim *> *> \param[in] DIRECT *> \verbatim *> DIRECT is CHARACTER*1 *> Indicates how H is formed from a product of elementary *> reflectors *> = 'F': H = H(1) H(2) . . . H(k) (Forward) *> = 'B': H = H(k) . . . H(2) H(1) (Backward) *> \endverbatim *> *> \param[in] STOREV *> \verbatim *> STOREV is CHARACTER*1 *> Indicates how the vectors which define the elementary *> reflectors are stored: *> = 'C': Columnwise *> = 'R': Rowwise *> \endverbatim *> *> \param[in] M *> \verbatim *> M is INTEGER *> The number of rows of the matrix C. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The number of columns of the matrix C. *> \endverbatim *> *> \param[in] K *> \verbatim *> K is INTEGER *> The order of the matrix T (= the number of elementary *> reflectors whose product defines the block reflector). *> \endverbatim *> *> \param[in] V *> \verbatim *> V is DOUBLE PRECISION array, dimension *> (LDV,K) if STOREV = 'C' *> (LDV,M) if STOREV = 'R' and SIDE = 'L' *> (LDV,N) if STOREV = 'R' and SIDE = 'R' *> The matrix V. See Further Details. *> \endverbatim *> *> \param[in] LDV *> \verbatim *> LDV is INTEGER *> The leading dimension of the array V. *> If STOREV = 'C' and SIDE = 'L', LDV >= max(1,M); *> if STOREV = 'C' and SIDE = 'R', LDV >= max(1,N); *> if STOREV = 'R', LDV >= K. *> \endverbatim *> *> \param[in] T *> \verbatim *> T is DOUBLE PRECISION array, dimension (LDT,K) *> The triangular k by k matrix T in the representation of the *> block reflector. *> \endverbatim *> *> \param[in] LDT *> \verbatim *> LDT is INTEGER *> The leading dimension of the array T. LDT >= K. *> \endverbatim *> *> \param[in,out] C *> \verbatim *> C is DOUBLE PRECISION array, dimension (LDC,N) *> On entry, the m by n matrix C. *> On exit, C is overwritten by H*C or H**T*C or C*H or C*H**T. *> \endverbatim *> *> \param[in] LDC *> \verbatim *> LDC is INTEGER *> The leading dimension of the array C. LDC >= max(1,M). *> \endverbatim *> *> \param[out] WORK *> \verbatim *> WORK is DOUBLE PRECISION array, dimension (LDWORK,K) *> \endverbatim *> *> \param[in] LDWORK *> \verbatim *> LDWORK is INTEGER *> The leading dimension of the array WORK. *> If SIDE = 'L', LDWORK >= max(1,N); *> if SIDE = 'R', LDWORK >= max(1,M). *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup doubleOTHERauxiliary * *> \par Further Details: * ===================== *> *> \verbatim *> *> The shape of the matrix V and the storage of the vectors which define *> the H(i) is best illustrated by the following example with n = 5 and *> k = 3. The elements equal to 1 are not stored; the corresponding *> array elements are modified but restored on exit. The rest of the *> array is not used. *> *> DIRECT = 'F' and STOREV = 'C': DIRECT = 'F' and STOREV = 'R': *> *> V = ( 1 ) V = ( 1 v1 v1 v1 v1 ) *> ( v1 1 ) ( 1 v2 v2 v2 ) *> ( v1 v2 1 ) ( 1 v3 v3 ) *> ( v1 v2 v3 ) *> ( v1 v2 v3 ) *> *> DIRECT = 'B' and STOREV = 'C': DIRECT = 'B' and STOREV = 'R': *> *> V = ( v1 v2 v3 ) V = ( v1 v1 1 ) *> ( v1 v2 v3 ) ( v2 v2 v2 1 ) *> ( 1 v2 v3 ) ( v3 v3 v3 v3 1 ) *> ( 1 v3 ) *> ( 1 ) *> \endverbatim *> * ===================================================================== SUBROUTINE DLARFB( SIDE, TRANS, DIRECT, STOREV, M, N, K, V, LDV, $ T, LDT, C, LDC, WORK, LDWORK ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. CHARACTER DIRECT, SIDE, STOREV, TRANS INTEGER K, LDC, LDT, LDV, LDWORK, M, N * .. * .. Array Arguments .. DOUBLE PRECISION C( LDC, * ), T( LDT, * ), V( LDV, * ), $ WORK( LDWORK, * ) * .. * * ===================================================================== * * .. Parameters .. DOUBLE PRECISION ONE PARAMETER ( ONE = 1.0D+0 ) * .. * .. Local Scalars .. CHARACTER TRANST INTEGER I, J, LASTV, LASTC * .. * .. External Functions .. LOGICAL LSAME INTEGER ILADLR, ILADLC EXTERNAL LSAME, ILADLR, ILADLC * .. * .. External Subroutines .. EXTERNAL DCOPY, DGEMM, DTRMM * .. * .. Executable Statements .. * * Quick return if possible * IF( M.LE.0 .OR. N.LE.0 ) $ RETURN * IF( LSAME( TRANS, 'N' ) ) THEN TRANST = 'T' ELSE TRANST = 'N' END IF * IF( LSAME( STOREV, 'C' ) ) THEN * IF( LSAME( DIRECT, 'F' ) ) THEN * * Let V = ( V1 ) (first K rows) * ( V2 ) * where V1 is unit lower triangular. * IF( LSAME( SIDE, 'L' ) ) THEN * * Form H * C or H**T * C where C = ( C1 ) * ( C2 ) * LASTV = MAX( K, ILADLR( M, K, V, LDV ) ) LASTC = ILADLC( LASTV, N, C, LDC ) * * W := C**T * V = (C1**T * V1 + C2**T * V2) (stored in WORK) * * W := C1**T * DO 10 J = 1, K CALL DCOPY( LASTC, C( J, 1 ), LDC, WORK( 1, J ), 1 ) 10 CONTINUE * * W := W * V1 * CALL DTRMM( 'Right', 'Lower', 'No transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C2**T *V2 * CALL DGEMM( 'Transpose', 'No transpose', $ LASTC, K, LASTV-K, $ ONE, C( K+1, 1 ), LDC, V( K+1, 1 ), LDV, $ ONE, WORK, LDWORK ) END IF * * W := W * T**T or W * T * CALL DTRMM( 'Right', 'Upper', TRANST, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - V * W**T * IF( LASTV.GT.K ) THEN * * C2 := C2 - V2 * W**T * CALL DGEMM( 'No transpose', 'Transpose', $ LASTV-K, LASTC, K, $ -ONE, V( K+1, 1 ), LDV, WORK, LDWORK, ONE, $ C( K+1, 1 ), LDC ) END IF * * W := W * V1**T * CALL DTRMM( 'Right', 'Lower', 'Transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) * * C1 := C1 - W**T * DO 30 J = 1, K DO 20 I = 1, LASTC C( J, I ) = C( J, I ) - WORK( I, J ) 20 CONTINUE 30 CONTINUE * ELSE IF( LSAME( SIDE, 'R' ) ) THEN * * Form C * H or C * H**T where C = ( C1 C2 ) * LASTV = MAX( K, ILADLR( N, K, V, LDV ) ) LASTC = ILADLR( M, LASTV, C, LDC ) * * W := C * V = (C1*V1 + C2*V2) (stored in WORK) * * W := C1 * DO 40 J = 1, K CALL DCOPY( LASTC, C( 1, J ), 1, WORK( 1, J ), 1 ) 40 CONTINUE * * W := W * V1 * CALL DTRMM( 'Right', 'Lower', 'No transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C2 * V2 * CALL DGEMM( 'No transpose', 'No transpose', $ LASTC, K, LASTV-K, $ ONE, C( 1, K+1 ), LDC, V( K+1, 1 ), LDV, $ ONE, WORK, LDWORK ) END IF * * W := W * T or W * T**T * CALL DTRMM( 'Right', 'Upper', TRANS, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - W * V**T * IF( LASTV.GT.K ) THEN * * C2 := C2 - W * V2**T * CALL DGEMM( 'No transpose', 'Transpose', $ LASTC, LASTV-K, K, $ -ONE, WORK, LDWORK, V( K+1, 1 ), LDV, ONE, $ C( 1, K+1 ), LDC ) END IF * * W := W * V1**T * CALL DTRMM( 'Right', 'Lower', 'Transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) * * C1 := C1 - W * DO 60 J = 1, K DO 50 I = 1, LASTC C( I, J ) = C( I, J ) - WORK( I, J ) 50 CONTINUE 60 CONTINUE END IF * ELSE * * Let V = ( V1 ) * ( V2 ) (last K rows) * where V2 is unit upper triangular. * IF( LSAME( SIDE, 'L' ) ) THEN * * Form H * C or H**T * C where C = ( C1 ) * ( C2 ) * LASTV = MAX( K, ILADLR( M, K, V, LDV ) ) LASTC = ILADLC( LASTV, N, C, LDC ) * * W := C**T * V = (C1**T * V1 + C2**T * V2) (stored in WORK) * * W := C2**T * DO 70 J = 1, K CALL DCOPY( LASTC, C( LASTV-K+J, 1 ), LDC, $ WORK( 1, J ), 1 ) 70 CONTINUE * * W := W * V2 * CALL DTRMM( 'Right', 'Upper', 'No transpose', 'Unit', $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, $ WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C1**T*V1 * CALL DGEMM( 'Transpose', 'No transpose', $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, $ ONE, WORK, LDWORK ) END IF * * W := W * T**T or W * T * CALL DTRMM( 'Right', 'Lower', TRANST, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - V * W**T * IF( LASTV.GT.K ) THEN * * C1 := C1 - V1 * W**T * CALL DGEMM( 'No transpose', 'Transpose', $ LASTV-K, LASTC, K, -ONE, V, LDV, WORK, LDWORK, $ ONE, C, LDC ) END IF * * W := W * V2**T * CALL DTRMM( 'Right', 'Upper', 'Transpose', 'Unit', $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, $ WORK, LDWORK ) * * C2 := C2 - W**T * DO 90 J = 1, K DO 80 I = 1, LASTC C( LASTV-K+J, I ) = C( LASTV-K+J, I ) - WORK(I, J) 80 CONTINUE 90 CONTINUE * ELSE IF( LSAME( SIDE, 'R' ) ) THEN * * Form C * H or C * H**T where C = ( C1 C2 ) * LASTV = MAX( K, ILADLR( N, K, V, LDV ) ) LASTC = ILADLR( M, LASTV, C, LDC ) * * W := C * V = (C1*V1 + C2*V2) (stored in WORK) * * W := C2 * DO 100 J = 1, K CALL DCOPY( LASTC, C( 1, N-K+J ), 1, WORK( 1, J ), 1 ) 100 CONTINUE * * W := W * V2 * CALL DTRMM( 'Right', 'Upper', 'No transpose', 'Unit', $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, $ WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C1 * V1 * CALL DGEMM( 'No transpose', 'No transpose', $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, $ ONE, WORK, LDWORK ) END IF * * W := W * T or W * T**T * CALL DTRMM( 'Right', 'Lower', TRANS, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - W * V**T * IF( LASTV.GT.K ) THEN * * C1 := C1 - W * V1**T * CALL DGEMM( 'No transpose', 'Transpose', $ LASTC, LASTV-K, K, -ONE, WORK, LDWORK, V, LDV, $ ONE, C, LDC ) END IF * * W := W * V2**T * CALL DTRMM( 'Right', 'Upper', 'Transpose', 'Unit', $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, $ WORK, LDWORK ) * * C2 := C2 - W * DO 120 J = 1, K DO 110 I = 1, LASTC C( I, LASTV-K+J ) = C( I, LASTV-K+J ) - WORK(I, J) 110 CONTINUE 120 CONTINUE END IF END IF * ELSE IF( LSAME( STOREV, 'R' ) ) THEN * IF( LSAME( DIRECT, 'F' ) ) THEN * * Let V = ( V1 V2 ) (V1: first K columns) * where V1 is unit upper triangular. * IF( LSAME( SIDE, 'L' ) ) THEN * * Form H * C or H**T * C where C = ( C1 ) * ( C2 ) * LASTV = MAX( K, ILADLC( K, M, V, LDV ) ) LASTC = ILADLC( LASTV, N, C, LDC ) * * W := C**T * V**T = (C1**T * V1**T + C2**T * V2**T) (stored in WORK) * * W := C1**T * DO 130 J = 1, K CALL DCOPY( LASTC, C( J, 1 ), LDC, WORK( 1, J ), 1 ) 130 CONTINUE * * W := W * V1**T * CALL DTRMM( 'Right', 'Upper', 'Transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C2**T*V2**T * CALL DGEMM( 'Transpose', 'Transpose', $ LASTC, K, LASTV-K, $ ONE, C( K+1, 1 ), LDC, V( 1, K+1 ), LDV, $ ONE, WORK, LDWORK ) END IF * * W := W * T**T or W * T * CALL DTRMM( 'Right', 'Upper', TRANST, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - V**T * W**T * IF( LASTV.GT.K ) THEN * * C2 := C2 - V2**T * W**T * CALL DGEMM( 'Transpose', 'Transpose', $ LASTV-K, LASTC, K, $ -ONE, V( 1, K+1 ), LDV, WORK, LDWORK, $ ONE, C( K+1, 1 ), LDC ) END IF * * W := W * V1 * CALL DTRMM( 'Right', 'Upper', 'No transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) * * C1 := C1 - W**T * DO 150 J = 1, K DO 140 I = 1, LASTC C( J, I ) = C( J, I ) - WORK( I, J ) 140 CONTINUE 150 CONTINUE * ELSE IF( LSAME( SIDE, 'R' ) ) THEN * * Form C * H or C * H**T where C = ( C1 C2 ) * LASTV = MAX( K, ILADLC( K, N, V, LDV ) ) LASTC = ILADLR( M, LASTV, C, LDC ) * * W := C * V**T = (C1*V1**T + C2*V2**T) (stored in WORK) * * W := C1 * DO 160 J = 1, K CALL DCOPY( LASTC, C( 1, J ), 1, WORK( 1, J ), 1 ) 160 CONTINUE * * W := W * V1**T * CALL DTRMM( 'Right', 'Upper', 'Transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C2 * V2**T * CALL DGEMM( 'No transpose', 'Transpose', $ LASTC, K, LASTV-K, $ ONE, C( 1, K+1 ), LDC, V( 1, K+1 ), LDV, $ ONE, WORK, LDWORK ) END IF * * W := W * T or W * T**T * CALL DTRMM( 'Right', 'Upper', TRANS, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - W * V * IF( LASTV.GT.K ) THEN * * C2 := C2 - W * V2 * CALL DGEMM( 'No transpose', 'No transpose', $ LASTC, LASTV-K, K, $ -ONE, WORK, LDWORK, V( 1, K+1 ), LDV, $ ONE, C( 1, K+1 ), LDC ) END IF * * W := W * V1 * CALL DTRMM( 'Right', 'Upper', 'No transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) * * C1 := C1 - W * DO 180 J = 1, K DO 170 I = 1, LASTC C( I, J ) = C( I, J ) - WORK( I, J ) 170 CONTINUE 180 CONTINUE * END IF * ELSE * * Let V = ( V1 V2 ) (V2: last K columns) * where V2 is unit lower triangular. * IF( LSAME( SIDE, 'L' ) ) THEN * * Form H * C or H**T * C where C = ( C1 ) * ( C2 ) * LASTV = MAX( K, ILADLC( K, M, V, LDV ) ) LASTC = ILADLC( LASTV, N, C, LDC ) * * W := C**T * V**T = (C1**T * V1**T + C2**T * V2**T) (stored in WORK) * * W := C2**T * DO 190 J = 1, K CALL DCOPY( LASTC, C( LASTV-K+J, 1 ), LDC, $ WORK( 1, J ), 1 ) 190 CONTINUE * * W := W * V2**T * CALL DTRMM( 'Right', 'Lower', 'Transpose', 'Unit', $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, $ WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C1**T * V1**T * CALL DGEMM( 'Transpose', 'Transpose', $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, $ ONE, WORK, LDWORK ) END IF * * W := W * T**T or W * T * CALL DTRMM( 'Right', 'Lower', TRANST, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - V**T * W**T * IF( LASTV.GT.K ) THEN * * C1 := C1 - V1**T * W**T * CALL DGEMM( 'Transpose', 'Transpose', $ LASTV-K, LASTC, K, -ONE, V, LDV, WORK, LDWORK, $ ONE, C, LDC ) END IF * * W := W * V2 * CALL DTRMM( 'Right', 'Lower', 'No transpose', 'Unit', $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, $ WORK, LDWORK ) * * C2 := C2 - W**T * DO 210 J = 1, K DO 200 I = 1, LASTC C( LASTV-K+J, I ) = C( LASTV-K+J, I ) - WORK(I, J) 200 CONTINUE 210 CONTINUE * ELSE IF( LSAME( SIDE, 'R' ) ) THEN * * Form C * H or C * H**T where C = ( C1 C2 ) * LASTV = MAX( K, ILADLC( K, N, V, LDV ) ) LASTC = ILADLR( M, LASTV, C, LDC ) * * W := C * V**T = (C1*V1**T + C2*V2**T) (stored in WORK) * * W := C2 * DO 220 J = 1, K CALL DCOPY( LASTC, C( 1, LASTV-K+J ), 1, $ WORK( 1, J ), 1 ) 220 CONTINUE * * W := W * V2**T * CALL DTRMM( 'Right', 'Lower', 'Transpose', 'Unit', $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, $ WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C1 * V1**T * CALL DGEMM( 'No transpose', 'Transpose', $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, $ ONE, WORK, LDWORK ) END IF * * W := W * T or W * T**T * CALL DTRMM( 'Right', 'Lower', TRANS, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - W * V * IF( LASTV.GT.K ) THEN * * C1 := C1 - W * V1 * CALL DGEMM( 'No transpose', 'No transpose', $ LASTC, LASTV-K, K, -ONE, WORK, LDWORK, V, LDV, $ ONE, C, LDC ) END IF * * W := W * V2 * CALL DTRMM( 'Right', 'Lower', 'No transpose', 'Unit', $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, $ WORK, LDWORK ) * * C1 := C1 - W * DO 240 J = 1, K DO 230 I = 1, LASTC C( I, LASTV-K+J ) = C( I, LASTV-K+J ) - WORK(I, J) 230 CONTINUE 240 CONTINUE * END IF * END IF END IF * RETURN * * End of DLARFB * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/dlarfg.f ================================================ *> \brief \b DLARFG * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download DLARFG + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE DLARFG( N, ALPHA, X, INCX, TAU ) * * .. Scalar Arguments .. * INTEGER INCX, N * DOUBLE PRECISION ALPHA, TAU * .. * .. Array Arguments .. * DOUBLE PRECISION X( * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> DLARFG generates a real elementary reflector H of order n, such *> that *> *> H * ( alpha ) = ( beta ), H**T * H = I. *> ( x ) ( 0 ) *> *> where alpha and beta are scalars, and x is an (n-1)-element real *> vector. H is represented in the form *> *> H = I - tau * ( 1 ) * ( 1 v**T ) , *> ( v ) *> *> where tau is a real scalar and v is a real (n-1)-element *> vector. *> *> If the elements of x are all zero, then tau = 0 and H is taken to be *> the unit matrix. *> *> Otherwise 1 <= tau <= 2. *> \endverbatim * * Arguments: * ========== * *> \param[in] N *> \verbatim *> N is INTEGER *> The order of the elementary reflector. *> \endverbatim *> *> \param[in,out] ALPHA *> \verbatim *> ALPHA is DOUBLE PRECISION *> On entry, the value alpha. *> On exit, it is overwritten with the value beta. *> \endverbatim *> *> \param[in,out] X *> \verbatim *> X is DOUBLE PRECISION array, dimension *> (1+(N-2)*abs(INCX)) *> On entry, the vector x. *> On exit, it is overwritten with the vector v. *> \endverbatim *> *> \param[in] INCX *> \verbatim *> INCX is INTEGER *> The increment between elements of X. INCX > 0. *> \endverbatim *> *> \param[out] TAU *> \verbatim *> TAU is DOUBLE PRECISION *> The value tau. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup doubleOTHERauxiliary * * ===================================================================== SUBROUTINE DLARFG( N, ALPHA, X, INCX, TAU ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. INTEGER INCX, N DOUBLE PRECISION ALPHA, TAU * .. * .. Array Arguments .. DOUBLE PRECISION X( * ) * .. * * ===================================================================== * * .. Parameters .. DOUBLE PRECISION ONE, ZERO PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 ) * .. * .. Local Scalars .. INTEGER J, KNT DOUBLE PRECISION BETA, RSAFMN, SAFMIN, XNORM * .. * .. External Functions .. DOUBLE PRECISION DLAMCH, DLAPY2, DNRM2 EXTERNAL DLAMCH, DLAPY2, DNRM2 * .. * .. Intrinsic Functions .. INTRINSIC ABS, SIGN * .. * .. External Subroutines .. EXTERNAL DSCAL * .. * .. Executable Statements .. * IF( N.LE.1 ) THEN TAU = ZERO RETURN END IF * XNORM = DNRM2( N-1, X, INCX ) * IF( XNORM.EQ.ZERO ) THEN * * H = I * TAU = ZERO ELSE * * general case * BETA = -SIGN( DLAPY2( ALPHA, XNORM ), ALPHA ) SAFMIN = DLAMCH( 'S' ) / DLAMCH( 'E' ) KNT = 0 IF( ABS( BETA ).LT.SAFMIN ) THEN * * XNORM, BETA may be inaccurate; scale X and recompute them * RSAFMN = ONE / SAFMIN 10 CONTINUE KNT = KNT + 1 CALL DSCAL( N-1, RSAFMN, X, INCX ) BETA = BETA*RSAFMN ALPHA = ALPHA*RSAFMN IF( ABS( BETA ).LT.SAFMIN ) $ GO TO 10 * * New BETA is at most 1, at least SAFMIN * XNORM = DNRM2( N-1, X, INCX ) BETA = -SIGN( DLAPY2( ALPHA, XNORM ), ALPHA ) END IF TAU = ( BETA-ALPHA ) / BETA CALL DSCAL( N-1, ONE / ( ALPHA-BETA ), X, INCX ) * * If ALPHA is subnormal, it may lose relative accuracy * DO 20 J = 1, KNT BETA = BETA*SAFMIN 20 CONTINUE ALPHA = BETA END IF * RETURN * * End of DLARFG * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/dlarft.f ================================================ *> \brief \b DLARFT * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download DLARFT + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE DLARFT( DIRECT, STOREV, N, K, V, LDV, TAU, T, LDT ) * * .. Scalar Arguments .. * CHARACTER DIRECT, STOREV * INTEGER K, LDT, LDV, N * .. * .. Array Arguments .. * DOUBLE PRECISION T( LDT, * ), TAU( * ), V( LDV, * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> DLARFT forms the triangular factor T of a real block reflector H *> of order n, which is defined as a product of k elementary reflectors. *> *> If DIRECT = 'F', H = H(1) H(2) . . . H(k) and T is upper triangular; *> *> If DIRECT = 'B', H = H(k) . . . H(2) H(1) and T is lower triangular. *> *> If STOREV = 'C', the vector which defines the elementary reflector *> H(i) is stored in the i-th column of the array V, and *> *> H = I - V * T * V**T *> *> If STOREV = 'R', the vector which defines the elementary reflector *> H(i) is stored in the i-th row of the array V, and *> *> H = I - V**T * T * V *> \endverbatim * * Arguments: * ========== * *> \param[in] DIRECT *> \verbatim *> DIRECT is CHARACTER*1 *> Specifies the order in which the elementary reflectors are *> multiplied to form the block reflector: *> = 'F': H = H(1) H(2) . . . H(k) (Forward) *> = 'B': H = H(k) . . . H(2) H(1) (Backward) *> \endverbatim *> *> \param[in] STOREV *> \verbatim *> STOREV is CHARACTER*1 *> Specifies how the vectors which define the elementary *> reflectors are stored (see also Further Details): *> = 'C': columnwise *> = 'R': rowwise *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The order of the block reflector H. N >= 0. *> \endverbatim *> *> \param[in] K *> \verbatim *> K is INTEGER *> The order of the triangular factor T (= the number of *> elementary reflectors). K >= 1. *> \endverbatim *> *> \param[in] V *> \verbatim *> V is DOUBLE PRECISION array, dimension *> (LDV,K) if STOREV = 'C' *> (LDV,N) if STOREV = 'R' *> The matrix V. See further details. *> \endverbatim *> *> \param[in] LDV *> \verbatim *> LDV is INTEGER *> The leading dimension of the array V. *> If STOREV = 'C', LDV >= max(1,N); if STOREV = 'R', LDV >= K. *> \endverbatim *> *> \param[in] TAU *> \verbatim *> TAU is DOUBLE PRECISION array, dimension (K) *> TAU(i) must contain the scalar factor of the elementary *> reflector H(i). *> \endverbatim *> *> \param[out] T *> \verbatim *> T is DOUBLE PRECISION array, dimension (LDT,K) *> The k by k triangular factor T of the block reflector. *> If DIRECT = 'F', T is upper triangular; if DIRECT = 'B', T is *> lower triangular. The rest of the array is not used. *> \endverbatim *> *> \param[in] LDT *> \verbatim *> LDT is INTEGER *> The leading dimension of the array T. LDT >= K. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date April 2012 * *> \ingroup doubleOTHERauxiliary * *> \par Further Details: * ===================== *> *> \verbatim *> *> The shape of the matrix V and the storage of the vectors which define *> the H(i) is best illustrated by the following example with n = 5 and *> k = 3. The elements equal to 1 are not stored. *> *> DIRECT = 'F' and STOREV = 'C': DIRECT = 'F' and STOREV = 'R': *> *> V = ( 1 ) V = ( 1 v1 v1 v1 v1 ) *> ( v1 1 ) ( 1 v2 v2 v2 ) *> ( v1 v2 1 ) ( 1 v3 v3 ) *> ( v1 v2 v3 ) *> ( v1 v2 v3 ) *> *> DIRECT = 'B' and STOREV = 'C': DIRECT = 'B' and STOREV = 'R': *> *> V = ( v1 v2 v3 ) V = ( v1 v1 1 ) *> ( v1 v2 v3 ) ( v2 v2 v2 1 ) *> ( 1 v2 v3 ) ( v3 v3 v3 v3 1 ) *> ( 1 v3 ) *> ( 1 ) *> \endverbatim *> * ===================================================================== SUBROUTINE DLARFT( DIRECT, STOREV, N, K, V, LDV, TAU, T, LDT ) * * -- LAPACK auxiliary routine (version 3.4.1) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * April 2012 * * .. Scalar Arguments .. CHARACTER DIRECT, STOREV INTEGER K, LDT, LDV, N * .. * .. Array Arguments .. DOUBLE PRECISION T( LDT, * ), TAU( * ), V( LDV, * ) * .. * * ===================================================================== * * .. Parameters .. DOUBLE PRECISION ONE, ZERO PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 ) * .. * .. Local Scalars .. INTEGER I, J, PREVLASTV, LASTV * .. * .. External Subroutines .. EXTERNAL DGEMV, DTRMV * .. * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. * .. Executable Statements .. * * Quick return if possible * IF( N.EQ.0 ) $ RETURN * IF( LSAME( DIRECT, 'F' ) ) THEN PREVLASTV = N DO I = 1, K PREVLASTV = MAX( I, PREVLASTV ) IF( TAU( I ).EQ.ZERO ) THEN * * H(i) = I * DO J = 1, I T( J, I ) = ZERO END DO ELSE * * general case * IF( LSAME( STOREV, 'C' ) ) THEN * Skip any trailing zeros. DO LASTV = N, I+1, -1 IF( V( LASTV, I ).NE.ZERO ) EXIT END DO DO J = 1, I-1 T( J, I ) = -TAU( I ) * V( I , J ) END DO J = MIN( LASTV, PREVLASTV ) * * T(1:i-1,i) := - tau(i) * V(i:j,1:i-1)**T * V(i:j,i) * CALL DGEMV( 'Transpose', J-I, I-1, -TAU( I ), $ V( I+1, 1 ), LDV, V( I+1, I ), 1, ONE, $ T( 1, I ), 1 ) ELSE * Skip any trailing zeros. DO LASTV = N, I+1, -1 IF( V( I, LASTV ).NE.ZERO ) EXIT END DO DO J = 1, I-1 T( J, I ) = -TAU( I ) * V( J , I ) END DO J = MIN( LASTV, PREVLASTV ) * * T(1:i-1,i) := - tau(i) * V(1:i-1,i:j) * V(i,i:j)**T * CALL DGEMV( 'No transpose', I-1, J-I, -TAU( I ), $ V( 1, I+1 ), LDV, V( I, I+1 ), LDV, ONE, $ T( 1, I ), 1 ) END IF * * T(1:i-1,i) := T(1:i-1,1:i-1) * T(1:i-1,i) * CALL DTRMV( 'Upper', 'No transpose', 'Non-unit', I-1, T, $ LDT, T( 1, I ), 1 ) T( I, I ) = TAU( I ) IF( I.GT.1 ) THEN PREVLASTV = MAX( PREVLASTV, LASTV ) ELSE PREVLASTV = LASTV END IF END IF END DO ELSE PREVLASTV = 1 DO I = K, 1, -1 IF( TAU( I ).EQ.ZERO ) THEN * * H(i) = I * DO J = I, K T( J, I ) = ZERO END DO ELSE * * general case * IF( I.LT.K ) THEN IF( LSAME( STOREV, 'C' ) ) THEN * Skip any leading zeros. DO LASTV = 1, I-1 IF( V( LASTV, I ).NE.ZERO ) EXIT END DO DO J = I+1, K T( J, I ) = -TAU( I ) * V( N-K+I , J ) END DO J = MAX( LASTV, PREVLASTV ) * * T(i+1:k,i) = -tau(i) * V(j:n-k+i,i+1:k)**T * V(j:n-k+i,i) * CALL DGEMV( 'Transpose', N-K+I-J, K-I, -TAU( I ), $ V( J, I+1 ), LDV, V( J, I ), 1, ONE, $ T( I+1, I ), 1 ) ELSE * Skip any leading zeros. DO LASTV = 1, I-1 IF( V( I, LASTV ).NE.ZERO ) EXIT END DO DO J = I+1, K T( J, I ) = -TAU( I ) * V( J, N-K+I ) END DO J = MAX( LASTV, PREVLASTV ) * * T(i+1:k,i) = -tau(i) * V(i+1:k,j:n-k+i) * V(i,j:n-k+i)**T * CALL DGEMV( 'No transpose', K-I, N-K+I-J, $ -TAU( I ), V( I+1, J ), LDV, V( I, J ), LDV, $ ONE, T( I+1, I ), 1 ) END IF * * T(i+1:k,i) := T(i+1:k,i+1:k) * T(i+1:k,i) * CALL DTRMV( 'Lower', 'No transpose', 'Non-unit', K-I, $ T( I+1, I+1 ), LDT, T( I+1, I ), 1 ) IF( I.GT.1 ) THEN PREVLASTV = MIN( PREVLASTV, LASTV ) ELSE PREVLASTV = LASTV END IF END IF T( I, I ) = TAU( I ) END IF END DO END IF RETURN * * End of DLARFT * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/double.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #define SCALAR double #define SCALAR_SUFFIX d #define SCALAR_SUFFIX_UP "D" #define ISCOMPLEX 0 #include "cholesky.cpp" #include "lu.cpp" #include "eigenvalues.cpp" #include "svd.cpp" ================================================ FILE: VO_Module/thirdparty/eigen/lapack/dsecnd_NONE.f ================================================ *> \brief \b DSECND returns nothing * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * * Definition: * =========== * * DOUBLE PRECISION FUNCTION DSECND( ) * * *> \par Purpose: * ============= *> *> \verbatim *> *> DSECND returns nothing instead of returning the user time for a process in seconds. *> If you are using that routine, it means that neither EXTERNAL ETIME, *> EXTERNAL ETIME_, INTERNAL ETIME, INTERNAL CPU_TIME is available on *> your machine. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup auxOTHERauxiliary * * ===================================================================== DOUBLE PRECISION FUNCTION DSECND( ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * ===================================================================== * DSECND = 0.0D+0 RETURN * * End of DSECND * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/eigenvalues.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2011 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "lapack_common.h" #include // computes eigen values and vectors of a general N-by-N matrix A EIGEN_LAPACK_FUNC(syev,(char *jobz, char *uplo, int* n, Scalar* a, int *lda, Scalar* w, Scalar* /*work*/, int* lwork, int *info)) { // TODO exploit the work buffer bool query_size = *lwork==-1; *info = 0; if(*jobz!='N' && *jobz!='V') *info = -1; else if(UPLO(*uplo)==INVALID) *info = -2; else if(*n<0) *info = -3; else if(*lda eig(mat,computeVectors?ComputeEigenvectors:EigenvaluesOnly); if(eig.info()==NoConvergence) { make_vector(w,*n).setZero(); if(computeVectors) matrix(a,*n,*n,*lda).setIdentity(); //*info = 1; return 0; } make_vector(w,*n) = eig.eigenvalues(); if(computeVectors) matrix(a,*n,*n,*lda) = eig.eigenvectors(); return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/lapack/ilaclc.f ================================================ *> \brief \b ILACLC * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download ILACLC + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * INTEGER FUNCTION ILACLC( M, N, A, LDA ) * * .. Scalar Arguments .. * INTEGER M, N, LDA * .. * .. Array Arguments .. * COMPLEX A( LDA, * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> ILACLC scans A for its last non-zero column. *> \endverbatim * * Arguments: * ========== * *> \param[in] M *> \verbatim *> M is INTEGER *> The number of rows of the matrix A. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The number of columns of the matrix A. *> \endverbatim *> *> \param[in] A *> \verbatim *> A is COMPLEX array, dimension (LDA,N) *> The m by n matrix A. *> \endverbatim *> *> \param[in] LDA *> \verbatim *> LDA is INTEGER *> The leading dimension of the array A. LDA >= max(1,M). *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup complexOTHERauxiliary * * ===================================================================== INTEGER FUNCTION ILACLC( M, N, A, LDA ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. INTEGER M, N, LDA * .. * .. Array Arguments .. COMPLEX A( LDA, * ) * .. * * ===================================================================== * * .. Parameters .. COMPLEX ZERO PARAMETER ( ZERO = (0.0E+0, 0.0E+0) ) * .. * .. Local Scalars .. INTEGER I * .. * .. Executable Statements .. * * Quick test for the common case where one corner is non-zero. IF( N.EQ.0 ) THEN ILACLC = N ELSE IF( A(1, N).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN ILACLC = N ELSE * Now scan each column from the end, returning with the first non-zero. DO ILACLC = N, 1, -1 DO I = 1, M IF( A(I, ILACLC).NE.ZERO ) RETURN END DO END DO END IF RETURN END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/ilaclr.f ================================================ *> \brief \b ILACLR * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download ILACLR + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * INTEGER FUNCTION ILACLR( M, N, A, LDA ) * * .. Scalar Arguments .. * INTEGER M, N, LDA * .. * .. Array Arguments .. * COMPLEX A( LDA, * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> ILACLR scans A for its last non-zero row. *> \endverbatim * * Arguments: * ========== * *> \param[in] M *> \verbatim *> M is INTEGER *> The number of rows of the matrix A. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The number of columns of the matrix A. *> \endverbatim *> *> \param[in] A *> \verbatim *> A is array, dimension (LDA,N) *> The m by n matrix A. *> \endverbatim *> *> \param[in] LDA *> \verbatim *> LDA is INTEGER *> The leading dimension of the array A. LDA >= max(1,M). *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date April 2012 * *> \ingroup complexOTHERauxiliary * * ===================================================================== INTEGER FUNCTION ILACLR( M, N, A, LDA ) * * -- LAPACK auxiliary routine (version 3.4.1) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * April 2012 * * .. Scalar Arguments .. INTEGER M, N, LDA * .. * .. Array Arguments .. COMPLEX A( LDA, * ) * .. * * ===================================================================== * * .. Parameters .. COMPLEX ZERO PARAMETER ( ZERO = (0.0E+0, 0.0E+0) ) * .. * .. Local Scalars .. INTEGER I, J * .. * .. Executable Statements .. * * Quick test for the common case where one corner is non-zero. IF( M.EQ.0 ) THEN ILACLR = M ELSE IF( A(M, 1).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN ILACLR = M ELSE * Scan up each column tracking the last zero row seen. ILACLR = 0 DO J = 1, N I=M DO WHILE((A(MAX(I,1),J).EQ.ZERO).AND.(I.GE.1)) I=I-1 ENDDO ILACLR = MAX( ILACLR, I ) END DO END IF RETURN END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/iladlc.f ================================================ *> \brief \b ILADLC * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download ILADLC + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * INTEGER FUNCTION ILADLC( M, N, A, LDA ) * * .. Scalar Arguments .. * INTEGER M, N, LDA * .. * .. Array Arguments .. * DOUBLE PRECISION A( LDA, * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> ILADLC scans A for its last non-zero column. *> \endverbatim * * Arguments: * ========== * *> \param[in] M *> \verbatim *> M is INTEGER *> The number of rows of the matrix A. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The number of columns of the matrix A. *> \endverbatim *> *> \param[in] A *> \verbatim *> A is DOUBLE PRECISION array, dimension (LDA,N) *> The m by n matrix A. *> \endverbatim *> *> \param[in] LDA *> \verbatim *> LDA is INTEGER *> The leading dimension of the array A. LDA >= max(1,M). *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup auxOTHERauxiliary * * ===================================================================== INTEGER FUNCTION ILADLC( M, N, A, LDA ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. INTEGER M, N, LDA * .. * .. Array Arguments .. DOUBLE PRECISION A( LDA, * ) * .. * * ===================================================================== * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D+0 ) * .. * .. Local Scalars .. INTEGER I * .. * .. Executable Statements .. * * Quick test for the common case where one corner is non-zero. IF( N.EQ.0 ) THEN ILADLC = N ELSE IF( A(1, N).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN ILADLC = N ELSE * Now scan each column from the end, returning with the first non-zero. DO ILADLC = N, 1, -1 DO I = 1, M IF( A(I, ILADLC).NE.ZERO ) RETURN END DO END DO END IF RETURN END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/iladlr.f ================================================ *> \brief \b ILADLR * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download ILADLR + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * INTEGER FUNCTION ILADLR( M, N, A, LDA ) * * .. Scalar Arguments .. * INTEGER M, N, LDA * .. * .. Array Arguments .. * DOUBLE PRECISION A( LDA, * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> ILADLR scans A for its last non-zero row. *> \endverbatim * * Arguments: * ========== * *> \param[in] M *> \verbatim *> M is INTEGER *> The number of rows of the matrix A. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The number of columns of the matrix A. *> \endverbatim *> *> \param[in] A *> \verbatim *> A is DOUBLE PRECISION array, dimension (LDA,N) *> The m by n matrix A. *> \endverbatim *> *> \param[in] LDA *> \verbatim *> LDA is INTEGER *> The leading dimension of the array A. LDA >= max(1,M). *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date April 2012 * *> \ingroup auxOTHERauxiliary * * ===================================================================== INTEGER FUNCTION ILADLR( M, N, A, LDA ) * * -- LAPACK auxiliary routine (version 3.4.1) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * April 2012 * * .. Scalar Arguments .. INTEGER M, N, LDA * .. * .. Array Arguments .. DOUBLE PRECISION A( LDA, * ) * .. * * ===================================================================== * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D+0 ) * .. * .. Local Scalars .. INTEGER I, J * .. * .. Executable Statements .. * * Quick test for the common case where one corner is non-zero. IF( M.EQ.0 ) THEN ILADLR = M ELSE IF( A(M, 1).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN ILADLR = M ELSE * Scan up each column tracking the last zero row seen. ILADLR = 0 DO J = 1, N I=M DO WHILE((A(MAX(I,1),J).EQ.ZERO).AND.(I.GE.1)) I=I-1 ENDDO ILADLR = MAX( ILADLR, I ) END DO END IF RETURN END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/ilaslc.f ================================================ *> \brief \b ILASLC * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download ILASLC + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * INTEGER FUNCTION ILASLC( M, N, A, LDA ) * * .. Scalar Arguments .. * INTEGER M, N, LDA * .. * .. Array Arguments .. * REAL A( LDA, * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> ILASLC scans A for its last non-zero column. *> \endverbatim * * Arguments: * ========== * *> \param[in] M *> \verbatim *> M is INTEGER *> The number of rows of the matrix A. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The number of columns of the matrix A. *> \endverbatim *> *> \param[in] A *> \verbatim *> A is REAL array, dimension (LDA,N) *> The m by n matrix A. *> \endverbatim *> *> \param[in] LDA *> \verbatim *> LDA is INTEGER *> The leading dimension of the array A. LDA >= max(1,M). *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup realOTHERauxiliary * * ===================================================================== INTEGER FUNCTION ILASLC( M, N, A, LDA ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. INTEGER M, N, LDA * .. * .. Array Arguments .. REAL A( LDA, * ) * .. * * ===================================================================== * * .. Parameters .. REAL ZERO PARAMETER ( ZERO = 0.0D+0 ) * .. * .. Local Scalars .. INTEGER I * .. * .. Executable Statements .. * * Quick test for the common case where one corner is non-zero. IF( N.EQ.0 ) THEN ILASLC = N ELSE IF( A(1, N).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN ILASLC = N ELSE * Now scan each column from the end, returning with the first non-zero. DO ILASLC = N, 1, -1 DO I = 1, M IF( A(I, ILASLC).NE.ZERO ) RETURN END DO END DO END IF RETURN END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/ilaslr.f ================================================ *> \brief \b ILASLR * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download ILASLR + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * INTEGER FUNCTION ILASLR( M, N, A, LDA ) * * .. Scalar Arguments .. * INTEGER M, N, LDA * .. * .. Array Arguments .. * REAL A( LDA, * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> ILASLR scans A for its last non-zero row. *> \endverbatim * * Arguments: * ========== * *> \param[in] M *> \verbatim *> M is INTEGER *> The number of rows of the matrix A. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The number of columns of the matrix A. *> \endverbatim *> *> \param[in] A *> \verbatim *> A is REAL array, dimension (LDA,N) *> The m by n matrix A. *> \endverbatim *> *> \param[in] LDA *> \verbatim *> LDA is INTEGER *> The leading dimension of the array A. LDA >= max(1,M). *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date April 2012 * *> \ingroup realOTHERauxiliary * * ===================================================================== INTEGER FUNCTION ILASLR( M, N, A, LDA ) * * -- LAPACK auxiliary routine (version 3.4.1) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * April 2012 * * .. Scalar Arguments .. INTEGER M, N, LDA * .. * .. Array Arguments .. REAL A( LDA, * ) * .. * * ===================================================================== * * .. Parameters .. REAL ZERO PARAMETER ( ZERO = 0.0E+0 ) * .. * .. Local Scalars .. INTEGER I, J * .. * .. Executable Statements .. * * Quick test for the common case where one corner is non-zero. IF( M.EQ.0 ) THEN ILASLR = M ELSEIF( A(M, 1).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN ILASLR = M ELSE * Scan up each column tracking the last zero row seen. ILASLR = 0 DO J = 1, N I=M DO WHILE((A(MAX(I,1),J).EQ.ZERO).AND.(I.GE.1)) I=I-1 ENDDO ILASLR = MAX( ILASLR, I ) END DO END IF RETURN END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/ilazlc.f ================================================ *> \brief \b ILAZLC * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download ILAZLC + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * INTEGER FUNCTION ILAZLC( M, N, A, LDA ) * * .. Scalar Arguments .. * INTEGER M, N, LDA * .. * .. Array Arguments .. * COMPLEX*16 A( LDA, * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> ILAZLC scans A for its last non-zero column. *> \endverbatim * * Arguments: * ========== * *> \param[in] M *> \verbatim *> M is INTEGER *> The number of rows of the matrix A. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The number of columns of the matrix A. *> \endverbatim *> *> \param[in] A *> \verbatim *> A is COMPLEX*16 array, dimension (LDA,N) *> The m by n matrix A. *> \endverbatim *> *> \param[in] LDA *> \verbatim *> LDA is INTEGER *> The leading dimension of the array A. LDA >= max(1,M). *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup complex16OTHERauxiliary * * ===================================================================== INTEGER FUNCTION ILAZLC( M, N, A, LDA ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. INTEGER M, N, LDA * .. * .. Array Arguments .. COMPLEX*16 A( LDA, * ) * .. * * ===================================================================== * * .. Parameters .. COMPLEX*16 ZERO PARAMETER ( ZERO = (0.0D+0, 0.0D+0) ) * .. * .. Local Scalars .. INTEGER I * .. * .. Executable Statements .. * * Quick test for the common case where one corner is non-zero. IF( N.EQ.0 ) THEN ILAZLC = N ELSE IF( A(1, N).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN ILAZLC = N ELSE * Now scan each column from the end, returning with the first non-zero. DO ILAZLC = N, 1, -1 DO I = 1, M IF( A(I, ILAZLC).NE.ZERO ) RETURN END DO END DO END IF RETURN END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/ilazlr.f ================================================ *> \brief \b ILAZLR * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download ILAZLR + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * INTEGER FUNCTION ILAZLR( M, N, A, LDA ) * * .. Scalar Arguments .. * INTEGER M, N, LDA * .. * .. Array Arguments .. * COMPLEX*16 A( LDA, * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> ILAZLR scans A for its last non-zero row. *> \endverbatim * * Arguments: * ========== * *> \param[in] M *> \verbatim *> M is INTEGER *> The number of rows of the matrix A. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The number of columns of the matrix A. *> \endverbatim *> *> \param[in] A *> \verbatim *> A is COMPLEX*16 array, dimension (LDA,N) *> The m by n matrix A. *> \endverbatim *> *> \param[in] LDA *> \verbatim *> LDA is INTEGER *> The leading dimension of the array A. LDA >= max(1,M). *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date April 2012 * *> \ingroup complex16OTHERauxiliary * * ===================================================================== INTEGER FUNCTION ILAZLR( M, N, A, LDA ) * * -- LAPACK auxiliary routine (version 3.4.1) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * April 2012 * * .. Scalar Arguments .. INTEGER M, N, LDA * .. * .. Array Arguments .. COMPLEX*16 A( LDA, * ) * .. * * ===================================================================== * * .. Parameters .. COMPLEX*16 ZERO PARAMETER ( ZERO = (0.0D+0, 0.0D+0) ) * .. * .. Local Scalars .. INTEGER I, J * .. * .. Executable Statements .. * * Quick test for the common case where one corner is non-zero. IF( M.EQ.0 ) THEN ILAZLR = M ELSE IF( A(M, 1).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN ILAZLR = M ELSE * Scan up each column tracking the last zero row seen. ILAZLR = 0 DO J = 1, N I=M DO WHILE((A(MAX(I,1),J).EQ.ZERO).AND.(I.GE.1)) I=I-1 ENDDO ILAZLR = MAX( ILAZLR, I ) END DO END IF RETURN END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/lapack_common.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2010-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_LAPACK_COMMON_H #define EIGEN_LAPACK_COMMON_H #include "../blas/common.h" #include "../Eigen/src/misc/lapack.h" #define EIGEN_LAPACK_FUNC(FUNC,ARGLIST) \ extern "C" { int EIGEN_BLAS_FUNC(FUNC) ARGLIST; } \ int EIGEN_BLAS_FUNC(FUNC) ARGLIST typedef Eigen::Map > PivotsType; #if ISCOMPLEX #define EIGEN_LAPACK_ARG_IF_COMPLEX(X) X, #else #define EIGEN_LAPACK_ARG_IF_COMPLEX(X) #endif #endif // EIGEN_LAPACK_COMMON_H ================================================ FILE: VO_Module/thirdparty/eigen/lapack/lu.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2010-2011 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "common.h" #include // computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges EIGEN_LAPACK_FUNC(getrf,(int *m, int *n, RealScalar *pa, int *lda, int *ipiv, int *info)) { *info = 0; if(*m<0) *info = -1; else if(*n<0) *info = -2; else if(*lda(pa); int nb_transpositions; int ret = int(Eigen::internal::partial_lu_impl ::blocked_lu(*m, *n, a, *lda, ipiv, nb_transpositions)); for(int i=0; i=0) *info = ret+1; return 0; } //GETRS solves a system of linear equations // A * X = B or A' * X = B // with a general N-by-N matrix A using the LU factorization computed by GETRF EIGEN_LAPACK_FUNC(getrs,(char *trans, int *n, int *nrhs, RealScalar *pa, int *lda, int *ipiv, RealScalar *pb, int *ldb, int *info)) { *info = 0; if(OP(*trans)==INVALID) *info = -1; else if(*n<0) *info = -2; else if(*nrhs<0) *info = -3; else if(*lda(pa); Scalar* b = reinterpret_cast(pb); MatrixType lu(a,*n,*n,*lda); MatrixType B(b,*n,*nrhs,*ldb); for(int i=0; i<*n; ++i) ipiv[i]--; if(OP(*trans)==NOTR) { B = PivotsType(ipiv,*n) * B; lu.triangularView().solveInPlace(B); lu.triangularView().solveInPlace(B); } else if(OP(*trans)==TR) { lu.triangularView().transpose().solveInPlace(B); lu.triangularView().transpose().solveInPlace(B); B = PivotsType(ipiv,*n).transpose() * B; } else if(OP(*trans)==ADJ) { lu.triangularView().adjoint().solveInPlace(B); lu.triangularView().adjoint().solveInPlace(B); B = PivotsType(ipiv,*n).transpose() * B; } for(int i=0; i<*n; ++i) ipiv[i]++; return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/lapack/second_NONE.f ================================================ *> \brief \b SECOND returns nothing * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * * Definition: * =========== * * REAL FUNCTION SECOND( ) * * *> \par Purpose: * ============= *> *> \verbatim *> *> SECOND returns nothing instead of returning the user time for a process in seconds. *> If you are using that routine, it means that neither EXTERNAL ETIME, *> EXTERNAL ETIME_, INTERNAL ETIME, INTERNAL CPU_TIME is available on *> your machine. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup auxOTHERauxiliary * * ===================================================================== REAL FUNCTION SECOND( ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * ===================================================================== * SECOND = 0.0E+0 RETURN * * End of SECOND * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/single.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #define SCALAR float #define SCALAR_SUFFIX s #define SCALAR_SUFFIX_UP "S" #define ISCOMPLEX 0 #include "cholesky.cpp" #include "lu.cpp" #include "eigenvalues.cpp" #include "svd.cpp" ================================================ FILE: VO_Module/thirdparty/eigen/lapack/sladiv.f ================================================ *> \brief \b SLADIV * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download SLADIV + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE SLADIV( A, B, C, D, P, Q ) * * .. Scalar Arguments .. * REAL A, B, C, D, P, Q * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> SLADIV performs complex division in real arithmetic *> *> a + i*b *> p + i*q = --------- *> c + i*d *> *> The algorithm is due to Robert L. Smith and can be found *> in D. Knuth, The art of Computer Programming, Vol.2, p.195 *> \endverbatim * * Arguments: * ========== * *> \param[in] A *> \verbatim *> A is REAL *> \endverbatim *> *> \param[in] B *> \verbatim *> B is REAL *> \endverbatim *> *> \param[in] C *> \verbatim *> C is REAL *> \endverbatim *> *> \param[in] D *> \verbatim *> D is REAL *> The scalars a, b, c, and d in the above expression. *> \endverbatim *> *> \param[out] P *> \verbatim *> P is REAL *> \endverbatim *> *> \param[out] Q *> \verbatim *> Q is REAL *> The scalars p and q in the above expression. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup auxOTHERauxiliary * * ===================================================================== SUBROUTINE SLADIV( A, B, C, D, P, Q ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. REAL A, B, C, D, P, Q * .. * * ===================================================================== * * .. Local Scalars .. REAL E, F * .. * .. Intrinsic Functions .. INTRINSIC ABS * .. * .. Executable Statements .. * IF( ABS( D ).LT.ABS( C ) ) THEN E = D / C F = C + D*E P = ( A+B*E ) / F Q = ( B-A*E ) / F ELSE E = C / D F = D + C*E P = ( B+A*E ) / F Q = ( -A+B*E ) / F END IF * RETURN * * End of SLADIV * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/slamch.f ================================================ *> \brief \b SLAMCH * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * * Definition: * =========== * * REAL FUNCTION SLAMCH( CMACH ) * * .. Scalar Arguments .. * CHARACTER CMACH * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> SLAMCH determines single precision machine parameters. *> \endverbatim * * Arguments: * ========== * *> \param[in] CMACH *> \verbatim *> Specifies the value to be returned by SLAMCH: *> = 'E' or 'e', SLAMCH := eps *> = 'S' or 's , SLAMCH := sfmin *> = 'B' or 'b', SLAMCH := base *> = 'P' or 'p', SLAMCH := eps*base *> = 'N' or 'n', SLAMCH := t *> = 'R' or 'r', SLAMCH := rnd *> = 'M' or 'm', SLAMCH := emin *> = 'U' or 'u', SLAMCH := rmin *> = 'L' or 'l', SLAMCH := emax *> = 'O' or 'o', SLAMCH := rmax *> where *> eps = relative machine precision *> sfmin = safe minimum, such that 1/sfmin does not overflow *> base = base of the machine *> prec = eps*base *> t = number of (base) digits in the mantissa *> rnd = 1.0 when rounding occurs in addition, 0.0 otherwise *> emin = minimum exponent before (gradual) underflow *> rmin = underflow threshold - base**(emin-1) *> emax = largest exponent before overflow *> rmax = overflow threshold - (base**emax)*(1-eps) *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup auxOTHERauxiliary * * ===================================================================== REAL FUNCTION SLAMCH( CMACH ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. CHARACTER CMACH * .. * * ===================================================================== * * .. Parameters .. REAL ONE, ZERO PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 ) * .. * .. Local Scalars .. REAL RND, EPS, SFMIN, SMALL, RMACH * .. * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. * .. Intrinsic Functions .. INTRINSIC DIGITS, EPSILON, HUGE, MAXEXPONENT, $ MINEXPONENT, RADIX, TINY * .. * .. Executable Statements .. * * * Assume rounding, not chopping. Always. * RND = ONE * IF( ONE.EQ.RND ) THEN EPS = EPSILON(ZERO) * 0.5 ELSE EPS = EPSILON(ZERO) END IF * IF( LSAME( CMACH, 'E' ) ) THEN RMACH = EPS ELSE IF( LSAME( CMACH, 'S' ) ) THEN SFMIN = TINY(ZERO) SMALL = ONE / HUGE(ZERO) IF( SMALL.GE.SFMIN ) THEN * * Use SMALL plus a bit, to avoid the possibility of rounding * causing overflow when computing 1/sfmin. * SFMIN = SMALL*( ONE+EPS ) END IF RMACH = SFMIN ELSE IF( LSAME( CMACH, 'B' ) ) THEN RMACH = RADIX(ZERO) ELSE IF( LSAME( CMACH, 'P' ) ) THEN RMACH = EPS * RADIX(ZERO) ELSE IF( LSAME( CMACH, 'N' ) ) THEN RMACH = DIGITS(ZERO) ELSE IF( LSAME( CMACH, 'R' ) ) THEN RMACH = RND ELSE IF( LSAME( CMACH, 'M' ) ) THEN RMACH = MINEXPONENT(ZERO) ELSE IF( LSAME( CMACH, 'U' ) ) THEN RMACH = tiny(zero) ELSE IF( LSAME( CMACH, 'L' ) ) THEN RMACH = MAXEXPONENT(ZERO) ELSE IF( LSAME( CMACH, 'O' ) ) THEN RMACH = HUGE(ZERO) ELSE RMACH = ZERO END IF * SLAMCH = RMACH RETURN * * End of SLAMCH * END ************************************************************************ *> \brief \b SLAMC3 *> \details *> \b Purpose: *> \verbatim *> SLAMC3 is intended to force A and B to be stored prior to doing *> the addition of A and B , for use in situations where optimizers *> might hold one of these in a register. *> \endverbatim *> \author LAPACK is a software package provided by Univ. of Tennessee, Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd.. *> \date November 2011 *> \ingroup auxOTHERauxiliary *> *> \param[in] A *> \verbatim *> \endverbatim *> *> \param[in] B *> \verbatim *> The values A and B. *> \endverbatim *> * REAL FUNCTION SLAMC3( A, B ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. * November 2010 * * .. Scalar Arguments .. REAL A, B * .. * ===================================================================== * * .. Executable Statements .. * SLAMC3 = A + B * RETURN * * End of SLAMC3 * END * ************************************************************************ ================================================ FILE: VO_Module/thirdparty/eigen/lapack/slapy2.f ================================================ *> \brief \b SLAPY2 * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download SLAPY2 + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * REAL FUNCTION SLAPY2( X, Y ) * * .. Scalar Arguments .. * REAL X, Y * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> SLAPY2 returns sqrt(x**2+y**2), taking care not to cause unnecessary *> overflow. *> \endverbatim * * Arguments: * ========== * *> \param[in] X *> \verbatim *> X is REAL *> \endverbatim *> *> \param[in] Y *> \verbatim *> Y is REAL *> X and Y specify the values x and y. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup auxOTHERauxiliary * * ===================================================================== REAL FUNCTION SLAPY2( X, Y ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. REAL X, Y * .. * * ===================================================================== * * .. Parameters .. REAL ZERO PARAMETER ( ZERO = 0.0E0 ) REAL ONE PARAMETER ( ONE = 1.0E0 ) * .. * .. Local Scalars .. REAL W, XABS, YABS, Z * .. * .. Intrinsic Functions .. INTRINSIC ABS, MAX, MIN, SQRT * .. * .. Executable Statements .. * XABS = ABS( X ) YABS = ABS( Y ) W = MAX( XABS, YABS ) Z = MIN( XABS, YABS ) IF( Z.EQ.ZERO ) THEN SLAPY2 = W ELSE SLAPY2 = W*SQRT( ONE+( Z / W )**2 ) END IF RETURN * * End of SLAPY2 * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/slapy3.f ================================================ *> \brief \b SLAPY3 * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download SLAPY3 + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * REAL FUNCTION SLAPY3( X, Y, Z ) * * .. Scalar Arguments .. * REAL X, Y, Z * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> SLAPY3 returns sqrt(x**2+y**2+z**2), taking care not to cause *> unnecessary overflow. *> \endverbatim * * Arguments: * ========== * *> \param[in] X *> \verbatim *> X is REAL *> \endverbatim *> *> \param[in] Y *> \verbatim *> Y is REAL *> \endverbatim *> *> \param[in] Z *> \verbatim *> Z is REAL *> X, Y and Z specify the values x, y and z. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup auxOTHERauxiliary * * ===================================================================== REAL FUNCTION SLAPY3( X, Y, Z ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. REAL X, Y, Z * .. * * ===================================================================== * * .. Parameters .. REAL ZERO PARAMETER ( ZERO = 0.0E0 ) * .. * .. Local Scalars .. REAL W, XABS, YABS, ZABS * .. * .. Intrinsic Functions .. INTRINSIC ABS, MAX, SQRT * .. * .. Executable Statements .. * XABS = ABS( X ) YABS = ABS( Y ) ZABS = ABS( Z ) W = MAX( XABS, YABS, ZABS ) IF( W.EQ.ZERO ) THEN * W can be zero for max(0,nan,0) * adding all three entries together will make sure * NaN will not disappear. SLAPY3 = XABS + YABS + ZABS ELSE SLAPY3 = W*SQRT( ( XABS / W )**2+( YABS / W )**2+ $ ( ZABS / W )**2 ) END IF RETURN * * End of SLAPY3 * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/slarf.f ================================================ *> \brief \b SLARF * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download SLARF + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE SLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK ) * * .. Scalar Arguments .. * CHARACTER SIDE * INTEGER INCV, LDC, M, N * REAL TAU * .. * .. Array Arguments .. * REAL C( LDC, * ), V( * ), WORK( * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> SLARF applies a real elementary reflector H to a real m by n matrix *> C, from either the left or the right. H is represented in the form *> *> H = I - tau * v * v**T *> *> where tau is a real scalar and v is a real vector. *> *> If tau = 0, then H is taken to be the unit matrix. *> \endverbatim * * Arguments: * ========== * *> \param[in] SIDE *> \verbatim *> SIDE is CHARACTER*1 *> = 'L': form H * C *> = 'R': form C * H *> \endverbatim *> *> \param[in] M *> \verbatim *> M is INTEGER *> The number of rows of the matrix C. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The number of columns of the matrix C. *> \endverbatim *> *> \param[in] V *> \verbatim *> V is REAL array, dimension *> (1 + (M-1)*abs(INCV)) if SIDE = 'L' *> or (1 + (N-1)*abs(INCV)) if SIDE = 'R' *> The vector v in the representation of H. V is not used if *> TAU = 0. *> \endverbatim *> *> \param[in] INCV *> \verbatim *> INCV is INTEGER *> The increment between elements of v. INCV <> 0. *> \endverbatim *> *> \param[in] TAU *> \verbatim *> TAU is REAL *> The value tau in the representation of H. *> \endverbatim *> *> \param[in,out] C *> \verbatim *> C is REAL array, dimension (LDC,N) *> On entry, the m by n matrix C. *> On exit, C is overwritten by the matrix H * C if SIDE = 'L', *> or C * H if SIDE = 'R'. *> \endverbatim *> *> \param[in] LDC *> \verbatim *> LDC is INTEGER *> The leading dimension of the array C. LDC >= max(1,M). *> \endverbatim *> *> \param[out] WORK *> \verbatim *> WORK is REAL array, dimension *> (N) if SIDE = 'L' *> or (M) if SIDE = 'R' *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup realOTHERauxiliary * * ===================================================================== SUBROUTINE SLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. CHARACTER SIDE INTEGER INCV, LDC, M, N REAL TAU * .. * .. Array Arguments .. REAL C( LDC, * ), V( * ), WORK( * ) * .. * * ===================================================================== * * .. Parameters .. REAL ONE, ZERO PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 ) * .. * .. Local Scalars .. LOGICAL APPLYLEFT INTEGER I, LASTV, LASTC * .. * .. External Subroutines .. EXTERNAL SGEMV, SGER * .. * .. External Functions .. LOGICAL LSAME INTEGER ILASLR, ILASLC EXTERNAL LSAME, ILASLR, ILASLC * .. * .. Executable Statements .. * APPLYLEFT = LSAME( SIDE, 'L' ) LASTV = 0 LASTC = 0 IF( TAU.NE.ZERO ) THEN ! Set up variables for scanning V. LASTV begins pointing to the end ! of V. IF( APPLYLEFT ) THEN LASTV = M ELSE LASTV = N END IF IF( INCV.GT.0 ) THEN I = 1 + (LASTV-1) * INCV ELSE I = 1 END IF ! Look for the last non-zero row in V. DO WHILE( LASTV.GT.0 .AND. V( I ).EQ.ZERO ) LASTV = LASTV - 1 I = I - INCV END DO IF( APPLYLEFT ) THEN ! Scan for the last non-zero column in C(1:lastv,:). LASTC = ILASLC(LASTV, N, C, LDC) ELSE ! Scan for the last non-zero row in C(:,1:lastv). LASTC = ILASLR(M, LASTV, C, LDC) END IF END IF ! Note that lastc.eq.0 renders the BLAS operations null; no special ! case is needed at this level. IF( APPLYLEFT ) THEN * * Form H * C * IF( LASTV.GT.0 ) THEN * * w(1:lastc,1) := C(1:lastv,1:lastc)**T * v(1:lastv,1) * CALL SGEMV( 'Transpose', LASTV, LASTC, ONE, C, LDC, V, INCV, $ ZERO, WORK, 1 ) * * C(1:lastv,1:lastc) := C(...) - v(1:lastv,1) * w(1:lastc,1)**T * CALL SGER( LASTV, LASTC, -TAU, V, INCV, WORK, 1, C, LDC ) END IF ELSE * * Form C * H * IF( LASTV.GT.0 ) THEN * * w(1:lastc,1) := C(1:lastc,1:lastv) * v(1:lastv,1) * CALL SGEMV( 'No transpose', LASTC, LASTV, ONE, C, LDC, $ V, INCV, ZERO, WORK, 1 ) * * C(1:lastc,1:lastv) := C(...) - w(1:lastc,1) * v(1:lastv,1)**T * CALL SGER( LASTC, LASTV, -TAU, WORK, 1, V, INCV, C, LDC ) END IF END IF RETURN * * End of SLARF * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/slarfb.f ================================================ *> \brief \b SLARFB * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download SLARFB + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE SLARFB( SIDE, TRANS, DIRECT, STOREV, M, N, K, V, LDV, * T, LDT, C, LDC, WORK, LDWORK ) * * .. Scalar Arguments .. * CHARACTER DIRECT, SIDE, STOREV, TRANS * INTEGER K, LDC, LDT, LDV, LDWORK, M, N * .. * .. Array Arguments .. * REAL C( LDC, * ), T( LDT, * ), V( LDV, * ), * $ WORK( LDWORK, * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> SLARFB applies a real block reflector H or its transpose H**T to a *> real m by n matrix C, from either the left or the right. *> \endverbatim * * Arguments: * ========== * *> \param[in] SIDE *> \verbatim *> SIDE is CHARACTER*1 *> = 'L': apply H or H**T from the Left *> = 'R': apply H or H**T from the Right *> \endverbatim *> *> \param[in] TRANS *> \verbatim *> TRANS is CHARACTER*1 *> = 'N': apply H (No transpose) *> = 'T': apply H**T (Transpose) *> \endverbatim *> *> \param[in] DIRECT *> \verbatim *> DIRECT is CHARACTER*1 *> Indicates how H is formed from a product of elementary *> reflectors *> = 'F': H = H(1) H(2) . . . H(k) (Forward) *> = 'B': H = H(k) . . . H(2) H(1) (Backward) *> \endverbatim *> *> \param[in] STOREV *> \verbatim *> STOREV is CHARACTER*1 *> Indicates how the vectors which define the elementary *> reflectors are stored: *> = 'C': Columnwise *> = 'R': Rowwise *> \endverbatim *> *> \param[in] M *> \verbatim *> M is INTEGER *> The number of rows of the matrix C. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The number of columns of the matrix C. *> \endverbatim *> *> \param[in] K *> \verbatim *> K is INTEGER *> The order of the matrix T (= the number of elementary *> reflectors whose product defines the block reflector). *> \endverbatim *> *> \param[in] V *> \verbatim *> V is REAL array, dimension *> (LDV,K) if STOREV = 'C' *> (LDV,M) if STOREV = 'R' and SIDE = 'L' *> (LDV,N) if STOREV = 'R' and SIDE = 'R' *> The matrix V. See Further Details. *> \endverbatim *> *> \param[in] LDV *> \verbatim *> LDV is INTEGER *> The leading dimension of the array V. *> If STOREV = 'C' and SIDE = 'L', LDV >= max(1,M); *> if STOREV = 'C' and SIDE = 'R', LDV >= max(1,N); *> if STOREV = 'R', LDV >= K. *> \endverbatim *> *> \param[in] T *> \verbatim *> T is REAL array, dimension (LDT,K) *> The triangular k by k matrix T in the representation of the *> block reflector. *> \endverbatim *> *> \param[in] LDT *> \verbatim *> LDT is INTEGER *> The leading dimension of the array T. LDT >= K. *> \endverbatim *> *> \param[in,out] C *> \verbatim *> C is REAL array, dimension (LDC,N) *> On entry, the m by n matrix C. *> On exit, C is overwritten by H*C or H**T*C or C*H or C*H**T. *> \endverbatim *> *> \param[in] LDC *> \verbatim *> LDC is INTEGER *> The leading dimension of the array C. LDC >= max(1,M). *> \endverbatim *> *> \param[out] WORK *> \verbatim *> WORK is REAL array, dimension (LDWORK,K) *> \endverbatim *> *> \param[in] LDWORK *> \verbatim *> LDWORK is INTEGER *> The leading dimension of the array WORK. *> If SIDE = 'L', LDWORK >= max(1,N); *> if SIDE = 'R', LDWORK >= max(1,M). *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup realOTHERauxiliary * *> \par Further Details: * ===================== *> *> \verbatim *> *> The shape of the matrix V and the storage of the vectors which define *> the H(i) is best illustrated by the following example with n = 5 and *> k = 3. The elements equal to 1 are not stored; the corresponding *> array elements are modified but restored on exit. The rest of the *> array is not used. *> *> DIRECT = 'F' and STOREV = 'C': DIRECT = 'F' and STOREV = 'R': *> *> V = ( 1 ) V = ( 1 v1 v1 v1 v1 ) *> ( v1 1 ) ( 1 v2 v2 v2 ) *> ( v1 v2 1 ) ( 1 v3 v3 ) *> ( v1 v2 v3 ) *> ( v1 v2 v3 ) *> *> DIRECT = 'B' and STOREV = 'C': DIRECT = 'B' and STOREV = 'R': *> *> V = ( v1 v2 v3 ) V = ( v1 v1 1 ) *> ( v1 v2 v3 ) ( v2 v2 v2 1 ) *> ( 1 v2 v3 ) ( v3 v3 v3 v3 1 ) *> ( 1 v3 ) *> ( 1 ) *> \endverbatim *> * ===================================================================== SUBROUTINE SLARFB( SIDE, TRANS, DIRECT, STOREV, M, N, K, V, LDV, $ T, LDT, C, LDC, WORK, LDWORK ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. CHARACTER DIRECT, SIDE, STOREV, TRANS INTEGER K, LDC, LDT, LDV, LDWORK, M, N * .. * .. Array Arguments .. REAL C( LDC, * ), T( LDT, * ), V( LDV, * ), $ WORK( LDWORK, * ) * .. * * ===================================================================== * * .. Parameters .. REAL ONE PARAMETER ( ONE = 1.0E+0 ) * .. * .. Local Scalars .. CHARACTER TRANST INTEGER I, J, LASTV, LASTC * .. * .. External Functions .. LOGICAL LSAME INTEGER ILASLR, ILASLC EXTERNAL LSAME, ILASLR, ILASLC * .. * .. External Subroutines .. EXTERNAL SCOPY, SGEMM, STRMM * .. * .. Executable Statements .. * * Quick return if possible * IF( M.LE.0 .OR. N.LE.0 ) $ RETURN * IF( LSAME( TRANS, 'N' ) ) THEN TRANST = 'T' ELSE TRANST = 'N' END IF * IF( LSAME( STOREV, 'C' ) ) THEN * IF( LSAME( DIRECT, 'F' ) ) THEN * * Let V = ( V1 ) (first K rows) * ( V2 ) * where V1 is unit lower triangular. * IF( LSAME( SIDE, 'L' ) ) THEN * * Form H * C or H**T * C where C = ( C1 ) * ( C2 ) * LASTV = MAX( K, ILASLR( M, K, V, LDV ) ) LASTC = ILASLC( LASTV, N, C, LDC ) * * W := C**T * V = (C1**T * V1 + C2**T * V2) (stored in WORK) * * W := C1**T * DO 10 J = 1, K CALL SCOPY( LASTC, C( J, 1 ), LDC, WORK( 1, J ), 1 ) 10 CONTINUE * * W := W * V1 * CALL STRMM( 'Right', 'Lower', 'No transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C2**T *V2 * CALL SGEMM( 'Transpose', 'No transpose', $ LASTC, K, LASTV-K, $ ONE, C( K+1, 1 ), LDC, V( K+1, 1 ), LDV, $ ONE, WORK, LDWORK ) END IF * * W := W * T**T or W * T * CALL STRMM( 'Right', 'Upper', TRANST, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - V * W**T * IF( LASTV.GT.K ) THEN * * C2 := C2 - V2 * W**T * CALL SGEMM( 'No transpose', 'Transpose', $ LASTV-K, LASTC, K, $ -ONE, V( K+1, 1 ), LDV, WORK, LDWORK, ONE, $ C( K+1, 1 ), LDC ) END IF * * W := W * V1**T * CALL STRMM( 'Right', 'Lower', 'Transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) * * C1 := C1 - W**T * DO 30 J = 1, K DO 20 I = 1, LASTC C( J, I ) = C( J, I ) - WORK( I, J ) 20 CONTINUE 30 CONTINUE * ELSE IF( LSAME( SIDE, 'R' ) ) THEN * * Form C * H or C * H**T where C = ( C1 C2 ) * LASTV = MAX( K, ILASLR( N, K, V, LDV ) ) LASTC = ILASLR( M, LASTV, C, LDC ) * * W := C * V = (C1*V1 + C2*V2) (stored in WORK) * * W := C1 * DO 40 J = 1, K CALL SCOPY( LASTC, C( 1, J ), 1, WORK( 1, J ), 1 ) 40 CONTINUE * * W := W * V1 * CALL STRMM( 'Right', 'Lower', 'No transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C2 * V2 * CALL SGEMM( 'No transpose', 'No transpose', $ LASTC, K, LASTV-K, $ ONE, C( 1, K+1 ), LDC, V( K+1, 1 ), LDV, $ ONE, WORK, LDWORK ) END IF * * W := W * T or W * T**T * CALL STRMM( 'Right', 'Upper', TRANS, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - W * V**T * IF( LASTV.GT.K ) THEN * * C2 := C2 - W * V2**T * CALL SGEMM( 'No transpose', 'Transpose', $ LASTC, LASTV-K, K, $ -ONE, WORK, LDWORK, V( K+1, 1 ), LDV, ONE, $ C( 1, K+1 ), LDC ) END IF * * W := W * V1**T * CALL STRMM( 'Right', 'Lower', 'Transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) * * C1 := C1 - W * DO 60 J = 1, K DO 50 I = 1, LASTC C( I, J ) = C( I, J ) - WORK( I, J ) 50 CONTINUE 60 CONTINUE END IF * ELSE * * Let V = ( V1 ) * ( V2 ) (last K rows) * where V2 is unit upper triangular. * IF( LSAME( SIDE, 'L' ) ) THEN * * Form H * C or H**T * C where C = ( C1 ) * ( C2 ) * LASTV = MAX( K, ILASLR( M, K, V, LDV ) ) LASTC = ILASLC( LASTV, N, C, LDC ) * * W := C**T * V = (C1**T * V1 + C2**T * V2) (stored in WORK) * * W := C2**T * DO 70 J = 1, K CALL SCOPY( LASTC, C( LASTV-K+J, 1 ), LDC, $ WORK( 1, J ), 1 ) 70 CONTINUE * * W := W * V2 * CALL STRMM( 'Right', 'Upper', 'No transpose', 'Unit', $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, $ WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C1**T*V1 * CALL SGEMM( 'Transpose', 'No transpose', $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, $ ONE, WORK, LDWORK ) END IF * * W := W * T**T or W * T * CALL STRMM( 'Right', 'Lower', TRANST, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - V * W**T * IF( LASTV.GT.K ) THEN * * C1 := C1 - V1 * W**T * CALL SGEMM( 'No transpose', 'Transpose', $ LASTV-K, LASTC, K, -ONE, V, LDV, WORK, LDWORK, $ ONE, C, LDC ) END IF * * W := W * V2**T * CALL STRMM( 'Right', 'Upper', 'Transpose', 'Unit', $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, $ WORK, LDWORK ) * * C2 := C2 - W**T * DO 90 J = 1, K DO 80 I = 1, LASTC C( LASTV-K+J, I ) = C( LASTV-K+J, I ) - WORK(I, J) 80 CONTINUE 90 CONTINUE * ELSE IF( LSAME( SIDE, 'R' ) ) THEN * * Form C * H or C * H**T where C = ( C1 C2 ) * LASTV = MAX( K, ILASLR( N, K, V, LDV ) ) LASTC = ILASLR( M, LASTV, C, LDC ) * * W := C * V = (C1*V1 + C2*V2) (stored in WORK) * * W := C2 * DO 100 J = 1, K CALL SCOPY( LASTC, C( 1, N-K+J ), 1, WORK( 1, J ), 1 ) 100 CONTINUE * * W := W * V2 * CALL STRMM( 'Right', 'Upper', 'No transpose', 'Unit', $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, $ WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C1 * V1 * CALL SGEMM( 'No transpose', 'No transpose', $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, $ ONE, WORK, LDWORK ) END IF * * W := W * T or W * T**T * CALL STRMM( 'Right', 'Lower', TRANS, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - W * V**T * IF( LASTV.GT.K ) THEN * * C1 := C1 - W * V1**T * CALL SGEMM( 'No transpose', 'Transpose', $ LASTC, LASTV-K, K, -ONE, WORK, LDWORK, V, LDV, $ ONE, C, LDC ) END IF * * W := W * V2**T * CALL STRMM( 'Right', 'Upper', 'Transpose', 'Unit', $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, $ WORK, LDWORK ) * * C2 := C2 - W * DO 120 J = 1, K DO 110 I = 1, LASTC C( I, LASTV-K+J ) = C( I, LASTV-K+J ) - WORK(I, J) 110 CONTINUE 120 CONTINUE END IF END IF * ELSE IF( LSAME( STOREV, 'R' ) ) THEN * IF( LSAME( DIRECT, 'F' ) ) THEN * * Let V = ( V1 V2 ) (V1: first K columns) * where V1 is unit upper triangular. * IF( LSAME( SIDE, 'L' ) ) THEN * * Form H * C or H**T * C where C = ( C1 ) * ( C2 ) * LASTV = MAX( K, ILASLC( K, M, V, LDV ) ) LASTC = ILASLC( LASTV, N, C, LDC ) * * W := C**T * V**T = (C1**T * V1**T + C2**T * V2**T) (stored in WORK) * * W := C1**T * DO 130 J = 1, K CALL SCOPY( LASTC, C( J, 1 ), LDC, WORK( 1, J ), 1 ) 130 CONTINUE * * W := W * V1**T * CALL STRMM( 'Right', 'Upper', 'Transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C2**T*V2**T * CALL SGEMM( 'Transpose', 'Transpose', $ LASTC, K, LASTV-K, $ ONE, C( K+1, 1 ), LDC, V( 1, K+1 ), LDV, $ ONE, WORK, LDWORK ) END IF * * W := W * T**T or W * T * CALL STRMM( 'Right', 'Upper', TRANST, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - V**T * W**T * IF( LASTV.GT.K ) THEN * * C2 := C2 - V2**T * W**T * CALL SGEMM( 'Transpose', 'Transpose', $ LASTV-K, LASTC, K, $ -ONE, V( 1, K+1 ), LDV, WORK, LDWORK, $ ONE, C( K+1, 1 ), LDC ) END IF * * W := W * V1 * CALL STRMM( 'Right', 'Upper', 'No transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) * * C1 := C1 - W**T * DO 150 J = 1, K DO 140 I = 1, LASTC C( J, I ) = C( J, I ) - WORK( I, J ) 140 CONTINUE 150 CONTINUE * ELSE IF( LSAME( SIDE, 'R' ) ) THEN * * Form C * H or C * H**T where C = ( C1 C2 ) * LASTV = MAX( K, ILASLC( K, N, V, LDV ) ) LASTC = ILASLR( M, LASTV, C, LDC ) * * W := C * V**T = (C1*V1**T + C2*V2**T) (stored in WORK) * * W := C1 * DO 160 J = 1, K CALL SCOPY( LASTC, C( 1, J ), 1, WORK( 1, J ), 1 ) 160 CONTINUE * * W := W * V1**T * CALL STRMM( 'Right', 'Upper', 'Transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C2 * V2**T * CALL SGEMM( 'No transpose', 'Transpose', $ LASTC, K, LASTV-K, $ ONE, C( 1, K+1 ), LDC, V( 1, K+1 ), LDV, $ ONE, WORK, LDWORK ) END IF * * W := W * T or W * T**T * CALL STRMM( 'Right', 'Upper', TRANS, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - W * V * IF( LASTV.GT.K ) THEN * * C2 := C2 - W * V2 * CALL SGEMM( 'No transpose', 'No transpose', $ LASTC, LASTV-K, K, $ -ONE, WORK, LDWORK, V( 1, K+1 ), LDV, $ ONE, C( 1, K+1 ), LDC ) END IF * * W := W * V1 * CALL STRMM( 'Right', 'Upper', 'No transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) * * C1 := C1 - W * DO 180 J = 1, K DO 170 I = 1, LASTC C( I, J ) = C( I, J ) - WORK( I, J ) 170 CONTINUE 180 CONTINUE * END IF * ELSE * * Let V = ( V1 V2 ) (V2: last K columns) * where V2 is unit lower triangular. * IF( LSAME( SIDE, 'L' ) ) THEN * * Form H * C or H**T * C where C = ( C1 ) * ( C2 ) * LASTV = MAX( K, ILASLC( K, M, V, LDV ) ) LASTC = ILASLC( LASTV, N, C, LDC ) * * W := C**T * V**T = (C1**T * V1**T + C2**T * V2**T) (stored in WORK) * * W := C2**T * DO 190 J = 1, K CALL SCOPY( LASTC, C( LASTV-K+J, 1 ), LDC, $ WORK( 1, J ), 1 ) 190 CONTINUE * * W := W * V2**T * CALL STRMM( 'Right', 'Lower', 'Transpose', 'Unit', $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, $ WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C1**T * V1**T * CALL SGEMM( 'Transpose', 'Transpose', $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, $ ONE, WORK, LDWORK ) END IF * * W := W * T**T or W * T * CALL STRMM( 'Right', 'Lower', TRANST, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - V**T * W**T * IF( LASTV.GT.K ) THEN * * C1 := C1 - V1**T * W**T * CALL SGEMM( 'Transpose', 'Transpose', $ LASTV-K, LASTC, K, -ONE, V, LDV, WORK, LDWORK, $ ONE, C, LDC ) END IF * * W := W * V2 * CALL STRMM( 'Right', 'Lower', 'No transpose', 'Unit', $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, $ WORK, LDWORK ) * * C2 := C2 - W**T * DO 210 J = 1, K DO 200 I = 1, LASTC C( LASTV-K+J, I ) = C( LASTV-K+J, I ) - WORK(I, J) 200 CONTINUE 210 CONTINUE * ELSE IF( LSAME( SIDE, 'R' ) ) THEN * * Form C * H or C * H**T where C = ( C1 C2 ) * LASTV = MAX( K, ILASLC( K, N, V, LDV ) ) LASTC = ILASLR( M, LASTV, C, LDC ) * * W := C * V**T = (C1*V1**T + C2*V2**T) (stored in WORK) * * W := C2 * DO 220 J = 1, K CALL SCOPY( LASTC, C( 1, LASTV-K+J ), 1, $ WORK( 1, J ), 1 ) 220 CONTINUE * * W := W * V2**T * CALL STRMM( 'Right', 'Lower', 'Transpose', 'Unit', $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, $ WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C1 * V1**T * CALL SGEMM( 'No transpose', 'Transpose', $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, $ ONE, WORK, LDWORK ) END IF * * W := W * T or W * T**T * CALL STRMM( 'Right', 'Lower', TRANS, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - W * V * IF( LASTV.GT.K ) THEN * * C1 := C1 - W * V1 * CALL SGEMM( 'No transpose', 'No transpose', $ LASTC, LASTV-K, K, -ONE, WORK, LDWORK, V, LDV, $ ONE, C, LDC ) END IF * * W := W * V2 * CALL STRMM( 'Right', 'Lower', 'No transpose', 'Unit', $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, $ WORK, LDWORK ) * * C1 := C1 - W * DO 240 J = 1, K DO 230 I = 1, LASTC C( I, LASTV-K+J ) = C( I, LASTV-K+J ) $ - WORK( I, J ) 230 CONTINUE 240 CONTINUE * END IF * END IF END IF * RETURN * * End of SLARFB * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/slarfg.f ================================================ *> \brief \b SLARFG * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download SLARFG + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE SLARFG( N, ALPHA, X, INCX, TAU ) * * .. Scalar Arguments .. * INTEGER INCX, N * REAL ALPHA, TAU * .. * .. Array Arguments .. * REAL X( * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> SLARFG generates a real elementary reflector H of order n, such *> that *> *> H * ( alpha ) = ( beta ), H**T * H = I. *> ( x ) ( 0 ) *> *> where alpha and beta are scalars, and x is an (n-1)-element real *> vector. H is represented in the form *> *> H = I - tau * ( 1 ) * ( 1 v**T ) , *> ( v ) *> *> where tau is a real scalar and v is a real (n-1)-element *> vector. *> *> If the elements of x are all zero, then tau = 0 and H is taken to be *> the unit matrix. *> *> Otherwise 1 <= tau <= 2. *> \endverbatim * * Arguments: * ========== * *> \param[in] N *> \verbatim *> N is INTEGER *> The order of the elementary reflector. *> \endverbatim *> *> \param[in,out] ALPHA *> \verbatim *> ALPHA is REAL *> On entry, the value alpha. *> On exit, it is overwritten with the value beta. *> \endverbatim *> *> \param[in,out] X *> \verbatim *> X is REAL array, dimension *> (1+(N-2)*abs(INCX)) *> On entry, the vector x. *> On exit, it is overwritten with the vector v. *> \endverbatim *> *> \param[in] INCX *> \verbatim *> INCX is INTEGER *> The increment between elements of X. INCX > 0. *> \endverbatim *> *> \param[out] TAU *> \verbatim *> TAU is REAL *> The value tau. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup realOTHERauxiliary * * ===================================================================== SUBROUTINE SLARFG( N, ALPHA, X, INCX, TAU ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. INTEGER INCX, N REAL ALPHA, TAU * .. * .. Array Arguments .. REAL X( * ) * .. * * ===================================================================== * * .. Parameters .. REAL ONE, ZERO PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 ) * .. * .. Local Scalars .. INTEGER J, KNT REAL BETA, RSAFMN, SAFMIN, XNORM * .. * .. External Functions .. REAL SLAMCH, SLAPY2, SNRM2 EXTERNAL SLAMCH, SLAPY2, SNRM2 * .. * .. Intrinsic Functions .. INTRINSIC ABS, SIGN * .. * .. External Subroutines .. EXTERNAL SSCAL * .. * .. Executable Statements .. * IF( N.LE.1 ) THEN TAU = ZERO RETURN END IF * XNORM = SNRM2( N-1, X, INCX ) * IF( XNORM.EQ.ZERO ) THEN * * H = I * TAU = ZERO ELSE * * general case * BETA = -SIGN( SLAPY2( ALPHA, XNORM ), ALPHA ) SAFMIN = SLAMCH( 'S' ) / SLAMCH( 'E' ) KNT = 0 IF( ABS( BETA ).LT.SAFMIN ) THEN * * XNORM, BETA may be inaccurate; scale X and recompute them * RSAFMN = ONE / SAFMIN 10 CONTINUE KNT = KNT + 1 CALL SSCAL( N-1, RSAFMN, X, INCX ) BETA = BETA*RSAFMN ALPHA = ALPHA*RSAFMN IF( ABS( BETA ).LT.SAFMIN ) $ GO TO 10 * * New BETA is at most 1, at least SAFMIN * XNORM = SNRM2( N-1, X, INCX ) BETA = -SIGN( SLAPY2( ALPHA, XNORM ), ALPHA ) END IF TAU = ( BETA-ALPHA ) / BETA CALL SSCAL( N-1, ONE / ( ALPHA-BETA ), X, INCX ) * * If ALPHA is subnormal, it may lose relative accuracy * DO 20 J = 1, KNT BETA = BETA*SAFMIN 20 CONTINUE ALPHA = BETA END IF * RETURN * * End of SLARFG * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/slarft.f ================================================ *> \brief \b SLARFT * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download SLARFT + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE SLARFT( DIRECT, STOREV, N, K, V, LDV, TAU, T, LDT ) * * .. Scalar Arguments .. * CHARACTER DIRECT, STOREV * INTEGER K, LDT, LDV, N * .. * .. Array Arguments .. * REAL T( LDT, * ), TAU( * ), V( LDV, * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> SLARFT forms the triangular factor T of a real block reflector H *> of order n, which is defined as a product of k elementary reflectors. *> *> If DIRECT = 'F', H = H(1) H(2) . . . H(k) and T is upper triangular; *> *> If DIRECT = 'B', H = H(k) . . . H(2) H(1) and T is lower triangular. *> *> If STOREV = 'C', the vector which defines the elementary reflector *> H(i) is stored in the i-th column of the array V, and *> *> H = I - V * T * V**T *> *> If STOREV = 'R', the vector which defines the elementary reflector *> H(i) is stored in the i-th row of the array V, and *> *> H = I - V**T * T * V *> \endverbatim * * Arguments: * ========== * *> \param[in] DIRECT *> \verbatim *> DIRECT is CHARACTER*1 *> Specifies the order in which the elementary reflectors are *> multiplied to form the block reflector: *> = 'F': H = H(1) H(2) . . . H(k) (Forward) *> = 'B': H = H(k) . . . H(2) H(1) (Backward) *> \endverbatim *> *> \param[in] STOREV *> \verbatim *> STOREV is CHARACTER*1 *> Specifies how the vectors which define the elementary *> reflectors are stored (see also Further Details): *> = 'C': columnwise *> = 'R': rowwise *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The order of the block reflector H. N >= 0. *> \endverbatim *> *> \param[in] K *> \verbatim *> K is INTEGER *> The order of the triangular factor T (= the number of *> elementary reflectors). K >= 1. *> \endverbatim *> *> \param[in] V *> \verbatim *> V is REAL array, dimension *> (LDV,K) if STOREV = 'C' *> (LDV,N) if STOREV = 'R' *> The matrix V. See further details. *> \endverbatim *> *> \param[in] LDV *> \verbatim *> LDV is INTEGER *> The leading dimension of the array V. *> If STOREV = 'C', LDV >= max(1,N); if STOREV = 'R', LDV >= K. *> \endverbatim *> *> \param[in] TAU *> \verbatim *> TAU is REAL array, dimension (K) *> TAU(i) must contain the scalar factor of the elementary *> reflector H(i). *> \endverbatim *> *> \param[out] T *> \verbatim *> T is REAL array, dimension (LDT,K) *> The k by k triangular factor T of the block reflector. *> If DIRECT = 'F', T is upper triangular; if DIRECT = 'B', T is *> lower triangular. The rest of the array is not used. *> \endverbatim *> *> \param[in] LDT *> \verbatim *> LDT is INTEGER *> The leading dimension of the array T. LDT >= K. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date April 2012 * *> \ingroup realOTHERauxiliary * *> \par Further Details: * ===================== *> *> \verbatim *> *> The shape of the matrix V and the storage of the vectors which define *> the H(i) is best illustrated by the following example with n = 5 and *> k = 3. The elements equal to 1 are not stored. *> *> DIRECT = 'F' and STOREV = 'C': DIRECT = 'F' and STOREV = 'R': *> *> V = ( 1 ) V = ( 1 v1 v1 v1 v1 ) *> ( v1 1 ) ( 1 v2 v2 v2 ) *> ( v1 v2 1 ) ( 1 v3 v3 ) *> ( v1 v2 v3 ) *> ( v1 v2 v3 ) *> *> DIRECT = 'B' and STOREV = 'C': DIRECT = 'B' and STOREV = 'R': *> *> V = ( v1 v2 v3 ) V = ( v1 v1 1 ) *> ( v1 v2 v3 ) ( v2 v2 v2 1 ) *> ( 1 v2 v3 ) ( v3 v3 v3 v3 1 ) *> ( 1 v3 ) *> ( 1 ) *> \endverbatim *> * ===================================================================== SUBROUTINE SLARFT( DIRECT, STOREV, N, K, V, LDV, TAU, T, LDT ) * * -- LAPACK auxiliary routine (version 3.4.1) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * April 2012 * * .. Scalar Arguments .. CHARACTER DIRECT, STOREV INTEGER K, LDT, LDV, N * .. * .. Array Arguments .. REAL T( LDT, * ), TAU( * ), V( LDV, * ) * .. * * ===================================================================== * * .. Parameters .. REAL ONE, ZERO PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 ) * .. * .. Local Scalars .. INTEGER I, J, PREVLASTV, LASTV * .. * .. External Subroutines .. EXTERNAL SGEMV, STRMV * .. * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. * .. Executable Statements .. * * Quick return if possible * IF( N.EQ.0 ) $ RETURN * IF( LSAME( DIRECT, 'F' ) ) THEN PREVLASTV = N DO I = 1, K PREVLASTV = MAX( I, PREVLASTV ) IF( TAU( I ).EQ.ZERO ) THEN * * H(i) = I * DO J = 1, I T( J, I ) = ZERO END DO ELSE * * general case * IF( LSAME( STOREV, 'C' ) ) THEN * Skip any trailing zeros. DO LASTV = N, I+1, -1 IF( V( LASTV, I ).NE.ZERO ) EXIT END DO DO J = 1, I-1 T( J, I ) = -TAU( I ) * V( I , J ) END DO J = MIN( LASTV, PREVLASTV ) * * T(1:i-1,i) := - tau(i) * V(i:j,1:i-1)**T * V(i:j,i) * CALL SGEMV( 'Transpose', J-I, I-1, -TAU( I ), $ V( I+1, 1 ), LDV, V( I+1, I ), 1, ONE, $ T( 1, I ), 1 ) ELSE * Skip any trailing zeros. DO LASTV = N, I+1, -1 IF( V( I, LASTV ).NE.ZERO ) EXIT END DO DO J = 1, I-1 T( J, I ) = -TAU( I ) * V( J , I ) END DO J = MIN( LASTV, PREVLASTV ) * * T(1:i-1,i) := - tau(i) * V(1:i-1,i:j) * V(i,i:j)**T * CALL SGEMV( 'No transpose', I-1, J-I, -TAU( I ), $ V( 1, I+1 ), LDV, V( I, I+1 ), LDV, $ ONE, T( 1, I ), 1 ) END IF * * T(1:i-1,i) := T(1:i-1,1:i-1) * T(1:i-1,i) * CALL STRMV( 'Upper', 'No transpose', 'Non-unit', I-1, T, $ LDT, T( 1, I ), 1 ) T( I, I ) = TAU( I ) IF( I.GT.1 ) THEN PREVLASTV = MAX( PREVLASTV, LASTV ) ELSE PREVLASTV = LASTV END IF END IF END DO ELSE PREVLASTV = 1 DO I = K, 1, -1 IF( TAU( I ).EQ.ZERO ) THEN * * H(i) = I * DO J = I, K T( J, I ) = ZERO END DO ELSE * * general case * IF( I.LT.K ) THEN IF( LSAME( STOREV, 'C' ) ) THEN * Skip any leading zeros. DO LASTV = 1, I-1 IF( V( LASTV, I ).NE.ZERO ) EXIT END DO DO J = I+1, K T( J, I ) = -TAU( I ) * V( N-K+I , J ) END DO J = MAX( LASTV, PREVLASTV ) * * T(i+1:k,i) = -tau(i) * V(j:n-k+i,i+1:k)**T * V(j:n-k+i,i) * CALL SGEMV( 'Transpose', N-K+I-J, K-I, -TAU( I ), $ V( J, I+1 ), LDV, V( J, I ), 1, ONE, $ T( I+1, I ), 1 ) ELSE * Skip any leading zeros. DO LASTV = 1, I-1 IF( V( I, LASTV ).NE.ZERO ) EXIT END DO DO J = I+1, K T( J, I ) = -TAU( I ) * V( J, N-K+I ) END DO J = MAX( LASTV, PREVLASTV ) * * T(i+1:k,i) = -tau(i) * V(i+1:k,j:n-k+i) * V(i,j:n-k+i)**T * CALL SGEMV( 'No transpose', K-I, N-K+I-J, $ -TAU( I ), V( I+1, J ), LDV, V( I, J ), LDV, $ ONE, T( I+1, I ), 1 ) END IF * * T(i+1:k,i) := T(i+1:k,i+1:k) * T(i+1:k,i) * CALL STRMV( 'Lower', 'No transpose', 'Non-unit', K-I, $ T( I+1, I+1 ), LDT, T( I+1, I ), 1 ) IF( I.GT.1 ) THEN PREVLASTV = MIN( PREVLASTV, LASTV ) ELSE PREVLASTV = LASTV END IF END IF T( I, I ) = TAU( I ) END IF END DO END IF RETURN * * End of SLARFT * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/svd.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "lapack_common.h" #include // computes the singular values/vectors a general M-by-N matrix A using divide-and-conquer EIGEN_LAPACK_FUNC(gesdd,(char *jobz, int *m, int* n, Scalar* a, int *lda, RealScalar *s, Scalar *u, int *ldu, Scalar *vt, int *ldvt, Scalar* /*work*/, int* lwork, EIGEN_LAPACK_ARG_IF_COMPLEX(RealScalar */*rwork*/) int * /*iwork*/, int *info)) { // TODO exploit the work buffer bool query_size = *lwork==-1; int diag_size = (std::min)(*m,*n); *info = 0; if(*jobz!='A' && *jobz!='S' && *jobz!='O' && *jobz!='N') *info = -1; else if(*m<0) *info = -2; else if(*n<0) *info = -3; else if(*lda=*n && *ldvt<*n)) *info = -10; if(*info!=0) { int e = -*info; return xerbla_(SCALAR_SUFFIX_UP"GESDD ", &e, 6); } if(query_size) { *lwork = 0; return 0; } if(*n==0 || *m==0) return 0; PlainMatrixType mat(*m,*n); mat = matrix(a,*m,*n,*lda); int option = *jobz=='A' ? ComputeFullU|ComputeFullV : *jobz=='S' ? ComputeThinU|ComputeThinV : *jobz=='O' ? ComputeThinU|ComputeThinV : 0; BDCSVD svd(mat,option); make_vector(s,diag_size) = svd.singularValues().head(diag_size); if(*jobz=='A') { matrix(u,*m,*m,*ldu) = svd.matrixU(); matrix(vt,*n,*n,*ldvt) = svd.matrixV().adjoint(); } else if(*jobz=='S') { matrix(u,*m,diag_size,*ldu) = svd.matrixU(); matrix(vt,diag_size,*n,*ldvt) = svd.matrixV().adjoint(); } else if(*jobz=='O' && *m>=*n) { matrix(a,*m,*n,*lda) = svd.matrixU(); matrix(vt,*n,*n,*ldvt) = svd.matrixV().adjoint(); } else if(*jobz=='O') { matrix(u,*m,*m,*ldu) = svd.matrixU(); matrix(a,diag_size,*n,*lda) = svd.matrixV().adjoint(); } return 0; } // computes the singular values/vectors a general M-by-N matrix A using two sided jacobi algorithm EIGEN_LAPACK_FUNC(gesvd,(char *jobu, char *jobv, int *m, int* n, Scalar* a, int *lda, RealScalar *s, Scalar *u, int *ldu, Scalar *vt, int *ldvt, Scalar* /*work*/, int* lwork, EIGEN_LAPACK_ARG_IF_COMPLEX(RealScalar */*rwork*/) int *info)) { // TODO exploit the work buffer bool query_size = *lwork==-1; int diag_size = (std::min)(*m,*n); *info = 0; if( *jobu!='A' && *jobu!='S' && *jobu!='O' && *jobu!='N') *info = -1; else if((*jobv!='A' && *jobv!='S' && *jobv!='O' && *jobv!='N') || (*jobu=='O' && *jobv=='O')) *info = -2; else if(*m<0) *info = -3; else if(*n<0) *info = -4; else if(*lda svd(mat,option); make_vector(s,diag_size) = svd.singularValues().head(diag_size); { if(*jobu=='A') matrix(u,*m,*m,*ldu) = svd.matrixU(); else if(*jobu=='S') matrix(u,*m,diag_size,*ldu) = svd.matrixU(); else if(*jobu=='O') matrix(a,*m,diag_size,*lda) = svd.matrixU(); } { if(*jobv=='A') matrix(vt,*n,*n,*ldvt) = svd.matrixV().adjoint(); else if(*jobv=='S') matrix(vt,diag_size,*n,*ldvt) = svd.matrixV().adjoint(); else if(*jobv=='O') matrix(a,diag_size,*n,*lda) = svd.matrixV().adjoint(); } return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/lapack/zlacgv.f ================================================ *> \brief \b ZLACGV * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download ZLACGV + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE ZLACGV( N, X, INCX ) * * .. Scalar Arguments .. * INTEGER INCX, N * .. * .. Array Arguments .. * COMPLEX*16 X( * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> ZLACGV conjugates a complex vector of length N. *> \endverbatim * * Arguments: * ========== * *> \param[in] N *> \verbatim *> N is INTEGER *> The length of the vector X. N >= 0. *> \endverbatim *> *> \param[in,out] X *> \verbatim *> X is COMPLEX*16 array, dimension *> (1+(N-1)*abs(INCX)) *> On entry, the vector of length N to be conjugated. *> On exit, X is overwritten with conjg(X). *> \endverbatim *> *> \param[in] INCX *> \verbatim *> INCX is INTEGER *> The spacing between successive elements of X. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup complex16OTHERauxiliary * * ===================================================================== SUBROUTINE ZLACGV( N, X, INCX ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. INTEGER INCX, N * .. * .. Array Arguments .. COMPLEX*16 X( * ) * .. * * ===================================================================== * * .. Local Scalars .. INTEGER I, IOFF * .. * .. Intrinsic Functions .. INTRINSIC DCONJG * .. * .. Executable Statements .. * IF( INCX.EQ.1 ) THEN DO 10 I = 1, N X( I ) = DCONJG( X( I ) ) 10 CONTINUE ELSE IOFF = 1 IF( INCX.LT.0 ) $ IOFF = 1 - ( N-1 )*INCX DO 20 I = 1, N X( IOFF ) = DCONJG( X( IOFF ) ) IOFF = IOFF + INCX 20 CONTINUE END IF RETURN * * End of ZLACGV * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/zladiv.f ================================================ *> \brief \b ZLADIV * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download ZLADIV + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * COMPLEX*16 FUNCTION ZLADIV( X, Y ) * * .. Scalar Arguments .. * COMPLEX*16 X, Y * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> ZLADIV := X / Y, where X and Y are complex. The computation of X / Y *> will not overflow on an intermediary step unless the results *> overflows. *> \endverbatim * * Arguments: * ========== * *> \param[in] X *> \verbatim *> X is COMPLEX*16 *> \endverbatim *> *> \param[in] Y *> \verbatim *> Y is COMPLEX*16 *> The complex scalars X and Y. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup complex16OTHERauxiliary * * ===================================================================== COMPLEX*16 FUNCTION ZLADIV( X, Y ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. COMPLEX*16 X, Y * .. * * ===================================================================== * * .. Local Scalars .. DOUBLE PRECISION ZI, ZR * .. * .. External Subroutines .. EXTERNAL DLADIV * .. * .. Intrinsic Functions .. INTRINSIC DBLE, DCMPLX, DIMAG * .. * .. Executable Statements .. * CALL DLADIV( DBLE( X ), DIMAG( X ), DBLE( Y ), DIMAG( Y ), ZR, $ ZI ) ZLADIV = DCMPLX( ZR, ZI ) * RETURN * * End of ZLADIV * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/zlarf.f ================================================ *> \brief \b ZLARF * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download ZLARF + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE ZLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK ) * * .. Scalar Arguments .. * CHARACTER SIDE * INTEGER INCV, LDC, M, N * COMPLEX*16 TAU * .. * .. Array Arguments .. * COMPLEX*16 C( LDC, * ), V( * ), WORK( * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> ZLARF applies a complex elementary reflector H to a complex M-by-N *> matrix C, from either the left or the right. H is represented in the *> form *> *> H = I - tau * v * v**H *> *> where tau is a complex scalar and v is a complex vector. *> *> If tau = 0, then H is taken to be the unit matrix. *> *> To apply H**H, supply conjg(tau) instead *> tau. *> \endverbatim * * Arguments: * ========== * *> \param[in] SIDE *> \verbatim *> SIDE is CHARACTER*1 *> = 'L': form H * C *> = 'R': form C * H *> \endverbatim *> *> \param[in] M *> \verbatim *> M is INTEGER *> The number of rows of the matrix C. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The number of columns of the matrix C. *> \endverbatim *> *> \param[in] V *> \verbatim *> V is COMPLEX*16 array, dimension *> (1 + (M-1)*abs(INCV)) if SIDE = 'L' *> or (1 + (N-1)*abs(INCV)) if SIDE = 'R' *> The vector v in the representation of H. V is not used if *> TAU = 0. *> \endverbatim *> *> \param[in] INCV *> \verbatim *> INCV is INTEGER *> The increment between elements of v. INCV <> 0. *> \endverbatim *> *> \param[in] TAU *> \verbatim *> TAU is COMPLEX*16 *> The value tau in the representation of H. *> \endverbatim *> *> \param[in,out] C *> \verbatim *> C is COMPLEX*16 array, dimension (LDC,N) *> On entry, the M-by-N matrix C. *> On exit, C is overwritten by the matrix H * C if SIDE = 'L', *> or C * H if SIDE = 'R'. *> \endverbatim *> *> \param[in] LDC *> \verbatim *> LDC is INTEGER *> The leading dimension of the array C. LDC >= max(1,M). *> \endverbatim *> *> \param[out] WORK *> \verbatim *> WORK is COMPLEX*16 array, dimension *> (N) if SIDE = 'L' *> or (M) if SIDE = 'R' *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup complex16OTHERauxiliary * * ===================================================================== SUBROUTINE ZLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. CHARACTER SIDE INTEGER INCV, LDC, M, N COMPLEX*16 TAU * .. * .. Array Arguments .. COMPLEX*16 C( LDC, * ), V( * ), WORK( * ) * .. * * ===================================================================== * * .. Parameters .. COMPLEX*16 ONE, ZERO PARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ), $ ZERO = ( 0.0D+0, 0.0D+0 ) ) * .. * .. Local Scalars .. LOGICAL APPLYLEFT INTEGER I, LASTV, LASTC * .. * .. External Subroutines .. EXTERNAL ZGEMV, ZGERC * .. * .. External Functions .. LOGICAL LSAME INTEGER ILAZLR, ILAZLC EXTERNAL LSAME, ILAZLR, ILAZLC * .. * .. Executable Statements .. * APPLYLEFT = LSAME( SIDE, 'L' ) LASTV = 0 LASTC = 0 IF( TAU.NE.ZERO ) THEN * Set up variables for scanning V. LASTV begins pointing to the end * of V. IF( APPLYLEFT ) THEN LASTV = M ELSE LASTV = N END IF IF( INCV.GT.0 ) THEN I = 1 + (LASTV-1) * INCV ELSE I = 1 END IF * Look for the last non-zero row in V. DO WHILE( LASTV.GT.0 .AND. V( I ).EQ.ZERO ) LASTV = LASTV - 1 I = I - INCV END DO IF( APPLYLEFT ) THEN * Scan for the last non-zero column in C(1:lastv,:). LASTC = ILAZLC(LASTV, N, C, LDC) ELSE * Scan for the last non-zero row in C(:,1:lastv). LASTC = ILAZLR(M, LASTV, C, LDC) END IF END IF * Note that lastc.eq.0 renders the BLAS operations null; no special * case is needed at this level. IF( APPLYLEFT ) THEN * * Form H * C * IF( LASTV.GT.0 ) THEN * * w(1:lastc,1) := C(1:lastv,1:lastc)**H * v(1:lastv,1) * CALL ZGEMV( 'Conjugate transpose', LASTV, LASTC, ONE, $ C, LDC, V, INCV, ZERO, WORK, 1 ) * * C(1:lastv,1:lastc) := C(...) - v(1:lastv,1) * w(1:lastc,1)**H * CALL ZGERC( LASTV, LASTC, -TAU, V, INCV, WORK, 1, C, LDC ) END IF ELSE * * Form C * H * IF( LASTV.GT.0 ) THEN * * w(1:lastc,1) := C(1:lastc,1:lastv) * v(1:lastv,1) * CALL ZGEMV( 'No transpose', LASTC, LASTV, ONE, C, LDC, $ V, INCV, ZERO, WORK, 1 ) * * C(1:lastc,1:lastv) := C(...) - w(1:lastc,1) * v(1:lastv,1)**H * CALL ZGERC( LASTC, LASTV, -TAU, WORK, 1, V, INCV, C, LDC ) END IF END IF RETURN * * End of ZLARF * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/zlarfb.f ================================================ *> \brief \b ZLARFB * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download ZLARFB + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE ZLARFB( SIDE, TRANS, DIRECT, STOREV, M, N, K, V, LDV, * T, LDT, C, LDC, WORK, LDWORK ) * * .. Scalar Arguments .. * CHARACTER DIRECT, SIDE, STOREV, TRANS * INTEGER K, LDC, LDT, LDV, LDWORK, M, N * .. * .. Array Arguments .. * COMPLEX*16 C( LDC, * ), T( LDT, * ), V( LDV, * ), * $ WORK( LDWORK, * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> ZLARFB applies a complex block reflector H or its transpose H**H to a *> complex M-by-N matrix C, from either the left or the right. *> \endverbatim * * Arguments: * ========== * *> \param[in] SIDE *> \verbatim *> SIDE is CHARACTER*1 *> = 'L': apply H or H**H from the Left *> = 'R': apply H or H**H from the Right *> \endverbatim *> *> \param[in] TRANS *> \verbatim *> TRANS is CHARACTER*1 *> = 'N': apply H (No transpose) *> = 'C': apply H**H (Conjugate transpose) *> \endverbatim *> *> \param[in] DIRECT *> \verbatim *> DIRECT is CHARACTER*1 *> Indicates how H is formed from a product of elementary *> reflectors *> = 'F': H = H(1) H(2) . . . H(k) (Forward) *> = 'B': H = H(k) . . . H(2) H(1) (Backward) *> \endverbatim *> *> \param[in] STOREV *> \verbatim *> STOREV is CHARACTER*1 *> Indicates how the vectors which define the elementary *> reflectors are stored: *> = 'C': Columnwise *> = 'R': Rowwise *> \endverbatim *> *> \param[in] M *> \verbatim *> M is INTEGER *> The number of rows of the matrix C. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The number of columns of the matrix C. *> \endverbatim *> *> \param[in] K *> \verbatim *> K is INTEGER *> The order of the matrix T (= the number of elementary *> reflectors whose product defines the block reflector). *> \endverbatim *> *> \param[in] V *> \verbatim *> V is COMPLEX*16 array, dimension *> (LDV,K) if STOREV = 'C' *> (LDV,M) if STOREV = 'R' and SIDE = 'L' *> (LDV,N) if STOREV = 'R' and SIDE = 'R' *> See Further Details. *> \endverbatim *> *> \param[in] LDV *> \verbatim *> LDV is INTEGER *> The leading dimension of the array V. *> If STOREV = 'C' and SIDE = 'L', LDV >= max(1,M); *> if STOREV = 'C' and SIDE = 'R', LDV >= max(1,N); *> if STOREV = 'R', LDV >= K. *> \endverbatim *> *> \param[in] T *> \verbatim *> T is COMPLEX*16 array, dimension (LDT,K) *> The triangular K-by-K matrix T in the representation of the *> block reflector. *> \endverbatim *> *> \param[in] LDT *> \verbatim *> LDT is INTEGER *> The leading dimension of the array T. LDT >= K. *> \endverbatim *> *> \param[in,out] C *> \verbatim *> C is COMPLEX*16 array, dimension (LDC,N) *> On entry, the M-by-N matrix C. *> On exit, C is overwritten by H*C or H**H*C or C*H or C*H**H. *> \endverbatim *> *> \param[in] LDC *> \verbatim *> LDC is INTEGER *> The leading dimension of the array C. LDC >= max(1,M). *> \endverbatim *> *> \param[out] WORK *> \verbatim *> WORK is COMPLEX*16 array, dimension (LDWORK,K) *> \endverbatim *> *> \param[in] LDWORK *> \verbatim *> LDWORK is INTEGER *> The leading dimension of the array WORK. *> If SIDE = 'L', LDWORK >= max(1,N); *> if SIDE = 'R', LDWORK >= max(1,M). *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup complex16OTHERauxiliary * *> \par Further Details: * ===================== *> *> \verbatim *> *> The shape of the matrix V and the storage of the vectors which define *> the H(i) is best illustrated by the following example with n = 5 and *> k = 3. The elements equal to 1 are not stored; the corresponding *> array elements are modified but restored on exit. The rest of the *> array is not used. *> *> DIRECT = 'F' and STOREV = 'C': DIRECT = 'F' and STOREV = 'R': *> *> V = ( 1 ) V = ( 1 v1 v1 v1 v1 ) *> ( v1 1 ) ( 1 v2 v2 v2 ) *> ( v1 v2 1 ) ( 1 v3 v3 ) *> ( v1 v2 v3 ) *> ( v1 v2 v3 ) *> *> DIRECT = 'B' and STOREV = 'C': DIRECT = 'B' and STOREV = 'R': *> *> V = ( v1 v2 v3 ) V = ( v1 v1 1 ) *> ( v1 v2 v3 ) ( v2 v2 v2 1 ) *> ( 1 v2 v3 ) ( v3 v3 v3 v3 1 ) *> ( 1 v3 ) *> ( 1 ) *> \endverbatim *> * ===================================================================== SUBROUTINE ZLARFB( SIDE, TRANS, DIRECT, STOREV, M, N, K, V, LDV, $ T, LDT, C, LDC, WORK, LDWORK ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. CHARACTER DIRECT, SIDE, STOREV, TRANS INTEGER K, LDC, LDT, LDV, LDWORK, M, N * .. * .. Array Arguments .. COMPLEX*16 C( LDC, * ), T( LDT, * ), V( LDV, * ), $ WORK( LDWORK, * ) * .. * * ===================================================================== * * .. Parameters .. COMPLEX*16 ONE PARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ) ) * .. * .. Local Scalars .. CHARACTER TRANST INTEGER I, J, LASTV, LASTC * .. * .. External Functions .. LOGICAL LSAME INTEGER ILAZLR, ILAZLC EXTERNAL LSAME, ILAZLR, ILAZLC * .. * .. External Subroutines .. EXTERNAL ZCOPY, ZGEMM, ZLACGV, ZTRMM * .. * .. Intrinsic Functions .. INTRINSIC DCONJG * .. * .. Executable Statements .. * * Quick return if possible * IF( M.LE.0 .OR. N.LE.0 ) $ RETURN * IF( LSAME( TRANS, 'N' ) ) THEN TRANST = 'C' ELSE TRANST = 'N' END IF * IF( LSAME( STOREV, 'C' ) ) THEN * IF( LSAME( DIRECT, 'F' ) ) THEN * * Let V = ( V1 ) (first K rows) * ( V2 ) * where V1 is unit lower triangular. * IF( LSAME( SIDE, 'L' ) ) THEN * * Form H * C or H**H * C where C = ( C1 ) * ( C2 ) * LASTV = MAX( K, ILAZLR( M, K, V, LDV ) ) LASTC = ILAZLC( LASTV, N, C, LDC ) * * W := C**H * V = (C1**H * V1 + C2**H * V2) (stored in WORK) * * W := C1**H * DO 10 J = 1, K CALL ZCOPY( LASTC, C( J, 1 ), LDC, WORK( 1, J ), 1 ) CALL ZLACGV( LASTC, WORK( 1, J ), 1 ) 10 CONTINUE * * W := W * V1 * CALL ZTRMM( 'Right', 'Lower', 'No transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C2**H *V2 * CALL ZGEMM( 'Conjugate transpose', 'No transpose', $ LASTC, K, LASTV-K, ONE, C( K+1, 1 ), LDC, $ V( K+1, 1 ), LDV, ONE, WORK, LDWORK ) END IF * * W := W * T**H or W * T * CALL ZTRMM( 'Right', 'Upper', TRANST, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - V * W**H * IF( M.GT.K ) THEN * * C2 := C2 - V2 * W**H * CALL ZGEMM( 'No transpose', 'Conjugate transpose', $ LASTV-K, LASTC, K, $ -ONE, V( K+1, 1 ), LDV, WORK, LDWORK, $ ONE, C( K+1, 1 ), LDC ) END IF * * W := W * V1**H * CALL ZTRMM( 'Right', 'Lower', 'Conjugate transpose', $ 'Unit', LASTC, K, ONE, V, LDV, WORK, LDWORK ) * * C1 := C1 - W**H * DO 30 J = 1, K DO 20 I = 1, LASTC C( J, I ) = C( J, I ) - DCONJG( WORK( I, J ) ) 20 CONTINUE 30 CONTINUE * ELSE IF( LSAME( SIDE, 'R' ) ) THEN * * Form C * H or C * H**H where C = ( C1 C2 ) * LASTV = MAX( K, ILAZLR( N, K, V, LDV ) ) LASTC = ILAZLR( M, LASTV, C, LDC ) * * W := C * V = (C1*V1 + C2*V2) (stored in WORK) * * W := C1 * DO 40 J = 1, K CALL ZCOPY( LASTC, C( 1, J ), 1, WORK( 1, J ), 1 ) 40 CONTINUE * * W := W * V1 * CALL ZTRMM( 'Right', 'Lower', 'No transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C2 * V2 * CALL ZGEMM( 'No transpose', 'No transpose', $ LASTC, K, LASTV-K, $ ONE, C( 1, K+1 ), LDC, V( K+1, 1 ), LDV, $ ONE, WORK, LDWORK ) END IF * * W := W * T or W * T**H * CALL ZTRMM( 'Right', 'Upper', TRANS, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - W * V**H * IF( LASTV.GT.K ) THEN * * C2 := C2 - W * V2**H * CALL ZGEMM( 'No transpose', 'Conjugate transpose', $ LASTC, LASTV-K, K, $ -ONE, WORK, LDWORK, V( K+1, 1 ), LDV, $ ONE, C( 1, K+1 ), LDC ) END IF * * W := W * V1**H * CALL ZTRMM( 'Right', 'Lower', 'Conjugate transpose', $ 'Unit', LASTC, K, ONE, V, LDV, WORK, LDWORK ) * * C1 := C1 - W * DO 60 J = 1, K DO 50 I = 1, LASTC C( I, J ) = C( I, J ) - WORK( I, J ) 50 CONTINUE 60 CONTINUE END IF * ELSE * * Let V = ( V1 ) * ( V2 ) (last K rows) * where V2 is unit upper triangular. * IF( LSAME( SIDE, 'L' ) ) THEN * * Form H * C or H**H * C where C = ( C1 ) * ( C2 ) * LASTV = MAX( K, ILAZLR( M, K, V, LDV ) ) LASTC = ILAZLC( LASTV, N, C, LDC ) * * W := C**H * V = (C1**H * V1 + C2**H * V2) (stored in WORK) * * W := C2**H * DO 70 J = 1, K CALL ZCOPY( LASTC, C( LASTV-K+J, 1 ), LDC, $ WORK( 1, J ), 1 ) CALL ZLACGV( LASTC, WORK( 1, J ), 1 ) 70 CONTINUE * * W := W * V2 * CALL ZTRMM( 'Right', 'Upper', 'No transpose', 'Unit', $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, $ WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C1**H*V1 * CALL ZGEMM( 'Conjugate transpose', 'No transpose', $ LASTC, K, LASTV-K, $ ONE, C, LDC, V, LDV, $ ONE, WORK, LDWORK ) END IF * * W := W * T**H or W * T * CALL ZTRMM( 'Right', 'Lower', TRANST, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - V * W**H * IF( LASTV.GT.K ) THEN * * C1 := C1 - V1 * W**H * CALL ZGEMM( 'No transpose', 'Conjugate transpose', $ LASTV-K, LASTC, K, $ -ONE, V, LDV, WORK, LDWORK, $ ONE, C, LDC ) END IF * * W := W * V2**H * CALL ZTRMM( 'Right', 'Upper', 'Conjugate transpose', $ 'Unit', LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, $ WORK, LDWORK ) * * C2 := C2 - W**H * DO 90 J = 1, K DO 80 I = 1, LASTC C( LASTV-K+J, I ) = C( LASTV-K+J, I ) - $ DCONJG( WORK( I, J ) ) 80 CONTINUE 90 CONTINUE * ELSE IF( LSAME( SIDE, 'R' ) ) THEN * * Form C * H or C * H**H where C = ( C1 C2 ) * LASTV = MAX( K, ILAZLR( N, K, V, LDV ) ) LASTC = ILAZLR( M, LASTV, C, LDC ) * * W := C * V = (C1*V1 + C2*V2) (stored in WORK) * * W := C2 * DO 100 J = 1, K CALL ZCOPY( LASTC, C( 1, LASTV-K+J ), 1, $ WORK( 1, J ), 1 ) 100 CONTINUE * * W := W * V2 * CALL ZTRMM( 'Right', 'Upper', 'No transpose', 'Unit', $ LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, $ WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C1 * V1 * CALL ZGEMM( 'No transpose', 'No transpose', $ LASTC, K, LASTV-K, $ ONE, C, LDC, V, LDV, ONE, WORK, LDWORK ) END IF * * W := W * T or W * T**H * CALL ZTRMM( 'Right', 'Lower', TRANS, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - W * V**H * IF( LASTV.GT.K ) THEN * * C1 := C1 - W * V1**H * CALL ZGEMM( 'No transpose', 'Conjugate transpose', $ LASTC, LASTV-K, K, -ONE, WORK, LDWORK, V, LDV, $ ONE, C, LDC ) END IF * * W := W * V2**H * CALL ZTRMM( 'Right', 'Upper', 'Conjugate transpose', $ 'Unit', LASTC, K, ONE, V( LASTV-K+1, 1 ), LDV, $ WORK, LDWORK ) * * C2 := C2 - W * DO 120 J = 1, K DO 110 I = 1, LASTC C( I, LASTV-K+J ) = C( I, LASTV-K+J ) $ - WORK( I, J ) 110 CONTINUE 120 CONTINUE END IF END IF * ELSE IF( LSAME( STOREV, 'R' ) ) THEN * IF( LSAME( DIRECT, 'F' ) ) THEN * * Let V = ( V1 V2 ) (V1: first K columns) * where V1 is unit upper triangular. * IF( LSAME( SIDE, 'L' ) ) THEN * * Form H * C or H**H * C where C = ( C1 ) * ( C2 ) * LASTV = MAX( K, ILAZLC( K, M, V, LDV ) ) LASTC = ILAZLC( LASTV, N, C, LDC ) * * W := C**H * V**H = (C1**H * V1**H + C2**H * V2**H) (stored in WORK) * * W := C1**H * DO 130 J = 1, K CALL ZCOPY( LASTC, C( J, 1 ), LDC, WORK( 1, J ), 1 ) CALL ZLACGV( LASTC, WORK( 1, J ), 1 ) 130 CONTINUE * * W := W * V1**H * CALL ZTRMM( 'Right', 'Upper', 'Conjugate transpose', $ 'Unit', LASTC, K, ONE, V, LDV, WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C2**H*V2**H * CALL ZGEMM( 'Conjugate transpose', $ 'Conjugate transpose', LASTC, K, LASTV-K, $ ONE, C( K+1, 1 ), LDC, V( 1, K+1 ), LDV, $ ONE, WORK, LDWORK ) END IF * * W := W * T**H or W * T * CALL ZTRMM( 'Right', 'Upper', TRANST, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - V**H * W**H * IF( LASTV.GT.K ) THEN * * C2 := C2 - V2**H * W**H * CALL ZGEMM( 'Conjugate transpose', $ 'Conjugate transpose', LASTV-K, LASTC, K, $ -ONE, V( 1, K+1 ), LDV, WORK, LDWORK, $ ONE, C( K+1, 1 ), LDC ) END IF * * W := W * V1 * CALL ZTRMM( 'Right', 'Upper', 'No transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) * * C1 := C1 - W**H * DO 150 J = 1, K DO 140 I = 1, LASTC C( J, I ) = C( J, I ) - DCONJG( WORK( I, J ) ) 140 CONTINUE 150 CONTINUE * ELSE IF( LSAME( SIDE, 'R' ) ) THEN * * Form C * H or C * H**H where C = ( C1 C2 ) * LASTV = MAX( K, ILAZLC( K, N, V, LDV ) ) LASTC = ILAZLR( M, LASTV, C, LDC ) * * W := C * V**H = (C1*V1**H + C2*V2**H) (stored in WORK) * * W := C1 * DO 160 J = 1, K CALL ZCOPY( LASTC, C( 1, J ), 1, WORK( 1, J ), 1 ) 160 CONTINUE * * W := W * V1**H * CALL ZTRMM( 'Right', 'Upper', 'Conjugate transpose', $ 'Unit', LASTC, K, ONE, V, LDV, WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C2 * V2**H * CALL ZGEMM( 'No transpose', 'Conjugate transpose', $ LASTC, K, LASTV-K, ONE, C( 1, K+1 ), LDC, $ V( 1, K+1 ), LDV, ONE, WORK, LDWORK ) END IF * * W := W * T or W * T**H * CALL ZTRMM( 'Right', 'Upper', TRANS, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - W * V * IF( LASTV.GT.K ) THEN * * C2 := C2 - W * V2 * CALL ZGEMM( 'No transpose', 'No transpose', $ LASTC, LASTV-K, K, $ -ONE, WORK, LDWORK, V( 1, K+1 ), LDV, $ ONE, C( 1, K+1 ), LDC ) END IF * * W := W * V1 * CALL ZTRMM( 'Right', 'Upper', 'No transpose', 'Unit', $ LASTC, K, ONE, V, LDV, WORK, LDWORK ) * * C1 := C1 - W * DO 180 J = 1, K DO 170 I = 1, LASTC C( I, J ) = C( I, J ) - WORK( I, J ) 170 CONTINUE 180 CONTINUE * END IF * ELSE * * Let V = ( V1 V2 ) (V2: last K columns) * where V2 is unit lower triangular. * IF( LSAME( SIDE, 'L' ) ) THEN * * Form H * C or H**H * C where C = ( C1 ) * ( C2 ) * LASTV = MAX( K, ILAZLC( K, M, V, LDV ) ) LASTC = ILAZLC( LASTV, N, C, LDC ) * * W := C**H * V**H = (C1**H * V1**H + C2**H * V2**H) (stored in WORK) * * W := C2**H * DO 190 J = 1, K CALL ZCOPY( LASTC, C( LASTV-K+J, 1 ), LDC, $ WORK( 1, J ), 1 ) CALL ZLACGV( LASTC, WORK( 1, J ), 1 ) 190 CONTINUE * * W := W * V2**H * CALL ZTRMM( 'Right', 'Lower', 'Conjugate transpose', $ 'Unit', LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, $ WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C1**H * V1**H * CALL ZGEMM( 'Conjugate transpose', $ 'Conjugate transpose', LASTC, K, LASTV-K, $ ONE, C, LDC, V, LDV, ONE, WORK, LDWORK ) END IF * * W := W * T**H or W * T * CALL ZTRMM( 'Right', 'Lower', TRANST, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - V**H * W**H * IF( LASTV.GT.K ) THEN * * C1 := C1 - V1**H * W**H * CALL ZGEMM( 'Conjugate transpose', $ 'Conjugate transpose', LASTV-K, LASTC, K, $ -ONE, V, LDV, WORK, LDWORK, ONE, C, LDC ) END IF * * W := W * V2 * CALL ZTRMM( 'Right', 'Lower', 'No transpose', 'Unit', $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, $ WORK, LDWORK ) * * C2 := C2 - W**H * DO 210 J = 1, K DO 200 I = 1, LASTC C( LASTV-K+J, I ) = C( LASTV-K+J, I ) - $ DCONJG( WORK( I, J ) ) 200 CONTINUE 210 CONTINUE * ELSE IF( LSAME( SIDE, 'R' ) ) THEN * * Form C * H or C * H**H where C = ( C1 C2 ) * LASTV = MAX( K, ILAZLC( K, N, V, LDV ) ) LASTC = ILAZLR( M, LASTV, C, LDC ) * * W := C * V**H = (C1*V1**H + C2*V2**H) (stored in WORK) * * W := C2 * DO 220 J = 1, K CALL ZCOPY( LASTC, C( 1, LASTV-K+J ), 1, $ WORK( 1, J ), 1 ) 220 CONTINUE * * W := W * V2**H * CALL ZTRMM( 'Right', 'Lower', 'Conjugate transpose', $ 'Unit', LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, $ WORK, LDWORK ) IF( LASTV.GT.K ) THEN * * W := W + C1 * V1**H * CALL ZGEMM( 'No transpose', 'Conjugate transpose', $ LASTC, K, LASTV-K, ONE, C, LDC, V, LDV, ONE, $ WORK, LDWORK ) END IF * * W := W * T or W * T**H * CALL ZTRMM( 'Right', 'Lower', TRANS, 'Non-unit', $ LASTC, K, ONE, T, LDT, WORK, LDWORK ) * * C := C - W * V * IF( LASTV.GT.K ) THEN * * C1 := C1 - W * V1 * CALL ZGEMM( 'No transpose', 'No transpose', $ LASTC, LASTV-K, K, -ONE, WORK, LDWORK, V, LDV, $ ONE, C, LDC ) END IF * * W := W * V2 * CALL ZTRMM( 'Right', 'Lower', 'No transpose', 'Unit', $ LASTC, K, ONE, V( 1, LASTV-K+1 ), LDV, $ WORK, LDWORK ) * * C1 := C1 - W * DO 240 J = 1, K DO 230 I = 1, LASTC C( I, LASTV-K+J ) = C( I, LASTV-K+J ) $ - WORK( I, J ) 230 CONTINUE 240 CONTINUE * END IF * END IF END IF * RETURN * * End of ZLARFB * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/zlarfg.f ================================================ *> \brief \b ZLARFG * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download ZLARFG + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE ZLARFG( N, ALPHA, X, INCX, TAU ) * * .. Scalar Arguments .. * INTEGER INCX, N * COMPLEX*16 ALPHA, TAU * .. * .. Array Arguments .. * COMPLEX*16 X( * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> ZLARFG generates a complex elementary reflector H of order n, such *> that *> *> H**H * ( alpha ) = ( beta ), H**H * H = I. *> ( x ) ( 0 ) *> *> where alpha and beta are scalars, with beta real, and x is an *> (n-1)-element complex vector. H is represented in the form *> *> H = I - tau * ( 1 ) * ( 1 v**H ) , *> ( v ) *> *> where tau is a complex scalar and v is a complex (n-1)-element *> vector. Note that H is not hermitian. *> *> If the elements of x are all zero and alpha is real, then tau = 0 *> and H is taken to be the unit matrix. *> *> Otherwise 1 <= real(tau) <= 2 and abs(tau-1) <= 1 . *> \endverbatim * * Arguments: * ========== * *> \param[in] N *> \verbatim *> N is INTEGER *> The order of the elementary reflector. *> \endverbatim *> *> \param[in,out] ALPHA *> \verbatim *> ALPHA is COMPLEX*16 *> On entry, the value alpha. *> On exit, it is overwritten with the value beta. *> \endverbatim *> *> \param[in,out] X *> \verbatim *> X is COMPLEX*16 array, dimension *> (1+(N-2)*abs(INCX)) *> On entry, the vector x. *> On exit, it is overwritten with the vector v. *> \endverbatim *> *> \param[in] INCX *> \verbatim *> INCX is INTEGER *> The increment between elements of X. INCX > 0. *> \endverbatim *> *> \param[out] TAU *> \verbatim *> TAU is COMPLEX*16 *> The value tau. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup complex16OTHERauxiliary * * ===================================================================== SUBROUTINE ZLARFG( N, ALPHA, X, INCX, TAU ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. INTEGER INCX, N COMPLEX*16 ALPHA, TAU * .. * .. Array Arguments .. COMPLEX*16 X( * ) * .. * * ===================================================================== * * .. Parameters .. DOUBLE PRECISION ONE, ZERO PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 ) * .. * .. Local Scalars .. INTEGER J, KNT DOUBLE PRECISION ALPHI, ALPHR, BETA, RSAFMN, SAFMIN, XNORM * .. * .. External Functions .. DOUBLE PRECISION DLAMCH, DLAPY3, DZNRM2 COMPLEX*16 ZLADIV EXTERNAL DLAMCH, DLAPY3, DZNRM2, ZLADIV * .. * .. Intrinsic Functions .. INTRINSIC ABS, DBLE, DCMPLX, DIMAG, SIGN * .. * .. External Subroutines .. EXTERNAL ZDSCAL, ZSCAL * .. * .. Executable Statements .. * IF( N.LE.0 ) THEN TAU = ZERO RETURN END IF * XNORM = DZNRM2( N-1, X, INCX ) ALPHR = DBLE( ALPHA ) ALPHI = DIMAG( ALPHA ) * IF( XNORM.EQ.ZERO .AND. ALPHI.EQ.ZERO ) THEN * * H = I * TAU = ZERO ELSE * * general case * BETA = -SIGN( DLAPY3( ALPHR, ALPHI, XNORM ), ALPHR ) SAFMIN = DLAMCH( 'S' ) / DLAMCH( 'E' ) RSAFMN = ONE / SAFMIN * KNT = 0 IF( ABS( BETA ).LT.SAFMIN ) THEN * * XNORM, BETA may be inaccurate; scale X and recompute them * 10 CONTINUE KNT = KNT + 1 CALL ZDSCAL( N-1, RSAFMN, X, INCX ) BETA = BETA*RSAFMN ALPHI = ALPHI*RSAFMN ALPHR = ALPHR*RSAFMN IF( ABS( BETA ).LT.SAFMIN ) $ GO TO 10 * * New BETA is at most 1, at least SAFMIN * XNORM = DZNRM2( N-1, X, INCX ) ALPHA = DCMPLX( ALPHR, ALPHI ) BETA = -SIGN( DLAPY3( ALPHR, ALPHI, XNORM ), ALPHR ) END IF TAU = DCMPLX( ( BETA-ALPHR ) / BETA, -ALPHI / BETA ) ALPHA = ZLADIV( DCMPLX( ONE ), ALPHA-BETA ) CALL ZSCAL( N-1, ALPHA, X, INCX ) * * If ALPHA is subnormal, it may lose relative accuracy * DO 20 J = 1, KNT BETA = BETA*SAFMIN 20 CONTINUE ALPHA = BETA END IF * RETURN * * End of ZLARFG * END ================================================ FILE: VO_Module/thirdparty/eigen/lapack/zlarft.f ================================================ *> \brief \b ZLARFT * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download ZLARFT + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE ZLARFT( DIRECT, STOREV, N, K, V, LDV, TAU, T, LDT ) * * .. Scalar Arguments .. * CHARACTER DIRECT, STOREV * INTEGER K, LDT, LDV, N * .. * .. Array Arguments .. * COMPLEX*16 T( LDT, * ), TAU( * ), V( LDV, * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> ZLARFT forms the triangular factor T of a complex block reflector H *> of order n, which is defined as a product of k elementary reflectors. *> *> If DIRECT = 'F', H = H(1) H(2) . . . H(k) and T is upper triangular; *> *> If DIRECT = 'B', H = H(k) . . . H(2) H(1) and T is lower triangular. *> *> If STOREV = 'C', the vector which defines the elementary reflector *> H(i) is stored in the i-th column of the array V, and *> *> H = I - V * T * V**H *> *> If STOREV = 'R', the vector which defines the elementary reflector *> H(i) is stored in the i-th row of the array V, and *> *> H = I - V**H * T * V *> \endverbatim * * Arguments: * ========== * *> \param[in] DIRECT *> \verbatim *> DIRECT is CHARACTER*1 *> Specifies the order in which the elementary reflectors are *> multiplied to form the block reflector: *> = 'F': H = H(1) H(2) . . . H(k) (Forward) *> = 'B': H = H(k) . . . H(2) H(1) (Backward) *> \endverbatim *> *> \param[in] STOREV *> \verbatim *> STOREV is CHARACTER*1 *> Specifies how the vectors which define the elementary *> reflectors are stored (see also Further Details): *> = 'C': columnwise *> = 'R': rowwise *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The order of the block reflector H. N >= 0. *> \endverbatim *> *> \param[in] K *> \verbatim *> K is INTEGER *> The order of the triangular factor T (= the number of *> elementary reflectors). K >= 1. *> \endverbatim *> *> \param[in] V *> \verbatim *> V is COMPLEX*16 array, dimension *> (LDV,K) if STOREV = 'C' *> (LDV,N) if STOREV = 'R' *> The matrix V. See further details. *> \endverbatim *> *> \param[in] LDV *> \verbatim *> LDV is INTEGER *> The leading dimension of the array V. *> If STOREV = 'C', LDV >= max(1,N); if STOREV = 'R', LDV >= K. *> \endverbatim *> *> \param[in] TAU *> \verbatim *> TAU is COMPLEX*16 array, dimension (K) *> TAU(i) must contain the scalar factor of the elementary *> reflector H(i). *> \endverbatim *> *> \param[out] T *> \verbatim *> T is COMPLEX*16 array, dimension (LDT,K) *> The k by k triangular factor T of the block reflector. *> If DIRECT = 'F', T is upper triangular; if DIRECT = 'B', T is *> lower triangular. The rest of the array is not used. *> \endverbatim *> *> \param[in] LDT *> \verbatim *> LDT is INTEGER *> The leading dimension of the array T. LDT >= K. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date April 2012 * *> \ingroup complex16OTHERauxiliary * *> \par Further Details: * ===================== *> *> \verbatim *> *> The shape of the matrix V and the storage of the vectors which define *> the H(i) is best illustrated by the following example with n = 5 and *> k = 3. The elements equal to 1 are not stored. *> *> DIRECT = 'F' and STOREV = 'C': DIRECT = 'F' and STOREV = 'R': *> *> V = ( 1 ) V = ( 1 v1 v1 v1 v1 ) *> ( v1 1 ) ( 1 v2 v2 v2 ) *> ( v1 v2 1 ) ( 1 v3 v3 ) *> ( v1 v2 v3 ) *> ( v1 v2 v3 ) *> *> DIRECT = 'B' and STOREV = 'C': DIRECT = 'B' and STOREV = 'R': *> *> V = ( v1 v2 v3 ) V = ( v1 v1 1 ) *> ( v1 v2 v3 ) ( v2 v2 v2 1 ) *> ( 1 v2 v3 ) ( v3 v3 v3 v3 1 ) *> ( 1 v3 ) *> ( 1 ) *> \endverbatim *> * ===================================================================== SUBROUTINE ZLARFT( DIRECT, STOREV, N, K, V, LDV, TAU, T, LDT ) * * -- LAPACK auxiliary routine (version 3.4.1) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * April 2012 * * .. Scalar Arguments .. CHARACTER DIRECT, STOREV INTEGER K, LDT, LDV, N * .. * .. Array Arguments .. COMPLEX*16 T( LDT, * ), TAU( * ), V( LDV, * ) * .. * * ===================================================================== * * .. Parameters .. COMPLEX*16 ONE, ZERO PARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ), $ ZERO = ( 0.0D+0, 0.0D+0 ) ) * .. * .. Local Scalars .. INTEGER I, J, PREVLASTV, LASTV * .. * .. External Subroutines .. EXTERNAL ZGEMV, ZLACGV, ZTRMV * .. * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. * .. Executable Statements .. * * Quick return if possible * IF( N.EQ.0 ) $ RETURN * IF( LSAME( DIRECT, 'F' ) ) THEN PREVLASTV = N DO I = 1, K PREVLASTV = MAX( PREVLASTV, I ) IF( TAU( I ).EQ.ZERO ) THEN * * H(i) = I * DO J = 1, I T( J, I ) = ZERO END DO ELSE * * general case * IF( LSAME( STOREV, 'C' ) ) THEN * Skip any trailing zeros. DO LASTV = N, I+1, -1 IF( V( LASTV, I ).NE.ZERO ) EXIT END DO DO J = 1, I-1 T( J, I ) = -TAU( I ) * CONJG( V( I , J ) ) END DO J = MIN( LASTV, PREVLASTV ) * * T(1:i-1,i) := - tau(i) * V(i:j,1:i-1)**H * V(i:j,i) * CALL ZGEMV( 'Conjugate transpose', J-I, I-1, $ -TAU( I ), V( I+1, 1 ), LDV, $ V( I+1, I ), 1, ONE, T( 1, I ), 1 ) ELSE * Skip any trailing zeros. DO LASTV = N, I+1, -1 IF( V( I, LASTV ).NE.ZERO ) EXIT END DO DO J = 1, I-1 T( J, I ) = -TAU( I ) * V( J , I ) END DO J = MIN( LASTV, PREVLASTV ) * * T(1:i-1,i) := - tau(i) * V(1:i-1,i:j) * V(i,i:j)**H * CALL ZGEMM( 'N', 'C', I-1, 1, J-I, -TAU( I ), $ V( 1, I+1 ), LDV, V( I, I+1 ), LDV, $ ONE, T( 1, I ), LDT ) END IF * * T(1:i-1,i) := T(1:i-1,1:i-1) * T(1:i-1,i) * CALL ZTRMV( 'Upper', 'No transpose', 'Non-unit', I-1, T, $ LDT, T( 1, I ), 1 ) T( I, I ) = TAU( I ) IF( I.GT.1 ) THEN PREVLASTV = MAX( PREVLASTV, LASTV ) ELSE PREVLASTV = LASTV END IF END IF END DO ELSE PREVLASTV = 1 DO I = K, 1, -1 IF( TAU( I ).EQ.ZERO ) THEN * * H(i) = I * DO J = I, K T( J, I ) = ZERO END DO ELSE * * general case * IF( I.LT.K ) THEN IF( LSAME( STOREV, 'C' ) ) THEN * Skip any leading zeros. DO LASTV = 1, I-1 IF( V( LASTV, I ).NE.ZERO ) EXIT END DO DO J = I+1, K T( J, I ) = -TAU( I ) * CONJG( V( N-K+I , J ) ) END DO J = MAX( LASTV, PREVLASTV ) * * T(i+1:k,i) = -tau(i) * V(j:n-k+i,i+1:k)**H * V(j:n-k+i,i) * CALL ZGEMV( 'Conjugate transpose', N-K+I-J, K-I, $ -TAU( I ), V( J, I+1 ), LDV, V( J, I ), $ 1, ONE, T( I+1, I ), 1 ) ELSE * Skip any leading zeros. DO LASTV = 1, I-1 IF( V( I, LASTV ).NE.ZERO ) EXIT END DO DO J = I+1, K T( J, I ) = -TAU( I ) * V( J, N-K+I ) END DO J = MAX( LASTV, PREVLASTV ) * * T(i+1:k,i) = -tau(i) * V(i+1:k,j:n-k+i) * V(i,j:n-k+i)**H * CALL ZGEMM( 'N', 'C', K-I, 1, N-K+I-J, -TAU( I ), $ V( I+1, J ), LDV, V( I, J ), LDV, $ ONE, T( I+1, I ), LDT ) END IF * * T(i+1:k,i) := T(i+1:k,i+1:k) * T(i+1:k,i) * CALL ZTRMV( 'Lower', 'No transpose', 'Non-unit', K-I, $ T( I+1, I+1 ), LDT, T( I+1, I ), 1 ) IF( I.GT.1 ) THEN PREVLASTV = MIN( PREVLASTV, LASTV ) ELSE PREVLASTV = LASTV END IF END IF T( I, I ) = TAU( I ) END IF END DO END IF RETURN * * End of ZLARFT * END ================================================ FILE: VO_Module/thirdparty/eigen/scripts/CMakeLists.txt ================================================ get_property(EIGEN_TESTS_LIST GLOBAL PROPERTY EIGEN_TESTS_LIST) configure_file(buildtests.in ${CMAKE_BINARY_DIR}/buildtests.sh @ONLY) configure_file(check.in ${CMAKE_BINARY_DIR}/check.sh COPYONLY) configure_file(debug.in ${CMAKE_BINARY_DIR}/debug.sh COPYONLY) configure_file(release.in ${CMAKE_BINARY_DIR}/release.sh COPYONLY) ================================================ FILE: VO_Module/thirdparty/eigen/scripts/cdashtesting.cmake.in ================================================ set(CTEST_SOURCE_DIRECTORY "@CMAKE_SOURCE_DIR@") set(CTEST_BINARY_DIRECTORY "@CMAKE_BINARY_DIR@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") set(CTEST_BUILD_NAME "@BUILDNAME@") set(CTEST_SITE "@SITE@") set(MODEL Experimental) if(${CTEST_SCRIPT_ARG} MATCHES Nightly) set(MODEL Nightly) elseif(${CTEST_SCRIPT_ARG} MATCHES Continuous) set(MODEL Continuous) endif() find_program(CTEST_GIT_COMMAND NAMES git) set(CTEST_UPDATE_COMMAND "${CTEST_GIT_COMMAND}") ctest_start(${MODEL} ${CTEST_SOURCE_DIRECTORY} ${CTEST_BINARY_DIRECTORY}) ctest_update(SOURCE "${CTEST_SOURCE_DIRECTORY}") ctest_submit(PARTS Update Notes) # to get CTEST_PROJECT_SUBPROJECTS definition: include("${CTEST_SOURCE_DIRECTORY}/CTestConfig.cmake") foreach(subproject ${CTEST_PROJECT_SUBPROJECTS}) message("") message("Process ${subproject}") set_property(GLOBAL PROPERTY SubProject ${subproject}) set_property(GLOBAL PROPERTY Label ${subproject}) ctest_configure(BUILD ${CTEST_BINARY_DIRECTORY} SOURCE ${CTEST_SOURCE_DIRECTORY} ) ctest_submit(PARTS Configure) set(CTEST_BUILD_TARGET "Build${subproject}") message("Build ${CTEST_BUILD_TARGET}") ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) # builds target ${CTEST_BUILD_TARGET} ctest_submit(PARTS Build) ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" INCLUDE_LABEL "${subproject}" ) # runs only tests that have a LABELS property matching "${subproject}" ctest_coverage(BUILD "${CTEST_BINARY_DIRECTORY}" LABELS "${subproject}" ) ctest_submit(PARTS Test) endforeach() ================================================ FILE: VO_Module/thirdparty/eigen/scripts/check.in ================================================ #!/bin/bash # check : shorthand for make and ctest -R if [[ $# != 1 || $1 == *help ]] then echo "usage: $0 regexp" echo " Builds and runs tests matching the regexp." echo " The EIGEN_MAKE_ARGS environment variable allows to pass args to 'make'." echo " For example, to launch 5 concurrent builds, use EIGEN_MAKE_ARGS='-j5'" echo " The EIGEN_CTEST_ARGS environment variable allows to pass args to 'ctest'." echo " For example, with CTest 2.8, you can use EIGEN_CTEST_ARGS='-j5'." exit 0 fi if [ -n "${EIGEN_CTEST_ARGS:+x}" ] then ./buildtests.sh "$1" && ctest -R "$1" ${EIGEN_CTEST_ARGS} else ./buildtests.sh "$1" && ctest -R "$1" fi exit $? ================================================ FILE: VO_Module/thirdparty/eigen/scripts/debug.in ================================================ #!/bin/sh cmake -DCMAKE_BUILD_TYPE=Debug . ================================================ FILE: VO_Module/thirdparty/eigen/scripts/eigen_gen_credits.cpp ================================================ #include #include #include #include #include #include #include using namespace std; // this function takes a line that may contain a name and/or email address, // and returns just the name, while fixing the "bad cases". std::string contributor_name(const std::string& line) { string result; // let's first take care of the case of isolated email addresses, like // "user@localhost.localdomain" entries if(line.find("markb@localhost.localdomain") != string::npos) { return "Mark Borgerding"; } if(line.find("kayhman@contact.intra.cea.fr") != string::npos) { return "Guillaume Saupin"; } // from there on we assume that we have a entry of the form // either: // Bla bli Blurp // or: // Bla bli Blurp size_t position_of_email_address = line.find_first_of('<'); if(position_of_email_address != string::npos) { // there is an e-mail address in <...>. // Hauke once committed as "John Smith", fix that. if(line.find("hauke.heibel") != string::npos) result = "Hauke Heibel"; else { // just remove the e-mail address result = line.substr(0, position_of_email_address); } } else { // there is no e-mail address in <...>. if(line.find("convert-repo") != string::npos) result = ""; else result = line; } // remove trailing spaces size_t length = result.length(); while(length >= 1 && result[length-1] == ' ') result.erase(--length); return result; } // parses hg churn output to generate a contributors map. map contributors_map_from_churn_output(const char *filename) { map contributors_map; string line; ifstream churn_out; churn_out.open(filename, ios::in); while(!getline(churn_out,line).eof()) { // remove the histograms "******" that hg churn may draw at the end of some lines size_t first_star = line.find_first_of('*'); if(first_star != string::npos) line.erase(first_star); // remove trailing spaces size_t length = line.length(); while(length >= 1 && line[length-1] == ' ') line.erase(--length); // now the last space indicates where the number starts size_t last_space = line.find_last_of(' '); // get the number (of changesets or of modified lines for each contributor) int number; istringstream(line.substr(last_space+1)) >> number; // get the name of the contributor line.erase(last_space); string name = contributor_name(line); map::iterator it = contributors_map.find(name); // if new contributor, insert if(it == contributors_map.end()) contributors_map.insert(pair(name, number)); // if duplicate, just add the number else it->second += number; } churn_out.close(); return contributors_map; } // find the last name, i.e. the last word. // for "van den Schbling" types of last names, that's not a problem, that's actually what we want. string lastname(const string& name) { size_t last_space = name.find_last_of(' '); if(last_space >= name.length()-1) return name; else return name.substr(last_space+1); } struct contributor { string name; int changedlines; int changesets; string url; string misc; contributor() : changedlines(0), changesets(0) {} bool operator < (const contributor& other) { return lastname(name).compare(lastname(other.name)) < 0; } }; void add_online_info_into_contributors_list(list& contributors_list, const char *filename) { string line; ifstream online_info; online_info.open(filename, ios::in); while(!getline(online_info,line).eof()) { string hgname, realname, url, misc; size_t last_bar = line.find_last_of('|'); if(last_bar == string::npos) continue; if(last_bar < line.length()) misc = line.substr(last_bar+1); line.erase(last_bar); last_bar = line.find_last_of('|'); if(last_bar == string::npos) continue; if(last_bar < line.length()) url = line.substr(last_bar+1); line.erase(last_bar); last_bar = line.find_last_of('|'); if(last_bar == string::npos) continue; if(last_bar < line.length()) realname = line.substr(last_bar+1); line.erase(last_bar); hgname = line; // remove the example line if(hgname.find("MercurialName") != string::npos) continue; list::iterator it; for(it=contributors_list.begin(); it != contributors_list.end() && it->name != hgname; ++it) {} if(it == contributors_list.end()) { contributor c; c.name = realname; c.url = url; c.misc = misc; contributors_list.push_back(c); } else { it->name = realname; it->url = url; it->misc = misc; } } } int main() { // parse the hg churn output files map contributors_map_for_changedlines = contributors_map_from_churn_output("churn-changedlines.out"); //map contributors_map_for_changesets = contributors_map_from_churn_output("churn-changesets.out"); // merge into the contributors list list contributors_list; map::iterator it; for(it=contributors_map_for_changedlines.begin(); it != contributors_map_for_changedlines.end(); ++it) { contributor c; c.name = it->first; c.changedlines = it->second; c.changesets = 0; //contributors_map_for_changesets.find(it->first)->second; contributors_list.push_back(c); } add_online_info_into_contributors_list(contributors_list, "online-info.out"); contributors_list.sort(); cout << "{| cellpadding=\"5\"\n"; cout << "!\n"; cout << "! Lines changed\n"; cout << "!\n"; list::iterator itc; int i = 0; for(itc=contributors_list.begin(); itc != contributors_list.end(); ++itc) { if(itc->name.length() == 0) continue; if(i%2) cout << "|-\n"; else cout << "|- style=\"background:#FFFFD0\"\n"; if(itc->url.length()) cout << "| [" << itc->url << " " << itc->name << "]\n"; else cout << "| " << itc->name << "\n"; if(itc->changedlines) cout << "| " << itc->changedlines << "\n"; else cout << "| (no information)\n"; cout << "| " << itc->misc << "\n"; i++; } cout << "|}" << endl; } ================================================ FILE: VO_Module/thirdparty/eigen/scripts/eigen_gen_docs ================================================ #!/bin/sh # configuration # You should call this script with USER set as you want, else some default # will be used USER=${USER:-'orzel'} UPLOAD_DIR=dox-devel #ulimit -v 1024000 # step 1 : build rm build/doc/html -Rf mkdir build -p (cd build && cmake .. && make doc) || { echo "make failed"; exit 1; } #step 2 : upload # (the '/' at the end of path is very important, see rsync documentation) rsync -az --no-p --delete build/doc/html/ $USER@ssh.tuxfamily.org:eigen/eigen.tuxfamily.org-web/htdocs/$UPLOAD_DIR/ || { echo "upload failed"; exit 1; } #step 3 : fix the perm ssh $USER@ssh.tuxfamily.org "chmod -R g+w /home/eigen/eigen.tuxfamily.org-web/htdocs/$UPLOAD_DIR" || { echo "perm failed"; exit 1; } echo "Uploaded successfully" ================================================ FILE: VO_Module/thirdparty/eigen/scripts/eigen_gen_split_test_help.cmake ================================================ #!cmake -P file(WRITE split_test_helper.h "") foreach(i RANGE 1 999) file(APPEND split_test_helper.h "#if defined(EIGEN_TEST_PART_${i}) || defined(EIGEN_TEST_PART_ALL)\n" "#define CALL_SUBTEST_${i}(FUNC) CALL_SUBTEST(FUNC)\n" "#else\n" "#define CALL_SUBTEST_${i}(FUNC)\n" "#endif\n\n" ) endforeach() ================================================ FILE: VO_Module/thirdparty/eigen/scripts/eigen_monitor_perf.sh ================================================ #!/bin/bash # This is a script example to automatically update and upload performance unit tests. # The following five variables must be adjusted to match your settings. USER='ggael' UPLOAD_DIR=perf_monitoring/ggaelmacbook26 EIGEN_SOURCE_PATH=$HOME/Eigen/eigen export PREFIX="haswell-fma" export CXX_FLAGS="-mfma -w" #### BENCH_PATH=$EIGEN_SOURCE_PATH/bench/perf_monitoring/$PREFIX PREVPATH=$(pwd) cd $EIGEN_SOURCE_PATH/bench/perf_monitoring && ./runall.sh "Haswell 2.6GHz, FMA, Apple's clang" "$@" cd $PREVPATH || exit 1 ALLFILES="$BENCH_PATH/*.png $BENCH_PATH/*.html $BENCH_PATH/index.html $BENCH_PATH/s1.js $BENCH_PATH/s2.js" # (the '/' at the end of path is very important, see rsync documentation) rsync -az --no-p --delete $ALLFILES $USER@ssh.tuxfamily.org:eigen/eigen.tuxfamily.org-web/htdocs/$UPLOAD_DIR/ || { echo "upload failed"; exit 1; } # fix the perm ssh $USER@ssh.tuxfamily.org "chmod -R g+w /home/eigen/eigen.tuxfamily.org-web/htdocs/perf_monitoring" || { echo "perm failed"; exit 1; } ================================================ FILE: VO_Module/thirdparty/eigen/scripts/release.in ================================================ #!/bin/sh cmake -DCMAKE_BUILD_TYPE=Release . ================================================ FILE: VO_Module/thirdparty/eigen/scripts/relicense.py ================================================ # This file is part of Eigen, a lightweight C++ template library # for linear algebra. # # Copyright (C) 2012 Keir Mierle # # This Source Code Form is subject to the terms of the Mozilla # Public License v. 2.0. If a copy of the MPL was not distributed # with this file, You can obtain one at http://mozilla.org/MPL/2.0/. # # Author: mierle@gmail.com (Keir Mierle) # # Make the long-awaited conversion to MPL. lgpl3_header = ''' // 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 . ''' mpl2_header = """ // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. """ import os import sys exclusions = set(['relicense.py']) def update(text): if text.find(lgpl3_header) == -1: return text, False return text.replace(lgpl3_header, mpl2_header), True rootdir = sys.argv[1] for root, sub_folders, files in os.walk(rootdir): for basename in files: if basename in exclusions: print 'SKIPPED', filename continue filename = os.path.join(root, basename) fo = file(filename) text = fo.read() fo.close() text, updated = update(text) if updated: fo = file(filename, "w") fo.write(text) fo.close() print 'UPDATED', filename else: print ' ', filename ================================================ FILE: VO_Module/thirdparty/eigen/signature_of_eigen3_matrix_library ================================================ This file is just there as a signature to help identify directories containing Eigen3. When writing a script looking for Eigen3, just look for this file. This is especially useful to help disambiguate with Eigen2... ================================================ FILE: VO_Module/thirdparty/eigen/test/AnnoyingScalar.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2011-2018 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_TEST_ANNOYING_SCALAR_H #define EIGEN_TEST_ANNOYING_SCALAR_H #include #if EIGEN_COMP_GNUC #pragma GCC diagnostic ignored "-Wshadow" #endif #ifndef EIGEN_TEST_ANNOYING_SCALAR_DONT_THROW struct my_exception { my_exception() {} ~my_exception() {} }; #endif // An AnnoyingScalar is a pseudo scalar type that: // - can randomly through an exception in operator + // - randomly allocate on the heap or initialize a reference to itself making it non trivially copyable, nor movable, nor relocatable. class AnnoyingScalar { public: AnnoyingScalar() { init(); *v = 0; } AnnoyingScalar(long double _v) { init(); *v = _v; } AnnoyingScalar(double _v) { init(); *v = _v; } AnnoyingScalar(float _v) { init(); *v = _v; } AnnoyingScalar(int _v) { init(); *v = _v; } AnnoyingScalar(long _v) { init(); *v = _v; } #if EIGEN_HAS_CXX11 AnnoyingScalar(long long _v) { init(); *v = _v; } #endif AnnoyingScalar(const AnnoyingScalar& other) { init(); *v = *(other.v); } ~AnnoyingScalar() { if(v!=&data) delete v; instances--; } void init() { if(internal::random()) v = new float; else v = &data; instances++; } AnnoyingScalar operator+(const AnnoyingScalar& other) const { #ifndef EIGEN_TEST_ANNOYING_SCALAR_DONT_THROW countdown--; if(countdown<=0 && !dont_throw) throw my_exception(); #endif return AnnoyingScalar(*v+*other.v); } AnnoyingScalar operator-() const { return AnnoyingScalar(-*v); } AnnoyingScalar operator-(const AnnoyingScalar& other) const { return AnnoyingScalar(*v-*other.v); } AnnoyingScalar operator*(const AnnoyingScalar& other) const { return AnnoyingScalar((*v)*(*other.v)); } AnnoyingScalar operator/(const AnnoyingScalar& other) const { return AnnoyingScalar((*v)/(*other.v)); } AnnoyingScalar& operator+=(const AnnoyingScalar& other) { *v += *other.v; return *this; } AnnoyingScalar& operator-=(const AnnoyingScalar& other) { *v -= *other.v; return *this; } AnnoyingScalar& operator*=(const AnnoyingScalar& other) { *v *= *other.v; return *this; } AnnoyingScalar& operator/=(const AnnoyingScalar& other) { *v /= *other.v; return *this; } AnnoyingScalar& operator= (const AnnoyingScalar& other) { *v = *other.v; return *this; } bool operator==(const AnnoyingScalar& other) const { return *v == *other.v; } bool operator!=(const AnnoyingScalar& other) const { return *v != *other.v; } bool operator<=(const AnnoyingScalar& other) const { return *v <= *other.v; } bool operator< (const AnnoyingScalar& other) const { return *v < *other.v; } bool operator>=(const AnnoyingScalar& other) const { return *v >= *other.v; } bool operator> (const AnnoyingScalar& other) const { return *v > *other.v; } float* v; float data; static int instances; #ifndef EIGEN_TEST_ANNOYING_SCALAR_DONT_THROW static int countdown; static bool dont_throw; #endif }; AnnoyingScalar real(const AnnoyingScalar &x) { return x; } AnnoyingScalar imag(const AnnoyingScalar & ) { return 0; } AnnoyingScalar conj(const AnnoyingScalar &x) { return x; } AnnoyingScalar sqrt(const AnnoyingScalar &x) { return std::sqrt(*x.v); } AnnoyingScalar abs (const AnnoyingScalar &x) { return std::abs(*x.v); } AnnoyingScalar cos (const AnnoyingScalar &x) { return std::cos(*x.v); } AnnoyingScalar sin (const AnnoyingScalar &x) { return std::sin(*x.v); } AnnoyingScalar acos(const AnnoyingScalar &x) { return std::acos(*x.v); } AnnoyingScalar atan2(const AnnoyingScalar &y,const AnnoyingScalar &x) { return std::atan2(*y.v,*x.v); } std::ostream& operator<<(std::ostream& stream,const AnnoyingScalar& x) { stream << (*(x.v)); return stream; } int AnnoyingScalar::instances = 0; #ifndef EIGEN_TEST_ANNOYING_SCALAR_DONT_THROW int AnnoyingScalar::countdown = 0; bool AnnoyingScalar::dont_throw = false; #endif namespace Eigen { template<> struct NumTraits : NumTraits { enum { RequireInitialization = 1, }; typedef AnnoyingScalar Real; typedef AnnoyingScalar Nested; typedef AnnoyingScalar Literal; typedef AnnoyingScalar NonInteger; }; template<> inline AnnoyingScalar test_precision() { return test_precision(); } namespace numext { template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool (isfinite)(const AnnoyingScalar& x) { return (numext::isfinite)(*x.v); } } namespace internal { template<> EIGEN_STRONG_INLINE double cast(const AnnoyingScalar& x) { return double(*x.v); } template<> EIGEN_STRONG_INLINE float cast(const AnnoyingScalar& x) { return *x.v; } } } // namespace Eigen AnnoyingScalar get_test_precision(const AnnoyingScalar&) { return Eigen::test_precision(); } AnnoyingScalar test_relative_error(const AnnoyingScalar &a, const AnnoyingScalar &b) { return test_relative_error(*a.v, *b.v); } inline bool test_isApprox(const AnnoyingScalar &a, const AnnoyingScalar &b) { return internal::isApprox(*a.v, *b.v, test_precision()); } inline bool test_isMuchSmallerThan(const AnnoyingScalar &a, const AnnoyingScalar &b) { return test_isMuchSmallerThan(*a.v, *b.v); } #endif // EIGEN_TEST_ANNOYING_SCALAR_H ================================================ FILE: VO_Module/thirdparty/eigen/test/CMakeLists.txt ================================================ # The file split_test_helper.h was generated at first run, # it is now included in test/ if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/split_test_helper.h) file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/split_test_helper.h) endif() # check if we have a Fortran compiler include(CheckLanguage) check_language(Fortran) if(CMAKE_Fortran_COMPILER) enable_language(Fortran) set(EIGEN_Fortran_COMPILER_WORKS ON) else() set(EIGEN_Fortran_COMPILER_WORKS OFF) # search for a default Lapack library to complete Eigen's one find_package(LAPACK QUIET) endif() # TODO do the same for EXTERNAL_LAPACK option(EIGEN_TEST_EXTERNAL_BLAS "Use external BLAS library for testsuite" OFF) if(EIGEN_TEST_EXTERNAL_BLAS) find_package(BLAS REQUIRED) message(STATUS "BLAS_COMPILER_FLAGS: ${BLAS_COMPILER_FLAGS}") add_definitions("-DEIGEN_USE_BLAS") # is adding ${BLAS_COMPILER_FLAGS} necessary? list(APPEND EXTERNAL_LIBS "${BLAS_LIBRARIES}") endif() # configure blas/lapack (use Eigen's ones) set(EIGEN_BLAS_LIBRARIES eigen_blas) set(EIGEN_LAPACK_LIBRARIES eigen_lapack) set(EIGEN_TEST_MATRIX_DIR "" CACHE STRING "Enable testing of realword sparse matrices contained in the specified path") if(EIGEN_TEST_MATRIX_DIR) if(NOT WIN32) message(STATUS "Test realworld sparse matrices: ${EIGEN_TEST_MATRIX_DIR}") add_definitions( -DTEST_REAL_CASES="${EIGEN_TEST_MATRIX_DIR}" ) else() message(STATUS "REAL CASES CAN NOT BE CURRENTLY TESTED ON WIN32") endif() endif() set(SPARSE_LIBS " ") find_package(CHOLMOD) if(CHOLMOD_FOUND) add_definitions("-DEIGEN_CHOLMOD_SUPPORT") include_directories(${CHOLMOD_INCLUDES}) set(SPARSE_LIBS ${SPARSE_LIBS} ${CHOLMOD_LIBRARIES} ${EIGEN_BLAS_LIBRARIES} ${EIGEN_LAPACK_LIBRARIES}) set(CHOLMOD_ALL_LIBS ${CHOLMOD_LIBRARIES} ${EIGEN_BLAS_LIBRARIES} ${EIGEN_LAPACK_LIBRARIES}) ei_add_property(EIGEN_TESTED_BACKENDS "CHOLMOD, ") else() ei_add_property(EIGEN_MISSING_BACKENDS "CHOLMOD, ") endif() find_package(UMFPACK) if(UMFPACK_FOUND) add_definitions("-DEIGEN_UMFPACK_SUPPORT") include_directories(${UMFPACK_INCLUDES}) set(SPARSE_LIBS ${SPARSE_LIBS} ${UMFPACK_LIBRARIES} ${EIGEN_BLAS_LIBRARIES}) set(UMFPACK_ALL_LIBS ${UMFPACK_LIBRARIES} ${EIGEN_BLAS_LIBRARIES}) ei_add_property(EIGEN_TESTED_BACKENDS "UMFPACK, ") else() ei_add_property(EIGEN_MISSING_BACKENDS "UMFPACK, ") endif() find_package(KLU) if(KLU_FOUND) add_definitions("-DEIGEN_KLU_SUPPORT") include_directories(${KLU_INCLUDES}) set(SPARSE_LIBS ${SPARSE_LIBS} ${KLU_LIBRARIES} ${EIGEN_BLAS_LIBRARIES}) set(KLU_ALL_LIBS ${KLU_LIBRARIES} ${EIGEN_BLAS_LIBRARIES}) ei_add_property(EIGEN_TESTED_BACKENDS "KLU, ") else() ei_add_property(EIGEN_MISSING_BACKENDS "KLU, ") endif() find_package(SuperLU 4.0) if(SuperLU_FOUND) add_definitions("-DEIGEN_SUPERLU_SUPPORT") include_directories(${SUPERLU_INCLUDES}) set(SPARSE_LIBS ${SPARSE_LIBS} ${SUPERLU_LIBRARIES} ${EIGEN_BLAS_LIBRARIES}) set(SUPERLU_ALL_LIBS ${SUPERLU_LIBRARIES} ${EIGEN_BLAS_LIBRARIES}) ei_add_property(EIGEN_TESTED_BACKENDS "SuperLU, ") else() ei_add_property(EIGEN_MISSING_BACKENDS "SuperLU, ") endif() find_package(PASTIX QUIET COMPONENTS METIS SEQ) # check that the PASTIX found is a version without MPI find_path(PASTIX_pastix_nompi.h_INCLUDE_DIRS NAMES pastix_nompi.h HINTS ${PASTIX_INCLUDE_DIRS} ) if (NOT PASTIX_pastix_nompi.h_INCLUDE_DIRS) message(STATUS "A version of Pastix has been found but pastix_nompi.h does not exist in the include directory." " Because Eigen tests require a version without MPI, we disable the Pastix backend.") endif() if(PASTIX_FOUND AND PASTIX_pastix_nompi.h_INCLUDE_DIRS) add_definitions("-DEIGEN_PASTIX_SUPPORT") include_directories(${PASTIX_INCLUDE_DIRS_DEP}) if(SCOTCH_FOUND) include_directories(${SCOTCH_INCLUDE_DIRS}) set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${SCOTCH_LIBRARIES}) elseif(METIS_FOUND) include_directories(${METIS_INCLUDE_DIRS}) set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${METIS_LIBRARIES}) else() ei_add_property(EIGEN_MISSING_BACKENDS "PaStiX, ") endif() set(SPARSE_LIBS ${SPARSE_LIBS} ${PASTIX_LIBRARIES_DEP} ${ORDERING_LIBRARIES}) set(PASTIX_ALL_LIBS ${PASTIX_LIBRARIES_DEP}) ei_add_property(EIGEN_TESTED_BACKENDS "PaStiX, ") else() ei_add_property(EIGEN_MISSING_BACKENDS "PaStiX, ") endif() if(METIS_FOUND) add_definitions("-DEIGEN_METIS_SUPPORT") include_directories(${METIS_INCLUDE_DIRS}) ei_add_property(EIGEN_TESTED_BACKENDS "METIS, ") else() ei_add_property(EIGEN_MISSING_BACKENDS "METIS, ") endif() find_package(SPQR) if(SPQR_FOUND AND CHOLMOD_FOUND AND (EIGEN_Fortran_COMPILER_WORKS OR LAPACK_FOUND) ) add_definitions("-DEIGEN_SPQR_SUPPORT") include_directories(${SPQR_INCLUDES}) set(SPQR_ALL_LIBS ${SPQR_LIBRARIES} ${CHOLMOD_LIBRARIES} ${EIGEN_LAPACK_LIBRARIES} ${EIGEN_BLAS_LIBRARIES} ${LAPACK_LIBRARIES}) set(SPARSE_LIBS ${SPARSE_LIBS} ${SPQR_ALL_LIBS}) ei_add_property(EIGEN_TESTED_BACKENDS "SPQR, ") else() ei_add_property(EIGEN_MISSING_BACKENDS "SPQR, ") endif() option(EIGEN_TEST_NOQT "Disable Qt support in unit tests" OFF) if(NOT EIGEN_TEST_NOQT) find_package(Qt4) if(QT4_FOUND) include(${QT_USE_FILE}) ei_add_property(EIGEN_TESTED_BACKENDS "Qt4 support, ") else() ei_add_property(EIGEN_MISSING_BACKENDS "Qt4 support, ") endif() endif() if(TEST_LIB) add_definitions("-DEIGEN_EXTERN_INSTANTIATIONS=1") endif() set_property(GLOBAL PROPERTY EIGEN_CURRENT_SUBPROJECT "Official") add_custom_target(BuildOfficial) ei_add_test(rand) ei_add_test(meta) ei_add_test(numext) ei_add_test(sizeof) ei_add_test(dynalloc) ei_add_test(nomalloc) ei_add_test(first_aligned) ei_add_test(type_alias) ei_add_test(nullary) ei_add_test(mixingtypes) ei_add_test(io) ei_add_test(packetmath "-DEIGEN_FAST_MATH=1") ei_add_test(vectorization_logic) ei_add_test(basicstuff) ei_add_test(constructor) ei_add_test(linearstructure) ei_add_test(integer_types) ei_add_test(unalignedcount) if(NOT EIGEN_TEST_NO_EXCEPTIONS AND NOT EIGEN_TEST_OPENMP) ei_add_test(exceptions) endif() ei_add_test(redux) ei_add_test(visitor) ei_add_test(block) ei_add_test(corners) ei_add_test(symbolic_index) ei_add_test(indexed_view) ei_add_test(reshape) ei_add_test(swap) ei_add_test(resize) ei_add_test(conservative_resize) ei_add_test(product_small) ei_add_test(product_large) ei_add_test(product_extra) ei_add_test(diagonalmatrices) ei_add_test(adjoint) ei_add_test(diagonal) ei_add_test(miscmatrices) ei_add_test(commainitializer) ei_add_test(smallvectors) ei_add_test(mapped_matrix) ei_add_test(mapstride) ei_add_test(mapstaticmethods) ei_add_test(array_cwise) ei_add_test(array_for_matrix) ei_add_test(array_replicate) ei_add_test(array_reverse) ei_add_test(ref) ei_add_test(is_same_dense) ei_add_test(triangular) ei_add_test(selfadjoint) ei_add_test(product_selfadjoint) ei_add_test(product_symm) ei_add_test(product_syrk) ei_add_test(product_trmv) ei_add_test(product_trmm) ei_add_test(product_trsolve) ei_add_test(product_mmtr) ei_add_test(product_notemporary) ei_add_test(stable_norm) ei_add_test(permutationmatrices) ei_add_test(bandmatrix) ei_add_test(cholesky) ei_add_test(lu) ei_add_test(determinant) ei_add_test(inverse) ei_add_test(qr) ei_add_test(qr_colpivoting) ei_add_test(qr_fullpivoting) ei_add_test(upperbidiagonalization) ei_add_test(hessenberg) ei_add_test(schur_real) ei_add_test(schur_complex) ei_add_test(eigensolver_selfadjoint) ei_add_test(eigensolver_generic) ei_add_test(eigensolver_complex) ei_add_test(real_qz) ei_add_test(eigensolver_generalized_real) ei_add_test(jacobi) ei_add_test(jacobisvd) ei_add_test(bdcsvd) ei_add_test(householder) ei_add_test(geo_orthomethods) ei_add_test(geo_quaternion) ei_add_test(geo_eulerangles) ei_add_test(geo_parametrizedline) ei_add_test(geo_alignedbox) ei_add_test(geo_hyperplane) ei_add_test(geo_transformations) ei_add_test(geo_homogeneous) ei_add_test(stdvector) ei_add_test(stdvector_overload) ei_add_test(stdlist) ei_add_test(stdlist_overload) ei_add_test(stddeque) ei_add_test(stddeque_overload) ei_add_test(sparse_basic) ei_add_test(sparse_block) ei_add_test(sparse_vector) ei_add_test(sparse_product) ei_add_test(sparse_ref) ei_add_test(sparse_solvers) ei_add_test(sparse_permutations) ei_add_test(simplicial_cholesky) ei_add_test(conjugate_gradient) ei_add_test(incomplete_cholesky) ei_add_test(bicgstab) ei_add_test(lscg) ei_add_test(sparselu) ei_add_test(sparseqr) ei_add_test(umeyama) ei_add_test(nesting_ops "${CMAKE_CXX_FLAGS_DEBUG}") ei_add_test(nestbyvalue) ei_add_test(zerosized) ei_add_test(dontalign) ei_add_test(evaluators) if(NOT EIGEN_TEST_NO_EXCEPTIONS) ei_add_test(sizeoverflow) endif() ei_add_test(prec_inverse_4x4) ei_add_test(vectorwiseop) ei_add_test(special_numbers) ei_add_test(rvalue_types) ei_add_test(dense_storage) ei_add_test(ctorleak) ei_add_test(mpl2only) ei_add_test(inplace_decomposition) ei_add_test(half_float) ei_add_test(bfloat16_float) ei_add_test(array_of_string) ei_add_test(num_dimensions) ei_add_test(stl_iterators) ei_add_test(blasutil) ei_add_test(random_matrix) ei_add_test(initializer_list_construction) ei_add_test(diagonal_matrix_variadic_ctor) add_executable(bug1213 bug1213.cpp bug1213_main.cpp) check_cxx_compiler_flag("-ffast-math" COMPILER_SUPPORT_FASTMATH) if(COMPILER_SUPPORT_FASTMATH) set(EIGEN_FASTMATH_FLAGS "-ffast-math") else() check_cxx_compiler_flag("/fp:fast" COMPILER_SUPPORT_FPFAST) if(COMPILER_SUPPORT_FPFAST) set(EIGEN_FASTMATH_FLAGS "/fp:fast") endif() endif() ei_add_test(fastmath " ${EIGEN_FASTMATH_FLAGS} ") # # ei_add_test(denseLM) if(QT4_FOUND) ei_add_test(qtvector "" "${QT_QTCORE_LIBRARY}") endif() if(UMFPACK_FOUND) ei_add_test(umfpack_support "" "${UMFPACK_ALL_LIBS}") endif() if(KLU_FOUND OR SuiteSparse_FOUND) ei_add_test(klu_support "" "${KLU_ALL_LIBS}") endif() if(SUPERLU_FOUND) ei_add_test(superlu_support "" "${SUPERLU_ALL_LIBS}") endif() if(CHOLMOD_FOUND) ei_add_test(cholmod_support "" "${CHOLMOD_ALL_LIBS}") endif() if(PARDISO_FOUND) ei_add_test(pardiso_support "" "${PARDISO_ALL_LIBS}") endif() if(PASTIX_FOUND AND (SCOTCH_FOUND OR METIS_FOUND)) ei_add_test(pastix_support "" "${PASTIX_ALL_LIBS}") endif() if(SPQR_FOUND AND CHOLMOD_FOUND) ei_add_test(spqr_support "" "${SPQR_ALL_LIBS}") endif() if(METIS_FOUND) ei_add_test(metis_support "" "${METIS_LIBRARIES}") endif() string(TOLOWER "${CMAKE_CXX_COMPILER}" cmake_cxx_compiler_tolower) if(cmake_cxx_compiler_tolower MATCHES "qcc") set(CXX_IS_QCC "ON") endif() ei_add_property(EIGEN_TESTING_SUMMARY "CXX: ${CMAKE_CXX_COMPILER}\n") if(CMAKE_COMPILER_IS_GNUCXX AND NOT CXX_IS_QCC) execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version COMMAND head -n 1 OUTPUT_VARIABLE EIGEN_CXX_VERSION_STRING OUTPUT_STRIP_TRAILING_WHITESPACE) ei_add_property(EIGEN_TESTING_SUMMARY "CXX_VERSION: ${EIGEN_CXX_VERSION_STRING}\n") endif() ei_add_property(EIGEN_TESTING_SUMMARY "CXX_FLAGS: ${CMAKE_CXX_FLAGS}\n") if (EIGEN_TEST_CUSTOM_CXX_FLAGS) ei_add_property(EIGEN_TESTING_SUMMARY "Custom CXX flags: ${EIGEN_TEST_CUSTOM_CXX_FLAGS}\n") endif() ei_add_property(EIGEN_TESTING_SUMMARY "Sparse lib flags: ${SPARSE_LIBS}\n") option(EIGEN_TEST_EIGEN2 "Run whole Eigen2 test suite against EIGEN2_SUPPORT" OFF) mark_as_advanced(EIGEN_TEST_EIGEN2) if(EIGEN_TEST_EIGEN2) message(WARNING "The Eigen2 test suite has been removed") endif() # boost MP unit test find_package(Boost 1.53.0) if(Boost_FOUND) include_directories(${Boost_INCLUDE_DIRS}) ei_add_test(boostmultiprec "" "${Boost_LIBRARIES}") ei_add_property(EIGEN_TESTED_BACKENDS "Boost.Multiprecision, ") else() ei_add_property(EIGEN_MISSING_BACKENDS "Boost.Multiprecision, ") endif() # CUDA unit tests option(EIGEN_TEST_CUDA "Enable CUDA support in unit tests" OFF) option(EIGEN_TEST_CUDA_CLANG "Use clang instead of nvcc to compile the CUDA tests" OFF) if(EIGEN_TEST_CUDA_CLANG AND NOT CMAKE_CXX_COMPILER MATCHES "clang") message(WARNING "EIGEN_TEST_CUDA_CLANG is set, but CMAKE_CXX_COMPILER does not appear to be clang.") endif() if(EIGEN_TEST_CUDA) find_package(CUDA 5.0) if(CUDA_FOUND) set(CUDA_PROPAGATE_HOST_FLAGS OFF) set(EIGEN_CUDA_RELAXED_CONSTEXPR "--expt-relaxed-constexpr") if (${CUDA_VERSION} STREQUAL "7.0") set(EIGEN_CUDA_RELAXED_CONSTEXPR "--relaxed-constexpr") endif() if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CUDA_NVCC_FLAGS "-ccbin ${CMAKE_C_COMPILER}" CACHE STRING "nvcc flags" FORCE) endif() if(EIGEN_TEST_CUDA_CLANG) string(APPEND CMAKE_CXX_FLAGS " --cuda-path=${CUDA_TOOLKIT_ROOT_DIR}") foreach(GPU IN LISTS EIGEN_CUDA_COMPUTE_ARCH) string(APPEND CMAKE_CXX_FLAGS " --cuda-gpu-arch=sm_${GPU}") endforeach() else() foreach(GPU IN LISTS EIGEN_CUDA_COMPUTE_ARCH) string(APPEND CUDA_NVCC_FLAGS " -gencode arch=compute_${GPU},code=sm_${GPU}") endforeach() endif() string(APPEND CUDA_NVCC_FLAGS " ${EIGEN_CUDA_RELAXED_CONSTEXPR}") set(EIGEN_ADD_TEST_FILENAME_EXTENSION "cu") ei_add_test(gpu_basic) unset(EIGEN_ADD_TEST_FILENAME_EXTENSION) endif() endif() # HIP unit tests option(EIGEN_TEST_HIP "Add HIP support." OFF) if (EIGEN_TEST_HIP) set(HIP_PATH "/opt/rocm/hip" CACHE STRING "Path to the HIP installation.") if (EXISTS ${HIP_PATH}) list(APPEND CMAKE_MODULE_PATH ${HIP_PATH}/cmake) find_package(HIP REQUIRED) if (HIP_FOUND) execute_process(COMMAND ${HIP_PATH}/bin/hipconfig --platform OUTPUT_VARIABLE HIP_PLATFORM) if ((${HIP_PLATFORM} STREQUAL "hcc") OR (${HIP_PLATFORM} STREQUAL "amd")) include_directories(${HIP_PATH}/include) set(EIGEN_ADD_TEST_FILENAME_EXTENSION "cu") ei_add_test(gpu_basic) unset(EIGEN_ADD_TEST_FILENAME_EXTENSION) elseif ((${HIP_PLATFORM} STREQUAL "nvcc") OR (${HIP_PLATFORM} STREQUAL "nvidia")) message(FATAL_ERROR "HIP_PLATFORM = nvcc is not supported within Eigen") else () message(FATAL_ERROR "Unknown HIP_PLATFORM = ${HIP_PLATFORM}") endif() endif() else () message(FATAL_ERROR "EIGEN_TEST_HIP is ON, but the specified HIP_PATH (${HIP_PATH}) does not exist") endif() endif() cmake_dependent_option(EIGEN_TEST_BUILD_DOCUMENTATION "Test building the doxygen documentation" OFF "EIGEN_BUILD_DOC" OFF) if(EIGEN_TEST_BUILD_DOCUMENTATION) add_dependencies(buildtests doc) endif() # Register all smoke tests include("EigenSmokeTestList") ei_add_smoke_tests("${ei_smoke_test_list}") ================================================ FILE: VO_Module/thirdparty/eigen/test/MovableScalar.h ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2020 Sebastien Boisvert // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_MISC_MOVABLE_SCALAR_H #define EIGEN_MISC_MOVABLE_SCALAR_H #include namespace Eigen { template > struct MovableScalar : public Base { MovableScalar() = default; ~MovableScalar() = default; MovableScalar(const MovableScalar&) = default; MovableScalar(MovableScalar&& other) = default; MovableScalar& operator=(const MovableScalar&) = default; MovableScalar& operator=(MovableScalar&& other) = default; MovableScalar(Scalar scalar) : Base(100, scalar) {} operator Scalar() const { return this->size() > 0 ? this->back() : Scalar(); } }; template<> struct NumTraits> : GenericNumTraits {}; } #endif ================================================ FILE: VO_Module/thirdparty/eigen/test/OffByOneScalar.h ================================================ // A Scalar with internal representation T+1 so that zero is internally // represented by T(1). This is used to test memory fill. // template class OffByOneScalar { public: OffByOneScalar() : val_(1) {} OffByOneScalar(const OffByOneScalar& other) { *this = other; } OffByOneScalar& operator=(const OffByOneScalar& other) { val_ = other.val_; return *this; } OffByOneScalar(T val) : val_(val + 1) {} OffByOneScalar& operator=(T val) { val_ = val + 1; } operator T() const { return val_ - 1; } private: T val_; }; ================================================ FILE: VO_Module/thirdparty/eigen/test/SafeScalar.h ================================================ // A Scalar that asserts for uninitialized access. template class SafeScalar { public: SafeScalar() : initialized_(false) {} SafeScalar(const SafeScalar& other) { *this = other; } SafeScalar& operator=(const SafeScalar& other) { val_ = T(other); initialized_ = true; return *this; } SafeScalar(T val) : val_(val), initialized_(true) {} SafeScalar& operator=(T val) { val_ = val; initialized_ = true; } operator T() const { VERIFY(initialized_ && "Uninitialized access."); return val_; } private: T val_; bool initialized_; }; ================================================ FILE: VO_Module/thirdparty/eigen/test/adjoint.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2006-2008 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #define EIGEN_NO_STATIC_ASSERT #include "main.h" template struct adjoint_specific; template<> struct adjoint_specific { template static void run(const Vec& v1, const Vec& v2, Vec& v3, const Mat& square, Scalar s1, Scalar s2) { VERIFY(test_isApproxWithRef((s1 * v1 + s2 * v2).dot(v3), numext::conj(s1) * v1.dot(v3) + numext::conj(s2) * v2.dot(v3), 0)); VERIFY(test_isApproxWithRef(v3.dot(s1 * v1 + s2 * v2), s1*v3.dot(v1)+s2*v3.dot(v2), 0)); // check compatibility of dot and adjoint VERIFY(test_isApproxWithRef(v1.dot(square * v2), (square.adjoint() * v1).dot(v2), 0)); } }; template<> struct adjoint_specific { template static void run(const Vec& v1, const Vec& v2, Vec& v3, const Mat& square, Scalar s1, Scalar s2) { typedef typename NumTraits::Real RealScalar; using std::abs; RealScalar ref = NumTraits::IsInteger ? RealScalar(0) : (std::max)((s1 * v1 + s2 * v2).norm(),v3.norm()); VERIFY(test_isApproxWithRef((s1 * v1 + s2 * v2).dot(v3), numext::conj(s1) * v1.dot(v3) + numext::conj(s2) * v2.dot(v3), ref)); VERIFY(test_isApproxWithRef(v3.dot(s1 * v1 + s2 * v2), s1*v3.dot(v1)+s2*v3.dot(v2), ref)); VERIFY_IS_APPROX(v1.squaredNorm(), v1.norm() * v1.norm()); // check normalized() and normalize() VERIFY_IS_APPROX(v1, v1.norm() * v1.normalized()); v3 = v1; v3.normalize(); VERIFY_IS_APPROX(v1, v1.norm() * v3); VERIFY_IS_APPROX(v3, v1.normalized()); VERIFY_IS_APPROX(v3.norm(), RealScalar(1)); // check null inputs VERIFY_IS_APPROX((v1*0).normalized(), (v1*0)); #if (!EIGEN_ARCH_i386) || defined(EIGEN_VECTORIZE) RealScalar very_small = (std::numeric_limits::min)(); VERIFY( (v1*very_small).norm() == 0 ); VERIFY_IS_APPROX((v1*very_small).normalized(), (v1*very_small)); v3 = v1*very_small; v3.normalize(); VERIFY_IS_APPROX(v3, (v1*very_small)); #endif // check compatibility of dot and adjoint ref = NumTraits::IsInteger ? 0 : (std::max)((std::max)(v1.norm(),v2.norm()),(std::max)((square * v2).norm(),(square.adjoint() * v1).norm())); VERIFY(internal::isMuchSmallerThan(abs(v1.dot(square * v2) - (square.adjoint() * v1).dot(v2)), ref, test_precision())); // check that Random().normalized() works: tricky as the random xpr must be evaluated by // normalized() in order to produce a consistent result. VERIFY_IS_APPROX(Vec::Random(v1.size()).normalized().norm(), RealScalar(1)); } }; template void adjoint(const MatrixType& m) { /* this test covers the following files: Transpose.h Conjugate.h Dot.h */ using std::abs; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef Matrix VectorType; typedef Matrix SquareMatrixType; const Index PacketSize = internal::packet_traits::size; Index rows = m.rows(); Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols), m3(rows, cols), square = SquareMatrixType::Random(rows, rows); VectorType v1 = VectorType::Random(rows), v2 = VectorType::Random(rows), v3 = VectorType::Random(rows), vzero = VectorType::Zero(rows); Scalar s1 = internal::random(), s2 = internal::random(); // check basic compatibility of adjoint, transpose, conjugate VERIFY_IS_APPROX(m1.transpose().conjugate().adjoint(), m1); VERIFY_IS_APPROX(m1.adjoint().conjugate().transpose(), m1); // check multiplicative behavior VERIFY_IS_APPROX((m1.adjoint() * m2).adjoint(), m2.adjoint() * m1); VERIFY_IS_APPROX((s1 * m1).adjoint(), numext::conj(s1) * m1.adjoint()); // check basic properties of dot, squaredNorm VERIFY_IS_APPROX(numext::conj(v1.dot(v2)), v2.dot(v1)); VERIFY_IS_APPROX(numext::real(v1.dot(v1)), v1.squaredNorm()); adjoint_specific::IsInteger>::run(v1, v2, v3, square, s1, s2); VERIFY_IS_MUCH_SMALLER_THAN(abs(vzero.dot(v1)), static_cast(1)); // like in testBasicStuff, test operator() to check const-qualification Index r = internal::random(0, rows-1), c = internal::random(0, cols-1); VERIFY_IS_APPROX(m1.conjugate()(r,c), numext::conj(m1(r,c))); VERIFY_IS_APPROX(m1.adjoint()(c,r), numext::conj(m1(r,c))); // check inplace transpose m3 = m1; m3.transposeInPlace(); VERIFY_IS_APPROX(m3,m1.transpose()); m3.transposeInPlace(); VERIFY_IS_APPROX(m3,m1); if(PacketSize(0,m3.rows()-PacketSize); Index j = internal::random(0,m3.cols()-PacketSize); m3.template block(i,j).transposeInPlace(); VERIFY_IS_APPROX( (m3.template block(i,j)), (m1.template block(i,j).transpose()) ); m3.template block(i,j).transposeInPlace(); VERIFY_IS_APPROX(m3,m1); } // check inplace adjoint m3 = m1; m3.adjointInPlace(); VERIFY_IS_APPROX(m3,m1.adjoint()); m3.transposeInPlace(); VERIFY_IS_APPROX(m3,m1.conjugate()); // check mixed dot product typedef Matrix RealVectorType; RealVectorType rv1 = RealVectorType::Random(rows); VERIFY_IS_APPROX(v1.dot(rv1.template cast()), v1.dot(rv1)); VERIFY_IS_APPROX(rv1.template cast().dot(v1), rv1.dot(v1)); VERIFY( is_same_type(m1,m1.template conjugateIf()) ); VERIFY( is_same_type(m1.conjugate(),m1.template conjugateIf()) ); } template void adjoint_extra() { MatrixXcf a(10,10), b(10,10); VERIFY_RAISES_ASSERT(a = a.transpose()); VERIFY_RAISES_ASSERT(a = a.transpose() + b); VERIFY_RAISES_ASSERT(a = b + a.transpose()); VERIFY_RAISES_ASSERT(a = a.conjugate().transpose()); VERIFY_RAISES_ASSERT(a = a.adjoint()); VERIFY_RAISES_ASSERT(a = a.adjoint() + b); VERIFY_RAISES_ASSERT(a = b + a.adjoint()); // no assertion should be triggered for these cases: a.transpose() = a.transpose(); a.transpose() += a.transpose(); a.transpose() += a.transpose() + b; a.transpose() = a.adjoint(); a.transpose() += a.adjoint(); a.transpose() += a.adjoint() + b; // regression tests for check_for_aliasing MatrixXd c(10,10); c = 1.0 * MatrixXd::Ones(10,10) + c; c = MatrixXd::Ones(10,10) * 1.0 + c; c = c + MatrixXd::Ones(10,10) .cwiseProduct( MatrixXd::Zero(10,10) ); c = MatrixXd::Ones(10,10) * MatrixXd::Zero(10,10); // regression for bug 1646 for (int j = 0; j < 10; ++j) { c.col(j).head(j) = c.row(j).head(j); } for (int j = 0; j < 10; ++j) { c.col(j) = c.row(j); } a.conservativeResize(1,1); a = a.transpose(); a.conservativeResize(0,0); a = a.transpose(); } EIGEN_DECLARE_TEST(adjoint) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( adjoint(Matrix()) ); CALL_SUBTEST_2( adjoint(Matrix3d()) ); CALL_SUBTEST_3( adjoint(Matrix4f()) ); CALL_SUBTEST_4( adjoint(MatrixXcf(internal::random(1,EIGEN_TEST_MAX_SIZE/2), internal::random(1,EIGEN_TEST_MAX_SIZE/2))) ); CALL_SUBTEST_5( adjoint(MatrixXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_6( adjoint(MatrixXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); // Complement for 128 bits vectorization: CALL_SUBTEST_8( adjoint(Matrix2d()) ); CALL_SUBTEST_9( adjoint(Matrix()) ); // 256 bits vectorization: CALL_SUBTEST_10( adjoint(Matrix()) ); CALL_SUBTEST_11( adjoint(Matrix()) ); CALL_SUBTEST_12( adjoint(Matrix()) ); } // test a large static matrix only once CALL_SUBTEST_7( adjoint(Matrix()) ); CALL_SUBTEST_13( adjoint_extra<0>() ); } ================================================ FILE: VO_Module/thirdparty/eigen/test/array_cwise.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2009 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" // Test the corner cases of pow(x, y) for real types. template void pow_test() { const Scalar zero = Scalar(0); const Scalar eps = Eigen::NumTraits::epsilon(); const Scalar one = Scalar(1); const Scalar two = Scalar(2); const Scalar three = Scalar(3); const Scalar sqrt_half = Scalar(std::sqrt(0.5)); const Scalar sqrt2 = Scalar(std::sqrt(2)); const Scalar inf = Eigen::NumTraits::infinity(); const Scalar nan = Eigen::NumTraits::quiet_NaN(); const Scalar denorm_min = std::numeric_limits::denorm_min(); const Scalar min = (std::numeric_limits::min)(); const Scalar max = (std::numeric_limits::max)(); const Scalar max_exp = (static_cast(int(Eigen::NumTraits::max_exponent())) * Scalar(EIGEN_LN2)) / eps; const static Scalar abs_vals[] = {zero, denorm_min, min, eps, sqrt_half, one, sqrt2, two, three, max_exp, max, inf, nan}; const int abs_cases = 13; const int num_cases = 2*abs_cases * 2*abs_cases; // Repeat the same value to make sure we hit the vectorized path. const int num_repeats = 32; Array x(num_repeats, num_cases); Array y(num_repeats, num_cases); int count = 0; for (int i = 0; i < abs_cases; ++i) { const Scalar abs_x = abs_vals[i]; for (int sign_x = 0; sign_x < 2; ++sign_x) { Scalar x_case = sign_x == 0 ? -abs_x : abs_x; for (int j = 0; j < abs_cases; ++j) { const Scalar abs_y = abs_vals[j]; for (int sign_y = 0; sign_y < 2; ++sign_y) { Scalar y_case = sign_y == 0 ? -abs_y : abs_y; for (int repeat = 0; repeat < num_repeats; ++repeat) { x(repeat, count) = x_case; y(repeat, count) = y_case; } ++count; } } } } Array actual = x.pow(y); const Scalar tol = test_precision(); bool all_pass = true; for (int i = 0; i < 1; ++i) { for (int j = 0; j < num_cases; ++j) { Scalar e = static_cast(std::pow(x(i,j), y(i,j))); Scalar a = actual(i, j); bool fail = !(a==e) && !internal::isApprox(a, e, tol) && !((numext::isnan)(a) && (numext::isnan)(e)); all_pass &= !fail; if (fail) { std::cout << "pow(" << x(i,j) << "," << y(i,j) << ") = " << a << " != " << e << std::endl; } } } VERIFY(all_pass); } template void array(const ArrayType& m) { typedef typename ArrayType::Scalar Scalar; typedef typename ArrayType::RealScalar RealScalar; typedef Array ColVectorType; typedef Array RowVectorType; Index rows = m.rows(); Index cols = m.cols(); ArrayType m1 = ArrayType::Random(rows, cols), m2 = ArrayType::Random(rows, cols), m3(rows, cols); ArrayType m4 = m1; // copy constructor VERIFY_IS_APPROX(m1, m4); ColVectorType cv1 = ColVectorType::Random(rows); RowVectorType rv1 = RowVectorType::Random(cols); Scalar s1 = internal::random(), s2 = internal::random(); // scalar addition VERIFY_IS_APPROX(m1 + s1, s1 + m1); VERIFY_IS_APPROX(m1 + s1, ArrayType::Constant(rows,cols,s1) + m1); VERIFY_IS_APPROX(s1 - m1, (-m1)+s1 ); VERIFY_IS_APPROX(m1 - s1, m1 - ArrayType::Constant(rows,cols,s1)); VERIFY_IS_APPROX(s1 - m1, ArrayType::Constant(rows,cols,s1) - m1); VERIFY_IS_APPROX((m1*Scalar(2)) - s2, (m1+m1) - ArrayType::Constant(rows,cols,s2) ); m3 = m1; m3 += s2; VERIFY_IS_APPROX(m3, m1 + s2); m3 = m1; m3 -= s1; VERIFY_IS_APPROX(m3, m1 - s1); // scalar operators via Maps m3 = m1; ArrayType::Map(m1.data(), m1.rows(), m1.cols()) -= ArrayType::Map(m2.data(), m2.rows(), m2.cols()); VERIFY_IS_APPROX(m1, m3 - m2); m3 = m1; ArrayType::Map(m1.data(), m1.rows(), m1.cols()) += ArrayType::Map(m2.data(), m2.rows(), m2.cols()); VERIFY_IS_APPROX(m1, m3 + m2); m3 = m1; ArrayType::Map(m1.data(), m1.rows(), m1.cols()) *= ArrayType::Map(m2.data(), m2.rows(), m2.cols()); VERIFY_IS_APPROX(m1, m3 * m2); m3 = m1; m2 = ArrayType::Random(rows,cols); m2 = (m2==0).select(1,m2); ArrayType::Map(m1.data(), m1.rows(), m1.cols()) /= ArrayType::Map(m2.data(), m2.rows(), m2.cols()); VERIFY_IS_APPROX(m1, m3 / m2); // reductions VERIFY_IS_APPROX(m1.abs().colwise().sum().sum(), m1.abs().sum()); VERIFY_IS_APPROX(m1.abs().rowwise().sum().sum(), m1.abs().sum()); using std::abs; VERIFY_IS_MUCH_SMALLER_THAN(abs(m1.colwise().sum().sum() - m1.sum()), m1.abs().sum()); VERIFY_IS_MUCH_SMALLER_THAN(abs(m1.rowwise().sum().sum() - m1.sum()), m1.abs().sum()); if (!internal::isMuchSmallerThan(abs(m1.sum() - (m1+m2).sum()), m1.abs().sum(), test_precision())) VERIFY_IS_NOT_APPROX(((m1+m2).rowwise().sum()).sum(), m1.sum()); VERIFY_IS_APPROX(m1.colwise().sum(), m1.colwise().redux(internal::scalar_sum_op())); // vector-wise ops m3 = m1; VERIFY_IS_APPROX(m3.colwise() += cv1, m1.colwise() + cv1); m3 = m1; VERIFY_IS_APPROX(m3.colwise() -= cv1, m1.colwise() - cv1); m3 = m1; VERIFY_IS_APPROX(m3.rowwise() += rv1, m1.rowwise() + rv1); m3 = m1; VERIFY_IS_APPROX(m3.rowwise() -= rv1, m1.rowwise() - rv1); // Conversion from scalar VERIFY_IS_APPROX((m3 = s1), ArrayType::Constant(rows,cols,s1)); VERIFY_IS_APPROX((m3 = 1), ArrayType::Constant(rows,cols,1)); VERIFY_IS_APPROX((m3.topLeftCorner(rows,cols) = 1), ArrayType::Constant(rows,cols,1)); typedef Array FixedArrayType; { FixedArrayType f1(s1); VERIFY_IS_APPROX(f1, FixedArrayType::Constant(s1)); FixedArrayType f2(numext::real(s1)); VERIFY_IS_APPROX(f2, FixedArrayType::Constant(numext::real(s1))); FixedArrayType f3((int)100*numext::real(s1)); VERIFY_IS_APPROX(f3, FixedArrayType::Constant((int)100*numext::real(s1))); f1.setRandom(); FixedArrayType f4(f1.data()); VERIFY_IS_APPROX(f4, f1); } #if EIGEN_HAS_CXX11 { FixedArrayType f1{s1}; VERIFY_IS_APPROX(f1, FixedArrayType::Constant(s1)); FixedArrayType f2{numext::real(s1)}; VERIFY_IS_APPROX(f2, FixedArrayType::Constant(numext::real(s1))); FixedArrayType f3{(int)100*numext::real(s1)}; VERIFY_IS_APPROX(f3, FixedArrayType::Constant((int)100*numext::real(s1))); f1.setRandom(); FixedArrayType f4{f1.data()}; VERIFY_IS_APPROX(f4, f1); } #endif // pow VERIFY_IS_APPROX(m1.pow(2), m1.square()); VERIFY_IS_APPROX(pow(m1,2), m1.square()); VERIFY_IS_APPROX(m1.pow(3), m1.cube()); VERIFY_IS_APPROX(pow(m1,3), m1.cube()); VERIFY_IS_APPROX((-m1).pow(3), -m1.cube()); VERIFY_IS_APPROX(pow(2*m1,3), 8*m1.cube()); ArrayType exponents = ArrayType::Constant(rows, cols, RealScalar(2)); VERIFY_IS_APPROX(Eigen::pow(m1,exponents), m1.square()); VERIFY_IS_APPROX(m1.pow(exponents), m1.square()); VERIFY_IS_APPROX(Eigen::pow(2*m1,exponents), 4*m1.square()); VERIFY_IS_APPROX((2*m1).pow(exponents), 4*m1.square()); VERIFY_IS_APPROX(Eigen::pow(m1,2*exponents), m1.square().square()); VERIFY_IS_APPROX(m1.pow(2*exponents), m1.square().square()); VERIFY_IS_APPROX(Eigen::pow(m1(0,0), exponents), ArrayType::Constant(rows,cols,m1(0,0)*m1(0,0))); // Check possible conflicts with 1D ctor typedef Array OneDArrayType; { OneDArrayType o1(rows); VERIFY(o1.size()==rows); OneDArrayType o2(static_cast(rows)); VERIFY(o2.size()==rows); } #if EIGEN_HAS_CXX11 { OneDArrayType o1{rows}; VERIFY(o1.size()==rows); OneDArrayType o4{int(rows)}; VERIFY(o4.size()==rows); } #endif // Check possible conflicts with 2D ctor typedef Array TwoDArrayType; typedef Array ArrayType2; { TwoDArrayType o1(rows,cols); VERIFY(o1.rows()==rows); VERIFY(o1.cols()==cols); TwoDArrayType o2(static_cast(rows),static_cast(cols)); VERIFY(o2.rows()==rows); VERIFY(o2.cols()==cols); ArrayType2 o3(rows,cols); VERIFY(o3(0)==Scalar(rows) && o3(1)==Scalar(cols)); ArrayType2 o4(static_cast(rows),static_cast(cols)); VERIFY(o4(0)==Scalar(rows) && o4(1)==Scalar(cols)); } #if EIGEN_HAS_CXX11 { TwoDArrayType o1{rows,cols}; VERIFY(o1.rows()==rows); VERIFY(o1.cols()==cols); TwoDArrayType o2{int(rows),int(cols)}; VERIFY(o2.rows()==rows); VERIFY(o2.cols()==cols); ArrayType2 o3{rows,cols}; VERIFY(o3(0)==Scalar(rows) && o3(1)==Scalar(cols)); ArrayType2 o4{int(rows),int(cols)}; VERIFY(o4(0)==Scalar(rows) && o4(1)==Scalar(cols)); } #endif } template void comparisons(const ArrayType& m) { using std::abs; typedef typename ArrayType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; Index rows = m.rows(); Index cols = m.cols(); Index r = internal::random(0, rows-1), c = internal::random(0, cols-1); ArrayType m1 = ArrayType::Random(rows, cols), m2 = ArrayType::Random(rows, cols), m3(rows, cols), m4 = m1; m4 = (m4.abs()==Scalar(0)).select(1,m4); VERIFY(((m1 + Scalar(1)) > m1).all()); VERIFY(((m1 - Scalar(1)) < m1).all()); if (rows*cols>1) { m3 = m1; m3(r,c) += 1; VERIFY(! (m1 < m3).all() ); VERIFY(! (m1 > m3).all() ); } VERIFY(!(m1 > m2 && m1 < m2).any()); VERIFY((m1 <= m2 || m1 >= m2).all()); // comparisons array to scalar VERIFY( (m1 != (m1(r,c)+1) ).any() ); VERIFY( (m1 > (m1(r,c)-1) ).any() ); VERIFY( (m1 < (m1(r,c)+1) ).any() ); VERIFY( (m1 == m1(r,c) ).any() ); // comparisons scalar to array VERIFY( ( (m1(r,c)+1) != m1).any() ); VERIFY( ( (m1(r,c)-1) < m1).any() ); VERIFY( ( (m1(r,c)+1) > m1).any() ); VERIFY( ( m1(r,c) == m1).any() ); // test Select VERIFY_IS_APPROX( (m1m2).select(m1,m2), m1.cwiseMax(m2) ); Scalar mid = (m1.cwiseAbs().minCoeff() + m1.cwiseAbs().maxCoeff())/Scalar(2); for (int j=0; j=ArrayType::Constant(rows,cols,mid)) .select(m1,0), m3); // even shorter version: VERIFY_IS_APPROX( (m1.abs()RealScalar(0.1)).count() == rows*cols); // and/or VERIFY( (m1RealScalar(0)).count() == 0); VERIFY( (m1=RealScalar(0)).count() == rows*cols); RealScalar a = m1.abs().mean(); VERIFY( (m1<-a || m1>a).count() == (m1.abs()>a).count()); typedef Array ArrayOfIndices; // TODO allows colwise/rowwise for array VERIFY_IS_APPROX(((m1.abs()+1)>RealScalar(0.1)).colwise().count(), ArrayOfIndices::Constant(cols,rows).transpose()); VERIFY_IS_APPROX(((m1.abs()+1)>RealScalar(0.1)).rowwise().count(), ArrayOfIndices::Constant(rows, cols)); } template void array_real(const ArrayType& m) { using std::abs; using std::sqrt; typedef typename ArrayType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; Index rows = m.rows(); Index cols = m.cols(); ArrayType m1 = ArrayType::Random(rows, cols), m2 = ArrayType::Random(rows, cols), m3(rows, cols), m4 = m1; m4 = (m4.abs()==Scalar(0)).select(Scalar(1),m4); Scalar s1 = internal::random(); // these tests are mostly to check possible compilation issues with free-functions. VERIFY_IS_APPROX(m1.sin(), sin(m1)); VERIFY_IS_APPROX(m1.cos(), cos(m1)); VERIFY_IS_APPROX(m1.tan(), tan(m1)); VERIFY_IS_APPROX(m1.asin(), asin(m1)); VERIFY_IS_APPROX(m1.acos(), acos(m1)); VERIFY_IS_APPROX(m1.atan(), atan(m1)); VERIFY_IS_APPROX(m1.sinh(), sinh(m1)); VERIFY_IS_APPROX(m1.cosh(), cosh(m1)); VERIFY_IS_APPROX(m1.tanh(), tanh(m1)); #if EIGEN_HAS_CXX11_MATH VERIFY_IS_APPROX(m1.tanh().atanh(), atanh(tanh(m1))); VERIFY_IS_APPROX(m1.sinh().asinh(), asinh(sinh(m1))); VERIFY_IS_APPROX(m1.cosh().acosh(), acosh(cosh(m1))); #endif VERIFY_IS_APPROX(m1.logistic(), logistic(m1)); VERIFY_IS_APPROX(m1.arg(), arg(m1)); VERIFY_IS_APPROX(m1.round(), round(m1)); VERIFY_IS_APPROX(m1.rint(), rint(m1)); VERIFY_IS_APPROX(m1.floor(), floor(m1)); VERIFY_IS_APPROX(m1.ceil(), ceil(m1)); VERIFY((m1.isNaN() == (Eigen::isnan)(m1)).all()); VERIFY((m1.isInf() == (Eigen::isinf)(m1)).all()); VERIFY((m1.isFinite() == (Eigen::isfinite)(m1)).all()); VERIFY_IS_APPROX(m4.inverse(), inverse(m4)); VERIFY_IS_APPROX(m1.abs(), abs(m1)); VERIFY_IS_APPROX(m1.abs2(), abs2(m1)); VERIFY_IS_APPROX(m1.square(), square(m1)); VERIFY_IS_APPROX(m1.cube(), cube(m1)); VERIFY_IS_APPROX(cos(m1+RealScalar(3)*m2), cos((m1+RealScalar(3)*m2).eval())); VERIFY_IS_APPROX(m1.sign(), sign(m1)); VERIFY((m1.sqrt().sign().isNaN() == (Eigen::isnan)(sign(sqrt(m1)))).all()); // avoid inf and NaNs so verification doesn't fail m3 = m4.abs(); VERIFY_IS_APPROX(m3.sqrt(), sqrt(abs(m3))); VERIFY_IS_APPROX(m3.rsqrt(), Scalar(1)/sqrt(abs(m3))); VERIFY_IS_APPROX(rsqrt(m3), Scalar(1)/sqrt(abs(m3))); VERIFY_IS_APPROX(m3.log(), log(m3)); VERIFY_IS_APPROX(m3.log1p(), log1p(m3)); VERIFY_IS_APPROX(m3.log10(), log10(m3)); VERIFY_IS_APPROX(m3.log2(), log2(m3)); VERIFY((!(m1>m2) == (m1<=m2)).all()); VERIFY_IS_APPROX(sin(m1.asin()), m1); VERIFY_IS_APPROX(cos(m1.acos()), m1); VERIFY_IS_APPROX(tan(m1.atan()), m1); VERIFY_IS_APPROX(sinh(m1), Scalar(0.5)*(exp(m1)-exp(-m1))); VERIFY_IS_APPROX(cosh(m1), Scalar(0.5)*(exp(m1)+exp(-m1))); VERIFY_IS_APPROX(tanh(m1), (Scalar(0.5)*(exp(m1)-exp(-m1)))/(Scalar(0.5)*(exp(m1)+exp(-m1)))); VERIFY_IS_APPROX(logistic(m1), (Scalar(1)/(Scalar(1)+exp(-m1)))); VERIFY_IS_APPROX(arg(m1), ((m1())*Scalar(std::acos(Scalar(-1)))); VERIFY((round(m1) <= ceil(m1) && round(m1) >= floor(m1)).all()); VERIFY((rint(m1) <= ceil(m1) && rint(m1) >= floor(m1)).all()); VERIFY(((ceil(m1) - round(m1)) <= Scalar(0.5) || (round(m1) - floor(m1)) <= Scalar(0.5)).all()); VERIFY(((ceil(m1) - round(m1)) <= Scalar(1.0) && (round(m1) - floor(m1)) <= Scalar(1.0)).all()); VERIFY(((ceil(m1) - rint(m1)) <= Scalar(0.5) || (rint(m1) - floor(m1)) <= Scalar(0.5)).all()); VERIFY(((ceil(m1) - rint(m1)) <= Scalar(1.0) && (rint(m1) - floor(m1)) <= Scalar(1.0)).all()); VERIFY((Eigen::isnan)((m1*Scalar(0))/Scalar(0)).all()); VERIFY((Eigen::isinf)(m4/Scalar(0)).all()); VERIFY(((Eigen::isfinite)(m1) && (!(Eigen::isfinite)(m1*Scalar(0)/Scalar(0))) && (!(Eigen::isfinite)(m4/Scalar(0)))).all()); VERIFY_IS_APPROX(inverse(inverse(m4)),m4); VERIFY((abs(m1) == m1 || abs(m1) == -m1).all()); VERIFY_IS_APPROX(m3, sqrt(abs2(m3))); VERIFY_IS_APPROX(m1.absolute_difference(m2), (m1 > m2).select(m1 - m2, m2 - m1)); VERIFY_IS_APPROX( m1.sign(), -(-m1).sign() ); VERIFY_IS_APPROX( m1*m1.sign(),m1.abs()); VERIFY_IS_APPROX(m1.sign() * m1.abs(), m1); VERIFY_IS_APPROX(numext::abs2(numext::real(m1)) + numext::abs2(numext::imag(m1)), numext::abs2(m1)); VERIFY_IS_APPROX(numext::abs2(Eigen::real(m1)) + numext::abs2(Eigen::imag(m1)), numext::abs2(m1)); if(!NumTraits::IsComplex) VERIFY_IS_APPROX(numext::real(m1), m1); // shift argument of logarithm so that it is not zero Scalar smallNumber = NumTraits::dummy_precision(); VERIFY_IS_APPROX((m3 + smallNumber).log() , log(abs(m3) + smallNumber)); VERIFY_IS_APPROX((m3 + smallNumber + Scalar(1)).log() , log1p(abs(m3) + smallNumber)); VERIFY_IS_APPROX(m1.exp() * m2.exp(), exp(m1+m2)); VERIFY_IS_APPROX(m1.exp(), exp(m1)); VERIFY_IS_APPROX(m1.exp() / m2.exp(),(m1-m2).exp()); VERIFY_IS_APPROX(m1.expm1(), expm1(m1)); VERIFY_IS_APPROX((m3 + smallNumber).exp() - Scalar(1), expm1(abs(m3) + smallNumber)); VERIFY_IS_APPROX(m3.pow(RealScalar(0.5)), m3.sqrt()); VERIFY_IS_APPROX(pow(m3,RealScalar(0.5)), m3.sqrt()); VERIFY_IS_APPROX(m3.pow(RealScalar(-0.5)), m3.rsqrt()); VERIFY_IS_APPROX(pow(m3,RealScalar(-0.5)), m3.rsqrt()); // Avoid inf and NaN. m3 = (m1.square()::epsilon()).select(Scalar(1),m3); VERIFY_IS_APPROX(m3.pow(RealScalar(-2)), m3.square().inverse()); pow_test(); VERIFY_IS_APPROX(log10(m3), log(m3)/numext::log(Scalar(10))); VERIFY_IS_APPROX(log2(m3), log(m3)/numext::log(Scalar(2))); // scalar by array division const RealScalar tiny = sqrt(std::numeric_limits::epsilon()); s1 += Scalar(tiny); m1 += ArrayType::Constant(rows,cols,Scalar(tiny)); VERIFY_IS_APPROX(s1/m1, s1 * m1.inverse()); // check inplace transpose m3 = m1; m3.transposeInPlace(); VERIFY_IS_APPROX(m3, m1.transpose()); m3.transposeInPlace(); VERIFY_IS_APPROX(m3, m1); } template void array_complex(const ArrayType& m) { typedef typename ArrayType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; Index rows = m.rows(); Index cols = m.cols(); ArrayType m1 = ArrayType::Random(rows, cols), m2(rows, cols), m4 = m1; m4.real() = (m4.real().abs()==RealScalar(0)).select(RealScalar(1),m4.real()); m4.imag() = (m4.imag().abs()==RealScalar(0)).select(RealScalar(1),m4.imag()); Array m3(rows, cols); for (Index i = 0; i < m.rows(); ++i) for (Index j = 0; j < m.cols(); ++j) m2(i,j) = sqrt(m1(i,j)); // these tests are mostly to check possible compilation issues with free-functions. VERIFY_IS_APPROX(m1.sin(), sin(m1)); VERIFY_IS_APPROX(m1.cos(), cos(m1)); VERIFY_IS_APPROX(m1.tan(), tan(m1)); VERIFY_IS_APPROX(m1.sinh(), sinh(m1)); VERIFY_IS_APPROX(m1.cosh(), cosh(m1)); VERIFY_IS_APPROX(m1.tanh(), tanh(m1)); VERIFY_IS_APPROX(m1.logistic(), logistic(m1)); VERIFY_IS_APPROX(m1.arg(), arg(m1)); VERIFY((m1.isNaN() == (Eigen::isnan)(m1)).all()); VERIFY((m1.isInf() == (Eigen::isinf)(m1)).all()); VERIFY((m1.isFinite() == (Eigen::isfinite)(m1)).all()); VERIFY_IS_APPROX(m4.inverse(), inverse(m4)); VERIFY_IS_APPROX(m1.log(), log(m1)); VERIFY_IS_APPROX(m1.log10(), log10(m1)); VERIFY_IS_APPROX(m1.log2(), log2(m1)); VERIFY_IS_APPROX(m1.abs(), abs(m1)); VERIFY_IS_APPROX(m1.abs2(), abs2(m1)); VERIFY_IS_APPROX(m1.sqrt(), sqrt(m1)); VERIFY_IS_APPROX(m1.square(), square(m1)); VERIFY_IS_APPROX(m1.cube(), cube(m1)); VERIFY_IS_APPROX(cos(m1+RealScalar(3)*m2), cos((m1+RealScalar(3)*m2).eval())); VERIFY_IS_APPROX(m1.sign(), sign(m1)); VERIFY_IS_APPROX(m1.exp() * m2.exp(), exp(m1+m2)); VERIFY_IS_APPROX(m1.exp(), exp(m1)); VERIFY_IS_APPROX(m1.exp() / m2.exp(),(m1-m2).exp()); VERIFY_IS_APPROX(m1.expm1(), expm1(m1)); VERIFY_IS_APPROX(expm1(m1), exp(m1) - 1.); // Check for larger magnitude complex numbers that expm1 matches exp - 1. VERIFY_IS_APPROX(expm1(10. * m1), exp(10. * m1) - 1.); VERIFY_IS_APPROX(sinh(m1), 0.5*(exp(m1)-exp(-m1))); VERIFY_IS_APPROX(cosh(m1), 0.5*(exp(m1)+exp(-m1))); VERIFY_IS_APPROX(tanh(m1), (0.5*(exp(m1)-exp(-m1)))/(0.5*(exp(m1)+exp(-m1)))); VERIFY_IS_APPROX(logistic(m1), (1.0/(1.0 + exp(-m1)))); for (Index i = 0; i < m.rows(); ++i) for (Index j = 0; j < m.cols(); ++j) m3(i,j) = std::atan2(m1(i,j).imag(), m1(i,j).real()); VERIFY_IS_APPROX(arg(m1), m3); std::complex zero(0.0,0.0); VERIFY((Eigen::isnan)(m1*zero/zero).all()); #if EIGEN_COMP_MSVC // msvc complex division is not robust VERIFY((Eigen::isinf)(m4/RealScalar(0)).all()); #else #if EIGEN_COMP_CLANG // clang's complex division is notoriously broken too if((numext::isinf)(m4(0,0)/RealScalar(0))) { #endif VERIFY((Eigen::isinf)(m4/zero).all()); #if EIGEN_COMP_CLANG } else { VERIFY((Eigen::isinf)(m4.real()/zero.real()).all()); } #endif #endif // MSVC VERIFY(((Eigen::isfinite)(m1) && (!(Eigen::isfinite)(m1*zero/zero)) && (!(Eigen::isfinite)(m1/zero))).all()); VERIFY_IS_APPROX(inverse(inverse(m4)),m4); VERIFY_IS_APPROX(conj(m1.conjugate()), m1); VERIFY_IS_APPROX(abs(m1), sqrt(square(m1.real())+square(m1.imag()))); VERIFY_IS_APPROX(abs(m1), sqrt(abs2(m1))); VERIFY_IS_APPROX(log10(m1), log(m1)/log(10)); VERIFY_IS_APPROX(log2(m1), log(m1)/log(2)); VERIFY_IS_APPROX( m1.sign(), -(-m1).sign() ); VERIFY_IS_APPROX( m1.sign() * m1.abs(), m1); // scalar by array division Scalar s1 = internal::random(); const RealScalar tiny = std::sqrt(std::numeric_limits::epsilon()); s1 += Scalar(tiny); m1 += ArrayType::Constant(rows,cols,Scalar(tiny)); VERIFY_IS_APPROX(s1/m1, s1 * m1.inverse()); // check inplace transpose m2 = m1; m2.transposeInPlace(); VERIFY_IS_APPROX(m2, m1.transpose()); m2.transposeInPlace(); VERIFY_IS_APPROX(m2, m1); // Check vectorized inplace transpose. ArrayType m5 = ArrayType::Random(131, 131); ArrayType m6 = m5; m6.transposeInPlace(); VERIFY_IS_APPROX(m6, m5.transpose()); } template void min_max(const ArrayType& m) { typedef typename ArrayType::Scalar Scalar; Index rows = m.rows(); Index cols = m.cols(); ArrayType m1 = ArrayType::Random(rows, cols); // min/max with array Scalar maxM1 = m1.maxCoeff(); Scalar minM1 = m1.minCoeff(); VERIFY_IS_APPROX(ArrayType::Constant(rows,cols, minM1), (m1.min)(ArrayType::Constant(rows,cols, minM1))); VERIFY_IS_APPROX(m1, (m1.min)(ArrayType::Constant(rows,cols, maxM1))); VERIFY_IS_APPROX(ArrayType::Constant(rows,cols, maxM1), (m1.max)(ArrayType::Constant(rows,cols, maxM1))); VERIFY_IS_APPROX(m1, (m1.max)(ArrayType::Constant(rows,cols, minM1))); // min/max with scalar input VERIFY_IS_APPROX(ArrayType::Constant(rows,cols, minM1), (m1.min)( minM1)); VERIFY_IS_APPROX(m1, (m1.min)( maxM1)); VERIFY_IS_APPROX(ArrayType::Constant(rows,cols, maxM1), (m1.max)( maxM1)); VERIFY_IS_APPROX(m1, (m1.max)( minM1)); // min/max with various NaN propagation options. if (m1.size() > 1 && !NumTraits::IsInteger) { m1(0,0) = NumTraits::quiet_NaN(); maxM1 = m1.template maxCoeff(); minM1 = m1.template minCoeff(); VERIFY((numext::isnan)(maxM1)); VERIFY((numext::isnan)(minM1)); maxM1 = m1.template maxCoeff(); minM1 = m1.template minCoeff(); VERIFY(!(numext::isnan)(maxM1)); VERIFY(!(numext::isnan)(minM1)); } } template struct shift_left { template Scalar operator()(const Scalar& v) const { return v << N; } }; template struct arithmetic_shift_right { template Scalar operator()(const Scalar& v) const { return v >> N; } }; template void array_integer(const ArrayType& m) { Index rows = m.rows(); Index cols = m.cols(); ArrayType m1 = ArrayType::Random(rows, cols), m2(rows, cols); m2 = m1.template shiftLeft<2>(); VERIFY( (m2 == m1.unaryExpr(shift_left<2>())).all() ); m2 = m1.template shiftLeft<9>(); VERIFY( (m2 == m1.unaryExpr(shift_left<9>())).all() ); m2 = m1.template shiftRight<2>(); VERIFY( (m2 == m1.unaryExpr(arithmetic_shift_right<2>())).all() ); m2 = m1.template shiftRight<9>(); VERIFY( (m2 == m1.unaryExpr(arithmetic_shift_right<9>())).all() ); } EIGEN_DECLARE_TEST(array_cwise) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( array(Array()) ); CALL_SUBTEST_2( array(Array22f()) ); CALL_SUBTEST_3( array(Array44d()) ); CALL_SUBTEST_4( array(ArrayXXcf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_5( array(ArrayXXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_6( array(ArrayXXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_6( array(Array(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_6( array_integer(ArrayXXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_6( array_integer(Array(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); } for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( comparisons(Array()) ); CALL_SUBTEST_2( comparisons(Array22f()) ); CALL_SUBTEST_3( comparisons(Array44d()) ); CALL_SUBTEST_5( comparisons(ArrayXXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_6( comparisons(ArrayXXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); } for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( min_max(Array()) ); CALL_SUBTEST_2( min_max(Array22f()) ); CALL_SUBTEST_3( min_max(Array44d()) ); CALL_SUBTEST_5( min_max(ArrayXXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_6( min_max(ArrayXXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); } for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( array_real(Array()) ); CALL_SUBTEST_2( array_real(Array22f()) ); CALL_SUBTEST_3( array_real(Array44d()) ); CALL_SUBTEST_5( array_real(ArrayXXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_7( array_real(Array()) ); CALL_SUBTEST_8( array_real(Array()) ); } for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_4( array_complex(ArrayXXcf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); } VERIFY((internal::is_same< internal::global_math_functions_filtering_base::type, int >::value)); VERIFY((internal::is_same< internal::global_math_functions_filtering_base::type, float >::value)); VERIFY((internal::is_same< internal::global_math_functions_filtering_base::type, ArrayBase >::value)); typedef CwiseUnaryOp, ArrayXd > Xpr; VERIFY((internal::is_same< internal::global_math_functions_filtering_base::type, ArrayBase >::value)); } ================================================ FILE: VO_Module/thirdparty/eigen/test/array_for_matrix.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2009 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" template void array_for_matrix(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; typedef Matrix ColVectorType; typedef Matrix RowVectorType; Index rows = m.rows(); Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols), m3(rows, cols); ColVectorType cv1 = ColVectorType::Random(rows); RowVectorType rv1 = RowVectorType::Random(cols); Scalar s1 = internal::random(), s2 = internal::random(); // scalar addition VERIFY_IS_APPROX(m1.array() + s1, s1 + m1.array()); VERIFY_IS_APPROX((m1.array() + s1).matrix(), MatrixType::Constant(rows,cols,s1) + m1); VERIFY_IS_APPROX(((m1*Scalar(2)).array() - s2).matrix(), (m1+m1) - MatrixType::Constant(rows,cols,s2) ); m3 = m1; m3.array() += s2; VERIFY_IS_APPROX(m3, (m1.array() + s2).matrix()); m3 = m1; m3.array() -= s1; VERIFY_IS_APPROX(m3, (m1.array() - s1).matrix()); // reductions VERIFY_IS_MUCH_SMALLER_THAN(m1.colwise().sum().sum() - m1.sum(), m1.squaredNorm()); VERIFY_IS_MUCH_SMALLER_THAN(m1.rowwise().sum().sum() - m1.sum(), m1.squaredNorm()); VERIFY_IS_MUCH_SMALLER_THAN(m1.colwise().sum() + m2.colwise().sum() - (m1+m2).colwise().sum(), (m1+m2).squaredNorm()); VERIFY_IS_MUCH_SMALLER_THAN(m1.rowwise().sum() - m2.rowwise().sum() - (m1-m2).rowwise().sum(), (m1-m2).squaredNorm()); VERIFY_IS_APPROX(m1.colwise().sum(), m1.colwise().redux(internal::scalar_sum_op())); // vector-wise ops m3 = m1; VERIFY_IS_APPROX(m3.colwise() += cv1, m1.colwise() + cv1); m3 = m1; VERIFY_IS_APPROX(m3.colwise() -= cv1, m1.colwise() - cv1); m3 = m1; VERIFY_IS_APPROX(m3.rowwise() += rv1, m1.rowwise() + rv1); m3 = m1; VERIFY_IS_APPROX(m3.rowwise() -= rv1, m1.rowwise() - rv1); // empty objects VERIFY_IS_APPROX((m1.template block<0,Dynamic>(0,0,0,cols).colwise().sum()), RowVectorType::Zero(cols)); VERIFY_IS_APPROX((m1.template block(0,0,rows,0).rowwise().sum()), ColVectorType::Zero(rows)); VERIFY_IS_APPROX((m1.template block<0,Dynamic>(0,0,0,cols).colwise().prod()), RowVectorType::Ones(cols)); VERIFY_IS_APPROX((m1.template block(0,0,rows,0).rowwise().prod()), ColVectorType::Ones(rows)); VERIFY_IS_APPROX(m1.block(0,0,0,cols).colwise().sum(), RowVectorType::Zero(cols)); VERIFY_IS_APPROX(m1.block(0,0,rows,0).rowwise().sum(), ColVectorType::Zero(rows)); VERIFY_IS_APPROX(m1.block(0,0,0,cols).colwise().prod(), RowVectorType::Ones(cols)); VERIFY_IS_APPROX(m1.block(0,0,rows,0).rowwise().prod(), ColVectorType::Ones(rows)); // verify the const accessors exist const Scalar& ref_m1 = m.matrix().array().coeffRef(0); const Scalar& ref_m2 = m.matrix().array().coeffRef(0,0); const Scalar& ref_a1 = m.array().matrix().coeffRef(0); const Scalar& ref_a2 = m.array().matrix().coeffRef(0,0); VERIFY(&ref_a1 == &ref_m1); VERIFY(&ref_a2 == &ref_m2); // Check write accessors: m1.array().coeffRef(0,0) = 1; VERIFY_IS_APPROX(m1(0,0),Scalar(1)); m1.array()(0,0) = 2; VERIFY_IS_APPROX(m1(0,0),Scalar(2)); m1.array().matrix().coeffRef(0,0) = 3; VERIFY_IS_APPROX(m1(0,0),Scalar(3)); m1.array().matrix()(0,0) = 4; VERIFY_IS_APPROX(m1(0,0),Scalar(4)); } template void comparisons(const MatrixType& m) { using std::abs; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; Index rows = m.rows(); Index cols = m.cols(); Index r = internal::random(0, rows-1), c = internal::random(0, cols-1); MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols), m3(rows, cols); VERIFY(((m1.array() + Scalar(1)) > m1.array()).all()); VERIFY(((m1.array() - Scalar(1)) < m1.array()).all()); if (rows*cols>1) { m3 = m1; m3(r,c) += 1; VERIFY(! (m1.array() < m3.array()).all() ); VERIFY(! (m1.array() > m3.array()).all() ); } // comparisons to scalar VERIFY( (m1.array() != (m1(r,c)+1) ).any() ); VERIFY( (m1.array() > (m1(r,c)-1) ).any() ); VERIFY( (m1.array() < (m1(r,c)+1) ).any() ); VERIFY( (m1.array() == m1(r,c) ).any() ); VERIFY( m1.cwiseEqual(m1(r,c)).any() ); // test Select VERIFY_IS_APPROX( (m1.array()m2.array()).select(m1,m2), m1.cwiseMax(m2) ); Scalar mid = (m1.cwiseAbs().minCoeff() + m1.cwiseAbs().maxCoeff())/Scalar(2); for (int j=0; j=MatrixType::Constant(rows,cols,mid).array()) .select(m1,0), m3); // even shorter version: VERIFY_IS_APPROX( (m1.array().abs()RealScalar(0.1)).count() == rows*cols); // and/or VERIFY( ((m1.array()RealScalar(0)).matrix()).count() == 0); VERIFY( ((m1.array()=RealScalar(0)).matrix()).count() == rows*cols); RealScalar a = m1.cwiseAbs().mean(); VERIFY( ((m1.array()<-a).matrix() || (m1.array()>a).matrix()).count() == (m1.cwiseAbs().array()>a).count()); typedef Matrix VectorOfIndices; // TODO allows colwise/rowwise for array VERIFY_IS_APPROX(((m1.array().abs()+1)>RealScalar(0.1)).matrix().colwise().count(), VectorOfIndices::Constant(cols,rows).transpose()); VERIFY_IS_APPROX(((m1.array().abs()+1)>RealScalar(0.1)).matrix().rowwise().count(), VectorOfIndices::Constant(rows, cols)); } template void lpNorm(const VectorType& v) { using std::sqrt; typedef typename VectorType::RealScalar RealScalar; VectorType u = VectorType::Random(v.size()); if(v.size()==0) { VERIFY_IS_APPROX(u.template lpNorm(), RealScalar(0)); VERIFY_IS_APPROX(u.template lpNorm<1>(), RealScalar(0)); VERIFY_IS_APPROX(u.template lpNorm<2>(), RealScalar(0)); VERIFY_IS_APPROX(u.template lpNorm<5>(), RealScalar(0)); } else { VERIFY_IS_APPROX(u.template lpNorm(), u.cwiseAbs().maxCoeff()); } VERIFY_IS_APPROX(u.template lpNorm<1>(), u.cwiseAbs().sum()); VERIFY_IS_APPROX(u.template lpNorm<2>(), sqrt(u.array().abs().square().sum())); VERIFY_IS_APPROX(numext::pow(u.template lpNorm<5>(), typename VectorType::RealScalar(5)), u.array().abs().pow(5).sum()); } template void cwise_min_max(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; Index rows = m.rows(); Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols); // min/max with array Scalar maxM1 = m1.maxCoeff(); Scalar minM1 = m1.minCoeff(); VERIFY_IS_APPROX(MatrixType::Constant(rows,cols, minM1), m1.cwiseMin(MatrixType::Constant(rows,cols, minM1))); VERIFY_IS_APPROX(m1, m1.cwiseMin(MatrixType::Constant(rows,cols, maxM1))); VERIFY_IS_APPROX(MatrixType::Constant(rows,cols, maxM1), m1.cwiseMax(MatrixType::Constant(rows,cols, maxM1))); VERIFY_IS_APPROX(m1, m1.cwiseMax(MatrixType::Constant(rows,cols, minM1))); // min/max with scalar input VERIFY_IS_APPROX(MatrixType::Constant(rows,cols, minM1), m1.cwiseMin( minM1)); VERIFY_IS_APPROX(m1, m1.cwiseMin(maxM1)); VERIFY_IS_APPROX(-m1, (-m1).cwiseMin(-minM1)); VERIFY_IS_APPROX(-m1.array(), ((-m1).array().min)( -minM1)); VERIFY_IS_APPROX(MatrixType::Constant(rows,cols, maxM1), m1.cwiseMax( maxM1)); VERIFY_IS_APPROX(m1, m1.cwiseMax(minM1)); VERIFY_IS_APPROX(-m1, (-m1).cwiseMax(-maxM1)); VERIFY_IS_APPROX(-m1.array(), ((-m1).array().max)(-maxM1)); VERIFY_IS_APPROX(MatrixType::Constant(rows,cols, minM1).array(), (m1.array().min)( minM1)); VERIFY_IS_APPROX(m1.array(), (m1.array().min)( maxM1)); VERIFY_IS_APPROX(MatrixType::Constant(rows,cols, maxM1).array(), (m1.array().max)( maxM1)); VERIFY_IS_APPROX(m1.array(), (m1.array().max)( minM1)); } template void resize(const MatrixTraits& t) { typedef typename MatrixTraits::Scalar Scalar; typedef Matrix MatrixType; typedef Array Array2DType; typedef Matrix VectorType; typedef Array Array1DType; Index rows = t.rows(), cols = t.cols(); MatrixType m(rows,cols); VectorType v(rows); Array2DType a2(rows,cols); Array1DType a1(rows); m.array().resize(rows+1,cols+1); VERIFY(m.rows()==rows+1 && m.cols()==cols+1); a2.matrix().resize(rows+1,cols+1); VERIFY(a2.rows()==rows+1 && a2.cols()==cols+1); v.array().resize(cols); VERIFY(v.size()==cols); a1.matrix().resize(cols); VERIFY(a1.size()==cols); } template void regression_bug_654() { ArrayXf a = RowVectorXf(3); VectorXf v = Array(3); } // Check propagation of LvalueBit through Array/Matrix-Wrapper template void regrrssion_bug_1410() { const Matrix4i M; const Array4i A; ArrayWrapper MA = M.array(); MA.row(0); MatrixWrapper AM = A.matrix(); AM.row(0); VERIFY((internal::traits >::Flags&LvalueBit)==0); VERIFY((internal::traits >::Flags&LvalueBit)==0); VERIFY((internal::traits >::Flags&LvalueBit)==LvalueBit); VERIFY((internal::traits >::Flags&LvalueBit)==LvalueBit); } EIGEN_DECLARE_TEST(array_for_matrix) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( array_for_matrix(Matrix()) ); CALL_SUBTEST_2( array_for_matrix(Matrix2f()) ); CALL_SUBTEST_3( array_for_matrix(Matrix4d()) ); CALL_SUBTEST_4( array_for_matrix(MatrixXcf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_5( array_for_matrix(MatrixXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_6( array_for_matrix(MatrixXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); } for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( comparisons(Matrix()) ); CALL_SUBTEST_2( comparisons(Matrix2f()) ); CALL_SUBTEST_3( comparisons(Matrix4d()) ); CALL_SUBTEST_5( comparisons(MatrixXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_6( comparisons(MatrixXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); } for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( cwise_min_max(Matrix()) ); CALL_SUBTEST_2( cwise_min_max(Matrix2f()) ); CALL_SUBTEST_3( cwise_min_max(Matrix4d()) ); CALL_SUBTEST_5( cwise_min_max(MatrixXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_6( cwise_min_max(MatrixXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); } for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( lpNorm(Matrix()) ); CALL_SUBTEST_2( lpNorm(Vector2f()) ); CALL_SUBTEST_7( lpNorm(Vector3d()) ); CALL_SUBTEST_8( lpNorm(Vector4f()) ); CALL_SUBTEST_5( lpNorm(VectorXf(internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_4( lpNorm(VectorXcf(internal::random(1,EIGEN_TEST_MAX_SIZE))) ); } CALL_SUBTEST_5( lpNorm(VectorXf(0)) ); CALL_SUBTEST_4( lpNorm(VectorXcf(0)) ); for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_4( resize(MatrixXcf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_5( resize(MatrixXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_6( resize(MatrixXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); } CALL_SUBTEST_6( regression_bug_654<0>() ); CALL_SUBTEST_6( regrrssion_bug_1410<0>() ); } ================================================ FILE: VO_Module/thirdparty/eigen/test/array_of_string.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2016 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" EIGEN_DECLARE_TEST(array_of_string) { typedef Array ArrayXs; ArrayXs a1(3), a2(3), a3(3), a3ref(3); a1 << "one", "two", "three"; a2 << "1", "2", "3"; a3ref << "one (1)", "two (2)", "three (3)"; std::stringstream s1; s1 << a1; VERIFY_IS_EQUAL(s1.str(), std::string(" one two three")); a3 = a1 + std::string(" (") + a2 + std::string(")"); VERIFY((a3==a3ref).all()); a3 = a1; a3 += std::string(" (") + a2 + std::string(")"); VERIFY((a3==a3ref).all()); a1.swap(a3); VERIFY((a1==a3ref).all()); VERIFY((a3!=a3ref).all()); } ================================================ FILE: VO_Module/thirdparty/eigen/test/array_replicate.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" template void replicate(const MatrixType& m) { /* this test covers the following files: Replicate.cpp */ typedef typename MatrixType::Scalar Scalar; typedef Matrix VectorType; typedef Matrix MatrixX; typedef Matrix VectorX; Index rows = m.rows(); Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols); VectorType v1 = VectorType::Random(rows); MatrixX x1, x2; VectorX vx1; int f1 = internal::random(1,10), f2 = internal::random(1,10); x1.resize(rows*f1,cols*f2); for(int j=0; j())); x2.resize(rows,3*cols); x2 << m2, m2, m2; VERIFY_IS_APPROX(x2, (m2.template replicate<1,3>())); vx1.resize(3*rows,cols); vx1 << m2, m2, m2; VERIFY_IS_APPROX(vx1+vx1, vx1+(m2.template replicate<3,1>())); vx1=m2+(m2.colwise().replicate(1)); if(m2.cols()==1) VERIFY_IS_APPROX(m2.coeff(0), (m2.template replicate<3,1>().coeff(m2.rows()))); x2.resize(rows,f1); for (int j=0; j()) ); CALL_SUBTEST_2( replicate(Vector2f()) ); CALL_SUBTEST_3( replicate(Vector3d()) ); CALL_SUBTEST_4( replicate(Vector4f()) ); CALL_SUBTEST_5( replicate(VectorXf(16)) ); CALL_SUBTEST_6( replicate(VectorXcd(10)) ); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/array_reverse.cpp ================================================ // 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 // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include using namespace std; template void reverse(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; typedef Matrix VectorType; Index rows = m.rows(); Index cols = m.cols(); // this test relies a lot on Random.h, and there's not much more that we can do // to test it, hence I consider that we will have tested Random.h MatrixType m1 = MatrixType::Random(rows, cols), m2; VectorType v1 = VectorType::Random(rows); MatrixType m1_r = m1.reverse(); // Verify that MatrixBase::reverse() works for ( int i = 0; i < rows; i++ ) { for ( int j = 0; j < cols; j++ ) { VERIFY_IS_APPROX(m1_r(i, j), m1(rows - 1 - i, cols - 1 - j)); } } Reverse m1_rd(m1); // Verify that a Reverse default (in both directions) of an expression works for ( int i = 0; i < rows; i++ ) { for ( int j = 0; j < cols; j++ ) { VERIFY_IS_APPROX(m1_rd(i, j), m1(rows - 1 - i, cols - 1 - j)); } } Reverse m1_rb(m1); // Verify that a Reverse in both directions of an expression works for ( int i = 0; i < rows; i++ ) { for ( int j = 0; j < cols; j++ ) { VERIFY_IS_APPROX(m1_rb(i, j), m1(rows - 1 - i, cols - 1 - j)); } } Reverse m1_rv(m1); // Verify that a Reverse in the vertical directions of an expression works for ( int i = 0; i < rows; i++ ) { for ( int j = 0; j < cols; j++ ) { VERIFY_IS_APPROX(m1_rv(i, j), m1(rows - 1 - i, j)); } } Reverse m1_rh(m1); // Verify that a Reverse in the horizontal directions of an expression works for ( int i = 0; i < rows; i++ ) { for ( int j = 0; j < cols; j++ ) { VERIFY_IS_APPROX(m1_rh(i, j), m1(i, cols - 1 - j)); } } VectorType v1_r = v1.reverse(); // Verify that a VectorType::reverse() of an expression works for ( int i = 0; i < rows; i++ ) { VERIFY_IS_APPROX(v1_r(i), v1(rows - 1 - i)); } MatrixType m1_cr = m1.colwise().reverse(); // Verify that PartialRedux::reverse() works (for colwise()) for ( int i = 0; i < rows; i++ ) { for ( int j = 0; j < cols; j++ ) { VERIFY_IS_APPROX(m1_cr(i, j), m1(rows - 1 - i, j)); } } MatrixType m1_rr = m1.rowwise().reverse(); // Verify that PartialRedux::reverse() works (for rowwise()) for ( int i = 0; i < rows; i++ ) { for ( int j = 0; j < cols; j++ ) { VERIFY_IS_APPROX(m1_rr(i, j), m1(i, cols - 1 - j)); } } Scalar x = internal::random(); Index r = internal::random(0, rows-1), c = internal::random(0, cols-1); m1.reverse()(r, c) = x; VERIFY_IS_APPROX(x, m1(rows - 1 - r, cols - 1 - c)); m2 = m1; m2.reverseInPlace(); VERIFY_IS_APPROX(m2,m1.reverse().eval()); m2 = m1; m2.col(0).reverseInPlace(); VERIFY_IS_APPROX(m2.col(0),m1.col(0).reverse().eval()); m2 = m1; m2.row(0).reverseInPlace(); VERIFY_IS_APPROX(m2.row(0),m1.row(0).reverse().eval()); m2 = m1; m2.rowwise().reverseInPlace(); VERIFY_IS_APPROX(m2,m1.rowwise().reverse().eval()); m2 = m1; m2.colwise().reverseInPlace(); VERIFY_IS_APPROX(m2,m1.colwise().reverse().eval()); m1.colwise().reverse()(r, c) = x; VERIFY_IS_APPROX(x, m1(rows - 1 - r, c)); m1.rowwise().reverse()(r, c) = x; VERIFY_IS_APPROX(x, m1(r, cols - 1 - c)); } template void array_reverse_extra() { Vector4f x; x << 1, 2, 3, 4; Vector4f y; y << 4, 3, 2, 1; VERIFY(x.reverse()[1] == 3); VERIFY(x.reverse() == y); } // Simpler version of reverseInPlace leveraging a bug // in clang 6/7 with -O2 and AVX or AVX512 enabled. // This simpler version ensure that the clang bug is not simply hidden // through mis-inlining of reverseInPlace or other minor changes. template EIGEN_DONT_INLINE void bug1684_job1(MatrixType& m1, MatrixType& m2) { m2 = m1; m2.col(0).swap(m2.col(3)); m2.col(1).swap(m2.col(2)); } template EIGEN_DONT_INLINE void bug1684_job2(MatrixType& m1, MatrixType& m2) { m2 = m1; // load m1/m2 in AVX registers m1.col(0) = m2.col(3); // perform 128 bits moves m1.col(1) = m2.col(2); m1.col(2) = m2.col(1); m1.col(3) = m2.col(0); } template EIGEN_DONT_INLINE void bug1684_job3(MatrixType& m1, MatrixType& m2) { m2 = m1; Vector4f tmp; tmp = m2.col(0); m2.col(0) = m2.col(3); m2.col(3) = tmp; tmp = m2.col(1); m2.col(1) = m2.col(2); m2.col(2) = tmp; } template void bug1684() { Matrix4f m1 = Matrix4f::Random(); Matrix4f m2 = Matrix4f::Random(); bug1684_job1(m1,m2); VERIFY_IS_APPROX(m2, m1.rowwise().reverse().eval()); bug1684_job2(m1,m2); VERIFY_IS_APPROX(m2, m1.rowwise().reverse().eval()); // This one still fail after our swap's workaround, // but I expect users not to implement their own swap. // bug1684_job3(m1,m2); // VERIFY_IS_APPROX(m2, m1.rowwise().reverse().eval()); } EIGEN_DECLARE_TEST(array_reverse) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( reverse(Matrix()) ); CALL_SUBTEST_2( reverse(Matrix2f()) ); CALL_SUBTEST_3( reverse(Matrix4f()) ); CALL_SUBTEST_4( reverse(Matrix4d()) ); CALL_SUBTEST_5( reverse(MatrixXcf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_6( reverse(MatrixXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_7( reverse(MatrixXcd(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_8( reverse(Matrix()) ); CALL_SUBTEST_9( reverse(Matrix(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_3( bug1684<0>() ); } CALL_SUBTEST_3( array_reverse_extra<0>() ); } ================================================ FILE: VO_Module/thirdparty/eigen/test/bandmatrix.cpp ================================================ // This file is triangularView of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2009 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" template void bandmatrix(const MatrixType& _m) { typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef Matrix DenseMatrixType; Index rows = _m.rows(); Index cols = _m.cols(); Index supers = _m.supers(); Index subs = _m.subs(); MatrixType m(rows,cols,supers,subs); DenseMatrixType dm1(rows,cols); dm1.setZero(); m.diagonal().setConstant(123); dm1.diagonal().setConstant(123); for (int i=1; i<=m.supers();++i) { m.diagonal(i).setConstant(static_cast(i)); dm1.diagonal(i).setConstant(static_cast(i)); } for (int i=1; i<=m.subs();++i) { m.diagonal(-i).setConstant(-static_cast(i)); dm1.diagonal(-i).setConstant(-static_cast(i)); } //std::cerr << m.m_data << "\n\n" << m.toDense() << "\n\n" << dm1 << "\n\n\n\n"; VERIFY_IS_APPROX(dm1,m.toDenseMatrix()); for (int i=0; i(i+1)); dm1.col(i).setConstant(static_cast(i+1)); } Index d = (std::min)(rows,cols); Index a = std::max(0,cols-d-supers); Index b = std::max(0,rows-d-subs); if(a>0) dm1.block(0,d+supers,rows,a).setZero(); dm1.block(0,supers+1,cols-supers-1-a,cols-supers-1-a).template triangularView().setZero(); dm1.block(subs+1,0,rows-subs-1-b,rows-subs-1-b).template triangularView().setZero(); if(b>0) dm1.block(d+subs,0,b,cols).setZero(); //std::cerr << m.m_data << "\n\n" << m.toDense() << "\n\n" << dm1 << "\n\n"; VERIFY_IS_APPROX(dm1,m.toDenseMatrix()); } using Eigen::internal::BandMatrix; EIGEN_DECLARE_TEST(bandmatrix) { for(int i = 0; i < 10*g_repeat ; i++) { Index rows = internal::random(1,10); Index cols = internal::random(1,10); Index sups = internal::random(0,cols-1); Index subs = internal::random(0,rows-1); CALL_SUBTEST(bandmatrix(BandMatrix(rows,cols,sups,subs)) ); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/basicstuff.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2006-2008 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #define EIGEN_NO_STATIC_ASSERT #include "main.h" #include "random_without_cast_overflow.h" template void basicStuff(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; typedef Matrix VectorType; typedef Matrix SquareMatrixType; Index rows = m.rows(); Index cols = m.cols(); // this test relies a lot on Random.h, and there's not much more that we can do // to test it, hence I consider that we will have tested Random.h MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols), m3(rows, cols), mzero = MatrixType::Zero(rows, cols), square = Matrix::Random(rows, rows); VectorType v1 = VectorType::Random(rows), vzero = VectorType::Zero(rows); SquareMatrixType sm1 = SquareMatrixType::Random(rows,rows), sm2(rows,rows); Scalar x = 0; while(x == Scalar(0)) x = internal::random(); Index r = internal::random(0, rows-1), c = internal::random(0, cols-1); m1.coeffRef(r,c) = x; VERIFY_IS_APPROX(x, m1.coeff(r,c)); m1(r,c) = x; VERIFY_IS_APPROX(x, m1(r,c)); v1.coeffRef(r) = x; VERIFY_IS_APPROX(x, v1.coeff(r)); v1(r) = x; VERIFY_IS_APPROX(x, v1(r)); v1[r] = x; VERIFY_IS_APPROX(x, v1[r]); // test fetching with various index types. Index r1 = internal::random(0, numext::mini(Index(127),rows-1)); x = v1(static_cast(r1)); x = v1(static_cast(r1)); x = v1(static_cast(r1)); x = v1(static_cast(r1)); x = v1(static_cast(r1)); x = v1(static_cast(r1)); x = v1(static_cast(r1)); x = v1(static_cast(r1)); x = v1(static_cast(r1)); #if EIGEN_HAS_CXX11 x = v1(static_cast(r1)); x = v1(static_cast(r1)); #endif VERIFY_IS_APPROX( v1, v1); VERIFY_IS_NOT_APPROX( v1, 2*v1); VERIFY_IS_MUCH_SMALLER_THAN( vzero, v1); VERIFY_IS_MUCH_SMALLER_THAN( vzero, v1.squaredNorm()); VERIFY_IS_NOT_MUCH_SMALLER_THAN(v1, v1); VERIFY_IS_APPROX( vzero, v1-v1); VERIFY_IS_APPROX( m1, m1); VERIFY_IS_NOT_APPROX( m1, 2*m1); VERIFY_IS_MUCH_SMALLER_THAN( mzero, m1); VERIFY_IS_NOT_MUCH_SMALLER_THAN(m1, m1); VERIFY_IS_APPROX( mzero, m1-m1); // always test operator() on each read-only expression class, // in order to check const-qualifiers. // indeed, if an expression class (here Zero) is meant to be read-only, // hence has no _write() method, the corresponding MatrixBase method (here zero()) // should return a const-qualified object so that it is the const-qualified // operator() that gets called, which in turn calls _read(). VERIFY_IS_MUCH_SMALLER_THAN(MatrixType::Zero(rows,cols)(r,c), static_cast(1)); // now test copying a row-vector into a (column-)vector and conversely. square.col(r) = square.row(r).eval(); Matrix rv(rows); Matrix cv(rows); rv = square.row(r); cv = square.col(r); VERIFY_IS_APPROX(rv, cv.transpose()); if(cols!=1 && rows!=1 && MatrixType::SizeAtCompileTime!=Dynamic) { VERIFY_RAISES_ASSERT(m1 = (m2.block(0,0, rows-1, cols-1))); } if(cols!=1 && rows!=1) { VERIFY_RAISES_ASSERT(m1[0]); VERIFY_RAISES_ASSERT((m1+m1)[0]); } VERIFY_IS_APPROX(m3 = m1,m1); MatrixType m4; VERIFY_IS_APPROX(m4 = m1,m1); m3.real() = m1.real(); VERIFY_IS_APPROX(static_cast(m3).real(), static_cast(m1).real()); VERIFY_IS_APPROX(static_cast(m3).real(), m1.real()); // check == / != operators VERIFY(m1==m1); VERIFY(m1!=m2); VERIFY(!(m1==m2)); VERIFY(!(m1!=m1)); m1 = m2; VERIFY(m1==m2); VERIFY(!(m1!=m2)); // check automatic transposition sm2.setZero(); for(Index i=0;i(0,10)>5; m3 = b ? m1 : m2; if(b) VERIFY_IS_APPROX(m3,m1); else VERIFY_IS_APPROX(m3,m2); m3 = b ? -m1 : m2; if(b) VERIFY_IS_APPROX(m3,-m1); else VERIFY_IS_APPROX(m3,m2); m3 = b ? m1 : -m2; if(b) VERIFY_IS_APPROX(m3,m1); else VERIFY_IS_APPROX(m3,-m2); } } template void basicStuffComplex(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef Matrix RealMatrixType; Index rows = m.rows(); Index cols = m.cols(); Scalar s1 = internal::random(), s2 = internal::random(); VERIFY(numext::real(s1)==numext::real_ref(s1)); VERIFY(numext::imag(s1)==numext::imag_ref(s1)); numext::real_ref(s1) = numext::real(s2); numext::imag_ref(s1) = numext::imag(s2); VERIFY(internal::isApprox(s1, s2, NumTraits::epsilon())); // extended precision in Intel FPUs means that s1 == s2 in the line above is not guaranteed. RealMatrixType rm1 = RealMatrixType::Random(rows,cols), rm2 = RealMatrixType::Random(rows,cols); MatrixType cm(rows,cols); cm.real() = rm1; cm.imag() = rm2; VERIFY_IS_APPROX(static_cast(cm).real(), rm1); VERIFY_IS_APPROX(static_cast(cm).imag(), rm2); rm1.setZero(); rm2.setZero(); rm1 = cm.real(); rm2 = cm.imag(); VERIFY_IS_APPROX(static_cast(cm).real(), rm1); VERIFY_IS_APPROX(static_cast(cm).imag(), rm2); cm.real().setZero(); VERIFY(static_cast(cm).real().isZero()); VERIFY(!static_cast(cm).imag().isZero()); } template struct casting_test { static void run() { Matrix m; for (int i=0; i::value(); } } Matrix n = m.template cast(); for (int i=0; i(m(i, j)))); } } } }; template struct casting_test_runner { static void run() { casting_test::run(); casting_test::run(); casting_test::run(); casting_test::run(); casting_test::run(); casting_test::run(); casting_test::run(); #if EIGEN_HAS_CXX11 casting_test::run(); casting_test::run(); #endif casting_test::run(); casting_test::run(); casting_test::run(); casting_test::run(); casting_test >::run(); casting_test >::run(); } }; template struct casting_test_runner::IsComplex)>::type> { static void run() { // Only a few casts from std::complex are defined. casting_test::run(); casting_test::run(); casting_test >::run(); casting_test >::run(); } }; void casting_all() { casting_test_runner::run(); casting_test_runner::run(); casting_test_runner::run(); casting_test_runner::run(); casting_test_runner::run(); casting_test_runner::run(); casting_test_runner::run(); #if EIGEN_HAS_CXX11 casting_test_runner::run(); casting_test_runner::run(); #endif casting_test_runner::run(); casting_test_runner::run(); casting_test_runner::run(); casting_test_runner::run(); casting_test_runner >::run(); casting_test_runner >::run(); } template void fixedSizeMatrixConstruction() { Scalar raw[4]; for(int k=0; k<4; ++k) raw[k] = internal::random(); { Matrix m(raw); Array a(raw); for(int k=0; k<4; ++k) VERIFY(m(k) == raw[k]); for(int k=0; k<4; ++k) VERIFY(a(k) == raw[k]); VERIFY_IS_EQUAL(m,(Matrix(raw[0],raw[1],raw[2],raw[3]))); VERIFY((a==(Array(raw[0],raw[1],raw[2],raw[3]))).all()); } { Matrix m(raw); Array a(raw); for(int k=0; k<3; ++k) VERIFY(m(k) == raw[k]); for(int k=0; k<3; ++k) VERIFY(a(k) == raw[k]); VERIFY_IS_EQUAL(m,(Matrix(raw[0],raw[1],raw[2]))); VERIFY((a==Array(raw[0],raw[1],raw[2])).all()); } { Matrix m(raw), m2( (DenseIndex(raw[0])), (DenseIndex(raw[1])) ); Array a(raw), a2( (DenseIndex(raw[0])), (DenseIndex(raw[1])) ); for(int k=0; k<2; ++k) VERIFY(m(k) == raw[k]); for(int k=0; k<2; ++k) VERIFY(a(k) == raw[k]); VERIFY_IS_EQUAL(m,(Matrix(raw[0],raw[1]))); VERIFY((a==Array(raw[0],raw[1])).all()); for(int k=0; k<2; ++k) VERIFY(m2(k) == DenseIndex(raw[k])); for(int k=0; k<2; ++k) VERIFY(a2(k) == DenseIndex(raw[k])); } { Matrix m(raw), m2( (DenseIndex(raw[0])), (DenseIndex(raw[1])) ), m3( (int(raw[0])), (int(raw[1])) ), m4( (float(raw[0])), (float(raw[1])) ); Array a(raw), a2( (DenseIndex(raw[0])), (DenseIndex(raw[1])) ); for(int k=0; k<2; ++k) VERIFY(m(k) == raw[k]); for(int k=0; k<2; ++k) VERIFY(a(k) == raw[k]); VERIFY_IS_EQUAL(m,(Matrix(raw[0],raw[1]))); VERIFY((a==Array(raw[0],raw[1])).all()); for(int k=0; k<2; ++k) VERIFY(m2(k) == DenseIndex(raw[k])); for(int k=0; k<2; ++k) VERIFY(a2(k) == DenseIndex(raw[k])); for(int k=0; k<2; ++k) VERIFY(m3(k) == int(raw[k])); for(int k=0; k<2; ++k) VERIFY((m4(k)) == Scalar(float(raw[k]))); } { Matrix m(raw), m1(raw[0]), m2( (DenseIndex(raw[0])) ), m3( (int(raw[0])) ); Array a(raw), a1(raw[0]), a2( (DenseIndex(raw[0])) ); VERIFY(m(0) == raw[0]); VERIFY(a(0) == raw[0]); VERIFY(m1(0) == raw[0]); VERIFY(a1(0) == raw[0]); VERIFY(m2(0) == DenseIndex(raw[0])); VERIFY(a2(0) == DenseIndex(raw[0])); VERIFY(m3(0) == int(raw[0])); VERIFY_IS_EQUAL(m,(Matrix(raw[0]))); VERIFY((a==Array(raw[0])).all()); } } EIGEN_DECLARE_TEST(basicstuff) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( basicStuff(Matrix()) ); CALL_SUBTEST_2( basicStuff(Matrix4d()) ); CALL_SUBTEST_3( basicStuff(MatrixXcf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_4( basicStuff(MatrixXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_5( basicStuff(MatrixXcd(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_6( basicStuff(Matrix()) ); CALL_SUBTEST_7( basicStuff(Matrix(internal::random(1,EIGEN_TEST_MAX_SIZE),internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_8( casting_all() ); CALL_SUBTEST_3( basicStuffComplex(MatrixXcf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_5( basicStuffComplex(MatrixXcd(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); } CALL_SUBTEST_1(fixedSizeMatrixConstruction()); CALL_SUBTEST_1(fixedSizeMatrixConstruction()); CALL_SUBTEST_1(fixedSizeMatrixConstruction()); CALL_SUBTEST_1(fixedSizeMatrixConstruction()); CALL_SUBTEST_1(fixedSizeMatrixConstruction()); CALL_SUBTEST_1(fixedSizeMatrixConstruction()); } ================================================ FILE: VO_Module/thirdparty/eigen/test/bdcsvd.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2013 Gauthier Brun // Copyright (C) 2013 Nicolas Carre // Copyright (C) 2013 Jean Ceccato // Copyright (C) 2013 Pierre Zoppitelli // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/ // discard stack allocation as that too bypasses malloc #define EIGEN_STACK_ALLOCATION_LIMIT 0 #define EIGEN_RUNTIME_NO_MALLOC #include "main.h" #include #include #include #define SVD_DEFAULT(M) BDCSVD #define SVD_FOR_MIN_NORM(M) BDCSVD #include "svd_common.h" // Check all variants of JacobiSVD template void bdcsvd(const MatrixType& a = MatrixType(), bool pickrandom = true) { MatrixType m; if(pickrandom) { m.resizeLike(a); svd_fill_random(m); } else m = a; CALL_SUBTEST(( svd_test_all_computation_options >(m, false) )); } template void bdcsvd_method() { enum { Size = MatrixType::RowsAtCompileTime }; typedef typename MatrixType::RealScalar RealScalar; typedef Matrix RealVecType; MatrixType m = MatrixType::Identity(); VERIFY_IS_APPROX(m.bdcSvd().singularValues(), RealVecType::Ones()); VERIFY_RAISES_ASSERT(m.bdcSvd().matrixU()); VERIFY_RAISES_ASSERT(m.bdcSvd().matrixV()); VERIFY_IS_APPROX(m.bdcSvd(ComputeFullU|ComputeFullV).solve(m), m); VERIFY_IS_APPROX(m.bdcSvd(ComputeFullU|ComputeFullV).transpose().solve(m), m); VERIFY_IS_APPROX(m.bdcSvd(ComputeFullU|ComputeFullV).adjoint().solve(m), m); } // compare the Singular values returned with Jacobi and Bdc template void compare_bdc_jacobi(const MatrixType& a = MatrixType(), unsigned int computationOptions = 0) { MatrixType m = MatrixType::Random(a.rows(), a.cols()); BDCSVD bdc_svd(m); JacobiSVD jacobi_svd(m); VERIFY_IS_APPROX(bdc_svd.singularValues(), jacobi_svd.singularValues()); if(computationOptions & ComputeFullU) VERIFY_IS_APPROX(bdc_svd.matrixU(), jacobi_svd.matrixU()); if(computationOptions & ComputeThinU) VERIFY_IS_APPROX(bdc_svd.matrixU(), jacobi_svd.matrixU()); if(computationOptions & ComputeFullV) VERIFY_IS_APPROX(bdc_svd.matrixV(), jacobi_svd.matrixV()); if(computationOptions & ComputeThinV) VERIFY_IS_APPROX(bdc_svd.matrixV(), jacobi_svd.matrixV()); } EIGEN_DECLARE_TEST(bdcsvd) { CALL_SUBTEST_3(( svd_verify_assert >(Matrix3f()) )); CALL_SUBTEST_4(( svd_verify_assert >(Matrix4d()) )); CALL_SUBTEST_7(( svd_verify_assert >(MatrixXf(10,12)) )); CALL_SUBTEST_8(( svd_verify_assert >(MatrixXcd(7,5)) )); CALL_SUBTEST_101(( svd_all_trivial_2x2(bdcsvd) )); CALL_SUBTEST_102(( svd_all_trivial_2x2(bdcsvd) )); for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_3(( bdcsvd() )); CALL_SUBTEST_4(( bdcsvd() )); CALL_SUBTEST_5(( bdcsvd >() )); int r = internal::random(1, EIGEN_TEST_MAX_SIZE/2), c = internal::random(1, EIGEN_TEST_MAX_SIZE/2); TEST_SET_BUT_UNUSED_VARIABLE(r) TEST_SET_BUT_UNUSED_VARIABLE(c) CALL_SUBTEST_6(( bdcsvd(Matrix(r,2)) )); CALL_SUBTEST_7(( bdcsvd(MatrixXf(r,c)) )); CALL_SUBTEST_7(( compare_bdc_jacobi(MatrixXf(r,c)) )); CALL_SUBTEST_10(( bdcsvd(MatrixXd(r,c)) )); CALL_SUBTEST_10(( compare_bdc_jacobi(MatrixXd(r,c)) )); CALL_SUBTEST_8(( bdcsvd(MatrixXcd(r,c)) )); CALL_SUBTEST_8(( compare_bdc_jacobi(MatrixXcd(r,c)) )); // Test on inf/nan matrix CALL_SUBTEST_7( (svd_inf_nan, MatrixXf>()) ); CALL_SUBTEST_10( (svd_inf_nan, MatrixXd>()) ); } // test matrixbase method CALL_SUBTEST_1(( bdcsvd_method() )); CALL_SUBTEST_3(( bdcsvd_method() )); // Test problem size constructors CALL_SUBTEST_7( BDCSVD(10,10) ); // Check that preallocation avoids subsequent mallocs // Disabled because not supported by BDCSVD // CALL_SUBTEST_9( svd_preallocate() ); CALL_SUBTEST_2( svd_underoverflow() ); } ================================================ FILE: VO_Module/thirdparty/eigen/test/bfloat16_float.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include #include #include #include "main.h" #include #define VERIFY_BFLOAT16_BITS_EQUAL(h, bits) \ VERIFY_IS_EQUAL((numext::bit_cast(h)), (static_cast(bits))) // Make sure it's possible to forward declare Eigen::bfloat16 namespace Eigen { struct bfloat16; } using Eigen::bfloat16; float BinaryToFloat(uint32_t sign, uint32_t exponent, uint32_t high_mantissa, uint32_t low_mantissa) { float dest; uint32_t src = (sign << 31) + (exponent << 23) + (high_mantissa << 16) + low_mantissa; memcpy(static_cast(&dest), static_cast(&src), sizeof(dest)); return dest; } template void test_roundtrip() { // Representable T round trip via bfloat16 VERIFY_IS_EQUAL((internal::cast(internal::cast(-std::numeric_limits::infinity()))), -std::numeric_limits::infinity()); VERIFY_IS_EQUAL((internal::cast(internal::cast(std::numeric_limits::infinity()))), std::numeric_limits::infinity()); VERIFY_IS_EQUAL((internal::cast(internal::cast(T(-1.0)))), T(-1.0)); VERIFY_IS_EQUAL((internal::cast(internal::cast(T(-0.5)))), T(-0.5)); VERIFY_IS_EQUAL((internal::cast(internal::cast(T(-0.0)))), T(-0.0)); VERIFY_IS_EQUAL((internal::cast(internal::cast(T(1.0)))), T(1.0)); VERIFY_IS_EQUAL((internal::cast(internal::cast(T(0.5)))), T(0.5)); VERIFY_IS_EQUAL((internal::cast(internal::cast(T(0.0)))), T(0.0)); } void test_conversion() { using Eigen::bfloat16_impl::__bfloat16_raw; // Round-trip casts VERIFY_IS_EQUAL( numext::bit_cast(numext::bit_cast(bfloat16(1.0f))), bfloat16(1.0f)); VERIFY_IS_EQUAL( numext::bit_cast(numext::bit_cast(bfloat16(0.5f))), bfloat16(0.5f)); VERIFY_IS_EQUAL( numext::bit_cast(numext::bit_cast(bfloat16(-0.33333f))), bfloat16(-0.33333f)); VERIFY_IS_EQUAL( numext::bit_cast(numext::bit_cast(bfloat16(0.0f))), bfloat16(0.0f)); // Conversion from float. VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(1.0f), 0x3f80); VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(0.5f), 0x3f00); VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(0.33333f), 0x3eab); VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(3.38e38f), 0x7f7e); VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(3.40e38f), 0x7f80); // Becomes infinity. // Verify round-to-nearest-even behavior. float val1 = static_cast(bfloat16(__bfloat16_raw(0x3c00))); float val2 = static_cast(bfloat16(__bfloat16_raw(0x3c01))); float val3 = static_cast(bfloat16(__bfloat16_raw(0x3c02))); VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(0.5f * (val1 + val2)), 0x3c00); VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(0.5f * (val2 + val3)), 0x3c02); // Conversion from int. VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(-1), 0xbf80); VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(0), 0x0000); VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(1), 0x3f80); VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(2), 0x4000); VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(3), 0x4040); VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(12), 0x4140); // Conversion from bool. VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(false), 0x0000); VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(true), 0x3f80); // Conversion to bool VERIFY_IS_EQUAL(static_cast(bfloat16(3)), true); VERIFY_IS_EQUAL(static_cast(bfloat16(0.33333f)), true); VERIFY_IS_EQUAL(bfloat16(-0.0), false); VERIFY_IS_EQUAL(static_cast(bfloat16(0.0)), false); // Explicit conversion to float. VERIFY_IS_EQUAL(static_cast(bfloat16(__bfloat16_raw(0x0000))), 0.0f); VERIFY_IS_EQUAL(static_cast(bfloat16(__bfloat16_raw(0x3f80))), 1.0f); // Implicit conversion to float VERIFY_IS_EQUAL(bfloat16(__bfloat16_raw(0x0000)), 0.0f); VERIFY_IS_EQUAL(bfloat16(__bfloat16_raw(0x3f80)), 1.0f); // Zero representations VERIFY_IS_EQUAL(bfloat16(0.0f), bfloat16(0.0f)); VERIFY_IS_EQUAL(bfloat16(-0.0f), bfloat16(0.0f)); VERIFY_IS_EQUAL(bfloat16(-0.0f), bfloat16(-0.0f)); VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(0.0f), 0x0000); VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(-0.0f), 0x8000); // Default is zero VERIFY_IS_EQUAL(static_cast(bfloat16()), 0.0f); // Representable floats round trip via bfloat16 test_roundtrip(); test_roundtrip(); test_roundtrip >(); test_roundtrip >(); // Conversion Array a; for (int i = 0; i < 100; i++) a(i) = i + 1.25; Array b = a.cast(); Array c = b.cast(); for (int i = 0; i < 100; ++i) { VERIFY_LE(numext::abs(c(i) - a(i)), a(i) / 128); } // Epsilon VERIFY_LE(1.0f, static_cast((std::numeric_limits::epsilon)() + bfloat16(1.0f))); VERIFY_IS_EQUAL(1.0f, static_cast((std::numeric_limits::epsilon)() / bfloat16(2.0f) + bfloat16(1.0f))); // Negate VERIFY_IS_EQUAL(static_cast(-bfloat16(3.0f)), -3.0f); VERIFY_IS_EQUAL(static_cast(-bfloat16(-4.5f)), 4.5f); #if !EIGEN_COMP_MSVC // Visual Studio errors out on divisions by 0 VERIFY((numext::isnan)(static_cast(bfloat16(0.0 / 0.0)))); VERIFY((numext::isinf)(static_cast(bfloat16(1.0 / 0.0)))); VERIFY((numext::isinf)(static_cast(bfloat16(-1.0 / 0.0)))); // Visual Studio errors out on divisions by 0 VERIFY((numext::isnan)(bfloat16(0.0 / 0.0))); VERIFY((numext::isinf)(bfloat16(1.0 / 0.0))); VERIFY((numext::isinf)(bfloat16(-1.0 / 0.0))); #endif // NaNs and infinities. VERIFY(!(numext::isinf)(static_cast(bfloat16(3.38e38f)))); // Largest finite number. VERIFY(!(numext::isnan)(static_cast(bfloat16(0.0f)))); VERIFY((numext::isinf)(static_cast(bfloat16(__bfloat16_raw(0xff80))))); VERIFY((numext::isnan)(static_cast(bfloat16(__bfloat16_raw(0xffc0))))); VERIFY((numext::isinf)(static_cast(bfloat16(__bfloat16_raw(0x7f80))))); VERIFY((numext::isnan)(static_cast(bfloat16(__bfloat16_raw(0x7fc0))))); // Exactly same checks as above, just directly on the bfloat16 representation. VERIFY(!(numext::isinf)(bfloat16(__bfloat16_raw(0x7bff)))); VERIFY(!(numext::isnan)(bfloat16(__bfloat16_raw(0x0000)))); VERIFY((numext::isinf)(bfloat16(__bfloat16_raw(0xff80)))); VERIFY((numext::isnan)(bfloat16(__bfloat16_raw(0xffc0)))); VERIFY((numext::isinf)(bfloat16(__bfloat16_raw(0x7f80)))); VERIFY((numext::isnan)(bfloat16(__bfloat16_raw(0x7fc0)))); VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(BinaryToFloat(0x0, 0xff, 0x40, 0x0)), 0x7fc0); VERIFY_BFLOAT16_BITS_EQUAL(bfloat16(BinaryToFloat(0x1, 0xff, 0x40, 0x0)), 0xffc0); } void test_numtraits() { std::cout << "epsilon = " << NumTraits::epsilon() << " (0x" << std::hex << numext::bit_cast(NumTraits::epsilon()) << ")" << std::endl; std::cout << "highest = " << NumTraits::highest() << " (0x" << std::hex << numext::bit_cast(NumTraits::highest()) << ")" << std::endl; std::cout << "lowest = " << NumTraits::lowest() << " (0x" << std::hex << numext::bit_cast(NumTraits::lowest()) << ")" << std::endl; std::cout << "min = " << (std::numeric_limits::min)() << " (0x" << std::hex << numext::bit_cast((std::numeric_limits::min)()) << ")" << std::endl; std::cout << "denorm min = " << (std::numeric_limits::denorm_min)() << " (0x" << std::hex << numext::bit_cast((std::numeric_limits::denorm_min)()) << ")" << std::endl; std::cout << "infinity = " << NumTraits::infinity() << " (0x" << std::hex << numext::bit_cast(NumTraits::infinity()) << ")" << std::endl; std::cout << "quiet nan = " << NumTraits::quiet_NaN() << " (0x" << std::hex << numext::bit_cast(NumTraits::quiet_NaN()) << ")" << std::endl; std::cout << "signaling nan = " << std::numeric_limits::signaling_NaN() << " (0x" << std::hex << numext::bit_cast(std::numeric_limits::signaling_NaN()) << ")" << std::endl; VERIFY(NumTraits::IsSigned); VERIFY_IS_EQUAL( numext::bit_cast(std::numeric_limits::infinity()), numext::bit_cast(bfloat16(std::numeric_limits::infinity())) ); // There is no guarantee that casting a 32-bit NaN to bfloat16 has a precise // bit pattern. We test that it is in fact a NaN, then test the signaling // bit (msb of significand is 1 for quiet, 0 for signaling). const numext::uint16_t BFLOAT16_QUIET_BIT = 0x0040; VERIFY( (numext::isnan)(std::numeric_limits::quiet_NaN()) && (numext::isnan)(bfloat16(std::numeric_limits::quiet_NaN())) && ((numext::bit_cast(std::numeric_limits::quiet_NaN()) & BFLOAT16_QUIET_BIT) > 0) && ((numext::bit_cast(bfloat16(std::numeric_limits::quiet_NaN())) & BFLOAT16_QUIET_BIT) > 0) ); // After a cast to bfloat16, a signaling NaN may become non-signaling. Thus, // we check that both are NaN, and that only the `numeric_limits` version is // signaling. VERIFY( (numext::isnan)(std::numeric_limits::signaling_NaN()) && (numext::isnan)(bfloat16(std::numeric_limits::signaling_NaN())) && ((numext::bit_cast(std::numeric_limits::signaling_NaN()) & BFLOAT16_QUIET_BIT) == 0) ); VERIFY( (std::numeric_limits::min)() > bfloat16(0.f) ); VERIFY( (std::numeric_limits::denorm_min)() > bfloat16(0.f) ); VERIFY_IS_EQUAL( (std::numeric_limits::denorm_min)()/bfloat16(2), bfloat16(0.f) ); } void test_arithmetic() { VERIFY_IS_EQUAL(static_cast(bfloat16(2) + bfloat16(2)), 4); VERIFY_IS_EQUAL(static_cast(bfloat16(2) + bfloat16(-2)), 0); VERIFY_IS_APPROX(static_cast(bfloat16(0.33333f) + bfloat16(0.66667f)), 1.0f); VERIFY_IS_EQUAL(static_cast(bfloat16(2.0f) * bfloat16(-5.5f)), -11.0f); VERIFY_IS_APPROX(static_cast(bfloat16(1.0f) / bfloat16(3.0f)), 0.3339f); VERIFY_IS_EQUAL(static_cast(-bfloat16(4096.0f)), -4096.0f); VERIFY_IS_EQUAL(static_cast(-bfloat16(-4096.0f)), 4096.0f); } void test_comparison() { VERIFY(bfloat16(1.0f) > bfloat16(0.5f)); VERIFY(bfloat16(0.5f) < bfloat16(1.0f)); VERIFY(!(bfloat16(1.0f) < bfloat16(0.5f))); VERIFY(!(bfloat16(0.5f) > bfloat16(1.0f))); VERIFY(!(bfloat16(4.0f) > bfloat16(4.0f))); VERIFY(!(bfloat16(4.0f) < bfloat16(4.0f))); VERIFY(!(bfloat16(0.0f) < bfloat16(-0.0f))); VERIFY(!(bfloat16(-0.0f) < bfloat16(0.0f))); VERIFY(!(bfloat16(0.0f) > bfloat16(-0.0f))); VERIFY(!(bfloat16(-0.0f) > bfloat16(0.0f))); VERIFY(bfloat16(0.2f) > bfloat16(-1.0f)); VERIFY(bfloat16(-1.0f) < bfloat16(0.2f)); VERIFY(bfloat16(-16.0f) < bfloat16(-15.0f)); VERIFY(bfloat16(1.0f) == bfloat16(1.0f)); VERIFY(bfloat16(1.0f) != bfloat16(2.0f)); // Comparisons with NaNs and infinities. #if !EIGEN_COMP_MSVC // Visual Studio errors out on divisions by 0 VERIFY(!(bfloat16(0.0 / 0.0) == bfloat16(0.0 / 0.0))); VERIFY(bfloat16(0.0 / 0.0) != bfloat16(0.0 / 0.0)); VERIFY(!(bfloat16(1.0) == bfloat16(0.0 / 0.0))); VERIFY(!(bfloat16(1.0) < bfloat16(0.0 / 0.0))); VERIFY(!(bfloat16(1.0) > bfloat16(0.0 / 0.0))); VERIFY(bfloat16(1.0) != bfloat16(0.0 / 0.0)); VERIFY(bfloat16(1.0) < bfloat16(1.0 / 0.0)); VERIFY(bfloat16(1.0) > bfloat16(-1.0 / 0.0)); #endif } void test_basic_functions() { VERIFY_IS_EQUAL(static_cast(numext::abs(bfloat16(3.5f))), 3.5f); VERIFY_IS_EQUAL(static_cast(abs(bfloat16(3.5f))), 3.5f); VERIFY_IS_EQUAL(static_cast(numext::abs(bfloat16(-3.5f))), 3.5f); VERIFY_IS_EQUAL(static_cast(abs(bfloat16(-3.5f))), 3.5f); VERIFY_IS_EQUAL(static_cast(numext::floor(bfloat16(3.5f))), 3.0f); VERIFY_IS_EQUAL(static_cast(floor(bfloat16(3.5f))), 3.0f); VERIFY_IS_EQUAL(static_cast(numext::floor(bfloat16(-3.5f))), -4.0f); VERIFY_IS_EQUAL(static_cast(floor(bfloat16(-3.5f))), -4.0f); VERIFY_IS_EQUAL(static_cast(numext::ceil(bfloat16(3.5f))), 4.0f); VERIFY_IS_EQUAL(static_cast(ceil(bfloat16(3.5f))), 4.0f); VERIFY_IS_EQUAL(static_cast(numext::ceil(bfloat16(-3.5f))), -3.0f); VERIFY_IS_EQUAL(static_cast(ceil(bfloat16(-3.5f))), -3.0f); VERIFY_IS_APPROX(static_cast(numext::sqrt(bfloat16(0.0f))), 0.0f); VERIFY_IS_APPROX(static_cast(sqrt(bfloat16(0.0f))), 0.0f); VERIFY_IS_APPROX(static_cast(numext::sqrt(bfloat16(4.0f))), 2.0f); VERIFY_IS_APPROX(static_cast(sqrt(bfloat16(4.0f))), 2.0f); VERIFY_IS_APPROX(static_cast(numext::pow(bfloat16(0.0f), bfloat16(1.0f))), 0.0f); VERIFY_IS_APPROX(static_cast(pow(bfloat16(0.0f), bfloat16(1.0f))), 0.0f); VERIFY_IS_APPROX(static_cast(numext::pow(bfloat16(2.0f), bfloat16(2.0f))), 4.0f); VERIFY_IS_APPROX(static_cast(pow(bfloat16(2.0f), bfloat16(2.0f))), 4.0f); VERIFY_IS_EQUAL(static_cast(numext::exp(bfloat16(0.0f))), 1.0f); VERIFY_IS_EQUAL(static_cast(exp(bfloat16(0.0f))), 1.0f); VERIFY_IS_APPROX(static_cast(numext::exp(bfloat16(EIGEN_PI))), 20.f + static_cast(EIGEN_PI)); VERIFY_IS_APPROX(static_cast(exp(bfloat16(EIGEN_PI))), 20.f + static_cast(EIGEN_PI)); VERIFY_IS_EQUAL(static_cast(numext::expm1(bfloat16(0.0f))), 0.0f); VERIFY_IS_EQUAL(static_cast(expm1(bfloat16(0.0f))), 0.0f); VERIFY_IS_APPROX(static_cast(numext::expm1(bfloat16(2.0f))), 6.375f); VERIFY_IS_APPROX(static_cast(expm1(bfloat16(2.0f))), 6.375f); VERIFY_IS_EQUAL(static_cast(numext::log(bfloat16(1.0f))), 0.0f); VERIFY_IS_EQUAL(static_cast(log(bfloat16(1.0f))), 0.0f); VERIFY_IS_APPROX(static_cast(numext::log(bfloat16(10.0f))), 2.296875f); VERIFY_IS_APPROX(static_cast(log(bfloat16(10.0f))), 2.296875f); VERIFY_IS_EQUAL(static_cast(numext::log1p(bfloat16(0.0f))), 0.0f); VERIFY_IS_EQUAL(static_cast(log1p(bfloat16(0.0f))), 0.0f); VERIFY_IS_APPROX(static_cast(numext::log1p(bfloat16(10.0f))), 2.390625f); VERIFY_IS_APPROX(static_cast(log1p(bfloat16(10.0f))), 2.390625f); } void test_trigonometric_functions() { VERIFY_IS_APPROX(numext::cos(bfloat16(0.0f)), bfloat16(cosf(0.0f))); VERIFY_IS_APPROX(cos(bfloat16(0.0f)), bfloat16(cosf(0.0f))); VERIFY_IS_APPROX(numext::cos(bfloat16(EIGEN_PI)), bfloat16(cosf(EIGEN_PI))); // VERIFY_IS_APPROX(numext::cos(bfloat16(EIGEN_PI/2)), bfloat16(cosf(EIGEN_PI/2))); // VERIFY_IS_APPROX(numext::cos(bfloat16(3*EIGEN_PI/2)), bfloat16(cosf(3*EIGEN_PI/2))); VERIFY_IS_APPROX(numext::cos(bfloat16(3.5f)), bfloat16(cosf(3.5f))); VERIFY_IS_APPROX(numext::sin(bfloat16(0.0f)), bfloat16(sinf(0.0f))); VERIFY_IS_APPROX(sin(bfloat16(0.0f)), bfloat16(sinf(0.0f))); // VERIFY_IS_APPROX(numext::sin(bfloat16(EIGEN_PI)), bfloat16(sinf(EIGEN_PI))); VERIFY_IS_APPROX(numext::sin(bfloat16(EIGEN_PI/2)), bfloat16(sinf(EIGEN_PI/2))); VERIFY_IS_APPROX(numext::sin(bfloat16(3*EIGEN_PI/2)), bfloat16(sinf(3*EIGEN_PI/2))); VERIFY_IS_APPROX(numext::sin(bfloat16(3.5f)), bfloat16(sinf(3.5f))); VERIFY_IS_APPROX(numext::tan(bfloat16(0.0f)), bfloat16(tanf(0.0f))); VERIFY_IS_APPROX(tan(bfloat16(0.0f)), bfloat16(tanf(0.0f))); // VERIFY_IS_APPROX(numext::tan(bfloat16(EIGEN_PI)), bfloat16(tanf(EIGEN_PI))); // VERIFY_IS_APPROX(numext::tan(bfloat16(EIGEN_PI/2)), bfloat16(tanf(EIGEN_PI/2))); // VERIFY_IS_APPROX(numext::tan(bfloat16(3*EIGEN_PI/2)), bfloat16(tanf(3*EIGEN_PI/2))); VERIFY_IS_APPROX(numext::tan(bfloat16(3.5f)), bfloat16(tanf(3.5f))); } void test_array() { typedef Array ArrayXh; Index size = internal::random(1,10); Index i = internal::random(0,size-1); ArrayXh a1 = ArrayXh::Random(size), a2 = ArrayXh::Random(size); VERIFY_IS_APPROX( a1+a1, bfloat16(2)*a1 ); VERIFY( (a1.abs() >= bfloat16(0)).all() ); VERIFY_IS_APPROX( (a1*a1).sqrt(), a1.abs() ); VERIFY( ((a1.min)(a2) <= (a1.max)(a2)).all() ); a1(i) = bfloat16(-10.); VERIFY_IS_EQUAL( a1.minCoeff(), bfloat16(-10.) ); a1(i) = bfloat16(10.); VERIFY_IS_EQUAL( a1.maxCoeff(), bfloat16(10.) ); std::stringstream ss; ss << a1; } void test_product() { typedef Matrix MatrixXh; Index rows = internal::random(1,EIGEN_TEST_MAX_SIZE); Index cols = internal::random(1,EIGEN_TEST_MAX_SIZE); Index depth = internal::random(1,EIGEN_TEST_MAX_SIZE); MatrixXh Ah = MatrixXh::Random(rows,depth); MatrixXh Bh = MatrixXh::Random(depth,cols); MatrixXh Ch = MatrixXh::Random(rows,cols); MatrixXf Af = Ah.cast(); MatrixXf Bf = Bh.cast(); MatrixXf Cf = Ch.cast(); VERIFY_IS_APPROX(Ch.noalias()+=Ah*Bh, (Cf.noalias()+=Af*Bf).cast()); } EIGEN_DECLARE_TEST(bfloat16_float) { CALL_SUBTEST(test_numtraits()); for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST(test_conversion()); CALL_SUBTEST(test_arithmetic()); CALL_SUBTEST(test_comparison()); CALL_SUBTEST(test_basic_functions()); CALL_SUBTEST(test_trigonometric_functions()); CALL_SUBTEST(test_array()); CALL_SUBTEST(test_product()); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/bicgstab.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2011 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "sparse_solver.h" #include template void test_bicgstab_T() { BiCGSTAB, DiagonalPreconditioner > bicgstab_colmajor_diag; BiCGSTAB, IdentityPreconditioner > bicgstab_colmajor_I; BiCGSTAB, IncompleteLUT > bicgstab_colmajor_ilut; //BiCGSTAB, SSORPreconditioner > bicgstab_colmajor_ssor; bicgstab_colmajor_diag.setTolerance(NumTraits::epsilon()*4); bicgstab_colmajor_ilut.setTolerance(NumTraits::epsilon()*4); CALL_SUBTEST( check_sparse_square_solving(bicgstab_colmajor_diag) ); // CALL_SUBTEST( check_sparse_square_solving(bicgstab_colmajor_I) ); CALL_SUBTEST( check_sparse_square_solving(bicgstab_colmajor_ilut) ); //CALL_SUBTEST( check_sparse_square_solving(bicgstab_colmajor_ssor) ); } EIGEN_DECLARE_TEST(bicgstab) { CALL_SUBTEST_1((test_bicgstab_T()) ); CALL_SUBTEST_2((test_bicgstab_T, int>())); CALL_SUBTEST_3((test_bicgstab_T())); } ================================================ FILE: VO_Module/thirdparty/eigen/test/blasutil.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2020 Everton Constantino // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/ #include "main.h" // Disable "ignoring attributes on template argument" // for packet_traits // => The only workaround would be to wrap _m128 and the likes // within wrappers. #if EIGEN_GNUC_AT_LEAST(6,0) #pragma GCC diagnostic ignored "-Wignored-attributes" #endif #define GET(i,j) (StorageOrder == RowMajor ? (i)*stride + (j) : (i) + (j)*stride) #define SCATTER(i,j,k) (StorageOrder == RowMajor ? ((i)+(k))*stride + (j) : (i) + ((j)+(k))*stride) template void compare(const Packet& a, const Packet& b) { int pktsz = internal::packet_traits::size; Scalar *buffA = new Scalar[pktsz]; Scalar *buffB = new Scalar[pktsz]; internal::pstoreu(buffA, a); internal::pstoreu(buffB, b); for(int i = 0; i < pktsz; i++) { VERIFY_IS_EQUAL(buffA[i], buffB[i]); } delete[] buffA; delete[] buffB; } template struct PacketBlockSet { typedef typename internal::packet_traits::type Packet; void setPacketBlock(internal::PacketBlock& block, Scalar value) { for(int idx = 0; idx < n; idx++) { block.packet[idx] = internal::pset1(value); } } void comparePacketBlock(Scalar *data, int i, int j, int stride, internal::PacketBlock& block) { for(int idx = 0; idx < n; idx++) { Packet line = internal::ploadu(data + SCATTER(i,j,idx)); compare(block.packet[idx], line); } } }; template void run_bdmp_spec_1() { typedef internal::blas_data_mapper BlasDataMapper; int packetSize = internal::packet_traits::size; int minSize = std::max(packetSize, BlockSize); typedef typename internal::packet_traits::type Packet; int szm = internal::random(minSize,500), szn = internal::random(minSize,500); int stride = StorageOrder == RowMajor ? szn : szm; Scalar *d = new Scalar[szn*szm]; // Initializing with random entries for(int i = 0; i < szm*szn; i++) { d[i] = internal::random(static_cast(3), static_cast(10)); } BlasDataMapper bdm(d, stride); // Testing operator() for(int i = 0; i < szm; i++) { for(int j = 0; j < szn; j++) { VERIFY_IS_EQUAL(d[GET(i,j)], bdm(i,j)); } } // Testing getSubMapper and getLinearMapper int i0 = internal::random(0,szm-2); int j0 = internal::random(0,szn-2); for(int i = i0; i < szm; i++) { for(int j = j0; j < szn; j++) { const BlasDataMapper& bdmSM = bdm.getSubMapper(i0,j0); const internal::BlasLinearMapper& bdmLM = bdm.getLinearMapper(i0,j0); Scalar v = bdmSM(i - i0, j - j0); Scalar vd = d[GET(i,j)]; VERIFY_IS_EQUAL(vd, v); VERIFY_IS_EQUAL(vd, bdmLM(GET(i-i0, j-j0))); } } // Testing loadPacket for(int i = 0; i < szm - minSize; i++) { for(int j = 0; j < szn - minSize; j++) { Packet pktBDM = bdm.template loadPacket(i,j); Packet pktD = internal::ploadu(d + GET(i,j)); compare(pktBDM, pktD); } } // Testing gatherPacket Scalar *buff = new Scalar[packetSize]; for(int i = 0; i < szm - minSize; i++) { for(int j = 0; j < szn - minSize; j++) { Packet p = bdm.template gatherPacket(i,j); internal::pstoreu(buff, p); for(int k = 0; k < packetSize; k++) { VERIFY_IS_EQUAL(d[SCATTER(i,j,k)], buff[k]); } } } delete[] buff; // Testing scatterPacket for(int i = 0; i < szm - minSize; i++) { for(int j = 0; j < szn - minSize; j++) { Packet p = internal::pset1(static_cast(1)); bdm.template scatterPacket(i,j,p); for(int k = 0; k < packetSize; k++) { VERIFY_IS_EQUAL(d[SCATTER(i,j,k)], static_cast(1)); } } } //Testing storePacketBlock internal::PacketBlock block; PacketBlockSet pbs; pbs.setPacketBlock(block, static_cast(2)); for(int i = 0; i < szm - minSize; i++) { for(int j = 0; j < szn - minSize; j++) { bdm.template storePacketBlock(i, j, block); pbs.comparePacketBlock(d, i, j, stride, block); } } delete[] d; } template void run_test() { run_bdmp_spec_1(); run_bdmp_spec_1(); run_bdmp_spec_1(); run_bdmp_spec_1(); run_bdmp_spec_1(); run_bdmp_spec_1(); run_bdmp_spec_1(); run_bdmp_spec_1(); run_bdmp_spec_1(); run_bdmp_spec_1(); } EIGEN_DECLARE_TEST(blasutil) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1(run_test()); CALL_SUBTEST_2(run_test()); CALL_SUBTEST_3(run_test()); // TODO: Replace this by a call to numext::int64_t as soon as we have a way to // detect the typedef for int64_t on all platforms #if EIGEN_HAS_CXX11 CALL_SUBTEST_4(run_test()); #else CALL_SUBTEST_4(run_test()); #endif CALL_SUBTEST_5(run_test()); CALL_SUBTEST_6(run_test()); CALL_SUBTEST_7(run_test >()); CALL_SUBTEST_8(run_test >()); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/block.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2006-2010 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #define EIGEN_NO_STATIC_ASSERT // otherwise we fail at compile time on unused paths #include "main.h" template typename Eigen::internal::enable_if::IsComplex,typename MatrixType::Scalar>::type block_real_only(const MatrixType &m1, Index r1, Index r2, Index c1, Index c2, const Scalar& s1) { // check cwise-Functions: VERIFY_IS_APPROX(m1.row(r1).cwiseMax(s1), m1.cwiseMax(s1).row(r1)); VERIFY_IS_APPROX(m1.col(c1).cwiseMin(s1), m1.cwiseMin(s1).col(c1)); VERIFY_IS_APPROX(m1.block(r1,c1,r2-r1+1,c2-c1+1).cwiseMin(s1), m1.cwiseMin(s1).block(r1,c1,r2-r1+1,c2-c1+1)); VERIFY_IS_APPROX(m1.block(r1,c1,r2-r1+1,c2-c1+1).cwiseMax(s1), m1.cwiseMax(s1).block(r1,c1,r2-r1+1,c2-c1+1)); return Scalar(0); } template typename Eigen::internal::enable_if::IsComplex,typename MatrixType::Scalar>::type block_real_only(const MatrixType &, Index, Index, Index, Index, const Scalar&) { return Scalar(0); } // Check at compile-time that T1==T2, and at runtime-time that a==b template typename internal::enable_if::value,bool>::type is_same_block(const T1& a, const T2& b) { return a.isApprox(b); } template void block(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef Matrix VectorType; typedef Matrix RowVectorType; typedef Matrix DynamicMatrixType; typedef Matrix DynamicVectorType; Index rows = m.rows(); Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols), m1_copy = m1, m2 = MatrixType::Random(rows, cols), m3(rows, cols), ones = MatrixType::Ones(rows, cols); VectorType v1 = VectorType::Random(rows); Scalar s1 = internal::random(); Index r1 = internal::random(0,rows-1); Index r2 = internal::random(r1,rows-1); Index c1 = internal::random(0,cols-1); Index c2 = internal::random(c1,cols-1); block_real_only(m1, r1, r2, c1, c1, s1); //check row() and col() VERIFY_IS_EQUAL(m1.col(c1).transpose(), m1.transpose().row(c1)); //check operator(), both constant and non-constant, on row() and col() m1 = m1_copy; m1.row(r1) += s1 * m1_copy.row(r2); VERIFY_IS_APPROX(m1.row(r1), m1_copy.row(r1) + s1 * m1_copy.row(r2)); // check nested block xpr on lhs m1.row(r1).row(0) += s1 * m1_copy.row(r2); VERIFY_IS_APPROX(m1.row(r1), m1_copy.row(r1) + Scalar(2) * s1 * m1_copy.row(r2)); m1 = m1_copy; m1.col(c1) += s1 * m1_copy.col(c2); VERIFY_IS_APPROX(m1.col(c1), m1_copy.col(c1) + s1 * m1_copy.col(c2)); m1.col(c1).col(0) += s1 * m1_copy.col(c2); VERIFY_IS_APPROX(m1.col(c1), m1_copy.col(c1) + Scalar(2) * s1 * m1_copy.col(c2)); //check block() Matrix b1(1,1); b1(0,0) = m1(r1,c1); RowVectorType br1(m1.block(r1,0,1,cols)); VectorType bc1(m1.block(0,c1,rows,1)); VERIFY_IS_EQUAL(b1, m1.block(r1,c1,1,1)); VERIFY_IS_EQUAL(m1.row(r1), br1); VERIFY_IS_EQUAL(m1.col(c1), bc1); //check operator(), both constant and non-constant, on block() m1.block(r1,c1,r2-r1+1,c2-c1+1) = s1 * m2.block(0, 0, r2-r1+1,c2-c1+1); m1.block(r1,c1,r2-r1+1,c2-c1+1)(r2-r1,c2-c1) = m2.block(0, 0, r2-r1+1,c2-c1+1)(0,0); const Index BlockRows = 2; const Index BlockCols = 5; if (rows>=5 && cols>=8) { // test fixed block() as lvalue m1.template block(1,1) *= s1; // test operator() on fixed block() both as constant and non-constant m1.template block(1,1)(0, 3) = m1.template block<2,5>(1,1)(1,2); // check that fixed block() and block() agree Matrix b = m1.template block(3,3); VERIFY_IS_EQUAL(b, m1.block(3,3,BlockRows,BlockCols)); // same tests with mixed fixed/dynamic size m1.template block(1,1,BlockRows,BlockCols) *= s1; m1.template block(1,1,BlockRows,BlockCols)(0,3) = m1.template block<2,5>(1,1)(1,2); Matrix b2 = m1.template block(3,3,2,5); VERIFY_IS_EQUAL(b2, m1.block(3,3,BlockRows,BlockCols)); VERIFY(is_same_block(m1.block(3,3,BlockRows,BlockCols), m1.block(3,3,fix(BlockRows),fix(BlockCols)))); VERIFY(is_same_block(m1.template block(1,1,BlockRows,BlockCols), m1.block(1,1,fix,BlockCols))); VERIFY(is_same_block(m1.template block(1,1,BlockRows,BlockCols), m1.block(1,1,fix(),fix))); VERIFY(is_same_block(m1.template block(1,1,BlockRows,BlockCols), m1.block(1,1,fix,fix(BlockCols)))); } if (rows>2) { // test sub vectors VERIFY_IS_EQUAL(v1.template head<2>(), v1.block(0,0,2,1)); VERIFY_IS_EQUAL(v1.template head<2>(), v1.head(2)); VERIFY_IS_EQUAL(v1.template head<2>(), v1.segment(0,2)); VERIFY_IS_EQUAL(v1.template head<2>(), v1.template segment<2>(0)); Index i = rows-2; VERIFY_IS_EQUAL(v1.template tail<2>(), v1.block(i,0,2,1)); VERIFY_IS_EQUAL(v1.template tail<2>(), v1.tail(2)); VERIFY_IS_EQUAL(v1.template tail<2>(), v1.segment(i,2)); VERIFY_IS_EQUAL(v1.template tail<2>(), v1.template segment<2>(i)); i = internal::random(0,rows-2); VERIFY_IS_EQUAL(v1.segment(i,2), v1.template segment<2>(i)); } // stress some basic stuffs with block matrices VERIFY(numext::real(ones.col(c1).sum()) == RealScalar(rows)); VERIFY(numext::real(ones.row(r1).sum()) == RealScalar(cols)); VERIFY(numext::real(ones.col(c1).dot(ones.col(c2))) == RealScalar(rows)); VERIFY(numext::real(ones.row(r1).dot(ones.row(r2))) == RealScalar(cols)); // check that linear acccessors works on blocks m1 = m1_copy; if((MatrixType::Flags&RowMajorBit)==0) VERIFY_IS_EQUAL(m1.leftCols(c1).coeff(r1+c1*rows), m1(r1,c1)); else VERIFY_IS_EQUAL(m1.topRows(r1).coeff(c1+r1*cols), m1(r1,c1)); // now test some block-inside-of-block. // expressions with direct access VERIFY_IS_EQUAL( (m1.block(r1,c1,rows-r1,cols-c1).block(r2-r1,c2-c1,rows-r2,cols-c2)) , (m1.block(r2,c2,rows-r2,cols-c2)) ); VERIFY_IS_EQUAL( (m1.block(r1,c1,r2-r1+1,c2-c1+1).row(0)) , (m1.row(r1).segment(c1,c2-c1+1)) ); VERIFY_IS_EQUAL( (m1.block(r1,c1,r2-r1+1,c2-c1+1).col(0)) , (m1.col(c1).segment(r1,r2-r1+1)) ); VERIFY_IS_EQUAL( (m1.block(r1,c1,r2-r1+1,c2-c1+1).transpose().col(0)) , (m1.row(r1).segment(c1,c2-c1+1)).transpose() ); VERIFY_IS_EQUAL( (m1.transpose().block(c1,r1,c2-c1+1,r2-r1+1).col(0)) , (m1.row(r1).segment(c1,c2-c1+1)).transpose() ); // expressions without direct access VERIFY_IS_APPROX( ((m1+m2).block(r1,c1,rows-r1,cols-c1).block(r2-r1,c2-c1,rows-r2,cols-c2)) , ((m1+m2).block(r2,c2,rows-r2,cols-c2)) ); VERIFY_IS_APPROX( ((m1+m2).block(r1,c1,r2-r1+1,c2-c1+1).row(0)) , ((m1+m2).row(r1).segment(c1,c2-c1+1)) ); VERIFY_IS_APPROX( ((m1+m2).block(r1,c1,r2-r1+1,c2-c1+1).row(0)) , ((m1+m2).eval().row(r1).segment(c1,c2-c1+1)) ); VERIFY_IS_APPROX( ((m1+m2).block(r1,c1,r2-r1+1,c2-c1+1).col(0)) , ((m1+m2).col(c1).segment(r1,r2-r1+1)) ); VERIFY_IS_APPROX( ((m1+m2).block(r1,c1,r2-r1+1,c2-c1+1).transpose().col(0)) , ((m1+m2).row(r1).segment(c1,c2-c1+1)).transpose() ); VERIFY_IS_APPROX( ((m1+m2).transpose().block(c1,r1,c2-c1+1,r2-r1+1).col(0)) , ((m1+m2).row(r1).segment(c1,c2-c1+1)).transpose() ); VERIFY_IS_APPROX( ((m1+m2).template block(r1,c1,r2-r1+1,1)) , ((m1+m2).eval().col(c1).eval().segment(r1,r2-r1+1)) ); VERIFY_IS_APPROX( ((m1+m2).template block<1,Dynamic>(r1,c1,1,c2-c1+1)) , ((m1+m2).eval().row(r1).eval().segment(c1,c2-c1+1)) ); VERIFY_IS_APPROX( ((m1+m2).transpose().template block<1,Dynamic>(c1,r1,1,r2-r1+1)) , ((m1+m2).eval().col(c1).eval().segment(r1,r2-r1+1)).transpose() ); VERIFY_IS_APPROX( (m1+m2).row(r1).eval(), (m1+m2).eval().row(r1) ); VERIFY_IS_APPROX( (m1+m2).adjoint().col(r1).eval(), (m1+m2).adjoint().eval().col(r1) ); VERIFY_IS_APPROX( (m1+m2).adjoint().row(c1).eval(), (m1+m2).adjoint().eval().row(c1) ); VERIFY_IS_APPROX( (m1*1).row(r1).segment(c1,c2-c1+1).eval(), m1.row(r1).eval().segment(c1,c2-c1+1).eval() ); VERIFY_IS_APPROX( m1.col(c1).reverse().segment(r1,r2-r1+1).eval(),m1.col(c1).reverse().eval().segment(r1,r2-r1+1).eval() ); VERIFY_IS_APPROX( (m1*1).topRows(r1), m1.topRows(r1) ); VERIFY_IS_APPROX( (m1*1).leftCols(c1), m1.leftCols(c1) ); VERIFY_IS_APPROX( (m1*1).transpose().topRows(c1), m1.transpose().topRows(c1) ); VERIFY_IS_APPROX( (m1*1).transpose().leftCols(r1), m1.transpose().leftCols(r1) ); VERIFY_IS_APPROX( (m1*1).transpose().middleRows(c1,c2-c1+1), m1.transpose().middleRows(c1,c2-c1+1) ); VERIFY_IS_APPROX( (m1*1).transpose().middleCols(r1,r2-r1+1), m1.transpose().middleCols(r1,r2-r1+1) ); // evaluation into plain matrices from expressions with direct access (stress MapBase) DynamicMatrixType dm; DynamicVectorType dv; dm.setZero(); dm = m1.block(r1,c1,rows-r1,cols-c1).block(r2-r1,c2-c1,rows-r2,cols-c2); VERIFY_IS_EQUAL(dm, (m1.block(r2,c2,rows-r2,cols-c2))); dm.setZero(); dv.setZero(); dm = m1.block(r1,c1,r2-r1+1,c2-c1+1).row(0).transpose(); dv = m1.row(r1).segment(c1,c2-c1+1); VERIFY_IS_EQUAL(dv, dm); dm.setZero(); dv.setZero(); dm = m1.col(c1).segment(r1,r2-r1+1); dv = m1.block(r1,c1,r2-r1+1,c2-c1+1).col(0); VERIFY_IS_EQUAL(dv, dm); dm.setZero(); dv.setZero(); dm = m1.block(r1,c1,r2-r1+1,c2-c1+1).transpose().col(0); dv = m1.row(r1).segment(c1,c2-c1+1); VERIFY_IS_EQUAL(dv, dm); dm.setZero(); dv.setZero(); dm = m1.row(r1).segment(c1,c2-c1+1).transpose(); dv = m1.transpose().block(c1,r1,c2-c1+1,r2-r1+1).col(0); VERIFY_IS_EQUAL(dv, dm); VERIFY_IS_EQUAL( (m1.template block(1,0,0,1)), m1.block(1,0,0,1)); VERIFY_IS_EQUAL( (m1.template block<1,Dynamic>(0,1,1,0)), m1.block(0,1,1,0)); VERIFY_IS_EQUAL( ((m1*1).template block(1,0,0,1)), m1.block(1,0,0,1)); VERIFY_IS_EQUAL( ((m1*1).template block<1,Dynamic>(0,1,1,0)), m1.block(0,1,1,0)); if (rows>=2 && cols>=2) { VERIFY_RAISES_ASSERT( m1 += m1.col(0) ); VERIFY_RAISES_ASSERT( m1 -= m1.col(0) ); VERIFY_RAISES_ASSERT( m1.array() *= m1.col(0).array() ); VERIFY_RAISES_ASSERT( m1.array() /= m1.col(0).array() ); } VERIFY_IS_EQUAL( m1.template subVector(r1), m1.row(r1) ); VERIFY_IS_APPROX( (m1+m1).template subVector(r1), (m1+m1).row(r1) ); VERIFY_IS_EQUAL( m1.template subVector(c1), m1.col(c1) ); VERIFY_IS_APPROX( (m1+m1).template subVector(c1), (m1+m1).col(c1) ); VERIFY_IS_EQUAL( m1.template subVectors(), m1.rows() ); VERIFY_IS_EQUAL( m1.template subVectors(), m1.cols() ); if (rows>=2 || cols>=2) { VERIFY_IS_EQUAL( int(m1.middleCols(0,0).IsRowMajor), int(m1.IsRowMajor) ); VERIFY_IS_EQUAL( m1.middleCols(0,0).outerSize(), m1.IsRowMajor ? rows : 0); VERIFY_IS_EQUAL( m1.middleCols(0,0).innerSize(), m1.IsRowMajor ? 0 : rows); VERIFY_IS_EQUAL( int(m1.middleRows(0,0).IsRowMajor), int(m1.IsRowMajor) ); VERIFY_IS_EQUAL( m1.middleRows(0,0).outerSize(), m1.IsRowMajor ? 0 : cols); VERIFY_IS_EQUAL( m1.middleRows(0,0).innerSize(), m1.IsRowMajor ? cols : 0); } } template void compare_using_data_and_stride(const MatrixType& m) { Index rows = m.rows(); Index cols = m.cols(); Index size = m.size(); Index innerStride = m.innerStride(); Index outerStride = m.outerStride(); Index rowStride = m.rowStride(); Index colStride = m.colStride(); const typename MatrixType::Scalar* data = m.data(); for(int j=0;j void data_and_stride(const MatrixType& m) { Index rows = m.rows(); Index cols = m.cols(); Index r1 = internal::random(0,rows-1); Index r2 = internal::random(r1,rows-1); Index c1 = internal::random(0,cols-1); Index c2 = internal::random(c1,cols-1); MatrixType m1 = MatrixType::Random(rows, cols); compare_using_data_and_stride(m1.block(r1, c1, r2-r1+1, c2-c1+1)); compare_using_data_and_stride(m1.transpose().block(c1, r1, c2-c1+1, r2-r1+1)); compare_using_data_and_stride(m1.row(r1)); compare_using_data_and_stride(m1.col(c1)); compare_using_data_and_stride(m1.row(r1).transpose()); compare_using_data_and_stride(m1.col(c1).transpose()); } EIGEN_DECLARE_TEST(block) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( block(Matrix()) ); CALL_SUBTEST_1( block(Matrix(internal::random(2,50))) ); CALL_SUBTEST_1( block(Matrix(internal::random(2,50))) ); CALL_SUBTEST_2( block(Matrix4d()) ); CALL_SUBTEST_3( block(MatrixXcf(internal::random(2,50), internal::random(2,50))) ); CALL_SUBTEST_4( block(MatrixXi(internal::random(2,50), internal::random(2,50))) ); CALL_SUBTEST_5( block(MatrixXcd(internal::random(2,50), internal::random(2,50))) ); CALL_SUBTEST_6( block(MatrixXf(internal::random(2,50), internal::random(2,50))) ); CALL_SUBTEST_7( block(Matrix(internal::random(2,50), internal::random(2,50))) ); CALL_SUBTEST_8( block(Matrix(3, 4)) ); #ifndef EIGEN_DEFAULT_TO_ROW_MAJOR CALL_SUBTEST_6( data_and_stride(MatrixXf(internal::random(5,50), internal::random(5,50))) ); CALL_SUBTEST_7( data_and_stride(Matrix(internal::random(5,50), internal::random(5,50))) ); #endif } } ================================================ FILE: VO_Module/thirdparty/eigen/test/boostmultiprec.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2016 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include #ifdef EIGEN_TEST_MAX_SIZE #undef EIGEN_TEST_MAX_SIZE #endif #define EIGEN_TEST_MAX_SIZE 50 #ifdef EIGEN_TEST_PART_1 #include "cholesky.cpp" #endif #ifdef EIGEN_TEST_PART_2 #include "lu.cpp" #endif #ifdef EIGEN_TEST_PART_3 #include "qr.cpp" #endif #ifdef EIGEN_TEST_PART_4 #include "qr_colpivoting.cpp" #endif #ifdef EIGEN_TEST_PART_5 #include "qr_fullpivoting.cpp" #endif #ifdef EIGEN_TEST_PART_6 #include "eigensolver_selfadjoint.cpp" #endif #ifdef EIGEN_TEST_PART_7 #include "eigensolver_generic.cpp" #endif #ifdef EIGEN_TEST_PART_8 #include "eigensolver_generalized_real.cpp" #endif #ifdef EIGEN_TEST_PART_9 #include "jacobisvd.cpp" #endif #ifdef EIGEN_TEST_PART_10 #include "bdcsvd.cpp" #endif #ifdef EIGEN_TEST_PART_11 #include "simplicial_cholesky.cpp" #endif #include #undef min #undef max #undef isnan #undef isinf #undef isfinite #undef I #include #include #include #include #include namespace mp = boost::multiprecision; typedef mp::number, mp::et_on> Real; namespace Eigen { template<> struct NumTraits : GenericNumTraits { static inline Real dummy_precision() { return 1e-50; } }; template struct NumTraits > : NumTraits {}; template<> Real test_precision() { return 1e-50; } // needed in C++93 mode where number does not support explicit cast. namespace internal { template struct cast_impl { static inline NewType run(const Real& x) { return x.template convert_to(); } }; template<> struct cast_impl > { static inline std::complex run(const Real& x) { return std::complex(x); } }; } } namespace boost { namespace multiprecision { // to make ADL works as expected: using boost::math::isfinite; using boost::math::isnan; using boost::math::isinf; using boost::math::copysign; using boost::math::hypot; // The following is needed for std::complex: Real fabs(const Real& a) { return abs EIGEN_NOT_A_MACRO (a); } Real fmax(const Real& a, const Real& b) { using std::max; return max(a,b); } // some specialization for the unit tests: inline bool test_isMuchSmallerThan(const Real& a, const Real& b) { return internal::isMuchSmallerThan(a, b, test_precision()); } inline bool test_isApprox(const Real& a, const Real& b) { return internal::isApprox(a, b, test_precision()); } inline bool test_isApproxOrLessThan(const Real& a, const Real& b) { return internal::isApproxOrLessThan(a, b, test_precision()); } Real get_test_precision(const Real&) { return test_precision(); } Real test_relative_error(const Real &a, const Real &b) { using Eigen::numext::abs2; return sqrt(abs2(a-b)/Eigen::numext::mini(abs2(a),abs2(b))); } } } namespace Eigen { } EIGEN_DECLARE_TEST(boostmultiprec) { typedef Matrix Mat; typedef Matrix,Dynamic,Dynamic> MatC; std::cout << "NumTraits::epsilon() = " << NumTraits::epsilon() << std::endl; std::cout << "NumTraits::dummy_precision() = " << NumTraits::dummy_precision() << std::endl; std::cout << "NumTraits::lowest() = " << NumTraits::lowest() << std::endl; std::cout << "NumTraits::highest() = " << NumTraits::highest() << std::endl; std::cout << "NumTraits::digits10() = " << NumTraits::digits10() << std::endl; // check stream output { Mat A(10,10); A.setRandom(); std::stringstream ss; ss << A; } { MatC A(10,10); A.setRandom(); std::stringstream ss; ss << A; } for(int i = 0; i < g_repeat; i++) { int s = internal::random(1,EIGEN_TEST_MAX_SIZE); CALL_SUBTEST_1( cholesky(Mat(s,s)) ); CALL_SUBTEST_2( lu_non_invertible() ); CALL_SUBTEST_2( lu_invertible() ); CALL_SUBTEST_2( lu_non_invertible() ); CALL_SUBTEST_2( lu_invertible() ); CALL_SUBTEST_3( qr(Mat(internal::random(1,EIGEN_TEST_MAX_SIZE),internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_3( qr_invertible() ); CALL_SUBTEST_4( qr() ); CALL_SUBTEST_4( cod() ); CALL_SUBTEST_4( qr_invertible() ); CALL_SUBTEST_5( qr() ); CALL_SUBTEST_5( qr_invertible() ); CALL_SUBTEST_6( selfadjointeigensolver(Mat(s,s)) ); CALL_SUBTEST_7( eigensolver(Mat(s,s)) ); CALL_SUBTEST_8( generalized_eigensolver_real(Mat(s,s)) ); TEST_SET_BUT_UNUSED_VARIABLE(s) } CALL_SUBTEST_9(( jacobisvd(Mat(internal::random(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE), internal::random(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/2))) )); CALL_SUBTEST_10(( bdcsvd(Mat(internal::random(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE), internal::random(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/2))) )); CALL_SUBTEST_11(( test_simplicial_cholesky_T() )); } ================================================ FILE: VO_Module/thirdparty/eigen/test/bug1213.cpp ================================================ // This anonymous enum is essential to trigger the linking issue enum { Foo }; #include "bug1213.h" bool bug1213_1(const Eigen::Vector3f& x) { return bug1213_2(x); } ================================================ FILE: VO_Module/thirdparty/eigen/test/bug1213.h ================================================ #include template bool bug1213_2(const Eigen::Matrix& x); bool bug1213_1(const Eigen::Vector3f& x); ================================================ FILE: VO_Module/thirdparty/eigen/test/bug1213_main.cpp ================================================ // This is a regression unit regarding a weird linking issue with gcc. #include "bug1213.h" int main() { return 0; } template bool bug1213_2(const Eigen::Matrix& ) { return true; } template bool bug1213_2(const Eigen::Vector3f&); ================================================ FILE: VO_Module/thirdparty/eigen/test/cholesky.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #define TEST_ENABLE_TEMPORARY_TRACKING #include "main.h" #include #include #include "solverbase.h" template typename MatrixType::RealScalar matrix_l1_norm(const MatrixType& m) { if(m.cols()==0) return typename MatrixType::RealScalar(0); MatrixType symm = m.template selfadjointView(); return symm.cwiseAbs().colwise().sum().maxCoeff(); } template class CholType> void test_chol_update(const MatrixType& symm) { typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef Matrix VectorType; MatrixType symmLo = symm.template triangularView(); MatrixType symmUp = symm.template triangularView(); MatrixType symmCpy = symm; CholType chollo(symmLo); CholType cholup(symmUp); for (int k=0; k<10; ++k) { VectorType vec = VectorType::Random(symm.rows()); RealScalar sigma = internal::random(); symmCpy += sigma * vec * vec.adjoint(); // we are doing some downdates, so it might be the case that the matrix is not SPD anymore CholType chol(symmCpy); if(chol.info()!=Success) break; chollo.rankUpdate(vec, sigma); VERIFY_IS_APPROX(symmCpy, chollo.reconstructedMatrix()); cholup.rankUpdate(vec, sigma); VERIFY_IS_APPROX(symmCpy, cholup.reconstructedMatrix()); } } template void cholesky(const MatrixType& m) { /* this test covers the following files: LLT.h LDLT.h */ Index rows = m.rows(); Index cols = m.cols(); typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef Matrix SquareMatrixType; typedef Matrix VectorType; MatrixType a0 = MatrixType::Random(rows,cols); VectorType vecB = VectorType::Random(rows), vecX(rows); MatrixType matB = MatrixType::Random(rows,cols), matX(rows,cols); SquareMatrixType symm = a0 * a0.adjoint(); // let's make sure the matrix is not singular or near singular for (int k=0; k<3; ++k) { MatrixType a1 = MatrixType::Random(rows,cols); symm += a1 * a1.adjoint(); } { STATIC_CHECK(( internal::is_same::StorageIndex,int>::value )); STATIC_CHECK(( internal::is_same::StorageIndex,int>::value )); SquareMatrixType symmUp = symm.template triangularView(); SquareMatrixType symmLo = symm.template triangularView(); LLT chollo(symmLo); VERIFY_IS_APPROX(symm, chollo.reconstructedMatrix()); check_solverbase(symm, chollo, rows, rows, 1); check_solverbase(symm, chollo, rows, cols, rows); const MatrixType symmLo_inverse = chollo.solve(MatrixType::Identity(rows,cols)); RealScalar rcond = (RealScalar(1) / matrix_l1_norm(symmLo)) / matrix_l1_norm(symmLo_inverse); RealScalar rcond_est = chollo.rcond(); // Verify that the estimated condition number is within a factor of 10 of the // truth. VERIFY(rcond_est >= rcond / 10 && rcond_est <= rcond * 10); // test the upper mode LLT cholup(symmUp); VERIFY_IS_APPROX(symm, cholup.reconstructedMatrix()); vecX = cholup.solve(vecB); VERIFY_IS_APPROX(symm * vecX, vecB); matX = cholup.solve(matB); VERIFY_IS_APPROX(symm * matX, matB); // Verify that the estimated condition number is within a factor of 10 of the // truth. const MatrixType symmUp_inverse = cholup.solve(MatrixType::Identity(rows,cols)); rcond = (RealScalar(1) / matrix_l1_norm(symmUp)) / matrix_l1_norm(symmUp_inverse); rcond_est = cholup.rcond(); VERIFY(rcond_est >= rcond / 10 && rcond_est <= rcond * 10); MatrixType neg = -symmLo; chollo.compute(neg); VERIFY(neg.size()==0 || chollo.info()==NumericalIssue); VERIFY_IS_APPROX(MatrixType(chollo.matrixL().transpose().conjugate()), MatrixType(chollo.matrixU())); VERIFY_IS_APPROX(MatrixType(chollo.matrixU().transpose().conjugate()), MatrixType(chollo.matrixL())); VERIFY_IS_APPROX(MatrixType(cholup.matrixL().transpose().conjugate()), MatrixType(cholup.matrixU())); VERIFY_IS_APPROX(MatrixType(cholup.matrixU().transpose().conjugate()), MatrixType(cholup.matrixL())); // test some special use cases of SelfCwiseBinaryOp: MatrixType m1 = MatrixType::Random(rows,cols), m2(rows,cols); m2 = m1; m2 += symmLo.template selfadjointView().llt().solve(matB); VERIFY_IS_APPROX(m2, m1 + symmLo.template selfadjointView().llt().solve(matB)); m2 = m1; m2 -= symmLo.template selfadjointView().llt().solve(matB); VERIFY_IS_APPROX(m2, m1 - symmLo.template selfadjointView().llt().solve(matB)); m2 = m1; m2.noalias() += symmLo.template selfadjointView().llt().solve(matB); VERIFY_IS_APPROX(m2, m1 + symmLo.template selfadjointView().llt().solve(matB)); m2 = m1; m2.noalias() -= symmLo.template selfadjointView().llt().solve(matB); VERIFY_IS_APPROX(m2, m1 - symmLo.template selfadjointView().llt().solve(matB)); } // LDLT { STATIC_CHECK(( internal::is_same::StorageIndex,int>::value )); STATIC_CHECK(( internal::is_same::StorageIndex,int>::value )); int sign = internal::random()%2 ? 1 : -1; if(sign == -1) { symm = -symm; // test a negative matrix } SquareMatrixType symmUp = symm.template triangularView(); SquareMatrixType symmLo = symm.template triangularView(); LDLT ldltlo(symmLo); VERIFY(ldltlo.info()==Success); VERIFY_IS_APPROX(symm, ldltlo.reconstructedMatrix()); check_solverbase(symm, ldltlo, rows, rows, 1); check_solverbase(symm, ldltlo, rows, cols, rows); const MatrixType symmLo_inverse = ldltlo.solve(MatrixType::Identity(rows,cols)); RealScalar rcond = (RealScalar(1) / matrix_l1_norm(symmLo)) / matrix_l1_norm(symmLo_inverse); RealScalar rcond_est = ldltlo.rcond(); // Verify that the estimated condition number is within a factor of 10 of the // truth. VERIFY(rcond_est >= rcond / 10 && rcond_est <= rcond * 10); LDLT ldltup(symmUp); VERIFY(ldltup.info()==Success); VERIFY_IS_APPROX(symm, ldltup.reconstructedMatrix()); vecX = ldltup.solve(vecB); VERIFY_IS_APPROX(symm * vecX, vecB); matX = ldltup.solve(matB); VERIFY_IS_APPROX(symm * matX, matB); // Verify that the estimated condition number is within a factor of 10 of the // truth. const MatrixType symmUp_inverse = ldltup.solve(MatrixType::Identity(rows,cols)); rcond = (RealScalar(1) / matrix_l1_norm(symmUp)) / matrix_l1_norm(symmUp_inverse); rcond_est = ldltup.rcond(); VERIFY(rcond_est >= rcond / 10 && rcond_est <= rcond * 10); VERIFY_IS_APPROX(MatrixType(ldltlo.matrixL().transpose().conjugate()), MatrixType(ldltlo.matrixU())); VERIFY_IS_APPROX(MatrixType(ldltlo.matrixU().transpose().conjugate()), MatrixType(ldltlo.matrixL())); VERIFY_IS_APPROX(MatrixType(ldltup.matrixL().transpose().conjugate()), MatrixType(ldltup.matrixU())); VERIFY_IS_APPROX(MatrixType(ldltup.matrixU().transpose().conjugate()), MatrixType(ldltup.matrixL())); if(MatrixType::RowsAtCompileTime==Dynamic) { // note : each inplace permutation requires a small temporary vector (mask) // check inplace solve matX = matB; VERIFY_EVALUATION_COUNT(matX = ldltlo.solve(matX), 0); VERIFY_IS_APPROX(matX, ldltlo.solve(matB).eval()); matX = matB; VERIFY_EVALUATION_COUNT(matX = ldltup.solve(matX), 0); VERIFY_IS_APPROX(matX, ldltup.solve(matB).eval()); } // restore if(sign == -1) symm = -symm; // check matrices coming from linear constraints with Lagrange multipliers if(rows>=3) { SquareMatrixType A = symm; Index c = internal::random(0,rows-2); A.bottomRightCorner(c,c).setZero(); // Make sure a solution exists: vecX.setRandom(); vecB = A * vecX; vecX.setZero(); ldltlo.compute(A); VERIFY_IS_APPROX(A, ldltlo.reconstructedMatrix()); vecX = ldltlo.solve(vecB); VERIFY_IS_APPROX(A * vecX, vecB); } // check non-full rank matrices if(rows>=3) { Index r = internal::random(1,rows-1); Matrix a = Matrix::Random(rows,r); SquareMatrixType A = a * a.adjoint(); // Make sure a solution exists: vecX.setRandom(); vecB = A * vecX; vecX.setZero(); ldltlo.compute(A); VERIFY_IS_APPROX(A, ldltlo.reconstructedMatrix()); vecX = ldltlo.solve(vecB); VERIFY_IS_APPROX(A * vecX, vecB); } // check matrices with a wide spectrum if(rows>=3) { using std::pow; using std::sqrt; RealScalar s = (std::min)(16,std::numeric_limits::max_exponent10/8); Matrix a = Matrix::Random(rows,rows); Matrix d = Matrix::Random(rows); for(Index k=0; k(-s,s)); SquareMatrixType A = a * d.asDiagonal() * a.adjoint(); // Make sure a solution exists: vecX.setRandom(); vecB = A * vecX; vecX.setZero(); ldltlo.compute(A); VERIFY_IS_APPROX(A, ldltlo.reconstructedMatrix()); vecX = ldltlo.solve(vecB); if(ldltlo.vectorD().real().cwiseAbs().minCoeff()>RealScalar(0)) { VERIFY_IS_APPROX(A * vecX,vecB); } else { RealScalar large_tol = sqrt(test_precision()); VERIFY((A * vecX).isApprox(vecB, large_tol)); ++g_test_level; VERIFY_IS_APPROX(A * vecX,vecB); --g_test_level; } } } // update/downdate CALL_SUBTEST(( test_chol_update(symm) )); CALL_SUBTEST(( test_chol_update(symm) )); } template void cholesky_cplx(const MatrixType& m) { // classic test cholesky(m); // test mixing real/scalar types Index rows = m.rows(); Index cols = m.cols(); typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef Matrix RealMatrixType; typedef Matrix VectorType; RealMatrixType a0 = RealMatrixType::Random(rows,cols); VectorType vecB = VectorType::Random(rows), vecX(rows); MatrixType matB = MatrixType::Random(rows,cols), matX(rows,cols); RealMatrixType symm = a0 * a0.adjoint(); // let's make sure the matrix is not singular or near singular for (int k=0; k<3; ++k) { RealMatrixType a1 = RealMatrixType::Random(rows,cols); symm += a1 * a1.adjoint(); } { RealMatrixType symmLo = symm.template triangularView(); LLT chollo(symmLo); VERIFY_IS_APPROX(symm, chollo.reconstructedMatrix()); check_solverbase(symm, chollo, rows, rows, 1); //check_solverbase(symm, chollo, rows, cols, rows); } // LDLT { int sign = internal::random()%2 ? 1 : -1; if(sign == -1) { symm = -symm; // test a negative matrix } RealMatrixType symmLo = symm.template triangularView(); LDLT ldltlo(symmLo); VERIFY(ldltlo.info()==Success); VERIFY_IS_APPROX(symm, ldltlo.reconstructedMatrix()); check_solverbase(symm, ldltlo, rows, rows, 1); //check_solverbase(symm, ldltlo, rows, cols, rows); } } // regression test for bug 241 template void cholesky_bug241(const MatrixType& m) { eigen_assert(m.rows() == 2 && m.cols() == 2); typedef typename MatrixType::Scalar Scalar; typedef Matrix VectorType; MatrixType matA; matA << 1, 1, 1, 1; VectorType vecB; vecB << 1, 1; VectorType vecX = matA.ldlt().solve(vecB); VERIFY_IS_APPROX(matA * vecX, vecB); } // LDLT is not guaranteed to work for indefinite matrices, but happens to work fine if matrix is diagonal. // This test checks that LDLT reports correctly that matrix is indefinite. // See http://forum.kde.org/viewtopic.php?f=74&t=106942 and bug 736 template void cholesky_definiteness(const MatrixType& m) { eigen_assert(m.rows() == 2 && m.cols() == 2); MatrixType mat; LDLT ldlt(2); { mat << 1, 0, 0, -1; ldlt.compute(mat); VERIFY(ldlt.info()==Success); VERIFY(!ldlt.isNegative()); VERIFY(!ldlt.isPositive()); VERIFY_IS_APPROX(mat,ldlt.reconstructedMatrix()); } { mat << 1, 2, 2, 1; ldlt.compute(mat); VERIFY(ldlt.info()==Success); VERIFY(!ldlt.isNegative()); VERIFY(!ldlt.isPositive()); VERIFY_IS_APPROX(mat,ldlt.reconstructedMatrix()); } { mat << 0, 0, 0, 0; ldlt.compute(mat); VERIFY(ldlt.info()==Success); VERIFY(ldlt.isNegative()); VERIFY(ldlt.isPositive()); VERIFY_IS_APPROX(mat,ldlt.reconstructedMatrix()); } { mat << 0, 0, 0, 1; ldlt.compute(mat); VERIFY(ldlt.info()==Success); VERIFY(!ldlt.isNegative()); VERIFY(ldlt.isPositive()); VERIFY_IS_APPROX(mat,ldlt.reconstructedMatrix()); } { mat << -1, 0, 0, 0; ldlt.compute(mat); VERIFY(ldlt.info()==Success); VERIFY(ldlt.isNegative()); VERIFY(!ldlt.isPositive()); VERIFY_IS_APPROX(mat,ldlt.reconstructedMatrix()); } } template void cholesky_faillure_cases() { MatrixXd mat; LDLT ldlt; { mat.resize(2,2); mat << 0, 1, 1, 0; ldlt.compute(mat); VERIFY_IS_NOT_APPROX(mat,ldlt.reconstructedMatrix()); VERIFY(ldlt.info()==NumericalIssue); } #if (!EIGEN_ARCH_i386) || defined(EIGEN_VECTORIZE_SSE2) { mat.resize(3,3); mat << -1, -3, 3, -3, -8.9999999999999999999, 1, 3, 1, 0; ldlt.compute(mat); VERIFY(ldlt.info()==NumericalIssue); VERIFY_IS_NOT_APPROX(mat,ldlt.reconstructedMatrix()); } #endif { mat.resize(3,3); mat << 1, 2, 3, 2, 4, 1, 3, 1, 0; ldlt.compute(mat); VERIFY(ldlt.info()==NumericalIssue); VERIFY_IS_NOT_APPROX(mat,ldlt.reconstructedMatrix()); } { mat.resize(8,8); mat << 0.1, 0, -0.1, 0, 0, 0, 1, 0, 0, 4.24667, 0, 2.00333, 0, 0, 0, 0, -0.1, 0, 0.2, 0, -0.1, 0, 0, 0, 0, 2.00333, 0, 8.49333, 0, 2.00333, 0, 0, 0, 0, -0.1, 0, 0.1, 0, 0, 1, 0, 0, 0, 2.00333, 0, 4.24667, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0; ldlt.compute(mat); VERIFY(ldlt.info()==NumericalIssue); VERIFY_IS_NOT_APPROX(mat,ldlt.reconstructedMatrix()); } // bug 1479 { mat.resize(4,4); mat << 1, 2, 0, 1, 2, 4, 0, 2, 0, 0, 0, 1, 1, 2, 1, 1; ldlt.compute(mat); VERIFY(ldlt.info()==NumericalIssue); VERIFY_IS_NOT_APPROX(mat,ldlt.reconstructedMatrix()); } } template void cholesky_verify_assert() { MatrixType tmp; LLT llt; VERIFY_RAISES_ASSERT(llt.matrixL()) VERIFY_RAISES_ASSERT(llt.matrixU()) VERIFY_RAISES_ASSERT(llt.solve(tmp)) VERIFY_RAISES_ASSERT(llt.transpose().solve(tmp)) VERIFY_RAISES_ASSERT(llt.adjoint().solve(tmp)) VERIFY_RAISES_ASSERT(llt.solveInPlace(tmp)) LDLT ldlt; VERIFY_RAISES_ASSERT(ldlt.matrixL()) VERIFY_RAISES_ASSERT(ldlt.transpositionsP()) VERIFY_RAISES_ASSERT(ldlt.vectorD()) VERIFY_RAISES_ASSERT(ldlt.isPositive()) VERIFY_RAISES_ASSERT(ldlt.isNegative()) VERIFY_RAISES_ASSERT(ldlt.solve(tmp)) VERIFY_RAISES_ASSERT(ldlt.transpose().solve(tmp)) VERIFY_RAISES_ASSERT(ldlt.adjoint().solve(tmp)) VERIFY_RAISES_ASSERT(ldlt.solveInPlace(tmp)) } EIGEN_DECLARE_TEST(cholesky) { int s = 0; for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( cholesky(Matrix()) ); CALL_SUBTEST_3( cholesky(Matrix2d()) ); CALL_SUBTEST_3( cholesky_bug241(Matrix2d()) ); CALL_SUBTEST_3( cholesky_definiteness(Matrix2d()) ); CALL_SUBTEST_4( cholesky(Matrix3f()) ); CALL_SUBTEST_5( cholesky(Matrix4d()) ); s = internal::random(1,EIGEN_TEST_MAX_SIZE); CALL_SUBTEST_2( cholesky(MatrixXd(s,s)) ); TEST_SET_BUT_UNUSED_VARIABLE(s) s = internal::random(1,EIGEN_TEST_MAX_SIZE/2); CALL_SUBTEST_6( cholesky_cplx(MatrixXcd(s,s)) ); TEST_SET_BUT_UNUSED_VARIABLE(s) } // empty matrix, regression test for Bug 785: CALL_SUBTEST_2( cholesky(MatrixXd(0,0)) ); // This does not work yet: // CALL_SUBTEST_2( cholesky(Matrix()) ); CALL_SUBTEST_4( cholesky_verify_assert() ); CALL_SUBTEST_7( cholesky_verify_assert() ); CALL_SUBTEST_8( cholesky_verify_assert() ); CALL_SUBTEST_2( cholesky_verify_assert() ); // Test problem size constructors CALL_SUBTEST_9( LLT(10) ); CALL_SUBTEST_9( LDLT(10) ); CALL_SUBTEST_2( cholesky_faillure_cases() ); TEST_SET_BUT_UNUSED_VARIABLE(nb_temporaries) } ================================================ FILE: VO_Module/thirdparty/eigen/test/cholmod_support.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2011 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #define EIGEN_NO_DEBUG_SMALL_PRODUCT_BLOCKS #include "sparse_solver.h" #include template void test_cholmod_ST() { CholmodDecomposition g_chol_colmajor_lower; g_chol_colmajor_lower.setMode(CholmodSupernodalLLt); CholmodDecomposition g_chol_colmajor_upper; g_chol_colmajor_upper.setMode(CholmodSupernodalLLt); CholmodDecomposition g_llt_colmajor_lower; g_llt_colmajor_lower.setMode(CholmodSimplicialLLt); CholmodDecomposition g_llt_colmajor_upper; g_llt_colmajor_upper.setMode(CholmodSimplicialLLt); CholmodDecomposition g_ldlt_colmajor_lower; g_ldlt_colmajor_lower.setMode(CholmodLDLt); CholmodDecomposition g_ldlt_colmajor_upper; g_ldlt_colmajor_upper.setMode(CholmodLDLt); CholmodSupernodalLLT chol_colmajor_lower; CholmodSupernodalLLT chol_colmajor_upper; CholmodSimplicialLLT llt_colmajor_lower; CholmodSimplicialLLT llt_colmajor_upper; CholmodSimplicialLDLT ldlt_colmajor_lower; CholmodSimplicialLDLT ldlt_colmajor_upper; check_sparse_spd_solving(g_chol_colmajor_lower); check_sparse_spd_solving(g_chol_colmajor_upper); check_sparse_spd_solving(g_llt_colmajor_lower); check_sparse_spd_solving(g_llt_colmajor_upper); check_sparse_spd_solving(g_ldlt_colmajor_lower); check_sparse_spd_solving(g_ldlt_colmajor_upper); check_sparse_spd_solving(chol_colmajor_lower); check_sparse_spd_solving(chol_colmajor_upper); check_sparse_spd_solving(llt_colmajor_lower); check_sparse_spd_solving(llt_colmajor_upper); check_sparse_spd_solving(ldlt_colmajor_lower); check_sparse_spd_solving(ldlt_colmajor_upper); check_sparse_spd_determinant(chol_colmajor_lower); check_sparse_spd_determinant(chol_colmajor_upper); check_sparse_spd_determinant(llt_colmajor_lower); check_sparse_spd_determinant(llt_colmajor_upper); check_sparse_spd_determinant(ldlt_colmajor_lower); check_sparse_spd_determinant(ldlt_colmajor_upper); } template void test_cholmod_T() { test_cholmod_ST >(); } EIGEN_DECLARE_TEST(cholmod_support) { CALL_SUBTEST_11( (test_cholmod_T()) ); CALL_SUBTEST_12( (test_cholmod_T()) ); CALL_SUBTEST_13( (test_cholmod_T()) ); CALL_SUBTEST_14( (test_cholmod_T()) ); CALL_SUBTEST_21( (test_cholmod_T, ColMajor, int >()) ); CALL_SUBTEST_22( (test_cholmod_T, ColMajor, long>()) ); // TODO complex row-major matrices do not work at the moment: // CALL_SUBTEST_23( (test_cholmod_T, RowMajor, int >()) ); // CALL_SUBTEST_24( (test_cholmod_T, RowMajor, long>()) ); } ================================================ FILE: VO_Module/thirdparty/eigen/test/commainitializer.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" template void test_blocks() { Matrix m_fixed; MatrixXi m_dynamic(M1+M2, N1+N2); Matrix mat11; mat11.setRandom(); Matrix mat12; mat12.setRandom(); Matrix mat21; mat21.setRandom(); Matrix mat22; mat22.setRandom(); MatrixXi matx11 = mat11, matx12 = mat12, matx21 = mat21, matx22 = mat22; { VERIFY_IS_EQUAL((m_fixed << mat11, mat12, mat21, matx22).finished(), (m_dynamic << mat11, matx12, mat21, matx22).finished()); VERIFY_IS_EQUAL((m_fixed.template topLeftCorner()), mat11); VERIFY_IS_EQUAL((m_fixed.template topRightCorner()), mat12); VERIFY_IS_EQUAL((m_fixed.template bottomLeftCorner()), mat21); VERIFY_IS_EQUAL((m_fixed.template bottomRightCorner()), mat22); VERIFY_IS_EQUAL((m_fixed << mat12, mat11, matx21, mat22).finished(), (m_dynamic << mat12, matx11, matx21, mat22).finished()); } if(N1 > 0) { if(M1 > 0) { VERIFY_RAISES_ASSERT((m_fixed << mat11, mat12, mat11, mat21, mat22)); } if(M2 > 0) { VERIFY_RAISES_ASSERT((m_fixed << mat11, mat12, mat21, mat21, mat22)); } } else { // allow insertion of zero-column blocks: VERIFY_IS_EQUAL((m_fixed << mat11, mat12, mat11, mat11, mat21, mat21, mat22).finished(), (m_dynamic << mat12, mat22).finished()); } if(M1 != M2) { VERIFY_RAISES_ASSERT((m_fixed << mat11, mat21, mat12, mat22)); } } template struct test_block_recursion { static void run() { test_block_recursion::run(); test_block_recursion::run(); } }; template struct test_block_recursion<0,N> { static void run() { test_blocks<(N>>6)&3, (N>>4)&3, (N>>2)&3, N & 3>(); } }; void test_basics() { Matrix3d m3; Matrix4d m4; VERIFY_RAISES_ASSERT( (m3 << 1, 2, 3, 4, 5, 6, 7, 8) ); #ifndef _MSC_VER VERIFY_RAISES_ASSERT( (m3 << 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) ); #endif double data[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; Matrix3d ref = Map >(data); m3 = Matrix3d::Random(); m3 << 1, 2, 3, 4, 5, 6, 7, 8, 9; VERIFY_IS_APPROX(m3, ref ); Vector3d vec[3]; vec[0] << 1, 4, 7; vec[1] << 2, 5, 8; vec[2] << 3, 6, 9; m3 = Matrix3d::Random(); m3 << vec[0], vec[1], vec[2]; VERIFY_IS_APPROX(m3, ref); vec[0] << 1, 2, 3; vec[1] << 4, 5, 6; vec[2] << 7, 8, 9; m3 = Matrix3d::Random(); m3 << vec[0].transpose(), 4, 5, 6, vec[2].transpose(); VERIFY_IS_APPROX(m3, ref); } EIGEN_DECLARE_TEST(commainitializer) { CALL_SUBTEST_1(test_basics()); // recursively test all block-sizes from 0 to 3: CALL_SUBTEST_2(test_block_recursion<8>::run()); } ================================================ FILE: VO_Module/thirdparty/eigen/test/conjugate_gradient.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2011 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "sparse_solver.h" #include template void test_conjugate_gradient_T() { typedef SparseMatrix SparseMatrixType; ConjugateGradient cg_colmajor_lower_diag; ConjugateGradient cg_colmajor_upper_diag; ConjugateGradient cg_colmajor_loup_diag; ConjugateGradient cg_colmajor_lower_I; ConjugateGradient cg_colmajor_upper_I; CALL_SUBTEST( check_sparse_spd_solving(cg_colmajor_lower_diag) ); CALL_SUBTEST( check_sparse_spd_solving(cg_colmajor_upper_diag) ); CALL_SUBTEST( check_sparse_spd_solving(cg_colmajor_loup_diag) ); CALL_SUBTEST( check_sparse_spd_solving(cg_colmajor_lower_I) ); CALL_SUBTEST( check_sparse_spd_solving(cg_colmajor_upper_I) ); } EIGEN_DECLARE_TEST(conjugate_gradient) { CALL_SUBTEST_1(( test_conjugate_gradient_T() )); CALL_SUBTEST_2(( test_conjugate_gradient_T, int>() )); CALL_SUBTEST_3(( test_conjugate_gradient_T() )); } ================================================ FILE: VO_Module/thirdparty/eigen/test/conservative_resize.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Hauke Heibel // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include #include "AnnoyingScalar.h" using namespace Eigen; template void run_matrix_tests() { typedef Matrix MatrixType; MatrixType m, n; // boundary cases ... m = n = MatrixType::Random(50,50); m.conservativeResize(1,50); VERIFY_IS_APPROX(m, n.block(0,0,1,50)); m = n = MatrixType::Random(50,50); m.conservativeResize(50,1); VERIFY_IS_APPROX(m, n.block(0,0,50,1)); m = n = MatrixType::Random(50,50); m.conservativeResize(50,50); VERIFY_IS_APPROX(m, n.block(0,0,50,50)); // random shrinking ... for (int i=0; i<25; ++i) { const Index rows = internal::random(1,50); const Index cols = internal::random(1,50); m = n = MatrixType::Random(50,50); m.conservativeResize(rows,cols); VERIFY_IS_APPROX(m, n.block(0,0,rows,cols)); } // random growing with zeroing ... for (int i=0; i<25; ++i) { const Index rows = internal::random(50,75); const Index cols = internal::random(50,75); m = n = MatrixType::Random(50,50); m.conservativeResizeLike(MatrixType::Zero(rows,cols)); VERIFY_IS_APPROX(m.block(0,0,n.rows(),n.cols()), n); VERIFY( rows<=50 || m.block(50,0,rows-50,cols).sum() == Scalar(0) ); VERIFY( cols<=50 || m.block(0,50,rows,cols-50).sum() == Scalar(0) ); } } template void run_vector_tests() { typedef Matrix VectorType; VectorType m, n; // boundary cases ... m = n = VectorType::Random(50); m.conservativeResize(1); VERIFY_IS_APPROX(m, n.segment(0,1)); m = n = VectorType::Random(50); m.conservativeResize(50); VERIFY_IS_APPROX(m, n.segment(0,50)); m = n = VectorType::Random(50); m.conservativeResize(m.rows(),1); VERIFY_IS_APPROX(m, n.segment(0,1)); m = n = VectorType::Random(50); m.conservativeResize(m.rows(),50); VERIFY_IS_APPROX(m, n.segment(0,50)); // random shrinking ... for (int i=0; i<50; ++i) { const int size = internal::random(1,50); m = n = VectorType::Random(50); m.conservativeResize(size); VERIFY_IS_APPROX(m, n.segment(0,size)); m = n = VectorType::Random(50); m.conservativeResize(m.rows(), size); VERIFY_IS_APPROX(m, n.segment(0,size)); } // random growing with zeroing ... for (int i=0; i<50; ++i) { const int size = internal::random(50,100); m = n = VectorType::Random(50); m.conservativeResizeLike(VectorType::Zero(size)); VERIFY_IS_APPROX(m.segment(0,50), n); VERIFY( size<=50 || m.segment(50,size-50).sum() == Scalar(0) ); m = n = VectorType::Random(50); m.conservativeResizeLike(Matrix::Zero(1,size)); VERIFY_IS_APPROX(m.segment(0,50), n); VERIFY( size<=50 || m.segment(50,size-50).sum() == Scalar(0) ); } } // Basic memory leak check with a non-copyable scalar type template void noncopyable() { typedef Eigen::Matrix VectorType; typedef Eigen::Matrix MatrixType; { #ifndef EIGEN_TEST_ANNOYING_SCALAR_DONT_THROW AnnoyingScalar::dont_throw = true; #endif int n = 50; VectorType v0(n), v1(n); MatrixType m0(n,n), m1(n,n), m2(n,n); v0.setOnes(); v1.setOnes(); m0.setOnes(); m1.setOnes(); m2.setOnes(); VERIFY(m0==m1); m0.conservativeResize(2*n,2*n); VERIFY(m0.topLeftCorner(n,n) == m1); VERIFY(v0.head(n) == v1); v0.conservativeResize(2*n); VERIFY(v0.head(n) == v1); } VERIFY(AnnoyingScalar::instances==0 && "global memory leak detected in noncopyable"); } EIGEN_DECLARE_TEST(conservative_resize) { for(int i=0; i())); CALL_SUBTEST_1((run_matrix_tests())); CALL_SUBTEST_2((run_matrix_tests())); CALL_SUBTEST_2((run_matrix_tests())); CALL_SUBTEST_3((run_matrix_tests())); CALL_SUBTEST_3((run_matrix_tests())); CALL_SUBTEST_4((run_matrix_tests, Eigen::RowMajor>())); CALL_SUBTEST_4((run_matrix_tests, Eigen::ColMajor>())); CALL_SUBTEST_5((run_matrix_tests, Eigen::RowMajor>())); CALL_SUBTEST_5((run_matrix_tests, Eigen::ColMajor>())); CALL_SUBTEST_1((run_matrix_tests())); CALL_SUBTEST_1((run_vector_tests())); CALL_SUBTEST_2((run_vector_tests())); CALL_SUBTEST_3((run_vector_tests())); CALL_SUBTEST_4((run_vector_tests >())); CALL_SUBTEST_5((run_vector_tests >())); #ifndef EIGEN_TEST_ANNOYING_SCALAR_DONT_THROW AnnoyingScalar::dont_throw = true; #endif CALL_SUBTEST_6(( run_vector_tests() )); CALL_SUBTEST_6(( noncopyable<0>() )); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/constructor.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2017 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #define TEST_ENABLE_TEMPORARY_TRACKING #include "main.h" template struct Wrapper { MatrixType m_mat; inline Wrapper(const MatrixType &x) : m_mat(x) {} inline operator const MatrixType& () const { return m_mat; } inline operator MatrixType& () { return m_mat; } }; enum my_sizes { M = 12, N = 7}; template void ctor_init1(const MatrixType& m) { // Check logic in PlainObjectBase::_init1 Index rows = m.rows(); Index cols = m.cols(); MatrixType m0 = MatrixType::Random(rows,cols); VERIFY_EVALUATION_COUNT( MatrixType m1(m0), 1); VERIFY_EVALUATION_COUNT( MatrixType m2(m0+m0), 1); VERIFY_EVALUATION_COUNT( MatrixType m2(m0.block(0,0,rows,cols)) , 1); Wrapper wrapper(m0); VERIFY_EVALUATION_COUNT( MatrixType m3(wrapper) , 1); } EIGEN_DECLARE_TEST(constructor) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( ctor_init1(Matrix()) ); CALL_SUBTEST_1( ctor_init1(Matrix4d()) ); CALL_SUBTEST_1( ctor_init1(MatrixXcf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_1( ctor_init1(MatrixXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); } { Matrix a(123); VERIFY_IS_EQUAL(a[0], 123); } { Matrix a(123.0); VERIFY_IS_EQUAL(a[0], 123); } { Matrix a(123); VERIFY_IS_EQUAL(a[0], 123.f); } { Array a(123); VERIFY_IS_EQUAL(a[0], 123); } { Array a(123.0); VERIFY_IS_EQUAL(a[0], 123); } { Array a(123); VERIFY_IS_EQUAL(a[0], 123.f); } { Array a(123); VERIFY_IS_EQUAL(a(4), 123); } { Array a(123.0); VERIFY_IS_EQUAL(a(4), 123); } { Array a(123); VERIFY_IS_EQUAL(a(4), 123.f); } { MatrixXi m1(M,N); VERIFY_IS_EQUAL(m1.rows(),M); VERIFY_IS_EQUAL(m1.cols(),N); ArrayXXi a1(M,N); VERIFY_IS_EQUAL(a1.rows(),M); VERIFY_IS_EQUAL(a1.cols(),N); VectorXi v1(M); VERIFY_IS_EQUAL(v1.size(),M); ArrayXi a2(M); VERIFY_IS_EQUAL(a2.size(),M); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/corners.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2006-2010 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #define COMPARE_CORNER(A,B) \ VERIFY_IS_EQUAL(matrix.A, matrix.B); \ VERIFY_IS_EQUAL(const_matrix.A, const_matrix.B); template void corners(const MatrixType& m) { Index rows = m.rows(); Index cols = m.cols(); Index r = internal::random(1,rows); Index c = internal::random(1,cols); MatrixType matrix = MatrixType::Random(rows,cols); const MatrixType const_matrix = MatrixType::Random(rows,cols); COMPARE_CORNER(topLeftCorner(r,c), block(0,0,r,c)); COMPARE_CORNER(topRightCorner(r,c), block(0,cols-c,r,c)); COMPARE_CORNER(bottomLeftCorner(r,c), block(rows-r,0,r,c)); COMPARE_CORNER(bottomRightCorner(r,c), block(rows-r,cols-c,r,c)); Index sr = internal::random(1,rows) - 1; Index nr = internal::random(1,rows-sr); Index sc = internal::random(1,cols) - 1; Index nc = internal::random(1,cols-sc); COMPARE_CORNER(topRows(r), block(0,0,r,cols)); COMPARE_CORNER(middleRows(sr,nr), block(sr,0,nr,cols)); COMPARE_CORNER(bottomRows(r), block(rows-r,0,r,cols)); COMPARE_CORNER(leftCols(c), block(0,0,rows,c)); COMPARE_CORNER(middleCols(sc,nc), block(0,sc,rows,nc)); COMPARE_CORNER(rightCols(c), block(0,cols-c,rows,c)); } template void corners_fixedsize() { MatrixType matrix = MatrixType::Random(); const MatrixType const_matrix = MatrixType::Random(); enum { rows = MatrixType::RowsAtCompileTime, cols = MatrixType::ColsAtCompileTime, r = CRows, c = CCols, sr = SRows, sc = SCols }; VERIFY_IS_EQUAL((matrix.template topLeftCorner()), (matrix.template block(0,0))); VERIFY_IS_EQUAL((matrix.template topRightCorner()), (matrix.template block(0,cols-c))); VERIFY_IS_EQUAL((matrix.template bottomLeftCorner()), (matrix.template block(rows-r,0))); VERIFY_IS_EQUAL((matrix.template bottomRightCorner()), (matrix.template block(rows-r,cols-c))); VERIFY_IS_EQUAL((matrix.template topLeftCorner()), (matrix.template topLeftCorner(r,c))); VERIFY_IS_EQUAL((matrix.template topRightCorner()), (matrix.template topRightCorner(r,c))); VERIFY_IS_EQUAL((matrix.template bottomLeftCorner()), (matrix.template bottomLeftCorner(r,c))); VERIFY_IS_EQUAL((matrix.template bottomRightCorner()), (matrix.template bottomRightCorner(r,c))); VERIFY_IS_EQUAL((matrix.template topLeftCorner()), (matrix.template topLeftCorner(r,c))); VERIFY_IS_EQUAL((matrix.template topRightCorner()), (matrix.template topRightCorner(r,c))); VERIFY_IS_EQUAL((matrix.template bottomLeftCorner()), (matrix.template bottomLeftCorner(r,c))); VERIFY_IS_EQUAL((matrix.template bottomRightCorner()), (matrix.template bottomRightCorner(r,c))); VERIFY_IS_EQUAL((matrix.template topRows()), (matrix.template block(0,0))); VERIFY_IS_EQUAL((matrix.template middleRows(sr)), (matrix.template block(sr,0))); VERIFY_IS_EQUAL((matrix.template bottomRows()), (matrix.template block(rows-r,0))); VERIFY_IS_EQUAL((matrix.template leftCols()), (matrix.template block(0,0))); VERIFY_IS_EQUAL((matrix.template middleCols(sc)), (matrix.template block(0,sc))); VERIFY_IS_EQUAL((matrix.template rightCols()), (matrix.template block(0,cols-c))); VERIFY_IS_EQUAL((const_matrix.template topLeftCorner()), (const_matrix.template block(0,0))); VERIFY_IS_EQUAL((const_matrix.template topRightCorner()), (const_matrix.template block(0,cols-c))); VERIFY_IS_EQUAL((const_matrix.template bottomLeftCorner()), (const_matrix.template block(rows-r,0))); VERIFY_IS_EQUAL((const_matrix.template bottomRightCorner()), (const_matrix.template block(rows-r,cols-c))); VERIFY_IS_EQUAL((const_matrix.template topLeftCorner()), (const_matrix.template topLeftCorner(r,c))); VERIFY_IS_EQUAL((const_matrix.template topRightCorner()), (const_matrix.template topRightCorner(r,c))); VERIFY_IS_EQUAL((const_matrix.template bottomLeftCorner()), (const_matrix.template bottomLeftCorner(r,c))); VERIFY_IS_EQUAL((const_matrix.template bottomRightCorner()), (const_matrix.template bottomRightCorner(r,c))); VERIFY_IS_EQUAL((const_matrix.template topLeftCorner()), (const_matrix.template topLeftCorner(r,c))); VERIFY_IS_EQUAL((const_matrix.template topRightCorner()), (const_matrix.template topRightCorner(r,c))); VERIFY_IS_EQUAL((const_matrix.template bottomLeftCorner()), (const_matrix.template bottomLeftCorner(r,c))); VERIFY_IS_EQUAL((const_matrix.template bottomRightCorner()), (const_matrix.template bottomRightCorner(r,c))); VERIFY_IS_EQUAL((const_matrix.template topRows()), (const_matrix.template block(0,0))); VERIFY_IS_EQUAL((const_matrix.template middleRows(sr)), (const_matrix.template block(sr,0))); VERIFY_IS_EQUAL((const_matrix.template bottomRows()), (const_matrix.template block(rows-r,0))); VERIFY_IS_EQUAL((const_matrix.template leftCols()), (const_matrix.template block(0,0))); VERIFY_IS_EQUAL((const_matrix.template middleCols(sc)), (const_matrix.template block(0,sc))); VERIFY_IS_EQUAL((const_matrix.template rightCols()), (const_matrix.template block(0,cols-c))); } EIGEN_DECLARE_TEST(corners) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( corners(Matrix()) ); CALL_SUBTEST_2( corners(Matrix4d()) ); CALL_SUBTEST_3( corners(Matrix()) ); CALL_SUBTEST_4( corners(MatrixXcf(5, 7)) ); CALL_SUBTEST_5( corners(MatrixXf(21, 20)) ); CALL_SUBTEST_1(( corners_fixedsize, 1, 1, 0, 0>() )); CALL_SUBTEST_2(( corners_fixedsize() )); CALL_SUBTEST_3(( corners_fixedsize,4,7,5,2>() )); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/ctorleak.cpp ================================================ #include "main.h" #include // std::exception struct Foo { static Index object_count; static Index object_limit; int dummy; Foo() : dummy(0) { #ifdef EIGEN_EXCEPTIONS // TODO: Is this the correct way to handle this? if (Foo::object_count > Foo::object_limit) { std::cout << "\nThrow!\n"; throw Foo::Fail(); } #endif std::cout << '+'; ++Foo::object_count; } ~Foo() { std::cout << '-'; --Foo::object_count; } class Fail : public std::exception {}; }; Index Foo::object_count = 0; Index Foo::object_limit = 0; #undef EIGEN_TEST_MAX_SIZE #define EIGEN_TEST_MAX_SIZE 3 EIGEN_DECLARE_TEST(ctorleak) { typedef Matrix MatrixX; typedef Matrix VectorX; Foo::object_count = 0; for(int i = 0; i < g_repeat; i++) { Index rows = internal::random(2,EIGEN_TEST_MAX_SIZE), cols = internal::random(2,EIGEN_TEST_MAX_SIZE); Foo::object_limit = rows*cols; { MatrixX r(rows, cols); Foo::object_limit = r.size()+internal::random(0, rows*cols - 2); std::cout << "object_limit =" << Foo::object_limit << std::endl; #ifdef EIGEN_EXCEPTIONS try { #endif if(internal::random()) { std::cout << "\nMatrixX m(" << rows << ", " << cols << ");\n"; MatrixX m(rows, cols); } else { std::cout << "\nMatrixX m(r);\n"; MatrixX m(r); } #ifdef EIGEN_EXCEPTIONS VERIFY(false); // not reached if exceptions are enabled } catch (const Foo::Fail&) { /* ignore */ } #endif } VERIFY_IS_EQUAL(Index(0), Foo::object_count); { Foo::object_limit = (rows+1)*(cols+1); MatrixX A(rows, cols); VERIFY_IS_EQUAL(Foo::object_count, rows*cols); VectorX v=A.row(0); VERIFY_IS_EQUAL(Foo::object_count, (rows+1)*cols); v = A.col(0); VERIFY_IS_EQUAL(Foo::object_count, rows*(cols+1)); } VERIFY_IS_EQUAL(Index(0), Foo::object_count); } std::cout << "\n"; } ================================================ FILE: VO_Module/thirdparty/eigen/test/denseLM.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Desire Nuentsa // Copyright (C) 2012 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include #include #include #include "main.h" #include using namespace std; using namespace Eigen; template struct DenseLM : DenseFunctor { typedef DenseFunctor Base; typedef typename Base::JacobianType JacobianType; typedef Matrix VectorType; DenseLM(int n, int m) : DenseFunctor(n,m) { } VectorType model(const VectorType& uv, VectorType& x) { VectorType y; // Should change to use expression template int m = Base::values(); int n = Base::inputs(); eigen_assert(uv.size()%2 == 0); eigen_assert(uv.size() == n); eigen_assert(x.size() == m); y.setZero(m); int half = n/2; VectorBlock u(uv, 0, half); VectorBlock v(uv, half, half); for (int j = 0; j < m; j++) { for (int i = 0; i < half; i++) y(j) += u(i)*std::exp(-(x(j)-i)*(x(j)-i)/(v(i)*v(i))); } return y; } void initPoints(VectorType& uv_ref, VectorType& x) { m_x = x; m_y = this->model(uv_ref, x); } int operator()(const VectorType& uv, VectorType& fvec) { int m = Base::values(); int n = Base::inputs(); eigen_assert(uv.size()%2 == 0); eigen_assert(uv.size() == n); eigen_assert(fvec.size() == m); int half = n/2; VectorBlock u(uv, 0, half); VectorBlock v(uv, half, half); for (int j = 0; j < m; j++) { fvec(j) = m_y(j); for (int i = 0; i < half; i++) { fvec(j) -= u(i) *std::exp(-(m_x(j)-i)*(m_x(j)-i)/(v(i)*v(i))); } } return 0; } int df(const VectorType& uv, JacobianType& fjac) { int m = Base::values(); int n = Base::inputs(); eigen_assert(n == uv.size()); eigen_assert(fjac.rows() == m); eigen_assert(fjac.cols() == n); int half = n/2; VectorBlock u(uv, 0, half); VectorBlock v(uv, half, half); for (int j = 0; j < m; j++) { for (int i = 0; i < half; i++) { fjac.coeffRef(j,i) = -std::exp(-(m_x(j)-i)*(m_x(j)-i)/(v(i)*v(i))); fjac.coeffRef(j,i+half) = -2.*u(i)*(m_x(j)-i)*(m_x(j)-i)/(std::pow(v(i),3)) * std::exp(-(m_x(j)-i)*(m_x(j)-i)/(v(i)*v(i))); } } return 0; } VectorType m_x, m_y; //Data Points }; template int test_minimizeLM(FunctorType& functor, VectorType& uv) { LevenbergMarquardt lm(functor); LevenbergMarquardtSpace::Status info; info = lm.minimize(uv); VERIFY_IS_EQUAL(info, 1); //FIXME Check other parameters return info; } template int test_lmder(FunctorType& functor, VectorType& uv) { typedef typename VectorType::Scalar Scalar; LevenbergMarquardtSpace::Status info; LevenbergMarquardt lm(functor); info = lm.lmder1(uv); VERIFY_IS_EQUAL(info, 1); //FIXME Check other parameters return info; } template int test_minimizeSteps(FunctorType& functor, VectorType& uv) { LevenbergMarquardtSpace::Status info; LevenbergMarquardt lm(functor); info = lm.minimizeInit(uv); if (info==LevenbergMarquardtSpace::ImproperInputParameters) return info; do { info = lm.minimizeOneStep(uv); } while (info==LevenbergMarquardtSpace::Running); VERIFY_IS_EQUAL(info, 1); //FIXME Check other parameters return info; } template void test_denseLM_T() { typedef Matrix VectorType; int inputs = 10; int values = 1000; DenseLM dense_gaussian(inputs, values); VectorType uv(inputs),uv_ref(inputs); VectorType x(values); // Generate the reference solution uv_ref << -2, 1, 4 ,8, 6, 1.8, 1.2, 1.1, 1.9 , 3; //Generate the reference data points x.setRandom(); x = 10*x; x.array() += 10; dense_gaussian.initPoints(uv_ref, x); // Generate the initial parameters VectorBlock u(uv, 0, inputs/2); VectorBlock v(uv, inputs/2, inputs/2); // Solve the optimization problem //Solve in one go u.setOnes(); v.setOnes(); test_minimizeLM(dense_gaussian, uv); //Solve until the machine precision u.setOnes(); v.setOnes(); test_lmder(dense_gaussian, uv); // Solve step by step v.setOnes(); u.setOnes(); test_minimizeSteps(dense_gaussian, uv); } EIGEN_DECLARE_TEST(denseLM) { CALL_SUBTEST_2(test_denseLM_T()); // CALL_SUBTEST_2(test_sparseLM_T()); } ================================================ FILE: VO_Module/thirdparty/eigen/test/dense_storage.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2013 Hauke Heibel // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include "AnnoyingScalar.h" #include "SafeScalar.h" #include #if EIGEN_HAS_TYPE_TRAITS && EIGEN_HAS_CXX11 using DenseStorageD3x3 = Eigen::DenseStorage; static_assert(std::is_trivially_move_constructible::value, "DenseStorage not trivially_move_constructible"); static_assert(std::is_trivially_move_assignable::value, "DenseStorage not trivially_move_assignable"); #if !defined(EIGEN_DENSE_STORAGE_CTOR_PLUGIN) static_assert(std::is_trivially_copy_constructible::value, "DenseStorage not trivially_copy_constructible"); static_assert(std::is_trivially_copy_assignable::value, "DenseStorage not trivially_copy_assignable"); static_assert(std::is_trivially_copyable::value, "DenseStorage not trivially_copyable"); #endif #endif template void dense_storage_copy(int rows, int cols) { typedef DenseStorage DenseStorageType; const int size = rows*cols; DenseStorageType reference(size, rows, cols); T* raw_reference = reference.data(); for (int i=0; i(i); DenseStorageType copied_reference(reference); const T* raw_copied_reference = copied_reference.data(); for (int i=0; i void dense_storage_assignment(int rows, int cols) { typedef DenseStorage DenseStorageType; const int size = rows*cols; DenseStorageType reference(size, rows, cols); T* raw_reference = reference.data(); for (int i=0; i(i); DenseStorageType copied_reference; copied_reference = reference; const T* raw_copied_reference = copied_reference.data(); for (int i=0; i void dense_storage_swap(int rows0, int cols0, int rows1, int cols1) { typedef DenseStorage DenseStorageType; const int size0 = rows0*cols0; DenseStorageType a(size0, rows0, cols0); for (int i=0; i(i); } const int size1 = rows1*cols1; DenseStorageType b(size1, rows1, cols1); for (int i=0; i(-i); } a.swap(b); for (int i=0; i(i)); } for (int i=0; i(-i)); } } template void dense_storage_alignment() { #if EIGEN_HAS_ALIGNAS struct alignas(Alignment) Empty1 {}; VERIFY_IS_EQUAL(std::alignment_of::value, Alignment); struct EIGEN_ALIGN_TO_BOUNDARY(Alignment) Empty2 {}; VERIFY_IS_EQUAL(std::alignment_of::value, Alignment); struct Nested1 { EIGEN_ALIGN_TO_BOUNDARY(Alignment) T data[Size]; }; VERIFY_IS_EQUAL(std::alignment_of::value, Alignment); VERIFY_IS_EQUAL( (std::alignment_of >::value), Alignment); const std::size_t default_alignment = internal::compute_default_alignment::value; VERIFY_IS_EQUAL( (std::alignment_of >::value), default_alignment); VERIFY_IS_EQUAL( (std::alignment_of >::value), default_alignment); struct Nested2 { Matrix mat; }; VERIFY_IS_EQUAL(std::alignment_of::value, default_alignment); #endif } template void dense_storage_tests() { // Dynamic Storage. dense_storage_copy(4, 3); dense_storage_copy(4, 3); dense_storage_copy(4, 3); // Fixed Storage. dense_storage_copy(4, 3); dense_storage_copy(4, 3); dense_storage_copy(4, 3); dense_storage_copy(4, 3); // Fixed Storage with Uninitialized Elements. dense_storage_copy(4, 3); dense_storage_copy(4, 3); dense_storage_copy(4, 3); // Dynamic Storage. dense_storage_assignment(4, 3); dense_storage_assignment(4, 3); dense_storage_assignment(4, 3); // Fixed Storage. dense_storage_assignment(4, 3); dense_storage_assignment(4, 3); dense_storage_assignment(4, 3); dense_storage_assignment(4, 3); // Fixed Storage with Uninitialized Elements. dense_storage_assignment(4, 3); dense_storage_assignment(4, 3); dense_storage_assignment(4, 3); // Dynamic Storage. dense_storage_swap(4, 3, 4, 3); dense_storage_swap(4, 3, 2, 1); dense_storage_swap(2, 1, 4, 3); dense_storage_swap(4, 3, 4, 3); dense_storage_swap(4, 3, 2, 3); dense_storage_swap(2, 3, 4, 3); dense_storage_swap(4, 3, 4, 3); dense_storage_swap(4, 3, 4, 1); dense_storage_swap(4, 1, 4, 3); // Fixed Storage. dense_storage_swap(4, 3, 4, 3); dense_storage_swap(4, 3, 4, 3); dense_storage_swap(4, 3, 2, 1); dense_storage_swap(2, 1, 4, 3); dense_storage_swap(4, 3, 4, 3); dense_storage_swap(4, 3, 4, 1); dense_storage_swap(4, 1, 4, 3); dense_storage_swap(4, 3, 4, 3); dense_storage_swap(4, 3, 2, 3); dense_storage_swap(2, 3, 4, 3); // Fixed Storage with Uninitialized Elements. dense_storage_swap(4, 3, 4, 3); dense_storage_swap(4, 3, 2, 1); dense_storage_swap(2, 1, 4, 3); dense_storage_swap(4, 3, 4, 3); dense_storage_swap(4, 3, 4, 1); dense_storage_swap(4, 1, 4, 3); dense_storage_swap(4, 3, 4, 3); dense_storage_swap(4, 3, 2, 3); dense_storage_swap(2, 3, 4, 3); dense_storage_alignment(); dense_storage_alignment(); dense_storage_alignment(); dense_storage_alignment(); } EIGEN_DECLARE_TEST(dense_storage) { dense_storage_tests(); dense_storage_tests(); dense_storage_tests >(); dense_storage_tests(); } ================================================ FILE: VO_Module/thirdparty/eigen/test/determinant.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Benoit Jacob // Copyright (C) 2008 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include template void determinant(const MatrixType& m) { /* this test covers the following files: Determinant.h */ Index size = m.rows(); MatrixType m1(size, size), m2(size, size); m1.setRandom(); m2.setRandom(); typedef typename MatrixType::Scalar Scalar; Scalar x = internal::random(); VERIFY_IS_APPROX(MatrixType::Identity(size, size).determinant(), Scalar(1)); VERIFY_IS_APPROX((m1*m2).eval().determinant(), m1.determinant() * m2.determinant()); if(size==1) return; Index i = internal::random(0, size-1); Index j; do { j = internal::random(0, size-1); } while(j==i); m2 = m1; m2.row(i).swap(m2.row(j)); VERIFY_IS_APPROX(m2.determinant(), -m1.determinant()); m2 = m1; m2.col(i).swap(m2.col(j)); VERIFY_IS_APPROX(m2.determinant(), -m1.determinant()); VERIFY_IS_APPROX(m2.determinant(), m2.transpose().determinant()); VERIFY_IS_APPROX(numext::conj(m2.determinant()), m2.adjoint().determinant()); m2 = m1; m2.row(i) += x*m2.row(j); VERIFY_IS_APPROX(m2.determinant(), m1.determinant()); m2 = m1; m2.row(i) *= x; VERIFY_IS_APPROX(m2.determinant(), m1.determinant() * x); // check empty matrix VERIFY_IS_APPROX(m2.block(0,0,0,0).determinant(), Scalar(1)); } EIGEN_DECLARE_TEST(determinant) { for(int i = 0; i < g_repeat; i++) { int s = 0; CALL_SUBTEST_1( determinant(Matrix()) ); CALL_SUBTEST_2( determinant(Matrix()) ); CALL_SUBTEST_3( determinant(Matrix()) ); CALL_SUBTEST_4( determinant(Matrix()) ); CALL_SUBTEST_5( determinant(Matrix, 10, 10>()) ); s = internal::random(1,EIGEN_TEST_MAX_SIZE/4); CALL_SUBTEST_6( determinant(MatrixXd(s, s)) ); TEST_SET_BUT_UNUSED_VARIABLE(s) } } ================================================ FILE: VO_Module/thirdparty/eigen/test/diagonal.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2006-2010 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" template void diagonal(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; Index rows = m.rows(); Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols); Scalar s1 = internal::random(); //check diagonal() VERIFY_IS_APPROX(m1.diagonal(), m1.transpose().diagonal()); m2.diagonal() = 2 * m1.diagonal(); m2.diagonal()[0] *= 3; if (rows>2) { enum { N1 = MatrixType::RowsAtCompileTime>2 ? 2 : 0, N2 = MatrixType::RowsAtCompileTime>1 ? -1 : 0 }; // check sub/super diagonal if(MatrixType::SizeAtCompileTime!=Dynamic) { VERIFY(m1.template diagonal().RowsAtCompileTime == m1.diagonal(N1).size()); VERIFY(m1.template diagonal().RowsAtCompileTime == m1.diagonal(N2).size()); } m2.template diagonal() = 2 * m1.template diagonal(); VERIFY_IS_APPROX(m2.template diagonal(), static_cast(2) * m1.diagonal(N1)); m2.template diagonal()[0] *= 3; VERIFY_IS_APPROX(m2.template diagonal()[0], static_cast(6) * m1.template diagonal()[0]); m2.template diagonal() = 2 * m1.template diagonal(); m2.template diagonal()[0] *= 3; VERIFY_IS_APPROX(m2.template diagonal()[0], static_cast(6) * m1.template diagonal()[0]); m2.diagonal(N1) = 2 * m1.diagonal(N1); VERIFY_IS_APPROX(m2.template diagonal(), static_cast(2) * m1.diagonal(N1)); m2.diagonal(N1)[0] *= 3; VERIFY_IS_APPROX(m2.diagonal(N1)[0], static_cast(6) * m1.diagonal(N1)[0]); m2.diagonal(N2) = 2 * m1.diagonal(N2); VERIFY_IS_APPROX(m2.template diagonal(), static_cast(2) * m1.diagonal(N2)); m2.diagonal(N2)[0] *= 3; VERIFY_IS_APPROX(m2.diagonal(N2)[0], static_cast(6) * m1.diagonal(N2)[0]); m2.diagonal(N2).x() = s1; VERIFY_IS_APPROX(m2.diagonal(N2).x(), s1); m2.diagonal(N2).coeffRef(0) = Scalar(2)*s1; VERIFY_IS_APPROX(m2.diagonal(N2).coeff(0), Scalar(2)*s1); } VERIFY( m1.diagonal( cols).size()==0 ); VERIFY( m1.diagonal(-rows).size()==0 ); } template void diagonal_assert(const MatrixType& m) { Index rows = m.rows(); Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols); if (rows>=2 && cols>=2) { VERIFY_RAISES_ASSERT( m1 += m1.diagonal() ); VERIFY_RAISES_ASSERT( m1 -= m1.diagonal() ); VERIFY_RAISES_ASSERT( m1.array() *= m1.diagonal().array() ); VERIFY_RAISES_ASSERT( m1.array() /= m1.diagonal().array() ); } VERIFY_RAISES_ASSERT( m1.diagonal(cols+1) ); VERIFY_RAISES_ASSERT( m1.diagonal(-(rows+1)) ); } EIGEN_DECLARE_TEST(diagonal) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( diagonal(Matrix()) ); CALL_SUBTEST_1( diagonal(Matrix()) ); CALL_SUBTEST_1( diagonal(Matrix()) ); CALL_SUBTEST_2( diagonal(Matrix4d()) ); CALL_SUBTEST_2( diagonal(MatrixXcf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_2( diagonal(MatrixXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_2( diagonal(MatrixXcd(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_1( diagonal(MatrixXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_1( diagonal(Matrix(3, 4)) ); CALL_SUBTEST_1( diagonal_assert(MatrixXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/diagonal_matrix_variadic_ctor.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2019 David Tellenbach // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #define EIGEN_NO_STATIC_ASSERT #include "main.h" template void assertionTest() { typedef DiagonalMatrix DiagMatrix5; typedef DiagonalMatrix DiagMatrix7; typedef DiagonalMatrix DiagMatrixX; Scalar raw[6]; for (int i = 0; i < 6; ++i) { raw[i] = internal::random(); } VERIFY_RAISES_ASSERT((DiagMatrix5{raw[0], raw[1], raw[2], raw[3]})); VERIFY_RAISES_ASSERT((DiagMatrix5{raw[0], raw[1], raw[3]})); VERIFY_RAISES_ASSERT((DiagMatrix7{raw[0], raw[1], raw[2], raw[3]})); VERIFY_RAISES_ASSERT((DiagMatrixX { {raw[0], raw[1], raw[2]}, {raw[3], raw[4], raw[5]} })); } #define VERIFY_IMPLICIT_CONVERSION_3(DIAGTYPE, V0, V1, V2) \ DIAGTYPE d(V0, V1, V2); \ DIAGTYPE::DenseMatrixType Dense = d.toDenseMatrix(); \ VERIFY_IS_APPROX(Dense(0, 0), (Scalar)V0); \ VERIFY_IS_APPROX(Dense(1, 1), (Scalar)V1); \ VERIFY_IS_APPROX(Dense(2, 2), (Scalar)V2); #define VERIFY_IMPLICIT_CONVERSION_4(DIAGTYPE, V0, V1, V2, V3) \ DIAGTYPE d(V0, V1, V2, V3); \ DIAGTYPE::DenseMatrixType Dense = d.toDenseMatrix(); \ VERIFY_IS_APPROX(Dense(0, 0), (Scalar)V0); \ VERIFY_IS_APPROX(Dense(1, 1), (Scalar)V1); \ VERIFY_IS_APPROX(Dense(2, 2), (Scalar)V2); \ VERIFY_IS_APPROX(Dense(3, 3), (Scalar)V3); #define VERIFY_IMPLICIT_CONVERSION_5(DIAGTYPE, V0, V1, V2, V3, V4) \ DIAGTYPE d(V0, V1, V2, V3, V4); \ DIAGTYPE::DenseMatrixType Dense = d.toDenseMatrix(); \ VERIFY_IS_APPROX(Dense(0, 0), (Scalar)V0); \ VERIFY_IS_APPROX(Dense(1, 1), (Scalar)V1); \ VERIFY_IS_APPROX(Dense(2, 2), (Scalar)V2); \ VERIFY_IS_APPROX(Dense(3, 3), (Scalar)V3); \ VERIFY_IS_APPROX(Dense(4, 4), (Scalar)V4); template void constructorTest() { typedef DiagonalMatrix DiagonalMatrix0; typedef DiagonalMatrix DiagonalMatrix3; typedef DiagonalMatrix DiagonalMatrix4; typedef DiagonalMatrix DiagonalMatrixX; Scalar raw[7]; for (int k = 0; k < 7; ++k) raw[k] = internal::random(); // Fixed-sized matrices { DiagonalMatrix0 a {{}}; VERIFY(a.rows() == 0); VERIFY(a.cols() == 0); typename DiagonalMatrix0::DenseMatrixType m = a.toDenseMatrix(); for (Index k = 0; k < a.rows(); ++k) VERIFY(m(k, k) == raw[k]); } { DiagonalMatrix3 a {{raw[0], raw[1], raw[2]}}; VERIFY(a.rows() == 3); VERIFY(a.cols() == 3); typename DiagonalMatrix3::DenseMatrixType m = a.toDenseMatrix(); for (Index k = 0; k < a.rows(); ++k) VERIFY(m(k, k) == raw[k]); } { DiagonalMatrix4 a {{raw[0], raw[1], raw[2], raw[3]}}; VERIFY(a.rows() == 4); VERIFY(a.cols() == 4); typename DiagonalMatrix4::DenseMatrixType m = a.toDenseMatrix(); for (Index k = 0; k < a.rows(); ++k) VERIFY(m(k, k) == raw[k]); } // dynamically sized matrices { DiagonalMatrixX a{{}}; VERIFY(a.rows() == 0); VERIFY(a.rows() == 0); typename DiagonalMatrixX::DenseMatrixType m = a.toDenseMatrix(); for (Index k = 0; k < a.rows(); ++k) VERIFY(m(k, k) == raw[k]); } { DiagonalMatrixX a{{raw[0], raw[1], raw[2], raw[3], raw[4], raw[5], raw[6]}}; VERIFY(a.rows() == 7); VERIFY(a.rows() == 7); typename DiagonalMatrixX::DenseMatrixType m = a.toDenseMatrix(); for (Index k = 0; k < a.rows(); ++k) VERIFY(m(k, k) == raw[k]); } } template<> void constructorTest() { typedef float Scalar; typedef DiagonalMatrix DiagonalMatrix0; typedef DiagonalMatrix DiagonalMatrix3; typedef DiagonalMatrix DiagonalMatrix4; typedef DiagonalMatrix DiagonalMatrix5; typedef DiagonalMatrix DiagonalMatrixX; Scalar raw[7]; for (int k = 0; k < 7; ++k) raw[k] = internal::random(); // Fixed-sized matrices { DiagonalMatrix0 a {{}}; VERIFY(a.rows() == 0); VERIFY(a.cols() == 0); typename DiagonalMatrix0::DenseMatrixType m = a.toDenseMatrix(); for (Index k = 0; k < a.rows(); ++k) VERIFY(m(k, k) == raw[k]); } { DiagonalMatrix3 a {{raw[0], raw[1], raw[2]}}; VERIFY(a.rows() == 3); VERIFY(a.cols() == 3); typename DiagonalMatrix3::DenseMatrixType m = a.toDenseMatrix(); for (Index k = 0; k < a.rows(); ++k) VERIFY(m(k, k) == raw[k]); } { DiagonalMatrix4 a {{raw[0], raw[1], raw[2], raw[3]}}; VERIFY(a.rows() == 4); VERIFY(a.cols() == 4); typename DiagonalMatrix4::DenseMatrixType m = a.toDenseMatrix(); for (Index k = 0; k < a.rows(); ++k) VERIFY(m(k, k) == raw[k]); } // dynamically sized matrices { DiagonalMatrixX a{{}}; VERIFY(a.rows() == 0); VERIFY(a.rows() == 0); typename DiagonalMatrixX::DenseMatrixType m = a.toDenseMatrix(); for (Index k = 0; k < a.rows(); ++k) VERIFY(m(k, k) == raw[k]); } { DiagonalMatrixX a{{raw[0], raw[1], raw[2], raw[3], raw[4], raw[5], raw[6]}}; VERIFY(a.rows() == 7); VERIFY(a.rows() == 7); typename DiagonalMatrixX::DenseMatrixType m = a.toDenseMatrix(); for (Index k = 0; k < a.rows(); ++k) VERIFY(m(k, k) == raw[k]); } { VERIFY_IMPLICIT_CONVERSION_3(DiagonalMatrix3, 1.2647, 2.56f, -3); } { VERIFY_IMPLICIT_CONVERSION_4(DiagonalMatrix4, 1.2647, 2.56f, -3, 3.23f); } { VERIFY_IMPLICIT_CONVERSION_5(DiagonalMatrix5, 1.2647, 2.56f, -3, 3.23f, 2); } } EIGEN_DECLARE_TEST(diagonal_matrix_variadic_ctor) { CALL_SUBTEST_1(assertionTest()); CALL_SUBTEST_1(assertionTest()); CALL_SUBTEST_1(assertionTest()); CALL_SUBTEST_1(assertionTest()); CALL_SUBTEST_1(assertionTest()); CALL_SUBTEST_1(assertionTest()); CALL_SUBTEST_1(assertionTest>()); CALL_SUBTEST_2(constructorTest()); CALL_SUBTEST_2(constructorTest()); CALL_SUBTEST_2(constructorTest()); CALL_SUBTEST_2(constructorTest()); CALL_SUBTEST_2(constructorTest()); CALL_SUBTEST_2(constructorTest()); CALL_SUBTEST_2(constructorTest>()); } ================================================ FILE: VO_Module/thirdparty/eigen/test/diagonalmatrices.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" using namespace std; template void diagonalmatrices(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime }; typedef Matrix VectorType; typedef Matrix RowVectorType; typedef Matrix SquareMatrixType; typedef Matrix DynMatrixType; typedef DiagonalMatrix LeftDiagonalMatrix; typedef DiagonalMatrix RightDiagonalMatrix; typedef Matrix BigMatrix; Index rows = m.rows(); Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols); VectorType v1 = VectorType::Random(rows), v2 = VectorType::Random(rows); RowVectorType rv1 = RowVectorType::Random(cols), rv2 = RowVectorType::Random(cols); LeftDiagonalMatrix ldm1(v1), ldm2(v2); RightDiagonalMatrix rdm1(rv1), rdm2(rv2); Scalar s1 = internal::random(); SquareMatrixType sq_m1 (v1.asDiagonal()); VERIFY_IS_APPROX(sq_m1, v1.asDiagonal().toDenseMatrix()); sq_m1 = v1.asDiagonal(); VERIFY_IS_APPROX(sq_m1, v1.asDiagonal().toDenseMatrix()); SquareMatrixType sq_m2 = v1.asDiagonal(); VERIFY_IS_APPROX(sq_m1, sq_m2); ldm1 = v1.asDiagonal(); LeftDiagonalMatrix ldm3(v1); VERIFY_IS_APPROX(ldm1.diagonal(), ldm3.diagonal()); LeftDiagonalMatrix ldm4 = v1.asDiagonal(); VERIFY_IS_APPROX(ldm1.diagonal(), ldm4.diagonal()); sq_m1.block(0,0,rows,rows) = ldm1; VERIFY_IS_APPROX(sq_m1, ldm1.toDenseMatrix()); sq_m1.transpose() = ldm1; VERIFY_IS_APPROX(sq_m1, ldm1.toDenseMatrix()); Index i = internal::random(0, rows-1); Index j = internal::random(0, cols-1); VERIFY_IS_APPROX( ((ldm1 * m1)(i,j)) , ldm1.diagonal()(i) * m1(i,j) ); VERIFY_IS_APPROX( ((ldm1 * (m1+m2))(i,j)) , ldm1.diagonal()(i) * (m1+m2)(i,j) ); VERIFY_IS_APPROX( ((m1 * rdm1)(i,j)) , rdm1.diagonal()(j) * m1(i,j) ); VERIFY_IS_APPROX( ((v1.asDiagonal() * m1)(i,j)) , v1(i) * m1(i,j) ); VERIFY_IS_APPROX( ((m1 * rv1.asDiagonal())(i,j)) , rv1(j) * m1(i,j) ); VERIFY_IS_APPROX( (((v1+v2).asDiagonal() * m1)(i,j)) , (v1+v2)(i) * m1(i,j) ); VERIFY_IS_APPROX( (((v1+v2).asDiagonal() * (m1+m2))(i,j)) , (v1+v2)(i) * (m1+m2)(i,j) ); VERIFY_IS_APPROX( ((m1 * (rv1+rv2).asDiagonal())(i,j)) , (rv1+rv2)(j) * m1(i,j) ); VERIFY_IS_APPROX( (((m1+m2) * (rv1+rv2).asDiagonal())(i,j)) , (rv1+rv2)(j) * (m1+m2)(i,j) ); if(rows>1) { DynMatrixType tmp = m1.topRows(rows/2), res; VERIFY_IS_APPROX( (res = m1.topRows(rows/2) * rv1.asDiagonal()), tmp * rv1.asDiagonal() ); VERIFY_IS_APPROX( (res = v1.head(rows/2).asDiagonal()*m1.topRows(rows/2)), v1.head(rows/2).asDiagonal()*tmp ); } BigMatrix big; big.setZero(2*rows, 2*cols); big.block(i,j,rows,cols) = m1; big.block(i,j,rows,cols) = v1.asDiagonal() * big.block(i,j,rows,cols); VERIFY_IS_APPROX((big.block(i,j,rows,cols)) , v1.asDiagonal() * m1 ); big.block(i,j,rows,cols) = m1; big.block(i,j,rows,cols) = big.block(i,j,rows,cols) * rv1.asDiagonal(); VERIFY_IS_APPROX((big.block(i,j,rows,cols)) , m1 * rv1.asDiagonal() ); // scalar multiple VERIFY_IS_APPROX(LeftDiagonalMatrix(ldm1*s1).diagonal(), ldm1.diagonal() * s1); VERIFY_IS_APPROX(LeftDiagonalMatrix(s1*ldm1).diagonal(), s1 * ldm1.diagonal()); VERIFY_IS_APPROX(m1 * (rdm1 * s1), (m1 * rdm1) * s1); VERIFY_IS_APPROX(m1 * (s1 * rdm1), (m1 * rdm1) * s1); // Diagonal to dense sq_m1.setRandom(); sq_m2 = sq_m1; VERIFY_IS_APPROX( (sq_m1 += (s1*v1).asDiagonal()), sq_m2 += (s1*v1).asDiagonal().toDenseMatrix() ); VERIFY_IS_APPROX( (sq_m1 -= (s1*v1).asDiagonal()), sq_m2 -= (s1*v1).asDiagonal().toDenseMatrix() ); VERIFY_IS_APPROX( (sq_m1 = (s1*v1).asDiagonal()), (s1*v1).asDiagonal().toDenseMatrix() ); sq_m1.setRandom(); sq_m2 = v1.asDiagonal(); sq_m2 = sq_m1 * sq_m2; VERIFY_IS_APPROX( (sq_m1*v1.asDiagonal()).col(i), sq_m2.col(i) ); VERIFY_IS_APPROX( (sq_m1*v1.asDiagonal()).row(i), sq_m2.row(i) ); sq_m1 = v1.asDiagonal(); sq_m2 = v2.asDiagonal(); SquareMatrixType sq_m3 = v1.asDiagonal(); VERIFY_IS_APPROX( sq_m3 = v1.asDiagonal() + v2.asDiagonal(), sq_m1 + sq_m2); VERIFY_IS_APPROX( sq_m3 = v1.asDiagonal() - v2.asDiagonal(), sq_m1 - sq_m2); VERIFY_IS_APPROX( sq_m3 = v1.asDiagonal() - 2*v2.asDiagonal() + v1.asDiagonal(), sq_m1 - 2*sq_m2 + sq_m1); } template void as_scalar_product(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; typedef Matrix VectorType; typedef Matrix DynMatrixType; typedef Matrix DynVectorType; typedef Matrix DynRowVectorType; Index rows = m.rows(); Index depth = internal::random(1,EIGEN_TEST_MAX_SIZE); VectorType v1 = VectorType::Random(rows); DynVectorType dv1 = DynVectorType::Random(depth); DynRowVectorType drv1 = DynRowVectorType::Random(depth); DynMatrixType dm1 = dv1; DynMatrixType drm1 = drv1; Scalar s = v1(0); VERIFY_IS_APPROX( v1.asDiagonal() * drv1, s*drv1 ); VERIFY_IS_APPROX( dv1 * v1.asDiagonal(), dv1*s ); VERIFY_IS_APPROX( v1.asDiagonal() * drm1, s*drm1 ); VERIFY_IS_APPROX( dm1 * v1.asDiagonal(), dm1*s ); } template void bug987() { Matrix3Xd points = Matrix3Xd::Random(3, 3); Vector2d diag = Vector2d::Random(); Matrix2Xd tmp1 = points.topRows<2>(), res1, res2; VERIFY_IS_APPROX( res1 = diag.asDiagonal() * points.topRows<2>(), res2 = diag.asDiagonal() * tmp1 ); Matrix2d tmp2 = points.topLeftCorner<2,2>(); VERIFY_IS_APPROX(( res1 = points.topLeftCorner<2,2>()*diag.asDiagonal()) , res2 = tmp2*diag.asDiagonal() ); } EIGEN_DECLARE_TEST(diagonalmatrices) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( diagonalmatrices(Matrix()) ); CALL_SUBTEST_1( as_scalar_product(Matrix()) ); CALL_SUBTEST_2( diagonalmatrices(Matrix3f()) ); CALL_SUBTEST_3( diagonalmatrices(Matrix()) ); CALL_SUBTEST_4( diagonalmatrices(Matrix4d()) ); CALL_SUBTEST_5( diagonalmatrices(Matrix()) ); CALL_SUBTEST_6( diagonalmatrices(MatrixXcf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_6( as_scalar_product(MatrixXcf(1,1)) ); CALL_SUBTEST_7( diagonalmatrices(MatrixXi(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_8( diagonalmatrices(Matrix(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_9( diagonalmatrices(MatrixXf(internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_9( diagonalmatrices(MatrixXf(1,1)) ); CALL_SUBTEST_9( as_scalar_product(MatrixXf(1,1)) ); } CALL_SUBTEST_10( bug987<0>() ); } ================================================ FILE: VO_Module/thirdparty/eigen/test/dontalign.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2011 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #if defined EIGEN_TEST_PART_1 || defined EIGEN_TEST_PART_2 || defined EIGEN_TEST_PART_3 || defined EIGEN_TEST_PART_4 #define EIGEN_DONT_ALIGN #elif defined EIGEN_TEST_PART_5 || defined EIGEN_TEST_PART_6 || defined EIGEN_TEST_PART_7 || defined EIGEN_TEST_PART_8 #define EIGEN_DONT_ALIGN_STATICALLY #endif #include "main.h" #include template void dontalign(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; typedef Matrix VectorType; typedef Matrix SquareMatrixType; Index rows = m.rows(); Index cols = m.cols(); MatrixType a = MatrixType::Random(rows,cols); SquareMatrixType square = SquareMatrixType::Random(rows,rows); VectorType v = VectorType::Random(rows); VERIFY_IS_APPROX(v, square * square.colPivHouseholderQr().solve(v)); square = square.inverse().eval(); a = square * a; square = square*square; v = square * v; v = a.adjoint() * v; VERIFY(square.determinant() != Scalar(0)); // bug 219: MapAligned() was giving an assert with EIGEN_DONT_ALIGN, because Map Flags were miscomputed Scalar* array = internal::aligned_new(rows); v = VectorType::MapAligned(array, rows); internal::aligned_delete(array, rows); } EIGEN_DECLARE_TEST(dontalign) { #if defined EIGEN_TEST_PART_1 || defined EIGEN_TEST_PART_5 dontalign(Matrix3d()); dontalign(Matrix4f()); #elif defined EIGEN_TEST_PART_2 || defined EIGEN_TEST_PART_6 dontalign(Matrix3cd()); dontalign(Matrix4cf()); #elif defined EIGEN_TEST_PART_3 || defined EIGEN_TEST_PART_7 dontalign(Matrix()); dontalign(Matrix, 32, 32>()); #elif defined EIGEN_TEST_PART_4 || defined EIGEN_TEST_PART_8 dontalign(MatrixXd(32, 32)); dontalign(MatrixXcf(32, 32)); #endif } ================================================ FILE: VO_Module/thirdparty/eigen/test/dynalloc.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #if EIGEN_MAX_ALIGN_BYTES>0 #define ALIGNMENT EIGEN_MAX_ALIGN_BYTES #else #define ALIGNMENT 1 #endif typedef Matrix Vector16f; typedef Matrix Vector8f; void check_handmade_aligned_malloc() { for(int i = 1; i < 1000; i++) { char *p = (char*)internal::handmade_aligned_malloc(i); VERIFY(internal::UIntPtr(p)%ALIGNMENT==0); // if the buffer is wrongly allocated this will give a bad write --> check with valgrind for(int j = 0; j < i; j++) p[j]=0; internal::handmade_aligned_free(p); } } void check_aligned_malloc() { for(int i = ALIGNMENT; i < 1000; i++) { char *p = (char*)internal::aligned_malloc(i); VERIFY(internal::UIntPtr(p)%ALIGNMENT==0); // if the buffer is wrongly allocated this will give a bad write --> check with valgrind for(int j = 0; j < i; j++) p[j]=0; internal::aligned_free(p); } } void check_aligned_new() { for(int i = ALIGNMENT; i < 1000; i++) { float *p = internal::aligned_new(i); VERIFY(internal::UIntPtr(p)%ALIGNMENT==0); // if the buffer is wrongly allocated this will give a bad write --> check with valgrind for(int j = 0; j < i; j++) p[j]=0; internal::aligned_delete(p,i); } } void check_aligned_stack_alloc() { for(int i = ALIGNMENT; i < 400; i++) { ei_declare_aligned_stack_constructed_variable(float,p,i,0); VERIFY(internal::UIntPtr(p)%ALIGNMENT==0); // if the buffer is wrongly allocated this will give a bad write --> check with valgrind for(int j = 0; j < i; j++) p[j]=0; } } // test compilation with both a struct and a class... struct MyStruct { EIGEN_MAKE_ALIGNED_OPERATOR_NEW char dummychar; Vector16f avec; }; class MyClassA { public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW char dummychar; Vector16f avec; }; template void check_dynaligned() { // TODO have to be updated once we support multiple alignment values if(T::SizeAtCompileTime % ALIGNMENT == 0) { T* obj = new T; VERIFY(T::NeedsToAlign==1); VERIFY(internal::UIntPtr(obj)%ALIGNMENT==0); delete obj; } } template void check_custom_new_delete() { { T* t = new T; delete t; } { std::size_t N = internal::random(1,10); T* t = new T[N]; delete[] t; } #if EIGEN_MAX_ALIGN_BYTES>0 && (!EIGEN_HAS_CXX17_OVERALIGN) { T* t = static_cast((T::operator new)(sizeof(T))); (T::operator delete)(t, sizeof(T)); } { T* t = static_cast((T::operator new)(sizeof(T))); (T::operator delete)(t); } #endif } EIGEN_DECLARE_TEST(dynalloc) { // low level dynamic memory allocation CALL_SUBTEST(check_handmade_aligned_malloc()); CALL_SUBTEST(check_aligned_malloc()); CALL_SUBTEST(check_aligned_new()); CALL_SUBTEST(check_aligned_stack_alloc()); for (int i=0; i() ); CALL_SUBTEST( check_custom_new_delete() ); CALL_SUBTEST( check_custom_new_delete() ); CALL_SUBTEST( check_custom_new_delete() ); } // check static allocation, who knows ? #if EIGEN_MAX_STATIC_ALIGN_BYTES for (int i=0; i() ); CALL_SUBTEST(check_dynaligned() ); CALL_SUBTEST(check_dynaligned() ); CALL_SUBTEST(check_dynaligned() ); CALL_SUBTEST(check_dynaligned() ); CALL_SUBTEST(check_dynaligned() ); CALL_SUBTEST(check_dynaligned() ); } { MyStruct foo0; VERIFY(internal::UIntPtr(foo0.avec.data())%ALIGNMENT==0); MyClassA fooA; VERIFY(internal::UIntPtr(fooA.avec.data())%ALIGNMENT==0); } // dynamic allocation, single object for (int i=0; iavec.data())%ALIGNMENT==0); MyClassA *fooA = new MyClassA(); VERIFY(internal::UIntPtr(fooA->avec.data())%ALIGNMENT==0); delete foo0; delete fooA; } // dynamic allocation, array const int N = 10; for (int i=0; iavec.data())%ALIGNMENT==0); MyClassA *fooA = new MyClassA[N]; VERIFY(internal::UIntPtr(fooA->avec.data())%ALIGNMENT==0); delete[] foo0; delete[] fooA; } #endif } ================================================ FILE: VO_Module/thirdparty/eigen/test/eigen2support.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #define EIGEN2_SUPPORT #include "main.h" template void eigen2support(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; Index rows = m.rows(); Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols), m3(rows, cols); Scalar s1 = internal::random(), s2 = internal::random(); // scalar addition VERIFY_IS_APPROX(m1.cwise() + s1, s1 + m1.cwise()); VERIFY_IS_APPROX(m1.cwise() + s1, MatrixType::Constant(rows,cols,s1) + m1); VERIFY_IS_APPROX((m1*Scalar(2)).cwise() - s2, (m1+m1) - MatrixType::Constant(rows,cols,s2) ); m3 = m1; m3.cwise() += s2; VERIFY_IS_APPROX(m3, m1.cwise() + s2); m3 = m1; m3.cwise() -= s1; VERIFY_IS_APPROX(m3, m1.cwise() - s1); VERIFY_IS_EQUAL((m1.corner(TopLeft,1,1)), (m1.block(0,0,1,1))); VERIFY_IS_EQUAL((m1.template corner<1,1>(TopLeft)), (m1.template block<1,1>(0,0))); VERIFY_IS_EQUAL((m1.col(0).start(1)), (m1.col(0).segment(0,1))); VERIFY_IS_EQUAL((m1.col(0).template start<1>()), (m1.col(0).segment(0,1))); VERIFY_IS_EQUAL((m1.col(0).end(1)), (m1.col(0).segment(rows-1,1))); VERIFY_IS_EQUAL((m1.col(0).template end<1>()), (m1.col(0).segment(rows-1,1))); using std::cos; using numext::real; using numext::abs2; VERIFY_IS_EQUAL(ei_cos(s1), cos(s1)); VERIFY_IS_EQUAL(ei_real(s1), real(s1)); VERIFY_IS_EQUAL(ei_abs2(s1), abs2(s1)); m1.minor(0,0); } EIGEN_DECLARE_TEST(eigen2support) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( eigen2support(Matrix()) ); CALL_SUBTEST_2( eigen2support(MatrixXd(1,1)) ); CALL_SUBTEST_4( eigen2support(Matrix3f()) ); CALL_SUBTEST_5( eigen2support(Matrix4d()) ); CALL_SUBTEST_2( eigen2support(MatrixXf(200,200)) ); CALL_SUBTEST_6( eigen2support(MatrixXcd(100,100)) ); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/eigensolver_complex.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2009 Gael Guennebaud // Copyright (C) 2010 Jitse Niesen // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include #include #include template bool find_pivot(typename MatrixType::Scalar tol, MatrixType &diffs, Index col=0) { bool match = diffs.diagonal().sum() <= tol; if(match || col==diffs.cols()) { return match; } else { Index n = diffs.cols(); std::vector > transpositions; for(Index i=col; i tol) break; best_index += col; diffs.row(col).swap(diffs.row(best_index)); if(find_pivot(tol,diffs,col+1)) return true; diffs.row(col).swap(diffs.row(best_index)); // move current pivot to the end diffs.row(n-(i-col)-1).swap(diffs.row(best_index)); transpositions.push_back(std::pair(n-(i-col)-1,best_index)); } // restore for(Index k=transpositions.size()-1; k>=0; --k) diffs.row(transpositions[k].first).swap(diffs.row(transpositions[k].second)); } return false; } /* Check that two column vectors are approximately equal up to permutations. * Initially, this method checked that the k-th power sums are equal for all k = 1, ..., vec1.rows(), * however this strategy is numerically inacurate because of numerical cancellation issues. */ template void verify_is_approx_upto_permutation(const VectorType& vec1, const VectorType& vec2) { typedef typename VectorType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; VERIFY(vec1.cols() == 1); VERIFY(vec2.cols() == 1); VERIFY(vec1.rows() == vec2.rows()); Index n = vec1.rows(); RealScalar tol = test_precision()*test_precision()*numext::maxi(vec1.squaredNorm(),vec2.squaredNorm()); Matrix diffs = (vec1.rowwise().replicate(n) - vec2.rowwise().replicate(n).transpose()).cwiseAbs2(); VERIFY( find_pivot(tol, diffs) ); } template void eigensolver(const MatrixType& m) { /* this test covers the following files: ComplexEigenSolver.h, and indirectly ComplexSchur.h */ Index rows = m.rows(); Index cols = m.cols(); typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; MatrixType a = MatrixType::Random(rows,cols); MatrixType symmA = a.adjoint() * a; ComplexEigenSolver ei0(symmA); VERIFY_IS_EQUAL(ei0.info(), Success); VERIFY_IS_APPROX(symmA * ei0.eigenvectors(), ei0.eigenvectors() * ei0.eigenvalues().asDiagonal()); ComplexEigenSolver ei1(a); VERIFY_IS_EQUAL(ei1.info(), Success); VERIFY_IS_APPROX(a * ei1.eigenvectors(), ei1.eigenvectors() * ei1.eigenvalues().asDiagonal()); // Note: If MatrixType is real then a.eigenvalues() uses EigenSolver and thus // another algorithm so results may differ slightly verify_is_approx_upto_permutation(a.eigenvalues(), ei1.eigenvalues()); ComplexEigenSolver ei2; ei2.setMaxIterations(ComplexSchur::m_maxIterationsPerRow * rows).compute(a); VERIFY_IS_EQUAL(ei2.info(), Success); VERIFY_IS_EQUAL(ei2.eigenvectors(), ei1.eigenvectors()); VERIFY_IS_EQUAL(ei2.eigenvalues(), ei1.eigenvalues()); if (rows > 2) { ei2.setMaxIterations(1).compute(a); VERIFY_IS_EQUAL(ei2.info(), NoConvergence); VERIFY_IS_EQUAL(ei2.getMaxIterations(), 1); } ComplexEigenSolver eiNoEivecs(a, false); VERIFY_IS_EQUAL(eiNoEivecs.info(), Success); VERIFY_IS_APPROX(ei1.eigenvalues(), eiNoEivecs.eigenvalues()); // Regression test for issue #66 MatrixType z = MatrixType::Zero(rows,cols); ComplexEigenSolver eiz(z); VERIFY((eiz.eigenvalues().cwiseEqual(0)).all()); MatrixType id = MatrixType::Identity(rows, cols); VERIFY_IS_APPROX(id.operatorNorm(), RealScalar(1)); if (rows > 1 && rows < 20) { // Test matrix with NaN a(0,0) = std::numeric_limits::quiet_NaN(); ComplexEigenSolver eiNaN(a); VERIFY_IS_EQUAL(eiNaN.info(), NoConvergence); } // regression test for bug 1098 { ComplexEigenSolver eig(a.adjoint() * a); eig.compute(a.adjoint() * a); } // regression test for bug 478 { a.setZero(); ComplexEigenSolver ei3(a); VERIFY_IS_EQUAL(ei3.info(), Success); VERIFY_IS_MUCH_SMALLER_THAN(ei3.eigenvalues().norm(),RealScalar(1)); VERIFY((ei3.eigenvectors().transpose()*ei3.eigenvectors().transpose()).eval().isIdentity()); } } template void eigensolver_verify_assert(const MatrixType& m) { ComplexEigenSolver eig; VERIFY_RAISES_ASSERT(eig.eigenvectors()); VERIFY_RAISES_ASSERT(eig.eigenvalues()); MatrixType a = MatrixType::Random(m.rows(),m.cols()); eig.compute(a, false); VERIFY_RAISES_ASSERT(eig.eigenvectors()); } EIGEN_DECLARE_TEST(eigensolver_complex) { int s = 0; for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( eigensolver(Matrix4cf()) ); s = internal::random(1,EIGEN_TEST_MAX_SIZE/4); CALL_SUBTEST_2( eigensolver(MatrixXcd(s,s)) ); CALL_SUBTEST_3( eigensolver(Matrix, 1, 1>()) ); CALL_SUBTEST_4( eigensolver(Matrix3f()) ); TEST_SET_BUT_UNUSED_VARIABLE(s) } CALL_SUBTEST_1( eigensolver_verify_assert(Matrix4cf()) ); s = internal::random(1,EIGEN_TEST_MAX_SIZE/4); CALL_SUBTEST_2( eigensolver_verify_assert(MatrixXcd(s,s)) ); CALL_SUBTEST_3( eigensolver_verify_assert(Matrix, 1, 1>()) ); CALL_SUBTEST_4( eigensolver_verify_assert(Matrix3f()) ); // Test problem size constructors CALL_SUBTEST_5(ComplexEigenSolver tmp(s)); TEST_SET_BUT_UNUSED_VARIABLE(s) } ================================================ FILE: VO_Module/thirdparty/eigen/test/eigensolver_generalized_real.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012-2016 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #define EIGEN_RUNTIME_NO_MALLOC #include "main.h" #include #include #include template void generalized_eigensolver_real(const MatrixType& m) { /* this test covers the following files: GeneralizedEigenSolver.h */ Index rows = m.rows(); Index cols = m.cols(); typedef typename MatrixType::Scalar Scalar; typedef std::complex ComplexScalar; typedef Matrix VectorType; MatrixType a = MatrixType::Random(rows,cols); MatrixType b = MatrixType::Random(rows,cols); MatrixType a1 = MatrixType::Random(rows,cols); MatrixType b1 = MatrixType::Random(rows,cols); MatrixType spdA = a.adjoint() * a + a1.adjoint() * a1; MatrixType spdB = b.adjoint() * b + b1.adjoint() * b1; // lets compare to GeneralizedSelfAdjointEigenSolver { GeneralizedSelfAdjointEigenSolver symmEig(spdA, spdB); GeneralizedEigenSolver eig(spdA, spdB); VERIFY_IS_EQUAL(eig.eigenvalues().imag().cwiseAbs().maxCoeff(), 0); VectorType realEigenvalues = eig.eigenvalues().real(); std::sort(realEigenvalues.data(), realEigenvalues.data()+realEigenvalues.size()); VERIFY_IS_APPROX(realEigenvalues, symmEig.eigenvalues()); // check eigenvectors typename GeneralizedEigenSolver::EigenvectorsType D = eig.eigenvalues().asDiagonal(); typename GeneralizedEigenSolver::EigenvectorsType V = eig.eigenvectors(); VERIFY_IS_APPROX(spdA*V, spdB*V*D); } // non symmetric case: { GeneralizedEigenSolver eig(rows); // TODO enable full-prealocation of required memory, this probably requires an in-place mode for HessenbergDecomposition //Eigen::internal::set_is_malloc_allowed(false); eig.compute(a,b); //Eigen::internal::set_is_malloc_allowed(true); for(Index k=0; k tmp = (eig.betas()(k)*a).template cast() - eig.alphas()(k)*b; if(tmp.size()>1 && tmp.norm()>(std::numeric_limits::min)()) tmp /= tmp.norm(); VERIFY_IS_MUCH_SMALLER_THAN( std::abs(tmp.determinant()), Scalar(1) ); } // check eigenvectors typename GeneralizedEigenSolver::EigenvectorsType D = eig.eigenvalues().asDiagonal(); typename GeneralizedEigenSolver::EigenvectorsType V = eig.eigenvectors(); VERIFY_IS_APPROX(a*V, b*V*D); } // regression test for bug 1098 { GeneralizedSelfAdjointEigenSolver eig1(a.adjoint() * a,b.adjoint() * b); eig1.compute(a.adjoint() * a,b.adjoint() * b); GeneralizedEigenSolver eig2(a.adjoint() * a,b.adjoint() * b); eig2.compute(a.adjoint() * a,b.adjoint() * b); } // check without eigenvectors { GeneralizedEigenSolver eig1(spdA, spdB, true); GeneralizedEigenSolver eig2(spdA, spdB, false); VERIFY_IS_APPROX(eig1.eigenvalues(), eig2.eigenvalues()); } } EIGEN_DECLARE_TEST(eigensolver_generalized_real) { for(int i = 0; i < g_repeat; i++) { int s = 0; CALL_SUBTEST_1( generalized_eigensolver_real(Matrix4f()) ); s = internal::random(1,EIGEN_TEST_MAX_SIZE/4); CALL_SUBTEST_2( generalized_eigensolver_real(MatrixXd(s,s)) ); // some trivial but implementation-wise special cases CALL_SUBTEST_2( generalized_eigensolver_real(MatrixXd(1,1)) ); CALL_SUBTEST_2( generalized_eigensolver_real(MatrixXd(2,2)) ); CALL_SUBTEST_3( generalized_eigensolver_real(Matrix()) ); CALL_SUBTEST_4( generalized_eigensolver_real(Matrix2d()) ); TEST_SET_BUT_UNUSED_VARIABLE(s) } } ================================================ FILE: VO_Module/thirdparty/eigen/test/eigensolver_generic.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // Copyright (C) 2010,2012 Jitse Niesen // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include #include template void check_eigensolver_for_given_mat(const EigType &eig, const MatType& a) { typedef typename NumTraits::Real RealScalar; typedef Matrix RealVectorType; typedef typename std::complex Complex; Index n = a.rows(); VERIFY_IS_EQUAL(eig.info(), Success); VERIFY_IS_APPROX(a * eig.pseudoEigenvectors(), eig.pseudoEigenvectors() * eig.pseudoEigenvalueMatrix()); VERIFY_IS_APPROX(a.template cast() * eig.eigenvectors(), eig.eigenvectors() * eig.eigenvalues().asDiagonal()); VERIFY_IS_APPROX(eig.eigenvectors().colwise().norm(), RealVectorType::Ones(n).transpose()); VERIFY_IS_APPROX(a.eigenvalues(), eig.eigenvalues()); } template void eigensolver(const MatrixType& m) { /* this test covers the following files: EigenSolver.h */ Index rows = m.rows(); Index cols = m.cols(); typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef typename std::complex Complex; MatrixType a = MatrixType::Random(rows,cols); MatrixType a1 = MatrixType::Random(rows,cols); MatrixType symmA = a.adjoint() * a + a1.adjoint() * a1; EigenSolver ei0(symmA); VERIFY_IS_EQUAL(ei0.info(), Success); VERIFY_IS_APPROX(symmA * ei0.pseudoEigenvectors(), ei0.pseudoEigenvectors() * ei0.pseudoEigenvalueMatrix()); VERIFY_IS_APPROX((symmA.template cast()) * (ei0.pseudoEigenvectors().template cast()), (ei0.pseudoEigenvectors().template cast()) * (ei0.eigenvalues().asDiagonal())); EigenSolver ei1(a); CALL_SUBTEST( check_eigensolver_for_given_mat(ei1,a) ); EigenSolver ei2; ei2.setMaxIterations(RealSchur::m_maxIterationsPerRow * rows).compute(a); VERIFY_IS_EQUAL(ei2.info(), Success); VERIFY_IS_EQUAL(ei2.eigenvectors(), ei1.eigenvectors()); VERIFY_IS_EQUAL(ei2.eigenvalues(), ei1.eigenvalues()); if (rows > 2) { ei2.setMaxIterations(1).compute(a); VERIFY_IS_EQUAL(ei2.info(), NoConvergence); VERIFY_IS_EQUAL(ei2.getMaxIterations(), 1); } EigenSolver eiNoEivecs(a, false); VERIFY_IS_EQUAL(eiNoEivecs.info(), Success); VERIFY_IS_APPROX(ei1.eigenvalues(), eiNoEivecs.eigenvalues()); VERIFY_IS_APPROX(ei1.pseudoEigenvalueMatrix(), eiNoEivecs.pseudoEigenvalueMatrix()); MatrixType id = MatrixType::Identity(rows, cols); VERIFY_IS_APPROX(id.operatorNorm(), RealScalar(1)); if (rows > 2 && rows < 20) { // Test matrix with NaN a(0,0) = std::numeric_limits::quiet_NaN(); EigenSolver eiNaN(a); VERIFY_IS_NOT_EQUAL(eiNaN.info(), Success); } // regression test for bug 1098 { EigenSolver eig(a.adjoint() * a); eig.compute(a.adjoint() * a); } // regression test for bug 478 { a.setZero(); EigenSolver ei3(a); VERIFY_IS_EQUAL(ei3.info(), Success); VERIFY_IS_MUCH_SMALLER_THAN(ei3.eigenvalues().norm(),RealScalar(1)); VERIFY((ei3.eigenvectors().transpose()*ei3.eigenvectors().transpose()).eval().isIdentity()); } } template void eigensolver_verify_assert(const MatrixType& m) { EigenSolver eig; VERIFY_RAISES_ASSERT(eig.eigenvectors()); VERIFY_RAISES_ASSERT(eig.pseudoEigenvectors()); VERIFY_RAISES_ASSERT(eig.pseudoEigenvalueMatrix()); VERIFY_RAISES_ASSERT(eig.eigenvalues()); MatrixType a = MatrixType::Random(m.rows(),m.cols()); eig.compute(a, false); VERIFY_RAISES_ASSERT(eig.eigenvectors()); VERIFY_RAISES_ASSERT(eig.pseudoEigenvectors()); } template Matrix make_companion(const CoeffType& coeffs) { Index n = coeffs.size()-1; Matrix res(n,n); res.setZero(); res.row(0) = -coeffs.tail(n) / coeffs(0); res.diagonal(-1).setOnes(); return res; } template void eigensolver_generic_extra() { { // regression test for bug 793 MatrixXd a(3,3); a << 0, 0, 1, 1, 1, 1, 1, 1e+200, 1; Eigen::EigenSolver eig(a); double scale = 1e-200; // scale to avoid overflow during the comparisons VERIFY_IS_APPROX(a * eig.pseudoEigenvectors()*scale, eig.pseudoEigenvectors() * eig.pseudoEigenvalueMatrix()*scale); VERIFY_IS_APPROX(a * eig.eigenvectors()*scale, eig.eigenvectors() * eig.eigenvalues().asDiagonal()*scale); } { // check a case where all eigenvalues are null. MatrixXd a(2,2); a << 1, 1, -1, -1; Eigen::EigenSolver eig(a); VERIFY_IS_APPROX(eig.pseudoEigenvectors().squaredNorm(), 2.); VERIFY_IS_APPROX((a * eig.pseudoEigenvectors()).norm()+1., 1.); VERIFY_IS_APPROX((eig.pseudoEigenvectors() * eig.pseudoEigenvalueMatrix()).norm()+1., 1.); VERIFY_IS_APPROX((a * eig.eigenvectors()).norm()+1., 1.); VERIFY_IS_APPROX((eig.eigenvectors() * eig.eigenvalues().asDiagonal()).norm()+1., 1.); } // regression test for bug 933 { { VectorXd coeffs(5); coeffs << 1, -3, -175, -225, 2250; MatrixXd C = make_companion(coeffs); EigenSolver eig(C); CALL_SUBTEST( check_eigensolver_for_given_mat(eig,C) ); } { // this test is tricky because it requires high accuracy in smallest eigenvalues VectorXd coeffs(5); coeffs << 6.154671e-15, -1.003870e-10, -9.819570e-01, 3.995715e+03, 2.211511e+08; MatrixXd C = make_companion(coeffs); EigenSolver eig(C); CALL_SUBTEST( check_eigensolver_for_given_mat(eig,C) ); Index n = C.rows(); for(Index i=0;i Complex; MatrixXcd ac = C.cast(); ac.diagonal().array() -= eig.eigenvalues()(i); VectorXd sv = ac.jacobiSvd().singularValues(); // comparing to sv(0) is not enough here to catch the "bug", // the hard-coded 1.0 is important! VERIFY_IS_MUCH_SMALLER_THAN(sv(n-1), 1.0); } } } // regression test for bug 1557 { // this test is interesting because it contains zeros on the diagonal. MatrixXd A_bug1557(3,3); A_bug1557 << 0, 0, 0, 1, 0, 0.5887907064808635127, 0, 1, 0; EigenSolver eig(A_bug1557); CALL_SUBTEST( check_eigensolver_for_given_mat(eig,A_bug1557) ); } // regression test for bug 1174 { Index n = 12; MatrixXf A_bug1174(n,n); A_bug1174 << 262144, 0, 0, 262144, 786432, 0, 0, 0, 0, 0, 0, 786432, 262144, 0, 0, 262144, 786432, 0, 0, 0, 0, 0, 0, 786432, 262144, 0, 0, 262144, 786432, 0, 0, 0, 0, 0, 0, 786432, 262144, 0, 0, 262144, 786432, 0, 0, 0, 0, 0, 0, 786432, 0, 262144, 262144, 0, 0, 262144, 262144, 262144, 262144, 262144, 262144, 0, 0, 262144, 262144, 0, 0, 262144, 262144, 262144, 262144, 262144, 262144, 0, 0, 262144, 262144, 0, 0, 262144, 262144, 262144, 262144, 262144, 262144, 0, 0, 262144, 262144, 0, 0, 262144, 262144, 262144, 262144, 262144, 262144, 0, 0, 262144, 262144, 0, 0, 262144, 262144, 262144, 262144, 262144, 262144, 0, 0, 262144, 262144, 0, 0, 262144, 262144, 262144, 262144, 262144, 262144, 0, 0, 262144, 262144, 0, 0, 262144, 262144, 262144, 262144, 262144, 262144, 0, 0, 262144, 262144, 0, 0, 262144, 262144, 262144, 262144, 262144, 262144, 0; EigenSolver eig(A_bug1174); CALL_SUBTEST( check_eigensolver_for_given_mat(eig,A_bug1174) ); } } EIGEN_DECLARE_TEST(eigensolver_generic) { int s = 0; for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( eigensolver(Matrix4f()) ); s = internal::random(1,EIGEN_TEST_MAX_SIZE/4); CALL_SUBTEST_2( eigensolver(MatrixXd(s,s)) ); TEST_SET_BUT_UNUSED_VARIABLE(s) // some trivial but implementation-wise tricky cases CALL_SUBTEST_2( eigensolver(MatrixXd(1,1)) ); CALL_SUBTEST_2( eigensolver(MatrixXd(2,2)) ); CALL_SUBTEST_3( eigensolver(Matrix()) ); CALL_SUBTEST_4( eigensolver(Matrix2d()) ); } CALL_SUBTEST_1( eigensolver_verify_assert(Matrix4f()) ); s = internal::random(1,EIGEN_TEST_MAX_SIZE/4); CALL_SUBTEST_2( eigensolver_verify_assert(MatrixXd(s,s)) ); CALL_SUBTEST_3( eigensolver_verify_assert(Matrix()) ); CALL_SUBTEST_4( eigensolver_verify_assert(Matrix2d()) ); // Test problem size constructors CALL_SUBTEST_5(EigenSolver tmp(s)); // regression test for bug 410 CALL_SUBTEST_2( { MatrixXd A(1,1); A(0,0) = std::sqrt(-1.); // is Not-a-Number Eigen::EigenSolver solver(A); VERIFY_IS_EQUAL(solver.info(), NumericalIssue); } ); CALL_SUBTEST_2( eigensolver_generic_extra<0>() ); TEST_SET_BUT_UNUSED_VARIABLE(s) } ================================================ FILE: VO_Module/thirdparty/eigen/test/eigensolver_selfadjoint.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // Copyright (C) 2010 Jitse Niesen // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include "svd_fill.h" #include #include #include template void selfadjointeigensolver_essential_check(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; RealScalar eival_eps = numext::mini(test_precision(), NumTraits::dummy_precision()*20000); SelfAdjointEigenSolver eiSymm(m); VERIFY_IS_EQUAL(eiSymm.info(), Success); RealScalar scaling = m.cwiseAbs().maxCoeff(); if(scaling<(std::numeric_limits::min)()) { VERIFY(eiSymm.eigenvalues().cwiseAbs().maxCoeff() <= (std::numeric_limits::min)()); } else { VERIFY_IS_APPROX((m.template selfadjointView() * eiSymm.eigenvectors())/scaling, (eiSymm.eigenvectors() * eiSymm.eigenvalues().asDiagonal())/scaling); } VERIFY_IS_APPROX(m.template selfadjointView().eigenvalues(), eiSymm.eigenvalues()); VERIFY_IS_UNITARY(eiSymm.eigenvectors()); if(m.cols()<=4) { SelfAdjointEigenSolver eiDirect; eiDirect.computeDirect(m); VERIFY_IS_EQUAL(eiDirect.info(), Success); if(! eiSymm.eigenvalues().isApprox(eiDirect.eigenvalues(), eival_eps) ) { std::cerr << "reference eigenvalues: " << eiSymm.eigenvalues().transpose() << "\n" << "obtained eigenvalues: " << eiDirect.eigenvalues().transpose() << "\n" << "diff: " << (eiSymm.eigenvalues()-eiDirect.eigenvalues()).transpose() << "\n" << "error (eps): " << (eiSymm.eigenvalues()-eiDirect.eigenvalues()).norm() / eiSymm.eigenvalues().norm() << " (" << eival_eps << ")\n"; } if(scaling<(std::numeric_limits::min)()) { VERIFY(eiDirect.eigenvalues().cwiseAbs().maxCoeff() <= (std::numeric_limits::min)()); } else { VERIFY_IS_APPROX(eiSymm.eigenvalues()/scaling, eiDirect.eigenvalues()/scaling); VERIFY_IS_APPROX((m.template selfadjointView() * eiDirect.eigenvectors())/scaling, (eiDirect.eigenvectors() * eiDirect.eigenvalues().asDiagonal())/scaling); VERIFY_IS_APPROX(m.template selfadjointView().eigenvalues()/scaling, eiDirect.eigenvalues()/scaling); } VERIFY_IS_UNITARY(eiDirect.eigenvectors()); } } template void selfadjointeigensolver(const MatrixType& m) { /* this test covers the following files: EigenSolver.h, SelfAdjointEigenSolver.h (and indirectly: Tridiagonalization.h) */ Index rows = m.rows(); Index cols = m.cols(); typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; RealScalar largerEps = 10*test_precision(); MatrixType a = MatrixType::Random(rows,cols); MatrixType a1 = MatrixType::Random(rows,cols); MatrixType symmA = a.adjoint() * a + a1.adjoint() * a1; MatrixType symmC = symmA; svd_fill_random(symmA,Symmetric); symmA.template triangularView().setZero(); symmC.template triangularView().setZero(); MatrixType b = MatrixType::Random(rows,cols); MatrixType b1 = MatrixType::Random(rows,cols); MatrixType symmB = b.adjoint() * b + b1.adjoint() * b1; symmB.template triangularView().setZero(); CALL_SUBTEST( selfadjointeigensolver_essential_check(symmA) ); SelfAdjointEigenSolver eiSymm(symmA); // generalized eigen pb GeneralizedSelfAdjointEigenSolver eiSymmGen(symmC, symmB); SelfAdjointEigenSolver eiSymmNoEivecs(symmA, false); VERIFY_IS_EQUAL(eiSymmNoEivecs.info(), Success); VERIFY_IS_APPROX(eiSymm.eigenvalues(), eiSymmNoEivecs.eigenvalues()); // generalized eigen problem Ax = lBx eiSymmGen.compute(symmC, symmB,Ax_lBx); VERIFY_IS_EQUAL(eiSymmGen.info(), Success); VERIFY((symmC.template selfadjointView() * eiSymmGen.eigenvectors()).isApprox( symmB.template selfadjointView() * (eiSymmGen.eigenvectors() * eiSymmGen.eigenvalues().asDiagonal()), largerEps)); // generalized eigen problem BAx = lx eiSymmGen.compute(symmC, symmB,BAx_lx); VERIFY_IS_EQUAL(eiSymmGen.info(), Success); VERIFY((symmB.template selfadjointView() * (symmC.template selfadjointView() * eiSymmGen.eigenvectors())).isApprox( (eiSymmGen.eigenvectors() * eiSymmGen.eigenvalues().asDiagonal()), largerEps)); // generalized eigen problem ABx = lx eiSymmGen.compute(symmC, symmB,ABx_lx); VERIFY_IS_EQUAL(eiSymmGen.info(), Success); VERIFY((symmC.template selfadjointView() * (symmB.template selfadjointView() * eiSymmGen.eigenvectors())).isApprox( (eiSymmGen.eigenvectors() * eiSymmGen.eigenvalues().asDiagonal()), largerEps)); eiSymm.compute(symmC); MatrixType sqrtSymmA = eiSymm.operatorSqrt(); VERIFY_IS_APPROX(MatrixType(symmC.template selfadjointView()), sqrtSymmA*sqrtSymmA); VERIFY_IS_APPROX(sqrtSymmA, symmC.template selfadjointView()*eiSymm.operatorInverseSqrt()); MatrixType id = MatrixType::Identity(rows, cols); VERIFY_IS_APPROX(id.template selfadjointView().operatorNorm(), RealScalar(1)); SelfAdjointEigenSolver eiSymmUninitialized; VERIFY_RAISES_ASSERT(eiSymmUninitialized.info()); VERIFY_RAISES_ASSERT(eiSymmUninitialized.eigenvalues()); VERIFY_RAISES_ASSERT(eiSymmUninitialized.eigenvectors()); VERIFY_RAISES_ASSERT(eiSymmUninitialized.operatorSqrt()); VERIFY_RAISES_ASSERT(eiSymmUninitialized.operatorInverseSqrt()); eiSymmUninitialized.compute(symmA, false); VERIFY_RAISES_ASSERT(eiSymmUninitialized.eigenvectors()); VERIFY_RAISES_ASSERT(eiSymmUninitialized.operatorSqrt()); VERIFY_RAISES_ASSERT(eiSymmUninitialized.operatorInverseSqrt()); // test Tridiagonalization's methods Tridiagonalization tridiag(symmC); VERIFY_IS_APPROX(tridiag.diagonal(), tridiag.matrixT().diagonal()); VERIFY_IS_APPROX(tridiag.subDiagonal(), tridiag.matrixT().template diagonal<-1>()); Matrix T = tridiag.matrixT(); if(rows>1 && cols>1) { // FIXME check that upper and lower part are 0: //VERIFY(T.topRightCorner(rows-2, cols-2).template triangularView().isZero()); } VERIFY_IS_APPROX(tridiag.diagonal(), T.diagonal()); VERIFY_IS_APPROX(tridiag.subDiagonal(), T.template diagonal<1>()); VERIFY_IS_APPROX(MatrixType(symmC.template selfadjointView()), tridiag.matrixQ() * tridiag.matrixT().eval() * MatrixType(tridiag.matrixQ()).adjoint()); VERIFY_IS_APPROX(MatrixType(symmC.template selfadjointView()), tridiag.matrixQ() * tridiag.matrixT() * tridiag.matrixQ().adjoint()); // Test computation of eigenvalues from tridiagonal matrix if(rows > 1) { SelfAdjointEigenSolver eiSymmTridiag; eiSymmTridiag.computeFromTridiagonal(tridiag.matrixT().diagonal(), tridiag.matrixT().diagonal(-1), ComputeEigenvectors); VERIFY_IS_APPROX(eiSymm.eigenvalues(), eiSymmTridiag.eigenvalues()); VERIFY_IS_APPROX(tridiag.matrixT(), eiSymmTridiag.eigenvectors().real() * eiSymmTridiag.eigenvalues().asDiagonal() * eiSymmTridiag.eigenvectors().real().transpose()); } if (rows > 1 && rows < 20) { // Test matrix with NaN symmC(0,0) = std::numeric_limits::quiet_NaN(); SelfAdjointEigenSolver eiSymmNaN(symmC); VERIFY_IS_EQUAL(eiSymmNaN.info(), NoConvergence); } // regression test for bug 1098 { SelfAdjointEigenSolver eig(a.adjoint() * a); eig.compute(a.adjoint() * a); } // regression test for bug 478 { a.setZero(); SelfAdjointEigenSolver ei3(a); VERIFY_IS_EQUAL(ei3.info(), Success); VERIFY_IS_MUCH_SMALLER_THAN(ei3.eigenvalues().norm(),RealScalar(1)); VERIFY((ei3.eigenvectors().transpose()*ei3.eigenvectors().transpose()).eval().isIdentity()); } } template void bug_854() { Matrix3d m; m << 850.961, 51.966, 0, 51.966, 254.841, 0, 0, 0, 0; selfadjointeigensolver_essential_check(m); } template void bug_1014() { Matrix3d m; m << 0.11111111111111114658, 0, 0, 0, 0.11111111111111109107, 0, 0, 0, 0.11111111111111107719; selfadjointeigensolver_essential_check(m); } template void bug_1225() { Matrix3d m1, m2; m1.setRandom(); m1 = m1*m1.transpose(); m2 = m1.triangularView(); SelfAdjointEigenSolver eig1(m1); SelfAdjointEigenSolver eig2(m2.selfadjointView()); VERIFY_IS_APPROX(eig1.eigenvalues(), eig2.eigenvalues()); } template void bug_1204() { SparseMatrix A(2,2); A.setIdentity(); SelfAdjointEigenSolver > eig(A); } EIGEN_DECLARE_TEST(eigensolver_selfadjoint) { int s = 0; for(int i = 0; i < g_repeat; i++) { // trivial test for 1x1 matrices: CALL_SUBTEST_1( selfadjointeigensolver(Matrix())); CALL_SUBTEST_1( selfadjointeigensolver(Matrix())); CALL_SUBTEST_1( selfadjointeigensolver(Matrix, 1, 1>())); // very important to test 3x3 and 2x2 matrices since we provide special paths for them CALL_SUBTEST_12( selfadjointeigensolver(Matrix2f()) ); CALL_SUBTEST_12( selfadjointeigensolver(Matrix2d()) ); CALL_SUBTEST_12( selfadjointeigensolver(Matrix2cd()) ); CALL_SUBTEST_13( selfadjointeigensolver(Matrix3f()) ); CALL_SUBTEST_13( selfadjointeigensolver(Matrix3d()) ); CALL_SUBTEST_13( selfadjointeigensolver(Matrix3cd()) ); CALL_SUBTEST_2( selfadjointeigensolver(Matrix4d()) ); CALL_SUBTEST_2( selfadjointeigensolver(Matrix4cd()) ); s = internal::random(1,EIGEN_TEST_MAX_SIZE/4); CALL_SUBTEST_3( selfadjointeigensolver(MatrixXf(s,s)) ); CALL_SUBTEST_4( selfadjointeigensolver(MatrixXd(s,s)) ); CALL_SUBTEST_5( selfadjointeigensolver(MatrixXcd(s,s)) ); CALL_SUBTEST_9( selfadjointeigensolver(Matrix,Dynamic,Dynamic,RowMajor>(s,s)) ); TEST_SET_BUT_UNUSED_VARIABLE(s) // some trivial but implementation-wise tricky cases CALL_SUBTEST_4( selfadjointeigensolver(MatrixXd(1,1)) ); CALL_SUBTEST_4( selfadjointeigensolver(MatrixXd(2,2)) ); CALL_SUBTEST_5( selfadjointeigensolver(MatrixXcd(1,1)) ); CALL_SUBTEST_5( selfadjointeigensolver(MatrixXcd(2,2)) ); CALL_SUBTEST_6( selfadjointeigensolver(Matrix()) ); CALL_SUBTEST_7( selfadjointeigensolver(Matrix()) ); } CALL_SUBTEST_13( bug_854<0>() ); CALL_SUBTEST_13( bug_1014<0>() ); CALL_SUBTEST_13( bug_1204<0>() ); CALL_SUBTEST_13( bug_1225<0>() ); // Test problem size constructors s = internal::random(1,EIGEN_TEST_MAX_SIZE/4); CALL_SUBTEST_8(SelfAdjointEigenSolver tmp1(s)); CALL_SUBTEST_8(Tridiagonalization tmp2(s)); TEST_SET_BUT_UNUSED_VARIABLE(s) } ================================================ FILE: VO_Module/thirdparty/eigen/test/evaluator_common.h ================================================ ================================================ FILE: VO_Module/thirdparty/eigen/test/evaluators.cpp ================================================ #include "main.h" namespace Eigen { template const Product prod(const Lhs& lhs, const Rhs& rhs) { return Product(lhs,rhs); } template const Product lazyprod(const Lhs& lhs, const Rhs& rhs) { return Product(lhs,rhs); } template EIGEN_STRONG_INLINE DstXprType& copy_using_evaluator(const EigenBase &dst, const SrcXprType &src) { call_assignment(dst.const_cast_derived(), src.derived(), internal::assign_op()); return dst.const_cast_derived(); } template class StorageBase, typename SrcXprType> EIGEN_STRONG_INLINE const DstXprType& copy_using_evaluator(const NoAlias& dst, const SrcXprType &src) { call_assignment(dst, src.derived(), internal::assign_op()); return dst.expression(); } template EIGEN_STRONG_INLINE DstXprType& copy_using_evaluator(const PlainObjectBase &dst, const SrcXprType &src) { #ifdef EIGEN_NO_AUTOMATIC_RESIZING eigen_assert((dst.size()==0 || (IsVectorAtCompileTime ? (dst.size() == src.size()) : (dst.rows() == src.rows() && dst.cols() == src.cols()))) && "Size mismatch. Automatic resizing is disabled because EIGEN_NO_AUTOMATIC_RESIZING is defined"); #else dst.const_cast_derived().resizeLike(src.derived()); #endif call_assignment(dst.const_cast_derived(), src.derived(), internal::assign_op()); return dst.const_cast_derived(); } template void add_assign_using_evaluator(const DstXprType& dst, const SrcXprType& src) { typedef typename DstXprType::Scalar Scalar; call_assignment(const_cast(dst), src.derived(), internal::add_assign_op()); } template void subtract_assign_using_evaluator(const DstXprType& dst, const SrcXprType& src) { typedef typename DstXprType::Scalar Scalar; call_assignment(const_cast(dst), src.derived(), internal::sub_assign_op()); } template void multiply_assign_using_evaluator(const DstXprType& dst, const SrcXprType& src) { typedef typename DstXprType::Scalar Scalar; call_assignment(dst.const_cast_derived(), src.derived(), internal::mul_assign_op()); } template void divide_assign_using_evaluator(const DstXprType& dst, const SrcXprType& src) { typedef typename DstXprType::Scalar Scalar; call_assignment(dst.const_cast_derived(), src.derived(), internal::div_assign_op()); } template void swap_using_evaluator(const DstXprType& dst, const SrcXprType& src) { typedef typename DstXprType::Scalar Scalar; call_assignment(dst.const_cast_derived(), src.const_cast_derived(), internal::swap_assign_op()); } namespace internal { template class StorageBase, typename Src, typename Func> EIGEN_DEVICE_FUNC void call_assignment(const NoAlias& dst, const Src& src, const Func& func) { call_assignment_no_alias(dst.expression(), src, func); } template class StorageBase, typename Src, typename Func> EIGEN_DEVICE_FUNC void call_restricted_packet_assignment(const NoAlias& dst, const Src& src, const Func& func) { call_restricted_packet_assignment_no_alias(dst.expression(), src, func); } } } template long get_cost(const XprType& ) { return Eigen::internal::evaluator::CoeffReadCost; } using namespace std; #define VERIFY_IS_APPROX_EVALUATOR(DEST,EXPR) VERIFY_IS_APPROX(copy_using_evaluator(DEST,(EXPR)), (EXPR).eval()); #define VERIFY_IS_APPROX_EVALUATOR2(DEST,EXPR,REF) VERIFY_IS_APPROX(copy_using_evaluator(DEST,(EXPR)), (REF).eval()); EIGEN_DECLARE_TEST(evaluators) { // Testing Matrix evaluator and Transpose Vector2d v = Vector2d::Random(); const Vector2d v_const(v); Vector2d v2; RowVector2d w; VERIFY_IS_APPROX_EVALUATOR(v2, v); VERIFY_IS_APPROX_EVALUATOR(v2, v_const); // Testing Transpose VERIFY_IS_APPROX_EVALUATOR(w, v.transpose()); // Transpose as rvalue VERIFY_IS_APPROX_EVALUATOR(w, v_const.transpose()); copy_using_evaluator(w.transpose(), v); // Transpose as lvalue VERIFY_IS_APPROX(w,v.transpose().eval()); copy_using_evaluator(w.transpose(), v_const); VERIFY_IS_APPROX(w,v_const.transpose().eval()); // Testing Array evaluator { ArrayXXf a(2,3); ArrayXXf b(3,2); a << 1,2,3, 4,5,6; const ArrayXXf a_const(a); VERIFY_IS_APPROX_EVALUATOR(b, a.transpose()); VERIFY_IS_APPROX_EVALUATOR(b, a_const.transpose()); // Testing CwiseNullaryOp evaluator copy_using_evaluator(w, RowVector2d::Random()); VERIFY((w.array() >= -1).all() && (w.array() <= 1).all()); // not easy to test ... VERIFY_IS_APPROX_EVALUATOR(w, RowVector2d::Zero()); VERIFY_IS_APPROX_EVALUATOR(w, RowVector2d::Constant(3)); // mix CwiseNullaryOp and transpose VERIFY_IS_APPROX_EVALUATOR(w, Vector2d::Zero().transpose()); } { // test product expressions int s = internal::random(1,100); MatrixXf a(s,s), b(s,s), c(s,s), d(s,s); a.setRandom(); b.setRandom(); c.setRandom(); d.setRandom(); VERIFY_IS_APPROX_EVALUATOR(d, (a + b)); VERIFY_IS_APPROX_EVALUATOR(d, (a + b).transpose()); VERIFY_IS_APPROX_EVALUATOR2(d, prod(a,b), a*b); VERIFY_IS_APPROX_EVALUATOR2(d.noalias(), prod(a,b), a*b); VERIFY_IS_APPROX_EVALUATOR2(d, prod(a,b) + c, a*b + c); VERIFY_IS_APPROX_EVALUATOR2(d, s * prod(a,b), s * a*b); VERIFY_IS_APPROX_EVALUATOR2(d, prod(a,b).transpose(), (a*b).transpose()); VERIFY_IS_APPROX_EVALUATOR2(d, prod(a,b) + prod(b,c), a*b + b*c); // check that prod works even with aliasing present c = a*a; copy_using_evaluator(a, prod(a,a)); VERIFY_IS_APPROX(a,c); // check compound assignment of products d = c; add_assign_using_evaluator(c.noalias(), prod(a,b)); d.noalias() += a*b; VERIFY_IS_APPROX(c, d); d = c; subtract_assign_using_evaluator(c.noalias(), prod(a,b)); d.noalias() -= a*b; VERIFY_IS_APPROX(c, d); } { // test product with all possible sizes int s = internal::random(1,100); Matrix m11, res11; m11.setRandom(1,1); Matrix m14, res14; m14.setRandom(1,4); Matrix m1X, res1X; m1X.setRandom(1,s); Matrix m41, res41; m41.setRandom(4,1); Matrix m44, res44; m44.setRandom(4,4); Matrix m4X, res4X; m4X.setRandom(4,s); Matrix mX1, resX1; mX1.setRandom(s,1); Matrix mX4, resX4; mX4.setRandom(s,4); Matrix mXX, resXX; mXX.setRandom(s,s); VERIFY_IS_APPROX_EVALUATOR2(res11, prod(m11,m11), m11*m11); VERIFY_IS_APPROX_EVALUATOR2(res11, prod(m14,m41), m14*m41); VERIFY_IS_APPROX_EVALUATOR2(res11, prod(m1X,mX1), m1X*mX1); VERIFY_IS_APPROX_EVALUATOR2(res14, prod(m11,m14), m11*m14); VERIFY_IS_APPROX_EVALUATOR2(res14, prod(m14,m44), m14*m44); VERIFY_IS_APPROX_EVALUATOR2(res14, prod(m1X,mX4), m1X*mX4); VERIFY_IS_APPROX_EVALUATOR2(res1X, prod(m11,m1X), m11*m1X); VERIFY_IS_APPROX_EVALUATOR2(res1X, prod(m14,m4X), m14*m4X); VERIFY_IS_APPROX_EVALUATOR2(res1X, prod(m1X,mXX), m1X*mXX); VERIFY_IS_APPROX_EVALUATOR2(res41, prod(m41,m11), m41*m11); VERIFY_IS_APPROX_EVALUATOR2(res41, prod(m44,m41), m44*m41); VERIFY_IS_APPROX_EVALUATOR2(res41, prod(m4X,mX1), m4X*mX1); VERIFY_IS_APPROX_EVALUATOR2(res44, prod(m41,m14), m41*m14); VERIFY_IS_APPROX_EVALUATOR2(res44, prod(m44,m44), m44*m44); VERIFY_IS_APPROX_EVALUATOR2(res44, prod(m4X,mX4), m4X*mX4); VERIFY_IS_APPROX_EVALUATOR2(res4X, prod(m41,m1X), m41*m1X); VERIFY_IS_APPROX_EVALUATOR2(res4X, prod(m44,m4X), m44*m4X); VERIFY_IS_APPROX_EVALUATOR2(res4X, prod(m4X,mXX), m4X*mXX); VERIFY_IS_APPROX_EVALUATOR2(resX1, prod(mX1,m11), mX1*m11); VERIFY_IS_APPROX_EVALUATOR2(resX1, prod(mX4,m41), mX4*m41); VERIFY_IS_APPROX_EVALUATOR2(resX1, prod(mXX,mX1), mXX*mX1); VERIFY_IS_APPROX_EVALUATOR2(resX4, prod(mX1,m14), mX1*m14); VERIFY_IS_APPROX_EVALUATOR2(resX4, prod(mX4,m44), mX4*m44); VERIFY_IS_APPROX_EVALUATOR2(resX4, prod(mXX,mX4), mXX*mX4); VERIFY_IS_APPROX_EVALUATOR2(resXX, prod(mX1,m1X), mX1*m1X); VERIFY_IS_APPROX_EVALUATOR2(resXX, prod(mX4,m4X), mX4*m4X); VERIFY_IS_APPROX_EVALUATOR2(resXX, prod(mXX,mXX), mXX*mXX); } { ArrayXXf a(2,3); ArrayXXf b(3,2); a << 1,2,3, 4,5,6; const ArrayXXf a_const(a); // this does not work because Random is eval-before-nested: // copy_using_evaluator(w, Vector2d::Random().transpose()); // test CwiseUnaryOp VERIFY_IS_APPROX_EVALUATOR(v2, 3 * v); VERIFY_IS_APPROX_EVALUATOR(w, (3 * v).transpose()); VERIFY_IS_APPROX_EVALUATOR(b, (a + 3).transpose()); VERIFY_IS_APPROX_EVALUATOR(b, (2 * a_const + 3).transpose()); // test CwiseBinaryOp VERIFY_IS_APPROX_EVALUATOR(v2, v + Vector2d::Ones()); VERIFY_IS_APPROX_EVALUATOR(w, (v + Vector2d::Ones()).transpose().cwiseProduct(RowVector2d::Constant(3))); // dynamic matrices and arrays MatrixXd mat1(6,6), mat2(6,6); VERIFY_IS_APPROX_EVALUATOR(mat1, MatrixXd::Identity(6,6)); VERIFY_IS_APPROX_EVALUATOR(mat2, mat1); copy_using_evaluator(mat2.transpose(), mat1); VERIFY_IS_APPROX(mat2.transpose(), mat1); ArrayXXd arr1(6,6), arr2(6,6); VERIFY_IS_APPROX_EVALUATOR(arr1, ArrayXXd::Constant(6,6, 3.0)); VERIFY_IS_APPROX_EVALUATOR(arr2, arr1); // test automatic resizing mat2.resize(3,3); VERIFY_IS_APPROX_EVALUATOR(mat2, mat1); arr2.resize(9,9); VERIFY_IS_APPROX_EVALUATOR(arr2, arr1); // test direct traversal Matrix3f m3; Array33f a3; VERIFY_IS_APPROX_EVALUATOR(m3, Matrix3f::Identity()); // matrix, nullary // TODO: find a way to test direct traversal with array VERIFY_IS_APPROX_EVALUATOR(m3.transpose(), Matrix3f::Identity().transpose()); // transpose VERIFY_IS_APPROX_EVALUATOR(m3, 2 * Matrix3f::Identity()); // unary VERIFY_IS_APPROX_EVALUATOR(m3, Matrix3f::Identity() + Matrix3f::Zero()); // binary VERIFY_IS_APPROX_EVALUATOR(m3.block(0,0,2,2), Matrix3f::Identity().block(1,1,2,2)); // block // test linear traversal VERIFY_IS_APPROX_EVALUATOR(m3, Matrix3f::Zero()); // matrix, nullary VERIFY_IS_APPROX_EVALUATOR(a3, Array33f::Zero()); // array VERIFY_IS_APPROX_EVALUATOR(m3.transpose(), Matrix3f::Zero().transpose()); // transpose VERIFY_IS_APPROX_EVALUATOR(m3, 2 * Matrix3f::Zero()); // unary VERIFY_IS_APPROX_EVALUATOR(m3, Matrix3f::Zero() + m3); // binary // test inner vectorization Matrix4f m4, m4src = Matrix4f::Random(); Array44f a4, a4src = Matrix4f::Random(); VERIFY_IS_APPROX_EVALUATOR(m4, m4src); // matrix VERIFY_IS_APPROX_EVALUATOR(a4, a4src); // array VERIFY_IS_APPROX_EVALUATOR(m4.transpose(), m4src.transpose()); // transpose // TODO: find out why Matrix4f::Zero() does not allow inner vectorization VERIFY_IS_APPROX_EVALUATOR(m4, 2 * m4src); // unary VERIFY_IS_APPROX_EVALUATOR(m4, m4src + m4src); // binary // test linear vectorization MatrixXf mX(6,6), mXsrc = MatrixXf::Random(6,6); ArrayXXf aX(6,6), aXsrc = ArrayXXf::Random(6,6); VERIFY_IS_APPROX_EVALUATOR(mX, mXsrc); // matrix VERIFY_IS_APPROX_EVALUATOR(aX, aXsrc); // array VERIFY_IS_APPROX_EVALUATOR(mX.transpose(), mXsrc.transpose()); // transpose VERIFY_IS_APPROX_EVALUATOR(mX, MatrixXf::Zero(6,6)); // nullary VERIFY_IS_APPROX_EVALUATOR(mX, 2 * mXsrc); // unary VERIFY_IS_APPROX_EVALUATOR(mX, mXsrc + mXsrc); // binary // test blocks and slice vectorization VERIFY_IS_APPROX_EVALUATOR(m4, (mXsrc.block<4,4>(1,0))); VERIFY_IS_APPROX_EVALUATOR(aX, ArrayXXf::Constant(10, 10, 3.0).block(2, 3, 6, 6)); Matrix4f m4ref = m4; copy_using_evaluator(m4.block(1, 1, 2, 3), m3.bottomRows(2)); m4ref.block(1, 1, 2, 3) = m3.bottomRows(2); VERIFY_IS_APPROX(m4, m4ref); mX.setIdentity(20,20); MatrixXf mXref = MatrixXf::Identity(20,20); mXsrc = MatrixXf::Random(9,12); copy_using_evaluator(mX.block(4, 4, 9, 12), mXsrc); mXref.block(4, 4, 9, 12) = mXsrc; VERIFY_IS_APPROX(mX, mXref); // test Map const float raw[3] = {1,2,3}; float buffer[3] = {0,0,0}; Vector3f v3; Array3f a3f; VERIFY_IS_APPROX_EVALUATOR(v3, Map(raw)); VERIFY_IS_APPROX_EVALUATOR(a3f, Map(raw)); Vector3f::Map(buffer) = 2*v3; VERIFY(buffer[0] == 2); VERIFY(buffer[1] == 4); VERIFY(buffer[2] == 6); // test CwiseUnaryView mat1.setRandom(); mat2.setIdentity(); MatrixXcd matXcd(6,6), matXcd_ref(6,6); copy_using_evaluator(matXcd.real(), mat1); copy_using_evaluator(matXcd.imag(), mat2); matXcd_ref.real() = mat1; matXcd_ref.imag() = mat2; VERIFY_IS_APPROX(matXcd, matXcd_ref); // test Select VERIFY_IS_APPROX_EVALUATOR(aX, (aXsrc > 0).select(aXsrc, -aXsrc)); // test Replicate mXsrc = MatrixXf::Random(6, 6); VectorXf vX = VectorXf::Random(6); mX.resize(6, 6); VERIFY_IS_APPROX_EVALUATOR(mX, mXsrc.colwise() + vX); matXcd.resize(12, 12); VERIFY_IS_APPROX_EVALUATOR(matXcd, matXcd_ref.replicate(2,2)); VERIFY_IS_APPROX_EVALUATOR(matXcd, (matXcd_ref.replicate<2,2>())); // test partial reductions VectorXd vec1(6); VERIFY_IS_APPROX_EVALUATOR(vec1, mat1.rowwise().sum()); VERIFY_IS_APPROX_EVALUATOR(vec1, mat1.colwise().sum().transpose()); // test MatrixWrapper and ArrayWrapper mat1.setRandom(6,6); arr1.setRandom(6,6); VERIFY_IS_APPROX_EVALUATOR(mat2, arr1.matrix()); VERIFY_IS_APPROX_EVALUATOR(arr2, mat1.array()); VERIFY_IS_APPROX_EVALUATOR(mat2, (arr1 + 2).matrix()); VERIFY_IS_APPROX_EVALUATOR(arr2, mat1.array() + 2); mat2.array() = arr1 * arr1; VERIFY_IS_APPROX(mat2, (arr1 * arr1).matrix()); arr2.matrix() = MatrixXd::Identity(6,6); VERIFY_IS_APPROX(arr2, MatrixXd::Identity(6,6).array()); // test Reverse VERIFY_IS_APPROX_EVALUATOR(arr2, arr1.reverse()); VERIFY_IS_APPROX_EVALUATOR(arr2, arr1.colwise().reverse()); VERIFY_IS_APPROX_EVALUATOR(arr2, arr1.rowwise().reverse()); arr2.reverse() = arr1; VERIFY_IS_APPROX(arr2, arr1.reverse()); mat2.array() = mat1.array().reverse(); VERIFY_IS_APPROX(mat2.array(), mat1.array().reverse()); // test Diagonal VERIFY_IS_APPROX_EVALUATOR(vec1, mat1.diagonal()); vec1.resize(5); VERIFY_IS_APPROX_EVALUATOR(vec1, mat1.diagonal(1)); VERIFY_IS_APPROX_EVALUATOR(vec1, mat1.diagonal<-1>()); vec1.setRandom(); mat2 = mat1; copy_using_evaluator(mat1.diagonal(1), vec1); mat2.diagonal(1) = vec1; VERIFY_IS_APPROX(mat1, mat2); copy_using_evaluator(mat1.diagonal<-1>(), mat1.diagonal(1)); mat2.diagonal<-1>() = mat2.diagonal(1); VERIFY_IS_APPROX(mat1, mat2); } { // test swapping MatrixXd mat1, mat2, mat1ref, mat2ref; mat1ref = mat1 = MatrixXd::Random(6, 6); mat2ref = mat2 = 2 * mat1 + MatrixXd::Identity(6, 6); swap_using_evaluator(mat1, mat2); mat1ref.swap(mat2ref); VERIFY_IS_APPROX(mat1, mat1ref); VERIFY_IS_APPROX(mat2, mat2ref); swap_using_evaluator(mat1.block(0, 0, 3, 3), mat2.block(3, 3, 3, 3)); mat1ref.block(0, 0, 3, 3).swap(mat2ref.block(3, 3, 3, 3)); VERIFY_IS_APPROX(mat1, mat1ref); VERIFY_IS_APPROX(mat2, mat2ref); swap_using_evaluator(mat1.row(2), mat2.col(3).transpose()); mat1.row(2).swap(mat2.col(3).transpose()); VERIFY_IS_APPROX(mat1, mat1ref); VERIFY_IS_APPROX(mat2, mat2ref); } { // test compound assignment const Matrix4d mat_const = Matrix4d::Random(); Matrix4d mat, mat_ref; mat = mat_ref = Matrix4d::Identity(); add_assign_using_evaluator(mat, mat_const); mat_ref += mat_const; VERIFY_IS_APPROX(mat, mat_ref); subtract_assign_using_evaluator(mat.row(1), 2*mat.row(2)); mat_ref.row(1) -= 2*mat_ref.row(2); VERIFY_IS_APPROX(mat, mat_ref); const ArrayXXf arr_const = ArrayXXf::Random(5,3); ArrayXXf arr, arr_ref; arr = arr_ref = ArrayXXf::Constant(5, 3, 0.5); multiply_assign_using_evaluator(arr, arr_const); arr_ref *= arr_const; VERIFY_IS_APPROX(arr, arr_ref); divide_assign_using_evaluator(arr.row(1), arr.row(2) + 1); arr_ref.row(1) /= (arr_ref.row(2) + 1); VERIFY_IS_APPROX(arr, arr_ref); } { // test triangular shapes MatrixXd A = MatrixXd::Random(6,6), B(6,6), C(6,6), D(6,6); A.setRandom();B.setRandom(); VERIFY_IS_APPROX_EVALUATOR2(B, A.triangularView(), MatrixXd(A.triangularView())); A.setRandom();B.setRandom(); VERIFY_IS_APPROX_EVALUATOR2(B, A.triangularView(), MatrixXd(A.triangularView())); A.setRandom();B.setRandom(); VERIFY_IS_APPROX_EVALUATOR2(B, A.triangularView(), MatrixXd(A.triangularView())); A.setRandom();B.setRandom(); C = B; C.triangularView() = A; copy_using_evaluator(B.triangularView(), A); VERIFY(B.isApprox(C) && "copy_using_evaluator(B.triangularView(), A)"); A.setRandom();B.setRandom(); C = B; C.triangularView() = A.triangularView(); copy_using_evaluator(B.triangularView(), A.triangularView()); VERIFY(B.isApprox(C) && "copy_using_evaluator(B.triangularView(), A.triangularView())"); A.setRandom();B.setRandom(); C = B; C.triangularView() = A.triangularView().transpose(); copy_using_evaluator(B.triangularView(), A.triangularView().transpose()); VERIFY(B.isApprox(C) && "copy_using_evaluator(B.triangularView(), A.triangularView().transpose())"); A.setRandom();B.setRandom(); C = B; D = A; C.triangularView().swap(D.triangularView()); swap_using_evaluator(B.triangularView(), A.triangularView()); VERIFY(B.isApprox(C) && "swap_using_evaluator(B.triangularView(), A.triangularView())"); VERIFY_IS_APPROX_EVALUATOR2(B, prod(A.triangularView(),A), MatrixXd(A.triangularView()*A)); VERIFY_IS_APPROX_EVALUATOR2(B, prod(A.selfadjointView(),A), MatrixXd(A.selfadjointView()*A)); } { // test diagonal shapes VectorXd d = VectorXd::Random(6); MatrixXd A = MatrixXd::Random(6,6), B(6,6); A.setRandom();B.setRandom(); VERIFY_IS_APPROX_EVALUATOR2(B, lazyprod(d.asDiagonal(),A), MatrixXd(d.asDiagonal()*A)); VERIFY_IS_APPROX_EVALUATOR2(B, lazyprod(A,d.asDiagonal()), MatrixXd(A*d.asDiagonal())); } { // test CoeffReadCost Matrix4d a, b; VERIFY_IS_EQUAL( get_cost(a), 1 ); VERIFY_IS_EQUAL( get_cost(a+b), 3); VERIFY_IS_EQUAL( get_cost(2*a+b), 4); VERIFY_IS_EQUAL( get_cost(a*b), 1); VERIFY_IS_EQUAL( get_cost(a.lazyProduct(b)), 15); VERIFY_IS_EQUAL( get_cost(a*(a*b)), 1); VERIFY_IS_EQUAL( get_cost(a.lazyProduct(a*b)), 15); VERIFY_IS_EQUAL( get_cost(a*(a+b)), 1); VERIFY_IS_EQUAL( get_cost(a.lazyProduct(a+b)), 15); } // regression test for PR 544 and bug 1622 (introduced in #71609c4) { // test restricted_packet_assignment with an unaligned destination const size_t M = 2; const size_t K = 2; const size_t N = 5; float *destMem = new float[(M*N) + 1]; float *dest = (internal::UIntPtr(destMem)%EIGEN_MAX_ALIGN_BYTES) == 0 ? destMem+1 : destMem; const Matrix a = Matrix::Random(M, K); const Matrix b = Matrix::Random(K, N); Map > z(dest, M, N);; Product, Matrix, LazyProduct> tmp(a,b); internal::call_restricted_packet_assignment(z.noalias(), tmp.derived(), internal::assign_op()); VERIFY_IS_APPROX(z, a*b); delete[] destMem; } } ================================================ FILE: VO_Module/thirdparty/eigen/test/exceptions.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2011 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. // Various sanity tests with exceptions and non trivially copyable scalar type. // - no memory leak when a custom scalar type trow an exceptions // - todo: complete the list of tests! #define EIGEN_STACK_ALLOCATION_LIMIT 100000000 #include "main.h" #include "AnnoyingScalar.h" #define CHECK_MEMLEAK(OP) { \ AnnoyingScalar::countdown = 100; \ int before = AnnoyingScalar::instances; \ bool exception_thrown = false; \ try { OP; } \ catch (my_exception) { \ exception_thrown = true; \ VERIFY(AnnoyingScalar::instances==before && "memory leak detected in " && EIGEN_MAKESTRING(OP)); \ } \ VERIFY( (AnnoyingScalar::dont_throw) || (exception_thrown && " no exception thrown in " && EIGEN_MAKESTRING(OP)) ); \ } EIGEN_DECLARE_TEST(exceptions) { typedef Eigen::Matrix VectorType; typedef Eigen::Matrix MatrixType; { AnnoyingScalar::dont_throw = false; int n = 50; VectorType v0(n), v1(n); MatrixType m0(n,n), m1(n,n), m2(n,n); v0.setOnes(); v1.setOnes(); m0.setOnes(); m1.setOnes(); m2.setOnes(); CHECK_MEMLEAK(v0 = m0 * m1 * v1); CHECK_MEMLEAK(m2 = m0 * m1 * m2); CHECK_MEMLEAK((v0+v1).dot(v0+v1)); } VERIFY(AnnoyingScalar::instances==0 && "global memory leak detected in " && EIGEN_MAKESTRING(OP)); } ================================================ FILE: VO_Module/thirdparty/eigen/test/fastmath.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2015 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" void check(bool b, bool ref) { std::cout << b; if(b==ref) std::cout << " OK "; else std::cout << " BAD "; } #if EIGEN_COMP_MSVC && EIGEN_COMP_MSVC < 1800 namespace std { template bool (isfinite)(T x) { return _finite(x); } template bool (isnan)(T x) { return _isnan(x); } template bool (isinf)(T x) { return _fpclass(x)==_FPCLASS_NINF || _fpclass(x)==_FPCLASS_PINF; } } #endif template void check_inf_nan(bool dryrun) { Matrix m(10); m.setRandom(); m(3) = std::numeric_limits::quiet_NaN(); if(dryrun) { std::cout << "std::isfinite(" << m(3) << ") = "; check((std::isfinite)(m(3)),false); std::cout << " ; numext::isfinite = "; check((numext::isfinite)(m(3)), false); std::cout << "\n"; std::cout << "std::isinf(" << m(3) << ") = "; check((std::isinf)(m(3)),false); std::cout << " ; numext::isinf = "; check((numext::isinf)(m(3)), false); std::cout << "\n"; std::cout << "std::isnan(" << m(3) << ") = "; check((std::isnan)(m(3)),true); std::cout << " ; numext::isnan = "; check((numext::isnan)(m(3)), true); std::cout << "\n"; std::cout << "allFinite: "; check(m.allFinite(), 0); std::cout << "\n"; std::cout << "hasNaN: "; check(m.hasNaN(), 1); std::cout << "\n"; std::cout << "\n"; } else { if( (std::isfinite)(m(3))) g_test_level=1; VERIFY( !(numext::isfinite)(m(3)) ); g_test_level=0; if( (std::isinf) (m(3))) g_test_level=1; VERIFY( !(numext::isinf)(m(3)) ); g_test_level=0; if(!(std::isnan) (m(3))) g_test_level=1; VERIFY( (numext::isnan)(m(3)) ); g_test_level=0; if( (std::isfinite)(m(3))) g_test_level=1; VERIFY( !m.allFinite() ); g_test_level=0; if(!(std::isnan) (m(3))) g_test_level=1; VERIFY( m.hasNaN() ); g_test_level=0; } T hidden_zero = (std::numeric_limits::min)()*(std::numeric_limits::min)(); m(4) /= hidden_zero; if(dryrun) { std::cout << "std::isfinite(" << m(4) << ") = "; check((std::isfinite)(m(4)),false); std::cout << " ; numext::isfinite = "; check((numext::isfinite)(m(4)), false); std::cout << "\n"; std::cout << "std::isinf(" << m(4) << ") = "; check((std::isinf)(m(4)),true); std::cout << " ; numext::isinf = "; check((numext::isinf)(m(4)), true); std::cout << "\n"; std::cout << "std::isnan(" << m(4) << ") = "; check((std::isnan)(m(4)),false); std::cout << " ; numext::isnan = "; check((numext::isnan)(m(4)), false); std::cout << "\n"; std::cout << "allFinite: "; check(m.allFinite(), 0); std::cout << "\n"; std::cout << "hasNaN: "; check(m.hasNaN(), 1); std::cout << "\n"; std::cout << "\n"; } else { if( (std::isfinite)(m(3))) g_test_level=1; VERIFY( !(numext::isfinite)(m(4)) ); g_test_level=0; if(!(std::isinf) (m(3))) g_test_level=1; VERIFY( (numext::isinf)(m(4)) ); g_test_level=0; if( (std::isnan) (m(3))) g_test_level=1; VERIFY( !(numext::isnan)(m(4)) ); g_test_level=0; if( (std::isfinite)(m(3))) g_test_level=1; VERIFY( !m.allFinite() ); g_test_level=0; if(!(std::isnan) (m(3))) g_test_level=1; VERIFY( m.hasNaN() ); g_test_level=0; } m(3) = 0; if(dryrun) { std::cout << "std::isfinite(" << m(3) << ") = "; check((std::isfinite)(m(3)),true); std::cout << " ; numext::isfinite = "; check((numext::isfinite)(m(3)), true); std::cout << "\n"; std::cout << "std::isinf(" << m(3) << ") = "; check((std::isinf)(m(3)),false); std::cout << " ; numext::isinf = "; check((numext::isinf)(m(3)), false); std::cout << "\n"; std::cout << "std::isnan(" << m(3) << ") = "; check((std::isnan)(m(3)),false); std::cout << " ; numext::isnan = "; check((numext::isnan)(m(3)), false); std::cout << "\n"; std::cout << "allFinite: "; check(m.allFinite(), 0); std::cout << "\n"; std::cout << "hasNaN: "; check(m.hasNaN(), 0); std::cout << "\n"; std::cout << "\n\n"; } else { if(!(std::isfinite)(m(3))) g_test_level=1; VERIFY( (numext::isfinite)(m(3)) ); g_test_level=0; if( (std::isinf) (m(3))) g_test_level=1; VERIFY( !(numext::isinf)(m(3)) ); g_test_level=0; if( (std::isnan) (m(3))) g_test_level=1; VERIFY( !(numext::isnan)(m(3)) ); g_test_level=0; if( (std::isfinite)(m(3))) g_test_level=1; VERIFY( !m.allFinite() ); g_test_level=0; if( (std::isnan) (m(3))) g_test_level=1; VERIFY( !m.hasNaN() ); g_test_level=0; } } EIGEN_DECLARE_TEST(fastmath) { std::cout << "*** float *** \n\n"; check_inf_nan(true); std::cout << "*** double ***\n\n"; check_inf_nan(true); std::cout << "*** long double *** \n\n"; check_inf_nan(true); check_inf_nan(false); check_inf_nan(false); check_inf_nan(false); } ================================================ FILE: VO_Module/thirdparty/eigen/test/first_aligned.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" template void test_first_aligned_helper(Scalar *array, int size) { const int packet_size = sizeof(Scalar) * internal::packet_traits::size; VERIFY(((size_t(array) + sizeof(Scalar) * internal::first_default_aligned(array, size)) % packet_size) == 0); } template void test_none_aligned_helper(Scalar *array, int size) { EIGEN_UNUSED_VARIABLE(array); EIGEN_UNUSED_VARIABLE(size); VERIFY(internal::packet_traits::size == 1 || internal::first_default_aligned(array, size) == size); } struct some_non_vectorizable_type { float x; }; EIGEN_DECLARE_TEST(first_aligned) { EIGEN_ALIGN16 float array_float[100]; test_first_aligned_helper(array_float, 50); test_first_aligned_helper(array_float+1, 50); test_first_aligned_helper(array_float+2, 50); test_first_aligned_helper(array_float+3, 50); test_first_aligned_helper(array_float+4, 50); test_first_aligned_helper(array_float+5, 50); EIGEN_ALIGN16 double array_double[100]; test_first_aligned_helper(array_double, 50); test_first_aligned_helper(array_double+1, 50); test_first_aligned_helper(array_double+2, 50); double *array_double_plus_4_bytes = (double*)(internal::UIntPtr(array_double)+4); test_none_aligned_helper(array_double_plus_4_bytes, 50); test_none_aligned_helper(array_double_plus_4_bytes+1, 50); some_non_vectorizable_type array_nonvec[100]; test_first_aligned_helper(array_nonvec, 100); test_none_aligned_helper(array_nonvec, 100); } ================================================ FILE: VO_Module/thirdparty/eigen/test/geo_alignedbox.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2009 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include using namespace std; // NOTE the following workaround was needed on some 32 bits builds to kill extra precision of x87 registers. // It seems that it is not needed anymore, but let's keep it here, just in case... template EIGEN_DONT_INLINE void kill_extra_precision(T& /* x */) { // This one worked but triggered a warning: /* eigen_assert((void*)(&x) != (void*)0); */ // An alternative could be: /* volatile T tmp = x; */ /* x = tmp; */ } template void alignedbox(const BoxType& box) { /* this test covers the following files: AlignedBox.h */ typedef typename BoxType::Scalar Scalar; typedef NumTraits ScalarTraits; typedef typename ScalarTraits::Real RealScalar; typedef Matrix VectorType; const Index dim = box.dim(); VectorType p0 = VectorType::Random(dim); VectorType p1 = VectorType::Random(dim); while( p1 == p0 ){ p1 = VectorType::Random(dim); } RealScalar s1 = internal::random(0,1); BoxType b0(dim); BoxType b1(VectorType::Random(dim),VectorType::Random(dim)); BoxType b2; kill_extra_precision(b1); kill_extra_precision(p0); kill_extra_precision(p1); b0.extend(p0); b0.extend(p1); VERIFY(b0.contains(p0*s1+(Scalar(1)-s1)*p1)); VERIFY(b0.contains(b0.center())); VERIFY_IS_APPROX(b0.center(),(p0+p1)/Scalar(2)); (b2 = b0).extend(b1); VERIFY(b2.contains(b0)); VERIFY(b2.contains(b1)); VERIFY_IS_APPROX(b2.clamp(b0), b0); // intersection BoxType box1(VectorType::Random(dim)); box1.extend(VectorType::Random(dim)); BoxType box2(VectorType::Random(dim)); box2.extend(VectorType::Random(dim)); VERIFY(box1.intersects(box2) == !box1.intersection(box2).isEmpty()); // alignment -- make sure there is no memory alignment assertion BoxType *bp0 = new BoxType(dim); BoxType *bp1 = new BoxType(dim); bp0->extend(*bp1); delete bp0; delete bp1; // sampling for( int i=0; i<10; ++i ) { VectorType r = b0.sample(); VERIFY(b0.contains(r)); } } template void alignedboxTranslatable(const BoxType& box) { typedef typename BoxType::Scalar Scalar; typedef Matrix VectorType; typedef Transform IsometryTransform; typedef Transform AffineTransform; alignedbox(box); const VectorType Ones = VectorType::Ones(); const VectorType UnitX = VectorType::UnitX(); const Index dim = box.dim(); // box((-1, -1, -1), (1, 1, 1)) BoxType a(-Ones, Ones); VERIFY_IS_APPROX(a.sizes(), Ones * Scalar(2)); BoxType b = a; VectorType translate = Ones; translate[0] = Scalar(2); b.translate(translate); // translate by (2, 1, 1) -> box((1, 0, 0), (3, 2, 2)) VERIFY_IS_APPROX(b.sizes(), Ones * Scalar(2)); VERIFY_IS_APPROX((b.min)(), UnitX); VERIFY_IS_APPROX((b.max)(), Ones * Scalar(2) + UnitX); // Test transform IsometryTransform tf = IsometryTransform::Identity(); tf.translation() = -translate; BoxType c = b.transformed(tf); // translate by (-2, -1, -1) -> box((-1, -1, -1), (1, 1, 1)) VERIFY_IS_APPROX(c.sizes(), a.sizes()); VERIFY_IS_APPROX((c.min)(), (a.min)()); VERIFY_IS_APPROX((c.max)(), (a.max)()); c.transform(tf); // translate by (-2, -1, -1) -> box((-3, -2, -2), (-1, 0, 0)) VERIFY_IS_APPROX(c.sizes(), a.sizes()); VERIFY_IS_APPROX((c.min)(), Ones * Scalar(-2) - UnitX); VERIFY_IS_APPROX((c.max)(), -UnitX); // Scaling AffineTransform atf = AffineTransform::Identity(); atf.scale(Scalar(3)); c.transform(atf); // scale by 3 -> box((-9, -6, -6), (-3, 0, 0)) VERIFY_IS_APPROX(c.sizes(), Scalar(3) * a.sizes()); VERIFY_IS_APPROX((c.min)(), Ones * Scalar(-6) - UnitX * Scalar(3)); VERIFY_IS_APPROX((c.max)(), UnitX * Scalar(-3)); atf = AffineTransform::Identity(); atf.scale(Scalar(-3)); c.transform(atf); // scale by -3 -> box((27, 18, 18), (9, 0, 0)) VERIFY_IS_APPROX(c.sizes(), Scalar(9) * a.sizes()); VERIFY_IS_APPROX((c.min)(), UnitX * Scalar(9)); VERIFY_IS_APPROX((c.max)(), Ones * Scalar(18) + UnitX * Scalar(9)); // Check identity transform within numerical precision. BoxType transformedC = c.transformed(IsometryTransform::Identity()); VERIFY_IS_APPROX(transformedC, c); for (size_t i = 0; i < 10; ++i) { VectorType minCorner; VectorType maxCorner; for (Index d = 0; d < dim; ++d) { minCorner[d] = internal::random(-10,10); maxCorner[d] = minCorner[d] + internal::random(0, 10); } c = BoxType(minCorner, maxCorner); translate = VectorType::Random(); c.translate(translate); VERIFY_IS_APPROX((c.min)(), minCorner + translate); VERIFY_IS_APPROX((c.max)(), maxCorner + translate); } } template Rotation rotate2D(Scalar angle) { return Rotation2D(angle); } template Rotation rotate2DIntegral(typename NumTraits::NonInteger angle) { typedef typename NumTraits::NonInteger NonInteger; return Rotation2D(angle).toRotationMatrix(). template cast(); } template Rotation rotate3DZAxis(Scalar angle) { return AngleAxis(angle, Matrix(0, 0, 1)); } template Rotation rotate3DZAxisIntegral(typename NumTraits::NonInteger angle) { typedef typename NumTraits::NonInteger NonInteger; return AngleAxis(angle, Matrix(0, 0, 1)). toRotationMatrix().template cast(); } template Rotation rotate4DZWAxis(Scalar angle) { Rotation result = Matrix::Identity(); result.block(0, 0, 3, 3) = rotate3DZAxis(angle).toRotationMatrix(); return result; } template MatrixType randomRotationMatrix() { // algorithm from // https://www.isprs-ann-photogramm-remote-sens-spatial-inf-sci.net/III-7/103/2016/isprs-annals-III-7-103-2016.pdf const MatrixType rand = MatrixType::Random(); const MatrixType q = rand.householderQr().householderQ(); const JacobiSVD svd = q.jacobiSvd(ComputeFullU | ComputeFullV); const typename MatrixType::Scalar det = (svd.matrixU() * svd.matrixV().transpose()).determinant(); MatrixType diag = rand.Identity(); diag(MatrixType::RowsAtCompileTime - 1, MatrixType::ColsAtCompileTime - 1) = det; const MatrixType rotation = svd.matrixU() * diag * svd.matrixV().transpose(); return rotation; } template Matrix boxGetCorners(const Matrix& min_, const Matrix& max_) { Matrix result; for(Index i=0; i<(1< void alignedboxRotatable( const BoxType& box, Rotation (*rotate)(typename NumTraits::NonInteger /*_angle*/)) { alignedboxTranslatable(box); typedef typename BoxType::Scalar Scalar; typedef typename NumTraits::NonInteger NonInteger; typedef Matrix VectorType; typedef Transform IsometryTransform; typedef Transform AffineTransform; const VectorType Zero = VectorType::Zero(); const VectorType Ones = VectorType::Ones(); const VectorType UnitX = VectorType::UnitX(); const VectorType UnitY = VectorType::UnitY(); // this is vector (0, 0, -1, -1, -1, ...), i.e. with zeros at first and second dimensions const VectorType UnitZ = Ones - UnitX - UnitY; // in this kind of comments the 3D case values will be illustrated // box((-1, -1, -1), (1, 1, 1)) BoxType a(-Ones, Ones); // to allow templating this test for both 2D and 3D cases, we always set all // but the first coordinate to the same value; so basically 3D case works as // if you were looking at the scene from top VectorType minPoint = -2 * Ones; minPoint[0] = -3; VectorType maxPoint = Zero; maxPoint[0] = -1; BoxType c(minPoint, maxPoint); // box((-3, -2, -2), (-1, 0, 0)) IsometryTransform tf2 = IsometryTransform::Identity(); // for some weird reason the following statement has to be put separate from // the following rotate call, otherwise precision problems arise... Rotation rot = rotate(NonInteger(EIGEN_PI)); tf2.rotate(rot); c.transform(tf2); // rotate by 180 deg around origin -> box((1, 0, -2), (3, 2, 0)) VERIFY_IS_APPROX(c.sizes(), a.sizes()); VERIFY_IS_APPROX((c.min)(), UnitX - UnitZ * Scalar(2)); VERIFY_IS_APPROX((c.max)(), UnitX * Scalar(3) + UnitY * Scalar(2)); rot = rotate(NonInteger(EIGEN_PI / 2)); tf2.setIdentity(); tf2.rotate(rot); c.transform(tf2); // rotate by 90 deg around origin -> box((-2, 1, -2), (0, 3, 0)) VERIFY_IS_APPROX(c.sizes(), a.sizes()); VERIFY_IS_APPROX((c.min)(), Ones * Scalar(-2) + UnitY * Scalar(3)); VERIFY_IS_APPROX((c.max)(), UnitY * Scalar(3)); // box((-1, -1, -1), (1, 1, 1)) AffineTransform atf = AffineTransform::Identity(); atf.linearExt()(0, 1) = Scalar(1); c = BoxType(-Ones, Ones); c.transform(atf); // 45 deg shear in x direction -> box((-2, -1, -1), (2, 1, 1)) VERIFY_IS_APPROX(c.sizes(), Ones * Scalar(2) + UnitX * Scalar(2)); VERIFY_IS_APPROX((c.min)(), -Ones - UnitX); VERIFY_IS_APPROX((c.max)(), Ones + UnitX); } template void alignedboxNonIntegralRotatable( const BoxType& box, Rotation (*rotate)(typename NumTraits::NonInteger /*_angle*/)) { alignedboxRotatable(box, rotate); typedef typename BoxType::Scalar Scalar; typedef typename NumTraits::NonInteger NonInteger; enum { Dim = BoxType::AmbientDimAtCompileTime }; typedef Matrix VectorType; typedef Matrix CornersType; typedef Transform IsometryTransform; typedef Transform AffineTransform; const Index dim = box.dim(); const VectorType Zero = VectorType::Zero(); const VectorType Ones = VectorType::Ones(); VectorType minPoint = -2 * Ones; minPoint[1] = 1; VectorType maxPoint = Zero; maxPoint[1] = 3; BoxType c(minPoint, maxPoint); // ((-2, 1, -2), (0, 3, 0)) VectorType cornerBL = (c.min)(); VectorType cornerTR = (c.max)(); VectorType cornerBR = (c.min)(); cornerBR[0] = cornerTR[0]; VectorType cornerTL = (c.max)(); cornerTL[0] = cornerBL[0]; NonInteger angle = NonInteger(EIGEN_PI/3); Rotation rot = rotate(angle); IsometryTransform tf2; tf2.setIdentity(); tf2.rotate(rot); c.transform(tf2); // rotate by 60 deg -> box((-3.59, -1.23, -2), (-0.86, 1.5, 0)) cornerBL = tf2 * cornerBL; cornerBR = tf2 * cornerBR; cornerTL = tf2 * cornerTL; cornerTR = tf2 * cornerTR; VectorType minCorner = Ones * Scalar(-2); VectorType maxCorner = Zero; minCorner[0] = (min)((min)(cornerBL[0], cornerBR[0]), (min)(cornerTL[0], cornerTR[0])); maxCorner[0] = (max)((max)(cornerBL[0], cornerBR[0]), (max)(cornerTL[0], cornerTR[0])); minCorner[1] = (min)((min)(cornerBL[1], cornerBR[1]), (min)(cornerTL[1], cornerTR[1])); maxCorner[1] = (max)((max)(cornerBL[1], cornerBR[1]), (max)(cornerTL[1], cornerTR[1])); for (Index d = 2; d < dim; ++d) VERIFY_IS_APPROX(c.sizes()[d], Scalar(2)); VERIFY_IS_APPROX((c.min)(), minCorner); VERIFY_IS_APPROX((c.max)(), maxCorner); VectorType minCornerValue = Ones * Scalar(-2); VectorType maxCornerValue = Zero; minCornerValue[0] = Scalar(Scalar(-sqrt(2*2 + 3*3)) * Scalar(cos(Scalar(atan(2.0/3.0)) - angle/2))); minCornerValue[1] = Scalar(Scalar(-sqrt(1*1 + 2*2)) * Scalar(sin(Scalar(atan(2.0/1.0)) - angle/2))); maxCornerValue[0] = Scalar(-sin(angle)); maxCornerValue[1] = Scalar(3 * cos(angle)); VERIFY_IS_APPROX((c.min)(), minCornerValue); VERIFY_IS_APPROX((c.max)(), maxCornerValue); // randomized test - translate and rotate the box and compare to a box made of transformed vertices for (size_t i = 0; i < 10; ++i) { for (Index d = 0; d < dim; ++d) { minCorner[d] = internal::random(-10,10); maxCorner[d] = minCorner[d] + internal::random(0, 10); } c = BoxType(minCorner, maxCorner); CornersType corners = boxGetCorners(minCorner, maxCorner); typename AffineTransform::LinearMatrixType rotation = randomRotationMatrix(); tf2.setIdentity(); tf2.rotate(rotation); tf2.translate(VectorType::Random()); c.transform(tf2); corners = tf2 * corners; minCorner = corners.rowwise().minCoeff(); maxCorner = corners.rowwise().maxCoeff(); VERIFY_IS_APPROX((c.min)(), minCorner); VERIFY_IS_APPROX((c.max)(), maxCorner); } // randomized test - transform the box with a random affine matrix and compare to a box made of transformed vertices for (size_t i = 0; i < 10; ++i) { for (Index d = 0; d < dim; ++d) { minCorner[d] = internal::random(-10,10); maxCorner[d] = minCorner[d] + internal::random(0, 10); } c = BoxType(minCorner, maxCorner); CornersType corners = boxGetCorners(minCorner, maxCorner); AffineTransform atf = AffineTransform::Identity(); atf.linearExt() = AffineTransform::LinearPart::Random(); atf.translate(VectorType::Random()); c.transform(atf); corners = atf * corners; minCorner = corners.rowwise().minCoeff(); maxCorner = corners.rowwise().maxCoeff(); VERIFY_IS_APPROX((c.min)(), minCorner); VERIFY_IS_APPROX((c.max)(), maxCorner); } } template void alignedboxCastTests(const BoxType& box) { // casting typedef typename BoxType::Scalar Scalar; typedef Matrix VectorType; const Index dim = box.dim(); VectorType p0 = VectorType::Random(dim); VectorType p1 = VectorType::Random(dim); BoxType b0(dim); b0.extend(p0); b0.extend(p1); const int Dim = BoxType::AmbientDimAtCompileTime; typedef typename GetDifferentType::type OtherScalar; AlignedBox hp1f = b0.template cast(); VERIFY_IS_APPROX(hp1f.template cast(),b0); AlignedBox hp1d = b0.template cast(); VERIFY_IS_APPROX(hp1d.template cast(),b0); } void specificTest1() { Vector2f m; m << -1.0f, -2.0f; Vector2f M; M << 1.0f, 5.0f; typedef AlignedBox2f BoxType; BoxType box( m, M ); Vector2f sides = M-m; VERIFY_IS_APPROX(sides, box.sizes() ); VERIFY_IS_APPROX(sides[1], box.sizes()[1] ); VERIFY_IS_APPROX(sides[1], box.sizes().maxCoeff() ); VERIFY_IS_APPROX(sides[0], box.sizes().minCoeff() ); VERIFY_IS_APPROX( 14.0f, box.volume() ); VERIFY_IS_APPROX( 53.0f, box.diagonal().squaredNorm() ); VERIFY_IS_APPROX( std::sqrt( 53.0f ), box.diagonal().norm() ); VERIFY_IS_APPROX( m, box.corner( BoxType::BottomLeft ) ); VERIFY_IS_APPROX( M, box.corner( BoxType::TopRight ) ); Vector2f bottomRight; bottomRight << M[0], m[1]; Vector2f topLeft; topLeft << m[0], M[1]; VERIFY_IS_APPROX( bottomRight, box.corner( BoxType::BottomRight ) ); VERIFY_IS_APPROX( topLeft, box.corner( BoxType::TopLeft ) ); } void specificTest2() { Vector3i m; m << -1, -2, 0; Vector3i M; M << 1, 5, 3; typedef AlignedBox3i BoxType; BoxType box( m, M ); Vector3i sides = M-m; VERIFY_IS_APPROX(sides, box.sizes() ); VERIFY_IS_APPROX(sides[1], box.sizes()[1] ); VERIFY_IS_APPROX(sides[1], box.sizes().maxCoeff() ); VERIFY_IS_APPROX(sides[0], box.sizes().minCoeff() ); VERIFY_IS_APPROX( 42, box.volume() ); VERIFY_IS_APPROX( 62, box.diagonal().squaredNorm() ); VERIFY_IS_APPROX( m, box.corner( BoxType::BottomLeftFloor ) ); VERIFY_IS_APPROX( M, box.corner( BoxType::TopRightCeil ) ); Vector3i bottomRightFloor; bottomRightFloor << M[0], m[1], m[2]; Vector3i topLeftFloor; topLeftFloor << m[0], M[1], m[2]; VERIFY_IS_APPROX( bottomRightFloor, box.corner( BoxType::BottomRightFloor ) ); VERIFY_IS_APPROX( topLeftFloor, box.corner( BoxType::TopLeftFloor ) ); } EIGEN_DECLARE_TEST(geo_alignedbox) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( (alignedboxNonIntegralRotatable(AlignedBox2f(), &rotate2D)) ); CALL_SUBTEST_2( alignedboxCastTests(AlignedBox2f()) ); CALL_SUBTEST_3( (alignedboxNonIntegralRotatable(AlignedBox3f(), &rotate3DZAxis)) ); CALL_SUBTEST_4( alignedboxCastTests(AlignedBox3f()) ); CALL_SUBTEST_5( (alignedboxNonIntegralRotatable(AlignedBox4d(), &rotate4DZWAxis)) ); CALL_SUBTEST_6( alignedboxCastTests(AlignedBox4d()) ); CALL_SUBTEST_7( alignedboxTranslatable(AlignedBox1d()) ); CALL_SUBTEST_8( alignedboxCastTests(AlignedBox1d()) ); CALL_SUBTEST_9( alignedboxTranslatable(AlignedBox1i()) ); CALL_SUBTEST_10( (alignedboxRotatable(AlignedBox2i(), &rotate2DIntegral)) ); CALL_SUBTEST_11( (alignedboxRotatable(AlignedBox3i(), &rotate3DZAxisIntegral)) ); CALL_SUBTEST_14( alignedbox(AlignedBox(4)) ); } CALL_SUBTEST_12( specificTest1() ); CALL_SUBTEST_13( specificTest2() ); } ================================================ FILE: VO_Module/thirdparty/eigen/test/geo_eulerangles.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2012 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include #include #include template void verify_euler(const Matrix& ea, int i, int j, int k) { typedef Matrix Matrix3; typedef Matrix Vector3; typedef AngleAxis AngleAxisx; using std::abs; Matrix3 m(AngleAxisx(ea[0], Vector3::Unit(i)) * AngleAxisx(ea[1], Vector3::Unit(j)) * AngleAxisx(ea[2], Vector3::Unit(k))); Vector3 eabis = m.eulerAngles(i, j, k); Matrix3 mbis(AngleAxisx(eabis[0], Vector3::Unit(i)) * AngleAxisx(eabis[1], Vector3::Unit(j)) * AngleAxisx(eabis[2], Vector3::Unit(k))); VERIFY_IS_APPROX(m, mbis); /* If I==K, and ea[1]==0, then there no unique solution. */ /* The remark apply in the case where I!=K, and |ea[1]| is close to pi/2. */ if( (i!=k || ea[1]!=0) && (i==k || !internal::isApprox(abs(ea[1]),Scalar(EIGEN_PI/2),test_precision())) ) VERIFY((ea-eabis).norm() <= test_precision()); // approx_or_less_than does not work for 0 VERIFY(0 < eabis[0] || test_isMuchSmallerThan(eabis[0], Scalar(1))); VERIFY_IS_APPROX_OR_LESS_THAN(eabis[0], Scalar(EIGEN_PI)); VERIFY_IS_APPROX_OR_LESS_THAN(-Scalar(EIGEN_PI), eabis[1]); VERIFY_IS_APPROX_OR_LESS_THAN(eabis[1], Scalar(EIGEN_PI)); VERIFY_IS_APPROX_OR_LESS_THAN(-Scalar(EIGEN_PI), eabis[2]); VERIFY_IS_APPROX_OR_LESS_THAN(eabis[2], Scalar(EIGEN_PI)); } template void check_all_var(const Matrix& ea) { verify_euler(ea, 0,1,2); verify_euler(ea, 0,1,0); verify_euler(ea, 0,2,1); verify_euler(ea, 0,2,0); verify_euler(ea, 1,2,0); verify_euler(ea, 1,2,1); verify_euler(ea, 1,0,2); verify_euler(ea, 1,0,1); verify_euler(ea, 2,0,1); verify_euler(ea, 2,0,2); verify_euler(ea, 2,1,0); verify_euler(ea, 2,1,2); } template void eulerangles() { typedef Matrix Matrix3; typedef Matrix Vector3; typedef Array Array3; typedef Quaternion Quaternionx; typedef AngleAxis AngleAxisx; Scalar a = internal::random(-Scalar(EIGEN_PI), Scalar(EIGEN_PI)); Quaternionx q1; q1 = AngleAxisx(a, Vector3::Random().normalized()); Matrix3 m; m = q1; Vector3 ea = m.eulerAngles(0,1,2); check_all_var(ea); ea = m.eulerAngles(0,1,0); check_all_var(ea); // Check with purely random Quaternion: q1.coeffs() = Quaternionx::Coefficients::Random().normalized(); m = q1; ea = m.eulerAngles(0,1,2); check_all_var(ea); ea = m.eulerAngles(0,1,0); check_all_var(ea); // Check with random angles in range [0:pi]x[-pi:pi]x[-pi:pi]. ea = (Array3::Random() + Array3(1,0,0))*Scalar(EIGEN_PI)*Array3(0.5,1,1); check_all_var(ea); ea[2] = ea[0] = internal::random(0,Scalar(EIGEN_PI)); check_all_var(ea); ea[0] = ea[1] = internal::random(0,Scalar(EIGEN_PI)); check_all_var(ea); ea[1] = 0; check_all_var(ea); ea.head(2).setZero(); check_all_var(ea); ea.setZero(); check_all_var(ea); } EIGEN_DECLARE_TEST(geo_eulerangles) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( eulerangles() ); CALL_SUBTEST_2( eulerangles() ); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/geo_homogeneous.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include template void homogeneous(void) { /* this test covers the following files: Homogeneous.h */ typedef Matrix MatrixType; typedef Matrix VectorType; typedef Matrix HMatrixType; typedef Matrix HVectorType; typedef Matrix T1MatrixType; typedef Matrix T2MatrixType; typedef Matrix T3MatrixType; VectorType v0 = VectorType::Random(), ones = VectorType::Ones(); HVectorType hv0 = HVectorType::Random(); MatrixType m0 = MatrixType::Random(); HMatrixType hm0 = HMatrixType::Random(); hv0 << v0, 1; VERIFY_IS_APPROX(v0.homogeneous(), hv0); VERIFY_IS_APPROX(v0, hv0.hnormalized()); VERIFY_IS_APPROX(v0.homogeneous().sum(), hv0.sum()); VERIFY_IS_APPROX(v0.homogeneous().minCoeff(), hv0.minCoeff()); VERIFY_IS_APPROX(v0.homogeneous().maxCoeff(), hv0.maxCoeff()); hm0 << m0, ones.transpose(); VERIFY_IS_APPROX(m0.colwise().homogeneous(), hm0); VERIFY_IS_APPROX(m0, hm0.colwise().hnormalized()); hm0.row(Size-1).setRandom(); for(int j=0; j aff; Transform caff; Transform proj; Matrix pts; Matrix pts1, pts2; aff.affine().setRandom(); proj = caff = aff; pts.setRandom(Size,internal::random(1,20)); pts1 = pts.colwise().homogeneous(); VERIFY_IS_APPROX(aff * pts.colwise().homogeneous(), (aff * pts1).colwise().hnormalized()); VERIFY_IS_APPROX(caff * pts.colwise().homogeneous(), (caff * pts1).colwise().hnormalized()); VERIFY_IS_APPROX(proj * pts.colwise().homogeneous(), (proj * pts1)); VERIFY_IS_APPROX((aff * pts1).colwise().hnormalized(), aff * pts); VERIFY_IS_APPROX((caff * pts1).colwise().hnormalized(), caff * pts); pts2 = pts1; pts2.row(Size).setRandom(); VERIFY_IS_APPROX((aff * pts2).colwise().hnormalized(), aff * pts2.colwise().hnormalized()); VERIFY_IS_APPROX((caff * pts2).colwise().hnormalized(), caff * pts2.colwise().hnormalized()); VERIFY_IS_APPROX((proj * pts2).colwise().hnormalized(), (proj * pts2.colwise().hnormalized().colwise().homogeneous()).colwise().hnormalized()); // Test combination of homogeneous VERIFY_IS_APPROX( (t2 * v0.homogeneous()).hnormalized(), (t2.template topLeftCorner() * v0 + t2.template topRightCorner()) / ((t2.template bottomLeftCorner<1,Size>()*v0).value() + t2(Size,Size)) ); VERIFY_IS_APPROX( (t2 * pts.colwise().homogeneous()).colwise().hnormalized(), (Matrix(t2 * pts1).colwise().hnormalized()) ); VERIFY_IS_APPROX( (t2 .lazyProduct( v0.homogeneous() )).hnormalized(), (t2 * v0.homogeneous()).hnormalized() ); VERIFY_IS_APPROX( (t2 .lazyProduct ( pts.colwise().homogeneous() )).colwise().hnormalized(), (t2 * pts1).colwise().hnormalized() ); VERIFY_IS_APPROX( (v0.transpose().homogeneous() .lazyProduct( t2 )).hnormalized(), (v0.transpose().homogeneous()*t2).hnormalized() ); VERIFY_IS_APPROX( (pts.transpose().rowwise().homogeneous() .lazyProduct( t2 )).rowwise().hnormalized(), (pts1.transpose()*t2).rowwise().hnormalized() ); VERIFY_IS_APPROX( (t2.template triangularView() * v0.homogeneous()).eval(), (t2.template triangularView()*hv0) ); } EIGEN_DECLARE_TEST(geo_homogeneous) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1(( homogeneous() )); CALL_SUBTEST_2(( homogeneous() )); CALL_SUBTEST_3(( homogeneous() )); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/geo_hyperplane.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // Copyright (C) 2008 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include #include #include template void hyperplane(const HyperplaneType& _plane) { /* this test covers the following files: Hyperplane.h */ using std::abs; const Index dim = _plane.dim(); enum { Options = HyperplaneType::Options }; typedef typename HyperplaneType::Scalar Scalar; typedef typename HyperplaneType::RealScalar RealScalar; typedef Matrix VectorType; typedef Matrix MatrixType; VectorType p0 = VectorType::Random(dim); VectorType p1 = VectorType::Random(dim); VectorType n0 = VectorType::Random(dim).normalized(); VectorType n1 = VectorType::Random(dim).normalized(); HyperplaneType pl0(n0, p0); HyperplaneType pl1(n1, p1); HyperplaneType pl2 = pl1; Scalar s0 = internal::random(); Scalar s1 = internal::random(); VERIFY_IS_APPROX( n1.dot(n1), Scalar(1) ); VERIFY_IS_MUCH_SMALLER_THAN( pl0.absDistance(p0), Scalar(1) ); if(numext::abs2(s0)>RealScalar(1e-6)) VERIFY_IS_APPROX( pl1.signedDistance(p1 + n1 * s0), s0); else VERIFY_IS_MUCH_SMALLER_THAN( abs(pl1.signedDistance(p1 + n1 * s0) - s0), Scalar(1) ); VERIFY_IS_MUCH_SMALLER_THAN( pl1.signedDistance(pl1.projection(p0)), Scalar(1) ); VERIFY_IS_MUCH_SMALLER_THAN( pl1.absDistance(p1 + pl1.normal().unitOrthogonal() * s1), Scalar(1) ); // transform if (!NumTraits::IsComplex) { MatrixType rot = MatrixType::Random(dim,dim).householderQr().householderQ(); DiagonalMatrix scaling(VectorType::Random()); Translation translation(VectorType::Random()); while(scaling.diagonal().cwiseAbs().minCoeff()::type OtherScalar; Hyperplane hp1f = pl1.template cast(); VERIFY_IS_APPROX(hp1f.template cast(),pl1); Hyperplane hp1d = pl1.template cast(); VERIFY_IS_APPROX(hp1d.template cast(),pl1); } template void lines() { using std::abs; typedef Hyperplane HLine; typedef ParametrizedLine PLine; typedef Matrix Vector; typedef Matrix CoeffsType; for(int i = 0; i < 10; i++) { Vector center = Vector::Random(); Vector u = Vector::Random(); Vector v = Vector::Random(); Scalar a = internal::random(); while (abs(a-1) < Scalar(1e-4)) a = internal::random(); while (u.norm() < Scalar(1e-4)) u = Vector::Random(); while (v.norm() < Scalar(1e-4)) v = Vector::Random(); HLine line_u = HLine::Through(center + u, center + a*u); HLine line_v = HLine::Through(center + v, center + a*v); // the line equations should be normalized so that a^2+b^2=1 VERIFY_IS_APPROX(line_u.normal().norm(), Scalar(1)); VERIFY_IS_APPROX(line_v.normal().norm(), Scalar(1)); Vector result = line_u.intersection(line_v); // the lines should intersect at the point we called "center" if(abs(a-1) > Scalar(1e-2) && abs(v.normalized().dot(u.normalized())) void planes() { using std::abs; typedef Hyperplane Plane; typedef Matrix Vector; for(int i = 0; i < 10; i++) { Vector v0 = Vector::Random(); Vector v1(v0), v2(v0); if(internal::random(0,1)>0.25) v1 += Vector::Random(); if(internal::random(0,1)>0.25) v2 += v1 * std::pow(internal::random(0,1),internal::random(1,16)); if(internal::random(0,1)>0.25) v2 += Vector::Random() * std::pow(internal::random(0,1),internal::random(1,16)); Plane p0 = Plane::Through(v0, v1, v2); VERIFY_IS_APPROX(p0.normal().norm(), Scalar(1)); VERIFY_IS_MUCH_SMALLER_THAN(p0.absDistance(v0), Scalar(1)); VERIFY_IS_MUCH_SMALLER_THAN(p0.absDistance(v1), Scalar(1)); VERIFY_IS_MUCH_SMALLER_THAN(p0.absDistance(v2), Scalar(1)); } } template void hyperplane_alignment() { typedef Hyperplane Plane3a; typedef Hyperplane Plane3u; EIGEN_ALIGN_MAX Scalar array1[4]; EIGEN_ALIGN_MAX Scalar array2[4]; EIGEN_ALIGN_MAX Scalar array3[4+1]; Scalar* array3u = array3+1; Plane3a *p1 = ::new(reinterpret_cast(array1)) Plane3a; Plane3u *p2 = ::new(reinterpret_cast(array2)) Plane3u; Plane3u *p3 = ::new(reinterpret_cast(array3u)) Plane3u; p1->coeffs().setRandom(); *p2 = *p1; *p3 = *p1; VERIFY_IS_APPROX(p1->coeffs(), p2->coeffs()); VERIFY_IS_APPROX(p1->coeffs(), p3->coeffs()); } EIGEN_DECLARE_TEST(geo_hyperplane) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( hyperplane(Hyperplane()) ); CALL_SUBTEST_2( hyperplane(Hyperplane()) ); CALL_SUBTEST_2( hyperplane(Hyperplane()) ); CALL_SUBTEST_2( hyperplane_alignment() ); CALL_SUBTEST_3( hyperplane(Hyperplane()) ); CALL_SUBTEST_4( hyperplane(Hyperplane,5>()) ); CALL_SUBTEST_1( lines() ); CALL_SUBTEST_3( lines() ); CALL_SUBTEST_2( planes() ); CALL_SUBTEST_5( planes() ); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/geo_orthomethods.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2009 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include #include #include /* this test covers the following files: Geometry/OrthoMethods.h */ template void orthomethods_3() { typedef typename NumTraits::Real RealScalar; typedef Matrix Matrix3; typedef Matrix Vector3; typedef Matrix Vector4; Vector3 v0 = Vector3::Random(), v1 = Vector3::Random(), v2 = Vector3::Random(); // cross product VERIFY_IS_MUCH_SMALLER_THAN(v1.cross(v2).dot(v1), Scalar(1)); VERIFY_IS_MUCH_SMALLER_THAN(v1.dot(v1.cross(v2)), Scalar(1)); VERIFY_IS_MUCH_SMALLER_THAN(v1.cross(v2).dot(v2), Scalar(1)); VERIFY_IS_MUCH_SMALLER_THAN(v2.dot(v1.cross(v2)), Scalar(1)); VERIFY_IS_MUCH_SMALLER_THAN(v1.cross(Vector3::Random()).dot(v1), Scalar(1)); Matrix3 mat3; mat3 << v0.normalized(), (v0.cross(v1)).normalized(), (v0.cross(v1).cross(v0)).normalized(); VERIFY(mat3.isUnitary()); mat3.setRandom(); VERIFY_IS_APPROX(v0.cross(mat3*v1), -(mat3*v1).cross(v0)); VERIFY_IS_APPROX(v0.cross(mat3.lazyProduct(v1)), -(mat3.lazyProduct(v1)).cross(v0)); // colwise/rowwise cross product mat3.setRandom(); Vector3 vec3 = Vector3::Random(); Matrix3 mcross; int i = internal::random(0,2); mcross = mat3.colwise().cross(vec3); VERIFY_IS_APPROX(mcross.col(i), mat3.col(i).cross(vec3)); VERIFY_IS_MUCH_SMALLER_THAN((mat3.adjoint() * mat3.colwise().cross(vec3)).diagonal().cwiseAbs().sum(), Scalar(1)); VERIFY_IS_MUCH_SMALLER_THAN((mat3.adjoint() * mat3.colwise().cross(Vector3::Random())).diagonal().cwiseAbs().sum(), Scalar(1)); VERIFY_IS_MUCH_SMALLER_THAN((vec3.adjoint() * mat3.colwise().cross(vec3)).cwiseAbs().sum(), Scalar(1)); VERIFY_IS_MUCH_SMALLER_THAN((vec3.adjoint() * Matrix3::Random().colwise().cross(vec3)).cwiseAbs().sum(), Scalar(1)); mcross = mat3.rowwise().cross(vec3); VERIFY_IS_APPROX(mcross.row(i), mat3.row(i).cross(vec3)); // cross3 Vector4 v40 = Vector4::Random(), v41 = Vector4::Random(), v42 = Vector4::Random(); v40.w() = v41.w() = v42.w() = 0; v42.template head<3>() = v40.template head<3>().cross(v41.template head<3>()); VERIFY_IS_APPROX(v40.cross3(v41), v42); VERIFY_IS_MUCH_SMALLER_THAN(v40.cross3(Vector4::Random()).dot(v40), Scalar(1)); // check mixed product typedef Matrix RealVector3; RealVector3 rv1 = RealVector3::Random(); VERIFY_IS_APPROX(v1.cross(rv1.template cast()), v1.cross(rv1)); VERIFY_IS_APPROX(rv1.template cast().cross(v1), rv1.cross(v1)); } template void orthomethods(int size=Size) { typedef typename NumTraits::Real RealScalar; typedef Matrix VectorType; typedef Matrix Matrix3N; typedef Matrix MatrixN3; typedef Matrix Vector3; VectorType v0 = VectorType::Random(size); // unitOrthogonal VERIFY_IS_MUCH_SMALLER_THAN(v0.unitOrthogonal().dot(v0), Scalar(1)); VERIFY_IS_APPROX(v0.unitOrthogonal().norm(), RealScalar(1)); if (size>=3) { v0.template head<2>().setZero(); v0.tail(size-2).setRandom(); VERIFY_IS_MUCH_SMALLER_THAN(v0.unitOrthogonal().dot(v0), Scalar(1)); VERIFY_IS_APPROX(v0.unitOrthogonal().norm(), RealScalar(1)); } // colwise/rowwise cross product Vector3 vec3 = Vector3::Random(); int i = internal::random(0,size-1); Matrix3N mat3N(3,size), mcross3N(3,size); mat3N.setRandom(); mcross3N = mat3N.colwise().cross(vec3); VERIFY_IS_APPROX(mcross3N.col(i), mat3N.col(i).cross(vec3)); MatrixN3 matN3(size,3), mcrossN3(size,3); matN3.setRandom(); mcrossN3 = matN3.rowwise().cross(vec3); VERIFY_IS_APPROX(mcrossN3.row(i), matN3.row(i).cross(vec3)); } EIGEN_DECLARE_TEST(geo_orthomethods) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( orthomethods_3() ); CALL_SUBTEST_2( orthomethods_3() ); CALL_SUBTEST_4( orthomethods_3 >() ); CALL_SUBTEST_1( (orthomethods()) ); CALL_SUBTEST_2( (orthomethods()) ); CALL_SUBTEST_1( (orthomethods()) ); CALL_SUBTEST_2( (orthomethods()) ); CALL_SUBTEST_3( (orthomethods()) ); CALL_SUBTEST_4( (orthomethods,8>()) ); CALL_SUBTEST_5( (orthomethods(36)) ); CALL_SUBTEST_6( (orthomethods(35)) ); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/geo_parametrizedline.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // Copyright (C) 2008 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include #include #include template void parametrizedline(const LineType& _line) { /* this test covers the following files: ParametrizedLine.h */ using std::abs; const Index dim = _line.dim(); typedef typename LineType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef Matrix VectorType; typedef Hyperplane HyperplaneType; typedef Matrix MatrixType; VectorType p0 = VectorType::Random(dim); VectorType p1 = VectorType::Random(dim); VectorType d0 = VectorType::Random(dim).normalized(); LineType l0(p0, d0); Scalar s0 = internal::random(); Scalar s1 = abs(internal::random()); VERIFY_IS_MUCH_SMALLER_THAN( l0.distance(p0), RealScalar(1) ); VERIFY_IS_MUCH_SMALLER_THAN( l0.distance(p0+s0*d0), RealScalar(1) ); VERIFY_IS_APPROX( (l0.projection(p1)-p1).norm(), l0.distance(p1) ); VERIFY_IS_MUCH_SMALLER_THAN( l0.distance(l0.projection(p1)), RealScalar(1) ); VERIFY_IS_APPROX( Scalar(l0.distance((p0+s0*d0) + d0.unitOrthogonal() * s1)), s1 ); // casting const int Dim = LineType::AmbientDimAtCompileTime; typedef typename GetDifferentType::type OtherScalar; ParametrizedLine hp1f = l0.template cast(); VERIFY_IS_APPROX(hp1f.template cast(),l0); ParametrizedLine hp1d = l0.template cast(); VERIFY_IS_APPROX(hp1d.template cast(),l0); // intersections VectorType p2 = VectorType::Random(dim); VectorType n2 = VectorType::Random(dim).normalized(); HyperplaneType hp(p2,n2); Scalar t = l0.intersectionParameter(hp); VectorType pi = l0.pointAt(t); VERIFY_IS_MUCH_SMALLER_THAN(hp.signedDistance(pi), RealScalar(1)); VERIFY_IS_MUCH_SMALLER_THAN(l0.distance(pi), RealScalar(1)); VERIFY_IS_APPROX(l0.intersectionPoint(hp), pi); // transform if (!NumTraits::IsComplex) { MatrixType rot = MatrixType::Random(dim,dim).householderQr().householderQ(); DiagonalMatrix scaling(VectorType::Random()); Translation translation(VectorType::Random()); while(scaling.diagonal().cwiseAbs().minCoeff() void parametrizedline_alignment() { typedef ParametrizedLine Line4a; typedef ParametrizedLine Line4u; EIGEN_ALIGN_MAX Scalar array1[16]; EIGEN_ALIGN_MAX Scalar array2[16]; EIGEN_ALIGN_MAX Scalar array3[16+1]; Scalar* array3u = array3+1; Line4a *p1 = ::new(reinterpret_cast(array1)) Line4a; Line4u *p2 = ::new(reinterpret_cast(array2)) Line4u; Line4u *p3 = ::new(reinterpret_cast(array3u)) Line4u; p1->origin().setRandom(); p1->direction().setRandom(); *p2 = *p1; *p3 = *p1; VERIFY_IS_APPROX(p1->origin(), p2->origin()); VERIFY_IS_APPROX(p1->origin(), p3->origin()); VERIFY_IS_APPROX(p1->direction(), p2->direction()); VERIFY_IS_APPROX(p1->direction(), p3->direction()); } EIGEN_DECLARE_TEST(geo_parametrizedline) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( parametrizedline(ParametrizedLine()) ); CALL_SUBTEST_2( parametrizedline(ParametrizedLine()) ); CALL_SUBTEST_2( parametrizedline_alignment() ); CALL_SUBTEST_3( parametrizedline(ParametrizedLine()) ); CALL_SUBTEST_3( parametrizedline_alignment() ); CALL_SUBTEST_4( parametrizedline(ParametrizedLine,5>()) ); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/geo_quaternion.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2009 Gael Guennebaud // Copyright (C) 2009 Mathieu Gautier // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include #include #include #include "AnnoyingScalar.h" template T bounded_acos(T v) { using std::acos; using std::min; using std::max; return acos((max)(T(-1),(min)(v,T(1)))); } template void check_slerp(const QuatType& q0, const QuatType& q1) { using std::abs; typedef typename QuatType::Scalar Scalar; typedef AngleAxis AA; Scalar largeEps = test_precision(); Scalar theta_tot = AA(q1*q0.inverse()).angle(); if(theta_tot>Scalar(EIGEN_PI)) theta_tot = Scalar(2.)*Scalar(EIGEN_PI)-theta_tot; for(Scalar t=0; t<=Scalar(1.001); t+=Scalar(0.1)) { QuatType q = q0.slerp(t,q1); Scalar theta = AA(q*q0.inverse()).angle(); VERIFY(abs(q.norm() - 1) < largeEps); if(theta_tot==0) VERIFY(theta_tot==0); else VERIFY(abs(theta - t * theta_tot) < largeEps); } } template void quaternion(void) { /* this test covers the following files: Quaternion.h */ using std::abs; typedef Matrix Vector3; typedef Matrix Matrix3; typedef Quaternion Quaternionx; typedef AngleAxis AngleAxisx; Scalar largeEps = test_precision(); if (internal::is_same::value) largeEps = Scalar(1e-3); Scalar eps = internal::random() * Scalar(1e-2); Vector3 v0 = Vector3::Random(), v1 = Vector3::Random(), v2 = Vector3::Random(), v3 = Vector3::Random(); Scalar a = internal::random(-Scalar(EIGEN_PI), Scalar(EIGEN_PI)), b = internal::random(-Scalar(EIGEN_PI), Scalar(EIGEN_PI)); // Quaternion: Identity(), setIdentity(); Quaternionx q1, q2; q2.setIdentity(); VERIFY_IS_APPROX(Quaternionx(Quaternionx::Identity()).coeffs(), q2.coeffs()); q1.coeffs().setRandom(); VERIFY_IS_APPROX(q1.coeffs(), (q1*q2).coeffs()); #ifndef EIGEN_NO_IO // Printing std::ostringstream ss; ss << q2; VERIFY(ss.str() == "0i + 0j + 0k + 1"); #endif // concatenation q1 *= q2; q1 = AngleAxisx(a, v0.normalized()); q2 = AngleAxisx(a, v1.normalized()); // angular distance Scalar refangle = abs(AngleAxisx(q1.inverse()*q2).angle()); if (refangle>Scalar(EIGEN_PI)) refangle = Scalar(2)*Scalar(EIGEN_PI) - refangle; if((q1.coeffs()-q2.coeffs()).norm() > Scalar(10)*largeEps) { VERIFY_IS_MUCH_SMALLER_THAN(abs(q1.angularDistance(q2) - refangle), Scalar(1)); } // rotation matrix conversion VERIFY_IS_APPROX(q1 * v2, q1.toRotationMatrix() * v2); VERIFY_IS_APPROX(q1 * q2 * v2, q1.toRotationMatrix() * q2.toRotationMatrix() * v2); VERIFY( (q2*q1).isApprox(q1*q2, largeEps) || !(q2 * q1 * v2).isApprox(q1.toRotationMatrix() * q2.toRotationMatrix() * v2)); q2 = q1.toRotationMatrix(); VERIFY_IS_APPROX(q1*v1,q2*v1); Matrix3 rot1(q1); VERIFY_IS_APPROX(q1*v1,rot1*v1); Quaternionx q3(rot1.transpose()*rot1); VERIFY_IS_APPROX(q3*v1,v1); // angle-axis conversion AngleAxisx aa = AngleAxisx(q1); VERIFY_IS_APPROX(q1 * v1, Quaternionx(aa) * v1); // Do not execute the test if the rotation angle is almost zero, or // the rotation axis and v1 are almost parallel. if (abs(aa.angle()) > Scalar(5)*test_precision() && (aa.axis() - v1.normalized()).norm() < Scalar(1.99) && (aa.axis() + v1.normalized()).norm() < Scalar(1.99)) { VERIFY_IS_NOT_APPROX(q1 * v1, Quaternionx(AngleAxisx(aa.angle()*2,aa.axis())) * v1); } // from two vector creation VERIFY_IS_APPROX( v2.normalized(),(q2.setFromTwoVectors(v1, v2)*v1).normalized()); VERIFY_IS_APPROX( v1.normalized(),(q2.setFromTwoVectors(v1, v1)*v1).normalized()); VERIFY_IS_APPROX(-v1.normalized(),(q2.setFromTwoVectors(v1,-v1)*v1).normalized()); if (internal::is_same::value) { v3 = (v1.array()+eps).matrix(); VERIFY_IS_APPROX( v3.normalized(),(q2.setFromTwoVectors(v1, v3)*v1).normalized()); VERIFY_IS_APPROX(-v3.normalized(),(q2.setFromTwoVectors(v1,-v3)*v1).normalized()); } // from two vector creation static function VERIFY_IS_APPROX( v2.normalized(),(Quaternionx::FromTwoVectors(v1, v2)*v1).normalized()); VERIFY_IS_APPROX( v1.normalized(),(Quaternionx::FromTwoVectors(v1, v1)*v1).normalized()); VERIFY_IS_APPROX(-v1.normalized(),(Quaternionx::FromTwoVectors(v1,-v1)*v1).normalized()); if (internal::is_same::value) { v3 = (v1.array()+eps).matrix(); VERIFY_IS_APPROX( v3.normalized(),(Quaternionx::FromTwoVectors(v1, v3)*v1).normalized()); VERIFY_IS_APPROX(-v3.normalized(),(Quaternionx::FromTwoVectors(v1,-v3)*v1).normalized()); } // inverse and conjugate VERIFY_IS_APPROX(q1 * (q1.inverse() * v1), v1); VERIFY_IS_APPROX(q1 * (q1.conjugate() * v1), v1); // test casting Quaternion q1f = q1.template cast(); VERIFY_IS_APPROX(q1f.template cast(),q1); Quaternion q1d = q1.template cast(); VERIFY_IS_APPROX(q1d.template cast(),q1); // test bug 369 - improper alignment. Quaternionx *q = new Quaternionx; delete q; q1 = Quaternionx::UnitRandom(); q2 = Quaternionx::UnitRandom(); check_slerp(q1,q2); q1 = AngleAxisx(b, v1.normalized()); q2 = AngleAxisx(b+Scalar(EIGEN_PI), v1.normalized()); check_slerp(q1,q2); q1 = AngleAxisx(b, v1.normalized()); q2 = AngleAxisx(-b, -v1.normalized()); check_slerp(q1,q2); q1 = Quaternionx::UnitRandom(); q2.coeffs() = -q1.coeffs(); check_slerp(q1,q2); } template void mapQuaternion(void){ typedef Map, Aligned> MQuaternionA; typedef Map, Aligned> MCQuaternionA; typedef Map > MQuaternionUA; typedef Map > MCQuaternionUA; typedef Quaternion Quaternionx; typedef Matrix Vector3; typedef AngleAxis AngleAxisx; Vector3 v0 = Vector3::Random(), v1 = Vector3::Random(); Scalar a = internal::random(-Scalar(EIGEN_PI), Scalar(EIGEN_PI)); EIGEN_ALIGN_MAX Scalar array1[4]; EIGEN_ALIGN_MAX Scalar array2[4]; EIGEN_ALIGN_MAX Scalar array3[4+1]; Scalar* array3unaligned = array3+1; MQuaternionA mq1(array1); MCQuaternionA mcq1(array1); MQuaternionA mq2(array2); MQuaternionUA mq3(array3unaligned); MCQuaternionUA mcq3(array3unaligned); // std::cerr << array1 << " " << array2 << " " << array3 << "\n"; mq1 = AngleAxisx(a, v0.normalized()); mq2 = mq1; mq3 = mq1; Quaternionx q1 = mq1; Quaternionx q2 = mq2; Quaternionx q3 = mq3; Quaternionx q4 = MCQuaternionUA(array3unaligned); VERIFY_IS_APPROX(q1.coeffs(), q2.coeffs()); VERIFY_IS_APPROX(q1.coeffs(), q3.coeffs()); VERIFY_IS_APPROX(q4.coeffs(), q3.coeffs()); VERIFY_IS_APPROX(mq1 * (mq1.inverse() * v1), v1); VERIFY_IS_APPROX(mq1 * (mq1.conjugate() * v1), v1); VERIFY_IS_APPROX(mcq1 * (mcq1.inverse() * v1), v1); VERIFY_IS_APPROX(mcq1 * (mcq1.conjugate() * v1), v1); VERIFY_IS_APPROX(mq3 * (mq3.inverse() * v1), v1); VERIFY_IS_APPROX(mq3 * (mq3.conjugate() * v1), v1); VERIFY_IS_APPROX(mcq3 * (mcq3.inverse() * v1), v1); VERIFY_IS_APPROX(mcq3 * (mcq3.conjugate() * v1), v1); VERIFY_IS_APPROX(mq1*mq2, q1*q2); VERIFY_IS_APPROX(mq3*mq2, q3*q2); VERIFY_IS_APPROX(mcq1*mq2, q1*q2); VERIFY_IS_APPROX(mcq3*mq2, q3*q2); // Bug 1461, compilation issue with Map::w(), and other reference/constness checks: VERIFY_IS_APPROX(mcq3.coeffs().x() + mcq3.coeffs().y() + mcq3.coeffs().z() + mcq3.coeffs().w(), mcq3.coeffs().sum()); VERIFY_IS_APPROX(mcq3.x() + mcq3.y() + mcq3.z() + mcq3.w(), mcq3.coeffs().sum()); mq3.w() = 1; const Quaternionx& cq3(q3); VERIFY( &cq3.x() == &q3.x() ); const MQuaternionUA& cmq3(mq3); VERIFY( &cmq3.x() == &mq3.x() ); // FIXME the following should be ok. The problem is that currently the LValueBit flag // is used to determine whether we can return a coeff by reference or not, which is not enough for Map. //const MCQuaternionUA& cmcq3(mcq3); //VERIFY( &cmcq3.x() == &mcq3.x() ); // test cast { Quaternion q1f = mq1.template cast(); VERIFY_IS_APPROX(q1f.template cast(),mq1); Quaternion q1d = mq1.template cast(); VERIFY_IS_APPROX(q1d.template cast(),mq1); } } template void quaternionAlignment(void){ typedef Quaternion QuaternionA; typedef Quaternion QuaternionUA; EIGEN_ALIGN_MAX Scalar array1[4]; EIGEN_ALIGN_MAX Scalar array2[4]; EIGEN_ALIGN_MAX Scalar array3[4+1]; Scalar* arrayunaligned = array3+1; QuaternionA *q1 = ::new(reinterpret_cast(array1)) QuaternionA; QuaternionUA *q2 = ::new(reinterpret_cast(array2)) QuaternionUA; QuaternionUA *q3 = ::new(reinterpret_cast(arrayunaligned)) QuaternionUA; q1->coeffs().setRandom(); *q2 = *q1; *q3 = *q1; VERIFY_IS_APPROX(q1->coeffs(), q2->coeffs()); VERIFY_IS_APPROX(q1->coeffs(), q3->coeffs()); } template void check_const_correctness(const PlainObjectType&) { // there's a lot that we can't test here while still having this test compile! // the only possible approach would be to run a script trying to compile stuff and checking that it fails. // CMake can help with that. // verify that map-to-const don't have LvalueBit typedef typename internal::add_const::type ConstPlainObjectType; VERIFY( !(internal::traits >::Flags & LvalueBit) ); VERIFY( !(internal::traits >::Flags & LvalueBit) ); VERIFY( !(Map::Flags & LvalueBit) ); VERIFY( !(Map::Flags & LvalueBit) ); } #if EIGEN_HAS_RVALUE_REFERENCES // Regression for bug 1573 struct MovableClass { // The following line is a workaround for gcc 4.7 and 4.8 (see bug 1573 comments). static_assert(std::is_nothrow_move_constructible::value,""); MovableClass() = default; MovableClass(const MovableClass&) = default; MovableClass(MovableClass&&) noexcept = default; MovableClass& operator=(const MovableClass&) = default; MovableClass& operator=(MovableClass&&) = default; Quaternionf m_quat; }; #endif EIGEN_DECLARE_TEST(geo_quaternion) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1(( quaternion() )); CALL_SUBTEST_1( check_const_correctness(Quaternionf()) ); CALL_SUBTEST_1(( quaternion() )); CALL_SUBTEST_1(( quaternionAlignment() )); CALL_SUBTEST_1( mapQuaternion() ); CALL_SUBTEST_2(( quaternion() )); CALL_SUBTEST_2( check_const_correctness(Quaterniond()) ); CALL_SUBTEST_2(( quaternion() )); CALL_SUBTEST_2(( quaternionAlignment() )); CALL_SUBTEST_2( mapQuaternion() ); #ifndef EIGEN_TEST_ANNOYING_SCALAR_DONT_THROW AnnoyingScalar::dont_throw = true; #endif CALL_SUBTEST_3(( quaternion() )); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/geo_transformations.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2009 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include #include #include template Matrix angleToVec(T a) { return Matrix(std::cos(a), std::sin(a)); } // This permits to workaround a bug in clang/llvm code generation. template EIGEN_DONT_INLINE void dont_over_optimize(T& x) { volatile typename T::Scalar tmp = x(0); x(0) = tmp; } template void non_projective_only() { /* this test covers the following files: Cross.h Quaternion.h, Transform.cpp */ typedef Matrix Vector3; typedef Quaternion Quaternionx; typedef AngleAxis AngleAxisx; typedef Transform Transform3; typedef DiagonalMatrix AlignedScaling3; typedef Translation Translation3; Vector3 v0 = Vector3::Random(), v1 = Vector3::Random(); Transform3 t0, t1, t2; Scalar a = internal::random(-Scalar(EIGEN_PI), Scalar(EIGEN_PI)); Quaternionx q1, q2; q1 = AngleAxisx(a, v0.normalized()); t0 = Transform3::Identity(); VERIFY_IS_APPROX(t0.matrix(), Transform3::MatrixType::Identity()); t0.linear() = q1.toRotationMatrix(); v0 << 50, 2, 1; t0.scale(v0); VERIFY_IS_APPROX( (t0 * Vector3(1,0,0)).template head<3>().norm(), v0.x()); t0.setIdentity(); t1.setIdentity(); v1 << 1, 2, 3; t0.linear() = q1.toRotationMatrix(); t0.pretranslate(v0); t0.scale(v1); t1.linear() = q1.conjugate().toRotationMatrix(); t1.prescale(v1.cwiseInverse()); t1.translate(-v0); VERIFY((t0 * t1).matrix().isIdentity(test_precision())); t1.fromPositionOrientationScale(v0, q1, v1); VERIFY_IS_APPROX(t1.matrix(), t0.matrix()); VERIFY_IS_APPROX(t1*v1, t0*v1); // translation * vector t0.setIdentity(); t0.translate(v0); VERIFY_IS_APPROX((t0 * v1).template head<3>(), Translation3(v0) * v1); // AlignedScaling * vector t0.setIdentity(); t0.scale(v0); VERIFY_IS_APPROX((t0 * v1).template head<3>(), AlignedScaling3(v0) * v1); } template void transformations() { /* this test covers the following files: Cross.h Quaternion.h, Transform.cpp */ using std::cos; using std::abs; typedef Matrix Matrix3; typedef Matrix Matrix4; typedef Matrix Vector2; typedef Matrix Vector3; typedef Matrix Vector4; typedef Quaternion Quaternionx; typedef AngleAxis AngleAxisx; typedef Transform Transform2; typedef Transform Transform3; typedef typename Transform3::MatrixType MatrixType; typedef DiagonalMatrix AlignedScaling3; typedef Translation Translation2; typedef Translation Translation3; Vector3 v0 = Vector3::Random(), v1 = Vector3::Random(); Matrix3 matrot1, m; Scalar a = internal::random(-Scalar(EIGEN_PI), Scalar(EIGEN_PI)); Scalar s0 = internal::random(), s1 = internal::random(); while(v0.norm() < test_precision()) v0 = Vector3::Random(); while(v1.norm() < test_precision()) v1 = Vector3::Random(); VERIFY_IS_APPROX(v0, AngleAxisx(a, v0.normalized()) * v0); VERIFY_IS_APPROX(-v0, AngleAxisx(Scalar(EIGEN_PI), v0.unitOrthogonal()) * v0); if(abs(cos(a)) > test_precision()) { VERIFY_IS_APPROX(cos(a)*v0.squaredNorm(), v0.dot(AngleAxisx(a, v0.unitOrthogonal()) * v0)); } m = AngleAxisx(a, v0.normalized()).toRotationMatrix().adjoint(); VERIFY_IS_APPROX(Matrix3::Identity(), m * AngleAxisx(a, v0.normalized())); VERIFY_IS_APPROX(Matrix3::Identity(), AngleAxisx(a, v0.normalized()) * m); Quaternionx q1, q2; q1 = AngleAxisx(a, v0.normalized()); q2 = AngleAxisx(a, v1.normalized()); // rotation matrix conversion matrot1 = AngleAxisx(Scalar(0.1), Vector3::UnitX()) * AngleAxisx(Scalar(0.2), Vector3::UnitY()) * AngleAxisx(Scalar(0.3), Vector3::UnitZ()); VERIFY_IS_APPROX(matrot1 * v1, AngleAxisx(Scalar(0.1), Vector3(1,0,0)).toRotationMatrix() * (AngleAxisx(Scalar(0.2), Vector3(0,1,0)).toRotationMatrix() * (AngleAxisx(Scalar(0.3), Vector3(0,0,1)).toRotationMatrix() * v1))); // angle-axis conversion AngleAxisx aa = AngleAxisx(q1); VERIFY_IS_APPROX(q1 * v1, Quaternionx(aa) * v1); // The following test is stable only if 2*angle != angle and v1 is not colinear with axis if( (abs(aa.angle()) > test_precision()) && (abs(aa.axis().dot(v1.normalized()))<(Scalar(1)-Scalar(4)*test_precision())) ) { VERIFY( !(q1 * v1).isApprox(Quaternionx(AngleAxisx(aa.angle()*2,aa.axis())) * v1) ); } aa.fromRotationMatrix(aa.toRotationMatrix()); VERIFY_IS_APPROX(q1 * v1, Quaternionx(aa) * v1); // The following test is stable only if 2*angle != angle and v1 is not colinear with axis if( (abs(aa.angle()) > test_precision()) && (abs(aa.axis().dot(v1.normalized()))<(Scalar(1)-Scalar(4)*test_precision())) ) { VERIFY( !(q1 * v1).isApprox(Quaternionx(AngleAxisx(aa.angle()*2,aa.axis())) * v1) ); } // AngleAxis VERIFY_IS_APPROX(AngleAxisx(a,v1.normalized()).toRotationMatrix(), Quaternionx(AngleAxisx(a,v1.normalized())).toRotationMatrix()); AngleAxisx aa1; m = q1.toRotationMatrix(); aa1 = m; VERIFY_IS_APPROX(AngleAxisx(m).toRotationMatrix(), Quaternionx(m).toRotationMatrix()); // Transform // TODO complete the tests ! a = 0; while (abs(a)(-Scalar(0.4)*Scalar(EIGEN_PI), Scalar(0.4)*Scalar(EIGEN_PI)); q1 = AngleAxisx(a, v0.normalized()); Transform3 t0, t1, t2; // first test setIdentity() and Identity() t0.setIdentity(); VERIFY_IS_APPROX(t0.matrix(), Transform3::MatrixType::Identity()); t0.matrix().setZero(); t0 = Transform3::Identity(); VERIFY_IS_APPROX(t0.matrix(), Transform3::MatrixType::Identity()); t0.setIdentity(); t1.setIdentity(); v1 << 1, 2, 3; t0.linear() = q1.toRotationMatrix(); t0.pretranslate(v0); t0.scale(v1); t1.linear() = q1.conjugate().toRotationMatrix(); t1.prescale(v1.cwiseInverse()); t1.translate(-v0); VERIFY((t0 * t1).matrix().isIdentity(test_precision())); t1.fromPositionOrientationScale(v0, q1, v1); VERIFY_IS_APPROX(t1.matrix(), t0.matrix()); t0.setIdentity(); t0.scale(v0).rotate(q1.toRotationMatrix()); t1.setIdentity(); t1.scale(v0).rotate(q1); VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); t0.setIdentity(); t0.scale(v0).rotate(AngleAxisx(q1)); VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); VERIFY_IS_APPROX(t0.scale(a).matrix(), t1.scale(Vector3::Constant(a)).matrix()); VERIFY_IS_APPROX(t0.prescale(a).matrix(), t1.prescale(Vector3::Constant(a)).matrix()); // More transform constructors, operator=, operator*= Matrix3 mat3 = Matrix3::Random(); Matrix4 mat4; mat4 << mat3 , Vector3::Zero() , Vector4::Zero().transpose(); Transform3 tmat3(mat3), tmat4(mat4); if(Mode!=int(AffineCompact)) tmat4.matrix()(3,3) = Scalar(1); VERIFY_IS_APPROX(tmat3.matrix(), tmat4.matrix()); Scalar a3 = internal::random(-Scalar(EIGEN_PI), Scalar(EIGEN_PI)); Vector3 v3 = Vector3::Random().normalized(); AngleAxisx aa3(a3, v3); Transform3 t3(aa3); Transform3 t4; t4 = aa3; VERIFY_IS_APPROX(t3.matrix(), t4.matrix()); t4.rotate(AngleAxisx(-a3,v3)); VERIFY_IS_APPROX(t4.matrix(), MatrixType::Identity()); t4 *= aa3; VERIFY_IS_APPROX(t3.matrix(), t4.matrix()); do { v3 = Vector3::Random(); dont_over_optimize(v3); } while (v3.cwiseAbs().minCoeff()::epsilon()); Translation3 tv3(v3); Transform3 t5(tv3); t4 = tv3; VERIFY_IS_APPROX(t5.matrix(), t4.matrix()); t4.translate((-v3).eval()); VERIFY_IS_APPROX(t4.matrix(), MatrixType::Identity()); t4 *= tv3; VERIFY_IS_APPROX(t5.matrix(), t4.matrix()); AlignedScaling3 sv3(v3); Transform3 t6(sv3); t4 = sv3; VERIFY_IS_APPROX(t6.matrix(), t4.matrix()); t4.scale(v3.cwiseInverse()); VERIFY_IS_APPROX(t4.matrix(), MatrixType::Identity()); t4 *= sv3; VERIFY_IS_APPROX(t6.matrix(), t4.matrix()); // matrix * transform VERIFY_IS_APPROX((t3.matrix()*t4).matrix(), (t3*t4).matrix()); // chained Transform product VERIFY_IS_APPROX(((t3*t4)*t5).matrix(), (t3*(t4*t5)).matrix()); // check that Transform product doesn't have aliasing problems t5 = t4; t5 = t5*t5; VERIFY_IS_APPROX(t5, t4*t4); // 2D transformation Transform2 t20, t21; Vector2 v20 = Vector2::Random(); Vector2 v21 = Vector2::Random(); for (int k=0; k<2; ++k) if (abs(v21[k])(a).toRotationMatrix(); VERIFY_IS_APPROX(t20.fromPositionOrientationScale(v20,a,v21).matrix(), t21.pretranslate(v20).scale(v21).matrix()); t21.setIdentity(); t21.linear() = Rotation2D(-a).toRotationMatrix(); VERIFY( (t20.fromPositionOrientationScale(v20,a,v21) * (t21.prescale(v21.cwiseInverse()).translate(-v20))).matrix().isIdentity(test_precision()) ); // Transform - new API // 3D t0.setIdentity(); t0.rotate(q1).scale(v0).translate(v0); // mat * aligned scaling and mat * translation t1 = (Matrix3(q1) * AlignedScaling3(v0)) * Translation3(v0); VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); t1 = (Matrix3(q1) * Eigen::Scaling(v0)) * Translation3(v0); VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); t1 = (q1 * Eigen::Scaling(v0)) * Translation3(v0); VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); // mat * transformation and aligned scaling * translation t1 = Matrix3(q1) * (AlignedScaling3(v0) * Translation3(v0)); VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); t0.setIdentity(); t0.scale(s0).translate(v0); t1 = Eigen::Scaling(s0) * Translation3(v0); VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); t0.prescale(s0); t1 = Eigen::Scaling(s0) * t1; VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); t0 = t3; t0.scale(s0); t1 = t3 * Eigen::Scaling(s0,s0,s0); VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); t0.prescale(s0); t1 = Eigen::Scaling(s0,s0,s0) * t1; VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); t0 = t3; t0.scale(s0); t1 = t3 * Eigen::Scaling(s0); VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); t0.prescale(s0); t1 = Eigen::Scaling(s0) * t1; VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); t0.setIdentity(); t0.prerotate(q1).prescale(v0).pretranslate(v0); // translation * aligned scaling and transformation * mat t1 = (Translation3(v0) * AlignedScaling3(v0)) * Transform3(q1); VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); // scaling * mat and translation * mat t1 = Translation3(v0) * (AlignedScaling3(v0) * Transform3(q1)); VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); t0.setIdentity(); t0.scale(v0).translate(v0).rotate(q1); // translation * mat and aligned scaling * transformation t1 = AlignedScaling3(v0) * (Translation3(v0) * Transform3(q1)); VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); // transformation * aligned scaling t0.scale(v0); t1 *= AlignedScaling3(v0); VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); t1 = AlignedScaling3(v0) * (Translation3(v0) * Transform3(q1)); t1 = t1 * v0.asDiagonal(); VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); // transformation * translation t0.translate(v0); t1 = t1 * Translation3(v0); VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); // translation * transformation t0.pretranslate(v0); t1 = Translation3(v0) * t1; VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); // transform * quaternion t0.rotate(q1); t1 = t1 * q1; VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); // translation * quaternion t0.translate(v1).rotate(q1); t1 = t1 * (Translation3(v1) * q1); VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); // aligned scaling * quaternion t0.scale(v1).rotate(q1); t1 = t1 * (AlignedScaling3(v1) * q1); VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); // quaternion * transform t0.prerotate(q1); t1 = q1 * t1; VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); // quaternion * translation t0.rotate(q1).translate(v1); t1 = t1 * (q1 * Translation3(v1)); VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); // quaternion * aligned scaling t0.rotate(q1).scale(v1); t1 = t1 * (q1 * AlignedScaling3(v1)); VERIFY_IS_APPROX(t0.matrix(), t1.matrix()); // test transform inversion t0.setIdentity(); t0.translate(v0); do { t0.linear().setRandom(); } while(t0.linear().jacobiSvd().singularValues()(2)()); Matrix4 t044 = Matrix4::Zero(); t044(3,3) = 1; t044.block(0,0,t0.matrix().rows(),4) = t0.matrix(); VERIFY_IS_APPROX(t0.inverse(Affine).matrix(), t044.inverse().block(0,0,t0.matrix().rows(),4)); t0.setIdentity(); t0.translate(v0).rotate(q1); t044 = Matrix4::Zero(); t044(3,3) = 1; t044.block(0,0,t0.matrix().rows(),4) = t0.matrix(); VERIFY_IS_APPROX(t0.inverse(Isometry).matrix(), t044.inverse().block(0,0,t0.matrix().rows(),4)); Matrix3 mat_rotation, mat_scaling; t0.setIdentity(); t0.translate(v0).rotate(q1).scale(v1); t0.computeRotationScaling(&mat_rotation, &mat_scaling); VERIFY_IS_APPROX(t0.linear(), mat_rotation * mat_scaling); VERIFY_IS_APPROX(mat_rotation*mat_rotation.adjoint(), Matrix3::Identity()); VERIFY_IS_APPROX(mat_rotation.determinant(), Scalar(1)); t0.computeScalingRotation(&mat_scaling, &mat_rotation); VERIFY_IS_APPROX(t0.linear(), mat_scaling * mat_rotation); VERIFY_IS_APPROX(mat_rotation*mat_rotation.adjoint(), Matrix3::Identity()); VERIFY_IS_APPROX(mat_rotation.determinant(), Scalar(1)); // test casting Transform t1f = t1.template cast(); VERIFY_IS_APPROX(t1f.template cast(),t1); Transform t1d = t1.template cast(); VERIFY_IS_APPROX(t1d.template cast(),t1); Translation3 tr1(v0); Translation tr1f = tr1.template cast(); VERIFY_IS_APPROX(tr1f.template cast(),tr1); Translation tr1d = tr1.template cast(); VERIFY_IS_APPROX(tr1d.template cast(),tr1); AngleAxis aa1f = aa1.template cast(); VERIFY_IS_APPROX(aa1f.template cast(),aa1); AngleAxis aa1d = aa1.template cast(); VERIFY_IS_APPROX(aa1d.template cast(),aa1); Rotation2D r2d1(internal::random()); Rotation2D r2d1f = r2d1.template cast(); VERIFY_IS_APPROX(r2d1f.template cast(),r2d1); Rotation2D r2d1d = r2d1.template cast(); VERIFY_IS_APPROX(r2d1d.template cast(),r2d1); for(int k=0; k<100; ++k) { Scalar angle = internal::random(-100,100); Rotation2D rot2(angle); VERIFY( rot2.smallestPositiveAngle() >= 0 ); VERIFY( rot2.smallestPositiveAngle() <= Scalar(2)*Scalar(EIGEN_PI) ); VERIFY_IS_APPROX( angleToVec(rot2.smallestPositiveAngle()), angleToVec(rot2.angle()) ); VERIFY( rot2.smallestAngle() >= -Scalar(EIGEN_PI) ); VERIFY( rot2.smallestAngle() <= Scalar(EIGEN_PI) ); VERIFY_IS_APPROX( angleToVec(rot2.smallestAngle()), angleToVec(rot2.angle()) ); Matrix rot2_as_mat(rot2); Rotation2D rot3(rot2_as_mat); VERIFY_IS_APPROX( angleToVec(rot2.smallestAngle()), angleToVec(rot3.angle()) ); } s0 = internal::random(-100,100); s1 = internal::random(-100,100); Rotation2D R0(s0), R1(s1); t20 = Translation2(v20) * (R0 * Eigen::Scaling(s0)); t21 = Translation2(v20) * R0 * Eigen::Scaling(s0); VERIFY_IS_APPROX(t20,t21); t20 = Translation2(v20) * (R0 * R0.inverse() * Eigen::Scaling(s0)); t21 = Translation2(v20) * Eigen::Scaling(s0); VERIFY_IS_APPROX(t20,t21); VERIFY_IS_APPROX(s0, (R0.slerp(0, R1)).angle()); VERIFY_IS_APPROX( angleToVec(R1.smallestPositiveAngle()), angleToVec((R0.slerp(1, R1)).smallestPositiveAngle()) ); VERIFY_IS_APPROX(R0.smallestPositiveAngle(), (R0.slerp(0.5, R0)).smallestPositiveAngle()); if(std::cos(s0)>0) VERIFY_IS_MUCH_SMALLER_THAN((R0.slerp(0.5, R0.inverse())).smallestAngle(), Scalar(1)); else VERIFY_IS_APPROX(Scalar(EIGEN_PI), (R0.slerp(0.5, R0.inverse())).smallestPositiveAngle()); // Check path length Scalar l = 0; int path_steps = 100; for(int k=0; k::epsilon()*Scalar(path_steps/2))); // check basic features { Rotation2D r1; // default ctor r1 = Rotation2D(s0); // copy assignment VERIFY_IS_APPROX(r1.angle(),s0); Rotation2D r2(r1); // copy ctor VERIFY_IS_APPROX(r2.angle(),s0); } { Transform3 t32(Matrix4::Random()), t33, t34; t34 = t33 = t32; t32.scale(v0); t33*=AlignedScaling3(v0); VERIFY_IS_APPROX(t32.matrix(), t33.matrix()); t33 = t34 * AlignedScaling3(v0); VERIFY_IS_APPROX(t32.matrix(), t33.matrix()); } } template void transform_associativity_left(const A1& a1, const A2& a2, const P& p, const Q& q, const V& v, const H& h) { VERIFY_IS_APPROX( q*(a1*v), (q*a1)*v ); VERIFY_IS_APPROX( q*(a2*v), (q*a2)*v ); VERIFY_IS_APPROX( q*(p*h).hnormalized(), ((q*p)*h).hnormalized() ); } template void transform_associativity2(const A1& a1, const A2& a2, const P& p, const Q& q, const V& v, const H& h) { VERIFY_IS_APPROX( a1*(q*v), (a1*q)*v ); VERIFY_IS_APPROX( a2*(q*v), (a2*q)*v ); VERIFY_IS_APPROX( p *(q*v).homogeneous(), (p *q)*v.homogeneous() ); transform_associativity_left(a1, a2,p, q, v, h); } template void transform_associativity(const RotationType& R) { typedef Matrix VectorType; typedef Matrix HVectorType; typedef Matrix LinearType; typedef Matrix MatrixType; typedef Transform AffineCompactType; typedef Transform AffineType; typedef Transform ProjectiveType; typedef DiagonalMatrix ScalingType; typedef Translation TranslationType; AffineCompactType A1c; A1c.matrix().setRandom(); AffineCompactType A2c; A2c.matrix().setRandom(); AffineType A1(A1c); AffineType A2(A2c); ProjectiveType P1; P1.matrix().setRandom(); VectorType v1 = VectorType::Random(); VectorType v2 = VectorType::Random(); HVectorType h1 = HVectorType::Random(); Scalar s1 = internal::random(); LinearType L = LinearType::Random(); MatrixType M = MatrixType::Random(); CALL_SUBTEST( transform_associativity2(A1c, A1, P1, A2, v2, h1) ); CALL_SUBTEST( transform_associativity2(A1c, A1, P1, A2c, v2, h1) ); CALL_SUBTEST( transform_associativity2(A1c, A1, P1, v1.asDiagonal(), v2, h1) ); CALL_SUBTEST( transform_associativity2(A1c, A1, P1, ScalingType(v1), v2, h1) ); CALL_SUBTEST( transform_associativity2(A1c, A1, P1, Scaling(v1), v2, h1) ); CALL_SUBTEST( transform_associativity2(A1c, A1, P1, Scaling(s1), v2, h1) ); CALL_SUBTEST( transform_associativity2(A1c, A1, P1, TranslationType(v1), v2, h1) ); CALL_SUBTEST( transform_associativity_left(A1c, A1, P1, L, v2, h1) ); CALL_SUBTEST( transform_associativity2(A1c, A1, P1, R, v2, h1) ); VERIFY_IS_APPROX( A1*(M*h1), (A1*M)*h1 ); VERIFY_IS_APPROX( A1c*(M*h1), (A1c*M)*h1 ); VERIFY_IS_APPROX( P1*(M*h1), (P1*M)*h1 ); VERIFY_IS_APPROX( M*(A1*h1), (M*A1)*h1 ); VERIFY_IS_APPROX( M*(A1c*h1), (M*A1c)*h1 ); VERIFY_IS_APPROX( M*(P1*h1), ((M*P1)*h1) ); } template void transform_alignment() { typedef Transform Projective3a; typedef Transform Projective3u; EIGEN_ALIGN_MAX Scalar array1[16]; EIGEN_ALIGN_MAX Scalar array2[16]; EIGEN_ALIGN_MAX Scalar array3[16+1]; Scalar* array3u = array3+1; Projective3a *p1 = ::new(reinterpret_cast(array1)) Projective3a; Projective3u *p2 = ::new(reinterpret_cast(array2)) Projective3u; Projective3u *p3 = ::new(reinterpret_cast(array3u)) Projective3u; p1->matrix().setRandom(); *p2 = *p1; *p3 = *p1; VERIFY_IS_APPROX(p1->matrix(), p2->matrix()); VERIFY_IS_APPROX(p1->matrix(), p3->matrix()); VERIFY_IS_APPROX( (*p1) * (*p1), (*p2)*(*p3)); } template void transform_products() { typedef Matrix Mat; typedef Transform Proj; typedef Transform Aff; typedef Transform AffC; Proj p; p.matrix().setRandom(); Aff a; a.linear().setRandom(); a.translation().setRandom(); AffC ac = a; Mat p_m(p.matrix()), a_m(a.matrix()); VERIFY_IS_APPROX((p*p).matrix(), p_m*p_m); VERIFY_IS_APPROX((a*a).matrix(), a_m*a_m); VERIFY_IS_APPROX((p*a).matrix(), p_m*a_m); VERIFY_IS_APPROX((a*p).matrix(), a_m*p_m); VERIFY_IS_APPROX((ac*a).matrix(), a_m*a_m); VERIFY_IS_APPROX((a*ac).matrix(), a_m*a_m); VERIFY_IS_APPROX((p*ac).matrix(), p_m*a_m); VERIFY_IS_APPROX((ac*p).matrix(), a_m*p_m); } template void transformations_no_scale() { /* this test covers the following files: Cross.h Quaternion.h, Transform.h */ typedef Matrix Vector3; typedef Matrix Vector4; typedef Quaternion Quaternionx; typedef AngleAxis AngleAxisx; typedef Transform Transform3; typedef Translation Translation3; typedef Matrix Matrix4; Vector3 v0 = Vector3::Random(), v1 = Vector3::Random(); Transform3 t0, t1, t2; Scalar a = internal::random(-Scalar(EIGEN_PI), Scalar(EIGEN_PI)); Quaternionx q1, q2; q1 = AngleAxisx(a, v0.normalized()); t0 = Transform3::Identity(); VERIFY_IS_APPROX(t0.matrix(), Transform3::MatrixType::Identity()); t0.setIdentity(); t1.setIdentity(); v1 = Vector3::Ones(); t0.linear() = q1.toRotationMatrix(); t0.pretranslate(v0); t1.linear() = q1.conjugate().toRotationMatrix(); t1.translate(-v0); VERIFY((t0 * t1).matrix().isIdentity(test_precision())); t1.fromPositionOrientationScale(v0, q1, v1); VERIFY_IS_APPROX(t1.matrix(), t0.matrix()); VERIFY_IS_APPROX(t1*v1, t0*v1); // translation * vector t0.setIdentity(); t0.translate(v0); VERIFY_IS_APPROX((t0 * v1).template head<3>(), Translation3(v0) * v1); // Conversion to matrix. Transform3 t3; t3.linear() = q1.toRotationMatrix(); t3.translation() = v1; Matrix4 m3 = t3.matrix(); VERIFY((m3 * m3.inverse()).isIdentity(test_precision())); // Verify implicit last row is initialized. VERIFY_IS_APPROX(Vector4(m3.row(3)), Vector4(0.0, 0.0, 0.0, 1.0)); VERIFY_IS_APPROX(t3.rotation(), t3.linear()); if(Mode==Isometry) VERIFY(t3.rotation().data()==t3.linear().data()); } template void transformations_computed_scaling_continuity() { typedef Matrix Vector3; typedef Transform Transform3; typedef Matrix Matrix3; // Given: two transforms that differ by '2*eps'. Scalar eps(1e-3); Vector3 v0 = Vector3::Random().normalized(), v1 = Vector3::Random().normalized(), v3 = Vector3::Random().normalized(); Transform3 t0, t1; // The interesting case is when their determinants have different signs. Matrix3 rank2 = 50 * v0 * v0.adjoint() + 20 * v1 * v1.adjoint(); t0.linear() = rank2 + eps * v3 * v3.adjoint(); t1.linear() = rank2 - eps * v3 * v3.adjoint(); // When: computing the rotation-scaling parts Matrix3 r0, s0, r1, s1; t0.computeRotationScaling(&r0, &s0); t1.computeRotationScaling(&r1, &s1); // Then: the scaling parts should differ by no more than '2*eps'. const Scalar c(2.1); // 2 + room for rounding errors VERIFY((s0 - s1).norm() < c * eps); } EIGEN_DECLARE_TEST(geo_transformations) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1(( transformations() )); CALL_SUBTEST_1(( non_projective_only() )); CALL_SUBTEST_1(( transformations_computed_scaling_continuity() )); CALL_SUBTEST_2(( transformations() )); CALL_SUBTEST_2(( non_projective_only() )); CALL_SUBTEST_2(( transform_alignment() )); CALL_SUBTEST_3(( transformations() )); CALL_SUBTEST_3(( transformations() )); CALL_SUBTEST_3(( transform_alignment() )); CALL_SUBTEST_4(( transformations() )); CALL_SUBTEST_4(( non_projective_only() )); CALL_SUBTEST_5(( transformations() )); CALL_SUBTEST_5(( non_projective_only() )); CALL_SUBTEST_6(( transformations() )); CALL_SUBTEST_6(( transformations() )); CALL_SUBTEST_7(( transform_products() )); CALL_SUBTEST_7(( transform_products() )); CALL_SUBTEST_8(( transform_associativity(Rotation2D(internal::random()*double(EIGEN_PI))) )); CALL_SUBTEST_8(( transform_associativity(Quaterniond::UnitRandom()) )); CALL_SUBTEST_9(( transformations_no_scale() )); CALL_SUBTEST_9(( transformations_no_scale() )); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/gpu_basic.cu ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2015-2016 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. // workaround issue between gcc >= 4.7 and cuda 5.5 #if (defined __GNUC__) && (__GNUC__>4 || __GNUC_MINOR__>=7) #undef _GLIBCXX_ATOMIC_BUILTINS #undef _GLIBCXX_USE_INT128 #endif #define EIGEN_TEST_NO_LONGDOUBLE #define EIGEN_DEFAULT_DENSE_INDEX_TYPE int #include "main.h" #include "gpu_common.h" // Check that dense modules can be properly parsed by nvcc #include // struct Foo{ // EIGEN_DEVICE_FUNC // void operator()(int i, const float* mats, float* vecs) const { // using namespace Eigen; // // Matrix3f M(data); // // Vector3f x(data+9); // // Map(data+9) = M.inverse() * x; // Matrix3f M(mats+i/16); // Vector3f x(vecs+i*3); // // using std::min; // // using std::sqrt; // Map(vecs+i*3) << x.minCoeff(), 1, 2;// / x.dot(x);//(M.inverse() * x) / x.x(); // //x = x*2 + x.y() * x + x * x.maxCoeff() - x / x.sum(); // } // }; template struct coeff_wise { EIGEN_DEVICE_FUNC void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const { using namespace Eigen; T x1(in+i); T x2(in+i+1); T x3(in+i+2); Map res(out+i*T::MaxSizeAtCompileTime); res.array() += (in[0] * x1 + x2).array() * x3.array(); } }; template struct complex_sqrt { EIGEN_DEVICE_FUNC void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const { using namespace Eigen; typedef typename T::Scalar ComplexType; typedef typename T::Scalar::value_type ValueType; const int num_special_inputs = 18; if (i == 0) { const ValueType nan = std::numeric_limits::quiet_NaN(); typedef Eigen::Vector SpecialInputs; SpecialInputs special_in; special_in.setZero(); int idx = 0; special_in[idx++] = ComplexType(0, 0); special_in[idx++] = ComplexType(-0, 0); special_in[idx++] = ComplexType(0, -0); special_in[idx++] = ComplexType(-0, -0); // GCC's fallback sqrt implementation fails for inf inputs. // It is called when _GLIBCXX_USE_C99_COMPLEX is false or if // clang includes the GCC header (which temporarily disables // _GLIBCXX_USE_C99_COMPLEX) #if !defined(_GLIBCXX_COMPLEX) || \ (_GLIBCXX_USE_C99_COMPLEX && !defined(__CLANG_CUDA_WRAPPERS_COMPLEX)) const ValueType inf = std::numeric_limits::infinity(); special_in[idx++] = ComplexType(1.0, inf); special_in[idx++] = ComplexType(nan, inf); special_in[idx++] = ComplexType(1.0, -inf); special_in[idx++] = ComplexType(nan, -inf); special_in[idx++] = ComplexType(-inf, 1.0); special_in[idx++] = ComplexType(inf, 1.0); special_in[idx++] = ComplexType(-inf, -1.0); special_in[idx++] = ComplexType(inf, -1.0); special_in[idx++] = ComplexType(-inf, nan); special_in[idx++] = ComplexType(inf, nan); #endif special_in[idx++] = ComplexType(1.0, nan); special_in[idx++] = ComplexType(nan, 1.0); special_in[idx++] = ComplexType(nan, -1.0); special_in[idx++] = ComplexType(nan, nan); Map special_out(out); special_out = special_in.cwiseSqrt(); } T x1(in + i); Map res(out + num_special_inputs + i*T::MaxSizeAtCompileTime); res = x1.cwiseSqrt(); } }; template struct complex_operators { EIGEN_DEVICE_FUNC void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const { using namespace Eigen; typedef typename T::Scalar ComplexType; typedef typename T::Scalar::value_type ValueType; const int num_scalar_operators = 24; const int num_vector_operators = 23; // no unary + operator. int out_idx = i * (num_scalar_operators + num_vector_operators * T::MaxSizeAtCompileTime); // Scalar operators. const ComplexType a = in[i]; const ComplexType b = in[i + 1]; out[out_idx++] = +a; out[out_idx++] = -a; out[out_idx++] = a + b; out[out_idx++] = a + numext::real(b); out[out_idx++] = numext::real(a) + b; out[out_idx++] = a - b; out[out_idx++] = a - numext::real(b); out[out_idx++] = numext::real(a) - b; out[out_idx++] = a * b; out[out_idx++] = a * numext::real(b); out[out_idx++] = numext::real(a) * b; out[out_idx++] = a / b; out[out_idx++] = a / numext::real(b); out[out_idx++] = numext::real(a) / b; out[out_idx] = a; out[out_idx++] += b; out[out_idx] = a; out[out_idx++] -= b; out[out_idx] = a; out[out_idx++] *= b; out[out_idx] = a; out[out_idx++] /= b; const ComplexType true_value = ComplexType(ValueType(1), ValueType(0)); const ComplexType false_value = ComplexType(ValueType(0), ValueType(0)); out[out_idx++] = (a == b ? true_value : false_value); out[out_idx++] = (a == numext::real(b) ? true_value : false_value); out[out_idx++] = (numext::real(a) == b ? true_value : false_value); out[out_idx++] = (a != b ? true_value : false_value); out[out_idx++] = (a != numext::real(b) ? true_value : false_value); out[out_idx++] = (numext::real(a) != b ? true_value : false_value); // Vector versions. T x1(in + i); T x2(in + i + 1); const int res_size = T::MaxSizeAtCompileTime * num_scalar_operators; const int size = T::MaxSizeAtCompileTime; int block_idx = 0; Map> res(out + out_idx, res_size); res.segment(block_idx, size) = -x1; block_idx += size; res.segment(block_idx, size) = x1 + x2; block_idx += size; res.segment(block_idx, size) = x1 + x2.real(); block_idx += size; res.segment(block_idx, size) = x1.real() + x2; block_idx += size; res.segment(block_idx, size) = x1 - x2; block_idx += size; res.segment(block_idx, size) = x1 - x2.real(); block_idx += size; res.segment(block_idx, size) = x1.real() - x2; block_idx += size; res.segment(block_idx, size) = x1.array() * x2.array(); block_idx += size; res.segment(block_idx, size) = x1.array() * x2.real().array(); block_idx += size; res.segment(block_idx, size) = x1.real().array() * x2.array(); block_idx += size; res.segment(block_idx, size) = x1.array() / x2.array(); block_idx += size; res.segment(block_idx, size) = x1.array() / x2.real().array(); block_idx += size; res.segment(block_idx, size) = x1.real().array() / x2.array(); block_idx += size; res.segment(block_idx, size) = x1; res.segment(block_idx, size) += x2; block_idx += size; res.segment(block_idx, size) = x1; res.segment(block_idx, size) -= x2; block_idx += size; res.segment(block_idx, size) = x1; res.segment(block_idx, size).array() *= x2.array(); block_idx += size; res.segment(block_idx, size) = x1; res.segment(block_idx, size).array() /= x2.array(); block_idx += size; const T true_vector = T::Constant(true_value); const T false_vector = T::Constant(false_value); res.segment(block_idx, size) = (x1 == x2 ? true_vector : false_vector); block_idx += size; // Mixing types in equality comparison does not work. // res.segment(block_idx, size) = (x1 == x2.real() ? true_vector : false_vector); // block_idx += size; // res.segment(block_idx, size) = (x1.real() == x2 ? true_vector : false_vector); // block_idx += size; res.segment(block_idx, size) = (x1 != x2 ? true_vector : false_vector); block_idx += size; // res.segment(block_idx, size) = (x1 != x2.real() ? true_vector : false_vector); // block_idx += size; // res.segment(block_idx, size) = (x1.real() != x2 ? true_vector : false_vector); // block_idx += size; } }; template struct replicate { EIGEN_DEVICE_FUNC void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const { using namespace Eigen; T x1(in+i); int step = x1.size() * 4; int stride = 3 * step; typedef Map > MapType; MapType(out+i*stride+0*step, x1.rows()*2, x1.cols()*2) = x1.replicate(2,2); MapType(out+i*stride+1*step, x1.rows()*3, x1.cols()) = in[i] * x1.colwise().replicate(3); MapType(out+i*stride+2*step, x1.rows(), x1.cols()*3) = in[i] * x1.rowwise().replicate(3); } }; template struct alloc_new_delete { EIGEN_DEVICE_FUNC void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const { int offset = 2*i*T::MaxSizeAtCompileTime; T* x = new T(in + offset); Eigen::Map u(out + offset); u = *x; delete x; offset += T::MaxSizeAtCompileTime; T* y = new T[1]; y[0] = T(in + offset); Eigen::Map v(out + offset); v = y[0]; delete[] y; } }; template struct redux { EIGEN_DEVICE_FUNC void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const { using namespace Eigen; int N = 10; T x1(in+i); out[i*N+0] = x1.minCoeff(); out[i*N+1] = x1.maxCoeff(); out[i*N+2] = x1.sum(); out[i*N+3] = x1.prod(); out[i*N+4] = x1.matrix().squaredNorm(); out[i*N+5] = x1.matrix().norm(); out[i*N+6] = x1.colwise().sum().maxCoeff(); out[i*N+7] = x1.rowwise().maxCoeff().sum(); out[i*N+8] = x1.matrix().colwise().squaredNorm().sum(); } }; template struct prod_test { EIGEN_DEVICE_FUNC void operator()(int i, const typename T1::Scalar* in, typename T1::Scalar* out) const { using namespace Eigen; typedef Matrix T3; T1 x1(in+i); T2 x2(in+i+1); Map res(out+i*T3::MaxSizeAtCompileTime); res += in[i] * x1 * x2; } }; template struct diagonal { EIGEN_DEVICE_FUNC void operator()(int i, const typename T1::Scalar* in, typename T1::Scalar* out) const { using namespace Eigen; T1 x1(in+i); Map res(out+i*T2::MaxSizeAtCompileTime); res += x1.diagonal(); } }; template struct eigenvalues_direct { EIGEN_DEVICE_FUNC void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const { using namespace Eigen; typedef Matrix Vec; T M(in+i); Map res(out+i*Vec::MaxSizeAtCompileTime); T A = M*M.adjoint(); SelfAdjointEigenSolver eig; eig.computeDirect(A); res = eig.eigenvalues(); } }; template struct eigenvalues { EIGEN_DEVICE_FUNC void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const { using namespace Eigen; typedef Matrix Vec; T M(in+i); Map res(out+i*Vec::MaxSizeAtCompileTime); T A = M*M.adjoint(); SelfAdjointEigenSolver eig; eig.compute(A); res = eig.eigenvalues(); } }; template struct matrix_inverse { EIGEN_DEVICE_FUNC void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const { using namespace Eigen; T M(in+i); Map res(out+i*T::MaxSizeAtCompileTime); res = M.inverse(); } }; template struct numeric_limits_test { EIGEN_DEVICE_FUNC void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const { EIGEN_UNUSED_VARIABLE(in) int out_idx = i * 5; out[out_idx++] = numext::numeric_limits::epsilon(); out[out_idx++] = (numext::numeric_limits::max)(); out[out_idx++] = (numext::numeric_limits::min)(); out[out_idx++] = numext::numeric_limits::infinity(); out[out_idx++] = numext::numeric_limits::quiet_NaN(); } }; template bool verifyIsApproxWithInfsNans(const Type1& a, const Type2& b, typename Type1::Scalar* = 0) // Enabled for Eigen's type only { if (a.rows() != b.rows()) { return false; } if (a.cols() != b.cols()) { return false; } for (Index r = 0; r < a.rows(); ++r) { for (Index c = 0; c < a.cols(); ++c) { if (a(r, c) != b(r, c) && !((numext::isnan)(a(r, c)) && (numext::isnan)(b(r, c))) && !test_isApprox(a(r, c), b(r, c))) { return false; } } } return true; } template void test_with_infs_nans(const Kernel& ker, int n, const Input& in, Output& out) { Output out_ref, out_gpu; #if !defined(EIGEN_GPU_COMPILE_PHASE) out_ref = out_gpu = out; #else EIGEN_UNUSED_VARIABLE(in); EIGEN_UNUSED_VARIABLE(out); #endif run_on_cpu (ker, n, in, out_ref); run_on_gpu(ker, n, in, out_gpu); #if !defined(EIGEN_GPU_COMPILE_PHASE) verifyIsApproxWithInfsNans(out_ref, out_gpu); #endif } EIGEN_DECLARE_TEST(gpu_basic) { ei_test_init_gpu(); int nthreads = 100; Eigen::VectorXf in, out; Eigen::VectorXcf cfin, cfout; #if !defined(EIGEN_GPU_COMPILE_PHASE) int data_size = nthreads * 512; in.setRandom(data_size); out.setConstant(data_size, -1); cfin.setRandom(data_size); cfout.setConstant(data_size, -1); #endif CALL_SUBTEST( run_and_compare_to_gpu(coeff_wise(), nthreads, in, out) ); CALL_SUBTEST( run_and_compare_to_gpu(coeff_wise(), nthreads, in, out) ); #if !defined(EIGEN_USE_HIP) // FIXME // These subtests result in a compile failure on the HIP platform // // eigen-upstream/Eigen/src/Core/Replicate.h:61:65: error: // base class 'internal::dense_xpr_base, -1, -1> >::type' // (aka 'ArrayBase, -1, -1> >') has protected default constructor CALL_SUBTEST( run_and_compare_to_gpu(replicate(), nthreads, in, out) ); CALL_SUBTEST( run_and_compare_to_gpu(replicate(), nthreads, in, out) ); // HIP does not support new/delete on device. CALL_SUBTEST( run_and_compare_to_gpu(alloc_new_delete(), nthreads, in, out) ); #endif CALL_SUBTEST( run_and_compare_to_gpu(redux(), nthreads, in, out) ); CALL_SUBTEST( run_and_compare_to_gpu(redux(), nthreads, in, out) ); CALL_SUBTEST( run_and_compare_to_gpu(prod_test(), nthreads, in, out) ); CALL_SUBTEST( run_and_compare_to_gpu(prod_test(), nthreads, in, out) ); CALL_SUBTEST( run_and_compare_to_gpu(diagonal(), nthreads, in, out) ); CALL_SUBTEST( run_and_compare_to_gpu(diagonal(), nthreads, in, out) ); CALL_SUBTEST( run_and_compare_to_gpu(matrix_inverse(), nthreads, in, out) ); CALL_SUBTEST( run_and_compare_to_gpu(matrix_inverse(), nthreads, in, out) ); CALL_SUBTEST( run_and_compare_to_gpu(matrix_inverse(), nthreads, in, out) ); CALL_SUBTEST( run_and_compare_to_gpu(eigenvalues_direct(), nthreads, in, out) ); CALL_SUBTEST( run_and_compare_to_gpu(eigenvalues_direct(), nthreads, in, out) ); // Test std::complex. CALL_SUBTEST( run_and_compare_to_gpu(complex_operators(), nthreads, cfin, cfout) ); CALL_SUBTEST( test_with_infs_nans(complex_sqrt(), nthreads, cfin, cfout) ); // numeric_limits CALL_SUBTEST( test_with_infs_nans(numeric_limits_test(), 1, in, out) ); #if defined(__NVCC__) // FIXME // These subtests compiles only with nvcc and fail with HIPCC and clang-cuda CALL_SUBTEST( run_and_compare_to_gpu(eigenvalues(), nthreads, in, out) ); typedef Matrix Matrix6f; CALL_SUBTEST( run_and_compare_to_gpu(eigenvalues(), nthreads, in, out) ); #endif } ================================================ FILE: VO_Module/thirdparty/eigen/test/gpu_common.h ================================================ #ifndef EIGEN_TEST_GPU_COMMON_H #define EIGEN_TEST_GPU_COMMON_H #ifdef EIGEN_USE_HIP #include #include #else #include #include #include #endif #include #define EIGEN_USE_GPU #include #if !defined(__CUDACC__) && !defined(__HIPCC__) dim3 threadIdx, blockDim, blockIdx; #endif template void run_on_cpu(const Kernel& ker, int n, const Input& in, Output& out) { for(int i=0; i __global__ EIGEN_HIP_LAUNCH_BOUNDS_1024 void run_on_gpu_meta_kernel(const Kernel ker, int n, const Input* in, Output* out) { int i = threadIdx.x + blockIdx.x*blockDim.x; if(i void run_on_gpu(const Kernel& ker, int n, const Input& in, Output& out) { typename Input::Scalar* d_in; typename Output::Scalar* d_out; std::ptrdiff_t in_bytes = in.size() * sizeof(typename Input::Scalar); std::ptrdiff_t out_bytes = out.size() * sizeof(typename Output::Scalar); gpuMalloc((void**)(&d_in), in_bytes); gpuMalloc((void**)(&d_out), out_bytes); gpuMemcpy(d_in, in.data(), in_bytes, gpuMemcpyHostToDevice); gpuMemcpy(d_out, out.data(), out_bytes, gpuMemcpyHostToDevice); // Simple and non-optimal 1D mapping assuming n is not too large // That's only for unit testing! dim3 Blocks(128); dim3 Grids( (n+int(Blocks.x)-1)/int(Blocks.x) ); gpuDeviceSynchronize(); #ifdef EIGEN_USE_HIP hipLaunchKernelGGL(HIP_KERNEL_NAME(run_on_gpu_meta_kernel::type, typename std::decay::type>), dim3(Grids), dim3(Blocks), 0, 0, ker, n, d_in, d_out); #else run_on_gpu_meta_kernel<<>>(ker, n, d_in, d_out); #endif // Pre-launch errors. gpuError_t err = gpuGetLastError(); if (err != gpuSuccess) { printf("%s: %s\n", gpuGetErrorName(err), gpuGetErrorString(err)); gpu_assert(false); } // Kernel execution errors. err = gpuDeviceSynchronize(); if (err != gpuSuccess) { printf("%s: %s\n", gpuGetErrorName(err), gpuGetErrorString(err)); gpu_assert(false); } // check inputs have not been modified gpuMemcpy(const_cast(in.data()), d_in, in_bytes, gpuMemcpyDeviceToHost); gpuMemcpy(out.data(), d_out, out_bytes, gpuMemcpyDeviceToHost); gpuFree(d_in); gpuFree(d_out); } template void run_and_compare_to_gpu(const Kernel& ker, int n, const Input& in, Output& out) { Input in_ref, in_gpu; Output out_ref, out_gpu; #if !defined(EIGEN_GPU_COMPILE_PHASE) in_ref = in_gpu = in; out_ref = out_gpu = out; #else EIGEN_UNUSED_VARIABLE(in); EIGEN_UNUSED_VARIABLE(out); #endif run_on_cpu (ker, n, in_ref, out_ref); run_on_gpu(ker, n, in_gpu, out_gpu); #if !defined(EIGEN_GPU_COMPILE_PHASE) VERIFY_IS_APPROX(in_ref, in_gpu); VERIFY_IS_APPROX(out_ref, out_gpu); #endif } struct compile_time_device_info { EIGEN_DEVICE_FUNC void operator()(int i, const int* /*in*/, int* info) const { if (i == 0) { EIGEN_UNUSED_VARIABLE(info) #if defined(__CUDA_ARCH__) info[0] = int(__CUDA_ARCH__ +0); #endif #if defined(EIGEN_HIP_DEVICE_COMPILE) info[1] = int(EIGEN_HIP_DEVICE_COMPILE +0); #endif } } }; void ei_test_init_gpu() { int device = 0; gpuDeviceProp_t deviceProp; gpuGetDeviceProperties(&deviceProp, device); ArrayXi dummy(1), info(10); info = -1; run_on_gpu(compile_time_device_info(),10,dummy,info); std::cout << "GPU compile-time info:\n"; #ifdef EIGEN_CUDACC std::cout << " EIGEN_CUDACC: " << int(EIGEN_CUDACC) << "\n"; #endif #ifdef EIGEN_CUDA_SDK_VER std::cout << " EIGEN_CUDA_SDK_VER: " << int(EIGEN_CUDA_SDK_VER) << "\n"; #endif #ifdef EIGEN_COMP_NVCC std::cout << " EIGEN_COMP_NVCC: " << int(EIGEN_COMP_NVCC) << "\n"; #endif #ifdef EIGEN_HIPCC std::cout << " EIGEN_HIPCC: " << int(EIGEN_HIPCC) << "\n"; #endif std::cout << " EIGEN_CUDA_ARCH: " << info[0] << "\n"; std::cout << " EIGEN_HIP_DEVICE_COMPILE: " << info[1] << "\n"; std::cout << "GPU device info:\n"; std::cout << " name: " << deviceProp.name << "\n"; std::cout << " capability: " << deviceProp.major << "." << deviceProp.minor << "\n"; std::cout << " multiProcessorCount: " << deviceProp.multiProcessorCount << "\n"; std::cout << " maxThreadsPerMultiProcessor: " << deviceProp.maxThreadsPerMultiProcessor << "\n"; std::cout << " warpSize: " << deviceProp.warpSize << "\n"; std::cout << " regsPerBlock: " << deviceProp.regsPerBlock << "\n"; std::cout << " concurrentKernels: " << deviceProp.concurrentKernels << "\n"; std::cout << " clockRate: " << deviceProp.clockRate << "\n"; std::cout << " canMapHostMemory: " << deviceProp.canMapHostMemory << "\n"; std::cout << " computeMode: " << deviceProp.computeMode << "\n"; } #endif // EIGEN_TEST_GPU_COMMON_H ================================================ FILE: VO_Module/thirdparty/eigen/test/half_float.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include #include "main.h" #include #define VERIFY_HALF_BITS_EQUAL(h, bits) \ VERIFY_IS_EQUAL((numext::bit_cast(h)), (static_cast(bits))) // Make sure it's possible to forward declare Eigen::half namespace Eigen { struct half; } using Eigen::half; void test_conversion() { using Eigen::half_impl::__half_raw; // Round-trip bit-cast with uint16. VERIFY_IS_EQUAL( numext::bit_cast(numext::bit_cast(half(1.0f))), half(1.0f)); VERIFY_IS_EQUAL( numext::bit_cast(numext::bit_cast(half(0.5f))), half(0.5f)); VERIFY_IS_EQUAL( numext::bit_cast(numext::bit_cast(half(-0.33333f))), half(-0.33333f)); VERIFY_IS_EQUAL( numext::bit_cast(numext::bit_cast(half(0.0f))), half(0.0f)); // Conversion from float. VERIFY_HALF_BITS_EQUAL(half(1.0f), 0x3c00); VERIFY_HALF_BITS_EQUAL(half(0.5f), 0x3800); VERIFY_HALF_BITS_EQUAL(half(0.33333f), 0x3555); VERIFY_HALF_BITS_EQUAL(half(0.0f), 0x0000); VERIFY_HALF_BITS_EQUAL(half(-0.0f), 0x8000); VERIFY_HALF_BITS_EQUAL(half(65504.0f), 0x7bff); VERIFY_HALF_BITS_EQUAL(half(65536.0f), 0x7c00); // Becomes infinity. // Denormals. VERIFY_HALF_BITS_EQUAL(half(-5.96046e-08f), 0x8001); VERIFY_HALF_BITS_EQUAL(half(5.96046e-08f), 0x0001); VERIFY_HALF_BITS_EQUAL(half(1.19209e-07f), 0x0002); // Verify round-to-nearest-even behavior. float val1 = float(half(__half_raw(0x3c00))); float val2 = float(half(__half_raw(0x3c01))); float val3 = float(half(__half_raw(0x3c02))); VERIFY_HALF_BITS_EQUAL(half(0.5f * (val1 + val2)), 0x3c00); VERIFY_HALF_BITS_EQUAL(half(0.5f * (val2 + val3)), 0x3c02); // Conversion from int. VERIFY_HALF_BITS_EQUAL(half(-1), 0xbc00); VERIFY_HALF_BITS_EQUAL(half(0), 0x0000); VERIFY_HALF_BITS_EQUAL(half(1), 0x3c00); VERIFY_HALF_BITS_EQUAL(half(2), 0x4000); VERIFY_HALF_BITS_EQUAL(half(3), 0x4200); // Conversion from bool. VERIFY_HALF_BITS_EQUAL(half(false), 0x0000); VERIFY_HALF_BITS_EQUAL(half(true), 0x3c00); // Conversion to float. VERIFY_IS_EQUAL(float(half(__half_raw(0x0000))), 0.0f); VERIFY_IS_EQUAL(float(half(__half_raw(0x3c00))), 1.0f); // Denormals. VERIFY_IS_APPROX(float(half(__half_raw(0x8001))), -5.96046e-08f); VERIFY_IS_APPROX(float(half(__half_raw(0x0001))), 5.96046e-08f); VERIFY_IS_APPROX(float(half(__half_raw(0x0002))), 1.19209e-07f); // NaNs and infinities. VERIFY(!(numext::isinf)(float(half(65504.0f)))); // Largest finite number. VERIFY(!(numext::isnan)(float(half(0.0f)))); VERIFY((numext::isinf)(float(half(__half_raw(0xfc00))))); VERIFY((numext::isnan)(float(half(__half_raw(0xfc01))))); VERIFY((numext::isinf)(float(half(__half_raw(0x7c00))))); VERIFY((numext::isnan)(float(half(__half_raw(0x7c01))))); #if !EIGEN_COMP_MSVC // Visual Studio errors out on divisions by 0 VERIFY((numext::isnan)(float(half(0.0 / 0.0)))); VERIFY((numext::isinf)(float(half(1.0 / 0.0)))); VERIFY((numext::isinf)(float(half(-1.0 / 0.0)))); #endif // Exactly same checks as above, just directly on the half representation. VERIFY(!(numext::isinf)(half(__half_raw(0x7bff)))); VERIFY(!(numext::isnan)(half(__half_raw(0x0000)))); VERIFY((numext::isinf)(half(__half_raw(0xfc00)))); VERIFY((numext::isnan)(half(__half_raw(0xfc01)))); VERIFY((numext::isinf)(half(__half_raw(0x7c00)))); VERIFY((numext::isnan)(half(__half_raw(0x7c01)))); #if !EIGEN_COMP_MSVC // Visual Studio errors out on divisions by 0 VERIFY((numext::isnan)(half(0.0 / 0.0))); VERIFY((numext::isinf)(half(1.0 / 0.0))); VERIFY((numext::isinf)(half(-1.0 / 0.0))); #endif // Conversion to bool VERIFY(!static_cast(half(0.0))); VERIFY(!static_cast(half(-0.0))); VERIFY(static_cast(half(__half_raw(0x7bff)))); VERIFY(static_cast(half(-0.33333))); VERIFY(static_cast(half(1.0))); VERIFY(static_cast(half(-1.0))); VERIFY(static_cast(half(-5.96046e-08f))); } void test_numtraits() { std::cout << "epsilon = " << NumTraits::epsilon() << " (0x" << std::hex << numext::bit_cast(NumTraits::epsilon()) << ")" << std::endl; std::cout << "highest = " << NumTraits::highest() << " (0x" << std::hex << numext::bit_cast(NumTraits::highest()) << ")" << std::endl; std::cout << "lowest = " << NumTraits::lowest() << " (0x" << std::hex << numext::bit_cast(NumTraits::lowest()) << ")" << std::endl; std::cout << "min = " << (std::numeric_limits::min)() << " (0x" << std::hex << numext::bit_cast(half((std::numeric_limits::min)())) << ")" << std::endl; std::cout << "denorm min = " << (std::numeric_limits::denorm_min)() << " (0x" << std::hex << numext::bit_cast(half((std::numeric_limits::denorm_min)())) << ")" << std::endl; std::cout << "infinity = " << NumTraits::infinity() << " (0x" << std::hex << numext::bit_cast(NumTraits::infinity()) << ")" << std::endl; std::cout << "quiet nan = " << NumTraits::quiet_NaN() << " (0x" << std::hex << numext::bit_cast(NumTraits::quiet_NaN()) << ")" << std::endl; std::cout << "signaling nan = " << std::numeric_limits::signaling_NaN() << " (0x" << std::hex << numext::bit_cast(std::numeric_limits::signaling_NaN()) << ")" << std::endl; VERIFY(NumTraits::IsSigned); VERIFY_IS_EQUAL( numext::bit_cast(std::numeric_limits::infinity()), numext::bit_cast(half(std::numeric_limits::infinity())) ); // There is no guarantee that casting a 32-bit NaN to 16-bit has a precise // bit pattern. We test that it is in fact a NaN, then test the signaling // bit (msb of significand is 1 for quiet, 0 for signaling). const numext::uint16_t HALF_QUIET_BIT = 0x0200; VERIFY( (numext::isnan)(std::numeric_limits::quiet_NaN()) && (numext::isnan)(half(std::numeric_limits::quiet_NaN())) && ((numext::bit_cast(std::numeric_limits::quiet_NaN()) & HALF_QUIET_BIT) > 0) && ((numext::bit_cast(half(std::numeric_limits::quiet_NaN())) & HALF_QUIET_BIT) > 0) ); // After a cast to half, a signaling NaN may become non-signaling // (e.g. in the case of casting float to native __fp16). Thus, we check that // both are NaN, and that only the `numeric_limits` version is signaling. VERIFY( (numext::isnan)(std::numeric_limits::signaling_NaN()) && (numext::isnan)(half(std::numeric_limits::signaling_NaN())) && ((numext::bit_cast(std::numeric_limits::signaling_NaN()) & HALF_QUIET_BIT) == 0) ); VERIFY( (std::numeric_limits::min)() > half(0.f) ); VERIFY( (std::numeric_limits::denorm_min)() > half(0.f) ); VERIFY( (std::numeric_limits::min)()/half(2) > half(0.f) ); VERIFY_IS_EQUAL( (std::numeric_limits::denorm_min)()/half(2), half(0.f) ); } void test_arithmetic() { VERIFY_IS_EQUAL(float(half(2) + half(2)), 4); VERIFY_IS_EQUAL(float(half(2) + half(-2)), 0); VERIFY_IS_APPROX(float(half(0.33333f) + half(0.66667f)), 1.0f); VERIFY_IS_EQUAL(float(half(2.0f) * half(-5.5f)), -11.0f); VERIFY_IS_APPROX(float(half(1.0f) / half(3.0f)), 0.33333f); VERIFY_IS_EQUAL(float(-half(4096.0f)), -4096.0f); VERIFY_IS_EQUAL(float(-half(-4096.0f)), 4096.0f); half x(3); half y = ++x; VERIFY_IS_EQUAL(x, half(4)); VERIFY_IS_EQUAL(y, half(4)); y = --x; VERIFY_IS_EQUAL(x, half(3)); VERIFY_IS_EQUAL(y, half(3)); y = x++; VERIFY_IS_EQUAL(x, half(4)); VERIFY_IS_EQUAL(y, half(3)); y = x--; VERIFY_IS_EQUAL(x, half(3)); VERIFY_IS_EQUAL(y, half(4)); } void test_comparison() { VERIFY(half(1.0f) > half(0.5f)); VERIFY(half(0.5f) < half(1.0f)); VERIFY(!(half(1.0f) < half(0.5f))); VERIFY(!(half(0.5f) > half(1.0f))); VERIFY(!(half(4.0f) > half(4.0f))); VERIFY(!(half(4.0f) < half(4.0f))); VERIFY(!(half(0.0f) < half(-0.0f))); VERIFY(!(half(-0.0f) < half(0.0f))); VERIFY(!(half(0.0f) > half(-0.0f))); VERIFY(!(half(-0.0f) > half(0.0f))); VERIFY(half(0.2f) > half(-1.0f)); VERIFY(half(-1.0f) < half(0.2f)); VERIFY(half(-16.0f) < half(-15.0f)); VERIFY(half(1.0f) == half(1.0f)); VERIFY(half(1.0f) != half(2.0f)); // Comparisons with NaNs and infinities. #if !EIGEN_COMP_MSVC // Visual Studio errors out on divisions by 0 VERIFY(!(half(0.0 / 0.0) == half(0.0 / 0.0))); VERIFY(half(0.0 / 0.0) != half(0.0 / 0.0)); VERIFY(!(half(1.0) == half(0.0 / 0.0))); VERIFY(!(half(1.0) < half(0.0 / 0.0))); VERIFY(!(half(1.0) > half(0.0 / 0.0))); VERIFY(half(1.0) != half(0.0 / 0.0)); VERIFY(half(1.0) < half(1.0 / 0.0)); VERIFY(half(1.0) > half(-1.0 / 0.0)); #endif } void test_basic_functions() { VERIFY_IS_EQUAL(float(numext::abs(half(3.5f))), 3.5f); VERIFY_IS_EQUAL(float(abs(half(3.5f))), 3.5f); VERIFY_IS_EQUAL(float(numext::abs(half(-3.5f))), 3.5f); VERIFY_IS_EQUAL(float(abs(half(-3.5f))), 3.5f); VERIFY_IS_EQUAL(float(numext::floor(half(3.5f))), 3.0f); VERIFY_IS_EQUAL(float(floor(half(3.5f))), 3.0f); VERIFY_IS_EQUAL(float(numext::floor(half(-3.5f))), -4.0f); VERIFY_IS_EQUAL(float(floor(half(-3.5f))), -4.0f); VERIFY_IS_EQUAL(float(numext::ceil(half(3.5f))), 4.0f); VERIFY_IS_EQUAL(float(ceil(half(3.5f))), 4.0f); VERIFY_IS_EQUAL(float(numext::ceil(half(-3.5f))), -3.0f); VERIFY_IS_EQUAL(float(ceil(half(-3.5f))), -3.0f); VERIFY_IS_APPROX(float(numext::sqrt(half(0.0f))), 0.0f); VERIFY_IS_APPROX(float(sqrt(half(0.0f))), 0.0f); VERIFY_IS_APPROX(float(numext::sqrt(half(4.0f))), 2.0f); VERIFY_IS_APPROX(float(sqrt(half(4.0f))), 2.0f); VERIFY_IS_APPROX(float(numext::pow(half(0.0f), half(1.0f))), 0.0f); VERIFY_IS_APPROX(float(pow(half(0.0f), half(1.0f))), 0.0f); VERIFY_IS_APPROX(float(numext::pow(half(2.0f), half(2.0f))), 4.0f); VERIFY_IS_APPROX(float(pow(half(2.0f), half(2.0f))), 4.0f); VERIFY_IS_EQUAL(float(numext::exp(half(0.0f))), 1.0f); VERIFY_IS_EQUAL(float(exp(half(0.0f))), 1.0f); VERIFY_IS_APPROX(float(numext::exp(half(EIGEN_PI))), 20.f + float(EIGEN_PI)); VERIFY_IS_APPROX(float(exp(half(EIGEN_PI))), 20.f + float(EIGEN_PI)); VERIFY_IS_EQUAL(float(numext::expm1(half(0.0f))), 0.0f); VERIFY_IS_EQUAL(float(expm1(half(0.0f))), 0.0f); VERIFY_IS_APPROX(float(numext::expm1(half(2.0f))), 6.3890561f); VERIFY_IS_APPROX(float(expm1(half(2.0f))), 6.3890561f); VERIFY_IS_EQUAL(float(numext::log(half(1.0f))), 0.0f); VERIFY_IS_EQUAL(float(log(half(1.0f))), 0.0f); VERIFY_IS_APPROX(float(numext::log(half(10.0f))), 2.30273f); VERIFY_IS_APPROX(float(log(half(10.0f))), 2.30273f); VERIFY_IS_EQUAL(float(numext::log1p(half(0.0f))), 0.0f); VERIFY_IS_EQUAL(float(log1p(half(0.0f))), 0.0f); VERIFY_IS_APPROX(float(numext::log1p(half(10.0f))), 2.3978953f); VERIFY_IS_APPROX(float(log1p(half(10.0f))), 2.3978953f); VERIFY_IS_APPROX(numext::fmod(half(5.3f), half(2.0f)), half(1.3f)); VERIFY_IS_APPROX(fmod(half(5.3f), half(2.0f)), half(1.3f)); VERIFY_IS_APPROX(numext::fmod(half(-18.5f), half(-4.2f)), half(-1.7f)); VERIFY_IS_APPROX(fmod(half(-18.5f), half(-4.2f)), half(-1.7f)); } void test_trigonometric_functions() { VERIFY_IS_APPROX(numext::cos(half(0.0f)), half(cosf(0.0f))); VERIFY_IS_APPROX(cos(half(0.0f)), half(cosf(0.0f))); VERIFY_IS_APPROX(numext::cos(half(EIGEN_PI)), half(cosf(EIGEN_PI))); // VERIFY_IS_APPROX(numext::cos(half(EIGEN_PI/2)), half(cosf(EIGEN_PI/2))); // VERIFY_IS_APPROX(numext::cos(half(3*EIGEN_PI/2)), half(cosf(3*EIGEN_PI/2))); VERIFY_IS_APPROX(numext::cos(half(3.5f)), half(cosf(3.5f))); VERIFY_IS_APPROX(numext::sin(half(0.0f)), half(sinf(0.0f))); VERIFY_IS_APPROX(sin(half(0.0f)), half(sinf(0.0f))); // VERIFY_IS_APPROX(numext::sin(half(EIGEN_PI)), half(sinf(EIGEN_PI))); VERIFY_IS_APPROX(numext::sin(half(EIGEN_PI/2)), half(sinf(EIGEN_PI/2))); VERIFY_IS_APPROX(numext::sin(half(3*EIGEN_PI/2)), half(sinf(3*EIGEN_PI/2))); VERIFY_IS_APPROX(numext::sin(half(3.5f)), half(sinf(3.5f))); VERIFY_IS_APPROX(numext::tan(half(0.0f)), half(tanf(0.0f))); VERIFY_IS_APPROX(tan(half(0.0f)), half(tanf(0.0f))); // VERIFY_IS_APPROX(numext::tan(half(EIGEN_PI)), half(tanf(EIGEN_PI))); // VERIFY_IS_APPROX(numext::tan(half(EIGEN_PI/2)), half(tanf(EIGEN_PI/2))); //VERIFY_IS_APPROX(numext::tan(half(3*EIGEN_PI/2)), half(tanf(3*EIGEN_PI/2))); VERIFY_IS_APPROX(numext::tan(half(3.5f)), half(tanf(3.5f))); } void test_array() { typedef Array ArrayXh; Index size = internal::random(1,10); Index i = internal::random(0,size-1); ArrayXh a1 = ArrayXh::Random(size), a2 = ArrayXh::Random(size); VERIFY_IS_APPROX( a1+a1, half(2)*a1 ); VERIFY( (a1.abs() >= half(0)).all() ); VERIFY_IS_APPROX( (a1*a1).sqrt(), a1.abs() ); VERIFY( ((a1.min)(a2) <= (a1.max)(a2)).all() ); a1(i) = half(-10.); VERIFY_IS_EQUAL( a1.minCoeff(), half(-10.) ); a1(i) = half(10.); VERIFY_IS_EQUAL( a1.maxCoeff(), half(10.) ); std::stringstream ss; ss << a1; } void test_product() { typedef Matrix MatrixXh; Index rows = internal::random(1,EIGEN_TEST_MAX_SIZE); Index cols = internal::random(1,EIGEN_TEST_MAX_SIZE); Index depth = internal::random(1,EIGEN_TEST_MAX_SIZE); MatrixXh Ah = MatrixXh::Random(rows,depth); MatrixXh Bh = MatrixXh::Random(depth,cols); MatrixXh Ch = MatrixXh::Random(rows,cols); MatrixXf Af = Ah.cast(); MatrixXf Bf = Bh.cast(); MatrixXf Cf = Ch.cast(); VERIFY_IS_APPROX(Ch.noalias()+=Ah*Bh, (Cf.noalias()+=Af*Bf).cast()); } EIGEN_DECLARE_TEST(half_float) { CALL_SUBTEST(test_numtraits()); for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST(test_conversion()); CALL_SUBTEST(test_arithmetic()); CALL_SUBTEST(test_comparison()); CALL_SUBTEST(test_basic_functions()); CALL_SUBTEST(test_trigonometric_functions()); CALL_SUBTEST(test_array()); CALL_SUBTEST(test_product()); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/hessenberg.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Gael Guennebaud // Copyright (C) 2010 Jitse Niesen // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include template void hessenberg(int size = Size) { typedef Matrix MatrixType; // Test basic functionality: A = U H U* and H is Hessenberg for(int counter = 0; counter < g_repeat; ++counter) { MatrixType m = MatrixType::Random(size,size); HessenbergDecomposition hess(m); MatrixType Q = hess.matrixQ(); MatrixType H = hess.matrixH(); VERIFY_IS_APPROX(m, Q * H * Q.adjoint()); for(int row = 2; row < size; ++row) { for(int col = 0; col < row-1; ++col) { VERIFY(H(row,col) == (typename MatrixType::Scalar)0); } } } // Test whether compute() and constructor returns same result MatrixType A = MatrixType::Random(size, size); HessenbergDecomposition cs1; cs1.compute(A); HessenbergDecomposition cs2(A); VERIFY_IS_EQUAL(cs1.matrixH().eval(), cs2.matrixH().eval()); MatrixType cs1Q = cs1.matrixQ(); MatrixType cs2Q = cs2.matrixQ(); VERIFY_IS_EQUAL(cs1Q, cs2Q); // Test assertions for when used uninitialized HessenbergDecomposition hessUninitialized; VERIFY_RAISES_ASSERT( hessUninitialized.matrixH() ); VERIFY_RAISES_ASSERT( hessUninitialized.matrixQ() ); VERIFY_RAISES_ASSERT( hessUninitialized.householderCoefficients() ); VERIFY_RAISES_ASSERT( hessUninitialized.packedMatrix() ); // TODO: Add tests for packedMatrix() and householderCoefficients() } EIGEN_DECLARE_TEST(hessenberg) { CALL_SUBTEST_1(( hessenberg,1>() )); CALL_SUBTEST_2(( hessenberg,2>() )); CALL_SUBTEST_3(( hessenberg,4>() )); CALL_SUBTEST_4(( hessenberg(internal::random(1,EIGEN_TEST_MAX_SIZE)) )); CALL_SUBTEST_5(( hessenberg,Dynamic>(internal::random(1,EIGEN_TEST_MAX_SIZE)) )); // Test problem size constructors CALL_SUBTEST_6(HessenbergDecomposition(10)); } ================================================ FILE: VO_Module/thirdparty/eigen/test/householder.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009-2010 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include template void householder(const MatrixType& m) { static bool even = true; even = !even; /* this test covers the following files: Householder.h */ Index rows = m.rows(); Index cols = m.cols(); typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef Matrix VectorType; typedef Matrix::ret, 1> EssentialVectorType; typedef Matrix SquareMatrixType; typedef Matrix HBlockMatrixType; typedef Matrix HCoeffsVectorType; typedef Matrix TMatrixType; Matrix _tmp((std::max)(rows,cols)); Scalar* tmp = &_tmp.coeffRef(0,0); Scalar beta; RealScalar alpha; EssentialVectorType essential; VectorType v1 = VectorType::Random(rows), v2; v2 = v1; v1.makeHouseholder(essential, beta, alpha); v1.applyHouseholderOnTheLeft(essential,beta,tmp); VERIFY_IS_APPROX(v1.norm(), v2.norm()); if(rows>=2) VERIFY_IS_MUCH_SMALLER_THAN(v1.tail(rows-1).norm(), v1.norm()); v1 = VectorType::Random(rows); v2 = v1; v1.applyHouseholderOnTheLeft(essential,beta,tmp); VERIFY_IS_APPROX(v1.norm(), v2.norm()); // reconstruct householder matrix: SquareMatrixType id, H1, H2; id.setIdentity(rows, rows); H1 = H2 = id; VectorType vv(rows); vv << Scalar(1), essential; H1.applyHouseholderOnTheLeft(essential, beta, tmp); H2.applyHouseholderOnTheRight(essential, beta, tmp); VERIFY_IS_APPROX(H1, H2); VERIFY_IS_APPROX(H1, id - beta * vv*vv.adjoint()); MatrixType m1(rows, cols), m2(rows, cols); v1 = VectorType::Random(rows); if(even) v1.tail(rows-1).setZero(); m1.colwise() = v1; m2 = m1; m1.col(0).makeHouseholder(essential, beta, alpha); m1.applyHouseholderOnTheLeft(essential,beta,tmp); VERIFY_IS_APPROX(m1.norm(), m2.norm()); if(rows>=2) VERIFY_IS_MUCH_SMALLER_THAN(m1.block(1,0,rows-1,cols).norm(), m1.norm()); VERIFY_IS_MUCH_SMALLER_THAN(numext::imag(m1(0,0)), numext::real(m1(0,0))); VERIFY_IS_APPROX(numext::real(m1(0,0)), alpha); v1 = VectorType::Random(rows); if(even) v1.tail(rows-1).setZero(); SquareMatrixType m3(rows,rows), m4(rows,rows); m3.rowwise() = v1.transpose(); m4 = m3; m3.row(0).makeHouseholder(essential, beta, alpha); m3.applyHouseholderOnTheRight(essential.conjugate(),beta,tmp); VERIFY_IS_APPROX(m3.norm(), m4.norm()); if(rows>=2) VERIFY_IS_MUCH_SMALLER_THAN(m3.block(0,1,rows,rows-1).norm(), m3.norm()); VERIFY_IS_MUCH_SMALLER_THAN(numext::imag(m3(0,0)), numext::real(m3(0,0))); VERIFY_IS_APPROX(numext::real(m3(0,0)), alpha); // test householder sequence on the left with a shift Index shift = internal::random(0, std::max(rows-2,0)); Index brows = rows - shift; m1.setRandom(rows, cols); HBlockMatrixType hbm = m1.block(shift,0,brows,cols); HouseholderQR qr(hbm); m2 = m1; m2.block(shift,0,brows,cols) = qr.matrixQR(); HCoeffsVectorType hc = qr.hCoeffs().conjugate(); HouseholderSequence hseq(m2, hc); hseq.setLength(hc.size()).setShift(shift); VERIFY(hseq.length() == hc.size()); VERIFY(hseq.shift() == shift); MatrixType m5 = m2; m5.block(shift,0,brows,cols).template triangularView().setZero(); VERIFY_IS_APPROX(hseq * m5, m1); // test applying hseq directly m3 = hseq; VERIFY_IS_APPROX(m3 * m5, m1); // test evaluating hseq to a dense matrix, then applying SquareMatrixType hseq_mat = hseq; SquareMatrixType hseq_mat_conj = hseq.conjugate(); SquareMatrixType hseq_mat_adj = hseq.adjoint(); SquareMatrixType hseq_mat_trans = hseq.transpose(); SquareMatrixType m6 = SquareMatrixType::Random(rows, rows); VERIFY_IS_APPROX(hseq_mat.adjoint(), hseq_mat_adj); VERIFY_IS_APPROX(hseq_mat.conjugate(), hseq_mat_conj); VERIFY_IS_APPROX(hseq_mat.transpose(), hseq_mat_trans); VERIFY_IS_APPROX(hseq * m6, hseq_mat * m6); VERIFY_IS_APPROX(hseq.adjoint() * m6, hseq_mat_adj * m6); VERIFY_IS_APPROX(hseq.conjugate() * m6, hseq_mat_conj * m6); VERIFY_IS_APPROX(hseq.transpose() * m6, hseq_mat_trans * m6); VERIFY_IS_APPROX(m6 * hseq, m6 * hseq_mat); VERIFY_IS_APPROX(m6 * hseq.adjoint(), m6 * hseq_mat_adj); VERIFY_IS_APPROX(m6 * hseq.conjugate(), m6 * hseq_mat_conj); VERIFY_IS_APPROX(m6 * hseq.transpose(), m6 * hseq_mat_trans); // test householder sequence on the right with a shift TMatrixType tm2 = m2.transpose(); HouseholderSequence rhseq(tm2, hc); rhseq.setLength(hc.size()).setShift(shift); VERIFY_IS_APPROX(rhseq * m5, m1); // test applying rhseq directly m3 = rhseq; VERIFY_IS_APPROX(m3 * m5, m1); // test evaluating rhseq to a dense matrix, then applying } EIGEN_DECLARE_TEST(householder) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( householder(Matrix()) ); CALL_SUBTEST_2( householder(Matrix()) ); CALL_SUBTEST_3( householder(Matrix()) ); CALL_SUBTEST_4( householder(Matrix()) ); CALL_SUBTEST_5( householder(MatrixXd(internal::random(1,EIGEN_TEST_MAX_SIZE),internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_6( householder(MatrixXcf(internal::random(1,EIGEN_TEST_MAX_SIZE),internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_7( householder(MatrixXf(internal::random(1,EIGEN_TEST_MAX_SIZE),internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_8( householder(Matrix()) ); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/incomplete_cholesky.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2015-2016 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. // #define EIGEN_DONT_VECTORIZE // #define EIGEN_MAX_ALIGN_BYTES 0 #include "sparse_solver.h" #include #include template void test_incomplete_cholesky_T() { typedef SparseMatrix SparseMatrixType; ConjugateGradient > > cg_illt_lower_amd; ConjugateGradient > > cg_illt_lower_nat; ConjugateGradient > > cg_illt_upper_amd; ConjugateGradient > > cg_illt_upper_nat; ConjugateGradient > > cg_illt_uplo_amd; CALL_SUBTEST( check_sparse_spd_solving(cg_illt_lower_amd) ); CALL_SUBTEST( check_sparse_spd_solving(cg_illt_lower_nat) ); CALL_SUBTEST( check_sparse_spd_solving(cg_illt_upper_amd) ); CALL_SUBTEST( check_sparse_spd_solving(cg_illt_upper_nat) ); CALL_SUBTEST( check_sparse_spd_solving(cg_illt_uplo_amd) ); } template void bug1150() { // regression for bug 1150 for(int N = 1; N<20; ++N) { Eigen::MatrixXd b( N, N ); b.setOnes(); Eigen::SparseMatrix m( N, N ); m.reserve(Eigen::VectorXi::Constant(N,4)); for( int i = 0; i < N; ++i ) { m.insert( i, i ) = 1; m.coeffRef( i, i / 2 ) = 2; m.coeffRef( i, i / 3 ) = 2; m.coeffRef( i, i / 4 ) = 2; } Eigen::SparseMatrix A; A = m * m.transpose(); Eigen::ConjugateGradient, Eigen::Lower | Eigen::Upper, Eigen::IncompleteCholesky > solver( A ); VERIFY(solver.preconditioner().info() == Eigen::Success); VERIFY(solver.info() == Eigen::Success); } } EIGEN_DECLARE_TEST(incomplete_cholesky) { CALL_SUBTEST_1(( test_incomplete_cholesky_T() )); CALL_SUBTEST_2(( test_incomplete_cholesky_T, int>() )); CALL_SUBTEST_3(( test_incomplete_cholesky_T() )); CALL_SUBTEST_1(( bug1150<0>() )); } ================================================ FILE: VO_Module/thirdparty/eigen/test/indexed_view.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2017 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifdef EIGEN_TEST_PART_2 // Make sure we also check c++11 max implementation #define EIGEN_MAX_CPP_VER 11 #endif #ifdef EIGEN_TEST_PART_3 // Make sure we also check c++98 max implementation #define EIGEN_MAX_CPP_VER 03 // We need to disable this warning when compiling with c++11 while limiting Eigen to c++98 // Ideally we would rather configure the compiler to build in c++98 mode but this needs // to be done at the CMakeLists.txt level. #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) #pragma GCC diagnostic ignored "-Wdeprecated" #endif #if defined(__GNUC__) && (__GNUC__ >=9) #pragma GCC diagnostic ignored "-Wdeprecated-copy" #endif #if defined(__clang__) && (__clang_major__ >= 10) #pragma clang diagnostic ignored "-Wdeprecated-copy" #endif #endif #include #include #include "main.h" #if EIGEN_HAS_CXX11 #include #endif typedef std::pair IndexPair; int encode(Index i, Index j) { return int(i*100 + j); } IndexPair decode(Index ij) { return IndexPair(ij / 100, ij % 100); } template bool match(const T& xpr, std::string ref, std::string str_xpr = "") { EIGEN_UNUSED_VARIABLE(str_xpr); std::stringstream str; str << xpr; if(!(str.str() == ref)) std::cout << str_xpr << "\n" << xpr << "\n\n"; return str.str() == ref; } #define MATCH(X,R) match(X, R, #X) template typename internal::enable_if::value,bool>::type is_same_eq(const T1& a, const T2& b) { return (a == b).all(); } template bool is_same_seq(const T1& a, const T2& b) { bool ok = a.first()==b.first() && a.size() == b.size() && Index(a.incrObject())==Index(b.incrObject());; if(!ok) { std::cerr << "seqN(" << a.first() << ", " << a.size() << ", " << Index(a.incrObject()) << ") != "; std::cerr << "seqN(" << b.first() << ", " << b.size() << ", " << Index(b.incrObject()) << ")\n"; } return ok; } template typename internal::enable_if::value,bool>::type is_same_seq_type(const T1& a, const T2& b) { return is_same_seq(a,b); } #define VERIFY_EQ_INT(A,B) VERIFY_IS_APPROX(int(A),int(B)) // C++03 does not allow local or unnamed enums as index enum DummyEnum { XX=0, YY=1 }; void check_indexed_view() { Index n = 10; ArrayXd a = ArrayXd::LinSpaced(n,0,n-1); Array b = a.transpose(); #if EIGEN_COMP_CXXVER>=14 ArrayXXi A = ArrayXXi::NullaryExpr(n,n, std::ref(encode)); #else ArrayXXi A = ArrayXXi::NullaryExpr(n,n, std::ptr_fun(&encode)); #endif for(Index i=0; i vali(4); Map(&vali[0],4) = eii; std::vector veci(4); Map(veci.data(),4) = eii; VERIFY( MATCH( A(3, seq(9,3,-1)), "309 308 307 306 305 304 303") ); VERIFY( MATCH( A(seqN(2,5), seq(9,3,-1)), "209 208 207 206 205 204 203\n" "309 308 307 306 305 304 303\n" "409 408 407 406 405 404 403\n" "509 508 507 506 505 504 503\n" "609 608 607 606 605 604 603") ); VERIFY( MATCH( A(seqN(2,5), 5), "205\n" "305\n" "405\n" "505\n" "605") ); VERIFY( MATCH( A(seqN(last,5,-1), seq(2,last)), "902 903 904 905 906 907 908 909\n" "802 803 804 805 806 807 808 809\n" "702 703 704 705 706 707 708 709\n" "602 603 604 605 606 607 608 609\n" "502 503 504 505 506 507 508 509") ); VERIFY( MATCH( A(eii, veci), "303 301 306 305\n" "103 101 106 105\n" "603 601 606 605\n" "503 501 506 505") ); VERIFY( MATCH( A(eii, all), "300 301 302 303 304 305 306 307 308 309\n" "100 101 102 103 104 105 106 107 108 109\n" "600 601 602 603 604 605 606 607 608 609\n" "500 501 502 503 504 505 506 507 508 509") ); // take row number 3, and repeat it 5 times VERIFY( MATCH( A(seqN(3,5,0), all), "300 301 302 303 304 305 306 307 308 309\n" "300 301 302 303 304 305 306 307 308 309\n" "300 301 302 303 304 305 306 307 308 309\n" "300 301 302 303 304 305 306 307 308 309\n" "300 301 302 303 304 305 306 307 308 309") ); VERIFY( MATCH( a(seqN(3,3),0), "3\n4\n5" ) ); VERIFY( MATCH( a(seq(3,5)), "3\n4\n5" ) ); VERIFY( MATCH( a(seqN(3,3,1)), "3\n4\n5" ) ); VERIFY( MATCH( a(seqN(5,3,-1)), "5\n4\n3" ) ); VERIFY( MATCH( b(0,seqN(3,3)), "3 4 5" ) ); VERIFY( MATCH( b(seq(3,5)), "3 4 5" ) ); VERIFY( MATCH( b(seqN(3,3,1)), "3 4 5" ) ); VERIFY( MATCH( b(seqN(5,3,-1)), "5 4 3" ) ); VERIFY( MATCH( b(all), "0 1 2 3 4 5 6 7 8 9" ) ); VERIFY( MATCH( b(eii), "3 1 6 5" ) ); Array44i B; B.setRandom(); VERIFY( (A(seqN(2,5), 5)).ColsAtCompileTime == 1); VERIFY( (A(seqN(2,5), 5)).RowsAtCompileTime == Dynamic); VERIFY_EQ_INT( (A(seqN(2,5), 5)).InnerStrideAtCompileTime , A.InnerStrideAtCompileTime); VERIFY_EQ_INT( (A(seqN(2,5), 5)).OuterStrideAtCompileTime , A.col(5).OuterStrideAtCompileTime); VERIFY_EQ_INT( (A(5,seqN(2,5))).InnerStrideAtCompileTime , A.row(5).InnerStrideAtCompileTime); VERIFY_EQ_INT( (A(5,seqN(2,5))).OuterStrideAtCompileTime , A.row(5).OuterStrideAtCompileTime); VERIFY_EQ_INT( (B(1,seqN(1,2))).InnerStrideAtCompileTime , B.row(1).InnerStrideAtCompileTime); VERIFY_EQ_INT( (B(1,seqN(1,2))).OuterStrideAtCompileTime , B.row(1).OuterStrideAtCompileTime); VERIFY_EQ_INT( (A(seqN(2,5), seq(1,3))).InnerStrideAtCompileTime , A.InnerStrideAtCompileTime); VERIFY_EQ_INT( (A(seqN(2,5), seq(1,3))).OuterStrideAtCompileTime , A.OuterStrideAtCompileTime); VERIFY_EQ_INT( (B(seqN(1,2), seq(1,3))).InnerStrideAtCompileTime , B.InnerStrideAtCompileTime); VERIFY_EQ_INT( (B(seqN(1,2), seq(1,3))).OuterStrideAtCompileTime , B.OuterStrideAtCompileTime); VERIFY_EQ_INT( (A(seqN(2,5,2), seq(1,3,2))).InnerStrideAtCompileTime , Dynamic); VERIFY_EQ_INT( (A(seqN(2,5,2), seq(1,3,2))).OuterStrideAtCompileTime , Dynamic); VERIFY_EQ_INT( (A(seqN(2,5,fix<2>), seq(1,3,fix<3>))).InnerStrideAtCompileTime , 2); VERIFY_EQ_INT( (A(seqN(2,5,fix<2>), seq(1,3,fix<3>))).OuterStrideAtCompileTime , Dynamic); VERIFY_EQ_INT( (B(seqN(1,2,fix<2>), seq(1,3,fix<3>))).InnerStrideAtCompileTime , 2); VERIFY_EQ_INT( (B(seqN(1,2,fix<2>), seq(1,3,fix<3>))).OuterStrideAtCompileTime , 3*4); VERIFY_EQ_INT( (A(seqN(2,fix<5>), seqN(1,fix<3>))).RowsAtCompileTime, 5); VERIFY_EQ_INT( (A(seqN(2,fix<5>), seqN(1,fix<3>))).ColsAtCompileTime, 3); VERIFY_EQ_INT( (A(seqN(2,fix<5>(5)), seqN(1,fix<3>(3)))).RowsAtCompileTime, 5); VERIFY_EQ_INT( (A(seqN(2,fix<5>(5)), seqN(1,fix<3>(3)))).ColsAtCompileTime, 3); VERIFY_EQ_INT( (A(seqN(2,fix(5)), seqN(1,fix(3)))).RowsAtCompileTime, Dynamic); VERIFY_EQ_INT( (A(seqN(2,fix(5)), seqN(1,fix(3)))).ColsAtCompileTime, Dynamic); VERIFY_EQ_INT( (A(seqN(2,fix(5)), seqN(1,fix(3)))).rows(), 5); VERIFY_EQ_INT( (A(seqN(2,fix(5)), seqN(1,fix(3)))).cols(), 3); VERIFY( is_same_seq_type( seqN(2,5,fix<-1>), seqN(2,5,fix<-1>(-1)) ) ); VERIFY( is_same_seq_type( seqN(2,5), seqN(2,5,fix<1>(1)) ) ); VERIFY( is_same_seq_type( seqN(2,5,3), seqN(2,5,fix(3)) ) ); VERIFY( is_same_seq_type( seq(2,7,fix<3>), seqN(2,2,fix<3>) ) ); VERIFY( is_same_seq_type( seqN(2,fix(5),3), seqN(2,5,fix(3)) ) ); VERIFY( is_same_seq_type( seqN(2,fix<5>(5),fix<-2>), seqN(2,fix<5>,fix<-2>()) ) ); VERIFY( is_same_seq_type( seq(2,fix<5>), seqN(2,4) ) ); #if EIGEN_HAS_CXX11 VERIFY( is_same_seq_type( seq(fix<2>,fix<5>), seqN(fix<2>,fix<4>) ) ); VERIFY( is_same_seq( seqN(2,std::integral_constant(),std::integral_constant()), seqN(2,fix<5>,fix<-2>()) ) ); VERIFY( is_same_seq( seq(std::integral_constant(),std::integral_constant(),std::integral_constant()), seq(fix<1>,fix<5>,fix<2>()) ) ); VERIFY( is_same_seq_type( seqN(2,std::integral_constant(),std::integral_constant()), seqN(2,fix<5>,fix<-2>()) ) ); VERIFY( is_same_seq_type( seq(std::integral_constant(),std::integral_constant(),std::integral_constant()), seq(fix<1>,fix<5>,fix<2>()) ) ); VERIFY( is_same_seq_type( seqN(2,std::integral_constant()), seqN(2,fix<5>) ) ); VERIFY( is_same_seq_type( seq(std::integral_constant(),std::integral_constant()), seq(fix<1>,fix<5>) ) ); #else // sorry, no compile-time size recovery in c++98/03 VERIFY( is_same_seq( seq(fix<2>,fix<5>), seqN(fix<2>,fix<4>) ) ); #endif VERIFY( (A(seqN(2,fix<5>), 5)).RowsAtCompileTime == 5); VERIFY( (A(4, all)).ColsAtCompileTime == Dynamic); VERIFY( (A(4, all)).RowsAtCompileTime == 1); VERIFY( (B(1, all)).ColsAtCompileTime == 4); VERIFY( (B(1, all)).RowsAtCompileTime == 1); VERIFY( (B(all,1)).ColsAtCompileTime == 1); VERIFY( (B(all,1)).RowsAtCompileTime == 4); VERIFY(int( (A(all, eii)).ColsAtCompileTime) == int(eii.SizeAtCompileTime)); VERIFY_EQ_INT( (A(eii, eii)).Flags&DirectAccessBit, (unsigned int)(0)); VERIFY_EQ_INT( (A(eii, eii)).InnerStrideAtCompileTime, 0); VERIFY_EQ_INT( (A(eii, eii)).OuterStrideAtCompileTime, 0); VERIFY_IS_APPROX( A(seq(n-1,2,-2), seqN(n-1-6,3,-1)), A(seq(last,2,fix<-2>), seqN(last-6,3,fix<-1>)) ); VERIFY_IS_APPROX( A(seq(n-1,2,-2), seqN(n-1-6,4)), A(seq(last,2,-2), seqN(last-6,4)) ); VERIFY_IS_APPROX( A(seq(n-1-6,n-1-2), seqN(n-1-6,4)), A(seq(last-6,last-2), seqN(6+last-6-6,4)) ); VERIFY_IS_APPROX( A(seq((n-1)/2,(n)/2+3), seqN(2,4)), A(seq(last/2,(last+1)/2+3), seqN(last+2-last,4)) ); VERIFY_IS_APPROX( A(seq(n-2,2,-2), seqN(n-8,4)), A(seq(lastp1-2,2,-2), seqN(lastp1-8,4)) ); // Check all combinations of seq: VERIFY_IS_APPROX( A(seq(1,n-1-2,2), seq(1,n-1-2,2)), A(seq(1,last-2,2), seq(1,last-2,fix<2>)) ); VERIFY_IS_APPROX( A(seq(n-1-5,n-1-2,2), seq(n-1-5,n-1-2,2)), A(seq(last-5,last-2,2), seq(last-5,last-2,fix<2>)) ); VERIFY_IS_APPROX( A(seq(n-1-5,7,2), seq(n-1-5,7,2)), A(seq(last-5,7,2), seq(last-5,7,fix<2>)) ); VERIFY_IS_APPROX( A(seq(1,n-1-2), seq(n-1-5,7)), A(seq(1,last-2), seq(last-5,7)) ); VERIFY_IS_APPROX( A(seq(n-1-5,n-1-2), seq(n-1-5,n-1-2)), A(seq(last-5,last-2), seq(last-5,last-2)) ); VERIFY_IS_APPROX( A.col(A.cols()-1), A(all,last) ); VERIFY_IS_APPROX( A(A.rows()-2, A.cols()/2), A(last-1, lastp1/2) ); VERIFY_IS_APPROX( a(a.size()-2), a(last-1) ); VERIFY_IS_APPROX( a(a.size()/2), a((last+1)/2) ); // Check fall-back to Block { VERIFY( is_same_eq(A.col(0), A(all,0)) ); VERIFY( is_same_eq(A.row(0), A(0,all)) ); VERIFY( is_same_eq(A.block(0,0,2,2), A(seqN(0,2),seq(0,1))) ); VERIFY( is_same_eq(A.middleRows(2,4), A(seqN(2,4),all)) ); VERIFY( is_same_eq(A.middleCols(2,4), A(all,seqN(2,4))) ); VERIFY( is_same_eq(A.col(A.cols()-1), A(all,last)) ); const ArrayXXi& cA(A); VERIFY( is_same_eq(cA.col(0), cA(all,0)) ); VERIFY( is_same_eq(cA.row(0), cA(0,all)) ); VERIFY( is_same_eq(cA.block(0,0,2,2), cA(seqN(0,2),seq(0,1))) ); VERIFY( is_same_eq(cA.middleRows(2,4), cA(seqN(2,4),all)) ); VERIFY( is_same_eq(cA.middleCols(2,4), cA(all,seqN(2,4))) ); VERIFY( is_same_eq(a.head(4), a(seq(0,3))) ); VERIFY( is_same_eq(a.tail(4), a(seqN(last-3,4))) ); VERIFY( is_same_eq(a.tail(4), a(seq(lastp1-4,last))) ); VERIFY( is_same_eq(a.segment<4>(3), a(seqN(3,fix<4>))) ); } ArrayXXi A1=A, A2 = ArrayXXi::Random(4,4); ArrayXi range25(4); range25 << 3,2,4,5; A1(seqN(3,4),seq(2,5)) = A2; VERIFY_IS_APPROX( A1.block(3,2,4,4), A2 ); A1 = A; A2.setOnes(); A1(seq(6,3,-1),range25) = A2; VERIFY_IS_APPROX( A1.block(3,2,4,4), A2 ); // check reverse { VERIFY( is_same_seq_type( seq(3,7).reverse(), seqN(7,5,fix<-1>) ) ); VERIFY( is_same_seq_type( seq(7,3,fix<-2>).reverse(), seqN(3,3,fix<2>) ) ); VERIFY_IS_APPROX( a(seqN(2,last/2).reverse()), a(seqN(2+(last/2-1)*1,last/2,fix<-1>)) ); VERIFY_IS_APPROX( a(seqN(last/2,fix<4>).reverse()),a(seqN(last/2,fix<4>)).reverse() ); VERIFY_IS_APPROX( A(seq(last-5,last-1,2).reverse(), seqN(last-3,3,fix<-2>).reverse()), A(seq(last-5,last-1,2), seqN(last-3,3,fix<-2>)).reverse() ); } #if EIGEN_HAS_CXX11 // check lastN VERIFY_IS_APPROX( a(lastN(3)), a.tail(3) ); VERIFY( MATCH( a(lastN(3)), "7\n8\n9" ) ); VERIFY_IS_APPROX( a(lastN(fix<3>())), a.tail<3>() ); VERIFY( MATCH( a(lastN(3,2)), "5\n7\n9" ) ); VERIFY( MATCH( a(lastN(3,fix<2>())), "5\n7\n9" ) ); VERIFY( a(lastN(fix<3>())).SizeAtCompileTime == 3 ); VERIFY( (A(all, std::array{{1,3,2,4}})).ColsAtCompileTime == 4); VERIFY_IS_APPROX( (A(std::array{{1,3,5}}, std::array{{9,6,3,0}})), A(seqN(1,3,2), seqN(9,4,-3)) ); #if EIGEN_HAS_STATIC_ARRAY_TEMPLATE VERIFY_IS_APPROX( A({3, 1, 6, 5}, all), A(std::array{{3, 1, 6, 5}}, all) ); VERIFY_IS_APPROX( A(all,{3, 1, 6, 5}), A(all,std::array{{3, 1, 6, 5}}) ); VERIFY_IS_APPROX( A({1,3,5},{3, 1, 6, 5}), A(std::array{{1,3,5}},std::array{{3, 1, 6, 5}}) ); VERIFY_IS_EQUAL( A({1,3,5},{3, 1, 6, 5}).RowsAtCompileTime, 3 ); VERIFY_IS_EQUAL( A({1,3,5},{3, 1, 6, 5}).ColsAtCompileTime, 4 ); VERIFY_IS_APPROX( a({3, 1, 6, 5}), a(std::array{{3, 1, 6, 5}}) ); VERIFY_IS_EQUAL( a({1,3,5}).SizeAtCompileTime, 3 ); VERIFY_IS_APPROX( b({3, 1, 6, 5}), b(std::array{{3, 1, 6, 5}}) ); VERIFY_IS_EQUAL( b({1,3,5}).SizeAtCompileTime, 3 ); #endif #endif // check mat(i,j) with weird types for i and j { VERIFY_IS_APPROX( A(B.RowsAtCompileTime-1, 1), A(3,1) ); VERIFY_IS_APPROX( A(B.RowsAtCompileTime, 1), A(4,1) ); VERIFY_IS_APPROX( A(B.RowsAtCompileTime-1, B.ColsAtCompileTime-1), A(3,3) ); VERIFY_IS_APPROX( A(B.RowsAtCompileTime, B.ColsAtCompileTime), A(4,4) ); const Index I_ = 3, J_ = 4; VERIFY_IS_APPROX( A(I_,J_), A(3,4) ); } // check extended block API { VERIFY( is_same_eq( A.block<3,4>(1,1), A.block(1,1,fix<3>,fix<4>)) ); VERIFY( is_same_eq( A.block<3,4>(1,1,3,4), A.block(1,1,fix<3>(),fix<4>(4))) ); VERIFY( is_same_eq( A.block<3,Dynamic>(1,1,3,4), A.block(1,1,fix<3>,4)) ); VERIFY( is_same_eq( A.block(1,1,3,4), A.block(1,1,fix(3),fix<4>)) ); VERIFY( is_same_eq( A.block(1,1,3,4), A.block(1,1,fix(3),fix(4))) ); VERIFY( is_same_eq( A.topLeftCorner<3,4>(), A.topLeftCorner(fix<3>,fix<4>)) ); VERIFY( is_same_eq( A.bottomLeftCorner<3,4>(), A.bottomLeftCorner(fix<3>,fix<4>)) ); VERIFY( is_same_eq( A.bottomRightCorner<3,4>(), A.bottomRightCorner(fix<3>,fix<4>)) ); VERIFY( is_same_eq( A.topRightCorner<3,4>(), A.topRightCorner(fix<3>,fix<4>)) ); VERIFY( is_same_eq( A.leftCols<3>(), A.leftCols(fix<3>)) ); VERIFY( is_same_eq( A.rightCols<3>(), A.rightCols(fix<3>)) ); VERIFY( is_same_eq( A.middleCols<3>(1), A.middleCols(1,fix<3>)) ); VERIFY( is_same_eq( A.topRows<3>(), A.topRows(fix<3>)) ); VERIFY( is_same_eq( A.bottomRows<3>(), A.bottomRows(fix<3>)) ); VERIFY( is_same_eq( A.middleRows<3>(1), A.middleRows(1,fix<3>)) ); VERIFY( is_same_eq( a.segment<3>(1), a.segment(1,fix<3>)) ); VERIFY( is_same_eq( a.head<3>(), a.head(fix<3>)) ); VERIFY( is_same_eq( a.tail<3>(), a.tail(fix<3>)) ); const ArrayXXi& cA(A); VERIFY( is_same_eq( cA.block(1,1,3,4), cA.block(1,1,fix(3),fix<4>)) ); VERIFY( is_same_eq( cA.topLeftCorner<3,4>(), cA.topLeftCorner(fix<3>,fix<4>)) ); VERIFY( is_same_eq( cA.bottomLeftCorner<3,4>(), cA.bottomLeftCorner(fix<3>,fix<4>)) ); VERIFY( is_same_eq( cA.bottomRightCorner<3,4>(), cA.bottomRightCorner(fix<3>,fix<4>)) ); VERIFY( is_same_eq( cA.topRightCorner<3,4>(), cA.topRightCorner(fix<3>,fix<4>)) ); VERIFY( is_same_eq( cA.leftCols<3>(), cA.leftCols(fix<3>)) ); VERIFY( is_same_eq( cA.rightCols<3>(), cA.rightCols(fix<3>)) ); VERIFY( is_same_eq( cA.middleCols<3>(1), cA.middleCols(1,fix<3>)) ); VERIFY( is_same_eq( cA.topRows<3>(), cA.topRows(fix<3>)) ); VERIFY( is_same_eq( cA.bottomRows<3>(), cA.bottomRows(fix<3>)) ); VERIFY( is_same_eq( cA.middleRows<3>(1), cA.middleRows(1,fix<3>)) ); } // Check compilation of enums as index type: a(XX) = 1; A(XX,YY) = 1; // Anonymous enums only work with C++11 #if EIGEN_HAS_CXX11 enum { X=0, Y=1 }; a(X) = 1; A(X,Y) = 1; A(XX,Y) = 1; A(X,YY) = 1; #endif // Check compilation of varying integer types as index types: Index i = n/2; short i_short(i); std::size_t i_sizet(i); VERIFY_IS_EQUAL( a(i), a.coeff(i_short) ); VERIFY_IS_EQUAL( a(i), a.coeff(i_sizet) ); VERIFY_IS_EQUAL( A(i,i), A.coeff(i_short, i_short) ); VERIFY_IS_EQUAL( A(i,i), A.coeff(i_short, i) ); VERIFY_IS_EQUAL( A(i,i), A.coeff(i, i_short) ); VERIFY_IS_EQUAL( A(i,i), A.coeff(i, i_sizet) ); VERIFY_IS_EQUAL( A(i,i), A.coeff(i_sizet, i) ); VERIFY_IS_EQUAL( A(i,i), A.coeff(i_sizet, i_short) ); VERIFY_IS_EQUAL( A(i,i), A.coeff(5, i_sizet) ); // Regression test for Max{Rows,Cols}AtCompileTime { Matrix3i A3 = Matrix3i::Random(); ArrayXi ind(5); ind << 1,1,1,1,1; VERIFY_IS_EQUAL( A3(ind,ind).eval(), MatrixXi::Constant(5,5,A3(1,1)) ); } // Regression for bug 1736 { VERIFY_IS_APPROX(A(all, eii).col(0).eval(), A.col(eii(0))); A(all, eii).col(0) = A.col(eii(0)); } // bug 1815: IndexedView should allow linear access { VERIFY( MATCH( b(eii)(0), "3" ) ); VERIFY( MATCH( a(eii)(0), "3" ) ); VERIFY( MATCH( A(1,eii)(0), "103")); VERIFY( MATCH( A(eii,1)(0), "301")); VERIFY( MATCH( A(1,all)(1), "101")); VERIFY( MATCH( A(all,1)(1), "101")); } #if EIGEN_HAS_CXX11 //Bug IndexView with a single static row should be RowMajor: { // A(1, seq(0,2,1)).cwiseAbs().colwise().replicate(2).eval(); STATIC_CHECK(( (internal::evaluator::Flags & RowMajorBit) == RowMajorBit )); } #endif } EIGEN_DECLARE_TEST(indexed_view) { // for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( check_indexed_view() ); CALL_SUBTEST_2( check_indexed_view() ); CALL_SUBTEST_3( check_indexed_view() ); // } // static checks of some internals: STATIC_CHECK(( internal::is_valid_index_type::value )); STATIC_CHECK(( internal::is_valid_index_type::value )); STATIC_CHECK(( internal::is_valid_index_type::value )); STATIC_CHECK(( internal::is_valid_index_type::value )); STATIC_CHECK(( internal::is_valid_index_type::value )); STATIC_CHECK(( !internal::valid_indexed_view_overload::value )); STATIC_CHECK(( !internal::valid_indexed_view_overload::value )); STATIC_CHECK(( !internal::valid_indexed_view_overload::value )); STATIC_CHECK(( !internal::valid_indexed_view_overload::value )); } ================================================ FILE: VO_Module/thirdparty/eigen/test/initializer_list_construction.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2019 David Tellenbach // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #define EIGEN_NO_STATIC_ASSERT #include "main.h" template::IsInteger> struct TestMethodDispatching { static void run() {} }; template struct TestMethodDispatching { static void run() { { Matrix m {3, 4}; Array a {3, 4}; VERIFY(m.rows() == 3); VERIFY(m.cols() == 4); VERIFY(a.rows() == 3); VERIFY(a.cols() == 4); } { Matrix m {3, 4}; Array a {3, 4}; VERIFY(m(0) == 3); VERIFY(m(1) == 4); VERIFY(a(0) == 3); VERIFY(a(1) == 4); } { Matrix m {3, 4}; Array a {3, 4}; VERIFY(m(0) == 3); VERIFY(m(1) == 4); VERIFY(a(0) == 3); VERIFY(a(1) == 4); } } }; template void fixedsizeVariadicVectorConstruction2() { { Vec4 ref = Vec4::Random(); Vec4 v{ ref[0], ref[1], ref[2], ref[3] }; VERIFY_IS_APPROX(v, ref); VERIFY_IS_APPROX(v, (Vec4( ref[0], ref[1], ref[2], ref[3] ))); VERIFY_IS_APPROX(v, (Vec4({ref[0], ref[1], ref[2], ref[3]}))); Vec4 v2 = { ref[0], ref[1], ref[2], ref[3] }; VERIFY_IS_APPROX(v2, ref); } { Vec5 ref = Vec5::Random(); Vec5 v{ ref[0], ref[1], ref[2], ref[3], ref[4] }; VERIFY_IS_APPROX(v, ref); VERIFY_IS_APPROX(v, (Vec5( ref[0], ref[1], ref[2], ref[3], ref[4] ))); VERIFY_IS_APPROX(v, (Vec5({ref[0], ref[1], ref[2], ref[3], ref[4]}))); Vec5 v2 = { ref[0], ref[1], ref[2], ref[3], ref[4] }; VERIFY_IS_APPROX(v2, ref); } } #define CHECK_MIXSCALAR_V5_APPROX(V, A0, A1, A2, A3, A4) { \ VERIFY_IS_APPROX(V[0], Scalar(A0) ); \ VERIFY_IS_APPROX(V[1], Scalar(A1) ); \ VERIFY_IS_APPROX(V[2], Scalar(A2) ); \ VERIFY_IS_APPROX(V[3], Scalar(A3) ); \ VERIFY_IS_APPROX(V[4], Scalar(A4) ); \ } #define CHECK_MIXSCALAR_V5(VEC5, A0, A1, A2, A3, A4) { \ typedef VEC5::Scalar Scalar; \ VEC5 v = { A0 , A1 , A2 , A3 , A4 }; \ CHECK_MIXSCALAR_V5_APPROX(v, A0 , A1 , A2 , A3 , A4); \ } template void fixedsizeVariadicVectorConstruction3() { typedef Matrix Vec5; typedef Array Arr5; CHECK_MIXSCALAR_V5(Vec5, 1, 2., -3, 4.121, 5.53252); CHECK_MIXSCALAR_V5(Arr5, 1, 2., 3.12f, 4.121, 5.53252); } template void fixedsizeVariadicVectorConstruction() { CALL_SUBTEST(( fixedsizeVariadicVectorConstruction2, Matrix >() )); CALL_SUBTEST(( fixedsizeVariadicVectorConstruction2, Matrix >() )); CALL_SUBTEST(( fixedsizeVariadicVectorConstruction2, Array >() )); CALL_SUBTEST(( fixedsizeVariadicVectorConstruction2, Array >() )); } template void initializerListVectorConstruction() { Scalar raw[4]; for(int k = 0; k < 4; ++k) { raw[k] = internal::random(); } { Matrix m { {raw[0]}, {raw[1]},{raw[2]},{raw[3]} }; Array a { {raw[0]}, {raw[1]}, {raw[2]}, {raw[3]} }; for(int k = 0; k < 4; ++k) { VERIFY(m(k) == raw[k]); } for(int k = 0; k < 4; ++k) { VERIFY(a(k) == raw[k]); } VERIFY_IS_EQUAL(m, (Matrix({ {raw[0]}, {raw[1]}, {raw[2]}, {raw[3]} }))); VERIFY((a == (Array({ {raw[0]}, {raw[1]}, {raw[2]}, {raw[3]} }))).all()); } { Matrix m { {raw[0], raw[1], raw[2], raw[3]} }; Array a { {raw[0], raw[1], raw[2], raw[3]} }; for(int k = 0; k < 4; ++k) { VERIFY(m(k) == raw[k]); } for(int k = 0; k < 4; ++k) { VERIFY(a(k) == raw[k]); } VERIFY_IS_EQUAL(m, (Matrix({{raw[0],raw[1],raw[2],raw[3]}}))); VERIFY((a == (Array({{raw[0],raw[1],raw[2],raw[3]}}))).all()); } { Matrix m { {raw[0]}, {raw[1]}, {raw[2]}, {raw[3]} }; Array a { {raw[0]}, {raw[1]}, {raw[2]}, {raw[3]} }; for(int k=0; k < 4; ++k) { VERIFY(m(k) == raw[k]); } for(int k=0; k < 4; ++k) { VERIFY(a(k) == raw[k]); } VERIFY_IS_EQUAL(m, (Matrix({ {raw[0]}, {raw[1]}, {raw[2]}, {raw[3]} }))); VERIFY((a == (Array({ {raw[0]}, {raw[1]}, {raw[2]}, {raw[3]} }))).all()); } { Matrix m {{raw[0],raw[1],raw[2],raw[3]}}; Array a {{raw[0],raw[1],raw[2],raw[3]}}; for(int k=0; k < 4; ++k) { VERIFY(m(k) == raw[k]); } for(int k=0; k < 4; ++k) { VERIFY(a(k) == raw[k]); } VERIFY_IS_EQUAL(m, (Matrix({{raw[0],raw[1],raw[2],raw[3]}}))); VERIFY((a == (Array({{raw[0],raw[1],raw[2],raw[3]}}))).all()); } } template void initializerListMatrixConstruction() { const Index RowsAtCompileTime = 5; const Index ColsAtCompileTime = 4; const Index SizeAtCompileTime = RowsAtCompileTime * ColsAtCompileTime; Scalar raw[SizeAtCompileTime]; for (int i = 0; i < SizeAtCompileTime; ++i) { raw[i] = internal::random(); } { Matrix m {}; VERIFY(m.cols() == 0); VERIFY(m.rows() == 0); VERIFY_IS_EQUAL(m, (Matrix())); } { Matrix m { {raw[0], raw[1], raw[2], raw[3]}, {raw[4], raw[5], raw[6], raw[7]}, {raw[8], raw[9], raw[10], raw[11]}, {raw[12], raw[13], raw[14], raw[15]}, {raw[16], raw[17], raw[18], raw[19]} }; Matrix m2; m2 << raw[0], raw[1], raw[2], raw[3], raw[4], raw[5], raw[6], raw[7], raw[8], raw[9], raw[10], raw[11], raw[12], raw[13], raw[14], raw[15], raw[16], raw[17], raw[18], raw[19]; int k = 0; for(int i = 0; i < RowsAtCompileTime; ++i) { for (int j = 0; j < ColsAtCompileTime; ++j) { VERIFY(m(i, j) == raw[k]); ++k; } } VERIFY_IS_EQUAL(m, m2); } { Matrix m{ {raw[0], raw[1], raw[2], raw[3]}, {raw[4], raw[5], raw[6], raw[7]}, {raw[8], raw[9], raw[10], raw[11]}, {raw[12], raw[13], raw[14], raw[15]}, {raw[16], raw[17], raw[18], raw[19]} }; VERIFY(m.cols() == 4); VERIFY(m.rows() == 5); int k = 0; for(int i = 0; i < RowsAtCompileTime; ++i) { for (int j = 0; j < ColsAtCompileTime; ++j) { VERIFY(m(i, j) == raw[k]); ++k; } } Matrix m2(RowsAtCompileTime, ColsAtCompileTime); k = 0; for(int i = 0; i < RowsAtCompileTime; ++i) { for (int j = 0; j < ColsAtCompileTime; ++j) { m2(i, j) = raw[k]; ++k; } } VERIFY_IS_EQUAL(m, m2); } } template void initializerListArrayConstruction() { const Index RowsAtCompileTime = 5; const Index ColsAtCompileTime = 4; const Index SizeAtCompileTime = RowsAtCompileTime * ColsAtCompileTime; Scalar raw[SizeAtCompileTime]; for (int i = 0; i < SizeAtCompileTime; ++i) { raw[i] = internal::random(); } { Array a {}; VERIFY(a.cols() == 0); VERIFY(a.rows() == 0); } { Array m { {raw[0], raw[1], raw[2], raw[3]}, {raw[4], raw[5], raw[6], raw[7]}, {raw[8], raw[9], raw[10], raw[11]}, {raw[12], raw[13], raw[14], raw[15]}, {raw[16], raw[17], raw[18], raw[19]} }; Array m2; m2 << raw[0], raw[1], raw[2], raw[3], raw[4], raw[5], raw[6], raw[7], raw[8], raw[9], raw[10], raw[11], raw[12], raw[13], raw[14], raw[15], raw[16], raw[17], raw[18], raw[19]; int k = 0; for(int i = 0; i < RowsAtCompileTime; ++i) { for (int j = 0; j < ColsAtCompileTime; ++j) { VERIFY(m(i, j) == raw[k]); ++k; } } VERIFY_IS_APPROX(m, m2); } { Array m { {raw[0], raw[1], raw[2], raw[3]}, {raw[4], raw[5], raw[6], raw[7]}, {raw[8], raw[9], raw[10], raw[11]}, {raw[12], raw[13], raw[14], raw[15]}, {raw[16], raw[17], raw[18], raw[19]} }; VERIFY(m.cols() == 4); VERIFY(m.rows() == 5); int k = 0; for(int i = 0; i < RowsAtCompileTime; ++i) { for (int j = 0; j < ColsAtCompileTime; ++j) { VERIFY(m(i, j) == raw[k]); ++k; } } Array m2(RowsAtCompileTime, ColsAtCompileTime); k = 0; for(int i = 0; i < RowsAtCompileTime; ++i) { for (int j = 0; j < ColsAtCompileTime; ++j) { m2(i, j) = raw[k]; ++k; } } VERIFY_IS_APPROX(m, m2); } } template void dynamicVectorConstruction() { const Index size = 4; Scalar raw[size]; for (int i = 0; i < size; ++i) { raw[i] = internal::random(); } typedef Matrix VectorX; { VectorX v {{raw[0], raw[1], raw[2], raw[3]}}; for (int i = 0; i < size; ++i) { VERIFY(v(i) == raw[i]); } VERIFY(v.rows() == size); VERIFY(v.cols() == 1); VERIFY_IS_EQUAL(v, (VectorX {{raw[0], raw[1], raw[2], raw[3]}})); } { VERIFY_RAISES_ASSERT((VectorX {raw[0], raw[1], raw[2], raw[3]})); } { VERIFY_RAISES_ASSERT((VectorX { {raw[0], raw[1], raw[2], raw[3]}, {raw[0], raw[1], raw[2], raw[3]}, })); } } EIGEN_DECLARE_TEST(initializer_list_construction) { CALL_SUBTEST_1(initializerListVectorConstruction()); CALL_SUBTEST_1(initializerListVectorConstruction()); CALL_SUBTEST_1(initializerListVectorConstruction()); CALL_SUBTEST_1(initializerListVectorConstruction()); CALL_SUBTEST_1(initializerListVectorConstruction()); CALL_SUBTEST_1(initializerListVectorConstruction()); CALL_SUBTEST_1(initializerListVectorConstruction>()); CALL_SUBTEST_1(initializerListVectorConstruction>()); CALL_SUBTEST_2(initializerListMatrixConstruction()); CALL_SUBTEST_2(initializerListMatrixConstruction()); CALL_SUBTEST_2(initializerListMatrixConstruction()); CALL_SUBTEST_2(initializerListMatrixConstruction()); CALL_SUBTEST_2(initializerListMatrixConstruction()); CALL_SUBTEST_2(initializerListMatrixConstruction()); CALL_SUBTEST_2(initializerListMatrixConstruction>()); CALL_SUBTEST_2(initializerListMatrixConstruction>()); CALL_SUBTEST_3(initializerListArrayConstruction()); CALL_SUBTEST_3(initializerListArrayConstruction()); CALL_SUBTEST_3(initializerListArrayConstruction()); CALL_SUBTEST_3(initializerListArrayConstruction()); CALL_SUBTEST_3(initializerListArrayConstruction()); CALL_SUBTEST_3(initializerListArrayConstruction()); CALL_SUBTEST_3(initializerListArrayConstruction>()); CALL_SUBTEST_3(initializerListArrayConstruction>()); CALL_SUBTEST_4(fixedsizeVariadicVectorConstruction()); CALL_SUBTEST_4(fixedsizeVariadicVectorConstruction()); CALL_SUBTEST_4(fixedsizeVariadicVectorConstruction()); CALL_SUBTEST_4(fixedsizeVariadicVectorConstruction()); CALL_SUBTEST_4(fixedsizeVariadicVectorConstruction()); CALL_SUBTEST_4(fixedsizeVariadicVectorConstruction()); CALL_SUBTEST_4(fixedsizeVariadicVectorConstruction>()); CALL_SUBTEST_4(fixedsizeVariadicVectorConstruction>()); CALL_SUBTEST_4(fixedsizeVariadicVectorConstruction3<0>()); CALL_SUBTEST_5(TestMethodDispatching::run()); CALL_SUBTEST_5(TestMethodDispatching::run()); CALL_SUBTEST_6(dynamicVectorConstruction()); CALL_SUBTEST_6(dynamicVectorConstruction()); CALL_SUBTEST_6(dynamicVectorConstruction()); CALL_SUBTEST_6(dynamicVectorConstruction()); CALL_SUBTEST_6(dynamicVectorConstruction()); CALL_SUBTEST_6(dynamicVectorConstruction()); CALL_SUBTEST_6(dynamicVectorConstruction>()); CALL_SUBTEST_6(dynamicVectorConstruction>()); } ================================================ FILE: VO_Module/thirdparty/eigen/test/inplace_decomposition.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2016 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include #include #include // This file test inplace decomposition through Ref<>, as supported by Cholesky, LU, and QR decompositions. template void inplace(bool square = false, bool SPD = false) { typedef typename MatrixType::Scalar Scalar; typedef Matrix RhsType; typedef Matrix ResType; Index rows = MatrixType::RowsAtCompileTime==Dynamic ? internal::random(2,EIGEN_TEST_MAX_SIZE/2) : Index(MatrixType::RowsAtCompileTime); Index cols = MatrixType::ColsAtCompileTime==Dynamic ? (square?rows:internal::random(2,rows)) : Index(MatrixType::ColsAtCompileTime); MatrixType A = MatrixType::Random(rows,cols); RhsType b = RhsType::Random(rows); ResType x(cols); if(SPD) { assert(square); A.topRows(cols) = A.topRows(cols).adjoint() * A.topRows(cols); A.diagonal().array() += 1e-3; } MatrixType A0 = A; MatrixType A1 = A; DecType dec(A); // Check that the content of A has been modified VERIFY_IS_NOT_APPROX( A, A0 ); // Check that the decomposition is correct: if(rows==cols) { VERIFY_IS_APPROX( A0 * (x = dec.solve(b)), b ); } else { VERIFY_IS_APPROX( A0.transpose() * A0 * (x = dec.solve(b)), A0.transpose() * b ); } // Check that modifying A breaks the current dec: A.setRandom(); if(rows==cols) { VERIFY_IS_NOT_APPROX( A0 * (x = dec.solve(b)), b ); } else { VERIFY_IS_NOT_APPROX( A0.transpose() * A0 * (x = dec.solve(b)), A0.transpose() * b ); } // Check that calling compute(A1) does not modify A1: A = A0; dec.compute(A1); VERIFY_IS_EQUAL(A0,A1); VERIFY_IS_NOT_APPROX( A, A0 ); if(rows==cols) { VERIFY_IS_APPROX( A0 * (x = dec.solve(b)), b ); } else { VERIFY_IS_APPROX( A0.transpose() * A0 * (x = dec.solve(b)), A0.transpose() * b ); } } EIGEN_DECLARE_TEST(inplace_decomposition) { EIGEN_UNUSED typedef Matrix Matrix43d; for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1(( inplace >, MatrixXd>(true,true) )); CALL_SUBTEST_1(( inplace >, Matrix4d>(true,true) )); CALL_SUBTEST_2(( inplace >, MatrixXd>(true,true) )); CALL_SUBTEST_2(( inplace >, Matrix4d>(true,true) )); CALL_SUBTEST_3(( inplace >, MatrixXd>(true,false) )); CALL_SUBTEST_3(( inplace >, Matrix4d>(true,false) )); CALL_SUBTEST_4(( inplace >, MatrixXd>(true,false) )); CALL_SUBTEST_4(( inplace >, Matrix4d>(true,false) )); CALL_SUBTEST_5(( inplace >, MatrixXd>(false,false) )); CALL_SUBTEST_5(( inplace >, Matrix43d>(false,false) )); CALL_SUBTEST_6(( inplace >, MatrixXd>(false,false) )); CALL_SUBTEST_6(( inplace >, Matrix43d>(false,false) )); CALL_SUBTEST_7(( inplace >, MatrixXd>(false,false) )); CALL_SUBTEST_7(( inplace >, Matrix43d>(false,false) )); CALL_SUBTEST_8(( inplace >, MatrixXd>(false,false) )); CALL_SUBTEST_8(( inplace >, Matrix43d>(false,false) )); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/integer_types.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2010 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #define EIGEN_NO_STATIC_ASSERT #include "main.h" #undef VERIFY_IS_APPROX #define VERIFY_IS_APPROX(a, b) VERIFY((a)==(b)); #undef VERIFY_IS_NOT_APPROX #define VERIFY_IS_NOT_APPROX(a, b) VERIFY((a)!=(b)); template void signed_integer_type_tests(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; enum { is_signed = (Scalar(-1) > Scalar(0)) ? 0 : 1 }; VERIFY(is_signed == 1); Index rows = m.rows(); Index cols = m.cols(); MatrixType m1(rows, cols), m2 = MatrixType::Random(rows, cols), mzero = MatrixType::Zero(rows, cols); do { m1 = MatrixType::Random(rows, cols); } while(m1 == mzero || m1 == m2); // check linear structure Scalar s1; do { s1 = internal::random(); } while(s1 == 0); VERIFY_IS_EQUAL(-(-m1), m1); VERIFY_IS_EQUAL(-m2+m1+m2, m1); VERIFY_IS_EQUAL((-m1+m2)*s1, -s1*m1+s1*m2); } template void integer_type_tests(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; VERIFY(NumTraits::IsInteger); enum { is_signed = (Scalar(-1) > Scalar(0)) ? 0 : 1 }; VERIFY(int(NumTraits::IsSigned) == is_signed); typedef Matrix VectorType; Index rows = m.rows(); Index cols = m.cols(); // this test relies a lot on Random.h, and there's not much more that we can do // to test it, hence I consider that we will have tested Random.h MatrixType m1(rows, cols), m2 = MatrixType::Random(rows, cols), m3(rows, cols), mzero = MatrixType::Zero(rows, cols); typedef Matrix SquareMatrixType; SquareMatrixType identity = SquareMatrixType::Identity(rows, rows), square = SquareMatrixType::Random(rows, rows); VectorType v1(rows), v2 = VectorType::Random(rows), vzero = VectorType::Zero(rows); do { m1 = MatrixType::Random(rows, cols); } while(m1 == mzero || m1 == m2); do { v1 = VectorType::Random(rows); } while(v1 == vzero || v1 == v2); VERIFY_IS_APPROX( v1, v1); VERIFY_IS_NOT_APPROX( v1, 2*v1); VERIFY_IS_APPROX( vzero, v1-v1); VERIFY_IS_APPROX( m1, m1); VERIFY_IS_NOT_APPROX( m1, 2*m1); VERIFY_IS_APPROX( mzero, m1-m1); VERIFY_IS_APPROX(m3 = m1,m1); MatrixType m4; VERIFY_IS_APPROX(m4 = m1,m1); m3.real() = m1.real(); VERIFY_IS_APPROX(static_cast(m3).real(), static_cast(m1).real()); VERIFY_IS_APPROX(static_cast(m3).real(), m1.real()); // check == / != operators VERIFY(m1==m1); VERIFY(m1!=m2); VERIFY(!(m1==m2)); VERIFY(!(m1!=m1)); m1 = m2; VERIFY(m1==m2); VERIFY(!(m1!=m2)); // check linear structure Scalar s1; do { s1 = internal::random(); } while(s1 == 0); VERIFY_IS_EQUAL(m1+m1, 2*m1); VERIFY_IS_EQUAL(m1+m2-m1, m2); VERIFY_IS_EQUAL(m1*s1, s1*m1); VERIFY_IS_EQUAL((m1+m2)*s1, s1*m1+s1*m2); m3 = m2; m3 += m1; VERIFY_IS_EQUAL(m3, m1+m2); m3 = m2; m3 -= m1; VERIFY_IS_EQUAL(m3, m2-m1); m3 = m2; m3 *= s1; VERIFY_IS_EQUAL(m3, s1*m2); // check matrix product. VERIFY_IS_APPROX(identity * m1, m1); VERIFY_IS_APPROX(square * (m1 + m2), square * m1 + square * m2); VERIFY_IS_APPROX((m1 + m2).transpose() * square, m1.transpose() * square + m2.transpose() * square); VERIFY_IS_APPROX((m1 * m2.transpose()) * m1, m1 * (m2.transpose() * m1)); } template void integer_types_extra() { VERIFY_IS_EQUAL(int(internal::scalar_div_cost::value), 8); VERIFY_IS_EQUAL(int(internal::scalar_div_cost::value), 8); if(sizeof(long)>sizeof(int)) { VERIFY(int(internal::scalar_div_cost::value) > int(internal::scalar_div_cost::value)); VERIFY(int(internal::scalar_div_cost::value) > int(internal::scalar_div_cost::value)); } } EIGEN_DECLARE_TEST(integer_types) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( integer_type_tests(Matrix()) ); CALL_SUBTEST_1( integer_type_tests(Matrix()) ); CALL_SUBTEST_2( integer_type_tests(Matrix()) ); CALL_SUBTEST_2( signed_integer_type_tests(Matrix()) ); CALL_SUBTEST_3( integer_type_tests(Matrix(2, 10)) ); CALL_SUBTEST_3( signed_integer_type_tests(Matrix(2, 10)) ); CALL_SUBTEST_4( integer_type_tests(Matrix()) ); CALL_SUBTEST_4( integer_type_tests(Matrix(20, 20)) ); CALL_SUBTEST_5( integer_type_tests(Matrix(7, 4)) ); CALL_SUBTEST_5( signed_integer_type_tests(Matrix(7, 4)) ); CALL_SUBTEST_6( integer_type_tests(Matrix()) ); #if EIGEN_HAS_CXX11 CALL_SUBTEST_7( integer_type_tests(Matrix()) ); CALL_SUBTEST_7( signed_integer_type_tests(Matrix()) ); CALL_SUBTEST_8( integer_type_tests(Matrix(1, 5)) ); #endif } CALL_SUBTEST_9( integer_types_extra<0>() ); } ================================================ FILE: VO_Module/thirdparty/eigen/test/inverse.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // Copyright (C) 2008 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include template void inverse_for_fixed_size(const MatrixType&, typename internal::enable_if::type* = 0) { } template void inverse_for_fixed_size(const MatrixType& m1, typename internal::enable_if::type* = 0) { using std::abs; MatrixType m2, identity = MatrixType::Identity(); typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef Matrix VectorType; //computeInverseAndDetWithCheck tests //First: an invertible matrix bool invertible; Scalar det; m2.setZero(); m1.computeInverseAndDetWithCheck(m2, det, invertible); VERIFY(invertible); VERIFY_IS_APPROX(identity, m1*m2); VERIFY_IS_APPROX(det, m1.determinant()); m2.setZero(); m1.computeInverseWithCheck(m2, invertible); VERIFY(invertible); VERIFY_IS_APPROX(identity, m1*m2); //Second: a rank one matrix (not invertible, except for 1x1 matrices) VectorType v3 = VectorType::Random(); MatrixType m3 = v3*v3.transpose(), m4; m3.computeInverseAndDetWithCheck(m4, det, invertible); VERIFY( m1.rows()==1 ? invertible : !invertible ); VERIFY_IS_MUCH_SMALLER_THAN(abs(det-m3.determinant()), RealScalar(1)); m3.computeInverseWithCheck(m4, invertible); VERIFY( m1.rows()==1 ? invertible : !invertible ); // check with submatrices { Matrix m5; m5.setRandom(); m5.topLeftCorner(m1.rows(),m1.rows()) = m1; m2 = m5.template topLeftCorner().inverse(); VERIFY_IS_APPROX( (m5.template topLeftCorner()), m2.inverse() ); } } template void inverse(const MatrixType& m) { /* this test covers the following files: Inverse.h */ Index rows = m.rows(); Index cols = m.cols(); typedef typename MatrixType::Scalar Scalar; MatrixType m1(rows, cols), m2(rows, cols), identity = MatrixType::Identity(rows, rows); createRandomPIMatrixOfRank(rows,rows,rows,m1); m2 = m1.inverse(); VERIFY_IS_APPROX(m1, m2.inverse() ); VERIFY_IS_APPROX((Scalar(2)*m2).inverse(), m2.inverse()*Scalar(0.5)); VERIFY_IS_APPROX(identity, m1.inverse() * m1 ); VERIFY_IS_APPROX(identity, m1 * m1.inverse() ); VERIFY_IS_APPROX(m1, m1.inverse().inverse() ); // since for the general case we implement separately row-major and col-major, test that VERIFY_IS_APPROX(MatrixType(m1.transpose().inverse()), MatrixType(m1.inverse().transpose())); inverse_for_fixed_size(m1); // check in-place inversion if(MatrixType::RowsAtCompileTime>=2 && MatrixType::RowsAtCompileTime<=4) { // in-place is forbidden VERIFY_RAISES_ASSERT(m1 = m1.inverse()); } else { m2 = m1.inverse(); m1 = m1.inverse(); VERIFY_IS_APPROX(m1,m2); } } template void inverse_zerosized() { Matrix A(0,0); { Matrix b, x; x = A.inverse() * b; } { Matrix b(0,1), x; x = A.inverse() * b; VERIFY_IS_EQUAL(x.rows(), 0); VERIFY_IS_EQUAL(x.cols(), 1); } } EIGEN_DECLARE_TEST(inverse) { int s = 0; for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( inverse(Matrix()) ); CALL_SUBTEST_2( inverse(Matrix2d()) ); CALL_SUBTEST_3( inverse(Matrix3f()) ); CALL_SUBTEST_4( inverse(Matrix4f()) ); CALL_SUBTEST_4( inverse(Matrix()) ); s = internal::random(50,320); CALL_SUBTEST_5( inverse(MatrixXf(s,s)) ); TEST_SET_BUT_UNUSED_VARIABLE(s) CALL_SUBTEST_5( inverse_zerosized() ); CALL_SUBTEST_5( inverse(MatrixXf(0, 0)) ); CALL_SUBTEST_5( inverse(MatrixXf(1, 1)) ); s = internal::random(25,100); CALL_SUBTEST_6( inverse(MatrixXcd(s,s)) ); TEST_SET_BUT_UNUSED_VARIABLE(s) CALL_SUBTEST_7( inverse(Matrix4d()) ); CALL_SUBTEST_7( inverse(Matrix()) ); CALL_SUBTEST_8( inverse(Matrix4cd()) ); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/io.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2019 Joel Holdsworth // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include #include "main.h" template struct check_ostream_impl { static void run() { const Array array(123); std::ostringstream ss; ss << array; VERIFY(ss.str() == "123"); check_ostream_impl< std::complex >::run(); }; }; template<> struct check_ostream_impl { static void run() { const Array array(1, 0); std::ostringstream ss; ss << array; VERIFY(ss.str() == "1 0"); }; }; template struct check_ostream_impl< std::complex > { static void run() { const Array,1,1> array(std::complex(12, 34)); std::ostringstream ss; ss << array; VERIFY(ss.str() == "(12,34)"); }; }; template static void check_ostream() { check_ostream_impl::run(); } EIGEN_DECLARE_TEST(rand) { CALL_SUBTEST(check_ostream()); CALL_SUBTEST(check_ostream()); CALL_SUBTEST(check_ostream()); CALL_SUBTEST(check_ostream()); CALL_SUBTEST(check_ostream()); CALL_SUBTEST(check_ostream()); CALL_SUBTEST(check_ostream()); CALL_SUBTEST(check_ostream()); CALL_SUBTEST(check_ostream()); CALL_SUBTEST(check_ostream()); CALL_SUBTEST(check_ostream()); } ================================================ FILE: VO_Module/thirdparty/eigen/test/is_same_dense.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2015 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" using internal::is_same_dense; EIGEN_DECLARE_TEST(is_same_dense) { typedef Matrix ColMatrixXd; typedef Matrix,Dynamic,Dynamic,ColMajor> ColMatrixXcd; ColMatrixXd m1(10,10); ColMatrixXcd m2(10,10); Ref ref_m1(m1); Ref > ref_m2_real(m2.real()); Ref const_ref_m1(m1); VERIFY(is_same_dense(m1,m1)); VERIFY(is_same_dense(m1,ref_m1)); VERIFY(is_same_dense(const_ref_m1,m1)); VERIFY(is_same_dense(const_ref_m1,ref_m1)); VERIFY(is_same_dense(m1.block(0,0,m1.rows(),m1.cols()),m1)); VERIFY(!is_same_dense(m1.row(0),m1.col(0))); Ref const_ref_m1_row(m1.row(1)); VERIFY(!is_same_dense(m1.row(1),const_ref_m1_row)); Ref const_ref_m1_col(m1.col(1)); VERIFY(is_same_dense(m1.col(1),const_ref_m1_col)); VERIFY(!is_same_dense(m1, ref_m2_real)); VERIFY(!is_same_dense(m2, ref_m2_real)); } ================================================ FILE: VO_Module/thirdparty/eigen/test/jacobi.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // Copyright (C) 2009 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include template void jacobi(const MatrixType& m = MatrixType()) { Index rows = m.rows(); Index cols = m.cols(); enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime }; typedef Matrix JacobiVector; const MatrixType a(MatrixType::Random(rows, cols)); JacobiVector v = JacobiVector::Random().normalized(); JacobiScalar c = v.x(), s = v.y(); JacobiRotation rot(c, s); { Index p = internal::random(0, rows-1); Index q; do { q = internal::random(0, rows-1); } while (q == p); MatrixType b = a; b.applyOnTheLeft(p, q, rot); VERIFY_IS_APPROX(b.row(p), c * a.row(p) + numext::conj(s) * a.row(q)); VERIFY_IS_APPROX(b.row(q), -s * a.row(p) + numext::conj(c) * a.row(q)); } { Index p = internal::random(0, cols-1); Index q; do { q = internal::random(0, cols-1); } while (q == p); MatrixType b = a; b.applyOnTheRight(p, q, rot); VERIFY_IS_APPROX(b.col(p), c * a.col(p) - s * a.col(q)); VERIFY_IS_APPROX(b.col(q), numext::conj(s) * a.col(p) + numext::conj(c) * a.col(q)); } } EIGEN_DECLARE_TEST(jacobi) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1(( jacobi() )); CALL_SUBTEST_2(( jacobi() )); CALL_SUBTEST_3(( jacobi() )); CALL_SUBTEST_3(( jacobi >() )); int r = internal::random(2, internal::random(1,EIGEN_TEST_MAX_SIZE)/2), c = internal::random(2, internal::random(1,EIGEN_TEST_MAX_SIZE)/2); CALL_SUBTEST_4(( jacobi(MatrixXf(r,c)) )); CALL_SUBTEST_5(( jacobi(MatrixXcd(r,c)) )); CALL_SUBTEST_5(( jacobi >(MatrixXcd(r,c)) )); // complex is really important to test as it is the only way to cover conjugation issues in certain unaligned paths CALL_SUBTEST_6(( jacobi(MatrixXcf(r,c)) )); CALL_SUBTEST_6(( jacobi >(MatrixXcf(r,c)) )); TEST_SET_BUT_UNUSED_VARIABLE(r); TEST_SET_BUT_UNUSED_VARIABLE(c); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/jacobisvd.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2014 Gael Guennebaud // Copyright (C) 2009 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. // discard stack allocation as that too bypasses malloc #define EIGEN_STACK_ALLOCATION_LIMIT 0 #define EIGEN_RUNTIME_NO_MALLOC #include "main.h" #include #define SVD_DEFAULT(M) JacobiSVD #define SVD_FOR_MIN_NORM(M) JacobiSVD #include "svd_common.h" // Check all variants of JacobiSVD template void jacobisvd(const MatrixType& a = MatrixType(), bool pickrandom = true) { MatrixType m = a; if(pickrandom) svd_fill_random(m); CALL_SUBTEST(( svd_test_all_computation_options >(m, true) )); // check full only CALL_SUBTEST(( svd_test_all_computation_options >(m, false) )); CALL_SUBTEST(( svd_test_all_computation_options >(m, false) )); if(m.rows()==m.cols()) CALL_SUBTEST(( svd_test_all_computation_options >(m, false) )); } template void jacobisvd_verify_assert(const MatrixType& m) { svd_verify_assert >(m); svd_verify_assert >(m, true); svd_verify_assert >(m); svd_verify_assert >(m); Index rows = m.rows(); Index cols = m.cols(); enum { ColsAtCompileTime = MatrixType::ColsAtCompileTime }; MatrixType a = MatrixType::Zero(rows, cols); a.setZero(); if (ColsAtCompileTime == Dynamic) { JacobiSVD svd_fullqr; VERIFY_RAISES_ASSERT(svd_fullqr.compute(a, ComputeFullU|ComputeThinV)) VERIFY_RAISES_ASSERT(svd_fullqr.compute(a, ComputeThinU|ComputeThinV)) VERIFY_RAISES_ASSERT(svd_fullqr.compute(a, ComputeThinU|ComputeFullV)) } } template void jacobisvd_method() { enum { Size = MatrixType::RowsAtCompileTime }; typedef typename MatrixType::RealScalar RealScalar; typedef Matrix RealVecType; MatrixType m = MatrixType::Identity(); VERIFY_IS_APPROX(m.jacobiSvd().singularValues(), RealVecType::Ones()); VERIFY_RAISES_ASSERT(m.jacobiSvd().matrixU()); VERIFY_RAISES_ASSERT(m.jacobiSvd().matrixV()); VERIFY_IS_APPROX(m.jacobiSvd(ComputeFullU|ComputeFullV).solve(m), m); VERIFY_IS_APPROX(m.jacobiSvd(ComputeFullU|ComputeFullV).transpose().solve(m), m); VERIFY_IS_APPROX(m.jacobiSvd(ComputeFullU|ComputeFullV).adjoint().solve(m), m); } namespace Foo { // older compiler require a default constructor for Bar // cf: https://stackoverflow.com/questions/7411515/ class Bar {public: Bar() {}}; bool operator<(const Bar&, const Bar&) { return true; } } // regression test for a very strange MSVC issue for which simply // including SVDBase.h messes up with std::max and custom scalar type void msvc_workaround() { const Foo::Bar a; const Foo::Bar b; std::max EIGEN_NOT_A_MACRO (a,b); } EIGEN_DECLARE_TEST(jacobisvd) { CALL_SUBTEST_3(( jacobisvd_verify_assert(Matrix3f()) )); CALL_SUBTEST_4(( jacobisvd_verify_assert(Matrix4d()) )); CALL_SUBTEST_7(( jacobisvd_verify_assert(MatrixXf(10,12)) )); CALL_SUBTEST_8(( jacobisvd_verify_assert(MatrixXcd(7,5)) )); CALL_SUBTEST_11(svd_all_trivial_2x2(jacobisvd)); CALL_SUBTEST_12(svd_all_trivial_2x2(jacobisvd)); for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_3(( jacobisvd() )); CALL_SUBTEST_4(( jacobisvd() )); CALL_SUBTEST_5(( jacobisvd >() )); CALL_SUBTEST_6(( jacobisvd >(Matrix(10,2)) )); int r = internal::random(1, 30), c = internal::random(1, 30); TEST_SET_BUT_UNUSED_VARIABLE(r) TEST_SET_BUT_UNUSED_VARIABLE(c) CALL_SUBTEST_10(( jacobisvd(MatrixXd(r,c)) )); CALL_SUBTEST_7(( jacobisvd(MatrixXf(r,c)) )); CALL_SUBTEST_8(( jacobisvd(MatrixXcd(r,c)) )); (void) r; (void) c; // Test on inf/nan matrix CALL_SUBTEST_7( (svd_inf_nan, MatrixXf>()) ); CALL_SUBTEST_10( (svd_inf_nan, MatrixXd>()) ); // bug1395 test compile-time vectors as input CALL_SUBTEST_13(( jacobisvd_verify_assert(Matrix()) )); CALL_SUBTEST_13(( jacobisvd_verify_assert(Matrix()) )); CALL_SUBTEST_13(( jacobisvd_verify_assert(Matrix(r)) )); CALL_SUBTEST_13(( jacobisvd_verify_assert(Matrix(c)) )); } CALL_SUBTEST_7(( jacobisvd(MatrixXf(internal::random(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/2), internal::random(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/2))) )); CALL_SUBTEST_8(( jacobisvd(MatrixXcd(internal::random(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/3), internal::random(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/3))) )); // test matrixbase method CALL_SUBTEST_1(( jacobisvd_method() )); CALL_SUBTEST_3(( jacobisvd_method() )); // Test problem size constructors CALL_SUBTEST_7( JacobiSVD(10,10) ); // Check that preallocation avoids subsequent mallocs CALL_SUBTEST_9( svd_preallocate() ); CALL_SUBTEST_2( svd_underoverflow() ); msvc_workaround(); } ================================================ FILE: VO_Module/thirdparty/eigen/test/klu_support.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2011 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #define EIGEN_NO_DEBUG_SMALL_PRODUCT_BLOCKS #include "sparse_solver.h" #include template void test_klu_support_T() { KLU > klu_colmajor; KLU > klu_rowmajor; check_sparse_square_solving(klu_colmajor); check_sparse_square_solving(klu_rowmajor); //check_sparse_square_determinant(umfpack_colmajor); //check_sparse_square_determinant(umfpack_rowmajor); } EIGEN_DECLARE_TEST(klu_support) { CALL_SUBTEST_1(test_klu_support_T()); CALL_SUBTEST_2(test_klu_support_T >()); } ================================================ FILE: VO_Module/thirdparty/eigen/test/linearstructure.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2006-2008 Benoit Jacob // Copyright (C) 2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. static bool g_called; #define EIGEN_SCALAR_BINARY_OP_PLUGIN { g_called |= (!internal::is_same::value); } #include "main.h" template void linearStructure(const MatrixType& m) { using std::abs; /* this test covers the following files: CwiseUnaryOp.h, CwiseBinaryOp.h, SelfCwiseBinaryOp.h */ typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; Index rows = m.rows(); Index cols = m.cols(); // this test relies a lot on Random.h, and there's not much more that we can do // to test it, hence I consider that we will have tested Random.h MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols), m3(rows, cols); Scalar s1 = internal::random(); while (abs(s1)(); Index r = internal::random(0, rows-1), c = internal::random(0, cols-1); VERIFY_IS_APPROX(-(-m1), m1); VERIFY_IS_APPROX(m1+m1, 2*m1); VERIFY_IS_APPROX(m1+m2-m1, m2); VERIFY_IS_APPROX(-m2+m1+m2, m1); VERIFY_IS_APPROX(m1*s1, s1*m1); VERIFY_IS_APPROX((m1+m2)*s1, s1*m1+s1*m2); VERIFY_IS_APPROX((-m1+m2)*s1, -s1*m1+s1*m2); m3 = m2; m3 += m1; VERIFY_IS_APPROX(m3, m1+m2); m3 = m2; m3 -= m1; VERIFY_IS_APPROX(m3, m2-m1); m3 = m2; m3 *= s1; VERIFY_IS_APPROX(m3, s1*m2); if(!NumTraits::IsInteger) { m3 = m2; m3 /= s1; VERIFY_IS_APPROX(m3, m2/s1); } // again, test operator() to check const-qualification VERIFY_IS_APPROX((-m1)(r,c), -(m1(r,c))); VERIFY_IS_APPROX((m1-m2)(r,c), (m1(r,c))-(m2(r,c))); VERIFY_IS_APPROX((m1+m2)(r,c), (m1(r,c))+(m2(r,c))); VERIFY_IS_APPROX((s1*m1)(r,c), s1*(m1(r,c))); VERIFY_IS_APPROX((m1*s1)(r,c), (m1(r,c))*s1); if(!NumTraits::IsInteger) VERIFY_IS_APPROX((m1/s1)(r,c), (m1(r,c))/s1); // use .block to disable vectorization and compare to the vectorized version VERIFY_IS_APPROX(m1+m1.block(0,0,rows,cols), m1+m1); VERIFY_IS_APPROX(m1.cwiseProduct(m1.block(0,0,rows,cols)), m1.cwiseProduct(m1)); VERIFY_IS_APPROX(m1 - m1.block(0,0,rows,cols), m1 - m1); VERIFY_IS_APPROX(m1.block(0,0,rows,cols) * s1, m1 * s1); } // Make sure that complex * real and real * complex are properly optimized template void real_complex(DenseIndex rows = MatrixType::RowsAtCompileTime, DenseIndex cols = MatrixType::ColsAtCompileTime) { typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; RealScalar s = internal::random(); MatrixType m1 = MatrixType::Random(rows, cols); g_called = false; VERIFY_IS_APPROX(s*m1, Scalar(s)*m1); VERIFY(g_called && "real * matrix not properly optimized"); g_called = false; VERIFY_IS_APPROX(m1*s, m1*Scalar(s)); VERIFY(g_called && "matrix * real not properly optimized"); g_called = false; VERIFY_IS_APPROX(m1/s, m1/Scalar(s)); VERIFY(g_called && "matrix / real not properly optimized"); g_called = false; VERIFY_IS_APPROX(s+m1.array(), Scalar(s)+m1.array()); VERIFY(g_called && "real + matrix not properly optimized"); g_called = false; VERIFY_IS_APPROX(m1.array()+s, m1.array()+Scalar(s)); VERIFY(g_called && "matrix + real not properly optimized"); g_called = false; VERIFY_IS_APPROX(s-m1.array(), Scalar(s)-m1.array()); VERIFY(g_called && "real - matrix not properly optimized"); g_called = false; VERIFY_IS_APPROX(m1.array()-s, m1.array()-Scalar(s)); VERIFY(g_called && "matrix - real not properly optimized"); } template void linearstructure_overflow() { // make sure that /=scalar and /scalar do not overflow // rational: 1.0/4.94e-320 overflow, but m/4.94e-320 should not Matrix4d m2, m3; m3 = m2 = Matrix4d::Random()*1e-20; m2 = m2 / 4.9e-320; VERIFY_IS_APPROX(m2.cwiseQuotient(m2), Matrix4d::Ones()); m3 /= 4.9e-320; VERIFY_IS_APPROX(m3.cwiseQuotient(m3), Matrix4d::Ones()); } EIGEN_DECLARE_TEST(linearstructure) { g_called = true; VERIFY(g_called); // avoid `unneeded-internal-declaration` warning. for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( linearStructure(Matrix()) ); CALL_SUBTEST_2( linearStructure(Matrix2f()) ); CALL_SUBTEST_3( linearStructure(Vector3d()) ); CALL_SUBTEST_4( linearStructure(Matrix4d()) ); CALL_SUBTEST_5( linearStructure(MatrixXcf(internal::random(1,EIGEN_TEST_MAX_SIZE/2), internal::random(1,EIGEN_TEST_MAX_SIZE/2))) ); CALL_SUBTEST_6( linearStructure(MatrixXf (internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_7( linearStructure(MatrixXi (internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_8( linearStructure(MatrixXcd(internal::random(1,EIGEN_TEST_MAX_SIZE/2), internal::random(1,EIGEN_TEST_MAX_SIZE/2))) ); CALL_SUBTEST_9( linearStructure(ArrayXXf (internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_10( linearStructure(ArrayXXcf (internal::random(1,EIGEN_TEST_MAX_SIZE), internal::random(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_11( real_complex() ); CALL_SUBTEST_11( real_complex(10,10) ); CALL_SUBTEST_11( real_complex(10,10) ); } CALL_SUBTEST_4( linearstructure_overflow<0>() ); } ================================================ FILE: VO_Module/thirdparty/eigen/test/lscg.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2011 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "sparse_solver.h" #include template void test_lscg_T() { LeastSquaresConjugateGradient > lscg_colmajor_diag; LeastSquaresConjugateGradient, IdentityPreconditioner> lscg_colmajor_I; LeastSquaresConjugateGradient > lscg_rowmajor_diag; LeastSquaresConjugateGradient, IdentityPreconditioner> lscg_rowmajor_I; CALL_SUBTEST( check_sparse_square_solving(lscg_colmajor_diag) ); CALL_SUBTEST( check_sparse_square_solving(lscg_colmajor_I) ); CALL_SUBTEST( check_sparse_leastsquare_solving(lscg_colmajor_diag) ); CALL_SUBTEST( check_sparse_leastsquare_solving(lscg_colmajor_I) ); CALL_SUBTEST( check_sparse_square_solving(lscg_rowmajor_diag) ); CALL_SUBTEST( check_sparse_square_solving(lscg_rowmajor_I) ); CALL_SUBTEST( check_sparse_leastsquare_solving(lscg_rowmajor_diag) ); CALL_SUBTEST( check_sparse_leastsquare_solving(lscg_rowmajor_I) ); } EIGEN_DECLARE_TEST(lscg) { CALL_SUBTEST_1(test_lscg_T()); CALL_SUBTEST_2(test_lscg_T >()); } ================================================ FILE: VO_Module/thirdparty/eigen/test/lu.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2009 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include #include "solverbase.h" using namespace std; template typename MatrixType::RealScalar matrix_l1_norm(const MatrixType& m) { return m.cwiseAbs().colwise().sum().maxCoeff(); } template void lu_non_invertible() { STATIC_CHECK(( internal::is_same::StorageIndex,int>::value )); typedef typename MatrixType::RealScalar RealScalar; /* this test covers the following files: LU.h */ Index rows, cols, cols2; if(MatrixType::RowsAtCompileTime==Dynamic) { rows = internal::random(2,EIGEN_TEST_MAX_SIZE); } else { rows = MatrixType::RowsAtCompileTime; } if(MatrixType::ColsAtCompileTime==Dynamic) { cols = internal::random(2,EIGEN_TEST_MAX_SIZE); cols2 = internal::random(2,EIGEN_TEST_MAX_SIZE); } else { cols2 = cols = MatrixType::ColsAtCompileTime; } enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime }; typedef typename internal::kernel_retval_base >::ReturnType KernelMatrixType; typedef typename internal::image_retval_base >::ReturnType ImageMatrixType; typedef Matrix CMatrixType; typedef Matrix RMatrixType; Index rank = internal::random(1, (std::min)(rows, cols)-1); // The image of the zero matrix should consist of a single (zero) column vector VERIFY((MatrixType::Zero(rows,cols).fullPivLu().image(MatrixType::Zero(rows,cols)).cols() == 1)); // The kernel of the zero matrix is the entire space, and thus is an invertible matrix of dimensions cols. KernelMatrixType kernel = MatrixType::Zero(rows,cols).fullPivLu().kernel(); VERIFY((kernel.fullPivLu().isInvertible())); MatrixType m1(rows, cols), m3(rows, cols2); CMatrixType m2(cols, cols2); createRandomPIMatrixOfRank(rank, rows, cols, m1); FullPivLU lu; // The special value 0.01 below works well in tests. Keep in mind that we're only computing the rank // of singular values are either 0 or 1. // So it's not clear at all that the epsilon should play any role there. lu.setThreshold(RealScalar(0.01)); lu.compute(m1); MatrixType u(rows,cols); u = lu.matrixLU().template triangularView(); RMatrixType l = RMatrixType::Identity(rows,rows); l.block(0,0,rows,(std::min)(rows,cols)).template triangularView() = lu.matrixLU().block(0,0,rows,(std::min)(rows,cols)); VERIFY_IS_APPROX(lu.permutationP() * m1 * lu.permutationQ(), l*u); KernelMatrixType m1kernel = lu.kernel(); ImageMatrixType m1image = lu.image(m1); VERIFY_IS_APPROX(m1, lu.reconstructedMatrix()); VERIFY(rank == lu.rank()); VERIFY(cols - lu.rank() == lu.dimensionOfKernel()); VERIFY(!lu.isInjective()); VERIFY(!lu.isInvertible()); VERIFY(!lu.isSurjective()); VERIFY_IS_MUCH_SMALLER_THAN((m1 * m1kernel), m1); VERIFY(m1image.fullPivLu().rank() == rank); VERIFY_IS_APPROX(m1 * m1.adjoint() * m1image, m1image); check_solverbase(m1, lu, rows, cols, cols2); m2 = CMatrixType::Random(cols,cols2); m3 = m1*m2; m2 = CMatrixType::Random(cols,cols2); // test that the code, which does resize(), may be applied to an xpr m2.block(0,0,m2.rows(),m2.cols()) = lu.solve(m3); VERIFY_IS_APPROX(m3, m1*m2); } template void lu_invertible() { /* this test covers the following files: FullPivLU.h */ typedef typename NumTraits::Real RealScalar; Index size = MatrixType::RowsAtCompileTime; if( size==Dynamic) size = internal::random(1,EIGEN_TEST_MAX_SIZE); MatrixType m1(size, size), m2(size, size), m3(size, size); FullPivLU lu; lu.setThreshold(RealScalar(0.01)); do { m1 = MatrixType::Random(size,size); lu.compute(m1); } while(!lu.isInvertible()); VERIFY_IS_APPROX(m1, lu.reconstructedMatrix()); VERIFY(0 == lu.dimensionOfKernel()); VERIFY(lu.kernel().cols() == 1); // the kernel() should consist of a single (zero) column vector VERIFY(size == lu.rank()); VERIFY(lu.isInjective()); VERIFY(lu.isSurjective()); VERIFY(lu.isInvertible()); VERIFY(lu.image(m1).fullPivLu().isInvertible()); check_solverbase(m1, lu, size, size, size); MatrixType m1_inverse = lu.inverse(); m3 = MatrixType::Random(size,size); m2 = lu.solve(m3); VERIFY_IS_APPROX(m2, m1_inverse*m3); RealScalar rcond = (RealScalar(1) / matrix_l1_norm(m1)) / matrix_l1_norm(m1_inverse); const RealScalar rcond_est = lu.rcond(); // Verify that the estimated condition number is within a factor of 10 of the // truth. VERIFY(rcond_est > rcond / 10 && rcond_est < rcond * 10); // Regression test for Bug 302 MatrixType m4 = MatrixType::Random(size,size); VERIFY_IS_APPROX(lu.solve(m3*m4), lu.solve(m3)*m4); } template void lu_partial_piv(Index size = MatrixType::ColsAtCompileTime) { /* this test covers the following files: PartialPivLU.h */ typedef typename NumTraits::Real RealScalar; MatrixType m1(size, size), m2(size, size), m3(size, size); m1.setRandom(); PartialPivLU plu(m1); STATIC_CHECK(( internal::is_same::StorageIndex,int>::value )); VERIFY_IS_APPROX(m1, plu.reconstructedMatrix()); check_solverbase(m1, plu, size, size, size); MatrixType m1_inverse = plu.inverse(); m3 = MatrixType::Random(size,size); m2 = plu.solve(m3); VERIFY_IS_APPROX(m2, m1_inverse*m3); RealScalar rcond = (RealScalar(1) / matrix_l1_norm(m1)) / matrix_l1_norm(m1_inverse); const RealScalar rcond_est = plu.rcond(); // Verify that the estimate is within a factor of 10 of the truth. VERIFY(rcond_est > rcond / 10 && rcond_est < rcond * 10); } template void lu_verify_assert() { MatrixType tmp; FullPivLU lu; VERIFY_RAISES_ASSERT(lu.matrixLU()) VERIFY_RAISES_ASSERT(lu.permutationP()) VERIFY_RAISES_ASSERT(lu.permutationQ()) VERIFY_RAISES_ASSERT(lu.kernel()) VERIFY_RAISES_ASSERT(lu.image(tmp)) VERIFY_RAISES_ASSERT(lu.solve(tmp)) VERIFY_RAISES_ASSERT(lu.transpose().solve(tmp)) VERIFY_RAISES_ASSERT(lu.adjoint().solve(tmp)) VERIFY_RAISES_ASSERT(lu.determinant()) VERIFY_RAISES_ASSERT(lu.rank()) VERIFY_RAISES_ASSERT(lu.dimensionOfKernel()) VERIFY_RAISES_ASSERT(lu.isInjective()) VERIFY_RAISES_ASSERT(lu.isSurjective()) VERIFY_RAISES_ASSERT(lu.isInvertible()) VERIFY_RAISES_ASSERT(lu.inverse()) PartialPivLU plu; VERIFY_RAISES_ASSERT(plu.matrixLU()) VERIFY_RAISES_ASSERT(plu.permutationP()) VERIFY_RAISES_ASSERT(plu.solve(tmp)) VERIFY_RAISES_ASSERT(plu.transpose().solve(tmp)) VERIFY_RAISES_ASSERT(plu.adjoint().solve(tmp)) VERIFY_RAISES_ASSERT(plu.determinant()) VERIFY_RAISES_ASSERT(plu.inverse()) } EIGEN_DECLARE_TEST(lu) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( lu_non_invertible() ); CALL_SUBTEST_1( lu_invertible() ); CALL_SUBTEST_1( lu_verify_assert() ); CALL_SUBTEST_1( lu_partial_piv() ); CALL_SUBTEST_2( (lu_non_invertible >()) ); CALL_SUBTEST_2( (lu_verify_assert >()) ); CALL_SUBTEST_2( lu_partial_piv() ); CALL_SUBTEST_2( lu_partial_piv() ); CALL_SUBTEST_2( (lu_partial_piv >()) ); CALL_SUBTEST_3( lu_non_invertible() ); CALL_SUBTEST_3( lu_invertible() ); CALL_SUBTEST_3( lu_verify_assert() ); CALL_SUBTEST_4( lu_non_invertible() ); CALL_SUBTEST_4( lu_invertible() ); CALL_SUBTEST_4( lu_partial_piv(internal::random(1,EIGEN_TEST_MAX_SIZE)) ); CALL_SUBTEST_4( lu_verify_assert() ); CALL_SUBTEST_5( lu_non_invertible() ); CALL_SUBTEST_5( lu_invertible() ); CALL_SUBTEST_5( lu_verify_assert() ); CALL_SUBTEST_6( lu_non_invertible() ); CALL_SUBTEST_6( lu_invertible() ); CALL_SUBTEST_6( lu_partial_piv(internal::random(1,EIGEN_TEST_MAX_SIZE)) ); CALL_SUBTEST_6( lu_verify_assert() ); CALL_SUBTEST_7(( lu_non_invertible >() )); // Test problem size constructors CALL_SUBTEST_9( PartialPivLU(10) ); CALL_SUBTEST_9( FullPivLU(10, 20); ); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/main.h ================================================ // 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 // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include #include #include #include #include #include #include #include #include #include // The following includes of STL headers have to be done _before_ the // definition of macros min() and max(). The reason is that many STL // implementations will not work properly as the min and max symbols collide // with the STL functions std:min() and std::max(). The STL headers may check // for the macro definition of min/max and issue a warning or undefine the // macros. // // Still, Windows defines min() and max() in windef.h as part of the regular // Windows system interfaces and many other Windows APIs depend on these // macros being available. To prevent the macro expansion of min/max and to // make Eigen compatible with the Windows environment all function calls of // std::min() and std::max() have to be written with parenthesis around the // function name. // // All STL headers used by Eigen should be included here. Because main.h is // included before any Eigen header and because the STL headers are guarded // against multiple inclusions, no STL header will see our own min/max macro // definitions. #include #include // Disable ICC's std::complex operator specializations so we can use our own. #define _OVERRIDE_COMPLEX_SPECIALIZATION_ 1 #include #include #include #include #include #if __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) #include #include #ifdef EIGEN_USE_THREADS #include #endif #endif // Same for cuda_fp16.h #if defined(__CUDACC__) && !defined(EIGEN_NO_CUDA) // Means the compiler is either nvcc or clang with CUDA enabled #define EIGEN_CUDACC __CUDACC__ #endif #if defined(EIGEN_CUDACC) #include #define EIGEN_CUDA_SDK_VER (CUDA_VERSION * 10) #else #define EIGEN_CUDA_SDK_VER 0 #endif #if EIGEN_CUDA_SDK_VER >= 70500 #include #endif // To test that all calls from Eigen code to std::min() and std::max() are // protected by parenthesis against macro expansion, the min()/max() macros // are defined here and any not-parenthesized min/max call will cause a // compiler error. #if !defined(__HIPCC__) && !defined(EIGEN_USE_SYCL) // // HIP header files include the following files // // // // which seem to contain not-parenthesized calls to "max"/"min", triggering the following check and causing the compile to fail // // Including those header files before the following macro definition for "min" / "max", only partially resolves the issue // This is because other HIP header files also define "isnan" / "isinf" / "isfinite" functions, which are needed in other // headers. // // So instead choosing to simply disable this check for HIP // #define min(A,B) please_protect_your_min_with_parentheses #define max(A,B) please_protect_your_max_with_parentheses #define isnan(X) please_protect_your_isnan_with_parentheses #define isinf(X) please_protect_your_isinf_with_parentheses #define isfinite(X) please_protect_your_isfinite_with_parentheses #endif // test possible conflicts struct real {}; struct imag {}; #ifdef M_PI #undef M_PI #endif #define M_PI please_use_EIGEN_PI_instead_of_M_PI #define FORBIDDEN_IDENTIFIER (this_identifier_is_forbidden_to_avoid_clashes) this_identifier_is_forbidden_to_avoid_clashes // B0 is defined in POSIX header termios.h #define B0 FORBIDDEN_IDENTIFIER // `I` may be defined by complex.h: #define I FORBIDDEN_IDENTIFIER // Unit tests calling Eigen's blas library must preserve the default blocking size // to avoid troubles. #ifndef EIGEN_NO_DEBUG_SMALL_PRODUCT_BLOCKS #define EIGEN_DEBUG_SMALL_PRODUCT_BLOCKS #endif // shuts down ICC's remark #593: variable "XXX" was set but never used #define TEST_SET_BUT_UNUSED_VARIABLE(X) EIGEN_UNUSED_VARIABLE(X) #ifdef TEST_ENABLE_TEMPORARY_TRACKING static long int nb_temporaries; static long int nb_temporaries_on_assert = -1; inline void on_temporary_creation(long int size) { // here's a great place to set a breakpoint when debugging failures in this test! if(size!=0) nb_temporaries++; if(nb_temporaries_on_assert>0) assert(nb_temporaries if NDEBUG is not defined. #ifndef DEBUG #define DEBUG #endif // bounds integer values for AltiVec #if defined(__ALTIVEC__) || defined(__VSX__) #define EIGEN_MAKING_DOCS #endif #define DEFAULT_REPEAT 10 namespace Eigen { static std::vector g_test_stack; // level == 0 <=> abort if test fail // level >= 1 <=> warning message to std::cerr if test fail static int g_test_level = 0; static int g_repeat = 1; static unsigned int g_seed = 0; static bool g_has_set_repeat = false, g_has_set_seed = false; class EigenTest { public: EigenTest() : m_func(0) {} EigenTest(const char* a_name, void (*func)(void)) : m_name(a_name), m_func(func) { get_registered_tests().push_back(this); } const std::string& name() const { return m_name; } void operator()() const { m_func(); } static const std::vector& all() { return get_registered_tests(); } protected: static std::vector& get_registered_tests() { static std::vector* ms_registered_tests = new std::vector(); return *ms_registered_tests; } std::string m_name; void (*m_func)(void); }; // Declare and register a test, e.g.: // EIGEN_DECLARE_TEST(mytest) { ... } // will create a function: // void test_mytest() { ... } // that will be automatically called. #define EIGEN_DECLARE_TEST(X) \ void EIGEN_CAT(test_,X) (); \ static EigenTest EIGEN_CAT(test_handler_,X) (EIGEN_MAKESTRING(X), & EIGEN_CAT(test_,X)); \ void EIGEN_CAT(test_,X) () } #define TRACK std::cerr << __FILE__ << " " << __LINE__ << std::endl // #define TRACK while() #define EIGEN_DEFAULT_IO_FORMAT IOFormat(4, 0, " ", "\n", "", "", "", "") #if (defined(_CPPUNWIND) || defined(__EXCEPTIONS)) && !defined(__CUDA_ARCH__) && !defined(__HIP_DEVICE_COMPILE__) && !defined(__SYCL_DEVICE_ONLY__) #define EIGEN_EXCEPTIONS #endif #ifndef EIGEN_NO_ASSERTION_CHECKING namespace Eigen { static const bool should_raise_an_assert = false; // Used to avoid to raise two exceptions at a time in which // case the exception is not properly caught. // This may happen when a second exceptions is triggered in a destructor. static bool no_more_assert = false; static bool report_on_cerr_on_assert_failure = true; struct eigen_assert_exception { eigen_assert_exception(void) {} ~eigen_assert_exception() { Eigen::no_more_assert = false; } }; struct eigen_static_assert_exception { eigen_static_assert_exception(void) {} ~eigen_static_assert_exception() { Eigen::no_more_assert = false; } }; } // If EIGEN_DEBUG_ASSERTS is defined and if no assertion is triggered while // one should have been, then the list of executed assertions is printed out. // // EIGEN_DEBUG_ASSERTS is not enabled by default as it // significantly increases the compilation time // and might even introduce side effects that would hide // some memory errors. #ifdef EIGEN_DEBUG_ASSERTS namespace Eigen { namespace internal { static bool push_assert = false; } static std::vector eigen_assert_list; } #define eigen_assert(a) \ if( (!(a)) && (!no_more_assert) ) \ { \ if(report_on_cerr_on_assert_failure) \ std::cerr << #a << " " __FILE__ << "(" << __LINE__ << ")\n"; \ Eigen::no_more_assert = true; \ EIGEN_THROW_X(Eigen::eigen_assert_exception()); \ } \ else if (Eigen::internal::push_assert) \ { \ eigen_assert_list.push_back(std::string(EIGEN_MAKESTRING(__FILE__) " (" EIGEN_MAKESTRING(__LINE__) ") : " #a) ); \ } #ifdef EIGEN_EXCEPTIONS #define VERIFY_RAISES_ASSERT(a) \ { \ Eigen::no_more_assert = false; \ Eigen::eigen_assert_list.clear(); \ Eigen::internal::push_assert = true; \ Eigen::report_on_cerr_on_assert_failure = false; \ try { \ a; \ std::cerr << "One of the following asserts should have been triggered:\n"; \ for (uint ai=0 ; ai // required for createRandomPIMatrixOfRank and generateRandomMatrixSvs inline void verify_impl(bool condition, const char *testname, const char *file, int line, const char *condition_as_string) { if (!condition) { if(Eigen::g_test_level>0) std::cerr << "WARNING: "; std::cerr << "Test " << testname << " failed in " << file << " (" << line << ")" << std::endl << " " << condition_as_string << std::endl; std::cerr << "Stack:\n"; const int test_stack_size = static_cast(Eigen::g_test_stack.size()); for(int i=test_stack_size-1; i>=0; --i) std::cerr << " - " << Eigen::g_test_stack[i] << "\n"; std::cerr << "\n"; if(Eigen::g_test_level==0) abort(); } } #define VERIFY(a) ::verify_impl(a, g_test_stack.back().c_str(), __FILE__, __LINE__, EIGEN_MAKESTRING(a)) #define VERIFY_GE(a, b) ::verify_impl(a >= b, g_test_stack.back().c_str(), __FILE__, __LINE__, EIGEN_MAKESTRING(a >= b)) #define VERIFY_LE(a, b) ::verify_impl(a <= b, g_test_stack.back().c_str(), __FILE__, __LINE__, EIGEN_MAKESTRING(a <= b)) #define VERIFY_IS_EQUAL(a, b) VERIFY(test_is_equal(a, b, true)) #define VERIFY_IS_NOT_EQUAL(a, b) VERIFY(test_is_equal(a, b, false)) #define VERIFY_IS_APPROX(a, b) VERIFY(verifyIsApprox(a, b)) #define VERIFY_IS_NOT_APPROX(a, b) VERIFY(!test_isApprox(a, b)) #define VERIFY_IS_MUCH_SMALLER_THAN(a, b) VERIFY(test_isMuchSmallerThan(a, b)) #define VERIFY_IS_NOT_MUCH_SMALLER_THAN(a, b) VERIFY(!test_isMuchSmallerThan(a, b)) #define VERIFY_IS_APPROX_OR_LESS_THAN(a, b) VERIFY(test_isApproxOrLessThan(a, b)) #define VERIFY_IS_NOT_APPROX_OR_LESS_THAN(a, b) VERIFY(!test_isApproxOrLessThan(a, b)) #define VERIFY_IS_UNITARY(a) VERIFY(test_isUnitary(a)) #define STATIC_CHECK(COND) EIGEN_STATIC_ASSERT( (COND) , EIGEN_INTERNAL_ERROR_PLEASE_FILE_A_BUG_REPORT ) #define CALL_SUBTEST(FUNC) do { \ g_test_stack.push_back(EIGEN_MAKESTRING(FUNC)); \ FUNC; \ g_test_stack.pop_back(); \ } while (0) namespace Eigen { // Forward declarations to avoid ICC warnings template bool test_is_equal(const T& actual, const U& expected, bool expect_equal=true); template void createRandomPIMatrixOfRank(Index desired_rank, Index rows, Index cols, MatrixType& m); template void randomPermutationVector(PermutationVectorType& v, Index size); template MatrixType generateRandomUnitaryMatrix(const Index dim); template void generateRandomMatrixSvs(const RealScalarVectorType &svs, const Index rows, const Index cols, MatrixType& M); template VectorType setupRandomSvs(const Index dim, const RealScalar max); template VectorType setupRangeSvs(const Index dim, const RealScalar min, const RealScalar max); } // end namespace Eigen // Forward declaration to avoid ICC warnings template std::string type_name(); namespace Eigen { template typename internal::enable_if::value,bool>::type is_same_type(const T1&, const T2&) { return true; } template inline typename NumTraits::Real test_precision() { return NumTraits::dummy_precision(); } template<> inline float test_precision() { return 1e-3f; } template<> inline double test_precision() { return 1e-6; } template<> inline long double test_precision() { return 1e-6l; } template<> inline float test_precision >() { return test_precision(); } template<> inline double test_precision >() { return test_precision(); } template<> inline long double test_precision >() { return test_precision(); } #define EIGEN_TEST_SCALAR_TEST_OVERLOAD(TYPE) \ inline bool test_isApprox(TYPE a, TYPE b) \ { return internal::isApprox(a, b, test_precision()); } \ inline bool test_isMuchSmallerThan(TYPE a, TYPE b) \ { return internal::isMuchSmallerThan(a, b, test_precision()); } \ inline bool test_isApproxOrLessThan(TYPE a, TYPE b) \ { return internal::isApproxOrLessThan(a, b, test_precision()); } EIGEN_TEST_SCALAR_TEST_OVERLOAD(short) EIGEN_TEST_SCALAR_TEST_OVERLOAD(unsigned short) EIGEN_TEST_SCALAR_TEST_OVERLOAD(int) EIGEN_TEST_SCALAR_TEST_OVERLOAD(unsigned int) EIGEN_TEST_SCALAR_TEST_OVERLOAD(long) EIGEN_TEST_SCALAR_TEST_OVERLOAD(unsigned long) #if EIGEN_HAS_CXX11 EIGEN_TEST_SCALAR_TEST_OVERLOAD(long long) EIGEN_TEST_SCALAR_TEST_OVERLOAD(unsigned long long) #endif EIGEN_TEST_SCALAR_TEST_OVERLOAD(float) EIGEN_TEST_SCALAR_TEST_OVERLOAD(double) EIGEN_TEST_SCALAR_TEST_OVERLOAD(half) EIGEN_TEST_SCALAR_TEST_OVERLOAD(bfloat16) #undef EIGEN_TEST_SCALAR_TEST_OVERLOAD #ifndef EIGEN_TEST_NO_COMPLEX inline bool test_isApprox(const std::complex& a, const std::complex& b) { return internal::isApprox(a, b, test_precision >()); } inline bool test_isMuchSmallerThan(const std::complex& a, const std::complex& b) { return internal::isMuchSmallerThan(a, b, test_precision >()); } inline bool test_isApprox(const std::complex& a, const std::complex& b) { return internal::isApprox(a, b, test_precision >()); } inline bool test_isMuchSmallerThan(const std::complex& a, const std::complex& b) { return internal::isMuchSmallerThan(a, b, test_precision >()); } #ifndef EIGEN_TEST_NO_LONGDOUBLE inline bool test_isApprox(const std::complex& a, const std::complex& b) { return internal::isApprox(a, b, test_precision >()); } inline bool test_isMuchSmallerThan(const std::complex& a, const std::complex& b) { return internal::isMuchSmallerThan(a, b, test_precision >()); } #endif #endif #ifndef EIGEN_TEST_NO_LONGDOUBLE inline bool test_isApprox(const long double& a, const long double& b) { bool ret = internal::isApprox(a, b, test_precision()); if (!ret) std::cerr << std::endl << " actual = " << a << std::endl << " expected = " << b << std::endl << std::endl; return ret; } inline bool test_isMuchSmallerThan(const long double& a, const long double& b) { return internal::isMuchSmallerThan(a, b, test_precision()); } inline bool test_isApproxOrLessThan(const long double& a, const long double& b) { return internal::isApproxOrLessThan(a, b, test_precision()); } #endif // EIGEN_TEST_NO_LONGDOUBLE // test_relative_error returns the relative difference between a and b as a real scalar as used in isApprox. template typename NumTraits::NonInteger test_relative_error(const EigenBase &a, const EigenBase &b) { using std::sqrt; typedef typename NumTraits::NonInteger RealScalar; typename internal::nested_eval::type ea(a.derived()); typename internal::nested_eval::type eb(b.derived()); return sqrt(RealScalar((ea-eb).cwiseAbs2().sum()) / RealScalar((std::min)(eb.cwiseAbs2().sum(),ea.cwiseAbs2().sum()))); } template typename T1::RealScalar test_relative_error(const T1 &a, const T2 &b, const typename T1::Coefficients* = 0) { return test_relative_error(a.coeffs(), b.coeffs()); } template typename T1::Scalar test_relative_error(const T1 &a, const T2 &b, const typename T1::MatrixType* = 0) { return test_relative_error(a.matrix(), b.matrix()); } template S test_relative_error(const Translation &a, const Translation &b) { return test_relative_error(a.vector(), b.vector()); } template S test_relative_error(const ParametrizedLine &a, const ParametrizedLine &b) { return (std::max)(test_relative_error(a.origin(), b.origin()), test_relative_error(a.origin(), b.origin())); } template S test_relative_error(const AlignedBox &a, const AlignedBox &b) { return (std::max)(test_relative_error((a.min)(), (b.min)()), test_relative_error((a.max)(), (b.max)())); } template class SparseMatrixBase; template typename T1::RealScalar test_relative_error(const MatrixBase &a, const SparseMatrixBase &b) { return test_relative_error(a,b.toDense()); } template class SparseMatrixBase; template typename T1::RealScalar test_relative_error(const SparseMatrixBase &a, const MatrixBase &b) { return test_relative_error(a.toDense(),b); } template class SparseMatrixBase; template typename T1::RealScalar test_relative_error(const SparseMatrixBase &a, const SparseMatrixBase &b) { return test_relative_error(a.toDense(),b.toDense()); } template typename NumTraits::Real>::NonInteger test_relative_error(const T1 &a, const T2 &b, typename internal::enable_if::Real>::value, T1>::type* = 0) { typedef typename NumTraits::Real>::NonInteger RealScalar; return numext::sqrt(RealScalar(numext::abs2(a-b))/(numext::mini)(RealScalar(numext::abs2(a)),RealScalar(numext::abs2(b)))); } template T test_relative_error(const Rotation2D &a, const Rotation2D &b) { return test_relative_error(a.angle(), b.angle()); } template T test_relative_error(const AngleAxis &a, const AngleAxis &b) { return (std::max)(test_relative_error(a.angle(), b.angle()), test_relative_error(a.axis(), b.axis())); } template inline bool test_isApprox(const Type1& a, const Type2& b, typename Type1::Scalar* = 0) // Enabled for Eigen's type only { return a.isApprox(b, test_precision()); } // get_test_precision is a small wrapper to test_precision allowing to return the scalar precision for either scalars or expressions template typename NumTraits::Real get_test_precision(const T&, const typename T::Scalar* = 0) { return test_precision::Real>(); } template typename NumTraits::Real get_test_precision(const T&,typename internal::enable_if::Real>::value, T>::type* = 0) { return test_precision::Real>(); } // verifyIsApprox is a wrapper to test_isApprox that outputs the relative difference magnitude if the test fails. template inline bool verifyIsApprox(const Type1& a, const Type2& b) { bool ret = test_isApprox(a,b); if(!ret) { std::cerr << "Difference too large wrt tolerance " << get_test_precision(a) << ", relative error is: " << test_relative_error(a,b) << std::endl; } return ret; } // The idea behind this function is to compare the two scalars a and b where // the scalar ref is a hint about the expected order of magnitude of a and b. // WARNING: the scalar a and b must be positive // Therefore, if for some reason a and b are very small compared to ref, // we won't issue a false negative. // This test could be: abs(a-b) <= eps * ref // However, it seems that simply comparing a+ref and b+ref is more sensitive to true error. template inline bool test_isApproxWithRef(const Scalar& a, const Scalar& b, const ScalarRef& ref) { return test_isApprox(a+ref, b+ref); } template inline bool test_isMuchSmallerThan(const MatrixBase& m1, const MatrixBase& m2) { return m1.isMuchSmallerThan(m2, test_precision::Scalar>()); } template inline bool test_isMuchSmallerThan(const MatrixBase& m, const typename NumTraits::Scalar>::Real& s) { return m.isMuchSmallerThan(s, test_precision::Scalar>()); } template inline bool test_isUnitary(const MatrixBase& m) { return m.isUnitary(test_precision::Scalar>()); } template bool test_is_equal(const T& actual, const U& expected, bool expect_equal) { if ((actual==expected) == expect_equal) return true; // false: std::cerr << "\n actual = " << actual << "\n expected " << (expect_equal ? "= " : "!=") << expected << "\n\n"; return false; } // Forward declaration to avoid ICC warning template void createRandomPIMatrixOfRank(Index desired_rank, Index rows, Index cols, MatrixType& m); /** * Creates a random partial isometry matrix of given rank. * * A partial isometry is a matrix all of whose singular values are either 0 or 1. * This is very useful to test rank-revealing algorithms. * * @tparam MatrixType type of random partial isometry matrix * @param desired_rank rank requested for the random partial isometry matrix * @param rows row dimension of requested random partial isometry matrix * @param cols column dimension of requested random partial isometry matrix * @param m random partial isometry matrix */ template void createRandomPIMatrixOfRank(Index desired_rank, Index rows, Index cols, MatrixType& m) { typedef typename internal::traits::Scalar Scalar; enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime }; typedef Matrix VectorType; typedef Matrix MatrixAType; typedef Matrix MatrixBType; if(desired_rank == 0) { m.setZero(rows,cols); return; } if(desired_rank == 1) { // here we normalize the vectors to get a partial isometry m = VectorType::Random(rows).normalized() * VectorType::Random(cols).normalized().transpose(); return; } MatrixAType a = MatrixAType::Random(rows,rows); MatrixType d = MatrixType::Identity(rows,cols); MatrixBType b = MatrixBType::Random(cols,cols); // set the diagonal such that only desired_rank non-zero entries remain const Index diag_size = (std::min)(d.rows(),d.cols()); if(diag_size != desired_rank) d.diagonal().segment(desired_rank, diag_size-desired_rank) = VectorType::Zero(diag_size-desired_rank); HouseholderQR qra(a); HouseholderQR qrb(b); m = qra.householderQ() * d * qrb.householderQ(); } // Forward declaration to avoid ICC warning template void randomPermutationVector(PermutationVectorType& v, Index size); /** * Generate random permutation vector. * * @tparam PermutationVectorType type of vector used to store permutation * @param v permutation vector * @param size length of permutation vector */ template void randomPermutationVector(PermutationVectorType& v, Index size) { typedef typename PermutationVectorType::Scalar Scalar; v.resize(size); for(Index i = 0; i < size; ++i) v(i) = Scalar(i); if(size == 1) return; for(Index n = 0; n < 3 * size; ++n) { Index i = internal::random(0, size-1); Index j; do j = internal::random(0, size-1); while(j==i); std::swap(v(i), v(j)); } } /** * Generate a random unitary matrix of prescribed dimension. * * The algorithm is using a random Householder sequence to produce * a random unitary matrix. * * @tparam MatrixType type of matrix to generate * @param dim row and column dimension of the requested square matrix * @return random unitary matrix */ template MatrixType generateRandomUnitaryMatrix(const Index dim) { typedef typename internal::traits::Scalar Scalar; typedef Matrix VectorType; MatrixType v = MatrixType::Identity(dim, dim); VectorType h = VectorType::Zero(dim); for (Index i = 0; i < dim; ++i) { v.col(i).tail(dim - i - 1) = VectorType::Random(dim - i - 1); h(i) = 2 / v.col(i).tail(dim - i).squaredNorm(); } const Eigen::HouseholderSequence HSeq(v, h); return MatrixType(HSeq); } /** * Generation of random matrix with prescribed singular values. * * We generate random matrices with given singular values by setting up * a singular value decomposition. By choosing the number of zeros as * singular values we can specify the rank of the matrix. * Moreover, we also control its spectral norm, which is the largest * singular value, as well as its condition number with respect to the * l2-norm, which is the quotient of the largest and smallest singular * value. * * Reference: For details on the method see e.g. Section 8.1 (pp. 62 f) in * * C. C. Paige, M. A. Saunders, * LSQR: An algorithm for sparse linear equations and sparse least squares. * ACM Transactions on Mathematical Software 8(1), pp. 43-71, 1982. * https://web.stanford.edu/group/SOL/software/lsqr/lsqr-toms82a.pdf * * and also the LSQR webpage https://web.stanford.edu/group/SOL/software/lsqr/. * * @tparam MatrixType matrix type to generate * @tparam RealScalarVectorType vector type with real entries used for singular values * @param svs vector of desired singular values * @param rows row dimension of requested random matrix * @param cols column dimension of requested random matrix * @param M generated matrix with prescribed singular values */ template void generateRandomMatrixSvs(const RealScalarVectorType &svs, const Index rows, const Index cols, MatrixType& M) { enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime }; typedef typename internal::traits::Scalar Scalar; typedef Matrix MatrixAType; typedef Matrix MatrixBType; const Index min_dim = (std::min)(rows, cols); const MatrixAType U = generateRandomUnitaryMatrix(rows); const MatrixBType V = generateRandomUnitaryMatrix(cols); M = U.block(0, 0, rows, min_dim) * svs.asDiagonal() * V.block(0, 0, cols, min_dim).transpose(); } /** * Setup a vector of random singular values with prescribed upper limit. * For use with generateRandomMatrixSvs(). * * Singular values are non-negative real values. By convention (to be consistent with * singular value decomposition) we sort them in decreasing order. * * This strategy produces random singular values in the range [0, max], in particular * the singular values can be zero or arbitrarily close to zero. * * @tparam VectorType vector type with real entries used for singular values * @tparam RealScalar data type used for real entry * @param dim number of singular values to generate * @param max upper bound for singular values * @return vector of singular values */ template VectorType setupRandomSvs(const Index dim, const RealScalar max) { VectorType svs = max / RealScalar(2) * (VectorType::Random(dim) + VectorType::Ones(dim)); std::sort(svs.begin(), svs.end(), std::greater()); return svs; } /** * Setup a vector of random singular values with prescribed range. * For use with generateRandomMatrixSvs(). * * Singular values are non-negative real values. By convention (to be consistent with * singular value decomposition) we sort them in decreasing order. * * For dim > 1 this strategy generates a vector with largest entry max, smallest entry * min, and remaining entries in the range [min, max]. For dim == 1 the only entry is * min. * * @tparam VectorType vector type with real entries used for singular values * @tparam RealScalar data type used for real entry * @param dim number of singular values to generate * @param min smallest singular value to use * @param max largest singular value to use * @return vector of singular values */ template VectorType setupRangeSvs(const Index dim, const RealScalar min, const RealScalar max) { VectorType svs = VectorType::Random(dim); if(dim == 0) return svs; if(dim == 1) { svs(0) = min; return svs; } std::sort(svs.begin(), svs.end(), std::greater()); // scale to range [min, max] const RealScalar c_min = svs(dim - 1), c_max = svs(0); svs = (svs - VectorType::Constant(dim, c_min)) / (c_max - c_min); return min * (VectorType::Ones(dim) - svs) + max * svs; } /** * Check if number is "not a number" (NaN). * * @tparam T input type * @param x input value * @return true, if input value is "not a number" (NaN) */ template bool isNotNaN(const T& x) { return x==x; } /** * Check if number is plus infinity. * * @tparam T input type * @param x input value * @return true, if input value is plus infinity */ template bool isPlusInf(const T& x) { return x > NumTraits::highest(); } /** * Check if number is minus infinity. * * @tparam T input type * @param x input value * @return true, if input value is minus infinity */ template bool isMinusInf(const T& x) { return x < NumTraits::lowest(); } } // end namespace Eigen template struct GetDifferentType; template<> struct GetDifferentType { typedef double type; }; template<> struct GetDifferentType { typedef float type; }; template struct GetDifferentType > { typedef std::complex::type> type; }; template std::string type_name() { return "other"; } template<> std::string type_name() { return "float"; } template<> std::string type_name() { return "double"; } template<> std::string type_name() { return "long double"; } template<> std::string type_name() { return "int"; } template<> std::string type_name >() { return "complex"; } template<> std::string type_name >() { return "complex"; } template<> std::string type_name >() { return "complex"; } template<> std::string type_name >() { return "complex"; } using namespace Eigen; /** * Set number of repetitions for unit test from input string. * * @param str input string */ inline void set_repeat_from_string(const char *str) { errno = 0; g_repeat = int(strtoul(str, 0, 10)); if(errno || g_repeat <= 0) { std::cout << "Invalid repeat value " << str << std::endl; exit(EXIT_FAILURE); } g_has_set_repeat = true; } /** * Set seed for randomized unit tests from input string. * * @param str input string */ inline void set_seed_from_string(const char *str) { errno = 0; g_seed = int(strtoul(str, 0, 10)); if(errno || g_seed == 0) { std::cout << "Invalid seed value " << str << std::endl; exit(EXIT_FAILURE); } g_has_set_seed = true; } int main(int argc, char *argv[]) { g_has_set_repeat = false; g_has_set_seed = false; bool need_help = false; for(int i = 1; i < argc; i++) { if(argv[i][0] == 'r') { if(g_has_set_repeat) { std::cout << "Argument " << argv[i] << " conflicting with a former argument" << std::endl; return 1; } set_repeat_from_string(argv[i]+1); } else if(argv[i][0] == 's') { if(g_has_set_seed) { std::cout << "Argument " << argv[i] << " conflicting with a former argument" << std::endl; return 1; } set_seed_from_string(argv[i]+1); } else { need_help = true; } } if(need_help) { std::cout << "This test application takes the following optional arguments:" << std::endl; std::cout << " rN Repeat each test N times (default: " << DEFAULT_REPEAT << ")" << std::endl; std::cout << " sN Use N as seed for random numbers (default: based on current time)" << std::endl; std::cout << std::endl; std::cout << "If defined, the environment variables EIGEN_REPEAT and EIGEN_SEED" << std::endl; std::cout << "will be used as default values for these parameters." << std::endl; return 1; } char *env_EIGEN_REPEAT = getenv("EIGEN_REPEAT"); if(!g_has_set_repeat && env_EIGEN_REPEAT) set_repeat_from_string(env_EIGEN_REPEAT); char *env_EIGEN_SEED = getenv("EIGEN_SEED"); if(!g_has_set_seed && env_EIGEN_SEED) set_seed_from_string(env_EIGEN_SEED); if(!g_has_set_seed) g_seed = (unsigned int) time(NULL); if(!g_has_set_repeat) g_repeat = DEFAULT_REPEAT; std::cout << "Initializing random number generator with seed " << g_seed << std::endl; std::stringstream ss; ss << "Seed: " << g_seed; g_test_stack.push_back(ss.str()); srand(g_seed); std::cout << "Repeating each test " << g_repeat << " times" << std::endl; VERIFY(EigenTest::all().size()>0); for(std::size_t i=0; i this warning is raised even for legal usage as: g_test_stack.push_back("foo"); where g_test_stack is a std::vector // remark #1418: external function definition with no prior declaration // -> this warning is raised for all our test functions. Declaring them static would fix the issue. // warning #279: controlling expression is constant // remark #1572: floating-point equality and inequality comparisons are unreliable #pragma warning disable 279 383 1418 1572 #endif #ifdef _MSC_VER // 4503 - decorated name length exceeded, name was truncated #pragma warning( disable : 4503) #endif ================================================ FILE: VO_Module/thirdparty/eigen/test/mapped_matrix.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2006-2010 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_NO_STATIC_ASSERT #define EIGEN_NO_STATIC_ASSERT // turn static asserts into runtime asserts in order to check them #endif #include "main.h" #define EIGEN_TESTMAP_MAX_SIZE 256 template void map_class_vector(const VectorType& m) { typedef typename VectorType::Scalar Scalar; Index size = m.size(); Scalar* array1 = internal::aligned_new(size); Scalar* array2 = internal::aligned_new(size); Scalar* array3 = new Scalar[size+1]; Scalar* array3unaligned = (internal::UIntPtr(array3)%EIGEN_MAX_ALIGN_BYTES) == 0 ? array3+1 : array3; Scalar array4[EIGEN_TESTMAP_MAX_SIZE]; Map(array1, size) = VectorType::Random(size); Map(array2, size) = Map(array1, size); Map(array3unaligned, size) = Map(array1, size); Map(array4, size) = Map(array1, size); VectorType ma1 = Map(array1, size); VectorType ma2 = Map(array2, size); VectorType ma3 = Map(array3unaligned, size); VectorType ma4 = Map(array4, size); VERIFY_IS_EQUAL(ma1, ma2); VERIFY_IS_EQUAL(ma1, ma3); VERIFY_IS_EQUAL(ma1, ma4); #ifdef EIGEN_VECTORIZE if(internal::packet_traits::Vectorizable && size>=AlignedMax) VERIFY_RAISES_ASSERT((Map(array3unaligned, size))) #endif internal::aligned_delete(array1, size); internal::aligned_delete(array2, size); delete[] array3; } template void map_class_matrix(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; Index rows = m.rows(), cols = m.cols(), size = rows*cols; Scalar s1 = internal::random(); // array1 and array2 -> aligned heap allocation Scalar* array1 = internal::aligned_new(size); for(int i = 0; i < size; i++) array1[i] = Scalar(1); Scalar* array2 = internal::aligned_new(size); for(int i = 0; i < size; i++) array2[i] = Scalar(1); // array3unaligned -> unaligned pointer to heap Scalar* array3 = new Scalar[size+1]; Index sizep1 = size + 1; // <- without this temporary MSVC 2103 generates bad code for(Index i = 0; i < sizep1; i++) array3[i] = Scalar(1); Scalar* array3unaligned = (internal::UIntPtr(array3)%EIGEN_MAX_ALIGN_BYTES) == 0 ? array3+1 : array3; Scalar array4[256]; if(size<=256) for(int i = 0; i < size; i++) array4[i] = Scalar(1); Map map1(array1, rows, cols); Map map2(array2, rows, cols); Map map3(array3unaligned, rows, cols); Map map4(array4, rows, cols); VERIFY_IS_EQUAL(map1, MatrixType::Ones(rows,cols)); VERIFY_IS_EQUAL(map2, MatrixType::Ones(rows,cols)); VERIFY_IS_EQUAL(map3, MatrixType::Ones(rows,cols)); map1 = MatrixType::Random(rows,cols); map2 = map1; map3 = map1; MatrixType ma1 = map1; MatrixType ma2 = map2; MatrixType ma3 = map3; VERIFY_IS_EQUAL(map1, map2); VERIFY_IS_EQUAL(map1, map3); VERIFY_IS_EQUAL(ma1, ma2); VERIFY_IS_EQUAL(ma1, ma3); VERIFY_IS_EQUAL(ma1, map3); VERIFY_IS_APPROX(s1*map1, s1*map2); VERIFY_IS_APPROX(s1*ma1, s1*ma2); VERIFY_IS_EQUAL(s1*ma1, s1*ma3); VERIFY_IS_APPROX(s1*map1, s1*map3); map2 *= s1; map3 *= s1; VERIFY_IS_APPROX(s1*map1, map2); VERIFY_IS_APPROX(s1*map1, map3); if(size<=256) { VERIFY_IS_EQUAL(map4, MatrixType::Ones(rows,cols)); map4 = map1; MatrixType ma4 = map4; VERIFY_IS_EQUAL(map1, map4); VERIFY_IS_EQUAL(ma1, map4); VERIFY_IS_EQUAL(ma1, ma4); VERIFY_IS_APPROX(s1*map1, s1*map4); map4 *= s1; VERIFY_IS_APPROX(s1*map1, map4); } internal::aligned_delete(array1, size); internal::aligned_delete(array2, size); delete[] array3; } template void map_static_methods(const VectorType& m) { typedef typename VectorType::Scalar Scalar; Index size = m.size(); Scalar* array1 = internal::aligned_new(size); Scalar* array2 = internal::aligned_new(size); Scalar* array3 = new Scalar[size+1]; Scalar* array3unaligned = internal::UIntPtr(array3)%EIGEN_MAX_ALIGN_BYTES == 0 ? array3+1 : array3; VectorType::MapAligned(array1, size) = VectorType::Random(size); VectorType::Map(array2, size) = VectorType::Map(array1, size); VectorType::Map(array3unaligned, size) = VectorType::Map(array1, size); VectorType ma1 = VectorType::Map(array1, size); VectorType ma2 = VectorType::MapAligned(array2, size); VectorType ma3 = VectorType::Map(array3unaligned, size); VERIFY_IS_EQUAL(ma1, ma2); VERIFY_IS_EQUAL(ma1, ma3); internal::aligned_delete(array1, size); internal::aligned_delete(array2, size); delete[] array3; } template void check_const_correctness(const PlainObjectType&) { // there's a lot that we can't test here while still having this test compile! // the only possible approach would be to run a script trying to compile stuff and checking that it fails. // CMake can help with that. // verify that map-to-const don't have LvalueBit typedef typename internal::add_const::type ConstPlainObjectType; VERIFY( !(internal::traits >::Flags & LvalueBit) ); VERIFY( !(internal::traits >::Flags & LvalueBit) ); VERIFY( !(Map::Flags & LvalueBit) ); VERIFY( !(Map::Flags & LvalueBit) ); } template void map_not_aligned_on_scalar() { typedef Matrix MatrixType; Index size = 11; Scalar* array1 = internal::aligned_new((size+1)*(size+1)+1); Scalar* array2 = reinterpret_cast(sizeof(Scalar)/2+std::size_t(array1)); Map > map2(array2, size, size, OuterStride<>(size+1)); MatrixType m2 = MatrixType::Random(size,size); map2 = m2; VERIFY_IS_EQUAL(m2, map2); typedef Matrix VectorType; Map map3(array2, size); MatrixType v3 = VectorType::Random(size); map3 = v3; VERIFY_IS_EQUAL(v3, map3); internal::aligned_delete(array1, (size+1)*(size+1)+1); } EIGEN_DECLARE_TEST(mapped_matrix) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( map_class_vector(Matrix()) ); CALL_SUBTEST_1( check_const_correctness(Matrix()) ); CALL_SUBTEST_2( map_class_vector(Vector4d()) ); CALL_SUBTEST_2( map_class_vector(VectorXd(13)) ); CALL_SUBTEST_2( check_const_correctness(Matrix4d()) ); CALL_SUBTEST_3( map_class_vector(RowVector4f()) ); CALL_SUBTEST_4( map_class_vector(VectorXcf(8)) ); CALL_SUBTEST_5( map_class_vector(VectorXi(12)) ); CALL_SUBTEST_5( check_const_correctness(VectorXi(12)) ); CALL_SUBTEST_1( map_class_matrix(Matrix()) ); CALL_SUBTEST_2( map_class_matrix(Matrix4d()) ); CALL_SUBTEST_11( map_class_matrix(Matrix()) ); CALL_SUBTEST_4( map_class_matrix(MatrixXcf(internal::random(1,10),internal::random(1,10))) ); CALL_SUBTEST_5( map_class_matrix(MatrixXi(internal::random(1,10),internal::random(1,10))) ); CALL_SUBTEST_6( map_static_methods(Matrix()) ); CALL_SUBTEST_7( map_static_methods(Vector3f()) ); CALL_SUBTEST_8( map_static_methods(RowVector3d()) ); CALL_SUBTEST_9( map_static_methods(VectorXcd(8)) ); CALL_SUBTEST_10( map_static_methods(VectorXf(12)) ); CALL_SUBTEST_11( map_not_aligned_on_scalar() ); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/mapstaticmethods.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2011 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" // GCC<=4.8 has spurious shadow warnings, because `ptr` re-appears inside template instantiations // workaround: put these in an anonymous namespace namespace { float *ptr; const float *const_ptr; } template struct mapstaticmethods_impl {}; template struct mapstaticmethods_impl { static void run(const PlainObjectType& m) { mapstaticmethods_impl::run(m); int i = internal::random(2,5), j = internal::random(2,5); PlainObjectType::Map(ptr).setZero(); PlainObjectType::MapAligned(ptr).setZero(); PlainObjectType::Map(const_ptr).sum(); PlainObjectType::MapAligned(const_ptr).sum(); PlainObjectType::Map(ptr, InnerStride<>(i)).setZero(); PlainObjectType::MapAligned(ptr, InnerStride<>(i)).setZero(); PlainObjectType::Map(const_ptr, InnerStride<>(i)).sum(); PlainObjectType::MapAligned(const_ptr, InnerStride<>(i)).sum(); PlainObjectType::Map(ptr, InnerStride<2>()).setZero(); PlainObjectType::MapAligned(ptr, InnerStride<3>()).setZero(); PlainObjectType::Map(const_ptr, InnerStride<4>()).sum(); PlainObjectType::MapAligned(const_ptr, InnerStride<5>()).sum(); PlainObjectType::Map(ptr, OuterStride<>(i)).setZero(); PlainObjectType::MapAligned(ptr, OuterStride<>(i)).setZero(); PlainObjectType::Map(const_ptr, OuterStride<>(i)).sum(); PlainObjectType::MapAligned(const_ptr, OuterStride<>(i)).sum(); PlainObjectType::Map(ptr, OuterStride<2>()).setZero(); PlainObjectType::MapAligned(ptr, OuterStride<3>()).setZero(); PlainObjectType::Map(const_ptr, OuterStride<4>()).sum(); PlainObjectType::MapAligned(const_ptr, OuterStride<5>()).sum(); PlainObjectType::Map(ptr, Stride(i,j)).setZero(); PlainObjectType::MapAligned(ptr, Stride<2,Dynamic>(2,i)).setZero(); PlainObjectType::Map(const_ptr, Stride(i,3)).sum(); PlainObjectType::MapAligned(const_ptr, Stride(i,j)).sum(); PlainObjectType::Map(ptr, Stride<2,3>()).setZero(); PlainObjectType::MapAligned(ptr, Stride<3,4>()).setZero(); PlainObjectType::Map(const_ptr, Stride<2,4>()).sum(); PlainObjectType::MapAligned(const_ptr, Stride<5,3>()).sum(); } }; template struct mapstaticmethods_impl { static void run(const PlainObjectType& m) { Index rows = m.rows(), cols = m.cols(); int i = internal::random(2,5), j = internal::random(2,5); PlainObjectType::Map(ptr, rows, cols).setZero(); PlainObjectType::MapAligned(ptr, rows, cols).setZero(); PlainObjectType::Map(const_ptr, rows, cols).sum(); PlainObjectType::MapAligned(const_ptr, rows, cols).sum(); PlainObjectType::Map(ptr, rows, cols, InnerStride<>(i)).setZero(); PlainObjectType::MapAligned(ptr, rows, cols, InnerStride<>(i)).setZero(); PlainObjectType::Map(const_ptr, rows, cols, InnerStride<>(i)).sum(); PlainObjectType::MapAligned(const_ptr, rows, cols, InnerStride<>(i)).sum(); PlainObjectType::Map(ptr, rows, cols, InnerStride<2>()).setZero(); PlainObjectType::MapAligned(ptr, rows, cols, InnerStride<3>()).setZero(); PlainObjectType::Map(const_ptr, rows, cols, InnerStride<4>()).sum(); PlainObjectType::MapAligned(const_ptr, rows, cols, InnerStride<5>()).sum(); PlainObjectType::Map(ptr, rows, cols, OuterStride<>(i)).setZero(); PlainObjectType::MapAligned(ptr, rows, cols, OuterStride<>(i)).setZero(); PlainObjectType::Map(const_ptr, rows, cols, OuterStride<>(i)).sum(); PlainObjectType::MapAligned(const_ptr, rows, cols, OuterStride<>(i)).sum(); PlainObjectType::Map(ptr, rows, cols, OuterStride<2>()).setZero(); PlainObjectType::MapAligned(ptr, rows, cols, OuterStride<3>()).setZero(); PlainObjectType::Map(const_ptr, rows, cols, OuterStride<4>()).sum(); PlainObjectType::MapAligned(const_ptr, rows, cols, OuterStride<5>()).sum(); PlainObjectType::Map(ptr, rows, cols, Stride(i,j)).setZero(); PlainObjectType::MapAligned(ptr, rows, cols, Stride<2,Dynamic>(2,i)).setZero(); PlainObjectType::Map(const_ptr, rows, cols, Stride(i,3)).sum(); PlainObjectType::MapAligned(const_ptr, rows, cols, Stride(i,j)).sum(); PlainObjectType::Map(ptr, rows, cols, Stride<2,3>()).setZero(); PlainObjectType::MapAligned(ptr, rows, cols, Stride<3,4>()).setZero(); PlainObjectType::Map(const_ptr, rows, cols, Stride<2,4>()).sum(); PlainObjectType::MapAligned(const_ptr, rows, cols, Stride<5,3>()).sum(); } }; template struct mapstaticmethods_impl { static void run(const PlainObjectType& v) { Index size = v.size(); int i = internal::random(2,5); PlainObjectType::Map(ptr, size).setZero(); PlainObjectType::MapAligned(ptr, size).setZero(); PlainObjectType::Map(const_ptr, size).sum(); PlainObjectType::MapAligned(const_ptr, size).sum(); PlainObjectType::Map(ptr, size, InnerStride<>(i)).setZero(); PlainObjectType::MapAligned(ptr, size, InnerStride<>(i)).setZero(); PlainObjectType::Map(const_ptr, size, InnerStride<>(i)).sum(); PlainObjectType::MapAligned(const_ptr, size, InnerStride<>(i)).sum(); PlainObjectType::Map(ptr, size, InnerStride<2>()).setZero(); PlainObjectType::MapAligned(ptr, size, InnerStride<3>()).setZero(); PlainObjectType::Map(const_ptr, size, InnerStride<4>()).sum(); PlainObjectType::MapAligned(const_ptr, size, InnerStride<5>()).sum(); } }; template void mapstaticmethods(const PlainObjectType& m) { mapstaticmethods_impl::run(m); VERIFY(true); // just to avoid 'unused function' warning } EIGEN_DECLARE_TEST(mapstaticmethods) { ptr = internal::aligned_new(1000); for(int i = 0; i < 1000; i++) ptr[i] = float(i); const_ptr = ptr; CALL_SUBTEST_1(( mapstaticmethods(Matrix()) )); CALL_SUBTEST_1(( mapstaticmethods(Vector2f()) )); CALL_SUBTEST_2(( mapstaticmethods(Vector3f()) )); CALL_SUBTEST_2(( mapstaticmethods(Matrix2f()) )); CALL_SUBTEST_3(( mapstaticmethods(Matrix4f()) )); CALL_SUBTEST_3(( mapstaticmethods(Array4f()) )); CALL_SUBTEST_4(( mapstaticmethods(Array3f()) )); CALL_SUBTEST_4(( mapstaticmethods(Array33f()) )); CALL_SUBTEST_5(( mapstaticmethods(Array44f()) )); CALL_SUBTEST_5(( mapstaticmethods(VectorXf(1)) )); CALL_SUBTEST_5(( mapstaticmethods(VectorXf(8)) )); CALL_SUBTEST_6(( mapstaticmethods(MatrixXf(1,1)) )); CALL_SUBTEST_6(( mapstaticmethods(MatrixXf(5,7)) )); CALL_SUBTEST_7(( mapstaticmethods(ArrayXf(1)) )); CALL_SUBTEST_7(( mapstaticmethods(ArrayXf(5)) )); CALL_SUBTEST_8(( mapstaticmethods(ArrayXXf(1,1)) )); CALL_SUBTEST_8(( mapstaticmethods(ArrayXXf(8,6)) )); internal::aligned_delete(ptr, 1000); } ================================================ FILE: VO_Module/thirdparty/eigen/test/mapstride.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2010 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" template void map_class_vector(const VectorType& m) { typedef typename VectorType::Scalar Scalar; Index size = m.size(); VectorType v = VectorType::Random(size); Index arraysize = 3*size; Scalar* a_array = internal::aligned_new(arraysize+1); Scalar* array = a_array; if(Alignment!=Aligned) array = (Scalar*)(internal::IntPtr(a_array) + (internal::packet_traits::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits::Real))); { Map > map(array, size); map = v; for(int i = 0; i < size; ++i) { VERIFY(array[3*i] == v[i]); VERIFY(map[i] == v[i]); } } { Map > map(array, size, InnerStride(2)); map = v; for(int i = 0; i < size; ++i) { VERIFY(array[2*i] == v[i]); VERIFY(map[i] == v[i]); } } internal::aligned_delete(a_array, arraysize+1); } template void map_class_matrix(const MatrixType& _m) { typedef typename MatrixType::Scalar Scalar; Index rows = _m.rows(), cols = _m.cols(); MatrixType m = MatrixType::Random(rows,cols); Scalar s1 = internal::random(); Index arraysize = 4*(rows+4)*(cols+4); Scalar* a_array1 = internal::aligned_new(arraysize+1); Scalar* array1 = a_array1; if(Alignment!=Aligned) array1 = (Scalar*)(internal::IntPtr(a_array1) + (internal::packet_traits::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits::Real))); Scalar a_array2[256]; Scalar* array2 = a_array2; if(Alignment!=Aligned) array2 = (Scalar*)(internal::IntPtr(a_array2) + (internal::packet_traits::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits::Real))); else array2 = (Scalar*)(((internal::UIntPtr(a_array2)+EIGEN_MAX_ALIGN_BYTES-1)/EIGEN_MAX_ALIGN_BYTES)*EIGEN_MAX_ALIGN_BYTES); Index maxsize2 = a_array2 - array2 + 256; // test no inner stride and some dynamic outer stride for(int k=0; k<2; ++k) { if(k==1 && (m.innerSize()+1)*m.outerSize() > maxsize2) break; Scalar* array = (k==0 ? array1 : array2); Map > map(array, rows, cols, OuterStride(m.innerSize()+1)); map = m; VERIFY(map.outerStride() == map.innerSize()+1); for(int i = 0; i < m.outerSize(); ++i) for(int j = 0; j < m.innerSize(); ++j) { VERIFY(array[map.outerStride()*i+j] == m.coeffByOuterInner(i,j)); VERIFY(map.coeffByOuterInner(i,j) == m.coeffByOuterInner(i,j)); } VERIFY_IS_APPROX(s1*map,s1*m); map *= s1; VERIFY_IS_APPROX(map,s1*m); } // test no inner stride and an outer stride of +4. This is quite important as for fixed-size matrices, // this allows to hit the special case where it's vectorizable. for(int k=0; k<2; ++k) { if(k==1 && (m.innerSize()+4)*m.outerSize() > maxsize2) break; Scalar* array = (k==0 ? array1 : array2); enum { InnerSize = MatrixType::InnerSizeAtCompileTime, OuterStrideAtCompileTime = InnerSize==Dynamic ? Dynamic : InnerSize+4 }; Map > map(array, rows, cols, OuterStride(m.innerSize()+4)); map = m; VERIFY(map.outerStride() == map.innerSize()+4); for(int i = 0; i < m.outerSize(); ++i) for(int j = 0; j < m.innerSize(); ++j) { VERIFY(array[map.outerStride()*i+j] == m.coeffByOuterInner(i,j)); VERIFY(map.coeffByOuterInner(i,j) == m.coeffByOuterInner(i,j)); } VERIFY_IS_APPROX(s1*map,s1*m); map *= s1; VERIFY_IS_APPROX(map,s1*m); } // test both inner stride and outer stride for(int k=0; k<2; ++k) { if(k==1 && (2*m.innerSize()+1)*(m.outerSize()*2) > maxsize2) break; Scalar* array = (k==0 ? array1 : array2); Map > map(array, rows, cols, Stride(2*m.innerSize()+1, 2)); map = m; VERIFY(map.outerStride() == 2*map.innerSize()+1); VERIFY(map.innerStride() == 2); for(int i = 0; i < m.outerSize(); ++i) for(int j = 0; j < m.innerSize(); ++j) { VERIFY(array[map.outerStride()*i+map.innerStride()*j] == m.coeffByOuterInner(i,j)); VERIFY(map.coeffByOuterInner(i,j) == m.coeffByOuterInner(i,j)); } VERIFY_IS_APPROX(s1*map,s1*m); map *= s1; VERIFY_IS_APPROX(map,s1*m); } // test inner stride and no outer stride for(int k=0; k<2; ++k) { if(k==1 && (m.innerSize()*2)*m.outerSize() > maxsize2) break; Scalar* array = (k==0 ? array1 : array2); Map > map(array, rows, cols, InnerStride(2)); map = m; VERIFY(map.outerStride() == map.innerSize()*2); for(int i = 0; i < m.outerSize(); ++i) for(int j = 0; j < m.innerSize(); ++j) { VERIFY(array[map.innerSize()*i*2+j*2] == m.coeffByOuterInner(i,j)); VERIFY(map.coeffByOuterInner(i,j) == m.coeffByOuterInner(i,j)); } VERIFY_IS_APPROX(s1*map,s1*m); map *= s1; VERIFY_IS_APPROX(map,s1*m); } // test negative strides { Matrix::Map(a_array1, arraysize+1).setRandom(); Index outerstride = m.innerSize()+4; Scalar* array = array1; { Map > map1(array, rows, cols, OuterStride<>( outerstride)); Map > map2(array+(m.outerSize()-1)*outerstride, rows, cols, OuterStride<>(-outerstride)); if(MatrixType::IsRowMajor) VERIFY_IS_APPROX(map1.colwise().reverse(), map2); else VERIFY_IS_APPROX(map1.rowwise().reverse(), map2); } { Map > map1(array, rows, cols, OuterStride<>( outerstride)); Map > map2(array+(m.outerSize()-1)*outerstride+m.innerSize()-1, rows, cols, Stride(-outerstride,-1)); VERIFY_IS_APPROX(map1.reverse(), map2); } { Map > map1(array, rows, cols, OuterStride<>( outerstride)); Map > map2(array+(m.outerSize()-1)*outerstride+m.innerSize()-1, rows, cols, Stride(-outerstride,-1)); VERIFY_IS_APPROX(map1.reverse(), map2); } } internal::aligned_delete(a_array1, arraysize+1); } // Additional tests for inner-stride but no outer-stride template void bug1453() { const int data[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}; typedef Matrix RowMatrixXi; typedef Matrix ColMatrix23i; typedef Matrix ColMatrix32i; typedef Matrix RowMatrix23i; typedef Matrix RowMatrix32i; VERIFY_IS_APPROX(MatrixXi::Map(data, 2, 3, InnerStride<2>()), MatrixXi::Map(data, 2, 3, Stride<4,2>())); VERIFY_IS_APPROX(MatrixXi::Map(data, 2, 3, InnerStride<>(2)), MatrixXi::Map(data, 2, 3, Stride<4,2>())); VERIFY_IS_APPROX(MatrixXi::Map(data, 3, 2, InnerStride<2>()), MatrixXi::Map(data, 3, 2, Stride<6,2>())); VERIFY_IS_APPROX(MatrixXi::Map(data, 3, 2, InnerStride<>(2)), MatrixXi::Map(data, 3, 2, Stride<6,2>())); VERIFY_IS_APPROX(RowMatrixXi::Map(data, 2, 3, InnerStride<2>()), RowMatrixXi::Map(data, 2, 3, Stride<6,2>())); VERIFY_IS_APPROX(RowMatrixXi::Map(data, 2, 3, InnerStride<>(2)), RowMatrixXi::Map(data, 2, 3, Stride<6,2>())); VERIFY_IS_APPROX(RowMatrixXi::Map(data, 3, 2, InnerStride<2>()), RowMatrixXi::Map(data, 3, 2, Stride<4,2>())); VERIFY_IS_APPROX(RowMatrixXi::Map(data, 3, 2, InnerStride<>(2)), RowMatrixXi::Map(data, 3, 2, Stride<4,2>())); VERIFY_IS_APPROX(ColMatrix23i::Map(data, InnerStride<2>()), MatrixXi::Map(data, 2, 3, Stride<4,2>())); VERIFY_IS_APPROX(ColMatrix23i::Map(data, InnerStride<>(2)), MatrixXi::Map(data, 2, 3, Stride<4,2>())); VERIFY_IS_APPROX(ColMatrix32i::Map(data, InnerStride<2>()), MatrixXi::Map(data, 3, 2, Stride<6,2>())); VERIFY_IS_APPROX(ColMatrix32i::Map(data, InnerStride<>(2)), MatrixXi::Map(data, 3, 2, Stride<6,2>())); VERIFY_IS_APPROX(RowMatrix23i::Map(data, InnerStride<2>()), RowMatrixXi::Map(data, 2, 3, Stride<6,2>())); VERIFY_IS_APPROX(RowMatrix23i::Map(data, InnerStride<>(2)), RowMatrixXi::Map(data, 2, 3, Stride<6,2>())); VERIFY_IS_APPROX(RowMatrix32i::Map(data, InnerStride<2>()), RowMatrixXi::Map(data, 3, 2, Stride<4,2>())); VERIFY_IS_APPROX(RowMatrix32i::Map(data, InnerStride<>(2)), RowMatrixXi::Map(data, 3, 2, Stride<4,2>())); } EIGEN_DECLARE_TEST(mapstride) { for(int i = 0; i < g_repeat; i++) { int maxn = 3; CALL_SUBTEST_1( map_class_vector(Matrix()) ); CALL_SUBTEST_1( map_class_vector(Matrix()) ); CALL_SUBTEST_2( map_class_vector(Vector4d()) ); CALL_SUBTEST_2( map_class_vector(Vector4d()) ); CALL_SUBTEST_3( map_class_vector(RowVector4f()) ); CALL_SUBTEST_3( map_class_vector(RowVector4f()) ); CALL_SUBTEST_4( map_class_vector(VectorXcf(internal::random(1,maxn))) ); CALL_SUBTEST_4( map_class_vector(VectorXcf(internal::random(1,maxn))) ); CALL_SUBTEST_5( map_class_vector(VectorXi(internal::random(1,maxn))) ); CALL_SUBTEST_5( map_class_vector(VectorXi(internal::random(1,maxn))) ); CALL_SUBTEST_1( map_class_matrix(Matrix()) ); CALL_SUBTEST_1( map_class_matrix(Matrix()) ); CALL_SUBTEST_2( map_class_matrix(Matrix4d()) ); CALL_SUBTEST_2( map_class_matrix(Matrix4d()) ); CALL_SUBTEST_3( map_class_matrix(Matrix()) ); CALL_SUBTEST_3( map_class_matrix(Matrix()) ); CALL_SUBTEST_3( map_class_matrix(Matrix()) ); CALL_SUBTEST_3( map_class_matrix(Matrix()) ); CALL_SUBTEST_4( map_class_matrix(MatrixXcf(internal::random(1,maxn),internal::random(1,maxn))) ); CALL_SUBTEST_4( map_class_matrix(MatrixXcf(internal::random(1,maxn),internal::random(1,maxn))) ); CALL_SUBTEST_5( map_class_matrix(MatrixXi(internal::random(1,maxn),internal::random(1,maxn))) ); CALL_SUBTEST_5( map_class_matrix(MatrixXi(internal::random(1,maxn),internal::random(1,maxn))) ); CALL_SUBTEST_6( map_class_matrix(MatrixXcd(internal::random(1,maxn),internal::random(1,maxn))) ); CALL_SUBTEST_6( map_class_matrix(MatrixXcd(internal::random(1,maxn),internal::random(1,maxn))) ); CALL_SUBTEST_5( bug1453<0>() ); TEST_SET_BUT_UNUSED_VARIABLE(maxn); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/meta.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" template bool check_is_convertible(const From&, const To&) { return internal::is_convertible::value; } struct FooReturnType { typedef int ReturnType; }; struct MyInterface { virtual void func() = 0; virtual ~MyInterface() {} }; struct MyImpl : public MyInterface { void func() {} }; EIGEN_DECLARE_TEST(meta) { VERIFY((internal::conditional<(3<4),internal::true_type, internal::false_type>::type::value)); VERIFY(( internal::is_same::value)); VERIFY((!internal::is_same::value)); VERIFY((!internal::is_same::value)); VERIFY((!internal::is_same::value)); VERIFY(( internal::is_same::type >::value)); VERIFY(( internal::is_same::type >::value)); VERIFY(( internal::is_same::type >::value)); VERIFY(( internal::is_same::type >::value)); VERIFY(( internal::is_same::type >::value)); VERIFY(( internal::is_same::type >::value)); VERIFY(( internal::is_same::type >::value)); // test add_const VERIFY(( internal::is_same< internal::add_const::type, const float >::value)); VERIFY(( internal::is_same< internal::add_const::type, float* const>::value)); VERIFY(( internal::is_same< internal::add_const::type, float const* const>::value)); VERIFY(( internal::is_same< internal::add_const::type, float& >::value)); // test remove_const VERIFY(( internal::is_same< internal::remove_const::type, float const* >::value)); VERIFY(( internal::is_same< internal::remove_const::type, float const* >::value)); VERIFY(( internal::is_same< internal::remove_const::type, float* >::value)); // test add_const_on_value_type VERIFY(( internal::is_same< internal::add_const_on_value_type::type, float const& >::value)); VERIFY(( internal::is_same< internal::add_const_on_value_type::type, float const* >::value)); VERIFY(( internal::is_same< internal::add_const_on_value_type::type, const float >::value)); VERIFY(( internal::is_same< internal::add_const_on_value_type::type, const float >::value)); VERIFY(( internal::is_same< internal::add_const_on_value_type::type, const float* const>::value)); VERIFY(( internal::is_same< internal::add_const_on_value_type::type, const float* const>::value)); VERIFY(( internal::is_same::type >::value)); VERIFY(( internal::is_same::type >::value)); VERIFY(( internal::is_same::type >::value)); VERIFY(( internal::is_same::type >::value)); VERIFY(( internal::is_same::type >::value)); // is_convertible STATIC_CHECK(( internal::is_convertible::value )); STATIC_CHECK(( internal::is_convertible::value )); STATIC_CHECK(( internal::is_convertible::value )); STATIC_CHECK(( internal::is_convertible::value )); STATIC_CHECK(( internal::is_convertible::value )); STATIC_CHECK(( internal::is_convertible >::value )); STATIC_CHECK((!internal::is_convertible,double>::value )); STATIC_CHECK(( internal::is_convertible::value )); STATIC_CHECK(( internal::is_convertible::value )); STATIC_CHECK(( internal::is_convertible::value )); STATIC_CHECK(( internal::is_convertible::value )); STATIC_CHECK(( internal::is_convertible::value )); STATIC_CHECK(( internal::is_convertible::value )); STATIC_CHECK((!internal::is_convertible::value )); STATIC_CHECK((!internal::is_convertible::value )); STATIC_CHECK(!( internal::is_convertible::value )); STATIC_CHECK(!( internal::is_convertible::value )); STATIC_CHECK(( internal::is_convertible::value )); //STATIC_CHECK((!internal::is_convertible::value )); //does not even compile because the conversion is prevented by a static assertion STATIC_CHECK((!internal::is_convertible::value )); STATIC_CHECK((!internal::is_convertible::value )); { float f = 0.0f; MatrixXf A, B; VectorXf a, b; VERIFY(( check_is_convertible(a.dot(b), f) )); VERIFY(( check_is_convertible(a.transpose()*b, f) )); VERIFY((!check_is_convertible(A*B, f) )); VERIFY(( check_is_convertible(A*B, A) )); } #if (EIGEN_COMP_GNUC && EIGEN_COMP_GNUC <= 99) \ || (EIGEN_COMP_CLANG && EIGEN_COMP_CLANG <= 909) \ || (EIGEN_COMP_MSVC && EIGEN_COMP_MSVC <=1914) // See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1752, // basically, a fix in the c++ standard breaks our c++98 implementation // of is_convertible for abstract classes. // So the following tests are expected to fail with recent compilers. STATIC_CHECK(( !internal::is_convertible::value )); #if (!EIGEN_COMP_GNUC_STRICT) || (EIGEN_GNUC_AT_LEAST(4,8)) // GCC prior to 4.8 fails to compile this test: // error: cannot allocate an object of abstract type 'MyInterface' // In other word, it does not obey SFINAE. // Nevertheless, we don't really care about supporting abstract type as scalar type! STATIC_CHECK(( !internal::is_convertible::value )); #endif STATIC_CHECK(( internal::is_convertible::value )); #endif { int i = 0; VERIFY(( check_is_convertible(fix<3>(), i) )); VERIFY((!check_is_convertible(i, fix()) )); } VERIFY(( internal::has_ReturnType::value )); VERIFY(( internal::has_ReturnType >::value )); VERIFY(( !internal::has_ReturnType::value )); VERIFY(( !internal::has_ReturnType::value )); VERIFY(internal::meta_sqrt<1>::ret == 1); #define VERIFY_META_SQRT(X) VERIFY(internal::meta_sqrt::ret == int(std::sqrt(double(X)))) VERIFY_META_SQRT(2); VERIFY_META_SQRT(3); VERIFY_META_SQRT(4); VERIFY_META_SQRT(5); VERIFY_META_SQRT(6); VERIFY_META_SQRT(8); VERIFY_META_SQRT(9); VERIFY_META_SQRT(15); VERIFY_META_SQRT(16); VERIFY_META_SQRT(17); VERIFY_META_SQRT(255); VERIFY_META_SQRT(256); VERIFY_META_SQRT(257); VERIFY_META_SQRT(1023); VERIFY_META_SQRT(1024); VERIFY_META_SQRT(1025); } ================================================ FILE: VO_Module/thirdparty/eigen/test/metis_support.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "sparse_solver.h" #include #include #include template void test_metis_T() { SparseLU, MetisOrdering > sparselu_metis; check_sparse_square_solving(sparselu_metis); } EIGEN_DECLARE_TEST(metis_support) { CALL_SUBTEST_1(test_metis_T()); } ================================================ FILE: VO_Module/thirdparty/eigen/test/miscmatrices.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2006-2008 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" template void miscMatrices(const MatrixType& m) { /* this test covers the following files: DiagonalMatrix.h Ones.h */ typedef typename MatrixType::Scalar Scalar; typedef Matrix VectorType; Index rows = m.rows(); Index cols = m.cols(); Index r = internal::random(0, rows-1), r2 = internal::random(0, rows-1), c = internal::random(0, cols-1); VERIFY_IS_APPROX(MatrixType::Ones(rows,cols)(r,c), static_cast(1)); MatrixType m1 = MatrixType::Ones(rows,cols); VERIFY_IS_APPROX(m1(r,c), static_cast(1)); VectorType v1 = VectorType::Random(rows); v1[0]; Matrix square(v1.asDiagonal()); if(r==r2) VERIFY_IS_APPROX(square(r,r2), v1[r]); else VERIFY_IS_MUCH_SMALLER_THAN(square(r,r2), static_cast(1)); square = MatrixType::Zero(rows, rows); square.diagonal() = VectorType::Ones(rows); VERIFY_IS_APPROX(square, MatrixType::Identity(rows, rows)); } EIGEN_DECLARE_TEST(miscmatrices) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( miscMatrices(Matrix()) ); CALL_SUBTEST_2( miscMatrices(Matrix4d()) ); CALL_SUBTEST_3( miscMatrices(MatrixXcf(3, 3)) ); CALL_SUBTEST_4( miscMatrices(MatrixXi(8, 12)) ); CALL_SUBTEST_5( miscMatrices(MatrixXcd(20, 20)) ); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/mixingtypes.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2015 Gael Guennebaud // Copyright (C) 2008 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #if defined(EIGEN_TEST_PART_7) #ifndef EIGEN_NO_STATIC_ASSERT #define EIGEN_NO_STATIC_ASSERT // turn static asserts into runtime asserts in order to check them #endif // ignore double-promotion diagnostic for clang and gcc, if we check for static assertion anyway: // TODO do the same for MSVC? #if defined(__clang__) # if (__clang_major__ * 100 + __clang_minor__) >= 308 # pragma clang diagnostic ignored "-Wdouble-promotion" # endif #elif defined(__GNUC__) // TODO is there a minimal GCC version for this? At least g++-4.7 seems to be fine with this. # pragma GCC diagnostic ignored "-Wdouble-promotion" #endif #endif #if defined(EIGEN_TEST_PART_1) || defined(EIGEN_TEST_PART_2) || defined(EIGEN_TEST_PART_3) #ifndef EIGEN_DONT_VECTORIZE #define EIGEN_DONT_VECTORIZE #endif #endif static bool g_called; #define EIGEN_SCALAR_BINARY_OP_PLUGIN { g_called |= (!internal::is_same::value); } #include "main.h" using namespace std; #define VERIFY_MIX_SCALAR(XPR,REF) \ g_called = false; \ VERIFY_IS_APPROX(XPR,REF); \ VERIFY( g_called && #XPR" not properly optimized"); template void raise_assertion(Index size = SizeAtCompileType) { // VERIFY_RAISES_ASSERT(mf+md); // does not even compile Matrix vf; vf.setRandom(size); Matrix vd; vd.setRandom(size); VERIFY_RAISES_ASSERT(vf=vd); VERIFY_RAISES_ASSERT(vf+=vd); VERIFY_RAISES_ASSERT(vf-=vd); VERIFY_RAISES_ASSERT(vd=vf); VERIFY_RAISES_ASSERT(vd+=vf); VERIFY_RAISES_ASSERT(vd-=vf); // vd.asDiagonal() * mf; // does not even compile // vcd.asDiagonal() * mf; // does not even compile #if 0 // we get other compilation errors here than just static asserts VERIFY_RAISES_ASSERT(vd.dot(vf)); #endif } template void mixingtypes(int size = SizeAtCompileType) { typedef std::complex CF; typedef std::complex CD; typedef Matrix Mat_f; typedef Matrix Mat_d; typedef Matrix, SizeAtCompileType, SizeAtCompileType> Mat_cf; typedef Matrix, SizeAtCompileType, SizeAtCompileType> Mat_cd; typedef Matrix Vec_f; typedef Matrix Vec_d; typedef Matrix, SizeAtCompileType, 1> Vec_cf; typedef Matrix, SizeAtCompileType, 1> Vec_cd; Mat_f mf = Mat_f::Random(size,size); Mat_d md = mf.template cast(); //Mat_d rd = md; Mat_cf mcf = Mat_cf::Random(size,size); Mat_cd mcd = mcf.template cast >(); Mat_cd rcd = mcd; Vec_f vf = Vec_f::Random(size,1); Vec_d vd = vf.template cast(); Vec_cf vcf = Vec_cf::Random(size,1); Vec_cd vcd = vcf.template cast >(); float sf = internal::random(); double sd = internal::random(); complex scf = internal::random >(); complex scd = internal::random >(); mf+mf; float epsf = std::sqrt(std::numeric_limits ::min EIGEN_EMPTY ()); double epsd = std::sqrt(std::numeric_limits::min EIGEN_EMPTY ()); while(std::abs(sf )(); while(std::abs(sd )(); while(std::abs(scf)(); while(std::abs(scd)(); // check scalar products VERIFY_MIX_SCALAR(vcf * sf , vcf * complex(sf)); VERIFY_MIX_SCALAR(sd * vcd , complex(sd) * vcd); VERIFY_MIX_SCALAR(vf * scf , vf.template cast >() * scf); VERIFY_MIX_SCALAR(scd * vd , scd * vd.template cast >()); VERIFY_MIX_SCALAR(vcf * 2 , vcf * complex(2)); VERIFY_MIX_SCALAR(vcf * 2.1 , vcf * complex(2.1)); VERIFY_MIX_SCALAR(2 * vcf, vcf * complex(2)); VERIFY_MIX_SCALAR(2.1 * vcf , vcf * complex(2.1)); // check scalar quotients VERIFY_MIX_SCALAR(vcf / sf , vcf / complex(sf)); VERIFY_MIX_SCALAR(vf / scf , vf.template cast >() / scf); VERIFY_MIX_SCALAR(vf.array() / scf, vf.template cast >().array() / scf); VERIFY_MIX_SCALAR(scd / vd.array() , scd / vd.template cast >().array()); // check scalar increment VERIFY_MIX_SCALAR(vcf.array() + sf , vcf.array() + complex(sf)); VERIFY_MIX_SCALAR(sd + vcd.array(), complex(sd) + vcd.array()); VERIFY_MIX_SCALAR(vf.array() + scf, vf.template cast >().array() + scf); VERIFY_MIX_SCALAR(scd + vd.array() , scd + vd.template cast >().array()); // check scalar subtractions VERIFY_MIX_SCALAR(vcf.array() - sf , vcf.array() - complex(sf)); VERIFY_MIX_SCALAR(sd - vcd.array(), complex(sd) - vcd.array()); VERIFY_MIX_SCALAR(vf.array() - scf, vf.template cast >().array() - scf); VERIFY_MIX_SCALAR(scd - vd.array() , scd - vd.template cast >().array()); // check scalar powers VERIFY_MIX_SCALAR( pow(vcf.array(), sf), Eigen::pow(vcf.array(), complex(sf)) ); VERIFY_MIX_SCALAR( vcf.array().pow(sf) , Eigen::pow(vcf.array(), complex(sf)) ); VERIFY_MIX_SCALAR( pow(sd, vcd.array()), Eigen::pow(complex(sd), vcd.array()) ); VERIFY_MIX_SCALAR( Eigen::pow(vf.array(), scf), Eigen::pow(vf.template cast >().array(), scf) ); VERIFY_MIX_SCALAR( vf.array().pow(scf) , Eigen::pow(vf.template cast >().array(), scf) ); VERIFY_MIX_SCALAR( Eigen::pow(scd, vd.array()), Eigen::pow(scd, vd.template cast >().array()) ); // check dot product vf.dot(vf); VERIFY_IS_APPROX(vcf.dot(vf), vcf.dot(vf.template cast >())); // check diagonal product VERIFY_IS_APPROX(vf.asDiagonal() * mcf, vf.template cast >().asDiagonal() * mcf); VERIFY_IS_APPROX(vcd.asDiagonal() * md, vcd.asDiagonal() * md.template cast >()); VERIFY_IS_APPROX(mcf * vf.asDiagonal(), mcf * vf.template cast >().asDiagonal()); VERIFY_IS_APPROX(md * vcd.asDiagonal(), md.template cast >() * vcd.asDiagonal()); // check inner product VERIFY_IS_APPROX((vf.transpose() * vcf).value(), (vf.template cast >().transpose() * vcf).value()); // check outer product VERIFY_IS_APPROX((vf * vcf.transpose()).eval(), (vf.template cast >() * vcf.transpose()).eval()); // coeff wise product VERIFY_IS_APPROX((vf * vcf.transpose()).eval(), (vf.template cast >() * vcf.transpose()).eval()); Mat_cd mcd2 = mcd; VERIFY_IS_APPROX(mcd.array() *= md.array(), mcd2.array() *= md.array().template cast >()); // check matrix-matrix products VERIFY_IS_APPROX(sd*md*mcd, (sd*md).template cast().eval()*mcd); VERIFY_IS_APPROX(sd*mcd*md, sd*mcd*md.template cast()); VERIFY_IS_APPROX(scd*md*mcd, scd*md.template cast().eval()*mcd); VERIFY_IS_APPROX(scd*mcd*md, scd*mcd*md.template cast()); VERIFY_IS_APPROX(sf*mf*mcf, sf*mf.template cast()*mcf); VERIFY_IS_APPROX(sf*mcf*mf, sf*mcf*mf.template cast()); VERIFY_IS_APPROX(scf*mf*mcf, scf*mf.template cast()*mcf); VERIFY_IS_APPROX(scf*mcf*mf, scf*mcf*mf.template cast()); VERIFY_IS_APPROX(sd*md.adjoint()*mcd, (sd*md).template cast().eval().adjoint()*mcd); VERIFY_IS_APPROX(sd*mcd.adjoint()*md, sd*mcd.adjoint()*md.template cast()); VERIFY_IS_APPROX(sd*md.adjoint()*mcd.adjoint(), (sd*md).template cast().eval().adjoint()*mcd.adjoint()); VERIFY_IS_APPROX(sd*mcd.adjoint()*md.adjoint(), sd*mcd.adjoint()*md.template cast().adjoint()); VERIFY_IS_APPROX(sd*md*mcd.adjoint(), (sd*md).template cast().eval()*mcd.adjoint()); VERIFY_IS_APPROX(sd*mcd*md.adjoint(), sd*mcd*md.template cast().adjoint()); VERIFY_IS_APPROX(sf*mf.adjoint()*mcf, (sf*mf).template cast().eval().adjoint()*mcf); VERIFY_IS_APPROX(sf*mcf.adjoint()*mf, sf*mcf.adjoint()*mf.template cast()); VERIFY_IS_APPROX(sf*mf.adjoint()*mcf.adjoint(), (sf*mf).template cast().eval().adjoint()*mcf.adjoint()); VERIFY_IS_APPROX(sf*mcf.adjoint()*mf.adjoint(), sf*mcf.adjoint()*mf.template cast().adjoint()); VERIFY_IS_APPROX(sf*mf*mcf.adjoint(), (sf*mf).template cast().eval()*mcf.adjoint()); VERIFY_IS_APPROX(sf*mcf*mf.adjoint(), sf*mcf*mf.template cast().adjoint()); VERIFY_IS_APPROX(sf*mf*vcf, (sf*mf).template cast().eval()*vcf); VERIFY_IS_APPROX(scf*mf*vcf,(scf*mf.template cast()).eval()*vcf); VERIFY_IS_APPROX(sf*mcf*vf, sf*mcf*vf.template cast()); VERIFY_IS_APPROX(scf*mcf*vf,scf*mcf*vf.template cast()); VERIFY_IS_APPROX(sf*vcf.adjoint()*mf, sf*vcf.adjoint()*mf.template cast().eval()); VERIFY_IS_APPROX(scf*vcf.adjoint()*mf, scf*vcf.adjoint()*mf.template cast().eval()); VERIFY_IS_APPROX(sf*vf.adjoint()*mcf, sf*vf.adjoint().template cast().eval()*mcf); VERIFY_IS_APPROX(scf*vf.adjoint()*mcf, scf*vf.adjoint().template cast().eval()*mcf); VERIFY_IS_APPROX(sd*md*vcd, (sd*md).template cast().eval()*vcd); VERIFY_IS_APPROX(scd*md*vcd,(scd*md.template cast()).eval()*vcd); VERIFY_IS_APPROX(sd*mcd*vd, sd*mcd*vd.template cast().eval()); VERIFY_IS_APPROX(scd*mcd*vd,scd*mcd*vd.template cast().eval()); VERIFY_IS_APPROX(sd*vcd.adjoint()*md, sd*vcd.adjoint()*md.template cast().eval()); VERIFY_IS_APPROX(scd*vcd.adjoint()*md, scd*vcd.adjoint()*md.template cast().eval()); VERIFY_IS_APPROX(sd*vd.adjoint()*mcd, sd*vd.adjoint().template cast().eval()*mcd); VERIFY_IS_APPROX(scd*vd.adjoint()*mcd, scd*vd.adjoint().template cast().eval()*mcd); VERIFY_IS_APPROX( sd*vcd.adjoint()*md.template triangularView(), sd*vcd.adjoint()*md.template cast().eval().template triangularView()); VERIFY_IS_APPROX(scd*vcd.adjoint()*md.template triangularView(), scd*vcd.adjoint()*md.template cast().eval().template triangularView()); VERIFY_IS_APPROX( sd*vcd.adjoint()*md.transpose().template triangularView(), sd*vcd.adjoint()*md.transpose().template cast().eval().template triangularView()); VERIFY_IS_APPROX(scd*vcd.adjoint()*md.transpose().template triangularView(), scd*vcd.adjoint()*md.transpose().template cast().eval().template triangularView()); VERIFY_IS_APPROX( sd*vd.adjoint()*mcd.template triangularView(), sd*vd.adjoint().template cast().eval()*mcd.template triangularView()); VERIFY_IS_APPROX(scd*vd.adjoint()*mcd.template triangularView(), scd*vd.adjoint().template cast().eval()*mcd.template triangularView()); VERIFY_IS_APPROX( sd*vd.adjoint()*mcd.transpose().template triangularView(), sd*vd.adjoint().template cast().eval()*mcd.transpose().template triangularView()); VERIFY_IS_APPROX(scd*vd.adjoint()*mcd.transpose().template triangularView(), scd*vd.adjoint().template cast().eval()*mcd.transpose().template triangularView()); // Not supported yet: trmm // VERIFY_IS_APPROX(sd*mcd*md.template triangularView(), sd*mcd*md.template cast().eval().template triangularView()); // VERIFY_IS_APPROX(scd*mcd*md.template triangularView(), scd*mcd*md.template cast().eval().template triangularView()); // VERIFY_IS_APPROX(sd*md*mcd.template triangularView(), sd*md.template cast().eval()*mcd.template triangularView()); // VERIFY_IS_APPROX(scd*md*mcd.template triangularView(), scd*md.template cast().eval()*mcd.template triangularView()); // Not supported yet: symv // VERIFY_IS_APPROX(sd*vcd.adjoint()*md.template selfadjointView(), sd*vcd.adjoint()*md.template cast().eval().template selfadjointView()); // VERIFY_IS_APPROX(scd*vcd.adjoint()*md.template selfadjointView(), scd*vcd.adjoint()*md.template cast().eval().template selfadjointView()); // VERIFY_IS_APPROX(sd*vd.adjoint()*mcd.template selfadjointView(), sd*vd.adjoint().template cast().eval()*mcd.template selfadjointView()); // VERIFY_IS_APPROX(scd*vd.adjoint()*mcd.template selfadjointView(), scd*vd.adjoint().template cast().eval()*mcd.template selfadjointView()); // Not supported yet: symm // VERIFY_IS_APPROX(sd*vcd.adjoint()*md.template selfadjointView(), sd*vcd.adjoint()*md.template cast().eval().template selfadjointView()); // VERIFY_IS_APPROX(scd*vcd.adjoint()*md.template selfadjointView(), scd*vcd.adjoint()*md.template cast().eval().template selfadjointView()); // VERIFY_IS_APPROX(sd*vd.adjoint()*mcd.template selfadjointView(), sd*vd.adjoint().template cast().eval()*mcd.template selfadjointView()); // VERIFY_IS_APPROX(scd*vd.adjoint()*mcd.template selfadjointView(), scd*vd.adjoint().template cast().eval()*mcd.template selfadjointView()); rcd.setZero(); VERIFY_IS_APPROX(Mat_cd(rcd.template triangularView() = sd * mcd * md), Mat_cd((sd * mcd * md.template cast().eval()).template triangularView())); VERIFY_IS_APPROX(Mat_cd(rcd.template triangularView() = sd * md * mcd), Mat_cd((sd * md.template cast().eval() * mcd).template triangularView())); VERIFY_IS_APPROX(Mat_cd(rcd.template triangularView() = scd * mcd * md), Mat_cd((scd * mcd * md.template cast().eval()).template triangularView())); VERIFY_IS_APPROX(Mat_cd(rcd.template triangularView() = scd * md * mcd), Mat_cd((scd * md.template cast().eval() * mcd).template triangularView())); VERIFY_IS_APPROX( md.array() * mcd.array(), md.template cast().eval().array() * mcd.array() ); VERIFY_IS_APPROX( mcd.array() * md.array(), mcd.array() * md.template cast().eval().array() ); VERIFY_IS_APPROX( md.array() + mcd.array(), md.template cast().eval().array() + mcd.array() ); VERIFY_IS_APPROX( mcd.array() + md.array(), mcd.array() + md.template cast().eval().array() ); VERIFY_IS_APPROX( md.array() - mcd.array(), md.template cast().eval().array() - mcd.array() ); VERIFY_IS_APPROX( mcd.array() - md.array(), mcd.array() - md.template cast().eval().array() ); if(mcd.array().abs().minCoeff()>epsd) { VERIFY_IS_APPROX( md.array() / mcd.array(), md.template cast().eval().array() / mcd.array() ); } if(md.array().abs().minCoeff()>epsd) { VERIFY_IS_APPROX( mcd.array() / md.array(), mcd.array() / md.template cast().eval().array() ); } if(md.array().abs().minCoeff()>epsd || mcd.array().abs().minCoeff()>epsd) { VERIFY_IS_APPROX( md.array().pow(mcd.array()), md.template cast().eval().array().pow(mcd.array()) ); VERIFY_IS_APPROX( mcd.array().pow(md.array()), mcd.array().pow(md.template cast().eval().array()) ); VERIFY_IS_APPROX( pow(md.array(),mcd.array()), md.template cast().eval().array().pow(mcd.array()) ); VERIFY_IS_APPROX( pow(mcd.array(),md.array()), mcd.array().pow(md.template cast().eval().array()) ); } rcd = mcd; VERIFY_IS_APPROX( rcd = md, md.template cast().eval() ); rcd = mcd; VERIFY_IS_APPROX( rcd += md, mcd + md.template cast().eval() ); rcd = mcd; VERIFY_IS_APPROX( rcd -= md, mcd - md.template cast().eval() ); rcd = mcd; VERIFY_IS_APPROX( rcd.array() *= md.array(), mcd.array() * md.template cast().eval().array() ); rcd = mcd; if(md.array().abs().minCoeff()>epsd) { VERIFY_IS_APPROX( rcd.array() /= md.array(), mcd.array() / md.template cast().eval().array() ); } rcd = mcd; VERIFY_IS_APPROX( rcd.noalias() += md + mcd*md, mcd + (md.template cast().eval()) + mcd*(md.template cast().eval())); VERIFY_IS_APPROX( rcd.noalias() = md*md, ((md*md).eval().template cast()) ); rcd = mcd; VERIFY_IS_APPROX( rcd.noalias() += md*md, mcd + ((md*md).eval().template cast()) ); rcd = mcd; VERIFY_IS_APPROX( rcd.noalias() -= md*md, mcd - ((md*md).eval().template cast()) ); VERIFY_IS_APPROX( rcd.noalias() = mcd + md*md, mcd + ((md*md).eval().template cast()) ); rcd = mcd; VERIFY_IS_APPROX( rcd.noalias() += mcd + md*md, mcd + mcd + ((md*md).eval().template cast()) ); rcd = mcd; VERIFY_IS_APPROX( rcd.noalias() -= mcd + md*md, - ((md*md).eval().template cast()) ); } EIGEN_DECLARE_TEST(mixingtypes) { g_called = false; // Silence -Wunneeded-internal-declaration. for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1(mixingtypes<3>()); CALL_SUBTEST_2(mixingtypes<4>()); CALL_SUBTEST_3(mixingtypes(internal::random(1,EIGEN_TEST_MAX_SIZE))); CALL_SUBTEST_4(mixingtypes<3>()); CALL_SUBTEST_5(mixingtypes<4>()); CALL_SUBTEST_6(mixingtypes(internal::random(1,EIGEN_TEST_MAX_SIZE))); CALL_SUBTEST_7(raise_assertion(internal::random(1,EIGEN_TEST_MAX_SIZE))); } CALL_SUBTEST_7(raise_assertion<0>()); CALL_SUBTEST_7(raise_assertion<3>()); CALL_SUBTEST_7(raise_assertion<4>()); CALL_SUBTEST_7(raise_assertion(0)); } ================================================ FILE: VO_Module/thirdparty/eigen/test/mpl2only.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2015 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_MPL2_ONLY #define EIGEN_MPL2_ONLY #endif #include #include #include #include #include #include #include int main() { return 0; } ================================================ FILE: VO_Module/thirdparty/eigen/test/nestbyvalue.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2019 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #define TEST_ENABLE_TEMPORARY_TRACKING #include "main.h" typedef NestByValue CpyMatrixXd; typedef CwiseBinaryOp,const CpyMatrixXd,const CpyMatrixXd> XprType; XprType get_xpr_with_temps(const MatrixXd& a) { MatrixXd t1 = a.rowwise().reverse(); MatrixXd t2 = a+a; return t1.nestByValue() + t2.nestByValue(); } EIGEN_DECLARE_TEST(nestbyvalue) { for(int i = 0; i < g_repeat; i++) { Index rows = internal::random(1,EIGEN_TEST_MAX_SIZE); Index cols = internal::random(1,EIGEN_TEST_MAX_SIZE); MatrixXd a = MatrixXd(rows,cols); nb_temporaries = 0; XprType x = get_xpr_with_temps(a); VERIFY_IS_EQUAL(nb_temporaries,6); MatrixXd b = x; VERIFY_IS_EQUAL(nb_temporaries,6+1); VERIFY_IS_APPROX(b, a.rowwise().reverse().eval() + (a+a).eval()); } } ================================================ FILE: VO_Module/thirdparty/eigen/test/nesting_ops.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2010 Hauke Heibel // Copyright (C) 2015 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #define TEST_ENABLE_TEMPORARY_TRACKING #include "main.h" template void use_n_times(const XprType &xpr) { typename internal::nested_eval::type mat(xpr); typename XprType::PlainObject res(mat.rows(), mat.cols()); nb_temporaries--; // remove res res.setZero(); for(int i=0; i bool verify_eval_type(const XprType &, const ReferenceType&) { typedef typename internal::nested_eval::type EvalType; return internal::is_same::type, typename internal::remove_all::type>::value; } template void run_nesting_ops_1(const MatrixType& _m) { typename internal::nested_eval::type m(_m); // Make really sure that we are in debug mode! VERIFY_RAISES_ASSERT(eigen_assert(false)); // The only intention of these tests is to ensure that this code does // not trigger any asserts or segmentation faults... more to come. VERIFY_IS_APPROX( (m.transpose() * m).diagonal().sum(), (m.transpose() * m).diagonal().sum() ); VERIFY_IS_APPROX( (m.transpose() * m).diagonal().array().abs().sum(), (m.transpose() * m).diagonal().array().abs().sum() ); VERIFY_IS_APPROX( (m.transpose() * m).array().abs().sum(), (m.transpose() * m).array().abs().sum() ); } template void run_nesting_ops_2(const MatrixType& _m) { typedef typename MatrixType::Scalar Scalar; Index rows = _m.rows(); Index cols = _m.cols(); MatrixType m1 = MatrixType::Random(rows,cols); Matrix m2; if((MatrixType::SizeAtCompileTime==Dynamic)) { VERIFY_EVALUATION_COUNT( use_n_times<1>(m1 + m1*m1), 1 ); VERIFY_EVALUATION_COUNT( use_n_times<10>(m1 + m1*m1), 1 ); VERIFY_EVALUATION_COUNT( use_n_times<1>(m1.template triangularView().solve(m1.col(0))), 1 ); VERIFY_EVALUATION_COUNT( use_n_times<10>(m1.template triangularView().solve(m1.col(0))), 1 ); VERIFY_EVALUATION_COUNT( use_n_times<1>(Scalar(2)*m1.template triangularView().solve(m1.col(0))), 2 ); // FIXME could be one by applying the scaling in-place on the solve result VERIFY_EVALUATION_COUNT( use_n_times<1>(m1.col(0)+m1.template triangularView().solve(m1.col(0))), 2 ); // FIXME could be one by adding m1.col() inplace VERIFY_EVALUATION_COUNT( use_n_times<10>(m1.col(0)+m1.template triangularView().solve(m1.col(0))), 2 ); } { VERIFY( verify_eval_type<10>(m1, m1) ); if(!NumTraits::IsComplex) { VERIFY( verify_eval_type<3>(2*m1, 2*m1) ); VERIFY( verify_eval_type<4>(2*m1, m1) ); } else { VERIFY( verify_eval_type<2>(2*m1, 2*m1) ); VERIFY( verify_eval_type<3>(2*m1, m1) ); } VERIFY( verify_eval_type<2>(m1+m1, m1+m1) ); VERIFY( verify_eval_type<3>(m1+m1, m1) ); VERIFY( verify_eval_type<1>(m1*m1.transpose(), m2) ); VERIFY( verify_eval_type<1>(m1*(m1+m1).transpose(), m2) ); VERIFY( verify_eval_type<2>(m1*m1.transpose(), m2) ); VERIFY( verify_eval_type<1>(m1+m1*m1, m1) ); VERIFY( verify_eval_type<1>(m1.template triangularView().solve(m1), m1) ); VERIFY( verify_eval_type<1>(m1+m1.template triangularView().solve(m1), m1) ); } } EIGEN_DECLARE_TEST(nesting_ops) { CALL_SUBTEST_1(run_nesting_ops_1(MatrixXf::Random(25,25))); CALL_SUBTEST_2(run_nesting_ops_1(MatrixXcd::Random(25,25))); CALL_SUBTEST_3(run_nesting_ops_1(Matrix4f::Random())); CALL_SUBTEST_4(run_nesting_ops_1(Matrix2d::Random())); Index s = internal::random(1,EIGEN_TEST_MAX_SIZE); CALL_SUBTEST_1( run_nesting_ops_2(MatrixXf(s,s)) ); CALL_SUBTEST_2( run_nesting_ops_2(MatrixXcd(s,s)) ); CALL_SUBTEST_3( run_nesting_ops_2(Matrix4f()) ); CALL_SUBTEST_4( run_nesting_ops_2(Matrix2d()) ); TEST_SET_BUT_UNUSED_VARIABLE(s) } ================================================ FILE: VO_Module/thirdparty/eigen/test/nomalloc.cpp ================================================ // 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 // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. // discard stack allocation as that too bypasses malloc #define EIGEN_STACK_ALLOCATION_LIMIT 0 // heap allocation will raise an assert if enabled at runtime #define EIGEN_RUNTIME_NO_MALLOC #include "main.h" #include #include #include #include #include template void nomalloc(const MatrixType& m) { /* this test check no dynamic memory allocation are issued with fixed-size matrices */ typedef typename MatrixType::Scalar Scalar; Index rows = m.rows(); Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols), m3(rows, cols); Scalar s1 = internal::random(); Index r = internal::random(0, rows-1), c = internal::random(0, cols-1); VERIFY_IS_APPROX((m1+m2)*s1, s1*m1+s1*m2); VERIFY_IS_APPROX((m1+m2)(r,c), (m1(r,c))+(m2(r,c))); VERIFY_IS_APPROX(m1.cwiseProduct(m1.block(0,0,rows,cols)), (m1.array()*m1.array()).matrix()); VERIFY_IS_APPROX((m1*m1.transpose())*m2, m1*(m1.transpose()*m2)); m2.col(0).noalias() = m1 * m1.col(0); m2.col(0).noalias() -= m1.adjoint() * m1.col(0); m2.col(0).noalias() -= m1 * m1.row(0).adjoint(); m2.col(0).noalias() -= m1.adjoint() * m1.row(0).adjoint(); m2.row(0).noalias() = m1.row(0) * m1; m2.row(0).noalias() -= m1.row(0) * m1.adjoint(); m2.row(0).noalias() -= m1.col(0).adjoint() * m1; m2.row(0).noalias() -= m1.col(0).adjoint() * m1.adjoint(); VERIFY_IS_APPROX(m2,m2); m2.col(0).noalias() = m1.template triangularView() * m1.col(0); m2.col(0).noalias() -= m1.adjoint().template triangularView() * m1.col(0); m2.col(0).noalias() -= m1.template triangularView() * m1.row(0).adjoint(); m2.col(0).noalias() -= m1.adjoint().template triangularView() * m1.row(0).adjoint(); m2.row(0).noalias() = m1.row(0) * m1.template triangularView(); m2.row(0).noalias() -= m1.row(0) * m1.adjoint().template triangularView(); m2.row(0).noalias() -= m1.col(0).adjoint() * m1.template triangularView(); m2.row(0).noalias() -= m1.col(0).adjoint() * m1.adjoint().template triangularView(); VERIFY_IS_APPROX(m2,m2); m2.col(0).noalias() = m1.template selfadjointView() * m1.col(0); m2.col(0).noalias() -= m1.adjoint().template selfadjointView() * m1.col(0); m2.col(0).noalias() -= m1.template selfadjointView() * m1.row(0).adjoint(); m2.col(0).noalias() -= m1.adjoint().template selfadjointView() * m1.row(0).adjoint(); m2.row(0).noalias() = m1.row(0) * m1.template selfadjointView(); m2.row(0).noalias() -= m1.row(0) * m1.adjoint().template selfadjointView(); m2.row(0).noalias() -= m1.col(0).adjoint() * m1.template selfadjointView(); m2.row(0).noalias() -= m1.col(0).adjoint() * m1.adjoint().template selfadjointView(); VERIFY_IS_APPROX(m2,m2); m2.template selfadjointView().rankUpdate(m1.col(0),-1); m2.template selfadjointView().rankUpdate(m1.row(0),-1); m2.template selfadjointView().rankUpdate(m1.col(0), m1.col(0)); // rank-2 // The following fancy matrix-matrix products are not safe yet regarding static allocation m2.template selfadjointView().rankUpdate(m1); m2 += m2.template triangularView() * m1; m2.template triangularView() = m2 * m2; m1 += m1.template selfadjointView() * m2; VERIFY_IS_APPROX(m2,m2); } template void ctms_decompositions() { const int maxSize = 16; const int size = 12; typedef Eigen::Matrix Matrix; typedef Eigen::Matrix Vector; typedef Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic, 0, maxSize, maxSize> ComplexMatrix; const Matrix A(Matrix::Random(size, size)), B(Matrix::Random(size, size)); Matrix X(size,size); const ComplexMatrix complexA(ComplexMatrix::Random(size, size)); const Matrix saA = A.adjoint() * A; const Vector b(Vector::Random(size)); Vector x(size); // Cholesky module Eigen::LLT LLT; LLT.compute(A); X = LLT.solve(B); x = LLT.solve(b); Eigen::LDLT LDLT; LDLT.compute(A); X = LDLT.solve(B); x = LDLT.solve(b); // Eigenvalues module Eigen::HessenbergDecomposition hessDecomp; hessDecomp.compute(complexA); Eigen::ComplexSchur cSchur(size); cSchur.compute(complexA); Eigen::ComplexEigenSolver cEigSolver; cEigSolver.compute(complexA); Eigen::EigenSolver eigSolver; eigSolver.compute(A); Eigen::SelfAdjointEigenSolver saEigSolver(size); saEigSolver.compute(saA); Eigen::Tridiagonalization tridiag; tridiag.compute(saA); // LU module Eigen::PartialPivLU ppLU; ppLU.compute(A); X = ppLU.solve(B); x = ppLU.solve(b); Eigen::FullPivLU fpLU; fpLU.compute(A); X = fpLU.solve(B); x = fpLU.solve(b); // QR module Eigen::HouseholderQR hQR; hQR.compute(A); X = hQR.solve(B); x = hQR.solve(b); Eigen::ColPivHouseholderQR cpQR; cpQR.compute(A); X = cpQR.solve(B); x = cpQR.solve(b); Eigen::FullPivHouseholderQR fpQR; fpQR.compute(A); // FIXME X = fpQR.solve(B); x = fpQR.solve(b); // SVD module Eigen::JacobiSVD jSVD; jSVD.compute(A, ComputeFullU | ComputeFullV); } void test_zerosized() { // default constructors: Eigen::MatrixXd A; Eigen::VectorXd v; // explicit zero-sized: Eigen::ArrayXXd A0(0,0); Eigen::ArrayXd v0(0); // assigning empty objects to each other: A=A0; v=v0; } template void test_reference(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; enum { Flag = MatrixType::IsRowMajor ? Eigen::RowMajor : Eigen::ColMajor}; enum { TransposeFlag = !MatrixType::IsRowMajor ? Eigen::RowMajor : Eigen::ColMajor}; Index rows = m.rows(), cols=m.cols(); typedef Eigen::Matrix MatrixX; typedef Eigen::Matrix MatrixXT; // Dynamic reference: typedef Eigen::Ref Ref; typedef Eigen::Ref RefT; Ref r1(m); Ref r2(m.block(rows/3, cols/4, rows/2, cols/2)); RefT r3(m.transpose()); RefT r4(m.topLeftCorner(rows/2, cols/2).transpose()); VERIFY_RAISES_ASSERT(RefT r5(m)); VERIFY_RAISES_ASSERT(Ref r6(m.transpose())); VERIFY_RAISES_ASSERT(Ref r7(Scalar(2) * m)); // Copy constructors shall also never malloc Ref r8 = r1; RefT r9 = r3; // Initializing from a compatible Ref shall also never malloc Eigen::Ref > r10=r8, r11=m; // Initializing from an incompatible Ref will malloc: typedef Eigen::Ref RefAligned; VERIFY_RAISES_ASSERT(RefAligned r12=r10); VERIFY_RAISES_ASSERT(Ref r13=r10); // r10 has more dynamic strides } EIGEN_DECLARE_TEST(nomalloc) { // create some dynamic objects Eigen::MatrixXd M1 = MatrixXd::Random(3,3); Ref R1 = 2.0*M1; // Ref requires temporary // from here on prohibit malloc: Eigen::internal::set_is_malloc_allowed(false); // check that our operator new is indeed called: VERIFY_RAISES_ASSERT(MatrixXd dummy(MatrixXd::Random(3,3))); CALL_SUBTEST_1(nomalloc(Matrix()) ); CALL_SUBTEST_2(nomalloc(Matrix4d()) ); CALL_SUBTEST_3(nomalloc(Matrix()) ); // Check decomposition modules with dynamic matrices that have a known compile-time max size (ctms) CALL_SUBTEST_4(ctms_decompositions()); CALL_SUBTEST_5(test_zerosized()); CALL_SUBTEST_6(test_reference(Matrix())); CALL_SUBTEST_7(test_reference(R1)); CALL_SUBTEST_8(Ref R2 = M1.topRows<2>(); test_reference(R2)); } ================================================ FILE: VO_Module/thirdparty/eigen/test/nullary.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2010-2011 Jitse Niesen // Copyright (C) 2016 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" template bool equalsIdentity(const MatrixType& A) { typedef typename MatrixType::Scalar Scalar; Scalar zero = static_cast(0); bool offDiagOK = true; for (Index i = 0; i < A.rows(); ++i) { for (Index j = i+1; j < A.cols(); ++j) { offDiagOK = offDiagOK && (A(i,j) == zero); } } for (Index i = 0; i < A.rows(); ++i) { for (Index j = 0; j < (std::min)(i, A.cols()); ++j) { offDiagOK = offDiagOK && (A(i,j) == zero); } } bool diagOK = (A.diagonal().array() == 1).all(); return offDiagOK && diagOK; } template void check_extremity_accuracy(const VectorType &v, const typename VectorType::Scalar &low, const typename VectorType::Scalar &high) { typedef typename VectorType::Scalar Scalar; typedef typename VectorType::RealScalar RealScalar; RealScalar prec = internal::is_same::value ? NumTraits::dummy_precision()*10 : NumTraits::dummy_precision()/10; Index size = v.size(); if(size<20) return; for (int i=0; isize-6) { Scalar ref = (low*RealScalar(size-i-1))/RealScalar(size-1) + (high*RealScalar(i))/RealScalar(size-1); if(std::abs(ref)>1) { if(!internal::isApprox(v(i), ref, prec)) std::cout << v(i) << " != " << ref << " ; relative error: " << std::abs((v(i)-ref)/ref) << " ; required precision: " << prec << " ; range: " << low << "," << high << " ; i: " << i << "\n"; VERIFY(internal::isApprox(v(i), (low*RealScalar(size-i-1))/RealScalar(size-1) + (high*RealScalar(i))/RealScalar(size-1), prec)); } } } } template void testVectorType(const VectorType& base) { typedef typename VectorType::Scalar Scalar; typedef typename VectorType::RealScalar RealScalar; const Index size = base.size(); Scalar high = internal::random(-500,500); Scalar low = (size == 1 ? high : internal::random(-500,500)); if (numext::real(low)>numext::real(high)) std::swap(low,high); // check low==high if(internal::random(0.f,1.f)<0.05f) low = high; // check abs(low) >> abs(high) else if(size>2 && std::numeric_limits::max_exponent10>0 && internal::random(0.f,1.f)<0.1f) low = -internal::random(1,2) * RealScalar(std::pow(RealScalar(10),std::numeric_limits::max_exponent10/2)); const Scalar step = ((size == 1) ? 1 : (high-low)/RealScalar(size-1)); // check whether the result yields what we expect it to do VectorType m(base); m.setLinSpaced(size,low,high); if(!NumTraits::IsInteger) { VectorType n(size); for (int i=0; i::IsInteger) || (range_length>=size && (Index(range_length)%(size-1))==0) || (Index(range_length+1)::IsInteger) || (range_length>=size)) for (int i=0; i::IsInteger) CALL_SUBTEST( check_extremity_accuracy(m, low, high) ); } VERIFY( numext::real(m(m.size()-1)) <= numext::real(high) ); VERIFY( (m.array().real() <= numext::real(high)).all() ); VERIFY( (m.array().real() >= numext::real(low)).all() ); VERIFY( numext::real(m(m.size()-1)) >= numext::real(low) ); if(size>=1) { VERIFY( internal::isApprox(m(0),low) ); VERIFY_IS_EQUAL(m(0) , low); } // check whether everything works with row and col major vectors Matrix row_vector(size); Matrix col_vector(size); row_vector.setLinSpaced(size,low,high); col_vector.setLinSpaced(size,low,high); // when using the extended precision (e.g., FPU) the relative error might exceed 1 bit // when computing the squared sum in isApprox, thus the 2x factor. VERIFY( row_vector.isApprox(col_vector.transpose(), RealScalar(2)*NumTraits::epsilon())); Matrix size_changer(size+50); size_changer.setLinSpaced(size,low,high); VERIFY( size_changer.size() == size ); typedef Matrix ScalarMatrix; ScalarMatrix scalar; scalar.setLinSpaced(1,low,high); VERIFY_IS_APPROX( scalar, ScalarMatrix::Constant(high) ); VERIFY_IS_APPROX( ScalarMatrix::LinSpaced(1,low,high), ScalarMatrix::Constant(high) ); // regression test for bug 526 (linear vectorized transversal) if (size > 1 && (!NumTraits::IsInteger)) { m.tail(size-1).setLinSpaced(low, high); VERIFY_IS_APPROX(m(size-1), high); } // regression test for bug 1383 (LinSpaced with empty size/range) { Index n0 = VectorType::SizeAtCompileTime==Dynamic ? 0 : VectorType::SizeAtCompileTime; low = internal::random(); m = VectorType::LinSpaced(n0,low,low-RealScalar(1)); VERIFY(m.size()==n0); if(VectorType::SizeAtCompileTime==Dynamic) { VERIFY_IS_EQUAL(VectorType::LinSpaced(n0,0,Scalar(n0-1)).sum(),Scalar(0)); VERIFY_IS_EQUAL(VectorType::LinSpaced(n0,low,low-RealScalar(1)).sum(),Scalar(0)); } m.setLinSpaced(n0,0,Scalar(n0-1)); VERIFY(m.size()==n0); m.setLinSpaced(n0,low,low-RealScalar(1)); VERIFY(m.size()==n0); // empty range only: VERIFY_IS_APPROX(VectorType::LinSpaced(size,low,low),VectorType::Constant(size,low)); m.setLinSpaced(size,low,low); VERIFY_IS_APPROX(m,VectorType::Constant(size,low)); if(NumTraits::IsInteger) { VERIFY_IS_APPROX( VectorType::LinSpaced(size,low,low+Scalar(size-1)), VectorType::LinSpaced(size,low+Scalar(size-1),low).reverse() ); if(VectorType::SizeAtCompileTime==Dynamic) { // Check negative multiplicator path: for(Index k=1; k<5; ++k) VERIFY_IS_APPROX( VectorType::LinSpaced(size,low,low+Scalar((size-1)*k)), VectorType::LinSpaced(size,low+Scalar((size-1)*k),low).reverse() ); // Check negative divisor path: for(Index k=1; k<5; ++k) VERIFY_IS_APPROX( VectorType::LinSpaced(size*k,low,low+Scalar(size-1)), VectorType::LinSpaced(size*k,low+Scalar(size-1),low).reverse() ); } } } // test setUnit() if(m.size()>0) { for(Index k=0; k<10; ++k) { Index i = internal::random(0,m.size()-1); m.setUnit(i); VERIFY_IS_APPROX( m, VectorType::Unit(m.size(), i) ); } if(VectorType::SizeAtCompileTime==Dynamic) { Index i = internal::random(0,2*m.size()-1); m.setUnit(2*m.size(),i); VERIFY_IS_APPROX( m, VectorType::Unit(m.size(),i) ); } } } template void testMatrixType(const MatrixType& m) { using std::abs; const Index rows = m.rows(); const Index cols = m.cols(); typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; Scalar s1; do { s1 = internal::random(); } while(abs(s1)::IsInteger)); MatrixType A; A.setIdentity(rows, cols); VERIFY(equalsIdentity(A)); VERIFY(equalsIdentity(MatrixType::Identity(rows, cols))); A = MatrixType::Constant(rows,cols,s1); Index i = internal::random(0,rows-1); Index j = internal::random(0,cols-1); VERIFY_IS_APPROX( MatrixType::Constant(rows,cols,s1)(i,j), s1 ); VERIFY_IS_APPROX( MatrixType::Constant(rows,cols,s1).coeff(i,j), s1 ); VERIFY_IS_APPROX( A(i,j), s1 ); } template void bug79() { // Assignment of a RowVectorXd to a MatrixXd (regression test for bug #79). VERIFY( (MatrixXd(RowVectorXd::LinSpaced(3, 0, 1)) - RowVector3d(0, 0.5, 1)).norm() < std::numeric_limits::epsilon() ); } template void bug1630() { Array4d x4 = Array4d::LinSpaced(0.0, 1.0); Array3d x3(Array4d::LinSpaced(0.0, 1.0).head(3)); VERIFY_IS_APPROX(x4.head(3), x3); } template void nullary_overflow() { // Check possible overflow issue int n = 60000; ArrayXi a1(n), a2(n); a1.setLinSpaced(n, 0, n-1); for(int i=0; i void nullary_internal_logic() { // check some internal logic VERIFY(( internal::has_nullary_operator >::value )); VERIFY(( !internal::has_unary_operator >::value )); VERIFY(( !internal::has_binary_operator >::value )); VERIFY(( internal::functor_has_linear_access >::ret )); VERIFY(( !internal::has_nullary_operator >::value )); VERIFY(( !internal::has_unary_operator >::value )); VERIFY(( internal::has_binary_operator >::value )); VERIFY(( !internal::functor_has_linear_access >::ret )); VERIFY(( !internal::has_nullary_operator >::value )); VERIFY(( internal::has_unary_operator >::value )); VERIFY(( !internal::has_binary_operator >::value )); VERIFY(( internal::functor_has_linear_access >::ret )); // Regression unit test for a weird MSVC bug. // Search "nullary_wrapper_workaround_msvc" in CoreEvaluators.h for the details. // See also traits::match. { MatrixXf A = MatrixXf::Random(3,3); Ref R = 2.0*A; VERIFY_IS_APPROX(R, A+A); Ref R1 = MatrixXf::Random(3,3)+A; VectorXi V = VectorXi::Random(3); Ref R2 = VectorXi::LinSpaced(3,1,3)+V; VERIFY_IS_APPROX(R2, V+Vector3i(1,2,3)); VERIFY(( internal::has_nullary_operator >::value )); VERIFY(( !internal::has_unary_operator >::value )); VERIFY(( !internal::has_binary_operator >::value )); VERIFY(( internal::functor_has_linear_access >::ret )); VERIFY(( !internal::has_nullary_operator >::value )); VERIFY(( internal::has_unary_operator >::value )); VERIFY(( !internal::has_binary_operator >::value )); VERIFY(( internal::functor_has_linear_access >::ret )); } } EIGEN_DECLARE_TEST(nullary) { CALL_SUBTEST_1( testMatrixType(Matrix2d()) ); CALL_SUBTEST_2( testMatrixType(MatrixXcf(internal::random(1,300),internal::random(1,300))) ); CALL_SUBTEST_3( testMatrixType(MatrixXf(internal::random(1,300),internal::random(1,300))) ); for(int i = 0; i < g_repeat*10; i++) { CALL_SUBTEST_3( testVectorType(VectorXcd(internal::random(1,30000))) ); CALL_SUBTEST_4( testVectorType(VectorXd(internal::random(1,30000))) ); CALL_SUBTEST_5( testVectorType(Vector4d()) ); // regression test for bug 232 CALL_SUBTEST_6( testVectorType(Vector3d()) ); CALL_SUBTEST_7( testVectorType(VectorXf(internal::random(1,30000))) ); CALL_SUBTEST_8( testVectorType(Vector3f()) ); CALL_SUBTEST_8( testVectorType(Vector4f()) ); CALL_SUBTEST_8( testVectorType(Matrix()) ); CALL_SUBTEST_8( testVectorType(Matrix()) ); CALL_SUBTEST_9( testVectorType(VectorXi(internal::random(1,10))) ); CALL_SUBTEST_9( testVectorType(VectorXi(internal::random(9,300))) ); CALL_SUBTEST_9( testVectorType(Matrix()) ); } CALL_SUBTEST_6( bug79<0>() ); CALL_SUBTEST_6( bug1630<0>() ); CALL_SUBTEST_9( nullary_overflow<0>() ); CALL_SUBTEST_10( nullary_internal_logic<0>() ); } ================================================ FILE: VO_Module/thirdparty/eigen/test/num_dimensions.cpp ================================================ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2018 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include template void check_dim(const Xpr& ) { STATIC_CHECK( Xpr::NumDimensions == ExpectedDim ); } #if EIGEN_HAS_CXX11 template